brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 9ea5471 Raw
103 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \3; RUN:   | FileCheck %s -check-prefix=RV32I4 5declare void @notdead(ptr)6 7; These tests must ensure the stack pointer is restored using the frame8; pointer9 10define void @simple_alloca(i32 %n) nounwind {11; RV32I-LABEL: simple_alloca:12; RV32I:       # %bb.0:13; RV32I-NEXT:    addi sp, sp, -1614; RV32I-NEXT:    sw ra, 12(sp) # 4-byte Folded Spill15; RV32I-NEXT:    sw s0, 8(sp) # 4-byte Folded Spill16; RV32I-NEXT:    addi s0, sp, 1617; RV32I-NEXT:    addi a0, a0, 1518; RV32I-NEXT:    andi a0, a0, -1619; RV32I-NEXT:    sub a0, sp, a020; RV32I-NEXT:    mv sp, a021; RV32I-NEXT:    call notdead22; RV32I-NEXT:    addi sp, s0, -1623; RV32I-NEXT:    lw ra, 12(sp) # 4-byte Folded Reload24; RV32I-NEXT:    lw s0, 8(sp) # 4-byte Folded Reload25; RV32I-NEXT:    addi sp, sp, 1626; RV32I-NEXT:    ret27  %1 = alloca i8, i32 %n28  call void @notdead(ptr %1)29  ret void30}31 32define void @scoped_alloca(i32 %n) nounwind {33; RV32I-LABEL: scoped_alloca:34; RV32I:       # %bb.0:35; RV32I-NEXT:    addi sp, sp, -1636; RV32I-NEXT:    sw ra, 12(sp) # 4-byte Folded Spill37; RV32I-NEXT:    sw s0, 8(sp) # 4-byte Folded Spill38; RV32I-NEXT:    sw s1, 4(sp) # 4-byte Folded Spill39; RV32I-NEXT:    addi s0, sp, 1640; RV32I-NEXT:    mv s1, sp41; RV32I-NEXT:    addi a0, a0, 1542; RV32I-NEXT:    andi a0, a0, -1643; RV32I-NEXT:    sub a0, sp, a044; RV32I-NEXT:    mv sp, a045; RV32I-NEXT:    call notdead46; RV32I-NEXT:    mv sp, s147; RV32I-NEXT:    addi sp, s0, -1648; RV32I-NEXT:    lw ra, 12(sp) # 4-byte Folded Reload49; RV32I-NEXT:    lw s0, 8(sp) # 4-byte Folded Reload50; RV32I-NEXT:    lw s1, 4(sp) # 4-byte Folded Reload51; RV32I-NEXT:    addi sp, sp, 1652; RV32I-NEXT:    ret53  %sp = call ptr @llvm.stacksave()54  %addr = alloca i8, i32 %n55  call void @notdead(ptr %addr)56  call void @llvm.stackrestore(ptr %sp)57  ret void58}59 60declare void @func(ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)61 62; Check that outgoing arguments passed on the stack do not corrupt a63; variable-sized stack object.64define void @alloca_callframe(i32 %n) nounwind {65; RV32I-LABEL: alloca_callframe:66; RV32I:       # %bb.0:67; RV32I-NEXT:    addi sp, sp, -1668; RV32I-NEXT:    sw ra, 12(sp) # 4-byte Folded Spill69; RV32I-NEXT:    sw s0, 8(sp) # 4-byte Folded Spill70; RV32I-NEXT:    addi s0, sp, 1671; RV32I-NEXT:    addi a0, a0, 1572; RV32I-NEXT:    andi a0, a0, -1673; RV32I-NEXT:    sub a0, sp, a074; RV32I-NEXT:    mv sp, a075; RV32I-NEXT:    addi sp, sp, -1676; RV32I-NEXT:    li t0, 1277; RV32I-NEXT:    li t1, 1178; RV32I-NEXT:    li t2, 1079; RV32I-NEXT:    li t3, 980; RV32I-NEXT:    li a1, 281; RV32I-NEXT:    li a2, 382; RV32I-NEXT:    li a3, 483; RV32I-NEXT:    li a4, 584; RV32I-NEXT:    li a5, 685; RV32I-NEXT:    li a6, 786; RV32I-NEXT:    li a7, 887; RV32I-NEXT:    sw t3, 0(sp)88; RV32I-NEXT:    sw t2, 4(sp)89; RV32I-NEXT:    sw t1, 8(sp)90; RV32I-NEXT:    sw t0, 12(sp)91; RV32I-NEXT:    call func92; RV32I-NEXT:    addi sp, sp, 1693; RV32I-NEXT:    addi sp, s0, -1694; RV32I-NEXT:    lw ra, 12(sp) # 4-byte Folded Reload95; RV32I-NEXT:    lw s0, 8(sp) # 4-byte Folded Reload96; RV32I-NEXT:    addi sp, sp, 1697; RV32I-NEXT:    ret98  %1 = alloca i8, i32 %n99  call void @func(ptr %1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8,100                  i32 9, i32 10, i32 11, i32 12)101  ret void102}103