[llvm] [PowerPC] Prefer VSX compare in vector selection (PR #65295)
Nemanja Ivanovic via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 21:55:41 PDT 2023
================
@@ -2707,6 +2707,44 @@ def : Pat<(vselect v4i32:$vA, v4f32:$vB, v4f32:$vC),
(XXSEL $vC, $vB, $vA)>;
def : Pat<(vselect v2i64:$vA, v2f64:$vB, v2f64:$vC),
(XXSEL $vC, $vB, $vA)>;
+
+def : Pat<(vselect (v4i32 (setcc v4i32:$lhs, v4i32:$rhs, SETEQ)),
+ v4i32:$tval, v4i32:$fval),
+ (XXSEL $fval, $tval, (XVCMPEQDP $lhs, $rhs))>;
+def : Pat<(vselect (v4i32 (setcc v4i32:$lhs, v4i32:$rhs, SETNE)),
+ v4i32:$tval, v4i32:$fval),
+ (XXSEL $tval, $fval, (XVCMPEQDP $lhs, $rhs))>;
+def : Pat<(vselect (v4i32 (setcc v4i32:$lhs, v4i32:$rhs, SETGE)),
+ v4i32:$tval, v4i32:$fval),
+ (XXSEL $fval, $tval, (XVCMPGEDP $lhs, $rhs))>;
----------------
nemanjai wrote:
Can you explain why it is OK to use double precision floating point compares to compare integers?
https://github.com/llvm/llvm-project/pull/65295
More information about the llvm-commits
mailing list