On Fri, Nov 3, 2017 at 11:14 AM, Richard Biener
<richard.guent...@gmail.com> wrote:
> On Fri, Nov 3, 2017 at 9:38 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
>>>            * config/i386/i386.c (ix86_emit_restore_reg_using_pop): 
>>> Prototype.
>>>            (ix86_adjust_stack_and_probe_stack_clash): Use a push/pop 
>>> sequence
>>>            to probe at the start of a noreturn function.
>>>
>>>            * gcc.target/i386/stack-check-12.c: New test
>>
>> -      emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
>> -       -GET_MODE_SIZE (word_mode)));
>> +      rtx_insn *insn = emit_insn (gen_push (gen_rtx_REG (word_mode, 0)));
>>
>> Please use AX_REG instead of 0.
>>
>> +      RTX_FRAME_RELATED_P (insn) = 1;
>> +      ix86_emit_restore_reg_using_pop (gen_rtx_REG (word_mode, 0));
>>
>> Also here.
>>
>>        emit_insn (gen_blockage ());
>>
>> BTW: Could we use an unused register here, if available? %eax is used
>> to pass first argument in regparm functions on 32bit targets.
>
> Can you push %[er]sp?  What about partial reg stalls when using other
> registers (if the last set was a movb to it)?  I guess [er]sp is safe here
> as was [re]ax due to the ABI?

That would work, too. I believe, that this won't trigger stack engine
[1], but since the operation is a bit unusual, let's ask HJ to be
sure.

[1] https://en.wikipedia.org/wiki/Stack_register#Stack_engine

Uros.

Reply via email to