]> git.ipfire.org Git - thirdparty/gcc.git/commit
[SPARC] Errata workaround for GRLIB-TN-0013
authorDaniel Cederman <cederman@gaisler.com>
Wed, 29 Nov 2017 15:37:19 +0000 (15:37 +0000)
committerDaniel Hellstrom <danielh@gcc.gnu.org>
Wed, 29 Nov 2017 15:37:19 +0000 (16:37 +0100)
commit97c30075e88f65351d4140a53a0f9acec76a075a
tree545d06bbed1d81221f919c4d58ee659b489724b0
parent47c72733ab0cc1ca5b7bb196298ce9ecd91c1896
[SPARC] Errata workaround for GRLIB-TN-0013

This patch provides a workaround for the errata described in GRLIB-TN-0013.

If the workaround is enabled it will:

* Prevent div and sqrt instructions in the delay slot.

* Insert NOPs to prevent the sequence (div/sqrt) -> (two or three floating
  point operations or loads) -> (div/sqrt).

* Not insert NOPs if any of the floating point operations have a dependency
  on the destination register of the first (div/sqrt).

* Not insert NOPs if one of the floating point operations is a (div/sqrt).

* Insert NOPs to prevent (div/sqrt) followed by a branch.

It is applicable to GR712RC, UT700, and UT699.

2017-11-29  Daniel Cederman  <cederman@gaisler.com>

gcc/
* config/sparc/sparc.c (fpop_reg_depend_p): New function.
(div_sqrt_insn_p): New function.
(sparc_do_work_around_errata): Insert NOP instructions to
prevent sequences that could trigger the TN-0013 errata for
certain LEON3 processors.
(pass_work_around_errata::gate): Also test sparc_fix_lost_divsqrt.
(sparc_option_override): Set sparc_fix_lost_divsqrt appropriately.
* config/sparc/sparc.md (fix_lost_divsqrt): New attribute.
(in_branch_delay): Prevent div and sqrt in delay slot if
fix_lost_divsqrt.
* config/sparc/sparc.opt (sparc_fix_lost_divsqrt): New variable.

From-SVN: r255237
gcc/ChangeLog
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.md
gcc/config/sparc/sparc.opt