|
1 |
| -; REQUIRES: expensive_checks |
2 |
| -; RUN: llc --mtriple=loongarch64 --frame-pointer=none --mattr=+lasx < %s |
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 |
| 2 | +; RUN: llc --mtriple=loongarch64 --frame-pointer=none --mattr=+lasx < %s | FileCheck %s |
3 | 3 |
|
4 |
| -; XFAIL: * |
| 4 | +;; This test is checking that when a function allows stack realignment and |
| 5 | +;; realignment needs were not detected before register allocation (at this |
| 6 | +;; point, fp is not preserved), but realignment is required during register |
| 7 | +;; allocation, the stack should not undergo realignment. |
5 | 8 |
|
6 |
| -;; FIXME: This test will crash with expensive check. The subsequent patch will |
7 |
| -;; address and fix this issue. |
| 9 | +;; Ensure that the `bstrins.d $sp, $zero, n, 0` instruction is not generated. |
| 10 | +;; n = log2(realign_size) - 1 |
8 | 11 |
|
9 | 12 | %struct.S = type { [64 x i16] }
|
10 | 13 |
|
11 | 14 | define dso_local noundef signext i32 @main() nounwind {
|
| 15 | +; CHECK-LABEL: main: |
| 16 | +; CHECK: # %bb.0: # %entry |
| 17 | +; CHECK-NEXT: addi.d $sp, $sp, -272 |
| 18 | +; CHECK-NEXT: st.d $ra, $sp, 264 # 8-byte Folded Spill |
| 19 | +; CHECK-NEXT: st.d $fp, $sp, 256 # 8-byte Folded Spill |
| 20 | +; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_0) |
| 21 | +; CHECK-NEXT: addi.d $a0, $a0, %pc_lo12(.LCPI0_0) |
| 22 | +; CHECK-NEXT: xvld $xr0, $a0, 0 |
| 23 | +; CHECK-NEXT: xvst $xr0, $sp, 96 # 32-byte Folded Spill |
| 24 | +; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_1) |
| 25 | +; CHECK-NEXT: addi.d $a0, $a0, %pc_lo12(.LCPI0_1) |
| 26 | +; CHECK-NEXT: xvld $xr1, $a0, 0 |
| 27 | +; CHECK-NEXT: xvst $xr1, $sp, 64 # 32-byte Folded Spill |
| 28 | +; CHECK-NEXT: xvst $xr1, $sp, 224 |
| 29 | +; CHECK-NEXT: xvst $xr0, $sp, 192 |
| 30 | +; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_2) |
| 31 | +; CHECK-NEXT: addi.d $a0, $a0, %pc_lo12(.LCPI0_2) |
| 32 | +; CHECK-NEXT: xvld $xr0, $a0, 0 |
| 33 | +; CHECK-NEXT: xvst $xr0, $sp, 32 # 32-byte Folded Spill |
| 34 | +; CHECK-NEXT: xvst $xr0, $sp, 160 |
| 35 | +; CHECK-NEXT: pcalau12i $a0, %pc_hi20(.LCPI0_3) |
| 36 | +; CHECK-NEXT: addi.d $a0, $a0, %pc_lo12(.LCPI0_3) |
| 37 | +; CHECK-NEXT: xvld $xr0, $a0, 0 |
| 38 | +; CHECK-NEXT: xvst $xr0, $sp, 0 # 32-byte Folded Spill |
| 39 | +; CHECK-NEXT: xvst $xr0, $sp, 128 |
| 40 | +; CHECK-NEXT: addi.d $fp, $sp, 128 |
| 41 | +; CHECK-NEXT: move $a0, $fp |
| 42 | +; CHECK-NEXT: bl %plt(foo) |
| 43 | +; CHECK-NEXT: xvld $xr0, $sp, 64 # 32-byte Folded Reload |
| 44 | +; CHECK-NEXT: xvst $xr0, $sp, 224 |
| 45 | +; CHECK-NEXT: xvld $xr0, $sp, 96 # 32-byte Folded Reload |
| 46 | +; CHECK-NEXT: xvst $xr0, $sp, 192 |
| 47 | +; CHECK-NEXT: xvld $xr0, $sp, 32 # 32-byte Folded Reload |
| 48 | +; CHECK-NEXT: xvst $xr0, $sp, 160 |
| 49 | +; CHECK-NEXT: xvld $xr0, $sp, 0 # 32-byte Folded Reload |
| 50 | +; CHECK-NEXT: xvst $xr0, $sp, 128 |
| 51 | +; CHECK-NEXT: move $a0, $fp |
| 52 | +; CHECK-NEXT: bl %plt(bar) |
| 53 | +; CHECK-NEXT: move $a0, $zero |
| 54 | +; CHECK-NEXT: ld.d $fp, $sp, 256 # 8-byte Folded Reload |
| 55 | +; CHECK-NEXT: ld.d $ra, $sp, 264 # 8-byte Folded Reload |
| 56 | +; CHECK-NEXT: addi.d $sp, $sp, 272 |
| 57 | +; CHECK-NEXT: ret |
12 | 58 | entry:
|
13 | 59 | %s = alloca %struct.S, align 2
|
14 | 60 | call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s)
|
|
0 commit comments