[all-commits] [llvm/llvm-project] 5dc0a1: [PowerPC] Fix __builtin_pdepd and __builtin_pextd ...

Amy Kwan via All-commits all-commits at lists.llvm.org
Tue Feb 15 10:31:13 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5dc0a1657be14df68bfc33deb2fb75476acdaec8
      https://github.com/llvm/llvm-project/commit/5dc0a1657be14df68bfc33deb2fb75476acdaec8
  Author: Amy Kwan <amy.kwan1 at ibm.com>
  Date:   2022-02-15 (Tue, 15 Feb 2022)

  Changed paths:
    M clang/lib/Sema/SemaChecking.cpp
    A clang/test/CodeGen/PowerPC/builtins-ppc-pwr10-64bit.c
    M llvm/test/CodeGen/PowerPC/p10-bit-manip-ops.ll

  Log Message:
  -----------
  [PowerPC] Fix __builtin_pdepd and __builtin_pextd to be 64-bit and P10 only.

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.

Differential Revision: https://reviews.llvm.org/D118753




More information about the All-commits mailing list