[clang] [llvm] [PowerPC] Add builtins for Post Quantum Cryptography Acceleration (PR #184717)
Maryam Moghadas via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 16 08:12:38 PDT 2026
================
@@ -612,6 +612,34 @@ let Predicates = [HasFutureVector] in {
v4i32:$vB))>;
}
+// Post Quantum Cryptography Acceleration patterns.
+// Use AddedComplexity to prefer these patterns over AltiVec patterns.
+let Predicates = [HasFutureVector], AddedComplexity = 400 in {
+ // Vector add
+ def : Pat<(v4i32 (add v4i32:$XA, v4i32:$XB)), (v4i32 (XVADDUWM $XA, $XB))>;
+ def : Pat<(v8i16 (add v8i16:$XA, v8i16:$XB)),
+ (COPY_TO_REGCLASS (XVADDUHM RCCp.AToVSRC, RCCp.BToVSRC), VSRC)>;
+ // Vector subtract
+ // Don't have a VSX negate instruction so use VNEGW instead.
+ def : Pat<(v4i32 (sub (v4i32 immAllZerosV), v4i32:$vB)), (v4i32 (VNEGW $vB))>;
----------------
maryammo wrote:
It seems the VNEGW pattern for negation is added but not tested.
https://github.com/llvm/llvm-project/pull/184717
More information about the cfe-commits
mailing list