[PATCH] D143467: [PowerPC] Add target feature requirement to builtins

Qiu Chaofan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 6 23:29:20 PST 2023


qiucf created this revision.
qiucf added reviewers: nemanjai, sfertile, amyk, shchenz, lkail, PowerPC.
Herald added a subscriber: kbarton.
Herald added a project: All.
qiucf requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang has mechanism to specify required target features of a built-in function. This patch adds such definitions to Altivec, VSX, HTM, PairedVec and MMA builtins.

This will help frontend to detect incompatible target features of bulitin when using `__attribute__((target("feature")))` syntax. For example,

  __attribute__((target("no-vsx")))
  void foo(vector double* d) {
    vector double a, b;
    *d = __builtin_vsx_xvmaxdp(a, b); // This would crash without this patch.
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143467

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/PowerPC/builtins-ppc-altivec.c
  clang/test/CodeGen/PowerPC/builtins-ppc-fma.c
  clang/test/CodeGen/PowerPC/builtins-ppc-fpconstrained.c
  clang/test/CodeGen/PowerPC/builtins-ppc-htm.c
  clang/test/CodeGen/PowerPC/builtins-ppc-vsx.c
  clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-test.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143467.495390.patch
Type: text/x-patch
Size: 102839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230207/e0a584eb/attachment-0001.bin>


More information about the cfe-commits mailing list