Skip to content

Commit a9bcedf

Browse files
authored
[NFC][SPIRV] Fix breakage introduced by #170798 (#171513)
Adding support for i128 missed a few quirks of legalisation, which were masked previously by early erroring out on bitwidth > 64. i128 uses should be legal, we decide whether or not the resulting module is viable (i.e. if the required extensions are present) in the ModuleAnalysis pass.
1 parent 7062cd6 commit a9bcedf

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,19 @@ SPIRVLegalizerInfo::SPIRVLegalizerInfo(const SPIRVSubtarget &ST) {
115115
v4s1, v4s8, v4s16, v4s32, v4s64};
116116

117117
auto allScalarsAndVectors = {
118-
s1, s8, s16, s32, s64, v2s1, v2s8, v2s16, v2s32, v2s64,
119-
v3s1, v3s8, v3s16, v3s32, v3s64, v4s1, v4s8, v4s16, v4s32, v4s64,
120-
v8s1, v8s8, v8s16, v8s32, v8s64, v16s1, v16s8, v16s16, v16s32, v16s64};
118+
s1, s8, s16, s32, s64, s128, v2s1, v2s8,
119+
v2s16, v2s32, v2s64, v3s1, v3s8, v3s16, v3s32, v3s64,
120+
v4s1, v4s8, v4s16, v4s32, v4s64, v8s1, v8s8, v8s16,
121+
v8s32, v8s64, v16s1, v16s8, v16s16, v16s32, v16s64};
121122

122-
auto allIntScalarsAndVectors = {s8, s16, s32, s64, v2s8, v2s16,
123-
v2s32, v2s64, v3s8, v3s16, v3s32, v3s64,
124-
v4s8, v4s16, v4s32, v4s64, v8s8, v8s16,
125-
v8s32, v8s64, v16s8, v16s16, v16s32, v16s64};
123+
auto allIntScalarsAndVectors = {
124+
s8, s16, s32, s64, s128, v2s8, v2s16, v2s32, v2s64,
125+
v3s8, v3s16, v3s32, v3s64, v4s8, v4s16, v4s32, v4s64, v8s8,
126+
v8s16, v8s32, v8s64, v16s8, v16s16, v16s32, v16s64};
126127

127128
auto allBoolScalarsAndVectors = {s1, v2s1, v3s1, v4s1, v8s1, v16s1};
128129

129-
auto allIntScalars = {s8, s16, s32, s64};
130+
auto allIntScalars = {s8, s16, s32, s64, s128};
130131

131132
auto allFloatScalarsAndF16Vector2AndVector4s = {s16, s32, s64, v2s16, v4s16};
132133

llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,11 @@ static SPIRVType *propagateSPIRVType(MachineInstr *MI, SPIRVGlobalRegistry *GR,
388388

389389
// To support current approach and limitations wrt. bit width here we widen a
390390
// scalar register with a bit width greater than 1 to valid sizes and cap it to
391-
// 64 width.
391+
// 128 width.
392392
static unsigned widenBitWidthToNextPow2(unsigned BitWidth) {
393393
if (BitWidth == 1)
394394
return 1; // No need to widen 1-bit values
395-
return std::min(std::max(1u << Log2_32_Ceil(BitWidth), 8u), 64u);
395+
return std::min(std::max(1u << Log2_32_Ceil(BitWidth), 8u), 128u);
396396
}
397397

398398
static void widenScalarType(Register Reg, MachineRegisterInfo &MRI) {

0 commit comments

Comments
 (0)