[llvm] [VectorCombine] foldPermuteOfBinops - support multi-use binary ops and operands in shuffle folding (PR #173153)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 22 05:32:44 PST 2025
================
@@ -64,14 +64,15 @@ define <4 x float> @fadd_v4f32_mixed_types(<4 x float> %a0) {
ret <4 x float> %post
}
-; Negative test - multiple use of fadd
define <4 x double> @fadd_v4f64_multiuse_op(<4 x double> %a, <4 x double> %b) {
; CHECK-LABEL: define <4 x double> @fadd_v4f64_multiuse_op(
; CHECK-SAME: <4 x double> [[A:%.*]], <4 x double> [[B:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[A1:%.*]] = shufflevector <4 x double> [[A]], <4 x double> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
; CHECK-NEXT: [[B1:%.*]] = shufflevector <4 x double> [[B]], <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
; CHECK-NEXT: [[OP:%.*]] = fadd <4 x double> [[A1]], [[B1]]
-; CHECK-NEXT: [[POST:%.*]] = shufflevector <4 x double> [[OP]], <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
+; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A]], <4 x double> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
+; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[B]], <4 x double> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+; CHECK-NEXT: [[POST:%.*]] = fadd <4 x double> [[TMP1]], [[TMP2]]
; CHECK-NEXT: call void @use_v4f64(<4 x double> [[OP]])
----------------
RKSimon wrote:
This wasn't expected - please can you show the cost breakdown from `opt -passes=vector-combine -debug`?
https://github.com/llvm/llvm-project/pull/173153
More information about the llvm-commits
mailing list