On 2022/08/17 4:58, Max Filippov wrote:
> Hi Suwa-san,
Hi!
>
> On Tue, Aug 16, 2022 at 5:42 AM Takayuki 'January June' Suwa
> <[email protected]> wrote:
>>
>> In a few cases, obviously omitable add instructions can be emitted via
>> invoking gen_addsi3.
>>
>> gcc/ChangeLog:
>>
>> * config/xtensa/xtensa.md (addsi3_internal): Rename from "addsi3".
>> (addsi3): New define_expand in order to reject integer additions of
>> constant zero.
>> ---
>> gcc/config/xtensa/xtensa.md | 14 +++++++++++++-
>> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> with this change a bunch of tests fail to build with the following error:
Ah, sorry, I want to withdraw this patch.
>> In a few cases
As a matter of fact, "in a few cases" is just only one:
[xtensa_expand_epilogue() in /gcc/config/xtensa/xtensa.cc]
> if (cfun->machine->current_frame_size > 0)
> {
> if (frame_pointer_needed || /* always reachable with addi */
> cfun->machine->current_frame_size > 1024 ||
> cfun->machine->current_frame_size <= 127)
> {
> if (cfun->machine->current_frame_size <= 127)
> offset = cfun->machine->current_frame_size;
> else
> offset = cfun->machine->callee_save_size;
>
> emit_insn (gen_addsi3 (stack_pointer_rtx,
> stack_pointer_rtx,
> GEN_INT (offset))); // offset can
> be zero!
> }
And adding "define_expand" only to deal with one rare case had too much impact,
as you saw...
> undefined reference to `__addsi3'
>
> E.g. gcc.c-torture/execute/20000519-1.c
> or gcc.c-torture/execute/20070919-1.c
>