This is an archive of the discontinued LLVM Phabricator instance.

X86: Rework inline asm integer register specification.
ClosedPublic

Authored by MatzeB on Jun 29 2015, 2:00 PM.

Details

Summary

This is a new version of http://reviews.llvm.org/D10260.

It turned out that when you specify an integer register in inline asm on
x86 you get the register of the required type size back. That means that
X86TargetLowering::getRegForInlineAsmConstraint() has to accept any of
the integer registers and adapt its size to the given target size which
may be any 8/16/32/64 bit sized type. Surprisingly that means given a
constraint of "{ax}" and a type of MVT::F32 we need to return X86::EAX.

This change makes this face explicit, the previous code seemed like
working by accident because there it never returned an error once a
register was found. On the other hand this rewrite allows to actually
return errors for invalid situations like requesting an integer register
for an i128 type.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 28706.Jun 29 2015, 2:00 PM
MatzeB retitled this revision from to X86: Rewrite .
MatzeB updated this object.
MatzeB edited the test plan for this revision. (Show Details)
MatzeB added reviewers: echristo, ahatanak, ab.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: Unknown Object (MLST).
MatzeB retitled this revision from X86: Rewrite to X86: Rework inline asm integer register specification..Jun 29 2015, 2:03 PM
echristo edited edge metadata.Jun 29 2015, 2:12 PM

Hi Matthias,

LGTM with a fix for the testcases (missing FileCheck etc). Also if you can avoid the temporary file it'd be great.

Thanks!

-eric

test/CodeGen/X86/asm-reject-reg-type-mismatch.ll
1 ↗(On Diff #28706)

Do you mean -filetype=asm here?

This revision was automatically updated to reflect the committed changes.