1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
8 ; CHECK-LABEL: name: add_i7
9 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
11 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
12 ; CHECK-NEXT: $x10 = COPY [[ADD]](s32)
13 ; CHECK-NEXT: PseudoRET implicit $x10
16 %2:_(s7) = G_TRUNC %0(s32)
17 %3:_(s7) = G_TRUNC %1(s32)
18 %4:_(s7) = G_ADD %2, %3
19 %5:_(s32) = G_ANYEXT %4(s7)
21 PseudoRET implicit $x10
28 ; CHECK-LABEL: name: add_i8
29 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
30 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
31 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
32 ; CHECK-NEXT: $x10 = COPY [[ADD]](s32)
33 ; CHECK-NEXT: PseudoRET implicit $x10
36 %2:_(s8) = G_TRUNC %0(s32)
37 %3:_(s8) = G_TRUNC %1(s32)
38 %4:_(s8) = G_ADD %2, %3
39 %5:_(s32) = G_ANYEXT %4(s8)
41 PseudoRET implicit $x10
48 ; CHECK-LABEL: name: add_i16
49 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
50 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
51 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
52 ; CHECK-NEXT: $x10 = COPY [[ADD]](s32)
53 ; CHECK-NEXT: PseudoRET implicit $x10
56 %2:_(s16) = G_TRUNC %0(s32)
57 %3:_(s16) = G_TRUNC %1(s32)
58 %4:_(s16) = G_ADD %2, %3
59 %5:_(s32) = G_ANYEXT %4(s16)
61 PseudoRET implicit $x10
68 ; CHECK-LABEL: name: add_i32
69 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
70 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
71 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
72 ; CHECK-NEXT: $x10 = COPY [[ADD]](s32)
73 ; CHECK-NEXT: PseudoRET implicit $x10
76 %2:_(s32) = G_ADD %0, %1
78 PseudoRET implicit $x10
85 ; CHECK-LABEL: name: add_i48
86 ; CHECK: %xlo:_(s32) = COPY $x10
87 ; CHECK-NEXT: %xhi:_(s32) = COPY $x11
88 ; CHECK-NEXT: %ylo:_(s32) = COPY $x12
89 ; CHECK-NEXT: %yhi:_(s32) = COPY $x13
90 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD %xlo, %ylo
91 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), %ylo
92 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
93 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD %xhi, %yhi
94 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD1]], [[ICMP]]
95 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[ADD2]](s32)
96 ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
97 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
98 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
99 %xlo:_(s32) = COPY $x10
100 %xhi:_(s32) = COPY $x11
101 %ylo:_(s32) = COPY $x12
102 %yhi:_(s32) = COPY $x13
103 %x0:_(s64) = G_MERGE_VALUES %xlo(s32), %xhi(s32)
104 %y0:_(s64) = G_MERGE_VALUES %ylo(s32), %yhi(s32)
105 %x:_(s48) = G_TRUNC %x0(s64)
106 %y:_(s48) = G_TRUNC %y0(s64)
107 %z:_(s48) = G_ADD %x, %y
108 %z0:_(s64) = G_ANYEXT %z(s48)
109 %zlo:_(s32), %zhi:_(s32) = G_UNMERGE_VALUES %z0(s64)
110 $x10 = COPY %zlo(s32)
111 $x11 = COPY %zhi(s32)
112 PseudoRET implicit $x10, implicit $x11
119 ; CHECK-LABEL: name: add_i64
120 ; CHECK: %lo1:_(s32) = COPY $x10
121 ; CHECK-NEXT: %hi1:_(s32) = COPY $x11
122 ; CHECK-NEXT: %lo2:_(s32) = COPY $x12
123 ; CHECK-NEXT: %hi2:_(s32) = COPY $x13
124 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD %lo1, %lo2
125 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), %lo2
126 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
127 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD %hi1, %hi2
128 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD1]], [[ICMP]]
129 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[ADD2]](s32)
130 ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
131 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
132 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
133 %lo1:_(s32) = COPY $x10
134 %hi1:_(s32) = COPY $x11
135 %lo2:_(s32) = COPY $x12
136 %hi2:_(s32) = COPY $x13
137 %x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32)
138 %x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32)
139 %y:_(s64) = G_ADD %x1, %x2
140 %loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64)
141 $x10 = COPY %loy(s32)
142 $x11 = COPY %hiy(s32)
143 PseudoRET implicit $x10, implicit $x11
150 ; CHECK-LABEL: name: add_i96
151 ; CHECK: %lo1:_(s32) = COPY $x10
152 ; CHECK-NEXT: %mid1:_(s32) = COPY $x11
153 ; CHECK-NEXT: %hi1:_(s32) = COPY $x12
154 ; CHECK-NEXT: %lo2:_(s32) = COPY $x13
155 ; CHECK-NEXT: %mid2:_(s32) = COPY $x14
156 ; CHECK-NEXT: %hi2:_(s32) = COPY $x15
157 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD %lo1, %lo2
158 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), %lo2
159 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
160 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD %mid1, %mid2
161 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD1]](s32), %mid1
162 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD1]], [[ICMP]]
163 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
164 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[ADD2]](s32), [[C]]
165 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP2]], [[ICMP]]
166 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[ICMP1]], [[AND]]
167 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[ADD2]](s32)
168 ; CHECK-NEXT: [[ADD3:%[0-9]+]]:_(s32) = G_ADD %hi1, %hi2
169 ; CHECK-NEXT: [[ADD4:%[0-9]+]]:_(s32) = G_ADD [[ADD3]], [[OR]]
170 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ADD4]](s32)
171 ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
172 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
173 ; CHECK-NEXT: $x12 = COPY [[COPY2]](s32)
174 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
175 %lo1:_(s32) = COPY $x10
176 %mid1:_(s32) = COPY $x11
177 %hi1:_(s32) = COPY $x12
178 %lo2:_(s32) = COPY $x13
179 %mid2:_(s32) = COPY $x14
180 %hi2:_(s32) = COPY $x15
181 %x1:_(s96) = G_MERGE_VALUES %lo1(s32), %mid1(s32), %hi1(s32)
182 %x2:_(s96) = G_MERGE_VALUES %lo2(s32), %mid2(s32), %hi2(s32)
183 %y:_(s96) = G_ADD %x1, %x2
184 %lo:_(s32), %mid:_(s32), %hi:_(s32) = G_UNMERGE_VALUES %y(s96)
186 $x11 = COPY %mid(s32)
188 PseudoRET implicit $x10, implicit $x11, implicit $x12