81 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 42; RUN: llc --mtriple=loongarch64 --frame-pointer=none --mattr=+lasx < %s | FileCheck %s3 4;; This test is checking that when a function allows stack realignment and5;; realignment needs were not detected before register allocation (at this6;; point, fp is not preserved), but realignment is required during register7;; allocation, the stack should not undergo realignment.8 9;; Ensure that the `bstrins.d $sp, $zero, n, 0` instruction is not generated.10;; n = log2(realign_size) - 111 12%struct.S = type { [64 x i16] }13 14define dso_local noundef signext i32 @main() nounwind {15; CHECK-LABEL: main:16; CHECK: # %bb.0: # %entry17; CHECK-NEXT: addi.d $sp, $sp, -28818; CHECK-NEXT: st.d $ra, $sp, 280 # 8-byte Folded Spill19; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_0)20; CHECK-NEXT: xvld $xr0, $a0, %pc_lo12(.LCPI0_0)21; CHECK-NEXT: xvst $xr0, $sp, 112 # 32-byte Folded Spill22; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_1)23; CHECK-NEXT: xvld $xr1, $a0, %pc_lo12(.LCPI0_1)24; CHECK-NEXT: xvst $xr1, $sp, 80 # 32-byte Folded Spill25; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_2)26; CHECK-NEXT: xvld $xr2, $a0, %pc_lo12(.LCPI0_2)27; CHECK-NEXT: xvst $xr2, $sp, 48 # 32-byte Folded Spill28; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_3)29; CHECK-NEXT: xvld $xr3, $a0, %pc_lo12(.LCPI0_3)30; CHECK-NEXT: xvst $xr3, $sp, 16 # 32-byte Folded Spill31; CHECK-NEXT: xvst $xr0, $sp, 15232; CHECK-NEXT: xvst $xr1, $sp, 18433; CHECK-NEXT: xvst $xr2, $sp, 21634; CHECK-NEXT: xvst $xr3, $sp, 24835; CHECK-NEXT: addi.d $a0, $sp, 15236; CHECK-NEXT: pcaddu18i $ra, %call36(foo)37; CHECK-NEXT: jirl $ra, $ra, 038; CHECK-NEXT: xvld $xr0, $sp, 112 # 32-byte Folded Reload39; CHECK-NEXT: xvst $xr0, $sp, 15240; CHECK-NEXT: xvld $xr0, $sp, 80 # 32-byte Folded Reload41; CHECK-NEXT: xvst $xr0, $sp, 18442; CHECK-NEXT: xvld $xr0, $sp, 48 # 32-byte Folded Reload43; CHECK-NEXT: xvst $xr0, $sp, 21644; CHECK-NEXT: xvld $xr0, $sp, 16 # 32-byte Folded Reload45; CHECK-NEXT: xvst $xr0, $sp, 24846; CHECK-NEXT: addi.d $a0, $sp, 15247; CHECK-NEXT: pcaddu18i $ra, %call36(bar)48; CHECK-NEXT: jirl $ra, $ra, 049; CHECK-NEXT: move $a0, $zero50; CHECK-NEXT: ld.d $ra, $sp, 280 # 8-byte Folded Reload51; CHECK-NEXT: addi.d $sp, $sp, 28852; CHECK-NEXT: ret53entry:54 %s = alloca %struct.S, align 255 call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s)56 store <16 x i16> <i16 16384, i16 16129, i16 15874, i16 15619, i16 15364, i16 15109, i16 14854, i16 14599, i16 14344, i16 14089, i16 13834, i16 13579, i16 13324, i16 13069, i16 12814, i16 12559>, ptr %s, align 257 %0 = getelementptr inbounds [64 x i16], ptr %s, i64 0, i64 1658 store <16 x i16> <i16 12304, i16 12049, i16 11794, i16 11539, i16 11284, i16 11029, i16 10774, i16 10519, i16 10264, i16 10009, i16 9754, i16 9499, i16 9244, i16 8989, i16 8734, i16 8479>, ptr %0, align 259 %1 = getelementptr inbounds [64 x i16], ptr %s, i64 0, i64 3260 store <16 x i16> <i16 8224, i16 7969, i16 7714, i16 7459, i16 7204, i16 6949, i16 6694, i16 6439, i16 6184, i16 5929, i16 5674, i16 5419, i16 5164, i16 4909, i16 4654, i16 4399>, ptr %1, align 261 %2 = getelementptr inbounds [64 x i16], ptr %s, i64 0, i64 4862 store <16 x i16> <i16 4144, i16 3889, i16 3634, i16 3379, i16 3124, i16 2869, i16 2614, i16 2359, i16 2104, i16 1849, i16 1594, i16 1339, i16 1084, i16 829, i16 574, i16 319>, ptr %2, align 263 call void @foo(ptr noundef nonnull %s)64 store <16 x i16> <i16 16384, i16 16129, i16 15874, i16 15619, i16 15364, i16 15109, i16 14854, i16 14599, i16 14344, i16 14089, i16 13834, i16 13579, i16 13324, i16 13069, i16 12814, i16 12559>, ptr %s, align 265 %3 = getelementptr inbounds [64 x i16], ptr %s, i64 0, i64 1666 store <16 x i16> <i16 12304, i16 12049, i16 11794, i16 11539, i16 11284, i16 11029, i16 10774, i16 10519, i16 10264, i16 10009, i16 9754, i16 9499, i16 9244, i16 8989, i16 8734, i16 8479>, ptr %3, align 267 %4 = getelementptr inbounds [64 x i16], ptr %s, i64 0, i64 3268 store <16 x i16> <i16 8224, i16 7969, i16 7714, i16 7459, i16 7204, i16 6949, i16 6694, i16 6439, i16 6184, i16 5929, i16 5674, i16 5419, i16 5164, i16 4909, i16 4654, i16 4399>, ptr %4, align 269 %5 = getelementptr inbounds [64 x i16], ptr %s, i64 0, i64 4870 store <16 x i16> <i16 4144, i16 3889, i16 3634, i16 3379, i16 3124, i16 2869, i16 2614, i16 2359, i16 2104, i16 1849, i16 1594, i16 1339, i16 1084, i16 829, i16 574, i16 319>, ptr %5, align 271 call void @bar(ptr noundef nonnull %s)72 call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s)73 ret i32 074}75 76declare void @foo(ptr nocapture noundef)77declare void @bar(ptr nocapture noundef)78 79declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)80declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)81