]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
MATCH: Optimize COND_ADD reduction pattern
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Tue, 26 Sep 2023 09:58:47 +0000 (17:58 +0800)
committerPan Li <pan2.li@intel.com>
Tue, 26 Sep 2023 12:20:58 +0000 (20:20 +0800)
Current COND_ADD reduction pattern can't optimize floating-point vector.
As Richard suggested: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631336.html
Allow COND_ADD reduction pattern to optimize floating-point vector.

Bootstrap and Regression is running.

Ok for trunk if tests pass ?

gcc/ChangeLog:

* match.pd: Optimize COND_ADD reduction pattern.

gcc/match.pd

index 3ce90c3333b7b7c3293bb9165dca2845c1d48d9b..790d956fe69ed8f98105f552810ab97dd25cb49a 100644 (file)
@@ -8863,8 +8863,11 @@ and,
 
    c = mask1 && mask2 ? d + b : d.  */
 (simplify
-  (IFN_COND_ADD @0 @1 (vec_cond @2 @3 integer_zerop) @1)
-   (IFN_COND_ADD (bit_and @0 @2) @1 @3 @1))
+  (IFN_COND_ADD @0 @1 (vec_cond @2 @3 zerop@4) @1)
+   (if (ANY_INTEGRAL_TYPE_P (type)
+       || (FLOAT_TYPE_P (type)
+           && fold_real_zero_addition_p (type, NULL_TREE, @4, 0)))
+   (IFN_COND_ADD (bit_and @0 @2) @1 @3 @1)))
 
 /* Detect simplication for a conditional length reduction where