[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / CodeGen / AMDGPU / GlobalISel / inst-select-zext.mir
blob0871983f2dc2afda3a67cfd56c7ab3bcc183b74b
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s -check-prefixes=GCN
4 ---
6 name: zext_scc_s1_to_sgpr_s32
7 legalized:       true
8 regBankSelected: true
9 body: |
10   bb.0:
11     liveins: $sgpr0
13     ; GCN-LABEL: name: zext_scc_s1_to_sgpr_s32
14     ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
15     ; GCN: S_CMP_EQ_U32 [[COPY]], [[COPY]], implicit-def $scc
16     ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY $scc
17     ; GCN: $scc = COPY [[COPY1]]
18     ; GCN: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 0, 1, implicit $scc
19     ; GCN: $sgpr0 = COPY [[S_CSELECT_B32_]]
20     %0:sgpr(s32) = COPY $sgpr0
21     %1:scc(s1) = G_ICMP intpred(eq), %0, %0
22     %2:sgpr(s32) = G_ZEXT %1
23     $sgpr0 = COPY %2
24 ...
26 ---
28 name: zext_scc_s1_to_sgpr_s64
29 legalized:       true
30 regBankSelected: true
31 body: |
32   bb.0:
33     liveins: $sgpr0
35     ; GCN-LABEL: name: zext_scc_s1_to_sgpr_s64
36     ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
37     ; GCN: S_CMP_EQ_U32 [[COPY]], [[COPY]], implicit-def $scc
38     ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY $scc
39     ; GCN: $scc = COPY [[COPY1]]
40     ; GCN: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64_xexec = S_CSELECT_B64 0, 1, implicit $scc
41     ; GCN: $sgpr0_sgpr1 = COPY [[S_CSELECT_B64_]]
42     %0:sgpr(s32) = COPY $sgpr0
43     %1:scc(s1) = G_ICMP intpred(eq), %0, %0
44     %2:sgpr(s64) = G_ZEXT %1
45     $sgpr0_sgpr1 = COPY %2
46 ...
48 ---
50 name: zext_sgpr_s1_to_sgpr_s32
51 legalized:       true
52 regBankSelected: true
53 body: |
54   bb.0:
55     liveins: $sgpr0
57     ; GCN-LABEL: name: zext_sgpr_s1_to_sgpr_s32
58     ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
59     ; GCN: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 [[COPY]], 1, implicit-def $scc
60     ; GCN: $sgpr0 = COPY [[S_AND_B32_]]
61     %0:sgpr(s32) = COPY $sgpr0
62     %1:sgpr(s1) = G_TRUNC %0
63     %2:sgpr(s32) = G_ZEXT %1
64     $sgpr0 = COPY %2
65 ...
67 ---
69 name: zext_sgpr_s1_to_sgpr_s64
70 legalized:       true
71 regBankSelected: true
72 body: |
73   bb.0:
74     liveins: $sgpr0
76     ; GCN-LABEL: name: zext_sgpr_s1_to_sgpr_s64
77     ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
78     ; GCN: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
79     ; GCN: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[DEF]], %subreg.sub1
80     ; GCN: [[S_BFE_U64_:%[0-9]+]]:sreg_64_xexec = S_BFE_U64 [[REG_SEQUENCE]], 65536, implicit-def $scc
81     ; GCN: $sgpr0_sgpr1 = COPY [[S_BFE_U64_]]
82     %0:sgpr(s32) = COPY $sgpr0
83     %1:sgpr(s1) = G_TRUNC %0
84     %2:sgpr(s64) = G_ZEXT %1
85     $sgpr0_sgpr1 = COPY %2
86 ...
88 ---
90 name: zext_sgpr_s8_to_sgpr_s32
91 legalized:       true
92 regBankSelected: true
93 body: |
94   bb.0:
95     liveins: $sgpr0
97     ; GCN-LABEL: name: zext_sgpr_s8_to_sgpr_s32
98     ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
99     ; GCN: [[S_BFE_U32_:%[0-9]+]]:sreg_32 = S_BFE_U32 [[COPY]], 524288, implicit-def $scc
100     ; GCN: $sgpr0 = COPY [[S_BFE_U32_]]
101     %0:sgpr(s32) = COPY $sgpr0
102     %1:sgpr(s8) = G_TRUNC %0
103     %2:sgpr(s32) = G_ZEXT %1
104     $sgpr0 = COPY %2
110 name: zext_sgpr_s16_to_sgpr_s32
111 legalized:       true
112 regBankSelected: true
113 body: |
114   bb.0:
115     liveins: $sgpr0
117     ; GCN-LABEL: name: zext_sgpr_s16_to_sgpr_s32
118     ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
119     ; GCN: [[S_BFE_U32_:%[0-9]+]]:sreg_32 = S_BFE_U32 [[COPY]], 1048576, implicit-def $scc
120     ; GCN: $sgpr0 = COPY [[S_BFE_U32_]]
121     %0:sgpr(s32) = COPY $sgpr0
122     %1:sgpr(s16) = G_TRUNC %0
123     %2:sgpr(s32) = G_ZEXT %1
124     $sgpr0 = COPY %2
130 name: zext_sgpr_s16_to_sgpr_s64
131 legalized:       true
132 regBankSelected: true
133 body: |
134   bb.0:
135     liveins: $sgpr0
137     ; GCN-LABEL: name: zext_sgpr_s16_to_sgpr_s64
138     ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
139     ; GCN: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
140     ; GCN: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[DEF]], %subreg.sub1
141     ; GCN: [[S_BFE_U64_:%[0-9]+]]:sreg_64_xexec = S_BFE_U64 [[REG_SEQUENCE]], 1048576, implicit-def $scc
142     ; GCN: $sgpr0_sgpr1 = COPY [[S_BFE_U64_]]
143     %0:sgpr(s32) = COPY $sgpr0
144     %1:sgpr(s16) = G_TRUNC %0
145     %2:sgpr(s64) = G_ZEXT %1
146     $sgpr0_sgpr1 = COPY %2
152 name: zext_vcc_s1_to_vgpr_s32
153 legalized:       true
154 regBankSelected: true
155 body: |
156   bb.0:
157     liveins: $vgpr0
159     ; GCN-LABEL: name: zext_vcc_s1_to_vgpr_s32
160     ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
161     ; GCN: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY]], implicit $exec
162     ; GCN: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, [[V_CMP_EQ_U32_e64_]], implicit $exec
163     ; GCN: $vgpr0 = COPY [[V_CNDMASK_B32_e64_]]
164     %0:vgpr(s32) = COPY $vgpr0
165     %1:vcc(s1) = G_ICMP intpred(eq), %0, %0
166     %2:vgpr(s32) = G_ZEXT %1
167     $vgpr0 = COPY %2
172 name: zext_vgpr_s1_to_vgpr_s32
173 legalized:       true
174 regBankSelected: true
175 body: |
176   bb.0:
177     liveins: $vgpr0
179     ; GCN-LABEL: name: zext_vgpr_s1_to_vgpr_s32
180     ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
181     ; GCN: [[V_AND_B32_e32_:%[0-9]+]]:vgpr_32 = V_AND_B32_e32 1, [[COPY]], implicit $exec
182     ; GCN: $vgpr0 = COPY [[V_AND_B32_e32_]]
183     %0:vgpr(s32) = COPY $vgpr0
184     %1:vgpr(s1) = G_TRUNC %0
185     %2:vgpr(s32) = G_ZEXT %1
186     $vgpr0 = COPY %2
191 name: zext_vgpr_s8_to_vgpr_s32
192 legalized:       true
193 regBankSelected: true
194 body: |
195   bb.0:
196     liveins: $vgpr0
198     ; GCN-LABEL: name: zext_vgpr_s8_to_vgpr_s32
199     ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
200     ; GCN: [[V_BFE_U32_:%[0-9]+]]:vgpr_32 = V_BFE_U32 [[COPY]], 0, 8, implicit $exec
201     ; GCN: $vgpr0 = COPY [[V_BFE_U32_]]
202     %0:vgpr(s32) = COPY $vgpr0
203     %1:vgpr(s8) = G_TRUNC %0
204     %2:vgpr(s32) = G_ZEXT %1
205     $vgpr0 = COPY %2
211 name: zext_vgpr_s16_to_vgpr_s32
212 legalized:       true
213 regBankSelected: true
214 body: |
215   bb.0:
216     liveins: $vgpr0
218     ; GCN-LABEL: name: zext_vgpr_s16_to_vgpr_s32
219     ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
220     ; GCN: [[V_BFE_U32_:%[0-9]+]]:vgpr_32 = V_BFE_U32 [[COPY]], 0, 16, implicit $exec
221     ; GCN: $vgpr0 = COPY [[V_BFE_U32_]]
222     %0:vgpr(s32) = COPY $vgpr0
223     %1:vgpr(s16) = G_TRUNC %0
224     %2:vgpr(s32) = G_ZEXT %1
225     $vgpr0 = COPY %2