llvm.org GIT mirror llvm / stable test / CodeGen / AMDGPU / GlobalISel / legalize-inttoptr.mir
stable

Tree @stable (Download .tar.gz)

legalize-inttoptr.mir @stableraw · history · blame

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -O0 -run-pass=legalizer -global-isel-abort=0 -o - %s | FileCheck %s

---
name: test_inttoptr_s64_to_p0
body: |
  bb.0:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_inttoptr_s64_to_p0
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[COPY]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[INTTOPTR]](p0)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(p0) = G_INTTOPTR %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: test_inttoptr_s64_to_p1
body: |
  bb.0:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_inttoptr_s64_to_p1
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p1) = G_INTTOPTR [[COPY]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[INTTOPTR]](p1)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(p1) = G_INTTOPTR %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: test_inttoptr_s64_to_p4
body: |
  bb.0:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_inttoptr_s64_to_p4
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p4) = G_INTTOPTR [[COPY]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[INTTOPTR]](p4)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(p4) = G_INTTOPTR %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: test_inttoptr_s32_to_p3
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_inttoptr_s32_to_p3
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p3) = G_INTTOPTR [[COPY]](s32)
    ; CHECK: $vgpr0 = COPY [[INTTOPTR]](p3)
    %0:_(s32) = COPY $vgpr0
    %1:_(p3) = G_INTTOPTR %0
    $vgpr0 = COPY %1
...

---
name: test_inttoptr_s32_to_p5
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_inttoptr_s32_to_p5
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p5) = G_INTTOPTR [[COPY]](s32)
    ; CHECK: $vgpr0 = COPY [[INTTOPTR]](p5)
    %0:_(s32) = COPY $vgpr0
    %1:_(p5) = G_INTTOPTR %0
    $vgpr0 = COPY %1
...

---
name: test_inttoptr_s64_to_p999
body: |
  bb.0:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_inttoptr_s64_to_p999
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p999) = G_INTTOPTR [[COPY]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[INTTOPTR]](p999)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(p999) = G_INTTOPTR %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: test_inttoptr_s32_to_p0
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_inttoptr_s32_to_p0
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[ZEXT]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[INTTOPTR]](p0)
    %0:_(s32) = COPY $vgpr0
    %1:_(p0) = G_INTTOPTR %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: test_inttoptr_s128_to_p0
body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3

    ; CHECK-LABEL: name: test_inttoptr_s128_to_p0
    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY]](s128)
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[TRUNC]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[INTTOPTR]](p0)
    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:_(p0) = G_INTTOPTR %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: test_inttoptr_v2s64_to_v2p0
body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3

    ; CHECK-LABEL: name: test_inttoptr_v2s64_to_v2p0
    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[UV]](s64)
    ; CHECK: [[INTTOPTR1:%[0-9]+]]:_(p0) = G_INTTOPTR [[UV1]](s64)
    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[INTTOPTR]](p0), [[INTTOPTR1]](p0)
    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
    %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:_(<2 x p0>) = G_INTTOPTR %0
    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
...

---
name: test_inttoptr_v2s32_to_v2p0
body: |
  bb.0:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_inttoptr_v2s32_to_v2p0
    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
    ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[UV]](s32)
    ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[ZEXT]](s64)
    ; CHECK: [[ZEXT1:%[0-9]+]]:_(s64) = G_ZEXT [[UV1]](s32)
    ; CHECK: [[INTTOPTR1:%[0-9]+]]:_(p0) = G_INTTOPTR [[ZEXT1]](s64)
    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[INTTOPTR]](p0), [[INTTOPTR1]](p0)
    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
    %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
    %1:_(<2 x p0>) = G_INTTOPTR %0
    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
...