diff options
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 194 |
1 files changed, 101 insertions, 93 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index fba7182e305..f6da8acd48a 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -80,7 +80,7 @@ init_expmed () char *free_point; /* This is "some random pseudo register" for purposes of calling recog to see what insns exist. */ - rtx reg = gen_rtx (REG, word_mode, 10000); + rtx reg = gen_rtx_REG (word_mode, 10000); rtx shift_insn, shiftadd_insn, shiftsub_insn; int dummy; int m; @@ -95,23 +95,25 @@ init_expmed () free_point = (char *) oballoc (0); zero_cost = rtx_cost (const0_rtx, 0); - add_cost = rtx_cost (gen_rtx (PLUS, word_mode, reg, reg), SET); - - shift_insn = emit_insn (gen_rtx (SET, VOIDmode, reg, - gen_rtx (ASHIFT, word_mode, reg, - const0_rtx))); - - shiftadd_insn = emit_insn (gen_rtx (SET, VOIDmode, reg, - gen_rtx (PLUS, word_mode, - gen_rtx (MULT, word_mode, - reg, const0_rtx), - reg))); - - shiftsub_insn = emit_insn (gen_rtx (SET, VOIDmode, reg, - gen_rtx (MINUS, word_mode, - gen_rtx (MULT, word_mode, - reg, const0_rtx), - reg))); + add_cost = rtx_cost (gen_rtx_PLUS (word_mode, reg, reg), SET); + + shift_insn = emit_insn (gen_rtx_SET (VOIDmode, reg, + gen_rtx_ASHIFT (word_mode, reg, + const0_rtx))); + + shiftadd_insn + = emit_insn (gen_rtx_SET (VOIDmode, reg, + gen_rtx_PLUS (word_mode, + gen_rtx_MULT (word_mode, + reg, const0_rtx), + reg))); + + shiftsub_insn + = emit_insn (gen_rtx_SET (VOIDmode, reg, + gen_rtx_MINUS (word_mode, + gen_rtx_MULT (word_mode, + reg, const0_rtx), + reg))); init_recog (); @@ -137,37 +139,39 @@ init_expmed () shiftsub_cost[m] = rtx_cost (SET_SRC (PATTERN (shiftsub_insn)), SET); } - negate_cost = rtx_cost (gen_rtx (NEG, word_mode, reg), SET); + negate_cost = rtx_cost (gen_rtx_NEG (word_mode, reg), SET); sdiv_pow2_cheap - = (rtx_cost (gen_rtx (DIV, word_mode, reg, GEN_INT (32)), SET) + = (rtx_cost (gen_rtx_DIV (word_mode, reg, GEN_INT (32)), SET) <= 2 * add_cost); smod_pow2_cheap - = (rtx_cost (gen_rtx (MOD, word_mode, reg, GEN_INT (32)), SET) + = (rtx_cost (gen_rtx_MOD (word_mode, reg, GEN_INT (32)), SET) <= 2 * add_cost); for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode)) { - reg = gen_rtx (REG, mode, 10000); - div_cost[(int) mode] = rtx_cost (gen_rtx (UDIV, mode, reg, reg), SET); - mul_cost[(int) mode] = rtx_cost (gen_rtx (MULT, mode, reg, reg), SET); + reg = gen_rtx_REG (mode, 10000); + div_cost[(int) mode] = rtx_cost (gen_rtx_UDIV (mode, reg, reg), SET); + mul_cost[(int) mode] = rtx_cost (gen_rtx_MULT (mode, reg, reg), SET); wider_mode = GET_MODE_WIDER_MODE (mode); if (wider_mode != VOIDmode) { mul_widen_cost[(int) wider_mode] - = rtx_cost (gen_rtx (MULT, wider_mode, - gen_rtx (ZERO_EXTEND, wider_mode, reg), - gen_rtx (ZERO_EXTEND, wider_mode, reg)), + = rtx_cost (gen_rtx_MULT (wider_mode, + gen_rtx_ZERO_EXTEND (wider_mode, reg), + gen_rtx_ZERO_EXTEND (wider_mode, reg)), SET); mul_highpart_cost[(int) mode] - = rtx_cost (gen_rtx (TRUNCATE, mode, - gen_rtx (LSHIFTRT, wider_mode, - gen_rtx (MULT, wider_mode, - gen_rtx (ZERO_EXTEND, wider_mode, reg), - gen_rtx (ZERO_EXTEND, wider_mode, reg)), - GEN_INT (GET_MODE_BITSIZE (mode)))), + = rtx_cost (gen_rtx_TRUNCATE + (mode, + gen_rtx_LSHIFTRT + (wider_mode, + gen_rtx_MULT (wider_mode, + gen_rtx_ZERO_EXTEND (wider_mode, reg), + gen_rtx_ZERO_EXTEND (wider_mode, reg)), + GEN_INT (GET_MODE_BITSIZE (mode)))), SET); } } @@ -273,7 +277,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size) if (GET_MODE (op0) != fieldmode) { if (GET_CODE (op0) == REG) - op0 = gen_rtx (SUBREG, fieldmode, op0, offset); + op0 = gen_rtx_SUBREG (fieldmode, op0, offset); else op0 = change_address (op0, fieldmode, plus_constant (XEXP (op0, 0), offset)); @@ -308,7 +312,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size) if(! (*insn_operand_predicate[icode][1]) (value, fieldmode)) value = copy_to_mode_reg (fieldmode, value); emit_insn (GEN_FCN (icode) - (gen_rtx (SUBREG, fieldmode, op0, offset), value)); + (gen_rtx_SUBREG (fieldmode, op0, offset), value)); } return value; } @@ -365,7 +369,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size) { if (offset != 0 || GET_MODE_SIZE (GET_MODE (op0)) > UNITS_PER_WORD) - op0 = gen_rtx (SUBREG, TYPE_MODE (type_for_size (BITS_PER_WORD, 0)), + op0 = gen_rtx_SUBREG (TYPE_MODE (type_for_size (BITS_PER_WORD, 0)), op0, offset); offset = 0; } @@ -382,7 +386,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size) { if (GET_CODE (value) != REG) value = copy_to_reg (value); - value = gen_rtx (SUBREG, word_mode, value, 0); + value = gen_rtx_SUBREG (word_mode, value, 0); } /* Now OFFSET is nonzero only if OP0 is memory @@ -465,9 +469,9 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size) if (GET_CODE (xop0) == SUBREG) /* We can't just change the mode, because this might clobber op0, and we will need the original value of op0 if insv fails. */ - xop0 = gen_rtx (SUBREG, maxmode, SUBREG_REG (xop0), SUBREG_WORD (xop0)); + xop0 = gen_rtx_SUBREG (maxmode, SUBREG_REG (xop0), SUBREG_WORD (xop0)); if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode) - xop0 = gen_rtx (SUBREG, maxmode, xop0, 0); + xop0 = gen_rtx_SUBREG (maxmode, xop0, 0); /* On big-endian machines, we count bits from the most significant. If the bit field insn does not, we must invert. */ @@ -497,7 +501,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size) /* Avoid making subreg of a subreg, or of a mem. */ if (GET_CODE (value1) != REG) value1 = copy_to_reg (value1); - value1 = gen_rtx (SUBREG, maxmode, value1, 0); + value1 = gen_rtx_SUBREG (maxmode, value1, 0); } else value1 = gen_lowpart (maxmode, value1); @@ -954,7 +958,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp, if (mode1 != GET_MODE (op0)) { if (GET_CODE (op0) == REG) - op0 = gen_rtx (SUBREG, mode1, op0, offset); + op0 = gen_rtx_SUBREG (mode1, op0, offset); else op0 = change_address (op0, mode1, plus_constant (XEXP (op0, 0), offset)); @@ -980,7 +984,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp, target = gen_reg_rtx (mode); /* Indicate for flow that the entire target reg is being set. */ - emit_insn (gen_rtx (CLOBBER, VOIDmode, target)); + emit_insn (gen_rtx_CLOBBER (VOIDmode, target)); for (i = 0; i < nwords; i++) { @@ -1049,7 +1053,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp, { if (offset != 0 || GET_MODE_SIZE (GET_MODE (op0)) > UNITS_PER_WORD) - op0 = gen_rtx (SUBREG, TYPE_MODE (type_for_size (BITS_PER_WORD, 0)), + op0 = gen_rtx_SUBREG (TYPE_MODE (type_for_size (BITS_PER_WORD, 0)), op0, offset); offset = 0; } @@ -1138,7 +1142,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp, if (GET_CODE (xop0) == SUBREG && GET_MODE (xop0) != maxmode) abort (); if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode) - xop0 = gen_rtx (SUBREG, maxmode, xop0, 0); + xop0 = gen_rtx_SUBREG (maxmode, xop0, 0); /* On big-endian machines, we count bits from the most significant. If the bit field insn does not, we must invert. */ @@ -1272,7 +1276,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp, if (GET_CODE (xop0) == SUBREG && GET_MODE (xop0) != maxmode) abort (); if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode) - xop0 = gen_rtx (SUBREG, maxmode, xop0, 0); + xop0 = gen_rtx_SUBREG (maxmode, xop0, 0); /* On big-endian machines, we count bits from the most significant. If the bit field insn does not, we must invert. */ @@ -1351,7 +1355,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp, target, unsignedp); if (GET_CODE (target) != REG) target = copy_to_reg (target); - return gen_rtx (SUBREG, tmode, target, 0); + return gen_rtx_SUBREG (tmode, target, 0); } else return convert_to_mode (tmode, target, unsignedp); @@ -2197,7 +2201,7 @@ expand_mult (mode, op0, op1, target, unsignedp) and then negate, do the multiplication directly, or do multiplication by OP1 - 1. */ - mult_cost = rtx_cost (gen_rtx (MULT, mode, op0, op1), SET); + mult_cost = rtx_cost (gen_rtx_MULT (mode, op0, op1), SET); mult_cost = MIN (12 * add_cost, mult_cost); synth_mult (&alg, val, mult_cost); @@ -2268,7 +2272,7 @@ expand_mult (mode, op0, op1, target, unsignedp) case alg_add_t_m2: tem = expand_shift (LSHIFT_EXPR, mode, op0, build_int_2 (log, 0), NULL_RTX, 0); - accum = force_operand (gen_rtx (PLUS, mode, accum, tem), + accum = force_operand (gen_rtx_PLUS (mode, accum, tem), add_target ? add_target : accum_target); val_so_far += (HOST_WIDE_INT) 1 << log; break; @@ -2276,7 +2280,7 @@ expand_mult (mode, op0, op1, target, unsignedp) case alg_sub_t_m2: tem = expand_shift (LSHIFT_EXPR, mode, op0, build_int_2 (log, 0), NULL_RTX, 0); - accum = force_operand (gen_rtx (MINUS, mode, accum, tem), + accum = force_operand (gen_rtx_MINUS (mode, accum, tem), add_target ? add_target : accum_target); val_so_far -= (HOST_WIDE_INT) 1 << log; break; @@ -2285,7 +2289,7 @@ expand_mult (mode, op0, op1, target, unsignedp) accum = expand_shift (LSHIFT_EXPR, mode, accum, build_int_2 (log, 0), shift_subtarget, 0); - accum = force_operand (gen_rtx (PLUS, mode, accum, op0), + accum = force_operand (gen_rtx_PLUS (mode, accum, op0), add_target ? add_target : accum_target); val_so_far = (val_so_far << log) + 1; break; @@ -2294,7 +2298,7 @@ expand_mult (mode, op0, op1, target, unsignedp) accum = expand_shift (LSHIFT_EXPR, mode, accum, build_int_2 (log, 0), shift_subtarget, 0); - accum = force_operand (gen_rtx (MINUS, mode, accum, op0), + accum = force_operand (gen_rtx_MINUS (mode, accum, op0), add_target ? add_target : accum_target); val_so_far = (val_so_far << log) - 1; break; @@ -2302,7 +2306,7 @@ expand_mult (mode, op0, op1, target, unsignedp) case alg_add_factor: tem = expand_shift (LSHIFT_EXPR, mode, accum, build_int_2 (log, 0), NULL_RTX, 0); - accum = force_operand (gen_rtx (PLUS, mode, accum, tem), + accum = force_operand (gen_rtx_PLUS (mode, accum, tem), add_target ? add_target : accum_target); val_so_far += val_so_far << log; break; @@ -2310,7 +2314,7 @@ expand_mult (mode, op0, op1, target, unsignedp) case alg_sub_factor: tem = expand_shift (LSHIFT_EXPR, mode, accum, build_int_2 (log, 0), NULL_RTX, 0); - accum = force_operand (gen_rtx (MINUS, mode, tem, accum), + accum = force_operand (gen_rtx_MINUS (mode, tem, accum), (add_target ? add_target : preserve ? 0 : tem)); val_so_far = (val_so_far << log) - val_so_far; @@ -2325,9 +2329,9 @@ expand_mult (mode, op0, op1, target, unsignedp) insn = get_last_insn (); REG_NOTES (insn) - = gen_rtx (EXPR_LIST, REG_EQUAL, - gen_rtx (MULT, mode, op0, GEN_INT (val_so_far)), - REG_NOTES (insn)); + = gen_rtx_EXPR_LIST (REG_EQUAL, + gen_rtx_MULT (mode, op0, GEN_INT (val_so_far)), + REG_NOTES (insn)); } if (variant == negate_variant) @@ -2338,7 +2342,7 @@ expand_mult (mode, op0, op1, target, unsignedp) else if (variant == add_variant) { val_so_far = val_so_far + 1; - accum = force_operand (gen_rtx (PLUS, mode, accum, op0), target); + accum = force_operand (gen_rtx_PLUS (mode, accum, op0), target); } if (val != val_so_far) @@ -2529,14 +2533,16 @@ expand_mult_highpart_adjust (mode, adj_operand, op0, op1, target, unsignedp) build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0), NULL_RTX, 0); tem = expand_and (tem, op1, NULL_RTX); - adj_operand = force_operand (gen_rtx (adj_code, mode, adj_operand, tem), - adj_operand); + adj_operand + = force_operand (gen_rtx_fmt_ee (adj_code, mode, adj_operand, tem), + adj_operand); tem = expand_shift (RSHIFT_EXPR, mode, op1, build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0), NULL_RTX, 0); tem = expand_and (tem, op0, NULL_RTX); - target = force_operand (gen_rtx (adj_code, mode, adj_operand, tem), target); + target = force_operand (gen_rtx_fmt_ee (adj_code, mode, adj_operand, tem), + target); return target; } @@ -2949,13 +2955,13 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) max_cost - extra_cost); if (t1 == 0) goto fail1; - t2 = force_operand (gen_rtx (MINUS, compute_mode, - op0, t1), + t2 = force_operand (gen_rtx_MINUS (compute_mode, + op0, t1), NULL_RTX); t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2, build_int_2 (1, 0), NULL_RTX,1); - t4 = force_operand (gen_rtx (PLUS, compute_mode, - t1, t3), + t4 = force_operand (gen_rtx_PLUS (compute_mode, + t1, t3), NULL_RTX); quotient = expand_shift (RSHIFT_EXPR, compute_mode, t4, @@ -2991,9 +2997,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) && (set = single_set (insn)) != 0 && SET_DEST (set) == quotient) REG_NOTES (insn) - = gen_rtx (EXPR_LIST, REG_EQUAL, - gen_rtx (UDIV, compute_mode, op0, op1), - REG_NOTES (insn)); + = gen_rtx_EXPR_LIST (REG_EQUAL, + gen_rtx_UDIV (compute_mode, op0, op1), + REG_NOTES (insn)); } else /* TRUNC_DIV, signed */ { @@ -3052,8 +3058,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) t2 = expand_shift (RSHIFT_EXPR, compute_mode, t1, build_int_2 (size - lgup, 0), NULL_RTX, 1); - t3 = force_operand (gen_rtx (PLUS, compute_mode, - op0, t2), + t3 = force_operand (gen_rtx_PLUS (compute_mode, + op0, t2), NULL_RTX); quotient = expand_shift (RSHIFT_EXPR, compute_mode, t3, build_int_2 (lgup, 0), @@ -3069,9 +3075,10 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) && (set = single_set (insn)) != 0 && SET_DEST (set) == quotient) REG_NOTES (insn) - = gen_rtx (EXPR_LIST, REG_EQUAL, - gen_rtx (DIV, compute_mode, op0, - GEN_INT (abs_d)), + = gen_rtx_EXPR_LIST (REG_EQUAL, + gen_rtx_DIV (compute_mode, + op0, + GEN_INT (abs_d)), REG_NOTES (insn)); quotient = expand_unop (compute_mode, neg_optab, @@ -3098,10 +3105,10 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) t3 = expand_shift (RSHIFT_EXPR, compute_mode, op0, build_int_2 (size - 1, 0), NULL_RTX, 0); if (d < 0) - quotient = force_operand (gen_rtx (MINUS, compute_mode, t3, t2), + quotient = force_operand (gen_rtx_MINUS (compute_mode, t3, t2), tquotient); else - quotient = force_operand (gen_rtx (MINUS, compute_mode, t2, t3), + quotient = force_operand (gen_rtx_MINUS (compute_mode, t2, t3), tquotient); } else @@ -3116,17 +3123,17 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) max_cost - extra_cost); if (t1 == 0) goto fail1; - t2 = force_operand (gen_rtx (PLUS, compute_mode, t1, op0), + t2 = force_operand (gen_rtx_PLUS (compute_mode, t1, op0), NULL_RTX); t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2, build_int_2 (post_shift, 0), NULL_RTX, 0); t4 = expand_shift (RSHIFT_EXPR, compute_mode, op0, build_int_2 (size - 1, 0), NULL_RTX, 0); if (d < 0) - quotient = force_operand (gen_rtx (MINUS, compute_mode, t4, t3), + quotient = force_operand (gen_rtx_MINUS (compute_mode, t4, t3), tquotient); else - quotient = force_operand (gen_rtx (MINUS, compute_mode, t3, t4), + quotient = force_operand (gen_rtx_MINUS (compute_mode, t3, t4), tquotient); } } @@ -3138,9 +3145,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) && (set = single_set (insn)) != 0 && SET_DEST (set) == quotient) REG_NOTES (insn) - = gen_rtx (EXPR_LIST, REG_EQUAL, - gen_rtx (DIV, compute_mode, op0, op1), - REG_NOTES (insn)); + = gen_rtx_EXPR_LIST (REG_EQUAL, + gen_rtx_DIV (compute_mode, op0, op1), + REG_NOTES (insn)); } break; } @@ -3208,13 +3215,13 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) else { rtx nsign, t1, t2, t3, t4; - t1 = force_operand (gen_rtx (PLUS, compute_mode, - op0, constm1_rtx), NULL_RTX); + t1 = force_operand (gen_rtx_PLUS (compute_mode, + op0, constm1_rtx), NULL_RTX); t2 = expand_binop (compute_mode, ior_optab, op0, t1, NULL_RTX, 0, OPTAB_WIDEN); nsign = expand_shift (RSHIFT_EXPR, compute_mode, t2, build_int_2 (size - 1, 0), NULL_RTX, 0); - t3 = force_operand (gen_rtx (MINUS, compute_mode, t1, nsign), + t3 = force_operand (gen_rtx_MINUS (compute_mode, t1, nsign), NULL_RTX); t4 = expand_divmod (0, TRUNC_DIV_EXPR, compute_mode, t3, op1, NULL_RTX, 0); @@ -3223,8 +3230,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) rtx t5; t5 = expand_unop (compute_mode, one_cmpl_optab, nsign, NULL_RTX, 0); - quotient = force_operand (gen_rtx (PLUS, compute_mode, - t4, t5), + quotient = force_operand (gen_rtx_PLUS (compute_mode, + t4, t5), tquotient); } } @@ -3355,8 +3362,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) quotient = t1; } else - quotient = force_operand (gen_rtx (PLUS, compute_mode, - t1, t3), + quotient = force_operand (gen_rtx_PLUS (compute_mode, + t1, t3), tquotient); break; } @@ -3457,8 +3464,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) quotient = t1; } else - quotient = force_operand (gen_rtx (PLUS, compute_mode, - t1, t3), + quotient = force_operand (gen_rtx_PLUS (compute_mode, + t1, t3), tquotient); break; } @@ -3575,10 +3582,11 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) insn = get_last_insn (); REG_NOTES (insn) - = gen_rtx (EXPR_LIST, REG_EQUAL, - gen_rtx (unsignedp ? UDIV : DIV, compute_mode, - op0, op1), - REG_NOTES (insn)); + = gen_rtx_EXPR_LIST (REG_EQUAL, + gen_rtx_fmt_ee (unsignedp ? UDIV : DIV, + compute_mode, + op0, op1), + REG_NOTES (insn)); } break; |