Commit 3bbeebd4 by Uros Bizjak Committed by Uros Bizjak

i386.c (emit_i387_cw_initialization): Always use logic instructions when…

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
parent d2d0710e
2018-04-03 Uros Bizjak <ubizjak@gmail.com>
* 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 <mliska@suse.cz> 2018-04-03 Martin Liska <mliska@suse.cz>
PR tree-optimization/82491 PR tree-optimization/82491
......
...@@ -19678,72 +19678,36 @@ emit_i387_cw_initialization (int mode) ...@@ -19678,72 +19678,36 @@ emit_i387_cw_initialization (int mode)
emit_insn (gen_x86_fnstcw_1 (stored_mode)); emit_insn (gen_x86_fnstcw_1 (stored_mode));
emit_move_insn (reg, copy_rtx (stored_mode)); emit_move_insn (reg, copy_rtx (stored_mode));
if (TARGET_64BIT || TARGET_PARTIAL_REG_STALL switch (mode)
|| 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) case I387_CW_TRUNC:
{ /* round toward zero (truncate) */
case I387_CW_TRUNC: emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0c00)));
/* round toward zero (truncate) */ slot = SLOT_CW_TRUNC;
emit_insn (gen_insvsi_1 (reg, GEN_INT (0xc))); break;
slot = SLOT_CW_TRUNC;
break;
case I387_CW_FLOOR: case I387_CW_FLOOR:
/* round down toward -oo */ /* round down toward -oo */
emit_insn (gen_insvsi_1 (reg, GEN_INT (0x4))); emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00)));
slot = SLOT_CW_FLOOR; emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0400)));
break; slot = SLOT_CW_FLOOR;
break;
case I387_CW_CEIL: case I387_CW_CEIL:
/* round up toward +oo */ /* round up toward +oo */
emit_insn (gen_insvsi_1 (reg, GEN_INT (0x8))); emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00)));
slot = SLOT_CW_CEIL; emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0800)));
break; slot = SLOT_CW_CEIL;
break;
case I387_CW_MASK_PM: case I387_CW_MASK_PM:
/* mask precision exception for nearbyint() */ /* mask precision exception for nearbyint() */
emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020))); emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020)));
slot = SLOT_CW_MASK_PM; slot = SLOT_CW_MASK_PM;
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
}
} }
gcc_assert (slot < MAX_386_STACK_LOCALS); gcc_assert (slot < MAX_386_STACK_LOCALS);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment