> I think GCN people wanted to make this code work for vectors, the > most obvious local fix is to use element_precision (type) above. > > Note usually vector integer divisions are not a thing so this might > explain why you're seeing this only with RVV?
Since nobody else has provided a patch yet, is the attached OK as long as x86 bootstrap and testsuite are clean? Regards Robin >From 5ac3bb96cae0af99cefeaa225806de67e268e8f5 Mon Sep 17 00:00:00 2001 From: Robin Dapp <rd...@ventanamicro.com> Date: Thu, 29 Jun 2023 11:35:02 +0200 Subject: [PATCH] ssa-math-opts: Use element_precision. The recent TYPE_PRECISION changes to detect improper usage cause an ICE in divmod_candidate_p for RVV when called with a vector type. Therefore, use element_precision instead. gcc/ChangeLog: * tree-ssa-math-opts.cc (divmod_candidate_p): Use element_precision. --- gcc/tree-ssa-math-opts.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index da01d4ab2b6..701fce2ab61 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -4995,8 +4995,8 @@ divmod_candidate_p (gassign *stmt) if (integer_pow2p (op2)) return false; - if (TYPE_PRECISION (type) <= HOST_BITS_PER_WIDE_INT - && TYPE_PRECISION (type) <= BITS_PER_WORD) + if (element_precision (type) <= HOST_BITS_PER_WIDE_INT + && element_precision (type) <= BITS_PER_WORD) return false; /* If the divisor is not power of 2 and the precision wider than -- 2.41.0