This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Fix __builtin_pdepd and __builtin_pextd to be 64-bit and P10 only.
ClosedPublic

Authored by amyk on Feb 1 2022, 8:51 PM.

Details

Summary

The __builtin_pdepd and __builtin_pextd are P10 builtins that are meant to
be used under 64-bit only. For instance, when the builtins are compiled under
32-bit mode:

$ cat t.c
unsigned long long foo(unsigned long long a, unsigned long long b) {
  return __builtin_pextd(a,b);
}

$ clang -c t.c -mcpu=pwr10 -m32
ExpandIntegerResult #0: t31: i64 = llvm.ppc.pextd TargetConstant:i32<6928>, t28, t29

fatal error: error in backend: Do not know how to expand the result of this operator!

This patch adds sema checking for these builtins to compile under 64-bit
mode only and on P10. The builtins will emit a diagnostic when they are compiled on
non-P10 compilations and on 32-bit mode.

Diff Detail

Event Timeline

amyk created this revision.Feb 1 2022, 8:51 PM
amyk requested review of this revision.Feb 1 2022, 8:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2022, 8:51 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
nemanjai accepted this revision.Feb 15 2022, 8:07 AM

LGTM.

This revision is now accepted and ready to land.Feb 15 2022, 8:07 AM
This revision was landed with ongoing or failed builds.Feb 15 2022, 10:31 AM
This revision was automatically updated to reflect the committed changes.