[llvm] [X86] Fold X * Y + Z --> C + Z for vpmadd52l/vpmadd52h (PR #156293)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 02:38:25 PDT 2025
================
@@ -183,3 +183,110 @@ define <2 x i64> @test_vpmadd52l_mul_zero_scalar(<2 x i64> %x0, <2 x i64> %x1) {
%1 = call <2 x i64> @llvm.x86.avx512.vpmadd52l.uq.128(<2 x i64> %x0, <2 x i64> <i64 0, i64 123>, <2 x i64> %x1)
ret <2 x i64> %1
}
+
+define <2 x i64> @test_vpmadd52l_mul_lo52_zero(<2 x i64> %x0) {
+ ; (1 << 51) * (1 << 1) -> 1 << 52 -> low 52 bits are zeroes
+; CHECK-LABEL: test_vpmadd52l_mul_lo52_zero:
+; CHECK: # %bb.0:
+; CHECK-NEXT: retq
+ %1 = call <2 x i64> @llvm.x86.avx512.vpmadd52l.uq.128(<2 x i64> %x0, <2 x i64> splat (i64 2251799813685248), <2 x i64> splat (i64 2))
+ ret <2 x i64> %1
+}
+
+define <2 x i64> @test_vpmadd52h_mul_hi52_zero(<2 x i64> %x0) {
+ ; (1 << 25) * (1 << 26) = 1 << 51 -> high 52 bits are zeroes
----------------
RKSimon wrote:
(style) move these manual comments above the define to avoid the update script potentially mangling it
https://github.com/llvm/llvm-project/pull/156293
More information about the llvm-commits
mailing list