asan.c (asan_clear_shadow): Use gen_int_mode with the mode of the associated expand_...
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 9 Sep 2013 13:06:53 +0000 (13:06 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 9 Sep 2013 13:06:53 +0000 (13:06 +0000)
gcc/
* asan.c (asan_clear_shadow): Use gen_int_mode with the mode
of the associated expand_* call.
(asan_emit_stack_protection): Likewise.
* builtins.c (round_trampoline_addr): Likewise.
* explow.c (allocate_dynamic_stack_space, probe_stack_range): Likewise.
* expmed.c (expand_smod_pow2, expand_sdiv_pow2, expand_divmod)
(emit_store_flag): Likewise.
* expr.c (emit_move_resolve_push, push_block, emit_single_push_insn_1)
(emit_push_insn, optimize_bitfield_assignment_op, expand_expr_real_1):
Likewise.
* function.c (instantiate_virtual_regs_in_insn): Likewise.
* ifcvt.c (noce_try_store_flag_constants): Likewise.
* loop-unroll.c (unroll_loop_runtime_iterations): Likewise.
* modulo-sched.c (generate_prolog_epilog): Likewise.
* optabs.c (expand_binop, widen_leading, expand_doubleword_clz)
(expand_ctz, expand_ffs, expand_unop): Likewise.

From-SVN: r202392

gcc/ChangeLog
gcc/asan.c
gcc/builtins.c
gcc/explow.c
gcc/expmed.c
gcc/expr.c
gcc/function.c
gcc/ifcvt.c
gcc/loop-unroll.c
gcc/modulo-sched.c
gcc/optabs.c

index b20987b..dd83c9e 100644 (file)
@@ -1,5 +1,24 @@
 2013-09-09  Richard Sandiford  <rdsandiford@googlemail.com>
 
+       * asan.c (asan_clear_shadow): Use gen_int_mode with the mode
+       of the associated expand_* call.
+       (asan_emit_stack_protection): Likewise.
+       * builtins.c (round_trampoline_addr): Likewise.
+       * explow.c (allocate_dynamic_stack_space, probe_stack_range): Likewise.
+       * expmed.c (expand_smod_pow2, expand_sdiv_pow2, expand_divmod)
+       (emit_store_flag): Likewise.
+       * expr.c (emit_move_resolve_push, push_block, emit_single_push_insn_1)
+       (emit_push_insn, optimize_bitfield_assignment_op, expand_expr_real_1):
+       Likewise.
+       * function.c (instantiate_virtual_regs_in_insn): Likewise.
+       * ifcvt.c (noce_try_store_flag_constants): Likewise.
+       * loop-unroll.c (unroll_loop_runtime_iterations): Likewise.
+       * modulo-sched.c (generate_prolog_epilog): Likewise.
+       * optabs.c (expand_binop, widen_leading, expand_doubleword_clz)
+       (expand_ctz, expand_ffs, expand_unop): Likewise.
+
+2013-09-09  Richard Sandiford  <rdsandiford@googlemail.com>
+
        * alias.c (addr_side_effect_eval): Use gen_int_mode with the mode
        of the associated gen_rtx_* call.
        * caller-save.c (init_caller_save): Likewise.
index af215f6..844d53e 100644 (file)
@@ -901,7 +901,7 @@ asan_clear_shadow (rtx shadow_mem, HOST_WIDE_INT len)
   emit_label (top_label);
 
   emit_move_insn (shadow_mem, const0_rtx);
-  tmp = expand_simple_binop (Pmode, PLUS, addr, GEN_INT (4), addr,
+  tmp = expand_simple_binop (Pmode, PLUS, addr, gen_int_mode (4, Pmode), addr,
                              true, OPTAB_LIB_WIDEN);
   if (tmp != addr)
     emit_move_insn (addr, tmp);
@@ -966,7 +966,8 @@ asan_emit_stack_protection (rtx base, HOST_WIDE_INT *offsets, tree *decls,
   str_cst = asan_pp_string (&asan_pp);
 
   /* Emit the prologue sequence.  */
-  base = expand_binop (Pmode, add_optab, base, GEN_INT (base_offset),
+  base = expand_binop (Pmode, add_optab, base,
+                      gen_int_mode (base_offset, Pmode),
                       NULL_RTX, 1, OPTAB_DIRECT);
   mem = gen_rtx_MEM (ptr_mode, base);
   emit_move_insn (mem, GEN_INT (ASAN_STACK_FRAME_MAGIC));
@@ -976,7 +977,8 @@ asan_emit_stack_protection (rtx base, HOST_WIDE_INT *offsets, tree *decls,
                              GEN_INT (ASAN_SHADOW_SHIFT),
                              NULL_RTX, 1, OPTAB_DIRECT);
   shadow_base = expand_binop (Pmode, add_optab, shadow_base,
-                             GEN_INT (targetm.asan_shadow_offset ()),
+                             gen_int_mode (targetm.asan_shadow_offset (),
+                                           Pmode),
                              NULL_RTX, 1, OPTAB_DIRECT);
   gcc_assert (asan_shadow_set != -1
              && (ASAN_RED_ZONE_SIZE >> ASAN_SHADOW_SHIFT) == 4);
index bb44a7f..6f690c7 100644 (file)
@@ -4862,8 +4862,8 @@ round_trampoline_addr (rtx tramp)
 
   /* Round address up to desired boundary.  */
   temp = gen_reg_rtx (Pmode);
-  addend = GEN_INT (TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT - 1);
-  mask = GEN_INT (-TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT);
+  addend = gen_int_mode (TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT - 1, Pmode);
+  mask = gen_int_mode (-TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT, Pmode);
 
   temp  = expand_simple_binop (Pmode, PLUS, tramp, addend,
                               temp, 0, OPTAB_LIB_WIDEN);
index a69240d..0ae5ee0 100644 (file)
@@ -1355,7 +1355,8 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
       else
        {
          ask = expand_binop (Pmode, add_optab, size,
-                             GEN_INT (required_align / BITS_PER_UNIT - 1),
+                             gen_int_mode (required_align / BITS_PER_UNIT - 1,
+                                           Pmode),
                              NULL_RTX, 1, OPTAB_LIB_WIDEN);
          must_align = true;
        }
@@ -1481,13 +1482,16 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
         but we know it can't.  So add ourselves and then do
         TRUNC_DIV_EXPR.  */
       target = expand_binop (Pmode, add_optab, target,
-                            GEN_INT (required_align / BITS_PER_UNIT - 1),
+                            gen_int_mode (required_align / BITS_PER_UNIT - 1,
+                                          Pmode),
                             NULL_RTX, 1, OPTAB_LIB_WIDEN);
       target = expand_divmod (0, TRUNC_DIV_EXPR, Pmode, target,
-                             GEN_INT (required_align / BITS_PER_UNIT),
+                             gen_int_mode (required_align / BITS_PER_UNIT,
+                                           Pmode),
                              NULL_RTX, 1);
       target = expand_mult (Pmode, target,
-                           GEN_INT (required_align / BITS_PER_UNIT),
+                           gen_int_mode (required_align / BITS_PER_UNIT,
+                                         Pmode),
                            NULL_RTX, 1);
     }
 
@@ -1669,7 +1673,7 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
 
       /* TEST_ADDR = TEST_ADDR + PROBE_INTERVAL.  */
       temp = expand_binop (Pmode, STACK_GROW_OPTAB, test_addr,
-                          GEN_INT (PROBE_INTERVAL), test_addr,
+                          gen_int_mode (PROBE_INTERVAL, Pmode), test_addr,
                           1, OPTAB_WIDEN);
 
       gcc_assert (temp == test_addr);
index dfaa123..f0a4837 100644 (file)
@@ -3666,7 +3666,8 @@ expand_smod_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
              temp = expand_binop (mode, sub_optab, temp, signmask,
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
-             temp = expand_binop (mode, and_optab, temp, GEN_INT (masklow),
+             temp = expand_binop (mode, and_optab, temp,
+                                  gen_int_mode (masklow, mode),
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
              temp = expand_binop (mode, xor_optab, temp, signmask,
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
@@ -3681,7 +3682,8 @@ expand_smod_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
 
              temp = expand_binop (mode, add_optab, op0, signmask,
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
-             temp = expand_binop (mode, and_optab, temp, GEN_INT (masklow),
+             temp = expand_binop (mode, and_optab, temp,
+                                  gen_int_mode (masklow, mode),
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
              temp = expand_binop (mode, sub_optab, temp, signmask,
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
@@ -3764,7 +3766,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
 
       start_sequence ();
       temp2 = copy_to_mode_reg (mode, op0);
-      temp = expand_binop (mode, add_optab, temp2, GEN_INT (d-1),
+      temp = expand_binop (mode, add_optab, temp2, gen_int_mode (d - 1, mode),
                           NULL_RTX, 0, OPTAB_LIB_WIDEN);
       temp = force_reg (mode, temp);
 
@@ -3791,7 +3793,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
       temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, -1);
       if (shift_cost (optimize_insn_for_speed_p (), mode, ushift)
          > COSTS_N_INSNS (1))
-       temp = expand_binop (mode, and_optab, temp, GEN_INT (d - 1),
+       temp = expand_binop (mode, and_optab, temp, gen_int_mode (d - 1, mode),
                             NULL_RTX, 0, OPTAB_LIB_WIDEN);
       else
        temp = expand_shift (RSHIFT_EXPR, mode, temp,
@@ -3804,7 +3806,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
   label = gen_label_rtx ();
   temp = copy_to_mode_reg (mode, op0);
   do_cmp_and_jump (temp, const0_rtx, GE, mode, label);
-  expand_inc (temp, GEN_INT (d - 1));
+  expand_inc (temp, gen_int_mode (d - 1, mode));
   emit_label (label);
   return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0);
 }
@@ -4062,9 +4064,11 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                    pre_shift = floor_log2 (d);
                    if (rem_flag)
                      {
+                       unsigned HOST_WIDE_INT mask
+                         = ((unsigned HOST_WIDE_INT) 1 << pre_shift) - 1;
                        remainder
                          = expand_binop (compute_mode, and_optab, op0,
-                                         GEN_INT (((HOST_WIDE_INT) 1 << pre_shift) - 1),
+                                         gen_int_mode (mask, compute_mode),
                                          remainder, 1,
                                          OPTAB_LIB_WIDEN);
                        if (remainder)
@@ -4115,10 +4119,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                              = (shift_cost (speed, compute_mode, post_shift - 1)
                                 + shift_cost (speed, compute_mode, 1)
                                 + 2 * add_cost (speed, compute_mode));
-                           t1 = expmed_mult_highpart (compute_mode, op0,
-                                                      GEN_INT (ml),
-                                                      NULL_RTX, 1,
-                                                      max_cost - extra_cost);
+                           t1 = expmed_mult_highpart
+                             (compute_mode, op0,
+                              gen_int_mode (ml, compute_mode),
+                              NULL_RTX, 1, max_cost - extra_cost);
                            if (t1 == 0)
                              goto fail1;
                            t2 = force_operand (gen_rtx_MINUS (compute_mode,
@@ -4147,10 +4151,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                            extra_cost
                              = (shift_cost (speed, compute_mode, pre_shift)
                                 + shift_cost (speed, compute_mode, post_shift));
-                           t2 = expmed_mult_highpart (compute_mode, t1,
-                                                      GEN_INT (ml),
-                                                      NULL_RTX, 1,
-                                                      max_cost - extra_cost);
+                           t2 = expmed_mult_highpart
+                             (compute_mode, t1,
+                              gen_int_mode (ml, compute_mode),
+                              NULL_RTX, 1, max_cost - extra_cost);
                            if (t2 == 0)
                              goto fail1;
                            quotient = expand_shift
@@ -4274,9 +4278,9 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                        extra_cost = (shift_cost (speed, compute_mode, post_shift)
                                      + shift_cost (speed, compute_mode, size - 1)
                                      + add_cost (speed, compute_mode));
-                       t1 = expmed_mult_highpart (compute_mode, op0,
-                                                  GEN_INT (ml), NULL_RTX, 0,
-                                                  max_cost - extra_cost);
+                       t1 = expmed_mult_highpart
+                         (compute_mode, op0, gen_int_mode (ml, compute_mode),
+                          NULL_RTX, 0, max_cost - extra_cost);
                        if (t1 == 0)
                          goto fail1;
                        t2 = expand_shift
@@ -4368,9 +4372,12 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                    pre_shift = floor_log2 (d);
                    if (rem_flag)
                      {
-                       remainder = expand_binop (compute_mode, and_optab, op0,
-                                                 GEN_INT (((HOST_WIDE_INT) 1 << pre_shift) - 1),
-                                                 remainder, 0, OPTAB_LIB_WIDEN);
+                       unsigned HOST_WIDE_INT mask
+                         = ((unsigned HOST_WIDE_INT) 1 << pre_shift) - 1;
+                       remainder = expand_binop
+                         (compute_mode, and_optab, op0,
+                          gen_int_mode (mask, compute_mode),
+                          remainder, 0, OPTAB_LIB_WIDEN);
                        if (remainder)
                          return gen_lowpart (mode, remainder);
                      }
@@ -4397,9 +4404,9 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                        extra_cost = (shift_cost (speed, compute_mode, post_shift)
                                      + shift_cost (speed, compute_mode, size - 1)
                                      + 2 * add_cost (speed, compute_mode));
-                       t3 = expmed_mult_highpart (compute_mode, t2,
-                                                  GEN_INT (ml), NULL_RTX, 1,
-                                                  max_cost - extra_cost);
+                       t3 = expmed_mult_highpart
+                         (compute_mode, t2, gen_int_mode (ml, compute_mode),
+                          NULL_RTX, 1, max_cost - extra_cost);
                        if (t3 != 0)
                          {
                            t4 = expand_shift
@@ -4537,7 +4544,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
                                   floor_log2 (d), tquotient, 1);
                t2 = expand_binop (compute_mode, and_optab, op0,
-                                  GEN_INT (d - 1),
+                                  gen_int_mode (d - 1, compute_mode),
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
                t3 = gen_reg_rtx (compute_mode);
                t3 = emit_store_flag (t3, NE, t2, const0_rtx,
@@ -4634,7 +4641,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
                                   floor_log2 (d), tquotient, 0);
                t2 = expand_binop (compute_mode, and_optab, op0,
-                                  GEN_INT (d - 1),
+                                  gen_int_mode (d - 1, compute_mode),
                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
                t3 = gen_reg_rtx (compute_mode);
                t3 = emit_store_flag (t3, NE, t2, const0_rtx,
@@ -5477,7 +5484,7 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
                                       STORE_FLAG_VALUE, target_mode);
              if (tem)
                 return expand_binop (target_mode, add_optab, tem,
-                                    GEN_INT (normalizep),
+                                    gen_int_mode (normalizep, target_mode),
                                     target, 0, OPTAB_WIDEN);
            }
           else if (!want_add
@@ -5581,7 +5588,8 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
                                   STORE_FLAG_VALUE, target_mode);
          if (tem != 0)
             tem = expand_binop (target_mode, add_optab, tem,
-                               GEN_INT (normalizep), target, 0, OPTAB_WIDEN);
+                               gen_int_mode (normalizep, target_mode),
+                               target, 0, OPTAB_WIDEN);
        }
       else if (!want_add
               && rtx_cost (trueval, XOR, 1,
index dfe5b3f..89bd49a 100644 (file)
@@ -3132,7 +3132,7 @@ emit_move_resolve_push (enum machine_mode mode, rtx x)
   /* Do not use anti_adjust_stack, since we don't want to update
      stack_pointer_delta.  */
   temp = expand_simple_binop (Pmode, PLUS, stack_pointer_rtx,
-                             GEN_INT (adjust), stack_pointer_rtx,
+                             gen_int_mode (adjust, Pmode), stack_pointer_rtx,
                              0, OPTAB_LIB_WIDEN);
   if (temp != stack_pointer_rtx)
     emit_move_insn (stack_pointer_rtx, temp);
@@ -3643,7 +3643,8 @@ push_block (rtx size, int extra, int below)
     {
       temp = copy_to_mode_reg (Pmode, size);
       if (extra != 0)
-       temp = expand_binop (Pmode, add_optab, temp, GEN_INT (extra),
+       temp = expand_binop (Pmode, add_optab, temp,
+                            gen_int_mode (extra, Pmode),
                             temp, 0, OPTAB_LIB_WIDEN);
       anti_adjust_stack (temp);
     }
@@ -3911,7 +3912,7 @@ emit_single_push_insn_1 (enum machine_mode mode, rtx x, tree type)
                                    add_optab,
 #endif
                                    stack_pointer_rtx,
-                                   GEN_INT (rounded_size),
+                                   gen_int_mode (rounded_size, Pmode),
                                    NULL_RTX, 0, OPTAB_LIB_WIDEN));
 
       offset = (HOST_WIDE_INT) padding_size;
@@ -4127,8 +4128,8 @@ emit_push_insn (rtx x, enum machine_mode mode, tree type, rtx size,
                size = GEN_INT (INTVAL (size) - used);
              else
                size = expand_binop (GET_MODE (size), sub_optab, size,
-                                    GEN_INT (used), NULL_RTX, 0,
-                                    OPTAB_LIB_WIDEN);
+                                    gen_int_mode (used, GET_MODE (size)),
+                                    NULL_RTX, 0, OPTAB_LIB_WIDEN);
            }
 
          /* Get the address of the stack space.
@@ -4475,7 +4476,8 @@ optimize_bitfield_assignment_op (unsigned HOST_WIDE_INT bitsize,
       binop = code == BIT_IOR_EXPR ? ior_optab : xor_optab;
       if (bitpos + bitsize != str_bitsize)
        {
-         rtx mask = GEN_INT (((unsigned HOST_WIDE_INT) 1 << bitsize) - 1);
+         rtx mask = gen_int_mode (((unsigned HOST_WIDE_INT) 1 << bitsize) - 1,
+                                  str_mode);
          value = expand_and (str_mode, value, mask, NULL_RTX);
        }
       value = expand_shift (LSHIFT_EXPR, str_mode, value, bitpos, NULL_RTX, 1);
@@ -9857,7 +9859,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
 
                    if (TYPE_UNSIGNED (TREE_TYPE (field)))
                      {
-                       op1 = GEN_INT (((HOST_WIDE_INT) 1 << bitsize) - 1);
+                       op1 = gen_int_mode (((HOST_WIDE_INT) 1 << bitsize) - 1,
+                                           imode);
                        op0 = expand_and (imode, op0, op1, target);
                      }
                    else
index 08731e8..d6434e8 100644 (file)
@@ -1544,9 +1544,10 @@ instantiate_virtual_regs_in_insn (rtx insn)
        {
          start_sequence ();
 
-         x = expand_simple_binop (GET_MODE (SET_DEST (set)), PLUS,
-                                  new_rtx, GEN_INT (offset), SET_DEST (set),
-                                  1, OPTAB_LIB_WIDEN);
+         x = expand_simple_binop (GET_MODE (SET_DEST (set)), PLUS, new_rtx,
+                                  gen_int_mode (offset,
+                                                GET_MODE (SET_DEST (set))),
+                                  SET_DEST (set), 1, OPTAB_LIB_WIDEN);
          if (x != SET_DEST (set))
            emit_move_insn (SET_DEST (set), x);
 
@@ -1666,8 +1667,8 @@ instantiate_virtual_regs_in_insn (rtx insn)
                 to see if (plus new offset) is a valid before we put
                 this through expand_simple_binop.  */
              x = expand_simple_binop (GET_MODE (x), PLUS, new_rtx,
-                                      GEN_INT (offset), NULL_RTX,
-                                      1, OPTAB_LIB_WIDEN);
+                                      gen_int_mode (offset, GET_MODE (x)),
+                                      NULL_RTX, 1, OPTAB_LIB_WIDEN);
              seq = get_insns ();
              end_sequence ();
              emit_insn_before (seq, insn);
@@ -1681,9 +1682,10 @@ instantiate_virtual_regs_in_insn (rtx insn)
          if (offset != 0)
            {
              start_sequence ();
-             new_rtx = expand_simple_binop (GET_MODE (new_rtx), PLUS, new_rtx,
-                                        GEN_INT (offset), NULL_RTX,
-                                        1, OPTAB_LIB_WIDEN);
+             new_rtx = expand_simple_binop
+               (GET_MODE (new_rtx), PLUS, new_rtx,
+                gen_int_mode (offset, GET_MODE (new_rtx)),
+                NULL_RTX, 1, OPTAB_LIB_WIDEN);
              seq = get_insns ();
              end_sequence ();
              emit_insn_before (seq, insn);
index 5698b4f..ebc4f1c 100644 (file)
@@ -1162,8 +1162,8 @@ noce_try_store_flag_constants (struct noce_if_info *if_info)
          target = expand_simple_binop (mode,
                                        (diff == STORE_FLAG_VALUE
                                         ? PLUS : MINUS),
-                                       GEN_INT (ifalse), target, if_info->x, 0,
-                                       OPTAB_WIDEN);
+                                       gen_int_mode (ifalse, mode), target,
+                                       if_info->x, 0, OPTAB_WIDEN);
        }
 
       /* if (test) x = 8; else x = 0;
@@ -1180,8 +1180,8 @@ noce_try_store_flag_constants (struct noce_if_info *if_info)
       else if (itrue == -1)
        {
          target = expand_simple_binop (mode, IOR,
-                                       target, GEN_INT (ifalse), if_info->x, 0,
-                                       OPTAB_WIDEN);
+                                       target, gen_int_mode (ifalse, mode),
+                                       if_info->x, 0, OPTAB_WIDEN);
        }
 
       /* if (test) x = a; else x = b;
@@ -1189,11 +1189,11 @@ noce_try_store_flag_constants (struct noce_if_info *if_info)
       else
        {
          target = expand_simple_binop (mode, AND,
-                                       target, GEN_INT (diff), if_info->x, 0,
-                                       OPTAB_WIDEN);
+                                       target, gen_int_mode (diff, mode),
+                                       if_info->x, 0, OPTAB_WIDEN);
          if (target)
            target = expand_simple_binop (mode, PLUS,
-                                         target, GEN_INT (ifalse),
+                                         target, gen_int_mode (ifalse, mode),
                                          if_info->x, 0, OPTAB_WIDEN);
        }
 
index ad26f3d..84902bf 100644 (file)
@@ -1166,8 +1166,7 @@ unroll_loop_runtime_iterations (struct loop *loop)
      the number of unrollings is a power of two, and thus this is correct
      even if there is overflow in the computation.  */
   niter = expand_simple_binop (desc->mode, AND,
-                              niter,
-                              GEN_INT (max_unroll),
+                              niter, gen_int_mode (max_unroll, desc->mode),
                               NULL_RTX, 0, OPTAB_LIB_WIDEN);
 
   init_code = get_insns ();
index a1d0999..3ad2ec7 100644 (file)
@@ -1148,8 +1148,9 @@ generate_prolog_epilog (partial_schedule_ptr ps, struct loop *loop,
          generate_prolog_epilog function.  */
       rtx sub_reg = NULL_RTX;
 
-      sub_reg = expand_simple_binop (GET_MODE (count_reg), MINUS,
-                                     count_reg, GEN_INT (last_stage),
+      sub_reg = expand_simple_binop (GET_MODE (count_reg), MINUS, count_reg,
+                                    gen_int_mode (last_stage,
+                                                  GET_MODE (count_reg)),
                                      count_reg, 1, OPTAB_DIRECT);
       gcc_assert (REG_P (sub_reg));
       if (REGNO (sub_reg) != REGNO (count_reg))
index a3051ad..1d0659e 100644 (file)
@@ -1563,7 +1563,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
         newop1 = negate_rtx (GET_MODE (op1), op1);
       else
         newop1 = expand_binop (GET_MODE (op1), sub_optab,
-                              GEN_INT (bits), op1,
+                              gen_int_mode (bits, GET_MODE (op1)), op1,
                               NULL_RTX, unsignedp, OPTAB_DIRECT);
 
       temp = expand_binop_directly (mode, otheroptab, op0, newop1,
@@ -2539,10 +2539,12 @@ widen_leading (enum machine_mode mode, rtx op0, rtx target, optab unoptab)
              temp = expand_unop (wider_mode, unoptab, xop0, NULL_RTX,
                                  unoptab != clrsb_optab);
              if (temp != 0)
-               temp = expand_binop (wider_mode, sub_optab, temp,
-                                    GEN_INT (GET_MODE_PRECISION (wider_mode)
-                                             - GET_MODE_PRECISION (mode)),
-                                    target, true, OPTAB_DIRECT);
+               temp = expand_binop
+                 (wider_mode, sub_optab, temp,
+                  gen_int_mode (GET_MODE_PRECISION (wider_mode)
+                                - GET_MODE_PRECISION (mode),
+                                wider_mode),
+                  target, true, OPTAB_DIRECT);
              if (temp == 0)
                delete_insns_since (last);
 
@@ -2601,7 +2603,7 @@ expand_doubleword_clz (enum machine_mode mode, rtx op0, rtx target)
   if (!temp)
     goto fail;
   temp = expand_binop (word_mode, add_optab, temp,
-                      GEN_INT (GET_MODE_BITSIZE (word_mode)),
+                      gen_int_mode (GET_MODE_BITSIZE (word_mode), word_mode),
                       result, true, OPTAB_DIRECT);
   if (!temp)
     goto fail;
@@ -2757,7 +2759,8 @@ expand_ctz (enum machine_mode mode, rtx op0, rtx target)
   if (temp)
     temp = expand_unop_direct (mode, clz_optab, temp, NULL_RTX, true);
   if (temp)
-    temp = expand_binop (mode, sub_optab, GEN_INT (GET_MODE_PRECISION (mode) - 1),
+    temp = expand_binop (mode, sub_optab,
+                        gen_int_mode (GET_MODE_PRECISION (mode) - 1, mode),
                         temp, target,
                         true, OPTAB_DIRECT);
   if (temp == 0)
@@ -2838,7 +2841,7 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target)
 
   /* temp now has a value in the range -1..bitsize-1.  ffs is supposed
      to produce a value in the range 0..bitsize.  */
-  temp = expand_binop (mode, add_optab, temp, GEN_INT (1),
+  temp = expand_binop (mode, add_optab, temp, gen_int_mode (1, mode),
                       target, false, OPTAB_DIRECT);
   if (!temp)
     goto fail;
@@ -3308,10 +3311,12 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
                 result.  Similarly for clrsb.  */
              if ((unoptab == clz_optab || unoptab == clrsb_optab)
                  && temp != 0)
-               temp = expand_binop (wider_mode, sub_optab, temp,
-                                    GEN_INT (GET_MODE_PRECISION (wider_mode)
-                                             - GET_MODE_PRECISION (mode)),
-                                    target, true, OPTAB_DIRECT);
+               temp = expand_binop
+                 (wider_mode, sub_optab, temp,
+                  gen_int_mode (GET_MODE_PRECISION (wider_mode)
+                                - GET_MODE_PRECISION (mode),
+                                wider_mode),
+                  target, true, OPTAB_DIRECT);
 
              /* Likewise for bswap.  */
              if (unoptab == bswap_optab && temp != 0)