i386: Improve stack protector patterns and peephole2s even more
commit016b3002e13acefb5773da78659c050187d3a96f
authorUros Bizjak <ubizjak@gmail.com>
Thu, 9 Nov 2023 18:47:57 +0000 (9 19:47 +0100)
committerUros Bizjak <ubizjak@gmail.com>
Thu, 9 Nov 2023 18:48:31 +0000 (9 19:48 +0100)
treeb928c4f077e11ca97b34580f9c95dc19ddd9ef68
parenta99f6bb142bc4506dcb8aa2b7722310ad92e4528
i386:  Improve stack protector patterns and peephole2s even more

Improve stack protector patterns and peephole2s even more:

a. Use unrelated register clears with integer mode size <= word
   mode size to clear stack protector scratch register.

b. Use unrelated register initializations in front of stack
   protector sequence to clear stack protector scratch register.

c. Use unrelated register initializations using LEA instructions
   to clear stack protector scratch register.

These stack protector improvements reuse 6914 unrelated register
initializations to substitute the clear of stack protector scratch
register in 12034 instances of stack protector sequence in recent linux
defconfig build.

gcc/ChangeLog:

* config/i386/i386.md (@stack_protect_set_1_<PTR:mode>_<W:mode>):
Use W mode iterator instead of SWI48.  Output MOV instead of XOR
for TARGET_USE_MOV0.
(stack_protect_set_1 peephole2): Use integer modes with
mode size <= word mode size for operand 3.
(stack_protect_set_1 peephole2 #2): New peephole2 pattern to
substitute stack protector scratch register clear with unrelated
register initialization, originally in front of stack
protector sequence.
(*stack_protect_set_3_<PTR:mode>_<SWI48:mode>): New insn pattern.
(stack_protect_set_1 peephole2): New peephole2 pattern to
substitute stack protector scratch register clear with unrelated
register initialization involving LEA instruction.
gcc/config/i386/i386.md