Skip to content

Commit a7c8c73

Browse files
mmereckiigcbot
authored andcommitted
Update pattern match for packed <4 x i8>
This PR extends the existing implemetnation to also handle `bitcast` instructions from `float` to `<4 x i8>`.
1 parent 657fcc9 commit a7c8c73

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ namespace IGC
32473247
isa<ConstantInt>(extract->getIndexOperand()) &&
32483248
isa<BitCastInst>(extract->getVectorOperand()) &&
32493249
cast<BitCastInst>(extract->getVectorOperand())->getType()->isIntOrIntVectorTy(8) &&
3250-
cast<BitCastInst>(extract->getVectorOperand())->getOperand(0)->getType()->isIntegerTy(32))
3250+
cast<BitCastInst>(extract->getVectorOperand())->getOperand(0)->getType()->getPrimitiveSizeInBits() == 32)
32513251
{
32523252
UnpackPattern* pattern = new (m_allocator) UnpackPattern();
32533253
auto bitcast = cast<BitCastInst>(extract->getVectorOperand());
@@ -3284,7 +3284,7 @@ namespace IGC
32843284
}
32853285
};
32863286

3287-
if (I.getType()->isIntegerTy(32) &&
3287+
if (I.getType()->getPrimitiveSizeInBits() == 32 &&
32883288
I.getOperand(0)->getType()->isIntOrIntVectorTy(8) &&
32893289
isa<InsertElementInst>(I.getOperand(0)))
32903290
{
@@ -3388,7 +3388,7 @@ namespace IGC
33883388
}
33893389
};
33903390

3391-
if (I.getType()->isIntegerTy(32) &&
3391+
if ((I.getType()->getPrimitiveSizeInBits() == 32) &&
33923392
I.getOperand(0)->getType()->isIntOrIntVectorTy(8) &&
33933393
isa<InsertElementInst>(I.getOperand(0)))
33943394
{
@@ -3422,7 +3422,7 @@ namespace IGC
34223422
if (!ee ||
34233423
!isa<ConstantInt>(ee->getOperand(1)) ||
34243424
!isa<BitCastInst>(ee->getOperand(0)) ||
3425-
!(cast<BitCastInst>(ee->getOperand(0)))->getOperand(0)->getType()->isIntegerTy(32))
3425+
((cast<BitCastInst>(ee->getOperand(0)))->getOperand(0)->getType()->getPrimitiveSizeInBits() != 32))
34263426
{
34273427
return false;
34283428
}
@@ -3433,7 +3433,7 @@ namespace IGC
34333433
else
34343434
{
34353435
if (!isa<UndefValue>(baseVec) &&
3436-
(!isa<BitCastInst>(baseVec) || !(cast<BitCastInst>(baseVec))->getOperand(0)->getType()->isIntegerTy(32)))
3436+
(!isa<BitCastInst>(baseVec) || (cast<BitCastInst>(baseVec))->getOperand(0)->getType()->getPrimitiveSizeInBits() != 32))
34373437
{
34383438
return false;
34393439
}
@@ -3535,7 +3535,7 @@ namespace IGC
35353535
if (isa<ConstantInt>(extract->getIndexOperand()) &&
35363536
isa<BitCastInst>(extract->getVectorOperand()) &&
35373537
cast<BitCastInst>(extract->getVectorOperand())->getType()->isIntOrIntVectorTy(8) &&
3538-
cast<BitCastInst>(extract->getVectorOperand())->getOperand(0)->getType()->isIntegerTy(32))
3538+
cast<BitCastInst>(extract->getVectorOperand())->getOperand(0)->getType()->getPrimitiveSizeInBits() == 32)
35393539
{
35403540
sources[i] = std::make_tuple(
35413541
true,

0 commit comments

Comments
 (0)