llvm/llvm/test/CodeGen/AArch64/GlobalISel/legalize-ptr-add.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
---
name:            test_ptr_add_vec_p0
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: test_ptr_add_vec_p0
    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $q0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $q1
    ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(<2 x p0>) = G_PTR_ADD [[COPY]], [[COPY1]](<2 x s64>)
    ; CHECK-NEXT: $q0 = COPY [[PTR_ADD]](<2 x p0>)
    %0:_(<2 x p0>) = COPY $q0
    %1:_(<2 x s64>) = COPY $q1
    %3:_(<2 x p0>) = G_PTR_ADD %0, %1(<2 x s64>)
    $q0 = COPY %3(<2 x p0>)

...
---
name:            test_ptr_add_vec_4xp0
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: test_ptr_add_vec_4xp0
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(p0) = COPY $x3
    ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY $x4
    ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s64) = COPY $x5
    ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s64) = COPY $x6
    ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s64) = COPY $x7
    ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[COPY]](p0), [[COPY1]](p0)
    ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[COPY2]](p0), [[COPY3]](p0)
    ; CHECK-NEXT: [[BUILD_VECTOR2:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[COPY4]](s64), [[COPY5]](s64)
    ; CHECK-NEXT: [[BUILD_VECTOR3:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[COPY6]](s64), [[COPY7]](s64)
    ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(<2 x p0>) = G_PTR_ADD [[BUILD_VECTOR]], [[BUILD_VECTOR2]](<2 x s64>)
    ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(<2 x p0>) = G_PTR_ADD [[BUILD_VECTOR1]], [[BUILD_VECTOR3]](<2 x s64>)
    ; CHECK-NEXT: %zero:_(s64) = G_CONSTANT i64 0
    ; CHECK-NEXT: %one:_(s64) = G_CONSTANT i64 1
    ; CHECK-NEXT: %extract0:_(p0) = G_EXTRACT_VECTOR_ELT [[PTR_ADD]](<2 x p0>), %zero(s64)
    ; CHECK-NEXT: %extract1:_(p0) = G_EXTRACT_VECTOR_ELT [[PTR_ADD]](<2 x p0>), %one(s64)
    ; CHECK-NEXT: %extract2:_(p0) = G_EXTRACT_VECTOR_ELT [[PTR_ADD1]](<2 x p0>), %zero(s64)
    ; CHECK-NEXT: %extract3:_(p0) = G_EXTRACT_VECTOR_ELT [[PTR_ADD1]](<2 x p0>), %one(s64)
    ; CHECK-NEXT: $x0 = COPY %extract0(p0)
    ; CHECK-NEXT: $x1 = COPY %extract1(p0)
    ; CHECK-NEXT: $x2 = COPY %extract2(p0)
    ; CHECK-NEXT: $x3 = COPY %extract3(p0)
    %0:_(p0) = COPY $x0
    %1:_(p0) = COPY $x1
    %2:_(p0) = COPY $x2
    %3:_(p0) = COPY $x3
    %4:_(s64) = COPY $x4
    %5:_(s64) = COPY $x5
    %6:_(s64) = COPY $x6
    %7:_(s64) = COPY $x7
    %ptr:_(<4 x p0>) = G_BUILD_VECTOR %0(p0), %1(p0), %2(p0), %3(p0)
    %add:_(<4 x s64>) = G_BUILD_VECTOR %4(s64), %5(s64), %6(s64), %7(s64)
    %res:_(<4 x p0>) = G_PTR_ADD %ptr, %add(<4 x s64>)
    %zero:_(s64) = G_CONSTANT i64 0
    %one:_(s64) = G_CONSTANT i64 1
    %two:_(s64) = G_CONSTANT i64 2
    %three:_(s64) = G_CONSTANT i64 3
    %extract0:_(p0) = G_EXTRACT_VECTOR_ELT %res(<4 x p0>), %zero(s64)
    %extract1:_(p0) = G_EXTRACT_VECTOR_ELT %res(<4 x p0>), %one(s64)
    %extract2:_(p0) = G_EXTRACT_VECTOR_ELT %res(<4 x p0>), %two(s64)
    %extract3:_(p0) = G_EXTRACT_VECTOR_ELT %res(<4 x p0>), %three(s64)
    $x0 = COPY %extract0(p0)
    $x1 = COPY %extract1(p0)
    $x2 = COPY %extract2(p0)
    $x3 = COPY %extract3(p0)
...