llvm/llvm/test/CodeGen/AMDGPU/GlobalISel/prelegalizer-combiner-fptrunc_fpext.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-prelegalizer-combiner -o - %s | FileCheck %s

---
name: fptrunc_fpext_s16_to_s32_to_s16
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: fptrunc_fpext_s16_to_s32_to_s16
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %reg:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: $vgpr0 = COPY %reg(s32)
    %reg:_(s32) = COPY $vgpr0
    %src:_(s16) = G_TRUNC %reg
    %fpext:_(s32) = G_FPEXT %src
    %fptrunc:_(s16) = G_FPTRUNC %fpext
    %anyext:_(s32) = G_ANYEXT %fptrunc
    $vgpr0 = COPY %anyext
...

---
name: fptrunc_fpext_s16_to_s64_to_s32
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: fptrunc_fpext_s16_to_s64_to_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %reg:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %src:_(s16) = G_TRUNC %reg(s32)
    ; CHECK-NEXT: %fpext:_(s64) = G_FPEXT %src(s16)
    ; CHECK-NEXT: %fptrunc:_(s32) = G_FPTRUNC %fpext(s64)
    ; CHECK-NEXT: $vgpr0 = COPY %fptrunc(s32)
    %reg:_(s32) = COPY $vgpr0
    %src:_(s16) = G_TRUNC %reg
    %fpext:_(s64) = G_FPEXT %src
    %fptrunc:_(s32) = G_FPTRUNC %fpext
    $vgpr0 = COPY %fptrunc
...

---
name: fptrunc_fpext_v2s16_to_v2s32_to_v2s16
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: fptrunc_fpext_v2s16_to_v2s32_to_v2s16
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
    ; CHECK-NEXT: $vgpr0 = COPY %src(<2 x s16>)
    %src:_(<2 x s16>) = COPY $vgpr0
    %fpext:_(<2 x s32>) = G_FPEXT %src
    %fptrunc:_(<2 x s16>) = G_FPTRUNC %fpext
    $vgpr0 = COPY %fptrunc
...

---
name: fptrunc_fpext_v2s16_to_v2s64_to_v2s32
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: fptrunc_fpext_v2s16_to_v2s64_to_v2s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
    ; CHECK-NEXT: %fpext:_(<2 x s64>) = G_FPEXT %src(<2 x s16>)
    ; CHECK-NEXT: %fptrunc:_(<2 x s32>) = G_FPTRUNC %fpext(<2 x s64>)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %fptrunc(<2 x s32>)
    %src:_(<2 x s16>) = COPY $vgpr0
    %fpext:_(<2 x s64>) = G_FPEXT %src
    %fptrunc:_(<2 x s32>) = G_FPTRUNC %fpext
    $vgpr0_vgpr1 = COPY %fptrunc
...