1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -march=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
7 ; CHECK-LABEL: name: test_ext
8 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
9 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
10 ; CHECK: $w0 = COPY [[TRUNC]](s32)
11 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
12 ; CHECK: $w0 = COPY [[TRUNC1]](s32)
13 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
14 ; CHECK: $w0 = COPY [[TRUNC2]](s32)
15 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
16 ; CHECK: $w0 = COPY [[TRUNC3]](s32)
17 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
18 ; CHECK: $x0 = COPY [[COPY1]](s64)
19 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
20 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
21 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
22 ; CHECK: $x0 = COPY [[AND]](s64)
23 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
24 ; CHECK: $x0 = COPY [[COPY3]](s64)
25 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
26 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
27 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY4]], [[C1]]
28 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C1]]
29 ; CHECK: $x0 = COPY [[ASHR]](s64)
30 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
31 ; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
32 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC4]], [[C2]]
33 ; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C2]]
34 ; CHECK: $w0 = COPY [[ASHR1]](s32)
35 ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
36 ; CHECK: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
37 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC5]], [[C3]]
38 ; CHECK: $w0 = COPY [[AND1]](s32)
39 ; CHECK: [[TRUNC6:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
40 ; CHECK: $w0 = COPY [[TRUNC6]](s32)
41 ; CHECK: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
42 ; CHECK: [[TRUNC7:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
43 ; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC7]], [[C4]]
44 ; CHECK: $w0 = COPY [[AND2]](s32)
45 ; CHECK: [[TRUNC8:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
46 ; CHECK: $w0 = COPY [[TRUNC8]](s32)
47 ; CHECK: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
48 ; CHECK: [[TRUNC9:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
49 ; CHECK: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[TRUNC9]], [[C5]]
50 ; CHECK: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[SHL2]], [[C5]]
51 ; CHECK: $w0 = COPY [[ASHR2]](s32)
52 ; CHECK: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
53 ; CHECK: [[TRUNC10:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
54 ; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC10]], [[C6]]
55 ; CHECK: $w0 = COPY [[AND3]](s32)
56 ; CHECK: [[TRUNC11:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
57 ; CHECK: $w0 = COPY [[TRUNC11]](s32)
58 ; CHECK: [[TRUNC12:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
59 ; CHECK: $w0 = COPY [[TRUNC12]](s32)
60 ; CHECK: [[FPEXT:%[0-9]+]]:_(s64) = G_FPEXT [[TRUNC12]](s32)
61 ; CHECK: $x0 = COPY [[FPEXT]](s64)
62 ; CHECK: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
63 ; CHECK: $w0 = COPY [[C7]](s32)
64 ; CHECK: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
65 ; CHECK: $w0 = COPY [[C8]](s32)
66 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
67 ; CHECK: $w0 = COPY [[DEF]](s32)
69 %1:_(s1) = G_TRUNC %0(s64)
70 %19:_(s32) = G_ANYEXT %1(s1)
72 %2:_(s8) = G_TRUNC %0(s64)
73 %20:_(s32) = G_ANYEXT %2(s8)
75 %3:_(s16) = G_TRUNC %0(s64)
76 %21:_(s32) = G_ANYEXT %3(s16)
78 %4:_(s32) = G_TRUNC %0(s64)
80 %5:_(s64) = G_ANYEXT %1(s1)
82 %6:_(s64) = G_ZEXT %2(s8)
84 %7:_(s64) = G_ANYEXT %3(s16)
86 %8:_(s64) = G_SEXT %4(s32)
88 %9:_(s32) = G_SEXT %1(s1)
90 %10:_(s32) = G_ZEXT %2(s8)
92 %11:_(s32) = G_ANYEXT %3(s16)
94 %12:_(s32) = G_ZEXT %1(s1)
96 %13:_(s32) = G_ANYEXT %2(s8)
98 %14:_(s32) = G_SEXT %3(s16)
100 %15:_(s8) = G_ZEXT %1(s1)
101 %22:_(s32) = G_ANYEXT %15(s8)
103 %16:_(s16) = G_ANYEXT %2(s8)
104 %23:_(s32) = G_ANYEXT %16(s16)
106 %17:_(s32) = G_TRUNC %0(s64)
108 %18:_(s64) = G_FPEXT %17(s32)
110 %24:_(s16) = G_IMPLICIT_DEF
111 %25:_(s32) = G_ZEXT %24(s16)
113 %26:_(s32) = G_SEXT %24(s16)
115 %27:_(s32) = G_ANYEXT %24(s16)
120 name: test_anyext_anyext
125 ; CHECK-LABEL: name: test_anyext_anyext
126 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
127 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
128 ; CHECK: $w0 = COPY [[COPY1]](s32)
130 %1:_(s1) = G_TRUNC %0(s32)
131 %2:_(s8) = G_ANYEXT %1(s1)
132 %3:_(s32) = G_ANYEXT %2(s8)
137 name: test_anyext_sext
142 ; CHECK-LABEL: name: test_anyext_sext
143 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
144 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
145 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
146 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]]
147 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]]
148 ; CHECK: $w0 = COPY [[ASHR]](s32)
150 %1:_(s1) = G_TRUNC %0(s32)
151 %2:_(s8) = G_SEXT %1(s1)
152 %3:_(s32) = G_ANYEXT %2(s8)
157 name: test_anyext_zext
162 ; CHECK-LABEL: name: test_anyext_zext
163 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
164 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
165 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
166 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
167 ; CHECK: $w0 = COPY [[AND]](s32)
169 %1:_(s1) = G_TRUNC %0(s32)
170 %2:_(s8) = G_ZEXT %1(s1)
171 %3:_(s32) = G_ANYEXT %2(s8)