[PATCH] D14307: AMDGPU: Add support for 's' and 'v' asm constraints
Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 19 14:14:49 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253610: AMDGPU: Add support for 's' and 'v' asm constraints (authored by tstellar).
Changed prior to commit:
http://reviews.llvm.org/D14307?vs=39121&id=40704#toc
Repository:
rL LLVM
http://reviews.llvm.org/D14307
Files:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl
Index: cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl
===================================================================
--- cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl
+++ cfe/trunk/test/Sema/inline-asm-validate-amdgpu.cl
@@ -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) : );
+}
Index: cfe/trunk/lib/Basic/Targets.cpp
===================================================================
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -1826,8 +1826,15 @@
}
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 {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14307.40704.patch
Type: text/x-patch
Size: 1293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151119/4e619d85/attachment.bin>
More information about the cfe-commits
mailing list