On Fri, May 29, 2020 at 06:26:55PM +0100, Richard Sandiford wrote: > Segher Boessenkool <seg...@kernel.crashing.org> writes: > > Most patterns *do* FAIL on some target. We cannot rewind time. > > Sure. But the point is that FAILing isn't “explicitly allowed” for vcond*. > In fact it's the opposite.
It has FAILed on rs6000 since 2004. > If we ignore the docs and look at what the status quo actually is -- > which I agree seems safest for GCC :-) -- then patterns are allowed to > FAIL if target-independent code provides an expand-time fallback for > the FAILing case. But that isn't true for vcond either. That is a bug in the callers then :-) > expand_vec_cond_expr does: > > icode = get_vcond_icode (mode, cmp_op_mode, unsignedp); > if (icode == CODE_FOR_nothing) > ... > > comparison = vector_compare_rtx (VOIDmode, tcode, op0a, op0b, unsignedp, > icode, 4); > rtx_op1 = expand_normal (op1); > rtx_op2 = expand_normal (op2); > > create_output_operand (&ops[0], target, mode); > create_input_operand (&ops[1], rtx_op1, mode); > create_input_operand (&ops[2], rtx_op2, mode); > create_fixed_operand (&ops[3], comparison); > create_fixed_operand (&ops[4], XEXP (comparison, 0)); > create_fixed_operand (&ops[5], XEXP (comparison, 1)); > expand_insn (icode, 6, ops); > return ops[0].value; > > which ICEs if the expander FAILs. > > So whether you go from the docs or from what's actually implemented, > vcond* isn't currently allowed to FAIL. All Richard's gcc_unreachable > suggestion would do is change where the ICE happens. > icode = get_vcond_icode (mode, cmp_op_mode, unsignedp); > if (icode == CODE_FOR_nothing) > ... Of course it is allowed to FAIL, based on this code. That is: the RTL pattern is allowed to FAIL. Whatever optabs do, I never understood :-) Is this vec_cmp that is used by the fallback? That will never FAIL for us (if it is enabled at all, natch, same as for any other target). Segher