diff mbox series

[1/2] simplify-rtx: Parity of parity is parity

Message ID 0040c135ed9015aab2237543e2c1c91d22decc7e.1593026638.git.segher@kernel.crashing.org
State New
Headers show
Series [1/2] simplify-rtx: Parity of parity is parity | expand

Commit Message

Segher Boessenkool June 24, 2020, 7:29 p.m. UTC
From: Roger Sayle <roger@nextmovesoftware.com>

2020-06-24  Roger Sayle  <roger@nextmovesoftware.com>

	* simplify-rtx.c (simplify_unary_operation_1): Simplify
	(parity (parity x)) as (parity x), i.e. PARITY is idempotent.
---
 gcc/simplify-rtx.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 28c2dc6..65008ea 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1391,6 +1391,10 @@  simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
 				       GET_MODE (XEXP (op, 0)));
 	  break;
 
+	case PARITY:
+	  /* (parity (parity x)) -> parity (x).  */
+	  return op;
+
 	default:
 	  break;
 	}