Page MenuHomePhabricator

[RISCV] Prevent __builtin_riscv_orc_b_64 from being compiled RV32 target.

Authored by craig.topper on Tue, Apr 6, 12:19 PM.



The backend can't handle this and will throw a fatal error from
type legalization. It's easy enough to fix that for this intrinsic
by just splitting the IR intrinsic since it works on individual bytes.

There will be other intrinsics in the future that would be harder
to support through splitting, for example grev, gorc, and shfl. Those
would require a compare and a select be inserted to check the MSB of
their control input.

This patch adds support for preventing this in the frontend with
a nice diagnostic.

Diff Detail

Event Timeline

craig.topper created this revision.Tue, Apr 6, 12:19 PM
craig.topper requested review of this revision.Tue, Apr 6, 12:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Apr 6, 12:19 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
frasercrmck added inline comments.Thu, Apr 8, 1:49 AM

What's the difference between this new feature and riscv64 above?

craig.topper added inline comments.Thu, Apr 8, 8:25 AM

The name I added to initFeatureMap has to match the feature name in because it will end up in the target-features attribute in IR.

SemaChecking just calls hasFeature, but CodeGenFunction also checks builtin features using the feature map. We check features in SemaChecking because the CodeGenFunction diagnostic isn’t phrased well for RISCV.

frasercrmck accepted this revision.Thu, Apr 8, 8:54 AM
frasercrmck added inline comments.

Ah I see, so since it has to match our "64bit" SubtargetFeature we can't reuse "riscv64"? Thanks.

This revision is now accepted and ready to land.Thu, Apr 8, 8:54 AM
craig.topper added inline comments.Thu, Apr 8, 9:11 AM