Skip to content

Commit

Permalink
Changes in code.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnBodrova authored and mnaczk committed Sep 29, 2022
1 parent 1b59692 commit f5a2985
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions IGC/VectorCompiler/lib/GenXCodeGen/GenXPatternMatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3311,17 +3311,11 @@ bool GenXPatternMatch::distributeIntegerMul(Function *F) {
// where ShtAmt[0] is a constant vector and ShtAmt[i] are constant splats.
static bool analyzeForShiftPattern(Constant *C,
SmallVectorImpl<Constant *> &ShtAmt,
const DataLayout &DL,
const llvm::GenXSubtarget &Subtarget) {
const DataLayout &DL) {
unsigned Width = 8;
auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(C->getType());
if (!VT || VT->getScalarSizeInBits() == 1)
if (!VT || VT->getNumElements() <= Width || VT->getScalarSizeInBits() == 1)
return false;

unsigned ElmSz = VT->getScalarSizeInBits() / genx::ByteBits;
unsigned Width = Subtarget.getGRFByteSize() / ElmSz;
if (cast<IGCLLVM::FixedVectorType>(VT)->getNumElements() <= Width)
return false;

unsigned NElts = VT->getNumElements();
if (NElts % Width != 0)
return false;
Expand Down Expand Up @@ -3394,9 +3388,6 @@ static bool analyzeForShiftPattern(Constant *C,
}

bool GenXPatternMatch::vectorizeConstants(Function *F) {
const GenXSubtarget *ST = &getAnalysis<TargetPassConfig>()
.getTM<GenXTargetMachine>()
.getGenXSubtarget();
bool Changed = false;
for (auto &BB : F->getBasicBlockList()) {
for (auto I = BB.begin(); I != BB.end();) {
Expand All @@ -3419,7 +3410,7 @@ bool GenXPatternMatch::vectorizeConstants(Function *F) {
C->getSplatValue())
continue;
SmallVector<Constant *, 8> ShtAmt;
if (analyzeForShiftPattern(C, ShtAmt, *DL, *ST)) {
if (analyzeForShiftPattern(C, ShtAmt, *DL)) {
// W1 = wrrregion(undef, ShtAmt[0], 0);
// V2 = fadd ShtAmt[0], ShtAmt[1]
// W2 = wrregion(W1, V2, Width)
Expand Down

0 comments on commit f5a2985

Please sign in to comment.