https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116896
--- Comment #12 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #11)
> That way targets can emit whatever is beneficial.
x86 already has an implementation of tri-state integer from conditional codes:
--cut here--
;; Produce a tri-state integer (-1, 0, 1) from condition codes.
(define_expand "cmpintqi"
[(set (match_dup 1)
(gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
(set (match_dup 2)
(ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
(parallel [(set (match_operand:QI 0 "register_operand")
(minus:QI (match_dup 1)
(match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
""
{
operands[1] = gen_reg_rtx (QImode);
operands[2] = gen_reg_rtx (QImode);
})
--cut here--
The above could be generalized to also handle integer .SPACESHIP operator.