From: Uros Bizjak Date: Tue, 3 Apr 2018 14:59:21 +0000 (+0200) Subject: i386.c (emit_i387_cw_initialization): Always use logic instructions when changing... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3bbeebd4d1ed20f1031d69e8ab646c687d58ee77;p=gcc.git i386.c (emit_i387_cw_initialization): Always use logic instructions when changing rounding bits to preserve precision... * config/i386/i386.c (emit_i387_cw_initialization): Always use logic instructions when changing rounding bits to preserve precision bits in the x87 control word. From-SVN: r259034 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bac81f8e5bc..f1030b4fd64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-03 Uros Bizjak + + * config/i386/i386.c (emit_i387_cw_initialization): Always use logic + instructions when changing rounding bits to preserve precision bits + in the x87 control word. + 2018-04-03 Martin Liska PR tree-optimization/82491 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 337545f127c..44ef60e5639 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -19678,72 +19678,36 @@ emit_i387_cw_initialization (int mode) emit_insn (gen_x86_fnstcw_1 (stored_mode)); emit_move_insn (reg, copy_rtx (stored_mode)); - if (TARGET_64BIT || TARGET_PARTIAL_REG_STALL - || optimize_insn_for_size_p ()) - { - switch (mode) - { - case I387_CW_TRUNC: - /* round toward zero (truncate) */ - emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0c00))); - slot = SLOT_CW_TRUNC; - break; - - case I387_CW_FLOOR: - /* round down toward -oo */ - emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00))); - emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0400))); - slot = SLOT_CW_FLOOR; - break; - - case I387_CW_CEIL: - /* round up toward +oo */ - emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00))); - emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0800))); - slot = SLOT_CW_CEIL; - break; - - case I387_CW_MASK_PM: - /* mask precision exception for nearbyint() */ - emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020))); - slot = SLOT_CW_MASK_PM; - break; - - default: - gcc_unreachable (); - } - } - else + switch (mode) { - switch (mode) - { - case I387_CW_TRUNC: - /* round toward zero (truncate) */ - emit_insn (gen_insvsi_1 (reg, GEN_INT (0xc))); - slot = SLOT_CW_TRUNC; - break; + case I387_CW_TRUNC: + /* round toward zero (truncate) */ + emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0c00))); + slot = SLOT_CW_TRUNC; + break; - case I387_CW_FLOOR: - /* round down toward -oo */ - emit_insn (gen_insvsi_1 (reg, GEN_INT (0x4))); - slot = SLOT_CW_FLOOR; - break; + case I387_CW_FLOOR: + /* round down toward -oo */ + emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00))); + emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0400))); + slot = SLOT_CW_FLOOR; + break; - case I387_CW_CEIL: - /* round up toward +oo */ - emit_insn (gen_insvsi_1 (reg, GEN_INT (0x8))); - slot = SLOT_CW_CEIL; - break; + case I387_CW_CEIL: + /* round up toward +oo */ + emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00))); + emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0800))); + slot = SLOT_CW_CEIL; + break; - case I387_CW_MASK_PM: - /* mask precision exception for nearbyint() */ - emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020))); - slot = SLOT_CW_MASK_PM; - break; + case I387_CW_MASK_PM: + /* mask precision exception for nearbyint() */ + emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020))); + slot = SLOT_CW_MASK_PM; + break; - default: - gcc_unreachable (); - } + default: + gcc_unreachable (); } gcc_assert (slot < MAX_386_STACK_LOCALS);