[llvm] [AArch64] Mark [usp]mull as commutative (PR #152158)

Cullen Rhodes via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 03:53:05 PDT 2025


================
@@ -6806,7 +6807,11 @@ defm ADDHN  : SIMDNarrowThreeVectorBHS<0,0b0100,"addhn", int_aarch64_neon_addhn>
 defm SUBHN  : SIMDNarrowThreeVectorBHS<0,0b0110,"subhn", int_aarch64_neon_subhn>;
 defm RADDHN : SIMDNarrowThreeVectorBHS<1,0b0100,"raddhn",int_aarch64_neon_raddhn>;
 defm RSUBHN : SIMDNarrowThreeVectorBHS<1,0b0110,"rsubhn",int_aarch64_neon_rsubhn>;
+let isCommutable = 1 in {
 defm PMULL  : SIMDDifferentThreeVectorBD<0,0b1110,"pmull", AArch64pmull>;
+defm SMULL   : SIMDLongThreeVectorBHS<0, 0b1100, "smull", AArch64smull>;
+defm UMULL   : SIMDLongThreeVectorBHS<1, 0b1100, "umull", AArch64umull>;
----------------
c-rhodes wrote:

SADDL/UADDL/SABDL/UABDL are already recognised as commutative: https://godbolt.org/z/PjbhMdd83

I suspect because they're using target-agnostic ISD nodes. I suppose I could still implement your suggestion, but if it makes no difference I'd rather not, as I can envision someone mistake seeing `isCommutable` for e.g. SADDL as what is making that work when in fact it's not.

https://github.com/llvm/llvm-project/pull/152158


More information about the llvm-commits mailing list