summaryrefslogtreecommitdiff
path: root/test/CodeGen/RISCV/frame.ll
blob: 0c9f59fd302c9b6b7f60d20709415c3ccdad1de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
; RUN:   | FileCheck -check-prefix=RV32I %s

%struct.key_t = type { i32, [16 x i8] }

define i32 @test() nounwind {
; RV32I-LABEL: test:
; RV32I:       # %bb.0:
; RV32I-NEXT:    addi sp, sp, -32
; RV32I-NEXT:    sw ra, 28(sp)
; RV32I-NEXT:    sw s0, 24(sp)
; RV32I-NEXT:    addi s0, sp, 32
; RV32I-NEXT:    sw zero, -16(s0)
; RV32I-NEXT:    sw zero, -20(s0)
; RV32I-NEXT:    sw zero, -24(s0)
; RV32I-NEXT:    sw zero, -28(s0)
; RV32I-NEXT:    sw zero, -32(s0)
; RV32I-NEXT:    lui a0, %hi(test1)
; RV32I-NEXT:    addi a1, a0, %lo(test1)
; RV32I-NEXT:    addi a0, s0, -28
; RV32I-NEXT:    jalr a1
; RV32I-NEXT:    mv a0, zero
; RV32I-NEXT:    lw s0, 24(sp)
; RV32I-NEXT:    lw ra, 28(sp)
; RV32I-NEXT:    addi sp, sp, 32
; RV32I-NEXT:    ret
  %key = alloca %struct.key_t, align 4
  %1 = bitcast %struct.key_t* %key to i8*
  call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 20, i32 4, i1 false)
  %2 = getelementptr inbounds %struct.key_t, %struct.key_t* %key, i64 0, i32 1, i64 0
  call void @test1(i8* %2) #3
  ret i32 0
}

declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1)

declare void @test1(i8*)