Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-ssube-rv64.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - | FileCheck %s
3
4 ---
5 name: ssube_i8
6 body: |
7 bb.1:
8 liveins: $x10, $x11, $x12
9
10 ; CHECK-LABEL: name: ssube_i8
11 ; CHECK: liveins: $x10, $x11, $x12
12 ; CHECK-NEXT: {{ $}}
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
14 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
15 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
16 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
17 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
18 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
19 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
20 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
21 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[ASHR]], [[ASHR1]]
22 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
23 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C1]]
24 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[SUB]], [[AND]]
25 ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[SUB1]], [[C]](s64)
26 ; CHECK-NEXT: [[ASHR2:%[0-9]+]]:_(s64) = G_ASHR [[SHL2]], [[C]](s64)
27 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[SUB1]](s64), [[ASHR2]]
28 ; CHECK-NEXT: $x10 = COPY [[SUB1]](s64)
29 ; CHECK-NEXT: $x11 = COPY [[ICMP]](s64)
30 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
31 %0:_(s64) = COPY $x10
32 %1:_(s8) = G_TRUNC %0(s64)
33 %2:_(s64) = COPY $x11
34 %3:_(s8) = G_TRUNC %2(s64)
35 %4:_(s64) = COPY $x12
36 %5:_(s1) = G_TRUNC %4(s64)
37 %6:_(s8), %7:_(s1) = G_SSUBE %1, %3, %5
38 %8:_(s64) = G_ANYEXT %6(s8)
39 %9:_(s64) = G_ANYEXT %7(s1)
40 $x10 = COPY %8(s64)
41 $x11 = COPY %9(s64)
42 PseudoRET implicit $x10, implicit $x11
43
44 ...
45 ---
46 name: ssube_i16
47 body: |
48 bb.1:
49 liveins: $x10, $x11, $x12
50
51 ; CHECK-LABEL: name: ssube_i16
52 ; CHECK: liveins: $x10, $x11, $x12
53 ; CHECK-NEXT: {{ $}}
54 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
55 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
56 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
57 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 48
58 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
59 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
60 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
61 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
62 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[ASHR]], [[ASHR1]]
63 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
64 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C1]]
65 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[SUB]], [[AND]]
66 ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[SUB1]], [[C]](s64)
67 ; CHECK-NEXT: [[ASHR2:%[0-9]+]]:_(s64) = G_ASHR [[SHL2]], [[C]](s64)
68 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[SUB1]](s64), [[ASHR2]]
69 ; CHECK-NEXT: $x10 = COPY [[SUB1]](s64)
70 ; CHECK-NEXT: $x11 = COPY [[ICMP]](s64)
71 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
72 %0:_(s64) = COPY $x10
73 %1:_(s16) = G_TRUNC %0(s64)
74 %2:_(s64) = COPY $x11
75 %3:_(s16) = G_TRUNC %2(s64)
76 %4:_(s64) = COPY $x12
77 %5:_(s1) = G_TRUNC %4(s64)
78 %6:_(s16), %7:_(s1) = G_SSUBE %1, %3, %5
79 %8:_(s64) = G_ANYEXT %6(s16)
80 %9:_(s64) = G_ANYEXT %7(s1)
81 $x10 = COPY %8(s64)
82 $x11 = COPY %9(s64)
83 PseudoRET implicit $x10, implicit $x11
84
85 ...
86 ---
87 name: ssube_i32
88 body: |
89 bb.1:
90 liveins: $x10, $x11, $x12
91
92 ; CHECK-LABEL: name: ssube_i32
93 ; CHECK: liveins: $x10, $x11, $x12
94 ; CHECK-NEXT: {{ $}}
95 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
96 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
97 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
98 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32
99 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32
100 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[SEXT_INREG]], [[SEXT_INREG1]]
101 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
102 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
103 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[SUB]], [[AND]]
104 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s64) = G_SEXT_INREG [[SUB1]], 32
105 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[SUB1]](s64), [[SEXT_INREG2]]
106 ; CHECK-NEXT: $x10 = COPY [[SUB1]](s64)
107 ; CHECK-NEXT: $x11 = COPY [[ICMP]](s64)
108 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
109 %0:_(s64) = COPY $x10
110 %1:_(s32) = G_TRUNC %0(s64)
111 %2:_(s64) = COPY $x11
112 %3:_(s32) = G_TRUNC %2(s64)
113 %4:_(s64) = COPY $x12
114 %5:_(s1) = G_TRUNC %4(s64)
115 %6:_(s32), %7:_(s1) = G_SSUBE %1, %3, %5
116 %8:_(s64) = G_ANYEXT %6(s32)
117 %9:_(s64) = G_ANYEXT %7(s1)
118 $x10 = COPY %8(s64)
119 $x11 = COPY %9(s64)
120 PseudoRET implicit $x10, implicit $x11
121
122 ...
123 ---
124 name: ssube_i64
125 body: |
126 bb.1:
127 liveins: $x10, $x11, $x12
128
129 ; CHECK-LABEL: name: ssube_i64
130 ; CHECK: liveins: $x10, $x11, $x12
131 ; CHECK-NEXT: {{ $}}
132 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
133 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
134 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
135 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
136 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
137 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY1]], [[AND]]
138 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[ADD]]
139 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY [[SUB]](s64)
140 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY]], [[COPY1]]
141 ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s64) = G_XOR [[COPY]], [[SUB]]
142 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[XOR1]]
143 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
144 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), [[AND1]](s64), [[C1]]
145 ; CHECK-NEXT: $x10 = COPY [[COPY3]](s64)
146 ; CHECK-NEXT: $x11 = COPY [[ICMP]](s64)
147 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
148 %0:_(s64) = COPY $x10
149 %1:_(s64) = COPY $x11
150 %2:_(s64) = COPY $x12
151 %3:_(s1) = G_TRUNC %2(s64)
152 %4:_(s64), %5:_(s1) = G_SSUBE %0, %1, %3
153 %6:_(s64) = G_ANYEXT %5(s1)
154 $x10 = COPY %4(s64)
155 $x11 = COPY %6(s64)
156 PseudoRET implicit $x10, implicit $x11
157
158 ...
159 ---
160 name: ssube_i128
161 body: |
162 bb.1:
163 liveins: $x10, $x11, $x12, $x13, $x14
164
165 ; CHECK-LABEL: name: ssube_i128
166 ; CHECK: liveins: $x10, $x11, $x12, $x13, $x14
167 ; CHECK-NEXT: {{ $}}
168 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
169 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
170 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
171 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x13
172 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY $x14
173 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
174 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
175 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
176 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY4]], [[C]]
177 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[DEF]], [[C1]]
178 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY2]], [[AND]]
179 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[ADD]](s64), [[AND]]
180 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s64) = COPY [[ADD]](s64)
181 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[COPY3]], [[AND1]]
182 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s64) = G_ADD [[ADD1]], [[ICMP]]
183 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s64) = COPY [[ADD2]](s64)
184 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY5]]
185 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[COPY]](s64), [[COPY5]]
186 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[COPY1]], [[COPY6]]
187 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[SUB1]], [[ICMP1]]
188 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY]], [[COPY2]]
189 ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s64) = G_XOR [[COPY1]], [[COPY3]]
190 ; CHECK-NEXT: [[XOR2:%[0-9]+]]:_(s64) = G_XOR [[COPY]], [[SUB]]
191 ; CHECK-NEXT: [[XOR3:%[0-9]+]]:_(s64) = G_XOR [[COPY1]], [[SUB2]]
192 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[XOR2]]
193 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND [[XOR1]], [[XOR3]]
194 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[AND2]](s64), [[C1]]
195 ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), [[AND3]](s64), [[C1]]
196 ; CHECK-NEXT: [[ICMP4:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND3]](s64), [[C1]]
197 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[ICMP2]](s64)
198 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[ICMP3]](s64)
199 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP4]](s64), [[TRUNC]], [[TRUNC1]]
200 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
201 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
202 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s64)
203 ; CHECK-NEXT: $x12 = COPY [[ANYEXT]](s64)
204 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
205 %0:_(s64) = COPY $x10
206 %1:_(s64) = COPY $x11
207 %2:_(s128) = G_MERGE_VALUES %0(s64), %1(s64)
208 %3:_(s64) = COPY $x12
209 %4:_(s64) = COPY $x13
210 %5:_(s128) = G_MERGE_VALUES %3(s64), %4(s64)
211 %6:_(s64) = COPY $x14
212 %7:_(s1) = G_TRUNC %6(s64)
213 %8:_(s128), %9:_(s1) = G_SSUBE %2, %5, %7
214 %10:_(s64), %11:_(s64) = G_UNMERGE_VALUES %8(s128)
215 %12:_(s64) = G_ANYEXT %9(s1)
216 $x10 = COPY %10(s64)
217 $x11 = COPY %11(s64)
218 $x12 = COPY %12(s64)
219 PseudoRET implicit $x10, implicit $x11, implicit $x12
220 ...