Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit de6038d

Browse files
committed
Revert r344873 "foo"
Rebase gone wrong left this in my tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344875 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 80da74b commit de6038d

File tree

4 files changed

+45
-62
lines changed

4 files changed

+45
-62
lines changed

lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6046,7 +6046,7 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
60466046
break;
60476047
}
60486048
if (auto *C = getTargetConstantFromNode(MaskNode)) {
6049-
DecodeVPERMILPMask(C, MaskEltSize, VT.getSizeInBits(), Mask);
6049+
DecodeVPERMILPMask(C, MaskEltSize, Mask);
60506050
break;
60516051
}
60526052
return false;
@@ -6063,7 +6063,7 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
60636063
break;
60646064
}
60656065
if (auto *C = getTargetConstantFromNode(MaskNode)) {
6066-
DecodePSHUFBMask(C, VT.getSizeInBits(), Mask);
6066+
DecodePSHUFBMask(C, Mask);
60676067
break;
60686068
}
60696069
return false;
@@ -6128,7 +6128,7 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
61286128
break;
61296129
}
61306130
if (auto *C = getTargetConstantFromNode(MaskNode)) {
6131-
DecodeVPERMIL2PMask(C, CtrlImm, MaskEltSize, VT.getSizeInBits(), Mask);
6131+
DecodeVPERMIL2PMask(C, CtrlImm, MaskEltSize, Mask);
61326132
break;
61336133
}
61346134
}
@@ -6145,7 +6145,7 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
61456145
break;
61466146
}
61476147
if (auto *C = getTargetConstantFromNode(MaskNode)) {
6148-
DecodeVPPERMMask(C, VT.getSizeInBits(), Mask);
6148+
DecodeVPPERMMask(C, Mask);
61496149
break;
61506150
}
61516151
return false;
@@ -6163,7 +6163,7 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
61636163
break;
61646164
}
61656165
if (auto *C = getTargetConstantFromNode(MaskNode)) {
6166-
DecodeVPERMVMask(C, MaskEltSize, VT.getSizeInBits(), Mask);
6166+
DecodeVPERMVMask(C, MaskEltSize, Mask);
61676167
break;
61686168
}
61696169
return false;
@@ -6178,7 +6178,7 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
61786178
SDValue MaskNode = N->getOperand(1);
61796179
unsigned MaskEltSize = VT.getScalarSizeInBits();
61806180
if (auto *C = getTargetConstantFromNode(MaskNode)) {
6181-
DecodeVPERMV3Mask(C, MaskEltSize, VT.getSizeInBits(), Mask);
6181+
DecodeVPERMV3Mask(C, MaskEltSize, Mask);
61826182
break;
61836183
}
61846184
return false;

lib/Target/X86/X86MCInstLower.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,18 +1594,6 @@ void X86AsmPrinter::EmitSEHInstruction(const MachineInstr *MI) {
15941594
}
15951595
}
15961596

1597-
static unsigned getRegisterWidth(const MCOperandInfo &Info) {
1598-
if (Info.RegClass == X86::VR128RegClassID ||
1599-
Info.RegClass == X86::VR128XRegClassID)
1600-
return 128;
1601-
if (Info.RegClass == X86::VR256RegClassID ||
1602-
Info.RegClass == X86::VR256XRegClassID)
1603-
return 256;
1604-
if (Info.RegClass == X86::VR512RegClassID)
1605-
return 512;
1606-
llvm_unreachable("Unknown register class!");
1607-
}
1608-
16091597
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
16101598
X86MCInstLower MCInstLowering(*MF, *this);
16111599
const X86RegisterInfo *RI =
@@ -1891,9 +1879,8 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
18911879

18921880
const MachineOperand &MaskOp = MI->getOperand(MaskIdx);
18931881
if (auto *C = getConstantFromPool(*MI, MaskOp)) {
1894-
unsigned Width = getRegisterWidth(MI->getDesc().OpInfo[0]);
18951882
SmallVector<int, 64> Mask;
1896-
DecodePSHUFBMask(C, Width, Mask);
1883+
DecodePSHUFBMask(C, Mask);
18971884
if (!Mask.empty())
18981885
OutStreamer->AddComment(getShuffleComment(MI, SrcIdx, SrcIdx, Mask),
18991886
!EnablePrintSchedInfo);
@@ -1964,9 +1951,8 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
19641951

19651952
const MachineOperand &MaskOp = MI->getOperand(MaskIdx);
19661953
if (auto *C = getConstantFromPool(*MI, MaskOp)) {
1967-
unsigned Width = getRegisterWidth(MI->getDesc().OpInfo[0]);
19681954
SmallVector<int, 16> Mask;
1969-
DecodeVPERMILPMask(C, ElSize, Width, Mask);
1955+
DecodeVPERMILPMask(C, ElSize, Mask);
19701956
if (!Mask.empty())
19711957
OutStreamer->AddComment(getShuffleComment(MI, SrcIdx, SrcIdx, Mask),
19721958
!EnablePrintSchedInfo);
@@ -1996,9 +1982,8 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
19961982

19971983
const MachineOperand &MaskOp = MI->getOperand(6);
19981984
if (auto *C = getConstantFromPool(*MI, MaskOp)) {
1999-
unsigned Width = getRegisterWidth(MI->getDesc().OpInfo[0]);
20001985
SmallVector<int, 16> Mask;
2001-
DecodeVPERMIL2PMask(C, (unsigned)CtrlOp.getImm(), ElSize, Width, Mask);
1986+
DecodeVPERMIL2PMask(C, (unsigned)CtrlOp.getImm(), ElSize, Mask);
20021987
if (!Mask.empty())
20031988
OutStreamer->AddComment(getShuffleComment(MI, 1, 2, Mask),
20041989
!EnablePrintSchedInfo);
@@ -2014,9 +1999,8 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
20141999

20152000
const MachineOperand &MaskOp = MI->getOperand(6);
20162001
if (auto *C = getConstantFromPool(*MI, MaskOp)) {
2017-
unsigned Width = getRegisterWidth(MI->getDesc().OpInfo[0]);
20182002
SmallVector<int, 16> Mask;
2019-
DecodeVPPERMMask(C, Width, Mask);
2003+
DecodeVPPERMMask(C, Mask);
20202004
if (!Mask.empty())
20212005
OutStreamer->AddComment(getShuffleComment(MI, 1, 2, Mask),
20222006
!EnablePrintSchedInfo);

lib/Target/X86/X86ShuffleDecodeConstantPool.cpp

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ static bool extractConstantMask(const Constant *C, unsigned MaskEltSizeInBits,
112112
return true;
113113
}
114114

115-
void DecodePSHUFBMask(const Constant *C, unsigned Width,
116-
SmallVectorImpl<int> &ShuffleMask) {
117-
assert((Width == 128 || Width == 256 || Width == 512) &&
118-
C->getType()->getPrimitiveSizeInBits() >= Width &&
115+
void DecodePSHUFBMask(const Constant *C, SmallVectorImpl<int> &ShuffleMask) {
116+
Type *MaskTy = C->getType();
117+
unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
118+
(void)MaskTySize;
119+
assert((MaskTySize == 128 || MaskTySize == 256 || MaskTySize == 512) &&
119120
"Unexpected vector size.");
120121

121122
// The shuffle mask requires a byte vector.
@@ -124,7 +125,7 @@ void DecodePSHUFBMask(const Constant *C, unsigned Width,
124125
if (!extractConstantMask(C, 8, UndefElts, RawMask))
125126
return;
126127

127-
unsigned NumElts = Width / 8;
128+
unsigned NumElts = RawMask.size();
128129
assert((NumElts == 16 || NumElts == 32 || NumElts == 64) &&
129130
"Unexpected number of vector elements.");
130131

@@ -150,10 +151,12 @@ void DecodePSHUFBMask(const Constant *C, unsigned Width,
150151
}
151152
}
152153

153-
void DecodeVPERMILPMask(const Constant *C, unsigned ElSize, unsigned Width,
154+
void DecodeVPERMILPMask(const Constant *C, unsigned ElSize,
154155
SmallVectorImpl<int> &ShuffleMask) {
155-
assert((Width == 128 || Width == 256 || Width == 512) &&
156-
C->getType()->getPrimitiveSizeInBits() >= Width &&
156+
Type *MaskTy = C->getType();
157+
unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
158+
(void)MaskTySize;
159+
assert((MaskTySize == 128 || MaskTySize == 256 || MaskTySize == 512) &&
157160
"Unexpected vector size.");
158161
assert((ElSize == 32 || ElSize == 64) && "Unexpected vector element size.");
159162

@@ -163,7 +166,7 @@ void DecodeVPERMILPMask(const Constant *C, unsigned ElSize, unsigned Width,
163166
if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
164167
return;
165168

166-
unsigned NumElts = Width / ElSize;
169+
unsigned NumElts = RawMask.size();
167170
unsigned NumEltsPerLane = 128 / ElSize;
168171
assert((NumElts == 2 || NumElts == 4 || NumElts == 8 || NumElts == 16) &&
169172
"Unexpected number of vector elements.");
@@ -186,21 +189,19 @@ void DecodeVPERMILPMask(const Constant *C, unsigned ElSize, unsigned Width,
186189
}
187190

188191
void DecodeVPERMIL2PMask(const Constant *C, unsigned M2Z, unsigned ElSize,
189-
unsigned Width,
190192
SmallVectorImpl<int> &ShuffleMask) {
191193
Type *MaskTy = C->getType();
192194
unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
193195
(void)MaskTySize;
194-
assert((MaskTySize == 128 || MaskTySize == 256) &&
195-
Width >= MaskTySize && "Unexpected vector size.");
196+
assert((MaskTySize == 128 || MaskTySize == 256) && "Unexpected vector size.");
196197

197198
// The shuffle mask requires elements the same size as the target.
198199
APInt UndefElts;
199200
SmallVector<uint64_t, 8> RawMask;
200201
if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
201202
return;
202203

203-
unsigned NumElts = Width / ElSize;
204+
unsigned NumElts = RawMask.size();
204205
unsigned NumEltsPerLane = 128 / ElSize;
205206
assert((NumElts == 2 || NumElts == 4 || NumElts == 8) &&
206207
"Unexpected number of vector elements.");
@@ -241,20 +242,17 @@ void DecodeVPERMIL2PMask(const Constant *C, unsigned M2Z, unsigned ElSize,
241242
}
242243
}
243244

244-
void DecodeVPPERMMask(const Constant *C, unsigned Width,
245-
SmallVectorImpl<int> &ShuffleMask) {
246-
Type *MaskTy = C->getType();
247-
unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
248-
(void)MaskTySize;
249-
assert(Width == 128 && Width >= MaskTySize && "Unexpected vector size.");
245+
void DecodeVPPERMMask(const Constant *C, SmallVectorImpl<int> &ShuffleMask) {
246+
assert(C->getType()->getPrimitiveSizeInBits() == 128 &&
247+
"Unexpected vector size.");
250248

251249
// The shuffle mask requires a byte vector.
252250
APInt UndefElts;
253251
SmallVector<uint64_t, 16> RawMask;
254252
if (!extractConstantMask(C, 8, UndefElts, RawMask))
255253
return;
256254

257-
unsigned NumElts = Width / 8;
255+
unsigned NumElts = RawMask.size();
258256
assert(NumElts == 16 && "Unexpected number of vector elements.");
259257

260258
for (unsigned i = 0; i != NumElts; ++i) {
@@ -293,10 +291,12 @@ void DecodeVPPERMMask(const Constant *C, unsigned Width,
293291
}
294292
}
295293

296-
void DecodeVPERMVMask(const Constant *C, unsigned ElSize, unsigned Width,
294+
void DecodeVPERMVMask(const Constant *C, unsigned ElSize,
297295
SmallVectorImpl<int> &ShuffleMask) {
298-
assert((Width == 128 || Width == 256 || Width == 512) &&
299-
C->getType()->getPrimitiveSizeInBits() >= Width &&
296+
Type *MaskTy = C->getType();
297+
unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
298+
(void)MaskTySize;
299+
assert((MaskTySize == 128 || MaskTySize == 256 || MaskTySize == 512) &&
300300
"Unexpected vector size.");
301301
assert((ElSize == 8 || ElSize == 16 || ElSize == 32 || ElSize == 64) &&
302302
"Unexpected vector element size.");
@@ -307,7 +307,7 @@ void DecodeVPERMVMask(const Constant *C, unsigned ElSize, unsigned Width,
307307
if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
308308
return;
309309

310-
unsigned NumElts = Width / ElSize;
310+
unsigned NumElts = RawMask.size();
311311

312312
for (unsigned i = 0; i != NumElts; ++i) {
313313
if (UndefElts[i]) {
@@ -319,10 +319,12 @@ void DecodeVPERMVMask(const Constant *C, unsigned ElSize, unsigned Width,
319319
}
320320
}
321321

322-
void DecodeVPERMV3Mask(const Constant *C, unsigned ElSize, unsigned Width,
322+
void DecodeVPERMV3Mask(const Constant *C, unsigned ElSize,
323323
SmallVectorImpl<int> &ShuffleMask) {
324-
assert((Width == 128 || Width == 256 || Width == 512) &&
325-
C->getType()->getPrimitiveSizeInBits() >= Width &&
324+
Type *MaskTy = C->getType();
325+
unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
326+
(void)MaskTySize;
327+
assert((MaskTySize == 128 || MaskTySize == 256 || MaskTySize == 512) &&
326328
"Unexpected vector size.");
327329
assert((ElSize == 8 || ElSize == 16 || ElSize == 32 || ElSize == 64) &&
328330
"Unexpected vector element size.");
@@ -333,7 +335,7 @@ void DecodeVPERMV3Mask(const Constant *C, unsigned ElSize, unsigned Width,
333335
if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
334336
return;
335337

336-
unsigned NumElts = Width / ElSize;
338+
unsigned NumElts = RawMask.size();
337339

338340
for (unsigned i = 0; i != NumElts; ++i) {
339341
if (UndefElts[i]) {

lib/Target/X86/X86ShuffleDecodeConstantPool.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,25 @@ class Constant;
2626
class MVT;
2727

2828
/// Decode a PSHUFB mask from an IR-level vector constant.
29-
void DecodePSHUFBMask(const Constant *C, unsigned Width,
30-
SmallVectorImpl<int> &ShuffleMask);
29+
void DecodePSHUFBMask(const Constant *C, SmallVectorImpl<int> &ShuffleMask);
3130

3231
/// Decode a VPERMILP variable mask from an IR-level vector constant.
33-
void DecodeVPERMILPMask(const Constant *C, unsigned ElSize, unsigned Width,
32+
void DecodeVPERMILPMask(const Constant *C, unsigned ElSize,
3433
SmallVectorImpl<int> &ShuffleMask);
3534

3635
/// Decode a VPERMILP2 variable mask from an IR-level vector constant.
3736
void DecodeVPERMIL2PMask(const Constant *C, unsigned MatchImm, unsigned ElSize,
38-
unsigned Width,
3937
SmallVectorImpl<int> &ShuffleMask);
4038

4139
/// Decode a VPPERM variable mask from an IR-level vector constant.
42-
void DecodeVPPERMMask(const Constant *C, unsigned Width,
43-
SmallVectorImpl<int> &ShuffleMask);
40+
void DecodeVPPERMMask(const Constant *C, SmallVectorImpl<int> &ShuffleMask);
4441

4542
/// Decode a VPERM W/D/Q/PS/PD mask from an IR-level vector constant.
46-
void DecodeVPERMVMask(const Constant *C, unsigned ElSize, unsigned Width,
43+
void DecodeVPERMVMask(const Constant *C, unsigned ElSize,
4744
SmallVectorImpl<int> &ShuffleMask);
4845

4946
/// Decode a VPERMT2 W/D/Q/PS/PD mask from an IR-level vector constant.
50-
void DecodeVPERMV3Mask(const Constant *C, unsigned ElSize, unsigned Width,
47+
void DecodeVPERMV3Mask(const Constant *C, unsigned ElSize,
5148
SmallVectorImpl<int> &ShuffleMask);
5249

5350
} // llvm namespace

0 commit comments

Comments
 (0)