1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=aarch64-apple-ios -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK
10 ; CHECK-LABEL: name: ptr_add
11 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
12 ; CHECK: [[COPY1:%[0-9]+]]:gpr64common = COPY [[COPY]]
13 ; CHECK: [[ADDXri:%[0-9]+]]:gpr64sp = ADDXri [[COPY1]], 42, 0
14 ; CHECK: $x0 = COPY [[ADDXri]]
16 %1:gpr(s64) = G_CONSTANT i64 42
17 %2:gpr(p0) = G_PTR_ADD %0, %1(s64)
22 name: ptr_add_no_constant
28 ; CHECK-LABEL: name: ptr_add_no_constant
29 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
30 ; CHECK: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
31 ; CHECK: [[ADDXrr:%[0-9]+]]:gpr64 = ADDXrr [[COPY]], [[COPY1]]
32 ; CHECK: $x0 = COPY [[ADDXrr]]
34 %1:gpr(s64) = COPY $x1
35 %2:gpr(p0) = G_PTR_ADD %0, %1(s64)
46 ; CHECK-LABEL: name: ptr_add_bad_imm
47 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
48 ; CHECK: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 10000
49 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gpr64 = SUBREG_TO_REG 0, [[MOVi32imm]], %subreg.sub_32
50 ; CHECK: [[ADDXrr:%[0-9]+]]:gpr64 = ADDXrr [[COPY]], [[SUBREG_TO_REG]]
51 ; CHECK: $x0 = COPY [[ADDXrr]]
53 %1:gpr(s64) = G_CONSTANT i64 10000
54 %2:gpr(p0) = G_PTR_ADD %0, %1(s64)
65 ; CHECK-LABEL: name: ptr_add_vec
66 ; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
67 ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1
68 ; CHECK: [[ADDv2i64_:%[0-9]+]]:fpr128 = ADDv2i64 [[COPY]], [[COPY1]]
69 ; CHECK: $q0 = COPY [[ADDv2i64_]]
70 %0:fpr(<2 x p0>) = COPY $q0
71 %1:fpr(<2 x s64>) = COPY $q1
72 %3:fpr(<2 x p0>) = G_PTR_ADD %0, %1(<2 x s64>)
73 $q0 = COPY %3(<2 x p0>)
82 ; CHECK-LABEL: name: ptr_add_neg_imm
83 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
84 ; CHECK: [[COPY1:%[0-9]+]]:gpr64common = COPY [[COPY]]
85 ; CHECK: [[SUBSXri:%[0-9]+]]:gpr64 = SUBSXri [[COPY1]], 10, 0, implicit-def $nzcv
86 ; CHECK: $x0 = COPY [[SUBSXri]]
88 %1:gpr(s64) = G_CONSTANT i64 -10
89 %2:gpr(p0) = G_PTR_ADD %0, %1(s64)
93 name: ptr_add_arith_extended
99 ; CHECK-LABEL: name: ptr_add_arith_extended
100 ; CHECK: %reg0:gpr32 = COPY $w0
101 ; CHECK: %ptr:gpr64 = COPY $x1
102 ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY %ptr
103 ; CHECK: %ptr_add:gpr64sp = ADDXrx [[COPY]], %reg0, 18
104 ; CHECK: $x0 = COPY %ptr_add
105 %reg0:gpr(s32) = COPY $w0
106 %ptr:gpr(p0) = COPY $x1
107 %ext:gpr(s64) = G_ZEXT %reg0(s32)
108 %cst:gpr(s64) = G_CONSTANT i64 2
109 %shift:gpr(s64) = G_SHL %ext, %cst(s64)
110 %ptr_add:gpr(p0) = G_PTR_ADD %ptr, %shift(s64)
111 $x0 = COPY %ptr_add(p0)
114 name: ptr_add_negated_reg
116 regBankSelected: true
120 ; CHECK-LABEL: name: ptr_add_negated_reg
121 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
122 ; CHECK: %src:gpr64 = COPY $x1
123 ; CHECK: [[SUBSXrr:%[0-9]+]]:gpr64 = SUBSXrr [[COPY]], %src, implicit-def $nzcv
124 ; CHECK: $x0 = COPY [[SUBSXrr]]
125 %0:gpr(p0) = COPY $x0
126 %src:gpr(s64) = COPY $x1
127 %1:gpr(s64) = G_CONSTANT i64 0
128 %neg:gpr(s64) = G_SUB %1, %src
129 %2:gpr(p0) = G_PTR_ADD %0, %neg(s64)