Skip to content

Commit 780b970

Browse files
committed
[AMDGPU][GlobalIsel] Introduce isRegisterClassType to check for legal types, instead of checking bit width.
1 parent 6d24291 commit 780b970

File tree

4 files changed

+296
-173
lines changed

4 files changed

+296
-173
lines changed

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

Lines changed: 85 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ static bool isRegisterVectorType(LLT Ty) {
239239
EltSize == 128 || EltSize == 256;
240240
}
241241

242+
// TODO: replace all uses of isRegisterType with isRegisterClassType
242243
static bool isRegisterType(LLT Ty) {
243244
if (!isRegisterSize(Ty.getSizeInBits()))
244245
return false;
@@ -258,6 +259,8 @@ static LegalityPredicate isRegisterType(unsigned TypeIdx) {
258259
}
259260

260261
// RegisterType that doesn't have a corresponding RegClass.
262+
// TODO: Once `isRegisterType` is replaced with `isRegisterClassType` this
263+
// should be removed.
261264
static LegalityPredicate isIllegalRegisterType(unsigned TypeIdx) {
262265
return [=](const LegalityQuery &Query) {
263266
LLT Ty = Query.Types[TypeIdx];
@@ -276,6 +279,85 @@ static LegalityPredicate elementTypeIsLegal(unsigned TypeIdx) {
276279
};
277280
}
278281

282+
static const LLT S1 = LLT::scalar(1);
283+
static const LLT S8 = LLT::scalar(8);
284+
static const LLT S16 = LLT::scalar(16);
285+
static const LLT S32 = LLT::scalar(32);
286+
static const LLT S64 = LLT::scalar(64);
287+
static const LLT S96 = LLT::scalar(96);
288+
static const LLT S128 = LLT::scalar(128);
289+
static const LLT S160 = LLT::scalar(160);
290+
static const LLT S224 = LLT::scalar(224);
291+
static const LLT S256 = LLT::scalar(256);
292+
static const LLT S512 = LLT::scalar(512);
293+
static const LLT MaxScalar = LLT::scalar(MaxRegisterSize);
294+
295+
static const LLT V2S8 = LLT::fixed_vector(2, 8);
296+
static const LLT V2S16 = LLT::fixed_vector(2, 16);
297+
static const LLT V4S16 = LLT::fixed_vector(4, 16);
298+
static const LLT V6S16 = LLT::fixed_vector(6, 16);
299+
static const LLT V8S16 = LLT::fixed_vector(8, 16);
300+
static const LLT V10S16 = LLT::fixed_vector(10, 16);
301+
static const LLT V12S16 = LLT::fixed_vector(12, 16);
302+
static const LLT V16S16 = LLT::fixed_vector(16, 16);
303+
304+
static const LLT V2S32 = LLT::fixed_vector(2, 32);
305+
static const LLT V3S32 = LLT::fixed_vector(3, 32);
306+
static const LLT V4S32 = LLT::fixed_vector(4, 32);
307+
static const LLT V5S32 = LLT::fixed_vector(5, 32);
308+
static const LLT V6S32 = LLT::fixed_vector(6, 32);
309+
static const LLT V7S32 = LLT::fixed_vector(7, 32);
310+
static const LLT V8S32 = LLT::fixed_vector(8, 32);
311+
static const LLT V9S32 = LLT::fixed_vector(9, 32);
312+
static const LLT V10S32 = LLT::fixed_vector(10, 32);
313+
static const LLT V11S32 = LLT::fixed_vector(11, 32);
314+
static const LLT V12S32 = LLT::fixed_vector(12, 32);
315+
static const LLT V16S32 = LLT::fixed_vector(16, 32);
316+
static const LLT V32S32 = LLT::fixed_vector(32, 32);
317+
318+
static const LLT V2S64 = LLT::fixed_vector(2, 64);
319+
static const LLT V3S64 = LLT::fixed_vector(3, 64);
320+
static const LLT V4S64 = LLT::fixed_vector(4, 64);
321+
static const LLT V5S64 = LLT::fixed_vector(5, 64);
322+
static const LLT V6S64 = LLT::fixed_vector(6, 64);
323+
static const LLT V7S64 = LLT::fixed_vector(7, 64);
324+
static const LLT V8S64 = LLT::fixed_vector(8, 64);
325+
static const LLT V16S64 = LLT::fixed_vector(16, 64);
326+
327+
static const LLT V2S128 = LLT::fixed_vector(2, 128);
328+
static const LLT V4S128 = LLT::fixed_vector(4, 128);
329+
330+
static std::initializer_list<LLT> AllScalarTypes = {S32, S64, S96, S128,
331+
S160, S224, S256, S512};
332+
333+
static std::initializer_list<LLT> AllS16Vectors{
334+
V2S16, V4S16, V6S16, V8S16, V10S16, V12S16, V16S16, V2S128, V4S128};
335+
336+
static std::initializer_list<LLT> AllS32Vectors = {
337+
V2S32, V3S32, V4S32, V5S32, V6S32, V7S32, V8S32,
338+
V9S32, V10S32, V11S32, V12S32, V16S32, V32S32};
339+
340+
static std::initializer_list<LLT> AllS64Vectors = {V2S64, V3S64, V4S64, V5S64,
341+
V6S64, V7S64, V8S64, V16S64};
342+
343+
// Checks whether a type is in the list of legal register types.
344+
static bool isRegisterClassType(LLT Ty) {
345+
if (Ty.isVector() && Ty.getElementType().isPointer())
346+
Ty = LLT::fixed_vector(Ty.getNumElements(),
347+
LLT::scalar(Ty.getScalarSizeInBits()));
348+
else if (Ty.isPointer())
349+
Ty = LLT::scalar(Ty.getScalarSizeInBits());
350+
351+
return is_contained(AllS32Vectors, Ty) || is_contained(AllS64Vectors, Ty) ||
352+
is_contained(AllScalarTypes, Ty) || is_contained(AllS16Vectors, Ty);
353+
}
354+
355+
static LegalityPredicate isRegisterClassType(unsigned TypeIdx) {
356+
return [TypeIdx](const LegalityQuery &Query) {
357+
return isRegisterClassType(Query.Types[TypeIdx]);
358+
};
359+
}
360+
279361
// If we have a truncating store or an extending load with a data size larger
280362
// than 32-bits, we need to reduce to a 32-bit type.
281363
static LegalityPredicate isWideScalarExtLoadTruncStore(unsigned TypeIdx) {
@@ -578,52 +660,6 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
578660
return LLT::pointer(AS, TM.getPointerSizeInBits(AS));
579661
};
580662

581-
const LLT S1 = LLT::scalar(1);
582-
const LLT S8 = LLT::scalar(8);
583-
const LLT S16 = LLT::scalar(16);
584-
const LLT S32 = LLT::scalar(32);
585-
const LLT S64 = LLT::scalar(64);
586-
const LLT S128 = LLT::scalar(128);
587-
const LLT S256 = LLT::scalar(256);
588-
const LLT S512 = LLT::scalar(512);
589-
const LLT MaxScalar = LLT::scalar(MaxRegisterSize);
590-
591-
const LLT V2S8 = LLT::fixed_vector(2, 8);
592-
const LLT V2S16 = LLT::fixed_vector(2, 16);
593-
const LLT V4S16 = LLT::fixed_vector(4, 16);
594-
595-
const LLT V2S32 = LLT::fixed_vector(2, 32);
596-
const LLT V3S32 = LLT::fixed_vector(3, 32);
597-
const LLT V4S32 = LLT::fixed_vector(4, 32);
598-
const LLT V5S32 = LLT::fixed_vector(5, 32);
599-
const LLT V6S32 = LLT::fixed_vector(6, 32);
600-
const LLT V7S32 = LLT::fixed_vector(7, 32);
601-
const LLT V8S32 = LLT::fixed_vector(8, 32);
602-
const LLT V9S32 = LLT::fixed_vector(9, 32);
603-
const LLT V10S32 = LLT::fixed_vector(10, 32);
604-
const LLT V11S32 = LLT::fixed_vector(11, 32);
605-
const LLT V12S32 = LLT::fixed_vector(12, 32);
606-
const LLT V13S32 = LLT::fixed_vector(13, 32);
607-
const LLT V14S32 = LLT::fixed_vector(14, 32);
608-
const LLT V15S32 = LLT::fixed_vector(15, 32);
609-
const LLT V16S32 = LLT::fixed_vector(16, 32);
610-
const LLT V32S32 = LLT::fixed_vector(32, 32);
611-
612-
const LLT V2S64 = LLT::fixed_vector(2, 64);
613-
const LLT V3S64 = LLT::fixed_vector(3, 64);
614-
const LLT V4S64 = LLT::fixed_vector(4, 64);
615-
const LLT V5S64 = LLT::fixed_vector(5, 64);
616-
const LLT V6S64 = LLT::fixed_vector(6, 64);
617-
const LLT V7S64 = LLT::fixed_vector(7, 64);
618-
const LLT V8S64 = LLT::fixed_vector(8, 64);
619-
const LLT V16S64 = LLT::fixed_vector(16, 64);
620-
621-
std::initializer_list<LLT> AllS32Vectors =
622-
{V2S32, V3S32, V4S32, V5S32, V6S32, V7S32, V8S32,
623-
V9S32, V10S32, V11S32, V12S32, V13S32, V14S32, V15S32, V16S32, V32S32};
624-
std::initializer_list<LLT> AllS64Vectors =
625-
{V2S64, V3S64, V4S64, V5S64, V6S64, V7S64, V8S64, V16S64};
626-
627663
const LLT GlobalPtr = GetAddrSpacePtr(AMDGPUAS::GLOBAL_ADDRESS);
628664
const LLT ConstantPtr = GetAddrSpacePtr(AMDGPUAS::CONSTANT_ADDRESS);
629665
const LLT Constant32Ptr = GetAddrSpacePtr(AMDGPUAS::CONSTANT_ADDRESS_32BIT);
@@ -836,10 +872,9 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
836872
.scalarize(0);
837873

838874
getActionDefinitionsBuilder(G_BITCAST)
839-
// Don't worry about the size constraint.
840-
.legalIf(all(isRegisterType(0), isRegisterType(1)))
841-
.lower();
842-
875+
// Don't worry about the size constraint.
876+
.legalIf(all(isRegisterClassType(0), isRegisterClassType(1)))
877+
.lower();
843878

844879
getActionDefinitionsBuilder(G_CONSTANT)
845880
.legalFor({S1, S32, S64, S16, GlobalPtr,
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2+
; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GPRIDX %s
3+
; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,MOVREL %s
4+
; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10PLUS,GFX10 %s
5+
; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1100 -amdgpu-enable-delay-alu=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10PLUS,GFX11 %s
6+
define void @main(<19 x i32> %arg) {
7+
; GCN-LABEL: main:
8+
; GCN: ; %bb.0: ; %bb
9+
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10+
; GCN-NEXT: s_mov_b32 s4, 0
11+
; GCN-NEXT: s_mov_b32 s12, s4
12+
; GCN-NEXT: v_cmp_eq_u16_e32 vcc, 0, v0
13+
; GCN-NEXT: v_mov_b32_e32 v1, 0
14+
; GCN-NEXT: s_mov_b32 s13, s4
15+
; GCN-NEXT: v_mov_b32_e32 v4, s12
16+
; GCN-NEXT: s_mov_b32 s5, s4
17+
; GCN-NEXT: s_mov_b32 s6, s4
18+
; GCN-NEXT: s_mov_b32 s7, s4
19+
; GCN-NEXT: s_mov_b32 s8, s4
20+
; GCN-NEXT: s_mov_b32 s9, s4
21+
; GCN-NEXT: s_mov_b32 s10, s4
22+
; GCN-NEXT: s_mov_b32 s11, s4
23+
; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
24+
; GCN-NEXT: v_mov_b32_e32 v2, v1
25+
; GCN-NEXT: v_mov_b32_e32 v3, v1
26+
; GCN-NEXT: v_mov_b32_e32 v5, s13
27+
; GCN-NEXT: image_store v[0:3], v[4:5], s[4:11] unorm
28+
; GCN-NEXT: s_waitcnt vmcnt(0)
29+
; GCN-NEXT: s_setpc_b64 s[30:31]
30+
;
31+
; GFX10-LABEL: main:
32+
; GFX10: ; %bb.0: ; %bb
33+
; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
34+
; GFX10-NEXT: s_mov_b32 s4, 0
35+
; GFX10-NEXT: v_mov_b32_e32 v1, 0
36+
; GFX10-NEXT: v_cmp_eq_u16_e32 vcc_lo, 0, v0
37+
; GFX10-NEXT: s_mov_b32 s10, s4
38+
; GFX10-NEXT: s_mov_b32 s11, s4
39+
; GFX10-NEXT: v_mov_b32_e32 v4, s10
40+
; GFX10-NEXT: v_mov_b32_e32 v2, v1
41+
; GFX10-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
42+
; GFX10-NEXT: v_mov_b32_e32 v3, v1
43+
; GFX10-NEXT: v_mov_b32_e32 v5, s11
44+
; GFX10-NEXT: s_mov_b32 s5, s4
45+
; GFX10-NEXT: s_mov_b32 s6, s4
46+
; GFX10-NEXT: s_mov_b32 s7, s4
47+
; GFX10-NEXT: s_mov_b32 s8, s4
48+
; GFX10-NEXT: s_mov_b32 s9, s4
49+
; GFX10-NEXT: image_store v[0:3], v[4:5], s[4:11] dim:SQ_RSRC_IMG_2D unorm
50+
; GFX10-NEXT: s_setpc_b64 s[30:31]
51+
;
52+
; GFX11-LABEL: main:
53+
; GFX11: ; %bb.0: ; %bb
54+
; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
55+
; GFX11-NEXT: s_mov_b32 s0, 0
56+
; GFX11-NEXT: v_cmp_eq_u16_e32 vcc_lo, 0, v0
57+
; GFX11-NEXT: s_mov_b32 s6, s0
58+
; GFX11-NEXT: s_mov_b32 s7, s0
59+
; GFX11-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v4, s6
60+
; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
61+
; GFX11-NEXT: v_mov_b32_e32 v5, s7
62+
; GFX11-NEXT: s_mov_b32 s1, s0
63+
; GFX11-NEXT: v_mov_b32_e32 v2, v1
64+
; GFX11-NEXT: v_mov_b32_e32 v3, v1
65+
; GFX11-NEXT: s_mov_b32 s2, s0
66+
; GFX11-NEXT: s_mov_b32 s3, s0
67+
; GFX11-NEXT: s_mov_b32 s4, s0
68+
; GFX11-NEXT: s_mov_b32 s5, s0
69+
; GFX11-NEXT: image_store v[0:3], v[4:5], s[0:7] dim:SQ_RSRC_IMG_2D unorm
70+
; GFX11-NEXT: s_setpc_b64 s[30:31]
71+
bb:
72+
%i = bitcast <19 x i32> %arg to <38 x i16>
73+
%i1 = extractelement <38 x i16> %i, i64 0
74+
%i2 = icmp eq i16 %i1, 0
75+
%i3 = zext i1 %i2 to i32
76+
%i4 = bitcast i32 %i3 to float
77+
%i5 = insertelement <4 x float> zeroinitializer, float %i4, i64 0
78+
call void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float> %i5, i32 0, i32 0, i32 0, <8 x i32> zeroinitializer, i32 0, i32 0)
79+
ret void
80+
}
81+
declare void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float>, i32 immarg, i32, i32, <8 x i32>, i32 immarg, i32 immarg)
82+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
83+
; GFX10PLUS: {{.*}}
84+
; GPRIDX: {{.*}}
85+
; MOVREL: {{.*}}

llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.ll

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,6 +2626,132 @@ entry:
26262626
ret double %ext
26272627
}
26282628

2629+
define amdgpu_ps double @dyn_extract_v7f64_s_v_bitcast(<14 x float> inreg %userData, i32 %sel) {
2630+
; GCN-LABEL: dyn_extract_v7f64_s_v_bitcast:
2631+
; GCN: ; %bb.0: ; %entry
2632+
; GCN-NEXT: v_mov_b32_e32 v1, s2
2633+
; GCN-NEXT: v_mov_b32_e32 v2, s3
2634+
; GCN-NEXT: v_mov_b32_e32 v3, s4
2635+
; GCN-NEXT: v_mov_b32_e32 v4, s5
2636+
; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 1, v0
2637+
; GCN-NEXT: v_mov_b32_e32 v5, s6
2638+
; GCN-NEXT: v_mov_b32_e32 v6, s7
2639+
; GCN-NEXT: v_cndmask_b32_e32 v1, v1, v3, vcc
2640+
; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v4, vcc
2641+
; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 2, v0
2642+
; GCN-NEXT: v_mov_b32_e32 v7, s8
2643+
; GCN-NEXT: v_mov_b32_e32 v8, s9
2644+
; GCN-NEXT: v_cndmask_b32_e32 v1, v1, v5, vcc
2645+
; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v6, vcc
2646+
; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 3, v0
2647+
; GCN-NEXT: v_mov_b32_e32 v9, s10
2648+
; GCN-NEXT: v_mov_b32_e32 v10, s11
2649+
; GCN-NEXT: v_cndmask_b32_e32 v1, v1, v7, vcc
2650+
; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v8, vcc
2651+
; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 4, v0
2652+
; GCN-NEXT: v_mov_b32_e32 v11, s12
2653+
; GCN-NEXT: v_mov_b32_e32 v12, s13
2654+
; GCN-NEXT: v_cndmask_b32_e32 v1, v1, v9, vcc
2655+
; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v10, vcc
2656+
; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 5, v0
2657+
; GCN-NEXT: v_mov_b32_e32 v13, s14
2658+
; GCN-NEXT: v_mov_b32_e32 v14, s15
2659+
; GCN-NEXT: v_cndmask_b32_e32 v1, v1, v11, vcc
2660+
; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v12, vcc
2661+
; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 6, v0
2662+
; GCN-NEXT: v_cndmask_b32_e32 v1, v1, v13, vcc
2663+
; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v14, vcc
2664+
; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 7, v0
2665+
; GCN-NEXT: ; kill: def $vgpr15 killed $sgpr2 killed $exec
2666+
; GCN-NEXT: ; kill: def $vgpr16 killed $sgpr3 killed $exec
2667+
; GCN-NEXT: v_cndmask_b32_e32 v0, v1, v15, vcc
2668+
; GCN-NEXT: v_cndmask_b32_e32 v1, v2, v16, vcc
2669+
; GCN-NEXT: v_readfirstlane_b32 s0, v0
2670+
; GCN-NEXT: v_readfirstlane_b32 s1, v1
2671+
; GCN-NEXT: ; return to shader part epilog
2672+
;
2673+
; GFX10-LABEL: dyn_extract_v7f64_s_v_bitcast:
2674+
; GFX10: ; %bb.0: ; %entry
2675+
; GFX10-NEXT: v_mov_b32_e32 v1, s4
2676+
; GFX10-NEXT: v_mov_b32_e32 v2, s5
2677+
; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, 1, v0
2678+
; GFX10-NEXT: s_mov_b32 s0, s14
2679+
; GFX10-NEXT: v_cndmask_b32_e32 v1, s2, v1, vcc_lo
2680+
; GFX10-NEXT: v_cndmask_b32_e32 v2, s3, v2, vcc_lo
2681+
; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, 2, v0
2682+
; GFX10-NEXT: v_cndmask_b32_e64 v1, v1, s6, vcc_lo
2683+
; GFX10-NEXT: v_cndmask_b32_e64 v2, v2, s7, vcc_lo
2684+
; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, 3, v0
2685+
; GFX10-NEXT: v_cndmask_b32_e64 v1, v1, s8, vcc_lo
2686+
; GFX10-NEXT: v_cndmask_b32_e64 v2, v2, s9, vcc_lo
2687+
; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, 4, v0
2688+
; GFX10-NEXT: v_cndmask_b32_e64 v1, v1, s10, vcc_lo
2689+
; GFX10-NEXT: v_cndmask_b32_e64 v2, v2, s11, vcc_lo
2690+
; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, 5, v0
2691+
; GFX10-NEXT: v_cndmask_b32_e64 v1, v1, s12, vcc_lo
2692+
; GFX10-NEXT: v_cndmask_b32_e64 v2, v2, s13, vcc_lo
2693+
; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, 6, v0
2694+
; GFX10-NEXT: v_cndmask_b32_e64 v1, v1, s0, vcc_lo
2695+
; GFX10-NEXT: v_cndmask_b32_e64 v2, v2, s15, vcc_lo
2696+
; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, 7, v0
2697+
; GFX10-NEXT: v_cndmask_b32_e64 v0, v1, s2, vcc_lo
2698+
; GFX10-NEXT: v_cndmask_b32_e64 v1, v2, s3, vcc_lo
2699+
; GFX10-NEXT: v_readfirstlane_b32 s0, v0
2700+
; GFX10-NEXT: v_readfirstlane_b32 s1, v1
2701+
; GFX10-NEXT: ; return to shader part epilog
2702+
;
2703+
; GFX11-LABEL: dyn_extract_v7f64_s_v_bitcast:
2704+
; GFX11: ; %bb.0: ; %entry
2705+
; GFX11-NEXT: v_dual_mov_b32 v1, s4 :: v_dual_mov_b32 v2, s5
2706+
; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, 1, v0
2707+
; GFX11-NEXT: s_mov_b32 s0, s14
2708+
; GFX11-NEXT: v_cndmask_b32_e32 v1, s2, v1, vcc_lo
2709+
; GFX11-NEXT: v_cndmask_b32_e32 v2, s3, v2, vcc_lo
2710+
; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, 2, v0
2711+
; GFX11-NEXT: v_cndmask_b32_e64 v1, v1, s6, vcc_lo
2712+
; GFX11-NEXT: v_cndmask_b32_e64 v2, v2, s7, vcc_lo
2713+
; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, 3, v0
2714+
; GFX11-NEXT: v_cndmask_b32_e64 v1, v1, s8, vcc_lo
2715+
; GFX11-NEXT: v_cndmask_b32_e64 v2, v2, s9, vcc_lo
2716+
; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, 4, v0
2717+
; GFX11-NEXT: v_cndmask_b32_e64 v1, v1, s10, vcc_lo
2718+
; GFX11-NEXT: v_cndmask_b32_e64 v2, v2, s11, vcc_lo
2719+
; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, 5, v0
2720+
; GFX11-NEXT: v_cndmask_b32_e64 v1, v1, s12, vcc_lo
2721+
; GFX11-NEXT: v_cndmask_b32_e64 v2, v2, s13, vcc_lo
2722+
; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, 6, v0
2723+
; GFX11-NEXT: v_cndmask_b32_e64 v1, v1, s0, vcc_lo
2724+
; GFX11-NEXT: v_cndmask_b32_e64 v2, v2, s15, vcc_lo
2725+
; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, 7, v0
2726+
; GFX11-NEXT: v_cndmask_b32_e64 v0, v1, s2, vcc_lo
2727+
; GFX11-NEXT: v_cndmask_b32_e64 v1, v2, s3, vcc_lo
2728+
; GFX11-NEXT: v_readfirstlane_b32 s0, v0
2729+
; GFX11-NEXT: v_readfirstlane_b32 s1, v1
2730+
; GFX11-NEXT: ; return to shader part epilog
2731+
entry:
2732+
%bc = bitcast <14 x float> %userData to <7 x double>
2733+
%ext = extractelement <7 x double> %bc, i32 %sel
2734+
ret double %ext
2735+
}
2736+
2737+
define amdgpu_ps i64 @dyn_extract_v7i64_s_v_bitcast(<14 x i32> inreg %userData, i32 %sel) {
2738+
; GCN-LABEL: dyn_extract_v7i64_s_v_bitcast:
2739+
; GCN: ; %bb.0: ; %entry
2740+
; GCN-NEXT: s_mov_b32 s0, s10
2741+
; GCN-NEXT: s_mov_b32 s1, s11
2742+
; GCN-NEXT: ; return to shader part epilog
2743+
;
2744+
; GFX10PLUS-LABEL: dyn_extract_v7i64_s_v_bitcast:
2745+
; GFX10PLUS: ; %bb.0: ; %entry
2746+
; GFX10PLUS-NEXT: s_mov_b32 s0, s10
2747+
; GFX10PLUS-NEXT: s_mov_b32 s1, s11
2748+
; GFX10PLUS-NEXT: ; return to shader part epilog
2749+
entry:
2750+
%.bc = bitcast <14 x i32> %userData to <7 x i64>
2751+
%ext = extractelement <7 x i64> %.bc, i32 4
2752+
ret i64 %ext
2753+
}
2754+
26292755
define amdgpu_ps double @dyn_extract_v7f64_s_v(<7 x double> inreg %vec, i32 %sel) {
26302756
; GCN-LABEL: dyn_extract_v7f64_s_v:
26312757
; GCN: ; %bb.0: ; %entry

0 commit comments

Comments
 (0)