1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -O0 -global-isel -mtriple aarch64 -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s
4 ; Make sure we treat <1 x N> getelementptrs like scalar getelementptrs.
6 ; We should not create a splat vector for the non-vector index on this
7 ; getelementptr. The entire getelementptr should be translated to a scalar
9 define <1 x ptr> @one_elt_vector_ptr_add_non_vector_idx(<1 x ptr> %vec) {
10 ; CHECK-LABEL: name: one_elt_vector_ptr_add_non_vector_idx
11 ; CHECK: bb.1 (%ir-block.0):
13 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $d0
14 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
15 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[C]](s32)
16 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY1]](s32)
17 ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[SEXT]](s64)
18 ; CHECK: [[COPY2:%[0-9]+]]:_(p0) = COPY [[PTR_ADD]](p0)
19 ; CHECK: $d0 = COPY [[COPY2]](p0)
20 ; CHECK: RET_ReallyLR implicit $d0
21 %ptr_add = getelementptr i8, <1 x ptr> %vec, <1 x i32> <i32 1>
22 ret <1 x ptr> %ptr_add
25 ; We should not create a splat vector for the non-vector pointer on this
26 ; getelementptr. The entire getelementptr should be translated to a scalar
28 define <1 x ptr> @one_elt_vector_ptr_add_non_vector_ptr(ptr %vec) {
29 ; CHECK-LABEL: name: one_elt_vector_ptr_add_non_vector_ptr
30 ; CHECK: bb.1 (%ir-block.0):
32 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
33 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
34 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[C]](s32)
35 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY1]](s32)
36 ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[SEXT]](s64)
37 ; CHECK: [[COPY2:%[0-9]+]]:_(p0) = COPY [[PTR_ADD]](p0)
38 ; CHECK: $d0 = COPY [[COPY2]](p0)
39 ; CHECK: RET_ReallyLR implicit $d0
40 %ptr_add = getelementptr i8, ptr %vec, <1 x i32> <i32 1>
41 ret <1 x ptr> %ptr_add