We have to negate masking value to clear certain bits.

2019-08-26  Uroš Bizjak  <ubiz...@gmail.com>

    * config/i386/i386.c (emit_i387_cw_initialization)
    <case I387_CW_ROUNDEVEN>: Fix masking operand value.

Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.

Uros.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 274930)
+++ config/i386/i386.c  (working copy)
@@ -13785,7 +13785,7 @@ emit_i387_cw_initialization (int mode)
     {
     case I387_CW_ROUNDEVEN:
       /* round to nearest */
-      emit_insn (gen_andhi3 (reg, reg, GEN_INT (0x0c00)));
+      emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00)));
       slot = SLOT_CW_ROUNDEVEN;
       break;
 

Reply via email to