[PATCH] D19792: AMDGPU/R600: Implement loads from constant AS

Jan Vesely via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 23:19:49 PDT 2016


jvesely added inline comments.

================
Comment at: lib/Target/AMDGPU/R600ISelLowering.cpp:1067
@@ -1092,1 +1066,3 @@
+  SDValue GA = DAG.getTargetGlobalAddress(GV, SDLoc(G), ConstPtrVT);
+  return DAG.getNode(AMDGPUISD::CONST_DATA_PTR, SDLoc(G), ConstPtrVT, GA);
 }
----------------
tstellarAMD wrote:
> Why can't you lower this directly to an immediate instead of using the CONST_DATA_PTR node?
I read somewhere that conversion from GA to TGA needed some kind of wrapper pseudo instruction and CONST_DATA_PTR filled the spot.

I tried using:
Pat<
 (globaladdress:$a)
 (MOV_IMM_CONST_ADDR tglobaladdress:$a)>;
to eliminate Lowering conversion entirely but that produced:
%vreg1<def> = MOV_IMM_CONST_ADDR %vreg1; R600_Reg32:%vreg1
I guess conversions in patterns don't work.

I also tried using:
Pat<
 (tglobaladdress:$a)
 (MOV_IMM_CONST_ADDR tglobaladdress:$a)>;
and lower to TGA, but that hit assertions in a lot of places that expect register operands and the easiest way to convert TGA to a register was a wrapper node.
%vreg2<def> = ADD_INT 0, 0, 1, 0, 0, 0, <ga:@float_gv>, 0, 0, 0, -1, %vreg0, 0, 0, 0, -1, 1, pred:%PRED_SEL_OFF, 0, 0; R600_TReg32_X:%vreg2 R600_Reg32:%vreg0


Repository:
  rL LLVM

http://reviews.llvm.org/D19792





More information about the llvm-commits mailing list