[clang] [llvm] [PowerPC] Add BCDCOPYSIGN and BCDSETSIGN Instruction Support (PR #144874)
Lei Huang via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 06:23:09 PDT 2025
================
@@ -515,6 +515,10 @@ TARGET_BUILTIN(__builtin_altivec_vctzh, "V8UsV8Us", "", "power9-vector")
TARGET_BUILTIN(__builtin_altivec_vctzw, "V4UiV4Ui", "", "power9-vector")
TARGET_BUILTIN(__builtin_altivec_vctzd, "V2ULLiV2ULLi", "", "power9-vector")
+//P9 BCD builtins
+TARGET_BUILTIN(__builtin_ppc_bcdcopysign, "V16UcV16UcV16Uc", "", "power9-vector")
----------------
lei137 wrote:
> We have [some similar bcd related builtins ](https://github.com/llvm/llvm-project/blob/fe0568389d68eb828a2591fd519711694f8c1543/clang/include/clang/Basic/BuiltinsPPC.def#L528) introduced on power8 and those are using the isa as a feature key as opposed to power 8 builtin despite also using vector types.
>
> > While they were introduced in ISA 3.0, they operate on vector types and require the vector unit.
>
> FWIW I am guessing you have the right feature set and those others are incorrect, but I'm not 100% sure on when we draw the distinction between the 2 and so can't say for sure. The xl documentation you linked says it's enabled by just -qarch=power9 (no mentioned of -qaltivec) which would be the equivalent of the isa, not the vector feature.
>
> @nemanjai @lei137 Do we split out the vector functionality because we can disable the vector unit and so even though all power9s have the unit, you cannot count on it being enabled?
Yes, we are able to specifically disable vector units via options so for instructions that require vectors we need to used the features that include vector units so it can error out gracefully if it is turned off.
https://github.com/llvm/llvm-project/pull/144874
More information about the llvm-commits
mailing list