[PATCH] D24016: AMDGPU: Relax SGPR asm constraint register class

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 17:34:21 PDT 2016


arsenm created this revision.
arsenm added a reviewer: tstellarAMD.
arsenm added a subscriber: llvm-commits.
Herald added subscribers: wdng, arsenm.

s should be SReg_32 to be as general as possible. This can avoid a copy from m0.


https://reviews.llvm.org/D24016

Files:
  lib/Target/AMDGPU/SIISelLowering.cpp
  test/CodeGen/AMDGPU/inline-constraints.ll

Index: test/CodeGen/AMDGPU/inline-constraints.ll
===================================================================
--- test/CodeGen/AMDGPU/inline-constraints.ll
+++ test/CodeGen/AMDGPU/inline-constraints.ll
@@ -21,3 +21,13 @@
   %s256 =  tail call <8 x i32> asm sideeffect "s_load_dwordx8 $0, $1", "=s,s"(i32 addrspace(1)* %ptr)
   ret void
 }
+
+; GCN-LABEL: {{^}}inline_sreg_constraint_m0:
+; GCN: s_mov_b32 m0, -1
+; GCN-NOT: s_mov_b32 s{{[0-9]+}}, m0
+; GCN: ; use m0
+define void @inline_sreg_constraint_m0(i32 addrspace(1)* %ptr) {
+  %m0 = tail call i32 asm sideeffect "s_mov_b32 m0, -1", "={M0}"()
+  tail call void asm sideeffect "; use $0", "s"(i32 %m0)
+  ret void
+}
Index: lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.cpp
+++ lib/Target/AMDGPU/SIISelLowering.cpp
@@ -3751,7 +3751,7 @@
       default:
         return std::make_pair(0U, nullptr);
       case 32:
-        return std::make_pair(0U, &AMDGPU::SGPR_32RegClass);
+        return std::make_pair(0U, &AMDGPU::SReg_32RegClass);
       case 64:
         return std::make_pair(0U, &AMDGPU::SGPR_64RegClass);
       case 128:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24016.69638.patch
Type: text/x-patch
Size: 1193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160830/675bff08/attachment.bin>


More information about the llvm-commits mailing list