Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-sub-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 - \
3 # RUN: | FileCheck %s
4 ---
5 name: sub_i8
6 body: |
7 bb.0.entry:
8 ; CHECK-LABEL: name: sub_i8
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
11 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
12 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
13 ; CHECK-NEXT: PseudoRET implicit $x10
14 %0:_(s64) = COPY $x10
15 %1:_(s64) = COPY $x11
16 %2:_(s8) = G_TRUNC %0(s64)
17 %3:_(s8) = G_TRUNC %1(s64)
18 %4:_(s8) = G_SUB %2, %3
19 %5:_(s64) = G_ANYEXT %4(s8)
20 $x10 = COPY %5(s64)
21 PseudoRET implicit $x10
22
23 ...
24 ---
25 name: sub_i15
26 body: |
27 bb.0.entry:
28 ; CHECK-LABEL: name: sub_i15
29 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
30 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
31 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
32 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
33 ; CHECK-NEXT: PseudoRET implicit $x10
34 %0:_(s64) = COPY $x10
35 %1:_(s64) = COPY $x11
36 %2:_(s15) = G_TRUNC %0(s64)
37 %3:_(s15) = G_TRUNC %1(s64)
38 %4:_(s15) = G_SUB %2, %3
39 %5:_(s64) = G_ANYEXT %4(s15)
40 $x10 = COPY %5(s64)
41 PseudoRET implicit $x10
42
43 ...
44 ---
45 name: sub_i16
46 body: |
47 bb.0.entry:
48 ; CHECK-LABEL: name: sub_i16
49 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
50 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
51 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
52 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
53 ; CHECK-NEXT: PseudoRET implicit $x10
54 %0:_(s64) = COPY $x10
55 %1:_(s64) = COPY $x11
56 %2:_(s16) = G_TRUNC %0(s64)
57 %3:_(s16) = G_TRUNC %1(s64)
58 %4:_(s16) = G_SUB %2, %3
59 %5:_(s64) = G_ANYEXT %4(s16)
60 $x10 = COPY %5(s64)
61 PseudoRET implicit $x10
62
63 ...
64 ---
65 name: sub_i32
66 body: |
67 bb.0.entry:
68 ; CHECK-LABEL: name: sub_i32
69 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
70 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
71 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
72 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[SUB]], 32
73 ; CHECK-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
74 ; CHECK-NEXT: PseudoRET implicit $x10
75 %0:_(s64) = COPY $x10
76 %1:_(s64) = COPY $x11
77 %2:_(s32) = G_TRUNC %0(s64)
78 %3:_(s32) = G_TRUNC %1(s64)
79 %4:_(s32) = G_SUB %2, %3
80 %5:_(s64) = G_ANYEXT %4(s32)
81 $x10 = COPY %5(s64)
82 PseudoRET implicit $x10
83
84 ...
85 ---
86 name: sub_i64
87 body: |
88 bb.0.entry:
89 ; CHECK-LABEL: name: sub_i64
90 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
91 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
92 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
93 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
94 ; CHECK-NEXT: PseudoRET implicit $x10
95 %0:_(s64) = COPY $x10
96 %1:_(s64) = COPY $x11
97 %2:_(s64) = G_SUB %0, %1
98 $x10 = COPY %2(s64)
99 PseudoRET implicit $x10
100
101 ...
102 ---
103 name: sub_i72
104 body: |
105 bb.0.entry:
106 ; CHECK-LABEL: name: sub_i72
107 ; CHECK: %x00:_(s64) = COPY $x10
108 ; CHECK-NEXT: %x01:_(s64) = COPY $x11
109 ; CHECK-NEXT: %y00:_(s64) = COPY $x12
110 ; CHECK-NEXT: %y01:_(s64) = COPY $x13
111 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %x00, %y00
112 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), %x00(s64), %y00
113 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB %x01, %y01
114 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[SUB1]], [[ICMP]]
115 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
116 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s64)
117 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
118 %x00:_(s64) = COPY $x10
119 %x01:_(s64) = COPY $x11
120 %y00:_(s64) = COPY $x12
121 %y01:_(s64) = COPY $x13
122 %x0:_(s128) = G_MERGE_VALUES %x00(s64), %x01
123 %y0:_(s128) = G_MERGE_VALUES %y00(s64), %y01
124 %x:_(s72) = G_TRUNC %x0(s128)
125 %y:_(s72) = G_TRUNC %y0(s128)
126 %z:_(s72) = G_SUB %x, %y
127 %z0:_(s128) = G_ANYEXT %z(s72)
128 %z00:_(s64), %z01:_(s64) = G_UNMERGE_VALUES %z0(s128)
129 $x10 = COPY %z00(s64)
130 $x11 = COPY %z01(s64)
131 PseudoRET implicit $x10, implicit $x11
132
133 ...
134 ---
135 name: sub_i128
136 body: |
137 bb.0.entry:
138 ; CHECK-LABEL: name: sub_i128
139 ; CHECK: %lo1:_(s64) = COPY $x10
140 ; CHECK-NEXT: %hi1:_(s64) = COPY $x11
141 ; CHECK-NEXT: %lo2:_(s64) = COPY $x12
142 ; CHECK-NEXT: %hi2:_(s64) = COPY $x13
143 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %lo1, %lo2
144 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), %lo1(s64), %lo2
145 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB %hi1, %hi2
146 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[SUB1]], [[ICMP]]
147 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
148 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s64)
149 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
150 %lo1:_(s64) = COPY $x10
151 %hi1:_(s64) = COPY $x11
152 %lo2:_(s64) = COPY $x12
153 %hi2:_(s64) = COPY $x13
154 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)
155 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)
156 %y:_(s128) = G_SUB %x1, %x2
157 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)
158 $x10 = COPY %loy(s64)
159 $x11 = COPY %hiy(s64)
160 PseudoRET implicit $x10, implicit $x11
161
162 ...
163 ---
164 name: sub_i192
165 body: |
166 bb.0.entry:
167 ; CHECK-LABEL: name: sub_i192
168 ; CHECK: %lo1:_(s64) = COPY $x10
169 ; CHECK-NEXT: %mid1:_(s64) = COPY $x11
170 ; CHECK-NEXT: %hi1:_(s64) = COPY $x12
171 ; CHECK-NEXT: %lo2:_(s64) = COPY $x13
172 ; CHECK-NEXT: %mid2:_(s64) = COPY $x14
173 ; CHECK-NEXT: %hi2:_(s64) = COPY $x15
174 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %lo1, %lo2
175 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), %lo1(s64), %lo2
176 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB %mid1, %mid2
177 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[SUB1]](s64), %mid1
178 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[SUB1]], [[ICMP]]
179 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
180 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[SUB1]](s64), [[C]]
181 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP2]], [[ICMP]]
182 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[ICMP1]], [[AND]]
183 ; CHECK-NEXT: [[SUB3:%[0-9]+]]:_(s64) = G_SUB %hi1, %hi2
184 ; CHECK-NEXT: [[SUB4:%[0-9]+]]:_(s64) = G_SUB [[SUB3]], [[OR]]
185 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
186 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s64)
187 ; CHECK-NEXT: $x12 = COPY [[SUB4]](s64)
188 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
189 %lo1:_(s64) = COPY $x10
190 %mid1:_(s64) = COPY $x11
191 %hi1:_(s64) = COPY $x12
192 %lo2:_(s64) = COPY $x13
193 %mid2:_(s64) = COPY $x14
194 %hi2:_(s64) = COPY $x15
195 %x1:_(s192) = G_MERGE_VALUES %lo1(s64), %mid1(s64), %hi1(s64)
196 %x2:_(s192) = G_MERGE_VALUES %lo2(s64), %mid2(s64), %hi2(s64)
197 %y:_(s192) = G_SUB %x1, %x2
198 %lo:_(s64), %mid:_(s64), %hi:_(s64) = G_UNMERGE_VALUES %y(s192)
199 $x10 = COPY %lo(s64)
200 $x11 = COPY %mid(s64)
201 $x12 = COPY %hi(s64)
202 PseudoRET implicit $x10, implicit $x11, implicit $x12
203
204 ...