[PATCH] D15736: AMDGPU/SI: Select non-uniform constant addrspace loads to flat instructions for HSA

Changpeng Fang via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 14:43:06 PST 2015

cfang added inline comments.

Comment at: lib/Target/AMDGPU/AMDGPUInstructions.td:391
@@ -390,3 +388,1 @@
 def flat_store : PatFrag<(ops node:$val, node:$ptr),
tstellarAMD wrote:
> cfang wrote:
> > I think this def should be untouched because it is used to FLAT for real flat address.
> I didn't remove this, I just moved it into SIInstrInfo.td.  It's a GCN specific definition, so I think that is a better place for it.
The relocation is fine. But I can not understand the redefinition of flat_load.

Comment at: lib/Target/AMDGPU/CIInstructions.td:265
@@ -266,1 +264,3 @@
+def : FlatLoadPat <FLAT_LOAD_DWORDX2, flat_load, v2i32>;
+def : FlatLoadPat <FLAT_LOAD_DWORDX4, flat_load, v4i32>;
tstellarAMD wrote:
> cfang wrote:
> > Do you think we should use "mubuf_load" here? With FlatForGlobal ON, we actually disabled SelectMUBUF. As a result, we should select FLAT for mubuf here.
> flat_load matches an additional address space "FlatAddress".
Do you think FlatAddress should be matched here? 
I think we already have FlatAddress matching above in the same file:
def : FLATLoad_Pattern <FLAT_LOAD_DWORD, i32, flat_load>;

Comment at: lib/Target/AMDGPU/SIInstrInfo.td:149
@@ +148,3 @@
+         isFlatLoad(dyn_cast<LoadSDNode>(N));
tstellarAMD wrote:
> cfang wrote:
> > This def here is a little confusion because it may have side effect for the general case where FlatForGlobal is OFF.
> I'm not sure what you mean here.
If isGlobalLoad is true, then flat_load is true.  This statement is valid only when FlatForGlobal is set.


More information about the llvm-commits mailing list