diff options
author | Richard Guenther <rguenther@suse.de> | 2011-03-15 09:30:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-03-15 09:30:13 +0000 |
commit | 01c77a60551535ea2326f7e72723cd8962a64eb1 (patch) | |
tree | e093dc10c71dc20327bca26defccbb70ebe56a99 /gcc | |
parent | cc9ce9ffd6a66a6eb5a317d9c027228753d6e490 (diff) | |
download | gcc-01c77a60551535ea2326f7e72723cd8962a64eb1.zip gcc-01c77a60551535ea2326f7e72723cd8962a64eb1.tar.gz gcc-01c77a60551535ea2326f7e72723cd8962a64eb1.tar.bz2 |
i386.c (ix86_emit_swdivsf): Implement more efficiently.
2011-03-15 Richard Guenther <rguenther@suse.de>
* config/i386/i386.c (ix86_emit_swdivsf): Implement more
efficiently.
From-SVN: r170981
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 34 |
2 files changed, 22 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4bcde0..aae2ea0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-03-15 Richard Guenther <rguenther@suse.de> + + * config/i386/i386.c (ix86_emit_swdivsf): Implement more + efficiently. + 2011-03-15 Alan Modra <amodra@gmail.com> PR target/48032 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9673524..1a3c97f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -31935,38 +31935,38 @@ void ix86_emit_i387_log1p (rtx op0, rtx op1) void ix86_emit_swdivsf (rtx res, rtx a, rtx b, enum machine_mode mode) { - rtx x0, x1, e0, e1, two; + rtx x0, x1, e0, e1; x0 = gen_reg_rtx (mode); e0 = gen_reg_rtx (mode); e1 = gen_reg_rtx (mode); x1 = gen_reg_rtx (mode); - two = CONST_DOUBLE_FROM_REAL_VALUE (dconst2, SFmode); - - if (VECTOR_MODE_P (mode)) - two = ix86_build_const_vector (mode, true, two); - - two = force_reg (mode, two); - - /* a / b = a * rcp(b) * (2.0 - b * rcp(b)) */ + /* a / b = a * ((rcp(b) + rcp(b)) - (b * rcp(b) * rcp (b))) */ /* x0 = rcp(b) estimate */ emit_insn (gen_rtx_SET (VOIDmode, x0, gen_rtx_UNSPEC (mode, gen_rtvec (1, b), UNSPEC_RCP))); - /* e0 = x0 * a */ + /* e0 = x0 * b */ emit_insn (gen_rtx_SET (VOIDmode, e0, - gen_rtx_MULT (mode, x0, a))); - /* e1 = x0 * b */ - emit_insn (gen_rtx_SET (VOIDmode, e1, gen_rtx_MULT (mode, x0, b))); - /* x1 = 2. - e1 */ + + /* e0 = x0 * e0 */ + emit_insn (gen_rtx_SET (VOIDmode, e0, + gen_rtx_MULT (mode, x0, e0))); + + /* e1 = x0 + x0 */ + emit_insn (gen_rtx_SET (VOIDmode, e1, + gen_rtx_PLUS (mode, x0, x0))); + + /* x1 = e1 - e0 */ emit_insn (gen_rtx_SET (VOIDmode, x1, - gen_rtx_MINUS (mode, two, e1))); - /* res = e0 * x1 */ + gen_rtx_MINUS (mode, e1, e0))); + + /* res = a * x1 */ emit_insn (gen_rtx_SET (VOIDmode, res, - gen_rtx_MULT (mode, e0, x1))); + gen_rtx_MULT (mode, a, x1))); } /* Output code to perform a Newton-Rhapson approximation of a |