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

ChenZheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 01:17:05 PST 2023


shchenz added a comment.

I think this is a good direction. For example we can avoid the crash in https://github.com/llvm/llvm-project/issues/60959 and give a clear diagnostic message.

However, manually adding the required target feature seems a little mistakable, like the one below. I guess we can not get the required feature in the LLVM instruction TDs(if the builtin is mapped to a IR intrinsic and the intrinsic is selected inside the instruction TD) because this is done in CLANG? 
Really need to way to make sure that the instruction are marked with the accurate target feature, if not possible to do this inside the compiler, an offline script maybe? Checking the instruction one by one is a little time-consuming.



================
Comment at: clang/include/clang/Basic/BuiltinsPPC.def:491
+TARGET_BUILTIN(__builtin_altivec_vabsduh, "V8UsV8UsV8Us", "", "altivec")
+TARGET_BUILTIN(__builtin_altivec_vabsduw, "V4UiV4UiV4Ui", "", "altivec")
 
----------------
These builtins `vabsdub`, `vabsduh`, `vabsduw`  should require ISA3.0 which is not altivec or vsx. Do we have a reasonable feature for Power9 instructions, `power9-vector` maybe?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143467/new/

https://reviews.llvm.org/D143467



More information about the cfe-commits mailing list