On Fri, Oct 28, 2022 at 2:34 PM Segher Boessenkool <seg...@kernel.crashing.org> wrote: > > On Wed, Oct 26, 2022 at 11:58:57AM -0700, H.J. Lu via Gcc-patches wrote: > > In i386.md, neg patterns which set MODE_CC register like > > > > (set (reg:CCC FLAGS_REG) > > (ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0))) > > > > can lead to errors when operand 1 is a constant value. If FLAGS_REG in > > But it cannot be. general_reg_operand will not allow that: > === > (define_predicate "general_reg_operand" > (and (match_code "reg") > (match_test "GENERAL_REGNO_P (REGNO (op))"))) > === > > > (set (reg:CCC FLAGS_REG) > > (ne:CCC (const_int 2) (const_int 0))) > > > > is set to 1, RTX simplifiers may simplify >
Here is another example: (define_insn "*neg<mode>_ccc_1" [(set (reg:CCC FLAGS_REG) (ne:CCC (match_operand:SWI 1 "nonimmediate_operand" "0") (const_int 0))) (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") (neg:SWI (match_dup 1)))] "" "neg{<imodesuffix>}\t%0" [(set_attr "type" "negnot") (set_attr "mode" "<MODE>")]) Operand 1 can be a known value. H.J.