[llvm] [X86] Attempt to use VPMADD52L/VPMULUDQ instead of VPMULLQ on slow VPMULLQ targets (or when VPMULLQ is unavailable) (PR #171760)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 01:05:31 PST 2025


================
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=cannonlake | FileCheck %s --check-prefix=CNL
+
+; ============================================================================
+; Case 1: 52-bit Optimization (vpmadd52luq)
+; ============================================================================
+
+define <8 x i64> @test_mul_52bit_fits(<8 x i64> %a, <8 x i64> %b) {
+; CNL-LABEL: test_mul_52bit_fits:
+; CNL:       # %bb.0:
+; CNL-NEXT:    vpxor %xmm2, %xmm2, %xmm2
+; CNL-NEXT:    vpmadd52luq %zmm1, %zmm0, %zmm2
+; CNL-NEXT:    vmovdqa64 %zmm2, %zmm0
+; CNL-NEXT:    retq
+  %a_masked = and <8 x i64> %a,
+                      <i64 4503599627370495,
+                       i64 4503599627370495,
+                       i64 4503599627370495,
+                       i64 4503599627370495,
+                       i64 4503599627370495,
+                       i64 4503599627370495,
+                       i64 4503599627370495,
+                       i64 4503599627370495>
----------------
RKSimon wrote:

Use splat where you can:
```
  %a_masked = and <8 x i64> %a,  splat (i64 4503599627370495)
```

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


More information about the llvm-commits mailing list