[cfe-commits] r122679 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGen/asm-variable.c
Rafael Espindola
rafael.espindola at gmail.com
Sat Jan 1 19:59:13 PST 2011
Author: rafael
Date: Sat Jan 1 21:59:13 2011
New Revision: 122679
URL: http://llvm.org/viewvc/llvm-project?rev=122679&view=rev
Log:
Add support for passing variables declared to use a xmm register to asm
statements using the "x" constraint.
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGen/asm-variable.c
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=122679&r1=122678&r2=122679&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sat Jan 1 21:59:13 2011
@@ -938,7 +938,8 @@
return Constraint;
llvm::StringRef Register = Attr->getLabel();
assert(Target.isValidGCCRegisterName(Register));
- if (Constraint != "r") {
+ // FIXME: We should check which registers are compatible with "r" or "x".
+ if (Constraint != "r" && Constraint != "x") {
CGM.ErrorUnsupported(&Stmt, "__asm__");
return Constraint;
}
Modified: cfe/trunk/test/CodeGen/asm-variable.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm-variable.c?rev=122679&r1=122678&r2=122679&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/asm-variable.c (original)
+++ cfe/trunk/test/CodeGen/asm-variable.c Sat Jan 1 21:59:13 2011
@@ -25,3 +25,35 @@
}
// CHECK: call i64 asm "call *$1", "={rax},r,{rdi},{rsi},{rdx},{rcx},{r8},{r9},~{dirflag},~{fpsr},~{flags}"
+
+unsigned long long foo2(unsigned long long addr, double a0,
+ double a1, double a2,
+ double a3, double a4,
+ double a5, double a6, double a7) {
+ register double b0 asm("xmm0");
+ register double b1 asm("xmm1");
+ register double b2 asm("xmm2");
+ register double b3 asm("xmm3");
+ register double b4 asm("xmm4");
+ register double b5 asm("xmm5");
+ register double b6 asm("xmm6");
+ register double b7 asm("xmm7");
+
+ register unsigned long long result asm("rax");
+
+ b0 = a0;
+ b1 = a1;
+ b2 = a2;
+ b3 = a3;
+ b4 = a4;
+ b5 = a5;
+ b6 = a6;
+ b7 = a7;
+
+ asm("call *%1" : "=r" (result)
+ : "r"(addr), "x" (b0), "x" (b1), "x" (b2), "x" (b3), "x" (b4), "x" (b5), "x" (b6),
+ "x" (b7));
+ return result;
+}
+
+// CHECK: call i64 asm "call *$1", "={rax},r,{xmm0},{xmm1},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},~{dirflag},~{fpsr},~{flags}
More information about the cfe-commits
mailing list