https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67459
Bug ID: 67459 Summary: [SH] addc/subc/negc set of T reg rtx seem wrong Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target Milestone: --- Target: sh*-*-* The following should be verified. Currently there is no problem because nothing in GCC understands or uses the exact T reg values. However, clrt/sett optimization might want to do that in the future, for which correct set rtxes are needed in the insns. addc: (set (reg:SI T_REG) (ltu:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 1)))] The insn operation description says (comparisons are unsigned): if (R[n] > R[n] + R[m]) T = 1; else if (R[n] + R[m] > R[n] + R[m] + T) T = 1; else T = 0; which could probably be simplified a bit. subc: (set (reg:SI T_REG) (gtu:SI (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (reg:SI T_REG)) (match_dup 1)))] The insn operation description says (comparisons are unsigned): if (R[n] < R[n] - R[m]) T = 1; else if (R[n] - R[m] < R[n] - R[m] - T) T = 1; else T = 0; negc: (set (reg:SI T_REG) (ne:SI (ior:SI (reg:SI T_REG) (match_dup 1)) (const_int 0)))] The insn operation description says: if (0 < 0 - R[m]) T = 1; else if (0 - R[m] - T < R[n]) T = 1; else T = 0;