diff mbox series

[v1] Match: Remove unnecessary types_match for case 1 of signed SAT_ADD

Message ID 20240913055911.1316232-1-pan2.li@intel.com
State New
Headers show
Series [v1] Match: Remove unnecessary types_match for case 1 of signed SAT_ADD | expand

Commit Message

Li, Pan2 Sept. 13, 2024, 5:59 a.m. UTC
From: Pan Li <pan2.li@intel.com>

Given all commutative binary operators requires types matching
for both operands.  Remove the types_match check for case 1 of
the signed SAT_ADD, because we have (bit_xor @0 @1), which ensure
the operands have the correct TREE type.

The below test suites are passed for this patch.
* The rv64gcv fully regression test.
* The x86 bootstrap test.
* The x86 fully regression test.

gcc/ChangeLog:

	* match.pd: Remove the types_match check for signed SAT_ADD
	case 1.

Signed-off-by: Pan Li <pan2.li@intel.com>
---
 gcc/match.pd | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Richard Biener Sept. 13, 2024, 7:52 a.m. UTC | #1
On Fri, Sep 13, 2024 at 8:00 AM <pan2.li@intel.com> wrote:
>
> From: Pan Li <pan2.li@intel.com>
>
> Given all commutative binary operators requires types matching
> for both operands.  Remove the types_match check for case 1 of
> the signed SAT_ADD, because we have (bit_xor @0 @1), which ensure
> the operands have the correct TREE type.
>
> The below test suites are passed for this patch.
> * The rv64gcv fully regression test.
> * The x86 bootstrap test.
> * The x86 fully regression test.

OK

> gcc/ChangeLog:
>
>         * match.pd: Remove the types_match check for signed SAT_ADD
>         case 1.
>
> Signed-off-by: Pan Li <pan2.li@intel.com>
> ---
>  gcc/match.pd | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 4cef965c9c7..5566c0e4c41 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -3204,8 +3204,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>             integer_zerop)
>         (bit_xor:c (negate (convert (lt @0 integer_zerop))) max_value)
>         @2)
> - (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type)
> -      && types_match (type, @0, @1))))
> + (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type))))
>
>  /* Signed saturation add, case 2:
>     T sum = (T)((UT)X + (UT)Y)
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/gcc/match.pd b/gcc/match.pd
index 4cef965c9c7..5566c0e4c41 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -3204,8 +3204,7 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 	    integer_zerop)
 	(bit_xor:c (negate (convert (lt @0 integer_zerop))) max_value)
 	@2)
- (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type)
-      && types_match (type, @0, @1))))
+ (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type))))
 
 /* Signed saturation add, case 2:
    T sum = (T)((UT)X + (UT)Y)