Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-sadde-rv32.mir

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