llvm/llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizercombiner-ashr.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s

---
name:  constant_fold_ashr_s32_s32
legalized:       true
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name: constant_fold_ashr_s32_s32
    ; CHECK: %shift:_(s32) = G_CONSTANT i32 -482254
    ; CHECK-NEXT: $vgpr0 = COPY %shift(s32)
    %val:_(s32) = G_CONSTANT i32 -123456789
    %shift_amt:_(s32) = G_CONSTANT i32 8
    %shift:_(s32) = G_ASHR %val, %shift_amt
    $vgpr0 = COPY %shift

...

---
name:  constant_fold_ashr_s16_s16
legalized:       true
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name: constant_fold_ashr_s16_s16
    ; CHECK: %ext:_(s32) = G_CONSTANT i32 64764
    ; CHECK-NEXT: $vgpr0 = COPY %ext(s32)
    %val:_(s16) = G_CONSTANT i16 -12345
    %shift_amt:_(s16) = G_CONSTANT i16 4
    %shift:_(s16) = G_ASHR %val, %shift_amt
    %ext:_(s32) = G_ANYEXT %shift
    $vgpr0 = COPY %ext

...

---
name:  constant_fold_ashr_s64_s32
legalized:       true
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name: constant_fold_ashr_s64_s32
    ; CHECK: %shift:_(s64) = G_CONSTANT i64 -482254
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %shift(s64)
    %val:_(s64) = G_CONSTANT i64 -123456789
    %shift_amt:_(s32) = G_CONSTANT i32 8
    %shift:_(s64) = G_ASHR %val, %shift_amt
    $vgpr0_vgpr1 = COPY %shift

...

---
name:  constant_fold_ashr_v2s16_v2s16
legalized:       true
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name: constant_fold_ashr_v2s16_v2s16
    ; CHECK: %val0:_(s16) = G_CONSTANT i16 1234
    ; CHECK-NEXT: %val1:_(s16) = G_CONSTANT i16 -5678
    ; CHECK-NEXT: %val:_(<2 x s16>) = G_BUILD_VECTOR %val0(s16), %val1(s16)
    ; CHECK-NEXT: %shift_amt_elt:_(s16) = G_CONSTANT i16 8
    ; CHECK-NEXT: %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt(s16), %shift_amt_elt(s16)
    ; CHECK-NEXT: %shift:_(<2 x s16>) = G_ASHR %val, %shift_amt(<2 x s16>)
    ; CHECK-NEXT: $vgpr0 = COPY %shift(<2 x s16>)
    %val0:_(s16) = G_CONSTANT i16 1234
    %val1:_(s16) = G_CONSTANT i16 -5678
    %val:_(<2 x s16>) = G_BUILD_VECTOR %val0, %val1
    %shift_amt_elt:_(s16) = G_CONSTANT i16 8
    %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt, %shift_amt_elt
    %shift:_(<2 x s16>) = G_ASHR %val, %shift_amt
    $vgpr0 = COPY %shift

...

---
name:  constant_fold_ashr_v2s16_v2s16_undef_amt_elt
legalized:       true
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name: constant_fold_ashr_v2s16_v2s16_undef_amt_elt
    ; CHECK: %val0:_(s16) = G_CONSTANT i16 1234
    ; CHECK-NEXT: %val1:_(s16) = G_CONSTANT i16 -5678
    ; CHECK-NEXT: %val:_(<2 x s16>) = G_BUILD_VECTOR %val0(s16), %val1(s16)
    ; CHECK-NEXT: %shift_amt_elt:_(s16) = G_CONSTANT i16 8
    ; CHECK-NEXT: %undef:_(s16) = G_IMPLICIT_DEF
    ; CHECK-NEXT: %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt(s16), %undef(s16)
    ; CHECK-NEXT: %shift:_(<2 x s16>) = G_ASHR %val, %shift_amt(<2 x s16>)
    ; CHECK-NEXT: $vgpr0 = COPY %shift(<2 x s16>)
    %val0:_(s16) = G_CONSTANT i16 1234
    %val1:_(s16) = G_CONSTANT i16 -5678
    %val:_(<2 x s16>) = G_BUILD_VECTOR %val0, %val1
    %shift_amt_elt:_(s16) = G_CONSTANT i16 8
    %undef:_(s16) = G_IMPLICIT_DEF
    %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt, %undef
    %shift:_(<2 x s16>) = G_ASHR %val, %shift_amt
    $vgpr0 = COPY %shift

...

---
name:  constant_fold_ashr_v2s16_v2s16_undef_val_elt
legalized:       true
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name: constant_fold_ashr_v2s16_v2s16_undef_val_elt
    ; CHECK: %val0:_(s16) = G_CONSTANT i16 -1234
    ; CHECK-NEXT: %undef:_(s16) = G_IMPLICIT_DEF
    ; CHECK-NEXT: %val:_(<2 x s16>) = G_BUILD_VECTOR %val0(s16), %undef(s16)
    ; CHECK-NEXT: %shift_amt_elt:_(s16) = G_CONSTANT i16 8
    ; CHECK-NEXT: %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt(s16), %shift_amt_elt(s16)
    ; CHECK-NEXT: %shift:_(<2 x s16>) = G_ASHR %val, %shift_amt(<2 x s16>)
    ; CHECK-NEXT: $vgpr0 = COPY %shift(<2 x s16>)
    %val0:_(s16) = G_CONSTANT i16 -1234
    %undef:_(s16) = G_IMPLICIT_DEF
    %val:_(<2 x s16>) = G_BUILD_VECTOR %val0, %undef
    %shift_amt_elt:_(s16) = G_CONSTANT i16 8
    %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt, %shift_amt_elt
    %shift:_(<2 x s16>) = G_ASHR %val, %shift_amt
    $vgpr0 = COPY %shift

...