1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
3 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
4 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
7 name: constant_fold_lshr_s32_s32
9 tracksRegLiveness: true
12 ; CHECK-LABEL: name: constant_fold_lshr_s32_s32
13 ; CHECK: %shift:_(s32) = G_CONSTANT i32 16294962
14 ; CHECK-NEXT: $vgpr0 = COPY %shift(s32)
15 %val:_(s32) = G_CONSTANT i32 -123456789
16 %shift_amt:_(s32) = G_CONSTANT i32 8
17 %shift:_(s32) = G_LSHR %val, %shift_amt
23 name: constant_fold_lshr_s16_s16
25 tracksRegLiveness: true
28 ; CHECK-LABEL: name: constant_fold_lshr_s16_s16
29 ; CHECK: %ext:_(s32) = G_CONSTANT i32 3324
30 ; CHECK-NEXT: $vgpr0 = COPY %ext(s32)
31 %val:_(s16) = G_CONSTANT i16 -12345
32 %shift_amt:_(s16) = G_CONSTANT i16 4
33 %shift:_(s16) = G_LSHR %val, %shift_amt
34 %ext:_(s32) = G_ANYEXT %shift
40 name: constant_fold_lshr_s64_s32
42 tracksRegLiveness: true
45 ; CHECK-LABEL: name: constant_fold_lshr_s64_s32
46 ; CHECK: %shift:_(s64) = G_CONSTANT i64 72057594037445682
47 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %shift(s64)
48 %val:_(s64) = G_CONSTANT i64 -123456789
49 %shift_amt:_(s32) = G_CONSTANT i32 8
50 %shift:_(s64) = G_LSHR %val, %shift_amt
51 $vgpr0_vgpr1 = COPY %shift
56 name: constant_fold_lshr_v2s16_v2s16
58 tracksRegLiveness: true
61 ; CHECK-LABEL: name: constant_fold_lshr_v2s16_v2s16
62 ; CHECK: %val0:_(s16) = G_CONSTANT i16 1234
63 ; CHECK-NEXT: %val1:_(s16) = G_CONSTANT i16 -5678
64 ; CHECK-NEXT: %val:_(<2 x s16>) = G_BUILD_VECTOR %val0(s16), %val1(s16)
65 ; CHECK-NEXT: %shift_amt_elt:_(s16) = G_CONSTANT i16 8
66 ; CHECK-NEXT: %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt(s16), %shift_amt_elt(s16)
67 ; CHECK-NEXT: %shift:_(<2 x s16>) = G_LSHR %val, %shift_amt(<2 x s16>)
68 ; CHECK-NEXT: $vgpr0 = COPY %shift(<2 x s16>)
69 %val0:_(s16) = G_CONSTANT i16 1234
70 %val1:_(s16) = G_CONSTANT i16 -5678
71 %val:_(<2 x s16>) = G_BUILD_VECTOR %val0, %val1
72 %shift_amt_elt:_(s16) = G_CONSTANT i16 8
73 %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt, %shift_amt_elt
74 %shift:_(<2 x s16>) = G_LSHR %val, %shift_amt
80 name: constant_fold_lshr_v2s16_v2s16_undef_amt_elt
82 tracksRegLiveness: true
85 ; CHECK-LABEL: name: constant_fold_lshr_v2s16_v2s16_undef_amt_elt
86 ; CHECK: %val0:_(s16) = G_CONSTANT i16 1234
87 ; CHECK-NEXT: %val1:_(s16) = G_CONSTANT i16 -5678
88 ; CHECK-NEXT: %val:_(<2 x s16>) = G_BUILD_VECTOR %val0(s16), %val1(s16)
89 ; CHECK-NEXT: %shift_amt_elt:_(s16) = G_CONSTANT i16 8
90 ; CHECK-NEXT: %undef:_(s16) = G_IMPLICIT_DEF
91 ; CHECK-NEXT: %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt(s16), %undef(s16)
92 ; CHECK-NEXT: %shift:_(<2 x s16>) = G_LSHR %val, %shift_amt(<2 x s16>)
93 ; CHECK-NEXT: $vgpr0 = COPY %shift(<2 x s16>)
94 %val0:_(s16) = G_CONSTANT i16 1234
95 %val1:_(s16) = G_CONSTANT i16 -5678
96 %val:_(<2 x s16>) = G_BUILD_VECTOR %val0, %val1
97 %shift_amt_elt:_(s16) = G_CONSTANT i16 8
98 %undef:_(s16) = G_IMPLICIT_DEF
99 %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt, %undef
100 %shift:_(<2 x s16>) = G_LSHR %val, %shift_amt
106 name: constant_fold_lshr_v2s16_v2s16_undef_val_elt
108 tracksRegLiveness: true
111 ; CHECK-LABEL: name: constant_fold_lshr_v2s16_v2s16_undef_val_elt
112 ; CHECK: %val0:_(s16) = G_CONSTANT i16 -1234
113 ; CHECK-NEXT: %undef:_(s16) = G_IMPLICIT_DEF
114 ; CHECK-NEXT: %val:_(<2 x s16>) = G_BUILD_VECTOR %val0(s16), %undef(s16)
115 ; CHECK-NEXT: %shift_amt_elt:_(s16) = G_CONSTANT i16 8
116 ; CHECK-NEXT: %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt(s16), %shift_amt_elt(s16)
117 ; CHECK-NEXT: %shift:_(<2 x s16>) = G_LSHR %val, %shift_amt(<2 x s16>)
118 ; CHECK-NEXT: $vgpr0 = COPY %shift(<2 x s16>)
119 %val0:_(s16) = G_CONSTANT i16 -1234
120 %undef:_(s16) = G_IMPLICIT_DEF
121 %val:_(<2 x s16>) = G_BUILD_VECTOR %val0, %undef
122 %shift_amt_elt:_(s16) = G_CONSTANT i16 8
123 %shift_amt:_(<2 x s16>) = G_BUILD_VECTOR %shift_amt_elt, %shift_amt_elt
124 %shift:_(<2 x s16>) = G_LSHR %val, %shift_amt