]> git.ipfire.org Git - thirdparty/gcc.git/commit
amdgcn: HardFP divide
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 14 Apr 2023 16:05:15 +0000 (17:05 +0100)
committerAndrew Stubbs <ams@codesourcery.com>
Tue, 18 Apr 2023 11:16:40 +0000 (12:16 +0100)
commitcfdc45f73c56ad051a53576a4e88675ced2660d4
tree3c5d4be1ee2f857d5d16e7b3d45b3842d405ba07
parentebaec582ca1ee33269724bff945a16655e487ad5
amdgcn: HardFP divide

Implement FP division using hardware instructions. This replaces both the
softfp library calls, and the --fast-math inaccurate divsion we had previously.

The GCN architecture does not have a single divide instruction, but it does
have a number of support instructions designed to make multiply-by-reciprocal
sufficiently accurate for non-fast-math usage.

gcc/ChangeLog:

* config/gcn/gcn-valu.md (SV_SFDF): New iterator.
(SV_FP): New iterator.
(scalar_mode, SCALAR_MODE): Add identity mappings for scalar modes.
(recip<mode>2): Unify the two patterns using SV_FP.
(div_scale<mode><exec_vcc>): New insn.
(div_fmas<mode><exec>): New insn.
(div_fixup<mode><exec>): New insn.
(div<mode>3): Unify the two expanders and rewrite using hardfp.
* config/gcn/gcn.cc (gcn_md_reorg): Support "vccwait" attribute.
* config/gcn/gcn.md (unspec): Add UNSPEC_DIV_SCALE, UNSPEC_DIV_FMAS,
and UNSPEC_DIV_FIXUP.
(vccwait): New attribute.

gcc/testsuite/ChangeLog:

* gcc.target/gcn/fpdiv.c: Remove the -ffast-math requirement.
gcc/config/gcn/gcn-valu.md
gcc/config/gcn/gcn.cc
gcc/config/gcn/gcn.md
gcc/testsuite/gcc.target/gcn/fpdiv.c