Skip to content

Commit fe19f0d

Browse files
committed
Reducing diff size
1 parent 635ff2a commit fe19f0d

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

lib/HLSL/HLOperationLower.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@ Value *TrivialBinaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
597597
Value *src1 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx);
598598
IRBuilder<> Builder(CI);
599599

600-
return TrivialDxilBinaryOperation(opcode, src0, src1, hlslOP, Builder);
600+
Value *binOp =
601+
TrivialDxilBinaryOperation(opcode, src0, src1, hlslOP, Builder);
602+
return binOp;
601603
}
602604

603605
// Translate call that trivially converts to a dxil trinary (aka tertiary)
@@ -614,7 +616,9 @@ Value *TrivialTrinaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
614616
Value *src2 = CI->getArgOperand(HLOperandIndex::kTrinaryOpSrc2Idx);
615617
IRBuilder<> Builder(CI);
616618

617-
return TrivialDxilTrinaryOperation(opcode, src0, src1, src2, hlslOP, Builder);
619+
Value *triOp =
620+
TrivialDxilTrinaryOperation(opcode, src0, src1, src2, hlslOP, Builder);
621+
return triOp;
618622
}
619623

620624
Value *TrivialIsSpecialFloat(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
@@ -1508,7 +1512,6 @@ Value *TranslateWaveA2B(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
15081512
Value *refArgs[] = {nullptr, CI->getOperand(1)};
15091513
return TrivialDxilOperation(opcode, refArgs, helper.voidTy, CI, hlslOP);
15101514
}
1511-
15121515
// Wave ballot intrinsic.
15131516
Value *TranslateWaveBallot(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
15141517
HLOperationLowerHelper &helper,
@@ -2081,7 +2084,7 @@ Value *TranslateFirstbitHi(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
20812084
HLObjectOperationLowerHelper *pObjHelper,
20822085
bool &Translated) {
20832086
Value *firstbitHi =
2084-
TrivialUnaryOperationRet(CI, IOP, opcode, helper, pObjHelper, Translated);
2087+
TrivialUnaryOperation(CI, IOP, opcode, helper, pObjHelper, Translated);
20852088
// firstbitHi == -1? -1 : (bitWidth-1 -firstbitHi);
20862089
IRBuilder<> Builder(CI);
20872090
Constant *neg1 = Builder.getInt32(-1);
@@ -2114,7 +2117,7 @@ Value *TranslateFirstbitLo(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
21142117
HLObjectOperationLowerHelper *pObjHelper,
21152118
bool &Translated) {
21162119
Value *firstbitLo =
2117-
TrivialUnaryOperationRet(CI, IOP, opcode, helper, pObjHelper, Translated);
2120+
TrivialUnaryOperation(CI, IOP, opcode, helper, pObjHelper, Translated);
21182121
return firstbitLo;
21192122
}
21202123

@@ -2276,8 +2279,8 @@ Value *TranslateExp(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
22762279
ConstantVector::getSplat(Ty->getVectorNumElements(), log2eConst);
22772280
}
22782281
val = Builder.CreateFMul(log2eConst, val);
2279-
2280-
return TrivialDxilUnaryOperation(OP::OpCode::Exp, val, hlslOP, Builder);
2282+
Value *exp = TrivialDxilUnaryOperation(OP::OpCode::Exp, val, hlslOP, Builder);
2283+
return exp;
22812284
}
22822285

22832286
Value *TranslateLog(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
@@ -2292,9 +2295,7 @@ Value *TranslateLog(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
22922295
if (Ty != Ty->getScalarType()) {
22932296
ln2Const = ConstantVector::getSplat(Ty->getVectorNumElements(), ln2Const);
22942297
}
2295-
2296-
Value *log =
2297-
TrivialDxilUnaryOperation(OP::OpCode::Log, val, hlslOP, Builder);
2298+
Value *log = TrivialDxilUnaryOperation(OP::OpCode::Log, val, hlslOP, Builder);
22982299

22992300
return Builder.CreateFMul(ln2Const, log);
23002301
}
@@ -2312,8 +2313,7 @@ Value *TranslateLog10(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
23122313
log2_10Const =
23132314
ConstantVector::getSplat(Ty->getVectorNumElements(), log2_10Const);
23142315
}
2315-
Value *log =
2316-
TrivialDxilUnaryOperation(OP::OpCode::Log, val, hlslOP, Builder);
2316+
Value *log = TrivialDxilUnaryOperation(OP::OpCode::Log, val, hlslOP, Builder);
23172317

23182318
return Builder.CreateFMul(log2_10Const, log);
23192319
}
@@ -2551,16 +2551,15 @@ Value *TranslateDot(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
25512551
Value *arg1 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx);
25522552
IRBuilder<> Builder(CI);
25532553
Type *EltTy = Ty->getScalarType();
2554-
if (EltTy->isFloatingPointTy() && Ty->getVectorNumElements() <= 4) {
2554+
if (EltTy->isFloatingPointTy() && Ty->getVectorNumElements() <= 4)
25552555
return TranslateFDot(arg0, arg1, vecSize, hlslOP, Builder);
2556-
} else {
2557-
DXIL::OpCode MadOpCode = DXIL::OpCode::IMad;
2558-
if (IOP == IntrinsicOp::IOP_udot)
2559-
MadOpCode = DXIL::OpCode::UMad;
2560-
else if (EltTy->isFloatingPointTy())
2561-
MadOpCode = DXIL::OpCode::FMad;
2562-
return ExpandDot(arg0, arg1, vecSize, hlslOP, Builder, MadOpCode);
2563-
}
2556+
2557+
DXIL::OpCode MadOpCode = DXIL::OpCode::IMad;
2558+
if (IOP == IntrinsicOp::IOP_udot)
2559+
MadOpCode = DXIL::OpCode::UMad;
2560+
else if (EltTy->isFloatingPointTy())
2561+
MadOpCode = DXIL::OpCode::FMad;
2562+
return ExpandDot(arg0, arg1, vecSize, hlslOP, Builder, MadOpCode);
25642563
}
25652564

25662565
Value *TranslateNormalize(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
@@ -2676,8 +2675,8 @@ Value *TranslateSmoothStep(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
26762675
Value *xSubMin = Builder.CreateFSub(x, minVal);
26772676
Value *satVal = Builder.CreateFDiv(xSubMin, maxSubMin);
26782677

2679-
Value *s =
2680-
TrivialDxilUnaryOperation(DXIL::OpCode::Saturate, satVal, hlslOP, Builder);
2678+
Value *s = TrivialDxilUnaryOperation(DXIL::OpCode::Saturate, satVal, hlslOP,
2679+
Builder);
26812680
// return s * s *(3-2*s).
26822681
Constant *c2 = ConstantFP::get(CI->getType(), 2);
26832682
Constant *c3 = ConstantFP::get(CI->getType(), 3);

0 commit comments

Comments
 (0)