[llvm-branch-commits] [llvm-branch] r164537 - in /llvm/branches/R600: lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp lib/Target/AMDGPU/R600Instructions.td test/CodeGen/R600/load.constant_addrspace.f32.ll

Tom Stellard thomas.stellard at amd.com
Mon Sep 24 08:54:34 PDT 2012


Author: tstellar
Date: Mon Sep 24 10:52:51 2012
New Revision: 164537

URL: http://llvm.org/viewvc/llvm-project?rev=164537&view=rev
Log:
R600: Handle loads from the constants address space.

Reading from constant memory is not supported yet, so constant reads use
global memory.

Added:
    llvm/branches/R600/test/CodeGen/R600/load.constant_addrspace.f32.ll
Modified:
    llvm/branches/R600/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp
    llvm/branches/R600/lib/Target/AMDGPU/R600Instructions.td

Modified: llvm/branches/R600/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp?rev=164537&r1=164536&r2=164537&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp (original)
+++ llvm/branches/R600/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp Mon Sep 24 10:52:51 2012
@@ -164,6 +164,7 @@
         Emit(inst, OS);
         break;
       }
+    case AMDGPU::CONSTANT_LOAD_eg:
     case AMDGPU::VTX_READ_PARAM_i32_eg:
     case AMDGPU::VTX_READ_PARAM_f32_eg:
     case AMDGPU::VTX_READ_GLOBAL_i8_eg:

Modified: llvm/branches/R600/lib/Target/AMDGPU/R600Instructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/AMDGPU/R600Instructions.td?rev=164537&r1=164536&r2=164537&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/AMDGPU/R600Instructions.td (original)
+++ llvm/branches/R600/lib/Target/AMDGPU/R600Instructions.td Mon Sep 24 10:52:51 2012
@@ -1171,6 +1171,15 @@
 def VTX_READ_GLOBAL_v4i32_eg : VTX_READ_GLOBAL_128_eg<v4i32>;
 def VTX_READ_GLOBAL_v4f32_eg : VTX_READ_GLOBAL_128_eg<v4f32>;
 
+//===----------------------------------------------------------------------===//
+// Constant Loads
+// XXX: We are currently storing all constants in the global address space.
+//===----------------------------------------------------------------------===//
+
+def CONSTANT_LOAD_eg : VTX_READ_32_eg <1,
+  [(set (f32 R600_TReg32_X:$dst), (constant_load ADDRVTX_READ:$ptr))]
+>;
+
 }
 
 let Predicates = [isCayman] in {

Added: llvm/branches/R600/test/CodeGen/R600/load.constant_addrspace.f32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/test/CodeGen/R600/load.constant_addrspace.f32.ll?rev=164537&view=auto
==============================================================================
--- llvm/branches/R600/test/CodeGen/R600/load.constant_addrspace.f32.ll (added)
+++ llvm/branches/R600/test/CodeGen/R600/load.constant_addrspace.f32.ll Mon Sep 24 10:52:51 2012
@@ -0,0 +1,9 @@
+;RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
+
+;CHECK: VTX_READ_eg T{{[0-9]+\.X, T[0-9]+\.X}}
+
+define void @test(float addrspace(1)* %out, float addrspace(2)* %in) {
+  %1 = load float addrspace(2)* %in
+  store float %1, float addrspace(1)* %out
+  ret void
+}





More information about the llvm-branch-commits mailing list