This is an archive of the discontinued LLVM Phabricator instance.

[X86] Use extended vector register classes in getRegForInlineAsmConstraint to support x/y/zmm16-31 when the type is mismatched.
ClosedPublic

Authored by craig.topper on May 2 2019, 12:22 PM.

Details

Summary

The FR32/FR64/VR128/VR256 register classes don't contain the upper 16 registers. For most cases we use the default implementation which will find any register class that contains the register in question if the VT is legal for the register class. But if the VT is i32 or i64, we won't find a matching register class and will instead up in the code modified in this patch.

If the requested register is x/y/zmm16-31 we weren't returning a register class that contains those registers and will hit an assertion in the caller.

To fix this, I've changed to use the extended register class instead. I don't believe we need a subtarget check to see if avx512 is enabled. The default implementation just pick whatever register class it finds first. I checked and we currently pick FR32X for XMM0 with an f32 type using the default implementation regardless of whether avx512 is enabled. So I assume its it is ok to do the same for i32.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.May 2 2019, 12:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2019, 12:22 PM

Add the whole patch not just the test.

rnk accepted this revision.May 6 2019, 3:36 PM

lgtm

This revision is now accepted and ready to land.May 6 2019, 3:36 PM
This revision was automatically updated to reflect the committed changes.