@@ -3946,7 +3946,7 @@ void EmitPass::emitEvalAttribute(llvm::GenIntrinsicInst* inst)
3946
3946
m_encoder->Send(m_destination, payload, exDesc, messDesc, false);
3947
3947
m_encoder->Push();
3948
3948
3949
- ResourceLoop (needLoop, flag, label);
3949
+ ResourceLoopBackEdge (needLoop, flag, label);
3950
3950
}
3951
3951
}
3952
3952
break;
@@ -4368,7 +4368,7 @@ void EmitPass::emitLdInstruction(llvm::Instruction* inst)
4368
4368
m_encoder->Copy(m_currShader->GetNULL(), m_currShader->GetTSC());
4369
4369
m_encoder->Push();
4370
4370
}
4371
- ResourceLoop (needLoop, flag, label);
4371
+ ResourceLoopBackEdge (needLoop, flag, label);
4372
4372
4373
4373
{
4374
4374
if (m_destination->IsUniform())
@@ -7202,7 +7202,7 @@ void EmitPass::emitSampleInstruction(SampleIntrinsic* inst)
7202
7202
m_encoder->Copy(m_currShader->GetNULL(), m_currShader->GetTSC());
7203
7203
m_encoder->Push();
7204
7204
}
7205
- ResourceLoop (needLoop, flag, label);
7205
+ ResourceLoopBackEdge (needLoop, flag, label);
7206
7206
7207
7207
{
7208
7208
if (simd8HFRet)
@@ -7359,7 +7359,7 @@ void EmitPass::emitInfoInstruction(InfoIntrinsic* inst)
7359
7359
m_encoder->Info(opCode, writeMask, resource, lod, tempDest);
7360
7360
m_encoder->Push();
7361
7361
7362
- ResourceLoop (needLoop, flag, label);
7362
+ ResourceLoopBackEdge (needLoop, flag, label);
7363
7363
7364
7364
if (tempDest != m_destination)
7365
7365
{
@@ -7441,7 +7441,7 @@ void EmitPass::emitSurfaceInfo(GenIntrinsicInst* inst)
7441
7441
m_encoder->Push();
7442
7442
7443
7443
IGC_ASSERT(m_destination->IsUniform());
7444
- ResourceLoop (needLoop, flag, label);
7444
+ ResourceLoopBackEdge (needLoop, flag, label);
7445
7445
ResetVMask(false);
7446
7446
}
7447
7447
@@ -7557,7 +7557,7 @@ void EmitPass::emitGather4Instruction(SamplerGatherIntrinsic* inst)
7557
7557
m_encoder->Copy(m_currShader->GetNULL(), m_currShader->GetTSC());
7558
7558
m_encoder->Push();
7559
7559
}
7560
- ResourceLoop (needLoop, flag, label);
7560
+ ResourceLoopBackEdge (needLoop, flag, label);
7561
7561
7562
7562
{
7563
7563
if (simd8HFRet)
@@ -7637,7 +7637,7 @@ void EmitPass::emitLdmsInstruction(llvm::Instruction* inst)
7637
7637
m_encoder->Copy(m_currShader->GetNULL(), m_currShader->GetTSC());
7638
7638
m_encoder->Push();
7639
7639
}
7640
- ResourceLoop (needLoop, flag, label);
7640
+ ResourceLoopBackEdge (needLoop, flag, label);
7641
7641
7642
7642
if (simd8HFRet)
7643
7643
{
@@ -8638,11 +8638,11 @@ void EmitPass::EmitGenIntrinsicMessage(llvm::GenIntrinsicInst* inst)
8638
8638
break;
8639
8639
case GenISAIntrinsic::GenISA_ldrawvector_indexed:
8640
8640
case GenISAIntrinsic::GenISA_ldraw_indexed:
8641
- emitLoadRawIndexed(inst);
8641
+ emitLoadRawIndexed(cast<LdRawIntrinsic>( inst) );
8642
8642
break;
8643
8643
case GenISAIntrinsic::GenISA_storerawvector_indexed:
8644
8644
case GenISAIntrinsic::GenISA_storeraw_indexed:
8645
- emitStoreRawIndexed(inst);
8645
+ emitStoreRawIndexed(cast<StoreRawIntrinsic>( inst) );
8646
8646
break;
8647
8647
case GenISAIntrinsic::GenISA_GetBufferPtr:
8648
8648
emitGetBufferPtr(inst);
@@ -9676,14 +9676,14 @@ void EmitPass::emitUAVSerialize()
9676
9676
}
9677
9677
9678
9678
9679
- void EmitPass::emitLoadRawIndexed(GenIntrinsicInst * inst)
9679
+ void EmitPass::emitLoadRawIndexed(LdRawIntrinsic * inst)
9680
9680
{
9681
- Value* buf_ptrv = inst->getOperand(0 );
9682
- Value* elem_idxv = inst->getOperand(1 );
9681
+ Value* buf_ptrv = inst->getResourceValue( );
9682
+ Value* elem_idxv = inst->getOffsetValue( );
9683
9683
9684
9684
ResourceDescriptor resource = GetResourceVariable(buf_ptrv);
9685
9685
m_currShader->isMessageTargetDataCacheDataPort = true;
9686
- emitLoad3DInner(cast<LdRawIntrinsic>( inst) , resource, elem_idxv);
9686
+ emitLoad3DInner(inst, resource, elem_idxv);
9687
9687
9688
9688
}
9689
9689
@@ -9901,7 +9901,7 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc
9901
9901
m_encoder->Cast(m_destination, gatherDest);
9902
9902
m_encoder->Push();
9903
9903
}
9904
- ResourceLoop (needLoop, flag, label);
9904
+ ResourceLoopBackEdge (needLoop, flag, label);
9905
9905
}
9906
9906
}
9907
9907
@@ -10818,41 +10818,26 @@ void EmitPass::emitSymbolRelocation(Function& F)
10818
10818
}
10819
10819
}
10820
10820
10821
- void EmitPass::emitStoreRawIndexed(GenIntrinsicInst * inst)
10821
+ void EmitPass::emitStoreRawIndexed(StoreRawIntrinsic * inst)
10822
10822
{
10823
- Value* pBufPtr = inst->getOperand(0 );
10824
- Value* pElmIdx = inst->getOperand(1 );
10825
- Value* pValToStore = inst->getOperand(2 );
10823
+ Value* pBufPtr = inst->getResourceValue( );
10824
+ Value* pOffset = inst->getOffsetValue( );
10825
+ Value* pValToStore = inst->getStoreValue( );
10826
10826
10827
10827
m_currShader->isMessageTargetDataCacheDataPort = true;
10828
10828
10829
- emitStore3DInner(pValToStore, pBufPtr, pElmIdx );
10829
+ emitStore3DInner(pValToStore, pBufPtr, pOffset );
10830
10830
10831
10831
}
10832
10832
10833
10833
void EmitPass::emitStore3D(StoreInst* inst, Value* elmIdxV)
10834
10834
{
10835
- Value* ptrVal = inst->getPointerOperand();
10836
- Value* pllElmIdx = nullptr;
10837
- if (elmIdxV)
10838
- {
10839
- pllElmIdx = elmIdxV;
10840
- }
10841
- else if (isa<ConstantPointerNull>(ptrVal))
10842
- {
10843
- pllElmIdx = ConstantInt::get(Type::getInt32Ty(inst->getContext()), 0);
10844
- }
10845
- else
10846
- {
10847
- pllElmIdx = inst->getPointerOperand();
10848
- }
10849
-
10850
10835
// Only support for scratch space added currently during emitStore
10851
10836
Value* pllValToStore = inst->getValueOperand();
10852
10837
Value* pllDstPtr = inst->getPointerOperand();
10853
10838
10854
10839
10855
- emitStore3DInner(pllValToStore, pllDstPtr, pllElmIdx );
10840
+ emitStore3DInner(pllValToStore, pllDstPtr, elmIdxV );
10856
10841
}
10857
10842
10858
10843
void EmitPass::emitStore3DInner(Value* pllValToStore, Value* pllDstPtr, Value* pllElmIdx)
@@ -10955,7 +10940,7 @@ void EmitPass::emitStore3DInner(Value* pllValToStore, Value* pllDstPtr, Value* p
10955
10940
m_encoder->Scatter4Scaled(storedVal, resource, ptr);
10956
10941
m_encoder->Push();
10957
10942
}
10958
- ResourceLoop (needLoop, flag, label);
10943
+ ResourceLoopBackEdge (needLoop, flag, label);
10959
10944
if (!isPrivateMem)
10960
10945
{
10961
10946
ResetVMask(false);
@@ -13357,8 +13342,8 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst* pInsn)
13357
13342
pDst);
13358
13343
m_encoder->Push();
13359
13344
}
13360
- ResourceLoop (needLoop, flag, label);
13361
- }
13345
+ ResourceLoopBackEdge (needLoop, flag, label);
13346
+ }
13362
13347
13363
13348
13364
13349
}
@@ -13553,7 +13538,7 @@ void EmitPass::emitAtomicTyped(GenIntrinsicInst* pInsn)
13553
13538
EU_GEN7_5_MESSAGE_TARGET_DATA_PORT_DATA_CACHE_1, exDesc, pMessDesc);
13554
13539
m_encoder->Push();
13555
13540
}
13556
- ResourceLoop (needLoop, flag, label);
13541
+ ResourceLoopBackEdge (needLoop, flag, label);
13557
13542
13558
13543
if (returnsImmValue)
13559
13544
{
@@ -13670,7 +13655,7 @@ void EmitPass::emitTypedRead(llvm::Instruction* pInsn)
13670
13655
m_encoder->Push();
13671
13656
}
13672
13657
}
13673
- ResourceLoop (needLoop, flag, label);
13658
+ ResourceLoopBackEdge (needLoop, flag, label);
13674
13659
13675
13660
if (m_currShader->m_SIMDSize != instWidth)
13676
13661
{
@@ -13818,7 +13803,7 @@ void EmitPass::emitTypedWrite(llvm::Instruction* pInsn)
13818
13803
}
13819
13804
}
13820
13805
}
13821
- ResourceLoop (needLoop, flag, label);
13806
+ ResourceLoopBackEdge (needLoop, flag, label);
13822
13807
}
13823
13808
ResetVMask();
13824
13809
m_currShader->isMessageTargetDataCacheDataPort = true;
@@ -14329,7 +14314,7 @@ void EmitPass::emitAtomicCounter(llvm::GenIntrinsicInst* pInsn)
14329
14314
}
14330
14315
}
14331
14316
14332
- ResourceLoop (needLoop, flag, label);
14317
+ ResourceLoopBackEdge (needLoop, flag, label);
14333
14318
ResetVMask();
14334
14319
m_currShader->isMessageTargetDataCacheDataPort = true;
14335
14320
}
@@ -14925,16 +14910,14 @@ void EmitPass::emitftoi(llvm::GenIntrinsicInst* inst)
14925
14910
ResetRoundingMode(inst);
14926
14911
}
14927
14912
14928
- // Return true if this store will be emit as uniform store
14929
- bool EmitPass::isUniformStoreOCL(llvm::StoreInst* SI)
14913
+ bool EmitPass::isUniformStoreOCL(Value* ptr, Value* storeVal)
14930
14914
{
14931
14915
if (m_currShader->GetShaderType() != ShaderType::OPENCL_SHADER ||
14932
- !m_currShader->GetIsUniform(SI->getPointerOperand() ))
14916
+ !m_currShader->GetIsUniform(ptr ))
14933
14917
{
14934
14918
return false;
14935
14919
}
14936
14920
14937
- Value* storeVal = SI->getValueOperand();
14938
14921
Type* Ty = storeVal->getType();
14939
14922
VectorType* VTy = dyn_cast<VectorType>(Ty);
14940
14923
uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
@@ -14947,10 +14930,16 @@ bool EmitPass::isUniformStoreOCL(llvm::StoreInst* SI)
14947
14930
// size must be 4 or 8. Also, note that if totalBytes = 4, elts must be 1.
14948
14931
bool doUniformStore = (elts == 1 ||
14949
14932
(m_currShader->GetIsUniform(storeVal) &&
14950
- (totalBytes == 8 || totalBytes == 12 || totalBytes == 16)));
14933
+ (totalBytes == 8 || totalBytes == 12 || totalBytes == 16)));
14951
14934
return doUniformStore;
14952
14935
}
14953
14936
14937
+ // Return true if this store will be emit as uniform store
14938
+ bool EmitPass::isUniformStoreOCL(llvm::StoreInst* SI)
14939
+ {
14940
+ return isUniformStoreOCL(SI->getPointerOperand(), SI->getValueOperand());
14941
+ }
14942
+
14954
14943
void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
14955
14944
{
14956
14945
uint destMask = m_currShader->GetExtractMask(BCI);
@@ -15555,7 +15544,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
15555
15544
15556
15545
ResourceDescriptor resource = GetResourceVariable(Ptr);
15557
15546
CountStatelessIndirectAccess(Ptr, resource);
15558
- // eOffset is in bytes as 2/19/14
15547
+ // eOffset is in bytes
15559
15548
// offset corresponds to Int2Ptr operand obtained during pattern matching
15560
15549
CVariable* eOffset = GetSymbol(immOffset ? offset : Ptr);
15561
15550
if (useA32)
@@ -16001,7 +15990,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO
16001
15990
{
16002
15991
ForceDMask(false);
16003
15992
}
16004
- // As 2/19/14, eOffset is in bytes !
15993
+ // eOffset is in bytes
16005
15994
// offset corresponds to Int2Ptr operand obtained during pattern matching
16006
15995
CVariable* eOffset = GetSymbol(immOffset ? offset : Ptr);
16007
15996
bool useA32 = !isA64Ptr(ptrType, m_currShader->GetContext());
@@ -17318,7 +17307,8 @@ bool EmitPass::ResourceLoopHeader(
17318
17307
CVariable*& flag,
17319
17308
uint& label)
17320
17309
{
17321
- if (resource.m_surfaceType != ESURFACE_BINDLESS && resource.m_surfaceType != ESURFACE_NORMAL)
17310
+ if (resource.m_surfaceType != ESURFACE_BINDLESS &&
17311
+ resource.m_surfaceType != ESURFACE_NORMAL)
17322
17312
{
17323
17313
// Loop only needed for access with surface state
17324
17314
return false;
@@ -17379,7 +17369,7 @@ bool EmitPass::ResourceLoopHeader(
17379
17369
return true;
17380
17370
}
17381
17371
17382
- void EmitPass::ResourceLoop (bool needLoop, CVariable* flag, uint label)
17372
+ void EmitPass::ResourceLoopBackEdge (bool needLoop, CVariable* flag, uint label)
17383
17373
{
17384
17374
if (needLoop)
17385
17375
{
0 commit comments