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: sext_i32
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
11 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[COPY1]]
12 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[ADD]], 32
13 ; CHECK-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
14 ; CHECK-NEXT: PseudoRET implicit $x10
17 %2:_(s32) = G_TRUNC %0(s64)
18 %3:_(s32) = G_TRUNC %1(s64)
19 %4:_(s32) = G_ADD %2, %3
20 %5:_(s64) = G_SEXT %4(s32)
22 PseudoRET implicit $x10
29 ; CHECK-LABEL: name: zext_i32
30 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
31 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
32 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[COPY1]]
33 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
34 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ADD]], [[C]]
35 ; CHECK-NEXT: $x10 = COPY [[AND]](s64)
36 ; CHECK-NEXT: PseudoRET implicit $x10
39 %2:_(s32) = G_TRUNC %0(s64)
40 %3:_(s32) = G_TRUNC %1(s64)
41 %4:_(s32) = G_ADD %2, %3
42 %5:_(s64) = G_ZEXT %4(s32)
44 PseudoRET implicit $x10
50 ; CHECK-LABEL: name: anyext_16_i32
52 ; CHECK-NEXT: successors: %bb.1(0x80000000)
55 ; CHECK-NEXT: liveins: $x10, $x11
57 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
58 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
59 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
60 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[C]](s64)
61 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s16) = G_LOAD [[COPY]](p0) :: (load (s16))
62 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD]](s16)
63 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
64 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
65 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s64), [[ANYEXT]], [[TRUNC]]
66 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
67 ; CHECK-NEXT: $x10 = COPY [[ANYEXT1]](s64)
68 ; CHECK-NEXT: PseudoRET implicit $x10
75 %2:_(s1) = G_TRUNC %1(s64)
76 %3:_(s32) = G_CONSTANT i32 0
77 %4:_(s16) = G_LOAD %0(p0) :: (load (s16))
78 %5:_(s32) = G_ANYEXT %4(s16)
79 %6:_(s32) = G_SELECT %2(s1), %5, %3
80 %7:_(s64) = G_ANYEXT %6(s32)
82 PseudoRET implicit $x10
88 ; CHECK-LABEL: name: sext_16_i32
90 ; CHECK-NEXT: successors: %bb.1(0x80000000)
93 ; CHECK-NEXT: liveins: $x10, $x11
95 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
96 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
97 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
98 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[C]](s64)
99 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s16) = G_LOAD [[COPY]](p0) :: (load (s16))
100 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[LOAD]](s16)
101 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
102 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
103 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s64), [[SEXT]], [[TRUNC]]
104 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
105 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
106 ; CHECK-NEXT: PseudoRET implicit $x10
112 %1:_(s64) = COPY $x11
113 %2:_(s1) = G_TRUNC %1(s64)
114 %3:_(s32) = G_CONSTANT i32 0
115 %4:_(s16) = G_LOAD %0(p0) :: (load (s16))
116 %5:_(s32) = G_SEXT %4(s16)
117 %6:_(s32) = G_SELECT %2(s1), %5, %3
118 %7:_(s64) = G_ANYEXT %6(s32)
120 PseudoRET implicit $x10
126 ; CHECK-LABEL: name: zext_16_i32
128 ; CHECK-NEXT: successors: %bb.1(0x80000000)
131 ; CHECK-NEXT: liveins: $x10, $x11
133 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
134 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
135 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
136 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[C]](s64)
137 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s16) = G_LOAD [[COPY]](p0) :: (load (s16))
138 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD]](s16)
139 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
140 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
141 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s64), [[ZEXT]], [[TRUNC]]
142 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
143 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
144 ; CHECK-NEXT: PseudoRET implicit $x10
150 %1:_(s64) = COPY $x11
151 %2:_(s1) = G_TRUNC %1(s64)
152 %3:_(s32) = G_CONSTANT i32 0
153 %4:_(s16) = G_LOAD %0(p0) :: (load (s16))
154 %5:_(s32) = G_ZEXT %4(s16)
155 %6:_(s32) = G_SELECT %2(s1), %5, %3
156 %7:_(s64) = G_ANYEXT %6(s32)
158 PseudoRET implicit $x10