This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add '32bit' feature to rv32 only builtins.
ClosedPublic

Authored by craig.topper on Aug 18 2022, 5:46 PM.

Details

Summary

The backend now has a 32bit feature as part of the recent mtune
patch. We can now use that make our rv32-only builtin error checking
work the same way as rv64-only errors.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 18 2022, 5:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2022, 5:46 PM
craig.topper requested review of this revision.Aug 18 2022, 5:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2022, 5:46 PM

Overall LGTM.

I have one concern, though. The old error message was more user friendly. Referring to RV32 as an extension is... weird. You're already massaging the error with the OF = "RV64" / OF = "RV32". Can't you special case this feature check error handling to make it print something more like the err_32_bit_builtin_64_bit_tgt message, "this builtin is only available on 32-bit targets"? (if so, the same goes for the 64-bit case).

Also, arguably this could be two separate patches, but maybe it's not worth splitting...?

clang/lib/Sema/SemaChecking.cpp
4362

That tablegen def is still being used for X86. Maybe you could make a similar patch for X86?

craig.topper added inline comments.Sep 4 2022, 8:21 PM
clang/lib/Sema/SemaChecking.cpp
4362

There's no "32bit" feature in X86.td in the backend. This was possible for RISC-V because I added "32bit" when I refactored mtune recently.

kito-cheng accepted this revision.Sep 6 2022, 8:36 AM

LGTM, and +1 for the error message improvement, but could be separated patch.

This revision is now accepted and ready to land.Sep 6 2022, 8:36 AM
This revision was automatically updated to reflect the committed changes.