1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck --check-prefix=GCN %s
3 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck --check-prefix=GCN %s
6 name: bfe_sext_inreg_ashr_s32
8 tracksRegLiveness: true
14 ; GCN-LABEL: name: bfe_sext_inreg_ashr_s32
15 ; GCN: liveins: $vgpr0
17 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
18 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
19 ; GCN-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
20 ; GCN-NEXT: [[SBFX:%[0-9]+]]:_(s32) = G_SBFX [[COPY]], [[C]](s32), [[C1]]
21 ; GCN-NEXT: $vgpr0 = COPY [[SBFX]](s32)
22 %0:_(s32) = COPY $vgpr0
23 %1:_(s32) = G_CONSTANT i32 4
24 %2:_(s32) = G_ASHR %0, %1(s32)
25 %3:_(s32) = COPY %2(s32)
26 %4:_(s32) = G_SEXT_INREG %3, 16
31 name: bfe_sext_inreg_lshr_s32
33 tracksRegLiveness: true
39 ; GCN-LABEL: name: bfe_sext_inreg_lshr_s32
40 ; GCN: liveins: $vgpr0
42 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
43 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
44 ; GCN-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
45 ; GCN-NEXT: [[SBFX:%[0-9]+]]:_(s32) = G_SBFX [[COPY]], [[C]](s32), [[C1]]
46 ; GCN-NEXT: $vgpr0 = COPY [[SBFX]](s32)
47 %0:_(s32) = COPY $vgpr0
48 %1:_(s32) = G_CONSTANT i32 4
49 %2:_(s32) = G_LSHR %0, %1(s32)
50 %3:_(s32) = COPY %2(s32)
51 %4:_(s32) = G_SEXT_INREG %3, 16
56 name: bfe_sext_inreg_ashr_s64
58 tracksRegLiveness: true
64 ; GCN-LABEL: name: bfe_sext_inreg_ashr_s64
65 ; GCN: liveins: $vgpr0_vgpr1
67 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
68 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
69 ; GCN-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
70 ; GCN-NEXT: [[SBFX:%[0-9]+]]:_(s64) = G_SBFX [[COPY]], [[C]](s32), [[C1]]
71 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[SBFX]](s64)
72 %0:_(s64) = COPY $vgpr0_vgpr1
73 %1:_(s32) = G_CONSTANT i32 4
74 %2:_(s64) = G_ASHR %0, %1(s32)
75 %3:_(s64) = COPY %2(s64)
76 %4:_(s64) = G_SEXT_INREG %3, 16
77 $vgpr0_vgpr1 = COPY %4(s64)
81 name: toobig_sext_inreg_ashr_s32
83 tracksRegLiveness: true
89 ; GCN-LABEL: name: toobig_sext_inreg_ashr_s32
90 ; GCN: liveins: $vgpr0
92 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
93 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
94 ; GCN-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]](s32)
95 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ASHR]], 20
96 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
97 %0:_(s32) = COPY $vgpr0
98 %1:_(s32) = G_CONSTANT i32 16
99 %2:_(s32) = G_ASHR %0, %1(s32)
100 %3:_(s32) = COPY %2(s32)
101 %4:_(s32) = G_SEXT_INREG %3, 20
102 $vgpr0 = COPY %4(s32)
106 name: toobig_sext_inreg_ashr_s64
108 tracksRegLiveness: true
112 liveins: $vgpr0_vgpr1
114 ; GCN-LABEL: name: toobig_sext_inreg_ashr_s64
115 ; GCN: liveins: $vgpr0_vgpr1
117 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
118 ; GCN-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
119 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
120 ; GCN-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[UV1]], [[C]](s32)
121 ; GCN-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
122 ; GCN-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[UV1]], [[C1]](s32)
123 ; GCN-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[ASHR1]](s32), [[ASHR]](s32)
124 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[MV]], 32
125 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[SEXT_INREG]](s64)
126 %0:_(s64) = COPY $vgpr0_vgpr1
127 %1:_(s32) = G_CONSTANT i32 40
128 %2:_(s64) = G_ASHR %0, %1(s32)
129 %3:_(s64) = COPY %2(s64)
130 %4:_(s64) = G_SEXT_INREG %3, 32
131 $vgpr0_vgpr1 = COPY %4(s64)
135 name: var_sext_inreg_ashr_s32
137 tracksRegLiveness: true
141 liveins: $vgpr0, $vgpr1
143 ; GCN-LABEL: name: var_sext_inreg_ashr_s32
144 ; GCN: liveins: $vgpr0, $vgpr1
146 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
147 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
148 ; GCN-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[COPY1]](s32)
149 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ASHR]], 10
150 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
151 %0:_(s32) = COPY $vgpr0
152 %1:_(s32) = COPY $vgpr1
153 %2:_(s32) = G_ASHR %0, %1(s32)
154 %3:_(s32) = COPY %2(s32)
155 %4:_(s32) = G_SEXT_INREG %3, 10
156 $vgpr0 = COPY %4(s32)