Skip to content

Commit d07b02c

Browse files
author
Greg Roth
committed
Allow vectors on or/and intrinsics
Since the or() and and() intrinsics did their own scalarization, the or/and operators would never be applied to full vectors. This leaves the scalarization for the scalarization pass, which will skip it for 6.9
1 parent 279883c commit d07b02c

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

lib/HLSL/HLOperationLower.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6210,41 +6210,17 @@ Value *TranslateAnd(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
62106210
bool &Translated) {
62116211
Value *x = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc0Idx);
62126212
Value *y = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx);
6213-
Type *Ty = CI->getType();
6214-
Type *EltTy = Ty->getScalarType();
62156213
IRBuilder<> Builder(CI);
62166214

6217-
if (Ty != EltTy) {
6218-
Value *Result = UndefValue::get(Ty);
6219-
for (unsigned i = 0; i < Ty->getVectorNumElements(); i++) {
6220-
Value *EltX = Builder.CreateExtractElement(x, i);
6221-
Value *EltY = Builder.CreateExtractElement(y, i);
6222-
Value *tmp = Builder.CreateAnd(EltX, EltY);
6223-
Result = Builder.CreateInsertElement(Result, tmp, i);
6224-
}
6225-
return Result;
6226-
}
62276215
return Builder.CreateAnd(x, y);
62286216
}
62296217
Value *TranslateOr(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
62306218
HLOperationLowerHelper &helper,
62316219
HLObjectOperationLowerHelper *pObjHelper, bool &Translated) {
62326220
Value *x = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc0Idx);
62336221
Value *y = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx);
6234-
Type *Ty = CI->getType();
6235-
Type *EltTy = Ty->getScalarType();
62366222
IRBuilder<> Builder(CI);
62376223

6238-
if (Ty != EltTy) {
6239-
Value *Result = UndefValue::get(Ty);
6240-
for (unsigned i = 0; i < Ty->getVectorNumElements(); i++) {
6241-
Value *EltX = Builder.CreateExtractElement(x, i);
6242-
Value *EltY = Builder.CreateExtractElement(y, i);
6243-
Value *tmp = Builder.CreateOr(EltX, EltY);
6244-
Result = Builder.CreateInsertElement(Result, tmp, i);
6245-
}
6246-
return Result;
6247-
}
62486224
return Builder.CreateOr(x, y);
62496225
}
62506226
Value *TranslateSelect(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,

0 commit comments

Comments
 (0)