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

Cullen Rhodes via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 07:20:35 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

For global-isel it's not recognised: https://godbolt.org/z/PTEP6ddT7 so I've added tests for these other ops you pointed out and split them out into #152512 so the affect of this patch is clearer.

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


More information about the llvm-commits mailing list