Denis Chertykov schrieb:
> 2011/9/22 Georg-Johann Lay <a...@gjlay.de>:
>> This patch adds the PLUS part to fix the PR.
>>
>> addsi3 has a 8-bit scratch register now so that constants that are not 
>> covered
>> by the constraints won't force a reload of the constant.
>>
>> The output routine tries adding the constant and subtracting the negated
>> constant and then chooses the shortest sequence.  Moreover, if the lower 
>> bytes
>> of the constant are zero, there is no need to add them.
>>
>> Besides that, the patch adds some add-and-zero-extend patterns.
>>
>> Passed without regressions.
> 
> 
> Why you removed immediate operand from subsi3:
> 
>  (define_insn "subsi3"
> -  [(set (match_operand:SI 0 "register_operand" "=r,d")
> -        (minus:SI (match_operand:SI 1 "register_operand" "0,0")
> -                 (match_operand:SI 2 "nonmemory_operand" "r,i")))]
> +  [(set (match_operand:SI 0 "register_operand"          "=r")
> +        (minus:SI (match_operand:SI 1 "register_operand" "0")
> +                  (match_operand:SI 2 "register_operand" "r")))]
>    ""
> -  "@
> -     sub %0,%2\;sbc %B0,%B2\;sbc %C0,%C2\;sbc %D0,%D2
> -     subi %A0,lo8(%2)\;sbci %B0,hi8(%2)\;sbci %C0,hlo8(%2)\;sbci 
> %D0,hhi8(%2)"
> -  [(set_attr "length" "4,4")
> -   (set_attr "cc" "set_czn,set_czn")])
> +  "sub %0,%2\;sbc %B0,%B2\;sbc %C0,%C2\;sbc %D0,%D2"
> +  [(set_attr "length" "4")
> +   (set_attr "cc" "set_czn")])

A = B - const

is canonizalized to

A = B + (-const)

For compile time constants. And for SImode there are no symbols so that the
immediate part of memory_operand is dead code and I cleaned it up.

> Denis.

Johann


Reply via email to