Eliminate common subexpression in both branches.

2018-09-17  Uros Bizjak  <ubiz...@gmail.com>

    * config/i386/i386.c (ix86_emit_i387_log1p): Emit fldln2 earlier.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to mainline SVN.

Uros.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 264369)
+++ config/i386/i386.c  (working copy)
@@ -43941,13 +43941,14 @@ void ix86_emit_i387_log1p (rtx op0, rtx op1)
   rtx test;
 
   emit_insn (gen_absxf2 (tmp, op1));
+  emit_move_insn (tmp2, standard_80387_constant_rtx (4)); /* fldln2 */
   test = gen_rtx_GE (VOIDmode, tmp,
     const_double_from_real_value (
        REAL_VALUE_ATOF ("0.29289321881345247561810596348408353", XFmode),
        XFmode));
-  emit_jump_insn (gen_cbranchxf4 (test, XEXP (test, 0), XEXP (test, 1), 
label1));
+  emit_jump_insn
+    (gen_cbranchxf4 (test, XEXP (test, 0), XEXP (test, 1), label1));
 
-  emit_move_insn (tmp2, standard_80387_constant_rtx (4)); /* fldln2 */
   emit_insn (gen_fyl2xp1xf3_i387 (op0, op1, tmp2));
   emit_jump (label2);
 
@@ -43954,7 +43955,6 @@ void ix86_emit_i387_log1p (rtx op0, rtx op1)
   emit_label (label1);
   emit_move_insn (tmp, CONST1_RTX (XFmode));
   emit_insn (gen_addxf3 (tmp, op1, tmp));
-  emit_move_insn (tmp2, standard_80387_constant_rtx (4)); /* fldln2 */
   emit_insn (gen_fyl2xxf3_i387 (op0, tmp, tmp2));
 
   emit_label (label2);

Reply via email to