diff mbox series

[1/6] Avoid shorten_binary_op on VECTOR_TYPE

Message ID 20230623082642.0811A1331F@imap2.suse-dmz.suse.de
State New
Headers show
Series [1/6] Avoid shorten_binary_op on VECTOR_TYPE | expand

Commit Message

Richard Biener June 23, 2023, 8:26 a.m. UTC
When we disallow TYPE_PRECISION on VECTOR_TYPEs it shows that
shorten_binary_op performs some checks on that that are likely
harmless in the end.  The following bails out early for
VECTOR_TYPE operations to avoid those questionable checks.

Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu.

OK?

gcc/c-family/
	* c-common.cc (shorten_binary_op): Exit early for VECTOR_TYPE
	operations.
---
 gcc/c-family/c-common.cc | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jeff Law June 23, 2023, 2:50 p.m. UTC | #1
On 6/23/23 02:26, Richard Biener via Gcc-patches wrote:
> When we disallow TYPE_PRECISION on VECTOR_TYPEs it shows that
> shorten_binary_op performs some checks on that that are likely
> harmless in the end.  The following bails out early for
> VECTOR_TYPE operations to avoid those questionable checks.
> 
> Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu.
> 
> OK?
> 
> gcc/c-family/
> 	* c-common.cc (shorten_binary_op): Exit early for VECTOR_TYPE
> 	operations.
OK.  Oh how I want shorten_binary_op to go away :(

jeff
diff mbox series

Patch

diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 9c8eed5442a..34566a342bd 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -1338,6 +1338,10 @@  shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise)
   int uns;
   tree type;
 
+  /* Do not shorten vector operations.  */
+  if (VECTOR_TYPE_P (result_type))
+    return result_type;
+
   /* Cast OP0 and OP1 to RESULT_TYPE.  Doing so prevents
      excessive narrowing when we call get_narrower below.  For
      example, suppose that OP0 is of unsigned int extended