On Mon, Jan 24, 2022 at 11:35:47PM +0100, AL gcc-patches wrote: > On Mon, Jan 24, 2022 at 06:24:11PM -0300, Raoni Fassina Firmino wrote: > > On Mon, Jan 24, 2022 at 02:29:39PM -0600, Bill Schmidt wrote: > > > Adding the patch author for his information. > > > > Thanks Bill. > > > > > On 1/24/22 2:26 PM, Jakub Jelinek via Gcc-patches wrote: > > > > expand_builtin_feclear_feraise_except doesn't check if op0 matches > > > > the predicate of operands[1], the backend requires const_int_operand,
Below is a patch to do just that. In preliminary tests it seems to work. What do you think aboud it Jakub? > > > > but because the call isn't done with a constant integer: > > > > feraiseexcept (t == LLONG_MIN ? FE_INEXACT : FE_INVALID); > > > > op0 is a REG. > > > > If CONST_INT is what is expected on all targets, then it should punt if > > > > op0 isn't one, otherwise it should the predicate. > > > > My expectation was for backend expanders to be free to choose when they > > expand, to be able to fail and cleanly fallback to libc call, and not > > enforce one specific constrains to all targets. > > > > I will look into it ASAP and see what can be done. > > Thanks for the feedback. > > These days the usual way of doing this is through > maybe_expand_insn and create_{output,input}_operand before that. I looked into maybe_expand_insn, if I undestood correctly in my reading of maybe_expand_insn I could remove mostly if not all code in expand_builtin_feclear_feraise_except with it, even the validate_arglist part in the beginning? o/ Raoni --- gcc/builtins.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/builtins.cc b/gcc/builtins.cc index e84208035dab..88e689993563 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -2598,6 +2598,9 @@ expand_builtin_feclear_feraise_except (tree exp, rtx target, if (icode == CODE_FOR_nothing) return NULL_RTX; + if (!(*insn_data[icode].operand[1].predicate) (op0, GET_MODE(op0))) + return NULL_RTX; + if (target == 0 || GET_MODE (target) != target_mode || !(*insn_data[icode].operand[0].predicate) (target, target_mode)) -- 2.34.1