r253610 - AMDGPU: Add support for 's' and 'v' asm constraints
Tom Stellard via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 19 14:11:58 PST 2015
Author: tstellar
Date: Thu Nov 19 16:11:58 2015
New Revision: 253610
URL: http://llvm.org/viewvc/llvm-project?rev=253610&view=rev
Log:
AMDGPU: Add support for 's' and 'v' asm constraints
Summary: 's' is used to specify sgprs and 'v' is used to specify vgprs.
Reviewers: arsenm, echristo
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D14307
Added:
cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=253610&r1=253609&r2=253610&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Nov 19 16:11:58 2015
@@ -1826,8 +1826,15 @@ public:
}
bool validateAsmConstraint(const char *&Name,
- TargetInfo::ConstraintInfo &info) const override {
- return true;
+ TargetInfo::ConstraintInfo &Info) const override {
+ switch (*Name) {
+ default: break;
+ case 'v': // vgpr
+ case 's': // sgpr
+ Info.setAllowsRegister();
+ return true;
+ }
+ return false;
}
ArrayRef<Builtin::Info> getTargetBuiltins() const override {
Added: cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl?rev=253610&view=auto
==============================================================================
--- cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl (added)
+++ cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl Thu Nov 19 16:11:58 2015
@@ -0,0 +1,14 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -x cl -triple amdgcn -fsyntax-only %s
+// expected-no-diagnostics
+
+kernel void test () {
+
+ int sgpr = 0, vgpr = 0, imm = 0;
+
+ // sgpr constraints
+ __asm__ ("s_mov_b32 %0, %1" : "=s" (sgpr) : "s" (imm) : );
+
+ // vgpr constraints
+ __asm__ ("v_mov_b32 %0, %1" : "=v" (vgpr) : "v" (imm) : );
+}
More information about the cfe-commits
mailing list