1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
8 ; CHECK-LABEL: name: const_i8
9 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -127
10 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
11 ; CHECK-NEXT: PseudoRET implicit $x10
12 %0:_(s8) = G_CONSTANT i8 129
13 %1:_(s64) = G_ANYEXT %0(s8)
15 PseudoRET implicit $x10
22 ; CHECK-LABEL: name: const_i15
23 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 15
24 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
25 ; CHECK-NEXT: PseudoRET implicit $x10
26 %0:_(s15) = G_CONSTANT i15 15
27 %1:_(s64) = G_ANYEXT %0(s15)
29 PseudoRET implicit $x10
36 ; CHECK-LABEL: name: const_i16
37 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 767
38 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
39 ; CHECK-NEXT: PseudoRET implicit $x10
40 %0:_(s16) = G_CONSTANT i16 -64769
41 %1:_(s64) = G_ANYEXT %0(s16)
43 PseudoRET implicit $x10
50 ; CHECK-LABEL: name: const_i32
51 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -64769
52 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
53 ; CHECK-NEXT: PseudoRET implicit $x10
54 %0:_(s32) = G_CONSTANT i32 -64769
55 %1:_(s64) = G_ANYEXT %0(s32)
57 PseudoRET implicit $x10
64 ; CHECK-LABEL: name: const_i64
65 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 2147483649
66 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
67 ; CHECK-NEXT: PseudoRET implicit $x10
68 %0:_(s64) = G_CONSTANT i64 2147483649
70 PseudoRET implicit $x10
77 ; CHECK-LABEL: name: const_i72
78 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -2147483649312
79 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
80 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
81 ; CHECK-NEXT: $x11 = COPY [[C1]](s64)
82 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
83 %0:_(s72) = G_CONSTANT i72 -2147483649312
84 %1:_(s128) = G_ANYEXT %0(s72)
85 %2:_(s64), %3:_(s64) = G_UNMERGE_VALUES %1(s128)
88 PseudoRET implicit $x10, implicit $x11
95 ; CHECK-LABEL: name: const_i128
96 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 21474831289
97 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
98 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
99 ; CHECK-NEXT: $x11 = COPY [[C1]](s64)
100 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
101 %0:_(s128) = G_CONSTANT i128 21474831289
102 %1:_(s64), %2:_(s64) = G_UNMERGE_VALUES %0(s128)
105 PseudoRET implicit $x10, implicit $x11
112 ; CHECK-LABEL: name: const_i192
113 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -214772364921
114 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
115 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
116 ; CHECK-NEXT: $x11 = COPY [[C1]](s64)
117 ; CHECK-NEXT: $x12 = COPY [[C1]](s64)
118 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
119 %0:_(s192) = G_CONSTANT i192 -214772364921
120 %1:_(s64), %2:_(s64), %3:_(s64) = G_UNMERGE_VALUES %0(s192)
124 PseudoRET implicit $x10, implicit $x11, implicit $x12
131 ; CHECK-LABEL: name: const_null
132 ; CHECK: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
133 ; CHECK-NEXT: $x10 = COPY [[C]](p0)
134 ; CHECK-NEXT: PseudoRET implicit $x10
135 %0:_(p0) = G_CONSTANT i64 0
137 PseudoRET implicit $x10
144 ; CHECK-LABEL: name: const_add_i32
145 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -64769
146 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
147 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[C]]
148 ; CHECK-NEXT: $x10 = COPY [[ADD]](s64)
149 ; CHECK-NEXT: PseudoRET implicit $x10
150 %0:_(s32) = G_CONSTANT i32 -64769
151 %1:_(s64) = COPY $x10
152 %2:_(s32) = G_TRUNC %1(s64)
153 %3:_(s32) = G_ADD %2, %0
154 %4:_(s64) = G_ANYEXT %3(s32)
156 PseudoRET implicit $x10
163 ; CHECK-LABEL: name: const_add_i8
164 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
165 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
166 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[C]]
167 ; CHECK-NEXT: $x10 = COPY [[ADD]](s64)
168 ; CHECK-NEXT: PseudoRET implicit $x10
169 %0:_(s8) = G_CONSTANT i8 1
170 %1:_(s64) = COPY $x10
171 %2:_(s8) = G_TRUNC %1(s64)
172 %3:_(s8) = G_ADD %2, %0
173 %4:_(s64) = G_ANYEXT %3(s8)
175 PseudoRET implicit $x10
181 name: constant_pool_i64
184 ; CHECK-LABEL: name: constant_pool_i64
185 ; CHECK: [[CONSTANT_POOL:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.0
186 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[CONSTANT_POOL]](p0) :: (load (s64) from constant-pool)
187 ; CHECK-NEXT: $x10 = COPY [[LOAD]](s64)
188 ; CHECK-NEXT: PseudoRET implicit $x10
189 %0:_(s64) = G_CONSTANT i64 -1085102592571150096
191 PseudoRET implicit $x10