aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/gcn/gcn.md
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2020-11-30 11:10:04 -0800
committerJulian Brown <julian@codesourcery.com>2021-01-12 16:46:01 -0800
commitc8812bac8ee39f73ea881e4f6260acf5590b4190 (patch)
tree705063c5b9410785f858502398a8516c6bc78630 /gcc/config/gcn/gcn.md
parentabb3993e49c04bd40e42f196f55785cc3fd81682 (diff)
downloadgcc-c8812bac8ee39f73ea881e4f6260acf5590b4190.zip
gcc-c8812bac8ee39f73ea881e4f6260acf5590b4190.tar.gz
gcc-c8812bac8ee39f73ea881e4f6260acf5590b4190.tar.bz2
amdgcn: Improve FP division accuracy
GCN has a reciprocal-approximation instruction but no hardware divide. This patch adjusts the open-coded reciprocal approximation/Newton-Raphson refinement steps to use fused multiply-add instructions as is necessary to obtain a properly-rounded result, and adds further refinement steps to correctly round the full division result. The patterns in question are still guarded by a flag_reciprocal_math condition, and do not yet support denormals. 2021-01-13 Julian Brown <julian@codesourcery.com> gcc/ * config/gcn/gcn-valu.md (recip<mode>2<exec>, recip<mode>2): Use unspec for reciprocal-approximation instructions. (div<mode>3): Use fused multiply-accumulate operations for reciprocal refinement and division result. * config/gcn/gcn.md (UNSPEC_RCP): New unspec constant. gcc/testsuite/ * gcc.target/gcn/fpdiv.c: New test.
Diffstat (limited to 'gcc/config/gcn/gcn.md')
-rw-r--r--gcc/config/gcn/gcn.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index 757e575..b5f895a 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -80,7 +80,8 @@
UNSPEC_MOV_DPP_SHR
UNSPEC_MOV_FROM_LANE63
UNSPEC_GATHER
- UNSPEC_SCATTER])
+ UNSPEC_SCATTER
+ UNSPEC_RCP])
;; }}}
;; {{{ Attributes