This is an archive of the discontinued LLVM Phabricator instance.

[inline asm] repeating constraint matches the same output
AbandonedPublic

Authored by zizhar on Jul 5 2017, 7:20 AM.

Details

Summary

The problem is that in a case like that where the same variable is used twice to match to the same output:

__asm ("mov %2, %%eax\n\t"
       : "=a" (r0)
       : "0" (t0), "0" (t0));

Even though the inputs are both t0, we get the error "more than one input constraint matches the same output '1'"
gcc can handle these cases.

Diff Detail

Repository
rL LLVM

Event Timeline

zizhar created this revision.Jul 5 2017, 7:20 AM
ahatanak edited edge metadata.Jul 5 2017, 11:15 AM

I tried compiling test18 with gcc7.1 (https://godbolt.org) and it fails to compile test18 with "inconsistent operand constraints in an 'asm'". Am I using the same version of the compiler as yours?

Also, do you need this to fix a real world case? I'm not sure I understand why or when anyone would need to use the same input operand twice.

zizhar abandoned this revision.Jul 26 2017, 3:59 AM

I agree,
My bad, apparently gcc doesn't support that, I see no reason to add that.
Closing the review.