jfb added a comment.
Added a test.
Constraint validation is lacking in LLVM: it doesn't check that the input
variable matches the constraint. I do pass `mfpmath vfp` to the test in case
this gets fixed, but it's not strictly necessary right now.
The following is currently accepted:
int oops(int x) { // CHECK-LABEL: @oops(
// CHECK: call float asm "vsqrt.f32 $0, $1", "=t,t"(float
__asm__("vsqrt.f32 %0, %1"
: "=t"(x)
: "t"(x));
return x;
}
Bitcode:
define arm_aapcscc i32 @oops(i32 %x) #1 {
%1 = alloca i32, align 4
store i32 %x, i32* %1, align 4
%2 = load i32, i32* %1, align 4
%3 = call i32 asm "vsqrt.f32 $0, $1", "=t,t"(i32 %2) #2, !srcloc !7
store i32 %3, i32* %1, align 4
%4 = load i32, i32* %1, align 4
ret i32 %4
}
Here's a fun GCC comparison <https://goo.gl/mwYkIh>, which is also surprising
in a different way.
Fixing this would be an entirely different patch.
http://reviews.llvm.org/D17349
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits