public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4278] MATCH: Optimize COND_ADD reduction pattern
@ 2023-09-26 12:21 Pan Li
  0 siblings, 0 replies; only message in thread
From: Pan Li @ 2023-09-26 12:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:277456180ea4d002675a9498a7b1ec9d483ded73

commit r14-4278-g277456180ea4d002675a9498a7b1ec9d483ded73
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Tue Sep 26 17:58:47 2023 +0800

    MATCH: Optimize COND_ADD reduction pattern
    
    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.

Diff:
---
 gcc/match.pd | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 3ce90c3333b..790d956fe69 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-26 12:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 12:21 [gcc r14-4278] MATCH: Optimize COND_ADD reduction pattern Pan Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).