1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -global-isel-abort=1 -verify-machineinstrs %s -o - | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 define void @inttoptr_p0_s64() { ret void }
8 define void @ptrtoint_s64_p0() { ret void }
9 define void @ptrtoint_s32_p0() { ret void }
10 define void @ptrtoint_s16_p0() { ret void }
11 define void @ptrtoint_s8_p0() { ret void }
12 define void @ptrtoint_s1_p0() { ret void }
13 define void @inttoptr_v2p0_v2s64() { ret void }
14 define void @ptrtoint_v2s64_v2p0() { ret void }
23 - { id: 0, class: gpr }
24 - { id: 1, class: gpr }
28 ; CHECK-LABEL: name: inttoptr_p0_s64
31 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64all = COPY $x0
32 ; CHECK-NEXT: $x0 = COPY [[COPY]]
34 %1(p0) = G_INTTOPTR %0
44 - { id: 0, class: gpr }
45 - { id: 1, class: gpr }
49 ; CHECK-LABEL: name: ptrtoint_s64_p0
52 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
53 ; CHECK-NEXT: $x0 = COPY [[COPY]]
55 %1(s64) = G_PTRTOINT %0
65 - { id: 0, class: gpr }
66 - { id: 1, class: gpr }
70 ; CHECK-LABEL: name: ptrtoint_s32_p0
73 ; CHECK-NEXT: %ptr:gpr64 = COPY $x0
74 ; CHECK-NEXT: %ptr2int:gpr64common = COPY %ptr
75 ; CHECK-NEXT: %int:gpr32sp = COPY %ptr2int.sub_32
76 ; CHECK-NEXT: $w0 = COPY %int
77 ; CHECK-NEXT: RET_ReallyLR implicit $w0
78 %ptr:gpr(p0) = COPY $x0
79 %ptr2int:gpr(s64) = G_PTRTOINT %ptr(p0)
80 %int:gpr(s32) = G_TRUNC %ptr2int(s64)
82 RET_ReallyLR implicit $w0
91 - { id: 0, class: gpr }
92 - { id: 1, class: gpr }
96 ; CHECK-LABEL: name: ptrtoint_s16_p0
99 ; CHECK-NEXT: %ptr:gpr64 = COPY $x0
100 ; CHECK-NEXT: %int:gpr32 = COPY %ptr.sub_32
101 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr32 = COPY %int
102 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr16 = COPY [[COPY]].hsub
103 ; CHECK-NEXT: $h0 = COPY [[COPY1]]
104 ; CHECK-NEXT: RET_ReallyLR implicit $h0
105 %ptr:gpr(p0) = COPY $x0
106 %ptr2int:gpr(s64) = G_PTRTOINT %ptr(p0)
107 %int:gpr(s16) = G_TRUNC %ptr2int(s64)
109 RET_ReallyLR implicit $h0
115 regBankSelected: true
118 - { id: 0, class: gpr }
119 - { id: 1, class: gpr }
123 ; CHECK-LABEL: name: ptrtoint_s8_p0
124 ; CHECK: liveins: $x0
126 ; CHECK-NEXT: %ptr:gpr64 = COPY $x0
127 ; CHECK-NEXT: %int:gpr32 = COPY %ptr.sub_32
128 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr32 = COPY %int
129 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr8 = COPY [[COPY]].bsub
130 ; CHECK-NEXT: $b0 = COPY [[COPY1]]
131 ; CHECK-NEXT: RET_ReallyLR implicit $b0
132 %ptr:gpr(p0) = COPY $x0
133 %ptr2int:gpr(s64) = G_PTRTOINT %ptr(p0)
134 %int:gpr(s8) = G_TRUNC %ptr2int(s64)
136 RET_ReallyLR implicit $b0
142 regBankSelected: true
145 - { id: 0, class: gpr }
146 - { id: 1, class: gpr }
150 ; CHECK-LABEL: name: ptrtoint_s1_p0
151 ; CHECK: liveins: $x0
153 ; CHECK-NEXT: %ptr:gpr64 = COPY $x0
154 ; CHECK-NEXT: %ptr2int:gpr64common = COPY %ptr
155 ; CHECK-NEXT: %trunc:gpr32common = COPY %ptr2int.sub_32
156 ; CHECK-NEXT: %ext:gpr32sp = ANDWri %trunc, 0
157 ; CHECK-NEXT: $w0 = COPY %ext
158 ; CHECK-NEXT: RET_ReallyLR implicit $w0
159 %ptr:gpr(p0) = COPY $x0
160 %ptr2int:gpr(s64) = G_PTRTOINT %ptr(p0)
161 %one:gpr(s32) = G_CONSTANT i32 1
162 %trunc:gpr(s32) = G_TRUNC %ptr2int(s64)
163 %ext:gpr(s32) = G_AND %trunc, %one
165 RET_ReallyLR implicit $w0
168 name: inttoptr_v2p0_v2s64
170 regBankSelected: true
171 tracksRegLiveness: true
175 ; CHECK-LABEL: name: inttoptr_v2p0_v2s64
176 ; CHECK: liveins: $q0, $x0
178 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
179 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY [[COPY]].dsub
180 ; CHECK-NEXT: $x0 = COPY [[COPY1]]
181 ; CHECK-NEXT: RET_ReallyLR implicit $x0
182 %1:fpr(<2 x s64>) = COPY $q0
183 %2:fpr(<2 x p0>) = G_INTTOPTR %1(<2 x s64>)
184 %4:gpr(s64) = G_CONSTANT i64 0
185 %3:fpr(p0) = G_EXTRACT_VECTOR_ELT %2(<2 x p0>), %4(s64)
187 RET_ReallyLR implicit $x0
191 name: ptrtoint_v2s64_v2p0
193 regBankSelected: true
194 tracksRegLiveness: true
198 ; CHECK-LABEL: name: ptrtoint_v2s64_v2p0
199 ; CHECK: liveins: $q0
201 ; CHECK-NEXT: %ptr:fpr128 = COPY $q0
202 ; CHECK-NEXT: $q0 = COPY %ptr
203 ; CHECK-NEXT: RET_ReallyLR implicit $q0
204 %ptr:fpr(<2 x p0>) = COPY $q0
205 %int:fpr(<2 x s64>) = G_PTRTOINT %ptr(<2 x p0>)
206 $q0 = COPY %int(<2 x s64>)
207 RET_ReallyLR implicit $q0