https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120240
Bug ID: 120240
Summary: addcc/negcc/notcc vs cond_add/cond_neg/cond_one_cmpl
optabs
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: documentation, internal-improvement
Severity: normal
Priority: P3
Component: middle-end
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
I noticed that we have 2 optabs that do very similar things, addcc and cond_add
(negcc and cond_neg, notcc and cond_one_cmpl) but it is not so obvious from the
documentation why there is both.
cond_add:
When operand 1 is true, perform an operation on operands 2 and 3 and
store the result in operand 0, otherwise store operand 4 in operand 0.
The operation works elementwise if the operands are vectors.
add@{mode}cc:
@cindex @code{add@var{mode}cc} instruction pattern
@item @samp{add@var{mode}cc}
Similar to @samp{mov@var{mode}cc} but for conditional addition. Conditionally
move operand 2 or (operands 2 + operand 3) into operand 0 according to the
comparison in operand 1. If the comparison is false, operand 2 is moved into
operand 0, otherwise (operand 2 + operand 3) is moved.