1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+f,+m,+zfh,+zvfh \
3 ; RUN: -enable-subreg-liveness=false < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+f,+m,+zfh,+zvfh < %s \
5 ; RUN: -enable-subreg-liveness=true| FileCheck %s --check-prefix=SUBREGLIVENESS
7 ; This testcase failed to compile after
8 ; c46aab01c002b7a04135b8b7f1f52d8c9ae23a58, which was reverted.
10 ; FIXME: The failure does not reproduce with -stop-before=greedy
11 ; output MIR with -start-before=greedy
13 define void @last_chance_recoloring_failure() {
14 ; CHECK-LABEL: last_chance_recoloring_failure:
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: addi sp, sp, -32
17 ; CHECK-NEXT: .cfi_def_cfa_offset 32
18 ; CHECK-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
19 ; CHECK-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
20 ; CHECK-NEXT: .cfi_offset ra, -8
21 ; CHECK-NEXT: .cfi_offset s0, -16
22 ; CHECK-NEXT: csrr a0, vlenb
23 ; CHECK-NEXT: slli a0, a0, 4
24 ; CHECK-NEXT: sub sp, sp, a0
25 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 16 * vlenb
26 ; CHECK-NEXT: li a0, 55
27 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
28 ; CHECK-NEXT: vloxseg2ei32.v v16, (a0), v8
29 ; CHECK-NEXT: csrr a0, vlenb
30 ; CHECK-NEXT: slli a0, a0, 3
31 ; CHECK-NEXT: add a0, sp, a0
32 ; CHECK-NEXT: addi a0, a0, 16
33 ; CHECK-NEXT: csrr a1, vlenb
34 ; CHECK-NEXT: slli a1, a1, 2
35 ; CHECK-NEXT: vs4r.v v16, (a0) # Unknown-size Folded Spill
36 ; CHECK-NEXT: add a0, a0, a1
37 ; CHECK-NEXT: vs4r.v v20, (a0) # Unknown-size Folded Spill
38 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
39 ; CHECK-NEXT: vmclr.m v0
40 ; CHECK-NEXT: li s0, 36
41 ; CHECK-NEXT: vsetvli zero, s0, e16, m4, ta, ma
42 ; CHECK-NEXT: vfwadd.vv v16, v8, v12, v0.t
43 ; CHECK-NEXT: addi a0, sp, 16
44 ; CHECK-NEXT: vs8r.v v16, (a0) # Unknown-size Folded Spill
45 ; CHECK-NEXT: call func
46 ; CHECK-NEXT: csrr a0, vlenb
47 ; CHECK-NEXT: slli a0, a0, 3
48 ; CHECK-NEXT: add a0, sp, a0
49 ; CHECK-NEXT: addi a0, a0, 16
50 ; CHECK-NEXT: csrr a1, vlenb
51 ; CHECK-NEXT: slli a1, a1, 2
52 ; CHECK-NEXT: vl4r.v v16, (a0) # Unknown-size Folded Reload
53 ; CHECK-NEXT: add a0, a0, a1
54 ; CHECK-NEXT: vl4r.v v20, (a0) # Unknown-size Folded Reload
55 ; CHECK-NEXT: addi a0, sp, 16
56 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
57 ; CHECK-NEXT: vsetvli zero, s0, e16, m4, ta, ma
58 ; CHECK-NEXT: vfwsub.wv v8, v24, v16
59 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, tu, mu
60 ; CHECK-NEXT: vfdiv.vv v8, v24, v8, v0.t
61 ; CHECK-NEXT: vse32.v v8, (a0)
62 ; CHECK-NEXT: csrr a0, vlenb
63 ; CHECK-NEXT: slli a0, a0, 4
64 ; CHECK-NEXT: add sp, sp, a0
65 ; CHECK-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
66 ; CHECK-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
67 ; CHECK-NEXT: addi sp, sp, 32
70 ; SUBREGLIVENESS-LABEL: last_chance_recoloring_failure:
71 ; SUBREGLIVENESS: # %bb.0: # %entry
72 ; SUBREGLIVENESS-NEXT: addi sp, sp, -32
73 ; SUBREGLIVENESS-NEXT: .cfi_def_cfa_offset 32
74 ; SUBREGLIVENESS-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
75 ; SUBREGLIVENESS-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
76 ; SUBREGLIVENESS-NEXT: .cfi_offset ra, -8
77 ; SUBREGLIVENESS-NEXT: .cfi_offset s0, -16
78 ; SUBREGLIVENESS-NEXT: csrr a0, vlenb
79 ; SUBREGLIVENESS-NEXT: slli a0, a0, 4
80 ; SUBREGLIVENESS-NEXT: sub sp, sp, a0
81 ; SUBREGLIVENESS-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 16 * vlenb
82 ; SUBREGLIVENESS-NEXT: li a0, 55
83 ; SUBREGLIVENESS-NEXT: vsetvli zero, a0, e16, m4, ta, ma
84 ; SUBREGLIVENESS-NEXT: vloxseg2ei32.v v16, (a0), v8
85 ; SUBREGLIVENESS-NEXT: csrr a0, vlenb
86 ; SUBREGLIVENESS-NEXT: slli a0, a0, 3
87 ; SUBREGLIVENESS-NEXT: add a0, sp, a0
88 ; SUBREGLIVENESS-NEXT: addi a0, a0, 16
89 ; SUBREGLIVENESS-NEXT: csrr a1, vlenb
90 ; SUBREGLIVENESS-NEXT: slli a1, a1, 2
91 ; SUBREGLIVENESS-NEXT: vs4r.v v16, (a0) # Unknown-size Folded Spill
92 ; SUBREGLIVENESS-NEXT: add a0, a0, a1
93 ; SUBREGLIVENESS-NEXT: vs4r.v v20, (a0) # Unknown-size Folded Spill
94 ; SUBREGLIVENESS-NEXT: vsetvli a0, zero, e8, m2, ta, ma
95 ; SUBREGLIVENESS-NEXT: vmclr.m v0
96 ; SUBREGLIVENESS-NEXT: li s0, 36
97 ; SUBREGLIVENESS-NEXT: vsetvli zero, s0, e16, m4, ta, ma
98 ; SUBREGLIVENESS-NEXT: vfwadd.vv v16, v8, v12, v0.t
99 ; SUBREGLIVENESS-NEXT: addi a0, sp, 16
100 ; SUBREGLIVENESS-NEXT: vs8r.v v16, (a0) # Unknown-size Folded Spill
101 ; SUBREGLIVENESS-NEXT: call func
102 ; SUBREGLIVENESS-NEXT: csrr a0, vlenb
103 ; SUBREGLIVENESS-NEXT: slli a0, a0, 3
104 ; SUBREGLIVENESS-NEXT: add a0, sp, a0
105 ; SUBREGLIVENESS-NEXT: addi a0, a0, 16
106 ; SUBREGLIVENESS-NEXT: csrr a1, vlenb
107 ; SUBREGLIVENESS-NEXT: slli a1, a1, 2
108 ; SUBREGLIVENESS-NEXT: vl4r.v v16, (a0) # Unknown-size Folded Reload
109 ; SUBREGLIVENESS-NEXT: add a0, a0, a1
110 ; SUBREGLIVENESS-NEXT: vl4r.v v20, (a0) # Unknown-size Folded Reload
111 ; SUBREGLIVENESS-NEXT: addi a0, sp, 16
112 ; SUBREGLIVENESS-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
113 ; SUBREGLIVENESS-NEXT: vsetvli zero, s0, e16, m4, ta, ma
114 ; SUBREGLIVENESS-NEXT: vfwsub.wv v8, v24, v16
115 ; SUBREGLIVENESS-NEXT: vsetvli zero, zero, e32, m8, tu, mu
116 ; SUBREGLIVENESS-NEXT: vfdiv.vv v8, v24, v8, v0.t
117 ; SUBREGLIVENESS-NEXT: vse32.v v8, (a0)
118 ; SUBREGLIVENESS-NEXT: csrr a0, vlenb
119 ; SUBREGLIVENESS-NEXT: slli a0, a0, 4
120 ; SUBREGLIVENESS-NEXT: add sp, sp, a0
121 ; SUBREGLIVENESS-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
122 ; SUBREGLIVENESS-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
123 ; SUBREGLIVENESS-NEXT: addi sp, sp, 32
124 ; SUBREGLIVENESS-NEXT: ret
126 %i = call { <vscale x 16 x half>, <vscale x 16 x half>} @llvm.riscv.vloxseg2.nxv16f16.nxv16i32.i64( <vscale x 16 x half> undef, <vscale x 16 x half> undef, ptr nonnull poison, <vscale x 16 x i32> poison, i64 55)
127 %i1 = extractvalue { <vscale x 16 x half>, <vscale x 16 x half> } %i, 0
128 %i2 = call <vscale x 16 x float> @llvm.riscv.vfwadd.mask.nxv16f32.nxv16f16.nxv16f16.i64(<vscale x 16 x float> poison, <vscale x 16 x half> poison, <vscale x 16 x half> poison, <vscale x 16 x i1> zeroinitializer, i64 7, i64 36, i64 0)
130 %i3 = call <vscale x 16 x i16> @llvm.riscv.vrgather.vv.mask.nxv16i16.i64(<vscale x 16 x i16> poison, <vscale x 16 x i16> poison, <vscale x 16 x i16> poison, <vscale x 16 x i1> poison, i64 32, i64 0)
131 %i4 = call <vscale x 16 x float> @llvm.riscv.vfwsub.w.nxv16f32.nxv16f16.i64(<vscale x 16 x float> poison, <vscale x 16 x float> %i2, <vscale x 16 x half> %i1, i64 7, i64 36)
132 %i5 = call <vscale x 16 x i16> @llvm.riscv.vssubu.mask.nxv16i16.nxv16i16.i64(<vscale x 16 x i16> %i3, <vscale x 16 x i16> %i3, <vscale x 16 x i16> poison, <vscale x 16 x i1> poison, i64 32, i64 0)
133 %i6 = call <vscale x 16 x float> @llvm.riscv.vfdiv.mask.nxv16f32.nxv16f32.i64(<vscale x 16 x float> %i4, <vscale x 16 x float> %i2, <vscale x 16 x float> poison, <vscale x 16 x i1> poison, i64 7, i64 36, i64 0)
134 call void @llvm.riscv.vse.nxv16f32.i64(<vscale x 16 x float> %i6, ptr nonnull poison, i64 36)
139 declare { <vscale x 16 x half>, <vscale x 16 x half>} @llvm.riscv.vloxseg2.nxv16f16.nxv16i32.i64( <vscale x 16 x half>, <vscale x 16 x half>, ptr nocapture, <vscale x 16 x i32>, i64)
140 declare <vscale x 16 x float> @llvm.riscv.vfwadd.mask.nxv16f32.nxv16f16.nxv16f16.i64(<vscale x 16 x float>, <vscale x 16 x half>, <vscale x 16 x half>, <vscale x 16 x i1>, i64, i64, i64 immarg)
141 declare <vscale x 16 x i16> @llvm.riscv.vrgather.vv.mask.nxv16i16.i64(<vscale x 16 x i16>, <vscale x 16 x i16>, <vscale x 16 x i16>, <vscale x 16 x i1>, i64, i64 immarg)
142 declare <vscale x 16 x float> @llvm.riscv.vfwsub.w.nxv16f32.nxv16f16.i64(<vscale x 16 x float>, <vscale x 16 x float>, <vscale x 16 x half>, i64, i64)
143 declare <vscale x 16 x i16> @llvm.riscv.vssubu.mask.nxv16i16.nxv16i16.i64(<vscale x 16 x i16>, <vscale x 16 x i16>, <vscale x 16 x i16>, <vscale x 16 x i1>, i64, i64 immarg)
144 declare <vscale x 16 x float> @llvm.riscv.vfdiv.mask.nxv16f32.nxv16f32.i64(<vscale x 16 x float>, <vscale x 16 x float>, <vscale x 16 x float>, <vscale x 16 x i1>, i64, i64, i64 immarg)
145 declare void @llvm.riscv.vse.nxv16f32.i64(<vscale x 16 x float>, ptr nocapture, i64) #3