This is an archive of the discontinued LLVM Phabricator instance.

[inline asm] "=i" output constraint support - gcc compatiblity
ClosedPublic

Authored by zizhar on Mar 27 2017, 1:14 AM.

Details

Summary

https://bugs.llvm.org/show_bug.cgi?id=32027

In gcc, "i" is being ignored as an output constraint - when there's another char besides '+'\'=' and 'i', gcc ignores 'i' completely (just in output constraint).
In order to be gcc compatible, we need to ignore it as well.
The following patch ignores the 'i' and making sure things as "=i" are still not allowed.

('i' makes no sense as an output constraint but gcc allows it and ignores it.)

Diff Detail

Repository
rL LLVM

Event Timeline

zizhar created this revision.Mar 27 2017, 1:14 AM
ahatanak added inline comments.
lib/Basic/TargetInfo.cpp
506 ↗(On Diff #90145)

If we are going to ignore 'i', should we ignore other constraints for immediate operands too (for example, 'n', 'E", and 'F')?

zizhar added inline comments.May 3 2017, 4:19 AM
lib/Basic/TargetInfo.cpp
506 ↗(On Diff #90145)

I agree, we should.
I will add these cases aswell :)

zizhar updated this revision to Diff 97602.May 3 2017, 4:39 AM
rnk accepted this revision.May 12 2017, 3:41 PM

lgtm

This revision is now accepted and ready to land.May 12 2017, 3:41 PM
This revision was automatically updated to reflect the committed changes.

I am getting errors with clang-tidy, is this the right place to ask for those additional constraints?

CUDA allows a few more output constraints --> https://docs.nvidia.com/cuda/inline-ptx-assembly/index.html#constraints

1.1.2. Constraints
There is a separate constraint letter for each PTX register type:

"h" = .u16 reg
"r" = .u32 reg
"l" = .u64 reg
"f" = .f32 reg
"d" = .f64 reg