r213428 - [X86 inline-asm] Error out on inline-asm constraint "=f".
Akira Hatanaka
ahatanaka at apple.com
Fri Jul 18 16:30:30 PDT 2014
Author: ahatanak
Date: Fri Jul 18 18:30:30 2014
New Revision: 213428
URL: http://llvm.org/viewvc/llvm-project?rev=213428&view=rev
Log:
[X86 inline-asm] Error out on inline-asm constraint "=f".
<rdar://problem/17476689>
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Sema/asm.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=213428&r1=213427&r2=213428&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jul 18 18:30:30 2014
@@ -2927,6 +2927,13 @@ X86TargetInfo::validateAsmConstraint(con
case 'm': // any MMX register, when inter-unit moves enabled.
break; // falls through to setAllowsRegister.
}
+ case 'f': // any x87 floating point stack register.
+ // Constraint 'f' cannot be used for output operands.
+ if (Info.ConstraintStr[0] == '=')
+ return false;
+
+ Info.setAllowsRegister();
+ return true;
case 'a': // eax.
case 'b': // ebx.
case 'c': // ecx.
@@ -2934,7 +2941,6 @@ X86TargetInfo::validateAsmConstraint(con
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.
Modified: cfe/trunk/test/Sema/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm.c?rev=213428&r1=213427&r2=213428&view=diff
==============================================================================
--- cfe/trunk/test/Sema/asm.c (original)
+++ cfe/trunk/test/Sema/asm.c Fri Jul 18 18:30:30 2014
@@ -157,3 +157,9 @@ struct foo {
};
register struct foo bar asm("sp"); // expected-error {{bad type for named register variable}}
register float baz asm("sp"); // expected-error {{bad type for named register variable}}
+
+double f_output_constraint(void) {
+ double result;
+ __asm("foo1": "=f" (result)); // expected-error {{invalid output constraint '=f' in asm}}
+ return result;
+}
More information about the cfe-commits
mailing list