@@ -744,8 +744,9 @@ bool EmitPass::runOnFunction(llvm::Function &F) {
744744 m_encoder->SetIsCodePatchCandidate(false);
745745 }
746746
747- if (m_pCtx->platform.supportDualSimd8PS() && m_pCtx->platform.isCoreChildOf(IGFX_XE2_HPG_CORE) &&
748- m_currShader->GetShaderType() == ShaderType::PIXEL_SHADER) {
747+ if (m_pCtx->platform.supportDualSimd8PS() &&
748+ m_pCtx->platform.isCoreChildOf(IGFX_XE2_HPG_CORE) &&
749+ m_currShader->GetShaderType() == ShaderType::PIXEL_SHADER ) {
749750 m_encoder->SetIsCodePatchCandidate(false);
750751 }
751752 } else {
@@ -3998,8 +3999,7 @@ void EmitPass::emitVideoAnalyticGRF(llvm::GenIntrinsicInst *inst, const DWORD re
39983999
39994000static bool isVectorTypeAllowed(Value *I) {
40004001 IGCLLVM::FixedVectorType *VecType = llvm::dyn_cast<IGCLLVM::FixedVectorType>(I->getType());
4001- if (!VecType)
4002- return false;
4002+ if (!VecType) return false;
40034003 auto ElType = VecType->getElementType();
40044004 return ElType->isIntegerTy(32) || ElType->isFloatTy();
40054005}
@@ -4045,10 +4045,8 @@ void EmitPass::BinaryUnary(llvm::Instruction *inst, const SSource source[2], con
40454045 break;
40464046 case Instruction::FAdd:
40474047 case Instruction::Add:
4048- if (inst->getType()->isVectorTy())
4049- Add(source, modifier);
4050- else
4051- EmitSimpleAlu(inst, source, modifier);
4048+ if (inst->getType()->isVectorTy()) Add(source, modifier);
4049+ else EmitSimpleAlu(inst, source, modifier);
40524050 break;
40534051 case Instruction::Call:
40544052 EmitAluIntrinsic(cast<CallInst>(inst), source, modifier);
@@ -4247,6 +4245,7 @@ static unsigned getVectorSize(Value *I) {
42474245 return NumElements;
42484246}
42494247
4248+
42504249void EmitPass::FPTrunc(const SSource sources[2], const DstModifier &modifier) {
42514250
42524251 CVariable *src[2];
@@ -4352,18 +4351,13 @@ bool EmitPass::isVectorEmissionPossible(const SSource sources[2], CVariable *src
43524351 // any non ordinary state of source modifiers
43534352 // can be a sign of emission of a specific pattern,
43544353 // emission can interfere with
4355- if (sources[0].elementOffset != 0)
4356- return false;
4357- if (sources[1].elementOffset != 0)
4358- return false;
4359- if (sources[0].SIMDOffset != 0)
4360- return false;
4361- if (sources[1].SIMDOffset != 0)
4362- return false;
4354+ if (sources[0].elementOffset != 0) return false;
4355+ if (sources[1].elementOffset != 0) return false;
4356+ if (sources[0].SIMDOffset != 0) return false;
4357+ if (sources[1].SIMDOffset != 0) return false;
43634358
43644359 bool AllowedVectorTypes = isVectorTypeAllowed(sources[0].value) && isVectorTypeAllowed(sources[1].value);
4365- if (!AllowedVectorTypes)
4366- return false;
4360+ if (!AllowedVectorTypes) return false;
43674361
43684362 bool DestSizeEquals = false;
43694363 // it's possible have a case where two uniform vectors are
@@ -4738,8 +4732,7 @@ void EmitPass::VectorMad(const SSource sources[3], const DstModifier &modifier)
47384732void EmitPass::FDiv(const SSource sources[2], const DstModifier &modifier) {
47394733
47404734 CVariable *src[2];
4741- for (int i = 0; i < 2; ++i)
4742- src[i] = GetSrcVariable(sources[i]);
4735+ for (int i = 0; i < 2; ++i) src[i] = GetSrcVariable(sources[i]);
47434736 bool IsPossible = isVectorEmissionPossible(sources, src);
47444737
47454738 if (IGC_IS_FLAG_ENABLED(EnableVectorEmitter) && IsPossible) {
@@ -5704,7 +5697,8 @@ void EmitPass::emitSimdShuffle(llvm::Instruction *inst) {
57045697 CVariable *tempCopy = m_currShader->GetNewVariable(simdChannel, "SanitizedIndexShuffleTmp");
57055698 m_encoder->And(tempCopy, simdChannel, m_currShader->ImmToVariable(maskOfValidLanes, ISA_TYPE_UW));
57065699 simdChannelUW = m_currShader->BitCast(tempCopy, ISA_TYPE_UW);
5707- } else {
5700+ }
5701+ else {
57085702 m_encoder->SetSrcRegion(0, 2, 1, 0);
57095703 m_encoder->SetDstRegion(2);
57105704 m_encoder->And(simdChannelUW, simdChannelUW, m_currShader->ImmToVariable(maskOfValidLanes, ISA_TYPE_UW));
@@ -8753,13 +8747,12 @@ void EmitPass::EmitGenIntrinsicMessage(llvm::GenIntrinsicInst *inst) {
87538747 break;
87548748 case GenISAIntrinsic::GenISA_ldrawvector_indexed:
87558749 case GenISAIntrinsic::GenISA_ldraw_indexed:
8756- emitLoadRawIndexed(cast<LdRawIntrinsic>(inst), cast<LdRawIntrinsic>(inst)->getOffsetValue(), nullptr, nullptr,
8757- false /*flipVarOffsetSign*/);
8750+ emitLoadRawIndexed(cast<LdRawIntrinsic>(inst), cast<LdRawIntrinsic>(inst)->getOffsetValue(), nullptr, nullptr);
87588751 break;
87598752 case GenISAIntrinsic::GenISA_storerawvector_indexed:
87608753 case GenISAIntrinsic::GenISA_storeraw_indexed:
87618754 emitStoreRawIndexed(cast<StoreRawIntrinsic>(inst), cast<StoreRawIntrinsic>(inst)->getOffsetValue(), nullptr,
8762- nullptr, false /*flipVarOffsetSign*/ );
8755+ nullptr);
87638756 break;
87648757 case GenISAIntrinsic::GenISA_GetBufferPtr:
87658758 emitGetBufferPtr(inst);
@@ -9225,7 +9218,6 @@ void EmitPass::EmitIntrinsicMessage(llvm::IntrinsicInst *inst) {
92259218 case Intrinsic::fabs:
92269219 case Intrinsic::trap:
92279220 case Intrinsic::experimental_noalias_scope_decl:
9228- case Intrinsic::assume:
92299221 // do nothing
92309222 break;
92319223 case Intrinsic::stacksave:
@@ -10447,8 +10439,8 @@ void EmitPass::setRovCacheCtrl(GenIntrinsicInst *inst) {
1044710439 inst->setMetadata("lsc.cache.ctrl", node);
1044810440}
1044910441
10450- void EmitPass::emitLoadRawIndexed(LdRawIntrinsic *inst, Value *varOffset, ConstantInt *immScale, ConstantInt *immOffset,
10451- bool flipVarOffsetSign ) {
10442+ void EmitPass::emitLoadRawIndexed(LdRawIntrinsic *inst, Value *varOffset, ConstantInt *immScale,
10443+ ConstantInt *immOffset ) {
1045210444 Value *bufPtrv = inst->getResourceValue();
1045310445
1045410446 LSC_DOC_ADDR_SPACE addrSpace = m_pCtx->getUserAddrSpaceMD().Get(inst);
@@ -10459,7 +10451,7 @@ void EmitPass::emitLoadRawIndexed(LdRawIntrinsic *inst, Value *varOffset, Consta
1045910451 }
1046010452 LSC_CACHE_OPTS cacheOpts = translateLSCCacheControlsFromMetadata(inst, true);
1046110453 emitLSCVectorLoad(inst, bufPtrv,
10462- varOffset, immOffset, immScale, flipVarOffsetSign, cacheOpts, addrSpace
10454+ varOffset, immOffset, immScale, cacheOpts, addrSpace
1046310455 );
1046410456 return;
1046510457 }
@@ -10718,8 +10710,7 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic *inst, ResourceDescriptor &resourc
1071810710 }
1071910711}
1072010712
10721- void EmitPass::emitLoad(LoadInst *inst, Value *offset, ConstantInt *immOffset, ConstantInt *immScale,
10722- bool flipVarOffsetSign
10713+ void EmitPass::emitLoad(LoadInst *inst, Value *offset, ConstantInt *immOffset, ConstantInt *immScale
1072310714) {
1072410715 if (m_pCtx->getModuleMetaData()->isHDCFastClearShader) {
1072510716 emitFastClear(inst);
@@ -10731,13 +10722,13 @@ void EmitPass::emitLoad(LoadInst *inst, Value *offset, ConstantInt *immOffset, C
1073110722 LSC_DOC_ADDR_SPACE addrSpace = m_pCtx->getUserAddrSpaceMD().Get(inst);
1073210723
1073310724 emitLSCVectorLoad(inst, inst->getPointerOperand(),
10734- offset, immOffset, immScale, flipVarOffsetSign, cacheOpts, addrSpace
10725+ offset, immOffset, immScale, cacheOpts, addrSpace
1073510726 );
1073610727 return;
1073710728 }
1073810729 IGC_ASSERT_MESSAGE(immScale ? immScale->getSExtValue() == 1 : true, "Immediate Scale not supported on non-LSC path!");
1073910730
10740- emitVectorLoad(inst, offset, immOffset, flipVarOffsetSign );
10731+ emitVectorLoad(inst, offset, immOffset);
1074110732}
1074210733
1074310734void EmitPass::emitPredicatedLoad(Instruction *inst) {
@@ -10752,7 +10743,7 @@ void EmitPass::emitPredicatedLoad(Instruction *inst) {
1075210743 LSC_DOC_ADDR_SPACE addrSpace = m_pCtx->getUserAddrSpaceMD().Get(inst);
1075310744
1075410745 emitLSCVectorLoad(inst, offset,
10755- offset, nullptr, nullptr, false, cacheOpts, addrSpace
10746+ offset, nullptr, nullptr, cacheOpts, addrSpace
1075610747 );
1075710748}
1075810749
@@ -11789,7 +11780,7 @@ void EmitPass::emitSymbolRelocation(Function &F) {
1178911780}
1179011781
1179111782void EmitPass::emitStoreRawIndexed(StoreRawIntrinsic *inst, Value *varOffset, ConstantInt *immScale,
11792- ConstantInt *immOffset, bool flipVarOffsetSign ) {
11783+ ConstantInt *immOffset) {
1179311784 Value *pBufPtr = inst->getResourceValue();
1179411785 Value *pValToStore = inst->getStoreValue();
1179511786
@@ -11800,8 +11791,8 @@ void EmitPass::emitStoreRawIndexed(StoreRawIntrinsic *inst, Value *varOffset, Co
1180011791
1180111792 LSC_CACHE_OPTS cacheOpts = translateLSCCacheControlsFromMetadata(inst, false);
1180211793 emitLSCVectorStore(pBufPtr,
11803- varOffset, immOffset, immScale, flipVarOffsetSign, pValToStore, inst->getParent(), cacheOpts,
11804- inst->getAlignment(), false, addrSpace
11794+ varOffset, immOffset, immScale, pValToStore, inst->getParent(), cacheOpts, inst->getAlignment() ,
11795+ false, addrSpace
1180511796 );
1180611797 return;
1180711798 }
@@ -11926,21 +11917,20 @@ void EmitPass::emitStore3DInner(Value *pllValToStore, Value *pllDstPtr, Value *p
1192611917 }
1192711918}
1192811919
11929- void EmitPass::emitStore(StoreInst *inst, Value *varOffset, ConstantInt *immOffset, ConstantInt *immScale,
11930- bool flipVarOffsetSign
11920+ void EmitPass::emitStore(StoreInst *inst, Value *varOffset, ConstantInt *immOffset, ConstantInt *immScale
1193111921) {
1193211922 if (shouldGenerateLSC(inst)) {
1193311923 LSC_DOC_ADDR_SPACE addrSpace = m_pCtx->getUserAddrSpaceMD().Get(inst);
1193411924
1193511925 LSC_CACHE_OPTS cacheOpts = translateLSCCacheControlsFromMetadata(inst, false);
1193611926 emitLSCVectorStore(inst->getPointerOperand(),
11937- varOffset, immOffset, immScale, flipVarOffsetSign, inst->getValueOperand(), inst->getParent(),
11938- cacheOpts, IGCLLVM::getAlignmentValue(inst), inst->getMetadata("enable.vmask"), addrSpace
11927+ varOffset, immOffset, immScale, inst->getValueOperand(), inst->getParent(), cacheOpts ,
11928+ IGCLLVM::getAlignmentValue(inst), inst->getMetadata("enable.vmask"), addrSpace
1193911929 );
1194011930 return;
1194111931 }
1194211932 IGC_ASSERT_MESSAGE(immScale ? immScale->getSExtValue() == 1 : true, "Immediate Scale not supported on non-LSC path!");
11943- emitVectorStore(inst, varOffset, immOffset, flipVarOffsetSign );
11933+ emitVectorStore(inst, varOffset, immOffset);
1194411934}
1194511935
1194611936void EmitPass::emitPredicatedStore(Instruction *inst) {
@@ -11953,8 +11943,7 @@ void EmitPass::emitPredicatedStore(Instruction *inst) {
1195311943 LSC_CACHE_OPTS cacheOpts = translateLSCCacheControlsFromMetadata(inst, false);
1195411944
1195511945 emitLSCVectorStore(inst->getOperand(0),
11956- inst->getOperand(0), nullptr, nullptr, false /*flipVarOffsetSign*/, inst->getOperand(1),
11957- inst->getParent(), cacheOpts,
11946+ inst->getOperand(0), nullptr, nullptr, inst->getOperand(1), inst->getParent(), cacheOpts,
1195811947 cast<ConstantInt>(inst->getOperand(2))->getZExtValue(), // alignment
1195911948 inst->getMetadata("enable.vmask"), addrSpace
1196011949 ,
@@ -14647,7 +14636,7 @@ CVariable *EmitPass::UnpackOrBroadcastIfUniform(CVariable *pVar) {
1464714636}
1464814637
1464914638void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst *pInst, Value *dstAddr, ConstantInt *immOffset,
14650- ConstantInt *immScale, bool flipVarOffsetSign
14639+ ConstantInt *immScale
1465114640) {
1465214641 ForceDMask();
1465314642 // Currently, Dword Atomics can be called by matching 2 intrinsics. One is the
@@ -14721,13 +14710,6 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst *pInst, Value *dstAddr, Cons
1472114710
1472214711 // Dst address in bytes.
1472314712 CVariable *pDstAddr = GetSymbol(dstAddr);
14724- if (flipVarOffsetSign) {
14725- CVariable *eNegBase = m_currShader->GetNewVariable(pDstAddr, CName(pDstAddr->getName(), "Neg"));
14726- m_encoder->SetSrcModifier(0, EMOD_NEG);
14727- m_encoder->Copy(eNegBase, pDstAddr); // MOV with -src modifier
14728- m_encoder->Push();
14729- pDstAddr = eNegBase;
14730- }
1473114713
1473214714
1473314715 PointerType *PtrTy = dyn_cast<PointerType>(dstAddr->getType());
@@ -16649,7 +16631,7 @@ void EmitPass::emitFastClearSend(llvm::Instruction *pInst) {
1664916631 m_encoder->Push();
1665016632}
1665116633
16652- void EmitPass::emitVectorLoad(LoadInst *inst, Value *offset, ConstantInt *immOffset, bool flipVarOffsetSign ) {
16634+ void EmitPass::emitVectorLoad(LoadInst *inst, Value *offset, ConstantInt *immOffset) {
1665316635 int immOffsetInt = 0;
1665416636 if (immOffset)
1665516637 immOffsetInt = static_cast<int>(immOffset->getSExtValue());
@@ -16663,13 +16645,6 @@ void EmitPass::emitVectorLoad(LoadInst *inst, Value *offset, ConstantInt *immOff
1666316645 // eOffset is in bytes
1666416646 // offset corresponds to Int2Ptr operand obtained during pattern matching
1666516647 CVariable *eOffset = GetSymbol(immOffset ? offset : Ptr);
16666- if (flipVarOffsetSign) {
16667- CVariable *eNegOffset = m_currShader->GetNewVariable(eOffset, CName(eOffset->getName(), "Neg"));
16668- m_encoder->SetSrcModifier(0, EMOD_NEG);
16669- m_encoder->Copy(eNegOffset, eOffset); // MOV with -src modifier
16670- m_encoder->Push();
16671- eOffset = eNegOffset;
16672- }
1667316648 if (useA32) {
1667416649 eOffset = TruncatePointer(eOffset);
1667516650 }
@@ -17108,7 +17083,7 @@ void EmitPass::emitVectorLoad(LoadInst *inst, Value *offset, ConstantInt *immOff
1710817083 }
1710917084}
1711017085
17111- void EmitPass::emitVectorStore(StoreInst *inst, Value *offset, ConstantInt *immOffset, bool flipVarOffsetSign ) {
17086+ void EmitPass::emitVectorStore(StoreInst *inst, Value *offset, ConstantInt *immOffset) {
1711217087 int immOffsetInt = 0;
1711317088 if (immOffset)
1711417089 immOffsetInt = static_cast<int>(immOffset->getSExtValue());
@@ -17125,13 +17100,6 @@ void EmitPass::emitVectorStore(StoreInst *inst, Value *offset, ConstantInt *immO
1712517100 // eOffset is in bytes
1712617101 // offset corresponds to Int2Ptr operand obtained during pattern matching
1712717102 CVariable *eOffset = GetSymbol(immOffset ? offset : Ptr);
17128- if (flipVarOffsetSign) {
17129- CVariable *eNegOffset = m_currShader->GetNewVariable(eOffset, CName(eOffset->getName(), "Neg"));
17130- m_encoder->SetSrcModifier(0, EMOD_NEG);
17131- m_encoder->Copy(eNegOffset, eOffset); // MOV with -src modifier
17132- m_encoder->Push();
17133- eOffset = eNegOffset;
17134- }
1713517103 bool useA32 = !isA64Ptr(ptrType, m_currShader->GetContext());
1713617104 if (useA32) {
1713717105 eOffset = TruncatePointer(eOffset);
@@ -17806,7 +17774,7 @@ void EmitPass::emitLSCVectorLoad_uniform(LSC_CACHE_OPTS CacheOpts, bool UseA32,
1780617774
1780717775void EmitPass::emitLSCVectorLoad(Instruction *inst, Value *Ptr,
1780817776 Value *varOffset, ConstantInt *immOffset, ConstantInt *immScale,
17809- bool flipVarOffsetSign, LSC_CACHE_OPTS cacheOpts, LSC_DOC_ADDR_SPACE addrSpace
17777+ LSC_CACHE_OPTS cacheOpts, LSC_DOC_ADDR_SPACE addrSpace
1781017778) {
1781117779
1781217780 bool predicatedLoad = false;
@@ -17836,13 +17804,6 @@ void EmitPass::emitLSCVectorLoad(Instruction *inst, Value *Ptr,
1783617804 // eOffset is in bytes
1783717805 // offset corresponds to Int2Ptr operand obtained during pattern matching
1783817806 CVariable *eOffset = GetSymbol(varOffset);
17839- if (flipVarOffsetSign) {
17840- CVariable *eNegOffset = m_currShader->GetNewVariable(eOffset, CName(eOffset->getName(), "Neg"));
17841- m_encoder->SetSrcModifier(0, EMOD_NEG);
17842- m_encoder->Copy(eNegOffset, eOffset); // MOV with -src modifier
17843- m_encoder->Push();
17844- eOffset = eNegOffset;
17845- }
1784617807 if (useA32) {
1784717808 eOffset = TruncatePointer(eOffset);
1784817809 }
@@ -18194,9 +18155,9 @@ void EmitPass::emitLSCVectorStore_uniform(LSC_CACHE_OPTS CacheOpts, bool UseA32,
1819418155}
1819518156
1819618157void EmitPass::emitLSCVectorStore(Value *Ptr,
18197- Value *varOffset, ConstantInt *immOffset, ConstantInt *immScale,
18198- bool flipVarOffsetSign, Value *storedVal, BasicBlock *BB, LSC_CACHE_OPTS cacheOpts ,
18199- alignment_t align, bool dontForceDmask, LSC_DOC_ADDR_SPACE addrSpace
18158+ Value *varOffset, ConstantInt *immOffset, ConstantInt *immScale, Value *storedVal,
18159+ BasicBlock *BB, LSC_CACHE_OPTS cacheOpts, alignment_t align, bool dontForceDmask ,
18160+ LSC_DOC_ADDR_SPACE addrSpace
1820018161 ,
1820118162 Value *predicate) {
1820218163
@@ -18217,13 +18178,6 @@ void EmitPass::emitLSCVectorStore(Value *Ptr,
1821718178
1821818179 // offset corresponds to Int2Ptr operand obtained during pattern matching
1821918180 CVariable *eOffset = GetSymbol(varOffset);
18220- if (flipVarOffsetSign) {
18221- CVariable *eNegOffset = m_currShader->GetNewVariable(eOffset, CName(eOffset->getName(), "Neg"));
18222- m_encoder->SetSrcModifier(0, EMOD_NEG);
18223- m_encoder->Copy(eNegOffset, eOffset); // MOV with -src modifier
18224- m_encoder->Push();
18225- eOffset = eNegOffset;
18226- }
1822718181 bool useA32 = !isA64Ptr(ptrType, m_currShader->GetContext());
1822818182 LSC_ADDR_SIZE addrSize = useA32 ? LSC_ADDR_SIZE_32b : LSC_ADDR_SIZE_64b;
1822918183 if (useA32) {
0 commit comments