llvm/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s

---
name:            test_constant_s32
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s32
    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
    ; CHECK-NEXT: $vgpr0 = COPY [[C]](s32)
    %0:_(s32) = G_CONSTANT i32 5
    $vgpr0 = COPY %0
...
---
name:            test_constant_s64
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s64
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[C]](s64)
    %0:_(s64) = G_CONSTANT i64 5
    $vgpr0_vgpr1 = COPY %0

...

---
name:            test_constant_s96
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s96
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -4780896129847249538
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -547834910
    ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C]](s64)
    ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s96) = G_MERGE_VALUES [[UV]](s32), [[UV1]](s32), [[C1]](s32)
    ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2 = COPY [[MV]](s96)
    %0:_(s96) = G_CONSTANT i96  -10105770365747857631829412482
    $vgpr0_vgpr1_vgpr2 = COPY %0

...

---
name:            test_constant_s1
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s1
    ; CHECK: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 false
    ; CHECK-NEXT: S_ENDPGM 0, implicit [[C]](s1)
    %1:_(s1) = G_CONSTANT i1 0
    S_ENDPGM 0, implicit %1
...

---
name:            test_constant_s7
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s7
    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
    ; CHECK-NEXT: $vgpr0 = COPY [[C]](s32)
    %0:_(s7) = G_CONSTANT i7 5
    %1:_(s32) = G_ANYEXT %0
    $vgpr0 = COPY %1
...

---
name:            test_constant_s8
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s8
    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
    ; CHECK-NEXT: $vgpr0 = COPY [[C]](s32)
    %0:_(s8) = G_CONSTANT i8 5
    %1:_(s32) = G_ANYEXT %0
    $vgpr0 = COPY %1
...

---
name:            test_constant_s16
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s16
    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
    ; CHECK-NEXT: $vgpr0 = COPY [[C]](s32)
    %0:_(s16) = G_CONSTANT i16 5
    %1:_(s32) = G_ANYEXT %0
    $vgpr0 = COPY %1
...

---
name:            test_constant_s128
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_s128
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
    ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[C]](s64), [[C1]](s64)
    ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[MV]](s128)
    %0:_(s128) = G_CONSTANT i128 5
    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %0
...

---
name: test_constant_p0
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_p0
    ; CHECK: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[C]](p0)
    %0:_(p0) = G_CONSTANT i64 0
    $vgpr0_vgpr1 = COPY %0
...

---
name: test_constant_p1
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_p1
    ; CHECK: [[C:%[0-9]+]]:_(p1) = G_CONSTANT i64 0
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[C]](p1)
    %0:_(p1) = G_CONSTANT i64 0
    $vgpr0_vgpr1 = COPY %0
...

---
name: test_constant_p2
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_p2
    ; CHECK: [[C:%[0-9]+]]:_(p2) = G_CONSTANT i32 0
    ; CHECK-NEXT: $vgpr0 = COPY [[C]](p2)
    %0:_(p2) = G_CONSTANT i32 0
    $vgpr0 = COPY %0
...

---
name: test_constant_p3
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_p3
    ; CHECK: [[C:%[0-9]+]]:_(p2) = G_CONSTANT i32 0
    ; CHECK-NEXT: $vgpr0 = COPY [[C]](p2)
    %0:_(p2) = G_CONSTANT i32 0
    $vgpr0 = COPY %0
...

---
name: test_constant_p4
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_p4
    ; CHECK: [[C:%[0-9]+]]:_(p4) = G_CONSTANT i64 0
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[C]](p4)
    %0:_(p4) = G_CONSTANT i64 0
    $vgpr0_vgpr1 = COPY %0
...

---
name: test_constant_p5
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_p5
    ; CHECK: [[C:%[0-9]+]]:_(p5) = G_CONSTANT i32 0
    ; CHECK-NEXT: $vgpr0 = COPY [[C]](p5)
    %0:_(p5) = G_CONSTANT i32 0
    $vgpr0 = COPY %0
...

---
name: test_constant_p999
body: |
  bb.0:

    ; CHECK-LABEL: name: test_constant_p999
    ; CHECK: [[C:%[0-9]+]]:_(p999) = G_CONSTANT i64 0
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[C]](p999)
    %0:_(p999) = G_CONSTANT i64 0
    $vgpr0_vgpr1 = COPY %0
...