summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Thompson <John.Thompson.JTSoftware@gmail.com>2010-09-18 01:15:13 +0000
committerJohn Thompson <John.Thompson.JTSoftware@gmail.com>2010-09-18 01:15:13 +0000
commit12240612813fbb520d77819e0f59a377a81114c8 (patch)
tree5c4462e093243fa38532f7ac60ade319187aa2ba
parenta701509229f658eac7c10bd6aa54cf6ed5b5011d (diff)
downloadbcm5719-llvm-12240612813fbb520d77819e0f59a377a81114c8.tar.gz
bcm5719-llvm-12240612813fbb520d77819e0f59a377a81114c8.zip
Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
llvm-svn: 114253
-rw-r--r--clang/lib/Basic/TargetInfo.cpp3
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp9
-rw-r--r--clang/test/CodeGen/asm-inout.c12
-rw-r--r--clang/test/Parser/asm-constraints-pr7869.c2
4 files changed, 17 insertions, 9 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index c7036bfd049..c7176413e0f 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -295,9 +295,8 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
Info.setAllowsMemory();
break;
case ',': // multiple alternative constraint. Pass it.
- Name++;
// Handle additional optional '=' or '+' modifiers.
- if (*Name == '=' || *Name == '+')
+ if (Name[1] == '=' || Name[1] == '+')
Name++;
break;
case '?': // Disparage slightly code.
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index a70534d2ca3..e83bea6d586 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -861,14 +861,11 @@ static std::string
SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
llvm::SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=0) {
std::string Result;
- std::string tmp;
while (*Constraint) {
switch (*Constraint) {
default:
- tmp = Target.convertConstraint(*Constraint);
- if (Result.find(tmp) == std::string::npos) // Combine unique constraints
- Result += tmp;
+ Result += Target.convertConstraint(*Constraint);
break;
// Ignore these
case '*':
@@ -877,8 +874,8 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
case '=': // Will see this and the following in mult-alt constraints.
case '+':
break;
- case ',': // FIXME - Until the back-end properly supports
- return Result; // multiple alternative constraints, we stop here.
+ case ',':
+ Result += "|";
break;
case 'g':
Result += "imr";
diff --git a/clang/test/CodeGen/asm-inout.c b/clang/test/CodeGen/asm-inout.c
index f04276693e2..5b0a5f7ef16 100644
--- a/clang/test/CodeGen/asm-inout.c
+++ b/clang/test/CodeGen/asm-inout.c
@@ -17,3 +17,15 @@ void test2() {
// CHECK: store i32 {{%[a-zA-Z0-9\.]+}}, i32* [[REGCALLRESULT]]
asm ("foobar" : "+r"(*foo()));
}
+
+// PR7338
+void test3(int *vout, int vin)
+{
+ // CHECK: call void asm "opr $0,$1", "=*r|m|r,r|m|r,~{di},~{dirflag},~{fpsr},~{flags}"
+asm(
+ "opr %[vout],%[vin]"
+ : [vout] "=r,=m,=r" (*vout)
+ : [vin] "r,m,r" (vin)
+ : "edi"
+ );
+}
diff --git a/clang/test/Parser/asm-constraints-pr7869.c b/clang/test/Parser/asm-constraints-pr7869.c
index d6f1725f1a8..db369911cf8 100644
--- a/clang/test/Parser/asm-constraints-pr7869.c
+++ b/clang/test/Parser/asm-constraints-pr7869.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 %s
int a, b, c, d, e, f, g, h, i, j, k, l;
OpenPOWER on IntegriCloud