From 1419a8859b3ab56d7d5f9cef4f9df3cf0293e911 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Sun, 6 Feb 2005 23:33:25 +0000 Subject: [PATCH] simplify-rtx.c (simplify_relational_operation_1): Simplify (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0)) into... * simplify-rtx.c (simplify_relational_operation_1): Simplify (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0)) into just (zero_extract:SI FOO (const_int 1) BAR). Co-Authored-By: Andrew Pinski Co-Authored-By: Paolo Bonzini From-SVN: r94684 --- gcc/ChangeLog | 8 ++++++++ gcc/simplify-rtx.c | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c92e209834c..4ae512ab5c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-02-06 Roger Sayle + Andrew Pinski + Paolo Bonzini + + * simplify-rtx.c (simplify_relational_operation_1): Simplify + (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0)) + into just (zero_extract:SI FOO (const_int 1) BAR). + 2005-02-06 Joseph S. Myers * doc/cpp.texi: Include gcc-common.texi. Don't define gcctabopt diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index a1a774752cf..f23dba7c63c 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2880,6 +2880,18 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode, return simplify_gen_relational (code, mode, cmp_mode, x, c); } + /* (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))) is + the same as (zero_extract:SI FOO (const_int 1) BAR). */ + if (code == NE + && op1 == const0_rtx + && GET_MODE_CLASS (mode) == MODE_INT + && cmp_mode != VOIDmode + && nonzero_bits (op0, cmp_mode) == 1 + && STORE_FLAG_VALUE == 1) + return GET_MODE_SIZE (mode) > GET_MODE_SIZE (cmp_mode) + ? simplify_gen_unary (ZERO_EXTEND, mode, op0, cmp_mode) + : gen_lowpart (mode, op0); + return NULL_RTX; } -- 2.30.2