This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't match x87 register inline asm constraints unless the VT is floating point or its a clobber
ClosedPublic

Authored by craig.topper on Sep 10 2020, 4:19 PM.

Details

Summary

The register class picked will be the RFP80 register class which has a f80 VT. The code in SelectionDAGBuilder that generates copies around inline assembly doesn't know how to handle an integer and floating point type of different bit widths.

The test case is derived from this https://godbolt.org/z/sEa659 which gcc accepts but clang crashes on. This patch just gives a more graceful error. I'm not sure if the single element struct case is special in gcc. Adding another field to the struct makes gcc reject it. If we want to support this correctly I think we need a change in the frontend to give us the true element type. Right now the frontend just realizes the constraint can take a memory argument so creates an integer type of the same size and bitcasts.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 10 2020, 4:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2020, 4:19 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
craig.topper requested review of this revision.Sep 10 2020, 4:19 PM
RKSimon accepted this revision.Sep 17 2020, 6:37 AM

LGTM

This revision is now accepted and ready to land.Sep 17 2020, 6:37 AM