tree-optimization/112990 - unsupported VEC_PERM from match pattern

Message ID 20231213084610.38028386074B@sourceware.org
State Committed
Commit b9baead90d74e9211fc94d655ecd5d3af3858158
Headers
Series tree-optimization/112990 - unsupported VEC_PERM from match pattern |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged

Commit Message

Richard Biener Dec. 13, 2023, 8:44 a.m. UTC
  The following avoids creating an unsupported VEC_PERM after vector
lowering from the pattern merging a bit-insert from a bit-field-ref
to a VEC_PERM.  For the already existing s390 testcase we get
TImode vectors which later ICE during attempted expansion of
a vec_perm_const.

Pushed accidentially before bootstrap / testing finished which is
still ongoing on x86-64_unknown-linux-gnu.  Will revert in the
event that goes wrong (not expecting that).

Richard.

	PR tree-optimization/112990
	* match.pd (bit_insert @0 (BIT_FIELD_REF @1 ..) ..):
	Restrict to vector modes after lowering.
---
 gcc/match.pd | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/gcc/match.pd b/gcc/match.pd
index 15bca217aaf..e3dcff5c29c 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -8505,6 +8505,8 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (simplify
  (bit_insert @0 (BIT_FIELD_REF@2 @1 @rsize @rpos) @ipos)
  (if (VECTOR_TYPE_P (type)
+      && (VECTOR_MODE_P (TYPE_MODE (type))
+	  || optimize_vectors_before_lowering_p ())
       && types_match (@0, @1)
       && types_match (TREE_TYPE (TREE_TYPE (@0)), TREE_TYPE (@2))
       && TYPE_VECTOR_SUBPARTS (type).is_constant ())