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

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 01:39:23 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>;
----------------
davemgreen wrote:

I would keep the original order as they were alphabetical. Or move all three up above ADDHN into their own little paragraph. Either is probably OK though.

Having said that, SADDL/UADDL is also commutative, as is SABDL/UABDL. It is only SSUBL/USUBL from SIMDLongThreeVectorBHS/SIMDLongThreeVectorBHSabdl that is not. You could think about inverting the meaning of the flag and only setting it on SUBL. SIMDLongThreeVectorBHSabdl should probably be cleaned up later though, as it could be combined with SIMDLongThreeVectorBHS.

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


More information about the llvm-commits mailing list