[PATCH] internal-fn: Force to reg if operand doesn't match.

Robin Dapp rdapp.gcc@gmail.com
Mon Jun 10 07:35:09 GMT 2024


Hi,

despite looking good on cfarm185 and Linaro's pre-commit CI
gcc-15-638-g7ca35f2e430 now appears to have caused several
regressions on arm-eabi cortex-m55 as found by Linaro's CI:

https://linaro.atlassian.net/browse/GNU-1252

I'm assuming this target is not tested as regularly and thus
the failures went unnoticed until now.

So it looks like we do need the insn_operand_matches after all?

This patch only forces to register if the respective operands
do not already match.

Bootstrap and regtest on aarch64 and x86 in progress.
Regtested on riscv64.

Regards
 Robin

gcc/ChangeLog:

	* internal-fn.cc (expand_vec_cond_mask_optab_fn): Only force to
	reg if operand does not already match.
---
 gcc/internal-fn.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
index 4948b48bde8..fa85fa69f5a 100644
--- a/gcc/internal-fn.cc
+++ b/gcc/internal-fn.cc
@@ -3162,7 +3162,13 @@ expand_vec_cond_mask_optab_fn (internal_fn, gcall *stmt, convert_optab optab)
   gcc_assert (icode != CODE_FOR_nothing);
 
   mask = expand_normal (op0);
+  if (!insn_operand_matches (icode, 3, mask))
+    mask = force_reg (mask_mode, mask);
+
   rtx_op1 = expand_normal (op1);
+  if (!insn_operand_matches (icode, 1, rtx_op1))
+    rtx_op1 = force_reg (mode, rtx_op1);
+
   rtx_op2 = expand_normal (op2);
 
   rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
-- 
2.45.1


More information about the Gcc-patches mailing list