On Mon, Dec 8, 2014 at 10:01 AM, Segher Boessenkool <seg...@kernel.crashing.org> wrote: > On Mon, Dec 08, 2014 at 09:44:44AM -0500, David Edelsohn wrote: >> > -;; Discourage ai/addic because of carry but provide it in an alternative >> > -;; allowing register zero as source. >> > (define_insn "*add<mode>3_internal1" >> > - [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r") >> > - (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b") >> > - (match_operand:GPR 2 "add_operand" "r,I,I,L")))] >> > + [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,r") >> > + (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,b") >> > + (match_operand:GPR 2 "add_operand" "r,I,L")))] >> > "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && >> > !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))" >> > "@ >> > add %0,%1,%2 >> > addi %0,%1,%2 >> > - addic %0,%1,%2 >> > addis %0,%1,%v2" >> > [(set_attr "type" "add")]) >> >> Why are you removing the alternative instead of clobbering XER[CA]? > > I should have mentioned, sorry. > > We don't want to clobber CA on *every* add, and reload can generate more > adds out of thin air. And CA is a fixed register. > > There may be a better way to do this, but I don't know it.
Okay. It's unfortunate that GCC does not have separate patterns for a safe ADD used by reload. Thanks, David