diff options
author | Dale Johannesen <dalej@apple.com> | 2010-08-24 22:33:12 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2010-08-24 22:33:12 +0000 |
commit | 46742a4771e96e598aa4ec9e67f4946d774e81d6 (patch) | |
tree | c9e55c6cea570f20c9a87e5dd603e7f60306d5b1 /clang | |
parent | 576048657ecee4548683de12e28152cb5262bcd8 (diff) | |
download | bcm5719-llvm-46742a4771e96e598aa4ec9e67f4946d774e81d6.tar.gz bcm5719-llvm-46742a4771e96e598aa4ec9e67f4946d774e81d6.zip |
Add some missing X86-specific asm constraint letters, and fix
some bugs in setting allowsRegister on the ones there.
8348447.
llvm-svn: 111980
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 22 | ||||
-rw-r--r-- | clang/test/CodeGen/asm.c | 22 |
2 files changed, 40 insertions, 4 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index af4925b429b..ebda7fbc410 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -1202,6 +1202,15 @@ X86TargetInfo::validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const { switch (*Name) { default: return false; + case 'Y': // first letter of a pair: + switch (*(Name+1)) { + default: return false; + case '0': // First SSE register. + case 't': // Any SSE register, when SSE2 is enabled. + case 'i': // Any SSE register, when SSE2 and inter-unit moves enabled. + case 'm': // any MMX register, when inter-unit moves enabled. + break; // falls through to setAllowsRegister. + } case 'a': // eax. case 'b': // ebx. case 'c': // ecx. @@ -1209,22 +1218,27 @@ X86TargetInfo::validateAsmConstraint(const char *&Name, case 'S': // esi. case 'D': // edi. case 'A': // edx:eax. + case 'f': // any x87 floating point stack register. case 't': // top of floating point stack. case 'u': // second from top of floating point stack. case 'q': // Any register accessible as [r]l: a, b, c, and d. case 'y': // Any MMX register. case 'x': // Any SSE register. case 'Q': // Any register accessible as [r]h: a, b, c, and d. + case 'R': // "Legacy" registers: ax, bx, cx, dx, di, si, sp, bp. + case 'l': // "Index" registers: any general register that can be used as an + // index in a base+index memory access. + Info.setAllowsRegister(); + return true; + case 'C': // SSE floating point constant. + case 'G': // x87 floating point constant. case 'e': // 32-bit signed integer constant for use with zero-extending // x86_64 instructions. case 'Z': // 32-bit unsigned integer constant for use with zero-extending // x86_64 instructions. - case 'N': // unsigned 8-bit integer constant for use with in and out - // instructions. - case 'R': // "legacy" registers: ax, bx, cx, dx, di, si, sp, bp. - Info.setAllowsRegister(); return true; } + return false; } std::string diff --git a/clang/test/CodeGen/asm.c b/clang/test/CodeGen/asm.c index 50770288786..eb112858718 100644 --- a/clang/test/CodeGen/asm.c +++ b/clang/test/CodeGen/asm.c @@ -168,3 +168,25 @@ float t21(long double x) { // CHECK: call x86_fp80 asm sideeffect "frndint" // CHECK-NEXT: fptrunc x86_fp80 {{.*}} to float } + +// <rdar://problem/8348447> - accept 'l' constraint +unsigned char t22(unsigned char a, unsigned char b) { + unsigned int la = a; + unsigned int lb = b; + unsigned int bigres; + unsigned char res; + __asm__ ("0:\n1:\n" : [bigres] "=la"(bigres) : [la] "0"(la), [lb] "c"(lb) : + "edx", "cc"); + res = bigres; + return res; +} + +// <rdar://problem/8348447> - accept 'l' constraint +unsigned char t23(unsigned char a, unsigned char b) { + unsigned int la = a; + unsigned int lb = b; + unsigned char res; + __asm__ ("0:\n1:\n" : [res] "=la"(res) : [la] "0"(la), [lb] "c"(lb) : + "edx", "cc"); + return res; +} |