1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple aarch64 -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
9 ; CHECK-LABEL: name: test_constant
10 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
11 ; CHECK: $w0 = COPY [[C]](s32)
12 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 42
13 ; CHECK: $w0 = COPY [[C1]](s32)
14 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
15 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[C2]](s32)
16 ; CHECK: $w0 = COPY [[COPY]](s32)
17 ; CHECK: $w0 = COPY [[C2]](s32)
18 ; CHECK: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
19 ; CHECK: $x0 = COPY [[C3]](s64)
20 ; CHECK: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
21 ; CHECK: $x0 = COPY [[C4]](s64)
22 %0:_(s1) = G_CONSTANT i1 0
23 %6:_(s32) = G_ANYEXT %0
25 %1:_(s8) = G_CONSTANT i8 42
26 %7:_(s32) = G_ANYEXT %1
28 %2:_(s16) = G_CONSTANT i16 65535
29 %8:_(s32) = G_ANYEXT %2
31 %3:_(s32) = G_CONSTANT i32 -1
33 %4:_(s64) = G_CONSTANT i64 1
35 %5:_(s64) = G_CONSTANT i64 0
44 ; CHECK-LABEL: name: test_fconstant
47 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
48 ; CHECK-NEXT: $w0 = COPY [[C]](s32)
49 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
50 ; CHECK-NEXT: $x0 = COPY [[C1]](s64)
51 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
52 ; CHECK-NEXT: $w0 = COPY [[C2]](s32)
53 %0:_(s32) = G_FCONSTANT float 1.0
55 %1:_(s64) = G_FCONSTANT double 2.0
57 %2:_(s16) = G_FCONSTANT half 0.0
58 %3:_(s32) = G_ANYEXT %2
68 ; CHECK-LABEL: name: s792
71 ; CHECK-NEXT: %trunc:_(s32) = G_CONSTANT i32 0
72 ; CHECK-NEXT: $w0 = COPY %trunc(s32)
73 ; CHECK-NEXT: RET_ReallyLR implicit $w0
74 %cst:_(s792) = G_CONSTANT i792 0
75 %trunc:_(s32) = G_TRUNC %cst(s792)
76 $w0 = COPY %trunc(s32)
77 RET_ReallyLR implicit $w0
85 ; CHECK-LABEL: name: s318
88 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1234
89 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
90 ; CHECK-NEXT: %ptr:_(p0) = COPY $x0
91 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
92 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 4611686018427387903
93 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[C]], [[C2]]
94 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C2]]
95 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C2]]
96 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C2]]
97 ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C3]]
98 ; CHECK-NEXT: G_STORE [[AND]](s64), %ptr(p0) :: (store (s64), align 64)
99 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
100 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C4]](s64)
101 ; CHECK-NEXT: G_STORE [[AND1]](s64), [[PTR_ADD]](p0) :: (store (s64) into unknown-address + 8)
102 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
103 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C5]](s64)
104 ; CHECK-NEXT: G_STORE [[AND2]](s64), [[PTR_ADD1]](p0) :: (store (s64) into unknown-address + 16, align 16)
105 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
106 ; CHECK-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C6]](s64)
107 ; CHECK-NEXT: G_STORE [[AND3]](s64), [[PTR_ADD2]](p0) :: (store (s64) into unknown-address + 24)
108 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
109 ; CHECK-NEXT: [[PTR_ADD3:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C7]](s64)
110 ; CHECK-NEXT: G_STORE [[AND4]](s64), [[PTR_ADD3]](p0) :: (store (s64) into unknown-address + 32, align 32)
111 ; CHECK-NEXT: RET_ReallyLR implicit $w0
112 %cst:_(s318) = G_CONSTANT i318 1234
113 %ptr:_(p0) = COPY $x0
114 G_STORE %cst(s318), %ptr(p0) :: (store (s318))
115 RET_ReallyLR implicit $w0
123 ; CHECK-LABEL: name: s158
124 ; CHECK: liveins: $x0
126 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1234
127 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
128 ; CHECK-NEXT: %ptr:_(p0) = COPY $x0
129 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
130 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 1073741823
131 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[C]], [[C2]]
132 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C2]]
133 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C3]]
134 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY [[AND]](s64)
135 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY [[AND1]](s64)
136 ; CHECK-NEXT: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[AND2]](s64), 0
137 ; CHECK-NEXT: G_STORE [[COPY]](s64), %ptr(p0) :: (store (s64), align 32)
138 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
139 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C4]](s64)
140 ; CHECK-NEXT: G_STORE [[COPY1]](s64), [[PTR_ADD]](p0) :: (store (s64) into unknown-address + 8)
141 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
142 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C5]](s64)
143 ; CHECK-NEXT: G_STORE [[EXTRACT]](s32), [[PTR_ADD1]](p0) :: (store (s32) into unknown-address + 16, align 16)
144 ; CHECK-NEXT: RET_ReallyLR implicit $w0
145 %cst:_(s158) = G_CONSTANT i158 1234
146 %ptr:_(p0) = COPY $x0
147 G_STORE %cst(s158), %ptr(p0) :: (store (s158))
148 RET_ReallyLR implicit $w0
157 ; CHECK-LABEL: name: s142
158 ; CHECK: liveins: $x0
160 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1234
161 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
162 ; CHECK-NEXT: %ptr:_(p0) = COPY $x0
163 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
164 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 16383
165 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[C]], [[C2]]
166 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C2]]
167 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[C1]], [[C3]]
168 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY [[AND]](s64)
169 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY [[AND1]](s64)
170 ; CHECK-NEXT: [[EXTRACT:%[0-9]+]]:_(s16) = G_EXTRACT [[AND2]](s64), 0
171 ; CHECK-NEXT: G_STORE [[COPY]](s64), %ptr(p0) :: (store (s64), align 32)
172 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
173 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C4]](s64)
174 ; CHECK-NEXT: G_STORE [[COPY1]](s64), [[PTR_ADD]](p0) :: (store (s64) into unknown-address + 8)
175 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
176 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C5]](s64)
177 ; CHECK-NEXT: G_STORE [[EXTRACT]](s16), [[PTR_ADD1]](p0) :: (store (s16) into unknown-address + 16, align 16)
178 ; CHECK-NEXT: RET_ReallyLR implicit $w0
179 %cst:_(s142) = G_CONSTANT i142 1234
180 %ptr:_(p0) = COPY $x0
181 G_STORE %cst(s142), %ptr(p0) :: (store (s142))
182 RET_ReallyLR implicit $w0