[llvm-branch-commits] [llvm-branch] r276664 - Merging r275928 and r276438:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jul 25 10:42:22 PDT 2016
Author: hans
Date: Mon Jul 25 12:42:22 2016
New Revision: 276664
URL: http://llvm.org/viewvc/llvm-project?rev=276664&view=rev
Log:
Merging r275928 and r276438:
------------------------------------------------------------------------
r275928 | arsenm | 2016-07-18 16:09:51 -0700 (Mon, 18 Jul 2016) | 1 line
AMDGPU: Fix test name and broken CHECK-LABEL
------------------------------------------------------------------------
------------------------------------------------------------------------
r276438 | arsenm | 2016-07-22 10:01:33 -0700 (Fri, 22 Jul 2016) | 6 lines
AMDGPU: Fix groupstaticsize for large LDS
The size can exceed s_movk_i32's limit, and we don't
want to use it this early since it inhibits optimizations.
This should probably be merged to the release branch.
------------------------------------------------------------------------
Added:
llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll
- copied, changed from r275928, llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll
Removed:
llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticgroup.ll
Modified:
llvm/branches/release_39/ (props changed)
llvm/branches/release_39/lib/Target/AMDGPU/SIISelLowering.cpp
Propchange: llvm/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 25 12:42:22 2016
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,275870,275879,275898,275935,275946,276181,276236-276237,276358,276364,276368,276389,276479
+/llvm/trunk:155241,275870,275879,275898,275928,275935,275946,276181,276236-276237,276358,276364,276368,276389,276438,276479
Modified: llvm/branches/release_39/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Target/AMDGPU/SIISelLowering.cpp?rev=276664&r1=276663&r2=276664&view=diff
==============================================================================
--- llvm/branches/release_39/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/branches/release_39/lib/Target/AMDGPU/SIISelLowering.cpp Mon Jul 25 12:42:22 2016
@@ -1134,9 +1134,9 @@ MachineBasicBlock *SITargetLowering::Emi
MachineFunction *MF = BB->getParent();
SIMachineFunctionInfo *MFI = MF->getInfo<SIMachineFunctionInfo>();
DebugLoc DL = MI.getDebugLoc();
- BuildMI(*BB, MI, DL, TII->get(AMDGPU::S_MOVK_I32))
- .addOperand(MI.getOperand(0))
- .addImm(MFI->LDSSize);
+ BuildMI(*BB, MI, DL, TII->get(AMDGPU::S_MOV_B32))
+ .addOperand(MI.getOperand(0))
+ .addImm(MFI->LDSSize);
MI.eraseFromParent();
return BB;
}
Removed: llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticgroup.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticgroup.ll?rev=276663&view=auto
==============================================================================
--- llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticgroup.ll (original)
+++ llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticgroup.ll (removed)
@@ -1,56 +0,0 @@
-; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck %s
-; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck %s
-; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck %s
-
-
- at lds0 = addrspace(3) global [512 x float] undef, align 4
- at lds1 = addrspace(3) global [256 x float] undef, align 4
-
-; FUNC-LABEL: {{^}}groupstaticsize_test0:
-; CHECK: s_movk_i32 s{{[0-9]+}}, 0x800
-define void @get_groupstaticsize_test0(float addrspace(1)* %out, i32 addrspace(1)* %lds_size) #0 {
- %tid.x = tail call i32 @llvm.amdgcn.workitem.id.x() #1
- %idx.0 = add nsw i32 %tid.x, 64
- %static_lds_size = call i32 @llvm.amdgcn.groupstaticsize() #1
- store i32 %static_lds_size, i32 addrspace(1)* %lds_size, align 4
- %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds0, i32 0, i32 %idx.0
- %val0 = load float, float addrspace(3)* %arrayidx0, align 4
- store float %val0, float addrspace(1)* %out, align 4
-
- ret void
-}
-
-
-; FUNC-LABEL: {{^}}groupstaticsize_test1:
-; CHECK: s_movk_i32 s{{[0-9]+}}, 0xc00
-define void @groupstaticsize_test1(float addrspace(1)* %out, i32 %cond, i32 addrspace(1)* %lds_size) {
-entry:
- %static_lds_size = call i32 @llvm.amdgcn.groupstaticsize() #1
- store i32 %static_lds_size, i32 addrspace(1)* %lds_size, align 4
- %tid.x = tail call i32 @llvm.amdgcn.workitem.id.x() #1
- %idx.0 = add nsw i32 %tid.x, 64
- %tmp = icmp eq i32 %cond, 0
- br i1 %tmp, label %if, label %else
-
-if: ; preds = %entry
- %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds0, i32 0, i32 %idx.0
- %val0 = load float, float addrspace(3)* %arrayidx0, align 4
- store float %val0, float addrspace(1)* %out, align 4
- br label %endif
-
-else: ; preds = %entry
- %arrayidx1 = getelementptr inbounds [256 x float], [256 x float] addrspace(3)* @lds1, i32 0, i32 %idx.0
- %val1 = load float, float addrspace(3)* %arrayidx1, align 4
- store float %val1, float addrspace(1)* %out, align 4
- br label %endif
-
-endif: ; preds = %else, %if
- ret void
-}
-
-
-declare i32 @llvm.amdgcn.groupstaticsize() #1
-declare i32 @llvm.amdgcn.workitem.id.x() #1
-
-attributes #0 = { nounwind }
-attributes #1 = { nounwind readnone }
Copied: llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll (from r275928, llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll?p2=llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll&p1=llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll&r1=275928&r2=276664&rev=276664&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll (original)
+++ llvm/branches/release_39/test/CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll Mon Jul 25 12:42:22 2016
@@ -5,8 +5,10 @@
@lds0 = addrspace(3) global [512 x float] undef, align 4
@lds1 = addrspace(3) global [256 x float] undef, align 4
+ at large = addrspace(3) global [4096 x i32] undef, align 4
+
; CHECK-LABEL: {{^}}groupstaticsize_test0:
-; CHECK: s_movk_i32 s{{[0-9]+}}, 0x800
+; CHECK: v_mov_b32_e32 v{{[0-9]+}}, 0x800{{$}}
define void @groupstaticsize_test0(float addrspace(1)* %out, i32 addrspace(1)* %lds_size) #0 {
%tid.x = tail call i32 @llvm.amdgcn.workitem.id.x() #1
%idx.0 = add nsw i32 %tid.x, 64
@@ -20,7 +22,7 @@ define void @groupstaticsize_test0(float
}
; CHECK-LABEL: {{^}}groupstaticsize_test1:
-; CHECK: s_movk_i32 s{{[0-9]+}}, 0xc00
+; CHECK: v_mov_b32_e32 v{{[0-9]+}}, 0xc00{{$}}
define void @groupstaticsize_test1(float addrspace(1)* %out, i32 %cond, i32 addrspace(1)* %lds_size) {
entry:
%static_lds_size = call i32 @llvm.amdgcn.groupstaticsize() #1
@@ -46,6 +48,17 @@ endif:
ret void
}
+; Exceeds 16-bit simm limit of s_movk_i32
+; CHECK-LABEL: {{^}}large_groupstaticsize:
+; CHECK: v_mov_b32_e32 [[REG:v[0-9]+]], 0x4000{{$}}
+define void @large_groupstaticsize(i32 addrspace(1)* %size, i32 %idx) #0 {
+ %gep = getelementptr inbounds [4096 x i32], [4096 x i32] addrspace(3)* @large, i32 0, i32 %idx
+ store volatile i32 0, i32 addrspace(3)* %gep
+ %static_lds_size = call i32 @llvm.amdgcn.groupstaticsize()
+ store i32 %static_lds_size, i32 addrspace(1)* %size
+ ret void
+}
+
declare i32 @llvm.amdgcn.groupstaticsize() #1
declare i32 @llvm.amdgcn.workitem.id.x() #1
More information about the llvm-branch-commits
mailing list