Commit b5034abb authored by Uros Bizjak's avatar Uros Bizjak
Browse files

i386: Improve CET builtin expanders.

Several fixes to CET builtin expanders:

a) Split out explicit zeroing of RDSSP output operand.
b) Use DImode memory operand for RSTORSSP and CLRSSBSY instructions.
c) Use parameterized pattern names to simplify calling of named patterns.

2020-08-13  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

	* config/i386/i386-builtin.def (CET_NORMAL): Merge to CET BDESC array.
	(__builtin_ia32_rddspd, __builtin_ia32_rddspq, __builtin_ia32_incsspd)
	(__builtin_ia32_incsspq, __builtin_ia32_wrssd, __builtin_ia32_wrssq)
	(__builtin_ia32_wrussd, __builtin_ia32_wrussq): Use CODE_FOR_nothing.
	* config/i386/i386-builtins.c: Remove handling of CET_NORMAL builtins.
	* config/i386/i386.md (@rdssp<mode>): Implement as parametrized
	name pattern.  Use SWI48 mode iterator.  Introduce input operand
	and remove explicit XOR zeroing from insn template.
	(@incssp<mode>): Implement as parametrized name pattern.
	Use SWI48 mode iterator.
	(@wrss<mode>): Ditto.
	(@wruss<mode>): Ditto.
	(rstorssp): Remove expander.  Rename insn pattern from *rstorssp<mode>.
	Use DImode memory operand.
	(clrssbsy): Remove expander.  Rename insn pattern from *clrssbsy<mode>.
	Use DImode memory operand.
	(save_stack_nonlocal): Update for parametrized name patterns.
	Use cleared register as an argument to gen_rddsp.
	(restore_stack_nonlocal): Update for parametrized name patterns.
	* config/i386/i386-expand.c (ix86_expand_builtin):
	[case IX86_BUILTIN_RDSSPD, case IX86_BUILTIN_RDSSPQ]: Expand here.
	[case IX86_BUILTIN_INCSSPD, case IX86_BUILTIN_INCSSPQ]: Ditto.
	[case IX86_BUILTIN_RSTORSSP, case IX86_BUILTIN_CLRSSBSY]:
	Generate DImode memory operand.
	[case IX86_BUILTIN_WRSSD, case IX86_BUILTIN_WRSSQ]
	[case IX86_BUILTIN_WRUSSD, case IX86_BUILTIN_WRUSSD]:
	Update for parameterized name patterns.
parent 0ad7e730
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment