* [0/3] Allow optabs to be zero-initialised
@ 2010-07-03 17:29 Richard Sandiford
2010-07-03 17:34 ` [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER Richard Sandiford
` (2 more replies)
0 siblings, 3 replies; 19+ messages in thread
From: Richard Sandiford @ 2010-07-03 17:29 UTC (permalink / raw)
To: gcc-patches
The global optab arrays require each insn_code field to be initialised
to CODE_FOR_nothing (a target-dependent value greater than any real
insn code). This series of three patches allows them to be initialised
to zero instead.
The series is a prerequisite for the upcoming "speed up target_reinit"
patches, but I think it's a good thing in its own right. It shaves
about 600K from the data section of cc1 (the exact value is target-
dependent) and cuts down the amount of run-time initialisation.
It also removes some preprocessor-conditional code.
Bootstrapped & regression-tested on x86_64-linux-gnu.
Richard
^ permalink raw reply [flat|nested] 19+ messages in thread
* [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 17:29 [0/3] Allow optabs to be zero-initialised Richard Sandiford
@ 2010-07-03 17:34 ` Richard Sandiford
[not found] ` <AANLkTinjMxQLGLg60mau0LpdCA2GnrkI3ZdlQ1pTvoV3@mail.gmail.com>
2010-07-03 17:44 ` [2/3] optabs: Bias optabs by -CODE_FOR_nothing Richard Sandiford
2010-07-03 17:49 ` [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too Richard Sandiford
2 siblings, 1 reply; 19+ messages in thread
From: Richard Sandiford @ 2010-07-03 17:34 UTC (permalink / raw)
To: gcc-patches
This patch semi-mechanically replaces:
optab_handler (foo, mode)->insn_code
with either:
OPTAB_HANDLER (foo, mode)
or:
SET_OPTAB_HANDLER (foo, mode, bar)
depending on whether the optab is being read or set to "bar".
It does the same thing for conversion optabs. This allows the
next patch to change the underlying representation in a single place.
Bootstrapped & regression-tested on x86_64-linux-gnu. OK to install?
Richard
gcc/
* optabs.h (optab_handler, convert_optab_handler): Delete.
(OPTAB_HANDLER, SET_OPTAB_HANDLER): New macros.
(CONVERT_OPTAB_HANDLER, SET_CONVERT_OPTAB_HANDLER): Likewise.
* builtins.c: Replace optab_handler(X)->insn_code with
OPTAB_HANDLER or SET_OPTAB_HANDLER thoughout. Likewise
convert_optab_handler(X)->insn_code with CONVERT_OPTAB_HANDLER
and SET_CONVERT_OPTAB_HANDLER.
* expmed.c, expr.c, genopinit.c, ifcvt.c, optabs.c, reload.c,
reload1.c, stmt.c, targhooks.c, tree-ssa-loop-prefetch.c,
tree-ssa-math-opts.c, tree-vect-data-refs.c, tree-vect-generic.c,
tree-vect-loop.c, tree-vect-patterns.c, tree-vect-slp.c,
tree-vect-stmts.c, config/m32c/m32c.c, config/rs6000/rs6000.c,
config/spu/spu.c: Likewise.
Index: gcc/optabs.h
===================================================================
--- gcc/optabs.h 2010-07-03 18:20:10.000000000 +0100
+++ gcc/optabs.h 2010-07-03 18:32:20.000000000 +0100
@@ -782,9 +782,15 @@ extern rtx expand_vec_cond_expr (tree, t
/* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */
extern rtx expand_vec_shift_expr (sepops, rtx);
-#define optab_handler(optab,mode) (&(optab)->handlers[(int) (mode)])
-#define convert_optab_handler(optab,mode,mode2) \
- (&(optab)->handlers[(int) (mode)][(int) (mode2)])
+#define OPTAB_HANDLER(OPTAB, MODE) \
+ ((OPTAB)->handlers[(int) (MODE)].insn_code)
+#define SET_OPTAB_HANDLER(OPTAB, MODE, CODE) \
+ ((void) ((OPTAB)->handlers[(int) (MODE)].insn_code = (CODE)))
+
+#define CONVERT_OPTAB_HANDLER(OPTAB, MODE, MODE2) \
+ ((OPTAB)->handlers[(int) (MODE)][(int) (MODE2)].insn_code)
+#define SET_CONVERT_OPTAB_HANDLER(OPTAB, MODE, MODE2, CODE) \
+ ((void) ((OPTAB)->handlers[(int) (MODE)][(int) (MODE2)].insn_code = (CODE)))
extern rtx optab_libfunc (optab optab, enum machine_mode mode);
extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/builtins.c 2010-07-03 18:32:20.000000000 +0100
@@ -1994,7 +1994,7 @@ expand_builtin_mathfn (tree exp, rtx tar
errno_set = false;
/* Before working hard, check whether the instruction is available. */
- if (optab_handler (builtin_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (builtin_optab, mode) != CODE_FOR_nothing)
{
target = gen_reg_rtx (mode);
@@ -2096,7 +2096,7 @@ expand_builtin_mathfn_2 (tree exp, rtx t
mode = TYPE_MODE (TREE_TYPE (exp));
/* Before working hard, check whether the instruction is available. */
- if (optab_handler (builtin_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (builtin_optab, mode) == CODE_FOR_nothing)
return NULL_RTX;
target = gen_reg_rtx (mode);
@@ -2173,7 +2173,7 @@ expand_builtin_mathfn_3 (tree exp, rtx t
/* Check if sincos insn is available, otherwise fallback
to sin or cos insn. */
- if (optab_handler (builtin_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (builtin_optab, mode) == CODE_FOR_nothing)
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_FLT_FN (BUILT_IN_SIN):
@@ -2185,7 +2185,7 @@ expand_builtin_mathfn_3 (tree exp, rtx t
}
/* Before working hard, check whether the instruction is available. */
- if (optab_handler (builtin_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (builtin_optab, mode) != CODE_FOR_nothing)
{
target = gen_reg_rtx (mode);
@@ -2282,7 +2282,7 @@ interclass_mathfn_icode (tree arg, tree
mode = TYPE_MODE (TREE_TYPE (arg));
if (builtin_optab)
- return optab_handler (builtin_optab, mode)->insn_code;
+ return OPTAB_HANDLER (builtin_optab, mode);
return CODE_FOR_nothing;
}
@@ -2370,7 +2370,7 @@ expand_builtin_sincos (tree exp)
mode = TYPE_MODE (TREE_TYPE (arg));
/* Check if sincos insn is available, otherwise emit the call. */
- if (optab_handler (sincos_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (sincos_optab, mode) == CODE_FOR_nothing)
return NULL_RTX;
target1 = gen_reg_rtx (mode);
@@ -2417,7 +2417,7 @@ expand_builtin_cexpi (tree exp, rtx targ
/* Try expanding via a sincos optab, fall back to emitting a libcall
to sincos or cexp. We are sure we have sincos or cexp because cexpi
is only generated from sincos, cexp or if we have either of them. */
- if (optab_handler (sincos_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (sincos_optab, mode) != CODE_FOR_nothing)
{
op1 = gen_reg_rtx (mode);
op2 = gen_reg_rtx (mode);
@@ -3080,8 +3080,7 @@ expand_builtin_pow (tree exp, rtx target
smaller than pow (x, 1.5) if sqrt will not be expanded
as a call. */
|| (n == 3
- && (optab_handler (sqrt_optab, mode)->insn_code
- != CODE_FOR_nothing))))
+ && OPTAB_HANDLER (sqrt_optab, mode) != CODE_FOR_nothing)))
{
tree call_expr = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 1,
narg0);
@@ -3272,7 +3271,7 @@ expand_builtin_strlen (tree exp, rtx tar
/* Bail out if we can't compute strlen in the right mode. */
while (insn_mode != VOIDmode)
{
- icode = optab_handler (strlen_optab, insn_mode)->insn_code;
+ icode = OPTAB_HANDLER (strlen_optab, insn_mode);
if (icode != CODE_FOR_nothing)
break;
@@ -5308,7 +5307,7 @@ expand_builtin_signbit (tree exp, rtx ta
/* Check if the back end provides an insn that handles signbit for the
argument's mode. */
- icode = signbit_optab->handlers [(int) fmode].insn_code;
+ icode = OPTAB_HANDLER (signbit_optab, fmode);
if (icode != CODE_FOR_nothing)
{
rtx last = get_last_insn ();
Index: gcc/expmed.c
===================================================================
--- gcc/expmed.c 2010-07-03 18:20:10.000000000 +0100
+++ gcc/expmed.c 2010-07-03 18:32:20.000000000 +0100
@@ -419,15 +419,14 @@ store_bit_field_1 (rtx str_rtx, unsigned
available. */
if (VECTOR_MODE_P (GET_MODE (op0))
&& !MEM_P (op0)
- && (optab_handler (vec_set_optab, GET_MODE (op0))->insn_code
- != CODE_FOR_nothing)
+ && OPTAB_HANDLER (vec_set_optab, GET_MODE (op0)) != CODE_FOR_nothing
&& fieldmode == GET_MODE_INNER (GET_MODE (op0))
&& bitsize == GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))
&& !(bitnum % GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))))
{
enum machine_mode outermode = GET_MODE (op0);
enum machine_mode innermode = GET_MODE_INNER (outermode);
- int icode = (int) optab_handler (vec_set_optab, outermode)->insn_code;
+ int icode = (int) OPTAB_HANDLER (vec_set_optab, outermode);
int pos = bitnum / GET_MODE_BITSIZE (innermode);
rtx rtxpos = GEN_INT (pos);
rtx src = value;
@@ -533,10 +532,9 @@ store_bit_field_1 (rtx str_rtx, unsigned
if (!MEM_P (op0)
&& (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0)
&& bitsize == GET_MODE_BITSIZE (fieldmode)
- && (optab_handler (movstrict_optab, fieldmode)->insn_code
- != CODE_FOR_nothing))
+ && OPTAB_HANDLER (movstrict_optab, fieldmode) != CODE_FOR_nothing)
{
- int icode = optab_handler (movstrict_optab, fieldmode)->insn_code;
+ int icode = OPTAB_HANDLER (movstrict_optab, fieldmode);
rtx insn;
rtx start = get_last_insn ();
rtx arg0 = op0;
@@ -1253,14 +1251,13 @@ extract_bit_field_1 (rtx str_rtx, unsign
available. */
if (VECTOR_MODE_P (GET_MODE (op0))
&& !MEM_P (op0)
- && (optab_handler (vec_extract_optab, GET_MODE (op0))->insn_code
- != CODE_FOR_nothing)
+ && OPTAB_HANDLER (vec_extract_optab, GET_MODE (op0)) != CODE_FOR_nothing
&& ((bitnum + bitsize - 1) / GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))
== bitnum / GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))))
{
enum machine_mode outermode = GET_MODE (op0);
enum machine_mode innermode = GET_MODE_INNER (outermode);
- int icode = (int) optab_handler (vec_extract_optab, outermode)->insn_code;
+ int icode = (int) OPTAB_HANDLER (vec_extract_optab, outermode);
unsigned HOST_WIDE_INT pos = bitnum / GET_MODE_BITSIZE (innermode);
rtx rtxpos = GEN_INT (pos);
rtx src = op0;
@@ -3567,7 +3564,7 @@ expand_mult_highpart_optab (enum machine
/* Try widening multiplication. */
moptab = unsignedp ? umul_widen_optab : smul_widen_optab;
- if (optab_handler (moptab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (OPTAB_HANDLER (moptab, wider_mode) != CODE_FOR_nothing
&& mul_widen_cost[speed][wider_mode] < max_cost)
{
tem = expand_binop (wider_mode, moptab, op0, narrow_op1, 0,
@@ -3577,7 +3574,7 @@ expand_mult_highpart_optab (enum machine
}
/* Try widening the mode and perform a non-widening multiplication. */
- if (optab_handler (smul_optab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (OPTAB_HANDLER (smul_optab, wider_mode) != CODE_FOR_nothing
&& size - 1 < BITS_PER_WORD
&& mul_cost[speed][wider_mode] + shift_cost[speed][mode][size-1] < max_cost)
{
@@ -3604,7 +3601,7 @@ expand_mult_highpart_optab (enum machine
/* Try widening multiplication of opposite signedness, and adjust. */
moptab = unsignedp ? smul_widen_optab : umul_widen_optab;
- if (optab_handler (moptab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (OPTAB_HANDLER (moptab, wider_mode) != CODE_FOR_nothing
&& size - 1 < BITS_PER_WORD
&& (mul_widen_cost[speed][wider_mode] + 2 * shift_cost[speed][mode][size-1]
+ 4 * add_cost[speed][mode] < max_cost))
@@ -3726,7 +3723,7 @@ expand_smod_pow2 (enum machine_mode mode
use a LSHIFTRT, 1 ADD, 1 SUB and an AND. */
temp = gen_rtx_LSHIFTRT (mode, result, shift);
- if (optab_handler (lshr_optab, mode)->insn_code == CODE_FOR_nothing
+ if (OPTAB_HANDLER (lshr_optab, mode) == CODE_FOR_nothing
|| rtx_cost (temp, SET, optimize_insn_for_speed_p ()) > COSTS_N_INSNS (2))
{
temp = expand_binop (mode, xor_optab, op0, signmask,
@@ -4030,8 +4027,8 @@ expand_divmod (int rem_flag, enum tree_c
for (compute_mode = mode; compute_mode != VOIDmode;
compute_mode = GET_MODE_WIDER_MODE (compute_mode))
- if (optab_handler (optab1, compute_mode)->insn_code != CODE_FOR_nothing
- || optab_handler (optab2, compute_mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (optab1, compute_mode) != CODE_FOR_nothing
+ || OPTAB_HANDLER (optab2, compute_mode) != CODE_FOR_nothing)
break;
if (compute_mode == VOIDmode)
@@ -4284,13 +4281,13 @@ expand_divmod (int rem_flag, enum tree_c
: sdiv_pow2_cheap[speed][compute_mode])
/* We assume that cheap metric is true if the
optab has an expander for this mode. */
- && ((optab_handler ((rem_flag ? smod_optab
+ && ((OPTAB_HANDLER ((rem_flag ? smod_optab
: sdiv_optab),
- compute_mode)->insn_code
+ compute_mode)
!= CODE_FOR_nothing)
- || (optab_handler(sdivmod_optab,
- compute_mode)
- ->insn_code != CODE_FOR_nothing)))
+ || (OPTAB_HANDLER (sdivmod_optab,
+ compute_mode)
+ != CODE_FOR_nothing)))
;
else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d))
{
@@ -4302,9 +4299,9 @@ expand_divmod (int rem_flag, enum tree_c
}
if (sdiv_pow2_cheap[speed][compute_mode]
- && ((optab_handler (sdiv_optab, compute_mode)->insn_code
+ && ((OPTAB_HANDLER (sdiv_optab, compute_mode)
!= CODE_FOR_nothing)
- || (optab_handler (sdivmod_optab, compute_mode)->insn_code
+ || (OPTAB_HANDLER (sdivmod_optab, compute_mode)
!= CODE_FOR_nothing)))
quotient = expand_divmod (0, TRUNC_DIV_EXPR,
compute_mode, op0,
@@ -4952,7 +4949,7 @@ expand_divmod (int rem_flag, enum tree_c
= sign_expand_binop (compute_mode, umod_optab, smod_optab,
op0, op1, target,
unsignedp,
- ((optab_handler (optab2, compute_mode)->insn_code
+ ((OPTAB_HANDLER (optab2, compute_mode)
!= CODE_FOR_nothing)
? OPTAB_DIRECT : OPTAB_WIDEN));
if (remainder == 0)
@@ -4980,7 +4977,7 @@ expand_divmod (int rem_flag, enum tree_c
= sign_expand_binop (compute_mode, udiv_optab, sdiv_optab,
op0, op1, rem_flag ? NULL_RTX : target,
unsignedp,
- ((optab_handler (optab2, compute_mode)->insn_code
+ ((OPTAB_HANDLER (optab2, compute_mode)
!= CODE_FOR_nothing)
? OPTAB_DIRECT : OPTAB_WIDEN));
@@ -5479,7 +5476,7 @@ emit_store_flag_1 (rtx target, enum rtx_
compare_mode = GET_MODE_WIDER_MODE (compare_mode))
{
enum machine_mode optab_mode = mclass == MODE_CC ? CCmode : compare_mode;
- icode = optab_handler (cstore_optab, optab_mode)->insn_code;
+ icode = OPTAB_HANDLER (cstore_optab, optab_mode);
if (icode != CODE_FOR_nothing)
{
do_pending_stack_adjust ();
@@ -5674,7 +5671,7 @@ emit_store_flag (rtx target, enum rtx_co
as "-(int)X >> 31" is still cheaper than inverting "(int)X == 0". */
rcode = reverse_condition (code);
if (can_compare_p (rcode, mode, ccp_store_flag)
- && ! (optab_handler (cstore_optab, mode)->insn_code == CODE_FOR_nothing
+ && ! (OPTAB_HANDLER (cstore_optab, mode) == CODE_FOR_nothing
&& code == NE
&& GET_MODE_SIZE (mode) < UNITS_PER_WORD
&& op1 == const0_rtx))
@@ -5773,9 +5770,9 @@ emit_store_flag (rtx target, enum rtx_co
that is compensated by the subsequent overflow when subtracting
one / negating. */
- if (optab_handler (abs_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (abs_optab, mode) != CODE_FOR_nothing)
tem = expand_unop (mode, abs_optab, op0, subtarget, 1);
- else if (optab_handler (ffs_optab, mode)->insn_code != CODE_FOR_nothing)
+ else if (OPTAB_HANDLER (ffs_optab, mode) != CODE_FOR_nothing)
tem = expand_unop (mode, ffs_optab, op0, subtarget, 1);
else if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
{
Index: gcc/expr.c
===================================================================
--- gcc/expr.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/expr.c 2010-07-03 18:32:20.000000000 +0100
@@ -434,7 +434,7 @@ convert_move (rtx to, rtx from, int unsi
/* Try converting directly if the insn is supported. */
- code = convert_optab_handler (tab, to_mode, from_mode)->insn_code;
+ code = CONVERT_OPTAB_HANDLER (tab, to_mode, from_mode);
if (code != CODE_FOR_nothing)
{
emit_unop_insn (code, to, from,
@@ -468,12 +468,12 @@ convert_move (rtx to, rtx from, int unsi
enum machine_mode full_mode
= smallest_mode_for_size (GET_MODE_BITSIZE (to_mode), MODE_INT);
- gcc_assert (convert_optab_handler (trunc_optab, to_mode, full_mode)->insn_code
+ gcc_assert (CONVERT_OPTAB_HANDLER (trunc_optab, to_mode, full_mode)
!= CODE_FOR_nothing);
if (full_mode != from_mode)
from = convert_to_mode (full_mode, from, unsignedp);
- emit_unop_insn (convert_optab_handler (trunc_optab, to_mode, full_mode)->insn_code,
+ emit_unop_insn (CONVERT_OPTAB_HANDLER (trunc_optab, to_mode, full_mode),
to, from, UNKNOWN);
return;
}
@@ -483,18 +483,19 @@ convert_move (rtx to, rtx from, int unsi
enum machine_mode full_mode
= smallest_mode_for_size (GET_MODE_BITSIZE (from_mode), MODE_INT);
- gcc_assert (convert_optab_handler (sext_optab, full_mode, from_mode)->insn_code
+ gcc_assert (CONVERT_OPTAB_HANDLER (sext_optab, full_mode, from_mode)
!= CODE_FOR_nothing);
if (to_mode == full_mode)
{
- emit_unop_insn (convert_optab_handler (sext_optab, full_mode, from_mode)->insn_code,
+ emit_unop_insn (CONVERT_OPTAB_HANDLER (sext_optab, full_mode,
+ from_mode),
to, from, UNKNOWN);
return;
}
new_from = gen_reg_rtx (full_mode);
- emit_unop_insn (convert_optab_handler (sext_optab, full_mode, from_mode)->insn_code,
+ emit_unop_insn (CONVERT_OPTAB_HANDLER (sext_optab, full_mode, from_mode),
new_from, from, UNKNOWN);
/* else proceed to integer conversions below. */
@@ -695,9 +696,10 @@ convert_move (rtx to, rtx from, int unsi
}
/* Support special truncate insns for certain modes. */
- if (convert_optab_handler (trunc_optab, to_mode, from_mode)->insn_code != CODE_FOR_nothing)
+ if (CONVERT_OPTAB_HANDLER (trunc_optab, to_mode,
+ from_mode) != CODE_FOR_nothing)
{
- emit_unop_insn (convert_optab_handler (trunc_optab, to_mode, from_mode)->insn_code,
+ emit_unop_insn (CONVERT_OPTAB_HANDLER (trunc_optab, to_mode, from_mode),
to, from, UNKNOWN);
return;
}
@@ -990,7 +992,7 @@ move_by_pieces (rtx to, rtx from, unsign
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (mov_optab, mode);
if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode))
move_by_pieces_1 (GEN_FCN (icode), mode, &data);
@@ -1071,7 +1073,7 @@ move_by_pieces_ninsns (unsigned HOST_WID
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (mov_optab, mode);
if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode))
n_insns += l / GET_MODE_SIZE (mode), l %= GET_MODE_SIZE (mode);
@@ -2352,7 +2354,7 @@ can_store_by_pieces (unsigned HOST_WIDE_
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (mov_optab, mode);
if (icode != CODE_FOR_nothing
&& align >= GET_MODE_ALIGNMENT (mode))
{
@@ -2565,7 +2567,7 @@ store_by_pieces_1 (struct store_by_piece
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (mov_optab, mode);
if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode))
store_by_pieces_2 (GEN_FCN (icode), mode, data);
@@ -3034,7 +3036,7 @@ emit_move_via_integer (enum machine_mode
return NULL_RTX;
/* The target must support moves in this mode. */
- code = optab_handler (mov_optab, imode)->insn_code;
+ code = OPTAB_HANDLER (mov_optab, imode);
if (code == CODE_FOR_nothing)
return NULL_RTX;
@@ -3184,7 +3186,7 @@ emit_move_complex (enum machine_mode mod
/* Move floating point as parts. */
if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
- && optab_handler (mov_optab, GET_MODE_INNER (mode))->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (mov_optab, GET_MODE_INNER (mode)) != CODE_FOR_nothing)
try_int = false;
/* Not possible if the values are inherently not adjacent. */
else if (GET_CODE (x) == CONCAT || GET_CODE (y) == CONCAT)
@@ -3235,7 +3237,7 @@ emit_move_ccmode (enum machine_mode mode
/* Assume all MODE_CC modes are equivalent; if we have movcc, use it. */
if (mode != CCmode)
{
- enum insn_code code = optab_handler (mov_optab, CCmode)->insn_code;
+ enum insn_code code = OPTAB_HANDLER (mov_optab, CCmode);
if (code != CODE_FOR_nothing)
{
x = emit_move_change_mode (CCmode, mode, x, true);
@@ -3375,7 +3377,7 @@ emit_move_insn_1 (rtx x, rtx y)
gcc_assert ((unsigned int) mode < (unsigned int) MAX_MACHINE_MODE);
- code = optab_handler (mov_optab, mode)->insn_code;
+ code = OPTAB_HANDLER (mov_optab, mode);
if (code != CODE_FOR_nothing)
return emit_insn (GEN_FCN (code) (x, y));
@@ -3627,7 +3629,7 @@ emit_single_push_insn (enum machine_mode
stack_pointer_delta += PUSH_ROUNDING (GET_MODE_SIZE (mode));
/* If there is push pattern, use it. Otherwise try old way of throwing
MEM representing push operation to move expander. */
- icode = optab_handler (push_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (push_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (((pred = insn_data[(int) icode].operand[0].predicate)
@@ -4363,7 +4365,7 @@ expand_assignment (tree to, tree from, b
set_mem_attributes (mem, to, 0);
set_mem_addr_space (mem, as);
- icode = movmisalign_optab->handlers[mode].insn_code;
+ icode = OPTAB_HANDLER (movmisalign_optab, mode);
gcc_assert (icode != CODE_FOR_nothing);
op_mode1 = insn_data[icode].operand[1].mode;
@@ -4496,7 +4498,7 @@ expand_assignment (tree to, tree from, b
emit_storent_insn (rtx to, rtx from)
{
enum machine_mode mode = GET_MODE (to), imode;
- enum insn_code code = optab_handler (storent_optab, mode)->insn_code;
+ enum insn_code code = OPTAB_HANDLER (storent_optab, mode);
rtx pattern;
if (code == CODE_FOR_nothing)
@@ -5703,7 +5705,7 @@ store_constructor (tree exp, rtx target,
{
enum machine_mode mode = GET_MODE (target);
- icode = (int) optab_handler (vec_init_optab, mode)->insn_code;
+ icode = (int) OPTAB_HANDLER (vec_init_optab, mode);
if (icode != CODE_FOR_nothing)
{
unsigned int i;
@@ -7704,7 +7706,7 @@ #define REDUCE_BIT_FIELD(expr) (reduce_b
this_optab = usmul_widen_optab;
if (mode == GET_MODE_2XWIDER_MODE (innermode))
{
- if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (this_optab, mode) != CODE_FOR_nothing)
{
if (TYPE_UNSIGNED (TREE_TYPE (treeop0)))
expand_operands (treeop0, treeop1, subtarget, &op0, &op1,
@@ -7730,7 +7732,7 @@ #define REDUCE_BIT_FIELD(expr) (reduce_b
if (mode == GET_MODE_2XWIDER_MODE (innermode))
{
- if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (this_optab, mode) != CODE_FOR_nothing)
{
expand_operands (treeop0, treeop1, NULL_RTX, &op0, &op1,
EXPAND_NORMAL);
@@ -7738,7 +7740,7 @@ #define REDUCE_BIT_FIELD(expr) (reduce_b
unsignedp, this_optab);
return REDUCE_BIT_FIELD (temp);
}
- if (optab_handler (other_optab, mode)->insn_code != CODE_FOR_nothing
+ if (OPTAB_HANDLER (other_optab, mode) != CODE_FOR_nothing
&& innermode == word_mode)
{
rtx htem, hipart;
@@ -8727,7 +8729,7 @@ expand_expr_real_1 (tree exp, rtx target
|| modifier == EXPAND_STACK_PARM);
/* The vectorizer should have already checked the mode. */
- icode = optab_handler (movmisalign_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (movmisalign_optab, mode);
gcc_assert (icode != CODE_FOR_nothing);
/* We've already validated the memory, and we're creating a
Index: gcc/genopinit.c
===================================================================
--- gcc/genopinit.c 2010-07-03 18:20:10.000000000 +0100
+++ gcc/genopinit.c 2010-07-03 18:32:20.000000000 +0100
@@ -60,152 +60,152 @@ Software Foundation; either version 3, o
upper-case forms of the comparison, respectively. */
static const char * const optabs[] =
-{ "convert_optab_handler (sext_optab, $B, $A)->insn_code = CODE_FOR_$(extend$a$b2$)",
- "convert_optab_handler (zext_optab, $B, $A)->insn_code = CODE_FOR_$(zero_extend$a$b2$)",
- "convert_optab_handler (sfix_optab, $B, $A)->insn_code = CODE_FOR_$(fix$F$a$I$b2$)",
- "convert_optab_handler (ufix_optab, $B, $A)->insn_code = CODE_FOR_$(fixuns$F$a$b2$)",
- "convert_optab_handler (sfixtrunc_optab, $B, $A)->insn_code = CODE_FOR_$(fix_trunc$F$a$I$b2$)",
- "convert_optab_handler (ufixtrunc_optab, $B, $A)->insn_code = CODE_FOR_$(fixuns_trunc$F$a$I$b2$)",
- "convert_optab_handler (sfloat_optab, $B, $A)->insn_code = CODE_FOR_$(float$I$a$F$b2$)",
- "convert_optab_handler (ufloat_optab, $B, $A)->insn_code = CODE_FOR_$(floatuns$I$a$F$b2$)",
- "convert_optab_handler (trunc_optab, $B, $A)->insn_code = CODE_FOR_$(trunc$a$b2$)",
- "convert_optab_handler (fract_optab, $B, $A)->insn_code = CODE_FOR_$(fract$a$b2$)",
- "convert_optab_handler (fractuns_optab, $B, $A)->insn_code = CODE_FOR_$(fractuns$I$a$Q$b2$)",
- "convert_optab_handler (fractuns_optab, $B, $A)->insn_code = CODE_FOR_$(fractuns$Q$a$I$b2$)",
- "convert_optab_handler (satfract_optab, $B, $A)->insn_code = CODE_FOR_$(satfract$a$Q$b2$)",
- "convert_optab_handler (satfractuns_optab, $B, $A)->insn_code = CODE_FOR_$(satfractuns$I$a$Q$b2$)",
- "optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$P$a3$)",
- "optab_handler (addv_optab, $A)->insn_code =\n\
- optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$F$a3$)",
- "optab_handler (addv_optab, $A)->insn_code = CODE_FOR_$(addv$I$a3$)",
- "optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$Q$a3$)",
- "optab_handler (ssadd_optab, $A)->insn_code = CODE_FOR_$(ssadd$Q$a3$)",
- "optab_handler (usadd_optab, $A)->insn_code = CODE_FOR_$(usadd$Q$a3$)",
- "optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$P$a3$)",
- "optab_handler (subv_optab, $A)->insn_code =\n\
- optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$F$a3$)",
- "optab_handler (subv_optab, $A)->insn_code = CODE_FOR_$(subv$I$a3$)",
- "optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$Q$a3$)",
- "optab_handler (sssub_optab, $A)->insn_code = CODE_FOR_$(sssub$Q$a3$)",
- "optab_handler (ussub_optab, $A)->insn_code = CODE_FOR_$(ussub$Q$a3$)",
- "optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$Q$a3$)",
- "optab_handler (ssmul_optab, $A)->insn_code = CODE_FOR_$(ssmul$Q$a3$)",
- "optab_handler (usmul_optab, $A)->insn_code = CODE_FOR_$(usmul$Q$a3$)",
- "optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$P$a3$)",
- "optab_handler (smulv_optab, $A)->insn_code =\n\
- optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$F$a3$)",
- "optab_handler (smulv_optab, $A)->insn_code = CODE_FOR_$(mulv$I$a3$)",
- "optab_handler (umul_highpart_optab, $A)->insn_code = CODE_FOR_$(umul$a3_highpart$)",
- "optab_handler (smul_highpart_optab, $A)->insn_code = CODE_FOR_$(smul$a3_highpart$)",
- "optab_handler (smul_widen_optab, $B)->insn_code = CODE_FOR_$(mul$a$b3$)$N",
- "optab_handler (umul_widen_optab, $B)->insn_code = CODE_FOR_$(umul$a$b3$)$N",
- "optab_handler (usmul_widen_optab, $B)->insn_code = CODE_FOR_$(usmul$a$b3$)$N",
- "optab_handler (smadd_widen_optab, $B)->insn_code = CODE_FOR_$(madd$a$b4$)$N",
- "optab_handler (umadd_widen_optab, $B)->insn_code = CODE_FOR_$(umadd$a$b4$)$N",
- "optab_handler (ssmadd_widen_optab, $B)->insn_code = CODE_FOR_$(ssmadd$a$b4$)$N",
- "optab_handler (usmadd_widen_optab, $B)->insn_code = CODE_FOR_$(usmadd$a$b4$)$N",
- "optab_handler (smsub_widen_optab, $B)->insn_code = CODE_FOR_$(msub$a$b4$)$N",
- "optab_handler (umsub_widen_optab, $B)->insn_code = CODE_FOR_$(umsub$a$b4$)$N",
- "optab_handler (ssmsub_widen_optab, $B)->insn_code = CODE_FOR_$(ssmsub$a$b4$)$N",
- "optab_handler (usmsub_widen_optab, $B)->insn_code = CODE_FOR_$(usmsub$a$b4$)$N",
- "optab_handler (sdiv_optab, $A)->insn_code = CODE_FOR_$(div$a3$)",
- "optab_handler (ssdiv_optab, $A)->insn_code = CODE_FOR_$(ssdiv$Q$a3$)",
- "optab_handler (sdivv_optab, $A)->insn_code = CODE_FOR_$(div$V$I$a3$)",
- "optab_handler (udiv_optab, $A)->insn_code = CODE_FOR_$(udiv$I$a3$)",
- "optab_handler (udiv_optab, $A)->insn_code = CODE_FOR_$(udiv$Q$a3$)",
- "optab_handler (usdiv_optab, $A)->insn_code = CODE_FOR_$(usdiv$Q$a3$)",
- "optab_handler (sdivmod_optab, $A)->insn_code = CODE_FOR_$(divmod$a4$)",
- "optab_handler (udivmod_optab, $A)->insn_code = CODE_FOR_$(udivmod$a4$)",
- "optab_handler (smod_optab, $A)->insn_code = CODE_FOR_$(mod$a3$)",
- "optab_handler (umod_optab, $A)->insn_code = CODE_FOR_$(umod$a3$)",
- "optab_handler (fmod_optab, $A)->insn_code = CODE_FOR_$(fmod$a3$)",
- "optab_handler (remainder_optab, $A)->insn_code = CODE_FOR_$(remainder$a3$)",
- "optab_handler (ftrunc_optab, $A)->insn_code = CODE_FOR_$(ftrunc$F$a2$)",
- "optab_handler (and_optab, $A)->insn_code = CODE_FOR_$(and$a3$)",
- "optab_handler (ior_optab, $A)->insn_code = CODE_FOR_$(ior$a3$)",
- "optab_handler (xor_optab, $A)->insn_code = CODE_FOR_$(xor$a3$)",
- "optab_handler (ashl_optab, $A)->insn_code = CODE_FOR_$(ashl$a3$)",
- "optab_handler (ssashl_optab, $A)->insn_code = CODE_FOR_$(ssashl$Q$a3$)",
- "optab_handler (usashl_optab, $A)->insn_code = CODE_FOR_$(usashl$Q$a3$)",
- "optab_handler (ashr_optab, $A)->insn_code = CODE_FOR_$(ashr$a3$)",
- "optab_handler (lshr_optab, $A)->insn_code = CODE_FOR_$(lshr$a3$)",
- "optab_handler (rotl_optab, $A)->insn_code = CODE_FOR_$(rotl$a3$)",
- "optab_handler (rotr_optab, $A)->insn_code = CODE_FOR_$(rotr$a3$)",
- "optab_handler (vashr_optab, $A)->insn_code = CODE_FOR_$(vashr$a3$)",
- "optab_handler (vlshr_optab, $A)->insn_code = CODE_FOR_$(vlshr$a3$)",
- "optab_handler (vashl_optab, $A)->insn_code = CODE_FOR_$(vashl$a3$)",
- "optab_handler (vrotl_optab, $A)->insn_code = CODE_FOR_$(vrotl$a3$)",
- "optab_handler (vrotr_optab, $A)->insn_code = CODE_FOR_$(vrotr$a3$)",
- "optab_handler (smin_optab, $A)->insn_code = CODE_FOR_$(smin$a3$)",
- "optab_handler (smax_optab, $A)->insn_code = CODE_FOR_$(smax$a3$)",
- "optab_handler (umin_optab, $A)->insn_code = CODE_FOR_$(umin$I$a3$)",
- "optab_handler (umax_optab, $A)->insn_code = CODE_FOR_$(umax$I$a3$)",
- "optab_handler (pow_optab, $A)->insn_code = CODE_FOR_$(pow$a3$)",
- "optab_handler (atan2_optab, $A)->insn_code = CODE_FOR_$(atan2$a3$)",
- "optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$P$a2$)",
- "optab_handler (negv_optab, $A)->insn_code =\n\
- optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$F$a2$)",
- "optab_handler (negv_optab, $A)->insn_code = CODE_FOR_$(negv$I$a2$)",
- "optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$Q$a2$)",
- "optab_handler (ssneg_optab, $A)->insn_code = CODE_FOR_$(ssneg$Q$a2$)",
- "optab_handler (usneg_optab, $A)->insn_code = CODE_FOR_$(usneg$Q$a2$)",
- "optab_handler (abs_optab, $A)->insn_code = CODE_FOR_$(abs$P$a2$)",
- "optab_handler (absv_optab, $A)->insn_code =\n\
- optab_handler (abs_optab, $A)->insn_code = CODE_FOR_$(abs$F$a2$)",
- "optab_handler (absv_optab, $A)->insn_code = CODE_FOR_$(absv$I$a2$)",
- "optab_handler (copysign_optab, $A)->insn_code = CODE_FOR_$(copysign$F$a3$)",
- "optab_handler (signbit_optab, $A)->insn_code = CODE_FOR_$(signbit$F$a2$)",
- "optab_handler (isinf_optab, $A)->insn_code = CODE_FOR_$(isinf$a2$)",
- "optab_handler (sqrt_optab, $A)->insn_code = CODE_FOR_$(sqrt$a2$)",
- "optab_handler (floor_optab, $A)->insn_code = CODE_FOR_$(floor$a2$)",
- "convert_optab_handler (lfloor_optab, $B, $A)->insn_code = CODE_FOR_$(lfloor$F$a$I$b2$)",
- "optab_handler (ceil_optab, $A)->insn_code = CODE_FOR_$(ceil$a2$)",
- "convert_optab_handler (lceil_optab, $B, $A)->insn_code = CODE_FOR_$(lceil$F$a$I$b2$)",
- "optab_handler (round_optab, $A)->insn_code = CODE_FOR_$(round$a2$)",
- "optab_handler (btrunc_optab, $A)->insn_code = CODE_FOR_$(btrunc$a2$)",
- "optab_handler (nearbyint_optab, $A)->insn_code = CODE_FOR_$(nearbyint$a2$)",
- "optab_handler (rint_optab, $A)->insn_code = CODE_FOR_$(rint$a2$)",
- "convert_optab_handler (lrint_optab, $B, $A)->insn_code = CODE_FOR_$(lrint$F$a$I$b2$)",
- "convert_optab_handler (lround_optab, $B, $A)->insn_code = CODE_FOR_$(lround$F$a$I$b2$)",
- "optab_handler (sincos_optab, $A)->insn_code = CODE_FOR_$(sincos$a3$)",
- "optab_handler (sin_optab, $A)->insn_code = CODE_FOR_$(sin$a2$)",
- "optab_handler (asin_optab, $A)->insn_code = CODE_FOR_$(asin$a2$)",
- "optab_handler (cos_optab, $A)->insn_code = CODE_FOR_$(cos$a2$)",
- "optab_handler (acos_optab, $A)->insn_code = CODE_FOR_$(acos$a2$)",
- "optab_handler (exp_optab, $A)->insn_code = CODE_FOR_$(exp$a2$)",
- "optab_handler (exp10_optab, $A)->insn_code = CODE_FOR_$(exp10$a2$)",
- "optab_handler (exp2_optab, $A)->insn_code = CODE_FOR_$(exp2$a2$)",
- "optab_handler (expm1_optab, $A)->insn_code = CODE_FOR_$(expm1$a2$)",
- "optab_handler (ldexp_optab, $A)->insn_code = CODE_FOR_$(ldexp$a3$)",
- "optab_handler (scalb_optab, $A)->insn_code = CODE_FOR_$(scalb$a3$)",
- "optab_handler (significand_optab, $A)->insn_code = CODE_FOR_$(significand$a2$)",
- "optab_handler (logb_optab, $A)->insn_code = CODE_FOR_$(logb$a2$)",
- "optab_handler (ilogb_optab, $A)->insn_code = CODE_FOR_$(ilogb$a2$)",
- "optab_handler (log_optab, $A)->insn_code = CODE_FOR_$(log$a2$)",
- "optab_handler (log10_optab, $A)->insn_code = CODE_FOR_$(log10$a2$)",
- "optab_handler (log2_optab, $A)->insn_code = CODE_FOR_$(log2$a2$)",
- "optab_handler (log1p_optab, $A)->insn_code = CODE_FOR_$(log1p$a2$)",
- "optab_handler (tan_optab, $A)->insn_code = CODE_FOR_$(tan$a2$)",
- "optab_handler (atan_optab, $A)->insn_code = CODE_FOR_$(atan$a2$)",
- "optab_handler (strlen_optab, $A)->insn_code = CODE_FOR_$(strlen$a$)",
- "optab_handler (one_cmpl_optab, $A)->insn_code = CODE_FOR_$(one_cmpl$a2$)",
- "optab_handler (bswap_optab, $A)->insn_code = CODE_FOR_$(bswap$a2$)",
- "optab_handler (ffs_optab, $A)->insn_code = CODE_FOR_$(ffs$a2$)",
- "optab_handler (clz_optab, $A)->insn_code = CODE_FOR_$(clz$a2$)",
- "optab_handler (ctz_optab, $A)->insn_code = CODE_FOR_$(ctz$a2$)",
- "optab_handler (popcount_optab, $A)->insn_code = CODE_FOR_$(popcount$a2$)",
- "optab_handler (parity_optab, $A)->insn_code = CODE_FOR_$(parity$a2$)",
- "optab_handler (mov_optab, $A)->insn_code = CODE_FOR_$(mov$a$)",
- "optab_handler (movstrict_optab, $A)->insn_code = CODE_FOR_$(movstrict$a$)",
- "optab_handler (movmisalign_optab, $A)->insn_code = CODE_FOR_$(movmisalign$a$)",
- "optab_handler (storent_optab, $A)->insn_code = CODE_FOR_$(storent$a$)",
- "optab_handler (addcc_optab, $A)->insn_code = CODE_FOR_$(add$acc$)",
+{ "SET_CONVERT_OPTAB_HANDLER (sext_optab, $B, $A, CODE_FOR_$(extend$a$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (zext_optab, $B, $A, CODE_FOR_$(zero_extend$a$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (sfix_optab, $B, $A, CODE_FOR_$(fix$F$a$I$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (ufix_optab, $B, $A, CODE_FOR_$(fixuns$F$a$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (sfixtrunc_optab, $B, $A, CODE_FOR_$(fix_trunc$F$a$I$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (ufixtrunc_optab, $B, $A, CODE_FOR_$(fixuns_trunc$F$a$I$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (sfloat_optab, $B, $A, CODE_FOR_$(float$I$a$F$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (ufloat_optab, $B, $A, CODE_FOR_$(floatuns$I$a$F$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (trunc_optab, $B, $A, CODE_FOR_$(trunc$a$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (fract_optab, $B, $A, CODE_FOR_$(fract$a$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (fractuns_optab, $B, $A, CODE_FOR_$(fractuns$I$a$Q$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (fractuns_optab, $B, $A, CODE_FOR_$(fractuns$Q$a$I$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (satfract_optab, $B, $A, CODE_FOR_$(satfract$a$Q$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (satfractuns_optab, $B, $A, CODE_FOR_$(satfractuns$I$a$Q$b2$))",
+ "SET_OPTAB_HANDLER (add_optab, $A, CODE_FOR_$(add$P$a3$))",
+ "SET_OPTAB_HANDLER (addv_optab, $A, CODE_FOR_$(add$F$a3$)),\n\
+ SET_OPTAB_HANDLER (add_optab, $A, CODE_FOR_$(add$F$a3$))",
+ "SET_OPTAB_HANDLER (addv_optab, $A, CODE_FOR_$(addv$I$a3$))",
+ "SET_OPTAB_HANDLER (add_optab, $A, CODE_FOR_$(add$Q$a3$))",
+ "SET_OPTAB_HANDLER (ssadd_optab, $A, CODE_FOR_$(ssadd$Q$a3$))",
+ "SET_OPTAB_HANDLER (usadd_optab, $A, CODE_FOR_$(usadd$Q$a3$))",
+ "SET_OPTAB_HANDLER (sub_optab, $A, CODE_FOR_$(sub$P$a3$))",
+ "SET_OPTAB_HANDLER (subv_optab, $A, CODE_FOR_$(sub$F$a3$)),\n\
+ SET_OPTAB_HANDLER (sub_optab, $A, CODE_FOR_$(sub$F$a3$))",
+ "SET_OPTAB_HANDLER (subv_optab, $A, CODE_FOR_$(subv$I$a3$))",
+ "SET_OPTAB_HANDLER (sub_optab, $A, CODE_FOR_$(sub$Q$a3$))",
+ "SET_OPTAB_HANDLER (sssub_optab, $A, CODE_FOR_$(sssub$Q$a3$))",
+ "SET_OPTAB_HANDLER (ussub_optab, $A, CODE_FOR_$(ussub$Q$a3$))",
+ "SET_OPTAB_HANDLER (smul_optab, $A, CODE_FOR_$(mul$Q$a3$))",
+ "SET_OPTAB_HANDLER (ssmul_optab, $A, CODE_FOR_$(ssmul$Q$a3$))",
+ "SET_OPTAB_HANDLER (usmul_optab, $A, CODE_FOR_$(usmul$Q$a3$))",
+ "SET_OPTAB_HANDLER (smul_optab, $A, CODE_FOR_$(mul$P$a3$))",
+ "SET_OPTAB_HANDLER (smulv_optab, $A, CODE_FOR_$(mul$F$a3$)),\n\
+ SET_OPTAB_HANDLER (smul_optab, $A, CODE_FOR_$(mul$F$a3$))",
+ "SET_OPTAB_HANDLER (smulv_optab, $A, CODE_FOR_$(mulv$I$a3$))",
+ "SET_OPTAB_HANDLER (umul_highpart_optab, $A, CODE_FOR_$(umul$a3_highpart$))",
+ "SET_OPTAB_HANDLER (smul_highpart_optab, $A, CODE_FOR_$(smul$a3_highpart$))",
+ "SET_OPTAB_HANDLER (smul_widen_optab, $B, CODE_FOR_$(mul$a$b3$)$N)",
+ "SET_OPTAB_HANDLER (umul_widen_optab, $B, CODE_FOR_$(umul$a$b3$)$N)",
+ "SET_OPTAB_HANDLER (usmul_widen_optab, $B, CODE_FOR_$(usmul$a$b3$)$N)",
+ "SET_OPTAB_HANDLER (smadd_widen_optab, $B, CODE_FOR_$(madd$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (umadd_widen_optab, $B, CODE_FOR_$(umadd$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (ssmadd_widen_optab, $B, CODE_FOR_$(ssmadd$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (usmadd_widen_optab, $B, CODE_FOR_$(usmadd$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (smsub_widen_optab, $B, CODE_FOR_$(msub$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (umsub_widen_optab, $B, CODE_FOR_$(umsub$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (ssmsub_widen_optab, $B, CODE_FOR_$(ssmsub$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (usmsub_widen_optab, $B, CODE_FOR_$(usmsub$a$b4$)$N)",
+ "SET_OPTAB_HANDLER (sdiv_optab, $A, CODE_FOR_$(div$a3$))",
+ "SET_OPTAB_HANDLER (ssdiv_optab, $A, CODE_FOR_$(ssdiv$Q$a3$))",
+ "SET_OPTAB_HANDLER (sdivv_optab, $A, CODE_FOR_$(div$V$I$a3$))",
+ "SET_OPTAB_HANDLER (udiv_optab, $A, CODE_FOR_$(udiv$I$a3$))",
+ "SET_OPTAB_HANDLER (udiv_optab, $A, CODE_FOR_$(udiv$Q$a3$))",
+ "SET_OPTAB_HANDLER (usdiv_optab, $A, CODE_FOR_$(usdiv$Q$a3$))",
+ "SET_OPTAB_HANDLER (sdivmod_optab, $A, CODE_FOR_$(divmod$a4$))",
+ "SET_OPTAB_HANDLER (udivmod_optab, $A, CODE_FOR_$(udivmod$a4$))",
+ "SET_OPTAB_HANDLER (smod_optab, $A, CODE_FOR_$(mod$a3$))",
+ "SET_OPTAB_HANDLER (umod_optab, $A, CODE_FOR_$(umod$a3$))",
+ "SET_OPTAB_HANDLER (fmod_optab, $A, CODE_FOR_$(fmod$a3$))",
+ "SET_OPTAB_HANDLER (remainder_optab, $A, CODE_FOR_$(remainder$a3$))",
+ "SET_OPTAB_HANDLER (ftrunc_optab, $A, CODE_FOR_$(ftrunc$F$a2$))",
+ "SET_OPTAB_HANDLER (and_optab, $A, CODE_FOR_$(and$a3$))",
+ "SET_OPTAB_HANDLER (ior_optab, $A, CODE_FOR_$(ior$a3$))",
+ "SET_OPTAB_HANDLER (xor_optab, $A, CODE_FOR_$(xor$a3$))",
+ "SET_OPTAB_HANDLER (ashl_optab, $A, CODE_FOR_$(ashl$a3$))",
+ "SET_OPTAB_HANDLER (ssashl_optab, $A, CODE_FOR_$(ssashl$Q$a3$))",
+ "SET_OPTAB_HANDLER (usashl_optab, $A, CODE_FOR_$(usashl$Q$a3$))",
+ "SET_OPTAB_HANDLER (ashr_optab, $A, CODE_FOR_$(ashr$a3$))",
+ "SET_OPTAB_HANDLER (lshr_optab, $A, CODE_FOR_$(lshr$a3$))",
+ "SET_OPTAB_HANDLER (rotl_optab, $A, CODE_FOR_$(rotl$a3$))",
+ "SET_OPTAB_HANDLER (rotr_optab, $A, CODE_FOR_$(rotr$a3$))",
+ "SET_OPTAB_HANDLER (vashr_optab, $A, CODE_FOR_$(vashr$a3$))",
+ "SET_OPTAB_HANDLER (vlshr_optab, $A, CODE_FOR_$(vlshr$a3$))",
+ "SET_OPTAB_HANDLER (vashl_optab, $A, CODE_FOR_$(vashl$a3$))",
+ "SET_OPTAB_HANDLER (vrotl_optab, $A, CODE_FOR_$(vrotl$a3$))",
+ "SET_OPTAB_HANDLER (vrotr_optab, $A, CODE_FOR_$(vrotr$a3$))",
+ "SET_OPTAB_HANDLER (smin_optab, $A, CODE_FOR_$(smin$a3$))",
+ "SET_OPTAB_HANDLER (smax_optab, $A, CODE_FOR_$(smax$a3$))",
+ "SET_OPTAB_HANDLER (umin_optab, $A, CODE_FOR_$(umin$I$a3$))",
+ "SET_OPTAB_HANDLER (umax_optab, $A, CODE_FOR_$(umax$I$a3$))",
+ "SET_OPTAB_HANDLER (pow_optab, $A, CODE_FOR_$(pow$a3$))",
+ "SET_OPTAB_HANDLER (atan2_optab, $A, CODE_FOR_$(atan2$a3$))",
+ "SET_OPTAB_HANDLER (neg_optab, $A, CODE_FOR_$(neg$P$a2$))",
+ "SET_OPTAB_HANDLER (negv_optab, $A, CODE_FOR_$(neg$F$a2$)),\n\
+ SET_OPTAB_HANDLER (neg_optab, $A, CODE_FOR_$(neg$F$a2$))",
+ "SET_OPTAB_HANDLER (negv_optab, $A, CODE_FOR_$(negv$I$a2$))",
+ "SET_OPTAB_HANDLER (neg_optab, $A, CODE_FOR_$(neg$Q$a2$))",
+ "SET_OPTAB_HANDLER (ssneg_optab, $A, CODE_FOR_$(ssneg$Q$a2$))",
+ "SET_OPTAB_HANDLER (usneg_optab, $A, CODE_FOR_$(usneg$Q$a2$))",
+ "SET_OPTAB_HANDLER (abs_optab, $A, CODE_FOR_$(abs$P$a2$))",
+ "SET_OPTAB_HANDLER (absv_optab, $A, CODE_FOR_$(abs$F$a2$)),\n\
+ SET_OPTAB_HANDLER (abs_optab, $A, CODE_FOR_$(abs$F$a2$))",
+ "SET_OPTAB_HANDLER (absv_optab, $A, CODE_FOR_$(absv$I$a2$))",
+ "SET_OPTAB_HANDLER (copysign_optab, $A, CODE_FOR_$(copysign$F$a3$))",
+ "SET_OPTAB_HANDLER (signbit_optab, $A, CODE_FOR_$(signbit$F$a2$))",
+ "SET_OPTAB_HANDLER (isinf_optab, $A, CODE_FOR_$(isinf$a2$))",
+ "SET_OPTAB_HANDLER (sqrt_optab, $A, CODE_FOR_$(sqrt$a2$))",
+ "SET_OPTAB_HANDLER (floor_optab, $A, CODE_FOR_$(floor$a2$))",
+ "SET_CONVERT_OPTAB_HANDLER (lfloor_optab, $B, $A, CODE_FOR_$(lfloor$F$a$I$b2$))",
+ "SET_OPTAB_HANDLER (ceil_optab, $A, CODE_FOR_$(ceil$a2$))",
+ "SET_CONVERT_OPTAB_HANDLER (lceil_optab, $B, $A, CODE_FOR_$(lceil$F$a$I$b2$))",
+ "SET_OPTAB_HANDLER (round_optab, $A, CODE_FOR_$(round$a2$))",
+ "SET_OPTAB_HANDLER (btrunc_optab, $A, CODE_FOR_$(btrunc$a2$))",
+ "SET_OPTAB_HANDLER (nearbyint_optab, $A, CODE_FOR_$(nearbyint$a2$))",
+ "SET_OPTAB_HANDLER (rint_optab, $A, CODE_FOR_$(rint$a2$))",
+ "SET_CONVERT_OPTAB_HANDLER (lrint_optab, $B, $A, CODE_FOR_$(lrint$F$a$I$b2$))",
+ "SET_CONVERT_OPTAB_HANDLER (lround_optab, $B, $A, CODE_FOR_$(lround$F$a$I$b2$))",
+ "SET_OPTAB_HANDLER (sincos_optab, $A, CODE_FOR_$(sincos$a3$))",
+ "SET_OPTAB_HANDLER (sin_optab, $A, CODE_FOR_$(sin$a2$))",
+ "SET_OPTAB_HANDLER (asin_optab, $A, CODE_FOR_$(asin$a2$))",
+ "SET_OPTAB_HANDLER (cos_optab, $A, CODE_FOR_$(cos$a2$))",
+ "SET_OPTAB_HANDLER (acos_optab, $A, CODE_FOR_$(acos$a2$))",
+ "SET_OPTAB_HANDLER (exp_optab, $A, CODE_FOR_$(exp$a2$))",
+ "SET_OPTAB_HANDLER (exp10_optab, $A, CODE_FOR_$(exp10$a2$))",
+ "SET_OPTAB_HANDLER (exp2_optab, $A, CODE_FOR_$(exp2$a2$))",
+ "SET_OPTAB_HANDLER (expm1_optab, $A, CODE_FOR_$(expm1$a2$))",
+ "SET_OPTAB_HANDLER (ldexp_optab, $A, CODE_FOR_$(ldexp$a3$))",
+ "SET_OPTAB_HANDLER (scalb_optab, $A, CODE_FOR_$(scalb$a3$))",
+ "SET_OPTAB_HANDLER (significand_optab, $A, CODE_FOR_$(significand$a2$))",
+ "SET_OPTAB_HANDLER (logb_optab, $A, CODE_FOR_$(logb$a2$))",
+ "SET_OPTAB_HANDLER (ilogb_optab, $A, CODE_FOR_$(ilogb$a2$))",
+ "SET_OPTAB_HANDLER (log_optab, $A, CODE_FOR_$(log$a2$))",
+ "SET_OPTAB_HANDLER (log10_optab, $A, CODE_FOR_$(log10$a2$))",
+ "SET_OPTAB_HANDLER (log2_optab, $A, CODE_FOR_$(log2$a2$))",
+ "SET_OPTAB_HANDLER (log1p_optab, $A, CODE_FOR_$(log1p$a2$))",
+ "SET_OPTAB_HANDLER (tan_optab, $A, CODE_FOR_$(tan$a2$))",
+ "SET_OPTAB_HANDLER (atan_optab, $A, CODE_FOR_$(atan$a2$))",
+ "SET_OPTAB_HANDLER (strlen_optab, $A, CODE_FOR_$(strlen$a$))",
+ "SET_OPTAB_HANDLER (one_cmpl_optab, $A, CODE_FOR_$(one_cmpl$a2$))",
+ "SET_OPTAB_HANDLER (bswap_optab, $A, CODE_FOR_$(bswap$a2$))",
+ "SET_OPTAB_HANDLER (ffs_optab, $A, CODE_FOR_$(ffs$a2$))",
+ "SET_OPTAB_HANDLER (clz_optab, $A, CODE_FOR_$(clz$a2$))",
+ "SET_OPTAB_HANDLER (ctz_optab, $A, CODE_FOR_$(ctz$a2$))",
+ "SET_OPTAB_HANDLER (popcount_optab, $A, CODE_FOR_$(popcount$a2$))",
+ "SET_OPTAB_HANDLER (parity_optab, $A, CODE_FOR_$(parity$a2$))",
+ "SET_OPTAB_HANDLER (mov_optab, $A, CODE_FOR_$(mov$a$))",
+ "SET_OPTAB_HANDLER (movstrict_optab, $A, CODE_FOR_$(movstrict$a$))",
+ "SET_OPTAB_HANDLER (movmisalign_optab, $A, CODE_FOR_$(movmisalign$a$))",
+ "SET_OPTAB_HANDLER (storent_optab, $A, CODE_FOR_$(storent$a$))",
+ "SET_OPTAB_HANDLER (addcc_optab, $A, CODE_FOR_$(add$acc$))",
"movcc_gen_code[$A] = CODE_FOR_$(mov$acc$)",
- "optab_handler (cbranch_optab, $A)->insn_code = CODE_FOR_$(cbranch$a4$)",
- "optab_handler (cmov_optab, $A)->insn_code = CODE_FOR_$(cmov$a6$)",
- "optab_handler (cstore_optab, $A)->insn_code = CODE_FOR_$(cstore$a4$)",
- "optab_handler (ctrap_optab, $A)->insn_code = CODE_FOR_$(ctrap$a4$)",
- "optab_handler (push_optab, $A)->insn_code = CODE_FOR_$(push$a1$)",
+ "SET_OPTAB_HANDLER (cbranch_optab, $A, CODE_FOR_$(cbranch$a4$))",
+ "SET_OPTAB_HANDLER (cmov_optab, $A, CODE_FOR_$(cmov$a6$))",
+ "SET_OPTAB_HANDLER (cstore_optab, $A, CODE_FOR_$(cstore$a4$))",
+ "SET_OPTAB_HANDLER (ctrap_optab, $A, CODE_FOR_$(ctrap$a4$))",
+ "SET_OPTAB_HANDLER (push_optab, $A, CODE_FOR_$(push$a1$))",
"reload_in_optab[$A] = CODE_FOR_$(reload_in$a$)",
"reload_out_optab[$A] = CODE_FOR_$(reload_out$a$)",
"movmem_optab[$A] = CODE_FOR_$(movmem$a$)",
@@ -234,45 +234,45 @@ static const char * const optabs[] =
"sync_compare_and_swap[$A] = CODE_FOR_$(sync_compare_and_swap$I$a$)",
"sync_lock_test_and_set[$A] = CODE_FOR_$(sync_lock_test_and_set$I$a$)",
"sync_lock_release[$A] = CODE_FOR_$(sync_lock_release$I$a$)",
- "optab_handler (vec_set_optab, $A)->insn_code = CODE_FOR_$(vec_set$a$)",
- "optab_handler (vec_extract_optab, $A)->insn_code = CODE_FOR_$(vec_extract$a$)",
- "optab_handler (vec_extract_even_optab, $A)->insn_code = CODE_FOR_$(vec_extract_even$a$)",
- "optab_handler (vec_extract_odd_optab, $A)->insn_code = CODE_FOR_$(vec_extract_odd$a$)",
- "optab_handler (vec_interleave_high_optab, $A)->insn_code = CODE_FOR_$(vec_interleave_high$a$)",
- "optab_handler (vec_interleave_low_optab, $A)->insn_code = CODE_FOR_$(vec_interleave_low$a$)",
- "optab_handler (vec_init_optab, $A)->insn_code = CODE_FOR_$(vec_init$a$)",
- "optab_handler (vec_shl_optab, $A)->insn_code = CODE_FOR_$(vec_shl_$a$)",
- "optab_handler (vec_shr_optab, $A)->insn_code = CODE_FOR_$(vec_shr_$a$)",
- "optab_handler (vec_realign_load_optab, $A)->insn_code = CODE_FOR_$(vec_realign_load_$a$)",
+ "SET_OPTAB_HANDLER (vec_set_optab, $A, CODE_FOR_$(vec_set$a$))",
+ "SET_OPTAB_HANDLER (vec_extract_optab, $A, CODE_FOR_$(vec_extract$a$))",
+ "SET_OPTAB_HANDLER (vec_extract_even_optab, $A, CODE_FOR_$(vec_extract_even$a$))",
+ "SET_OPTAB_HANDLER (vec_extract_odd_optab, $A, CODE_FOR_$(vec_extract_odd$a$))",
+ "SET_OPTAB_HANDLER (vec_interleave_high_optab, $A, CODE_FOR_$(vec_interleave_high$a$))",
+ "SET_OPTAB_HANDLER (vec_interleave_low_optab, $A, CODE_FOR_$(vec_interleave_low$a$))",
+ "SET_OPTAB_HANDLER (vec_init_optab, $A, CODE_FOR_$(vec_init$a$))",
+ "SET_OPTAB_HANDLER (vec_shl_optab, $A, CODE_FOR_$(vec_shl_$a$))",
+ "SET_OPTAB_HANDLER (vec_shr_optab, $A, CODE_FOR_$(vec_shr_$a$))",
+ "SET_OPTAB_HANDLER (vec_realign_load_optab, $A, CODE_FOR_$(vec_realign_load_$a$))",
"vcond_gen_code[$A] = CODE_FOR_$(vcond$a$)",
"vcondu_gen_code[$A] = CODE_FOR_$(vcondu$a$)",
- "optab_handler (ssum_widen_optab, $A)->insn_code = CODE_FOR_$(widen_ssum$I$a3$)",
- "optab_handler (usum_widen_optab, $A)->insn_code = CODE_FOR_$(widen_usum$I$a3$)",
- "optab_handler (udot_prod_optab, $A)->insn_code = CODE_FOR_$(udot_prod$I$a$)",
- "optab_handler (sdot_prod_optab, $A)->insn_code = CODE_FOR_$(sdot_prod$I$a$)",
- "optab_handler (reduc_smax_optab, $A)->insn_code = CODE_FOR_$(reduc_smax_$a$)",
- "optab_handler (reduc_umax_optab, $A)->insn_code = CODE_FOR_$(reduc_umax_$a$)",
- "optab_handler (reduc_smin_optab, $A)->insn_code = CODE_FOR_$(reduc_smin_$a$)",
- "optab_handler (reduc_umin_optab, $A)->insn_code = CODE_FOR_$(reduc_umin_$a$)",
- "optab_handler (reduc_splus_optab, $A)->insn_code = CODE_FOR_$(reduc_splus_$a$)" ,
- "optab_handler (reduc_uplus_optab, $A)->insn_code = CODE_FOR_$(reduc_uplus_$a$)",
- "optab_handler (vec_widen_umult_hi_optab, $A)->insn_code = CODE_FOR_$(vec_widen_umult_hi_$a$)",
- "optab_handler (vec_widen_umult_lo_optab, $A)->insn_code = CODE_FOR_$(vec_widen_umult_lo_$a$)",
- "optab_handler (vec_widen_smult_hi_optab, $A)->insn_code = CODE_FOR_$(vec_widen_smult_hi_$a$)",
- "optab_handler (vec_widen_smult_lo_optab, $A)->insn_code = CODE_FOR_$(vec_widen_smult_lo_$a$)",
- "optab_handler (vec_unpacks_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_hi_$a$)",
- "optab_handler (vec_unpacks_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_lo_$a$)",
- "optab_handler (vec_unpacku_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_hi_$a$)",
- "optab_handler (vec_unpacku_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_lo_$a$)",
- "optab_handler (vec_unpacks_float_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_float_hi_$a$)",
- "optab_handler (vec_unpacks_float_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_float_lo_$a$)",
- "optab_handler (vec_unpacku_float_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_float_hi_$a$)",
- "optab_handler (vec_unpacku_float_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_float_lo_$a$)",
- "optab_handler (vec_pack_trunc_optab, $A)->insn_code = CODE_FOR_$(vec_pack_trunc_$a$)",
- "optab_handler (vec_pack_ssat_optab, $A)->insn_code = CODE_FOR_$(vec_pack_ssat_$a$)",
- "optab_handler (vec_pack_usat_optab, $A)->insn_code = CODE_FOR_$(vec_pack_usat_$a$)",
- "optab_handler (vec_pack_sfix_trunc_optab, $A)->insn_code = CODE_FOR_$(vec_pack_sfix_trunc_$a$)",
- "optab_handler (vec_pack_ufix_trunc_optab, $A)->insn_code = CODE_FOR_$(vec_pack_ufix_trunc_$a$)"
+ "SET_OPTAB_HANDLER (ssum_widen_optab, $A, CODE_FOR_$(widen_ssum$I$a3$))",
+ "SET_OPTAB_HANDLER (usum_widen_optab, $A, CODE_FOR_$(widen_usum$I$a3$))",
+ "SET_OPTAB_HANDLER (udot_prod_optab, $A, CODE_FOR_$(udot_prod$I$a$))",
+ "SET_OPTAB_HANDLER (sdot_prod_optab, $A, CODE_FOR_$(sdot_prod$I$a$))",
+ "SET_OPTAB_HANDLER (reduc_smax_optab, $A, CODE_FOR_$(reduc_smax_$a$))",
+ "SET_OPTAB_HANDLER (reduc_umax_optab, $A, CODE_FOR_$(reduc_umax_$a$))",
+ "SET_OPTAB_HANDLER (reduc_smin_optab, $A, CODE_FOR_$(reduc_smin_$a$))",
+ "SET_OPTAB_HANDLER (reduc_umin_optab, $A, CODE_FOR_$(reduc_umin_$a$))",
+ "SET_OPTAB_HANDLER (reduc_splus_optab, $A, CODE_FOR_$(reduc_splus_$a$))" ,
+ "SET_OPTAB_HANDLER (reduc_uplus_optab, $A, CODE_FOR_$(reduc_uplus_$a$))",
+ "SET_OPTAB_HANDLER (vec_widen_umult_hi_optab, $A, CODE_FOR_$(vec_widen_umult_hi_$a$))",
+ "SET_OPTAB_HANDLER (vec_widen_umult_lo_optab, $A, CODE_FOR_$(vec_widen_umult_lo_$a$))",
+ "SET_OPTAB_HANDLER (vec_widen_smult_hi_optab, $A, CODE_FOR_$(vec_widen_smult_hi_$a$))",
+ "SET_OPTAB_HANDLER (vec_widen_smult_lo_optab, $A, CODE_FOR_$(vec_widen_smult_lo_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacks_hi_optab, $A, CODE_FOR_$(vec_unpacks_hi_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacks_lo_optab, $A, CODE_FOR_$(vec_unpacks_lo_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacku_hi_optab, $A, CODE_FOR_$(vec_unpacku_hi_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacku_lo_optab, $A, CODE_FOR_$(vec_unpacku_lo_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacks_float_hi_optab, $A, CODE_FOR_$(vec_unpacks_float_hi_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacks_float_lo_optab, $A, CODE_FOR_$(vec_unpacks_float_lo_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacku_float_hi_optab, $A, CODE_FOR_$(vec_unpacku_float_hi_$a$))",
+ "SET_OPTAB_HANDLER (vec_unpacku_float_lo_optab, $A, CODE_FOR_$(vec_unpacku_float_lo_$a$))",
+ "SET_OPTAB_HANDLER (vec_pack_trunc_optab, $A, CODE_FOR_$(vec_pack_trunc_$a$))",
+ "SET_OPTAB_HANDLER (vec_pack_ssat_optab, $A, CODE_FOR_$(vec_pack_ssat_$a$))",
+ "SET_OPTAB_HANDLER (vec_pack_usat_optab, $A, CODE_FOR_$(vec_pack_usat_$a$))",
+ "SET_OPTAB_HANDLER (vec_pack_sfix_trunc_optab, $A, CODE_FOR_$(vec_pack_sfix_trunc_$a$))",
+ "SET_OPTAB_HANDLER (vec_pack_ufix_trunc_optab, $A, CODE_FOR_$(vec_pack_ufix_trunc_$a$))"
};
static void gen_insn (rtx);
@@ -519,8 +519,9 @@ main (int argc, char **argv)
also convert validly to an unsigned one. */\n\
for (i = 0; i < NUM_MACHINE_MODES; i++)\n\
for (j = 0; j < NUM_MACHINE_MODES; j++)\n\
- convert_optab_handler (ufixtrunc_optab, i, j)->insn_code\n\
- = convert_optab_handler (sfixtrunc_optab, i, j)->insn_code;\n\
+ SET_CONVERT_OPTAB_HANDLER\n\
+ (ufixtrunc_optab, i, j,\n\
+ CONVERT_OPTAB_HANDLER (sfixtrunc_optab, i, j));\n\
#endif\n\
}");
Index: gcc/ifcvt.c
===================================================================
--- gcc/ifcvt.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/ifcvt.c 2010-07-03 18:32:20.000000000 +0100
@@ -3156,7 +3156,7 @@ find_if_header (basic_block test_bb, int
goto success;
if (HAVE_trap
- && optab_handler (ctrap_optab, word_mode)->insn_code != CODE_FOR_nothing
+ && OPTAB_HANDLER (ctrap_optab, word_mode) != CODE_FOR_nothing
&& find_cond_trap (test_bb, then_edge, else_edge))
goto success;
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/optabs.c 2010-07-03 18:32:20.000000000 +0100
@@ -562,10 +562,10 @@ expand_widen_pattern_expr (sepops ops, r
optab_for_tree_code (ops->code, TREE_TYPE (oprnd0), optab_default);
if (ops->code == WIDEN_MULT_PLUS_EXPR
|| ops->code == WIDEN_MULT_MINUS_EXPR)
- icode = (int) optab_handler (widen_pattern_optab,
- TYPE_MODE (TREE_TYPE (ops->op2)))->insn_code;
+ icode = (int) OPTAB_HANDLER (widen_pattern_optab,
+ TYPE_MODE (TREE_TYPE (ops->op2)));
else
- icode = (int) optab_handler (widen_pattern_optab, tmode0)->insn_code;
+ icode = (int) OPTAB_HANDLER (widen_pattern_optab, tmode0);
gcc_assert (icode != CODE_FOR_nothing);
xmode0 = insn_data[icode].operand[1].mode;
@@ -690,7 +690,7 @@ expand_widen_pattern_expr (sepops ops, r
expand_ternary_op (enum machine_mode mode, optab ternary_optab, rtx op0,
rtx op1, rtx op2, rtx target, int unsignedp)
{
- int icode = (int) optab_handler (ternary_optab, mode)->insn_code;
+ int icode = (int) OPTAB_HANDLER (ternary_optab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
enum machine_mode mode1 = insn_data[icode].operand[2].mode;
enum machine_mode mode2 = insn_data[icode].operand[3].mode;
@@ -698,8 +698,7 @@ expand_ternary_op (enum machine_mode mod
rtx pat;
rtx xop0 = op0, xop1 = op1, xop2 = op2;
- gcc_assert (optab_handler (ternary_optab, mode)->insn_code
- != CODE_FOR_nothing);
+ gcc_assert (OPTAB_HANDLER (ternary_optab, mode) != CODE_FOR_nothing);
if (!target || !insn_data[icode].operand[0].predicate (target, mode))
temp = gen_reg_rtx (mode);
@@ -819,7 +818,7 @@ expand_vec_shift_expr (sepops ops, rtx t
gcc_unreachable ();
}
- icode = optab_handler (shift_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (shift_optab, mode);
gcc_assert (icode != CODE_FOR_nothing);
mode1 = insn_data[icode].operand[1].mode;
@@ -1436,7 +1435,7 @@ expand_binop_directly (enum machine_mode
rtx target, int unsignedp, enum optab_methods methods,
rtx last)
{
- int icode = (int) optab_handler (binoptab, mode)->insn_code;
+ int icode = (int) OPTAB_HANDLER (binoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
enum machine_mode mode1 = insn_data[icode].operand[2].mode;
enum machine_mode tmp_mode;
@@ -1593,7 +1592,7 @@ expand_binop (enum machine_mode mode, op
/* If we can do it with a three-operand insn, do so. */
if (methods != OPTAB_MUST_WIDEN
- && optab_handler (binoptab, mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (binoptab, mode) != CODE_FOR_nothing)
{
temp = expand_binop_directly (mode, binoptab, op0, op1, target,
unsignedp, methods, last);
@@ -1604,9 +1603,9 @@ expand_binop (enum machine_mode mode, op
/* If we were trying to rotate, and that didn't work, try rotating
the other direction before falling back to shifts and bitwise-or. */
if (((binoptab == rotl_optab
- && optab_handler (rotr_optab, mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (rotr_optab, mode) != CODE_FOR_nothing)
|| (binoptab == rotr_optab
- && optab_handler (rotl_optab, mode)->insn_code != CODE_FOR_nothing))
+ && OPTAB_HANDLER (rotl_optab, mode) != CODE_FOR_nothing))
&& mclass == MODE_INT)
{
optab otheroptab = (binoptab == rotl_optab ? rotr_optab : rotl_optab);
@@ -1633,8 +1632,8 @@ expand_binop (enum machine_mode mode, op
if (binoptab == smul_optab
&& GET_MODE_WIDER_MODE (mode) != VOIDmode
- && ((optab_handler ((unsignedp ? umul_widen_optab : smul_widen_optab),
- GET_MODE_WIDER_MODE (mode))->insn_code)
+ && (OPTAB_HANDLER ((unsignedp ? umul_widen_optab : smul_widen_optab),
+ GET_MODE_WIDER_MODE (mode))
!= CODE_FOR_nothing))
{
temp = expand_binop (GET_MODE_WIDER_MODE (mode),
@@ -1662,12 +1661,12 @@ expand_binop (enum machine_mode mode, op
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (binoptab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (OPTAB_HANDLER (binoptab, wider_mode) != CODE_FOR_nothing
|| (binoptab == smul_optab
&& GET_MODE_WIDER_MODE (wider_mode) != VOIDmode
- && ((optab_handler ((unsignedp ? umul_widen_optab
- : smul_widen_optab),
- GET_MODE_WIDER_MODE (wider_mode))->insn_code)
+ && (OPTAB_HANDLER ((unsignedp ? umul_widen_optab
+ : smul_widen_optab),
+ GET_MODE_WIDER_MODE (wider_mode))
!= CODE_FOR_nothing)))
{
rtx xop0 = op0, xop1 = op1;
@@ -1734,7 +1733,7 @@ expand_binop (enum machine_mode mode, op
if ((binoptab == and_optab || binoptab == ior_optab || binoptab == xor_optab)
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (binoptab, word_mode) != CODE_FOR_nothing)
{
int i;
rtx insns;
@@ -1778,9 +1777,9 @@ expand_binop (enum machine_mode mode, op
&& mclass == MODE_INT
&& (CONST_INT_P (op1) || optimize_insn_for_speed_p ())
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (ashl_optab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (lshr_optab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (binoptab, word_mode) != CODE_FOR_nothing
+ && OPTAB_HANDLER (ashl_optab, word_mode) != CODE_FOR_nothing
+ && OPTAB_HANDLER (lshr_optab, word_mode) != CODE_FOR_nothing)
{
unsigned HOST_WIDE_INT shift_mask, double_shift_mask;
enum machine_mode op1_mode;
@@ -1848,8 +1847,8 @@ expand_binop (enum machine_mode mode, op
&& mclass == MODE_INT
&& CONST_INT_P (op1)
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (ashl_optab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (lshr_optab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (ashl_optab, word_mode) != CODE_FOR_nothing
+ && OPTAB_HANDLER (lshr_optab, word_mode) != CODE_FOR_nothing)
{
rtx insns;
rtx into_target, outof_target;
@@ -1960,7 +1959,7 @@ expand_binop (enum machine_mode mode, op
if ((binoptab == add_optab || binoptab == sub_optab)
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) >= 2 * UNITS_PER_WORD
- && optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (binoptab, word_mode) != CODE_FOR_nothing)
{
unsigned int i;
optab otheroptab = binoptab == add_optab ? sub_optab : add_optab;
@@ -2057,7 +2056,7 @@ expand_binop (enum machine_mode mode, op
if (i == GET_MODE_BITSIZE (mode) / (unsigned) BITS_PER_WORD)
{
- if (optab_handler (mov_optab, mode)->insn_code != CODE_FOR_nothing
+ if (OPTAB_HANDLER (mov_optab, mode) != CODE_FOR_nothing
|| ! rtx_equal_p (target, xtarget))
{
rtx temp = emit_move_insn (target, xtarget);
@@ -2086,13 +2085,12 @@ expand_binop (enum machine_mode mode, op
if (binoptab == smul_optab
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (smul_optab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (add_optab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (smul_optab, word_mode) != CODE_FOR_nothing
+ && OPTAB_HANDLER (add_optab, word_mode) != CODE_FOR_nothing)
{
rtx product = NULL_RTX;
- if (optab_handler (umul_widen_optab, mode)->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (umul_widen_optab, mode) != CODE_FOR_nothing)
{
product = expand_doubleword_mult (mode, op0, op1, target,
true, methods);
@@ -2101,8 +2099,7 @@ expand_binop (enum machine_mode mode, op
}
if (product == NULL_RTX
- && optab_handler (smul_widen_optab, mode)->insn_code
- != CODE_FOR_nothing)
+ && OPTAB_HANDLER (smul_widen_optab, mode) != CODE_FOR_nothing)
{
product = expand_doubleword_mult (mode, op0, op1, target,
false, methods);
@@ -2112,7 +2109,7 @@ expand_binop (enum machine_mode mode, op
if (product != NULL_RTX)
{
- if (optab_handler (mov_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (mov_optab, mode) != CODE_FOR_nothing)
{
temp = emit_move_insn (target ? target : product, product);
set_unique_reg_note (temp,
@@ -2193,8 +2190,7 @@ expand_binop (enum machine_mode mode, op
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if ((optab_handler (binoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (binoptab, wider_mode) != CODE_FOR_nothing
|| (methods == OPTAB_LIB
&& optab_libfunc (binoptab, wider_mode)))
{
@@ -2270,7 +2266,7 @@ sign_expand_binop (enum machine_mode mod
/* Try widening to a signed int. Make a fake signed optab that
hides any signed insn for direct use. */
wide_soptab = *soptab;
- optab_handler (&wide_soptab, mode)->insn_code = CODE_FOR_nothing;
+ SET_OPTAB_HANDLER (&wide_soptab, mode, CODE_FOR_nothing);
/* We don't want to generate new hash table entries from this fake
optab. */
wide_soptab.libcall_gen = NULL;
@@ -2332,9 +2328,9 @@ expand_twoval_unop (optab unoptab, rtx o
/* Record where to go back to if we fail. */
last = get_last_insn ();
- if (optab_handler (unoptab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (unoptab, mode) != CODE_FOR_nothing)
{
- int icode = (int) optab_handler (unoptab, mode)->insn_code;
+ int icode = (int) OPTAB_HANDLER (unoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[2].mode;
rtx pat;
rtx xop0 = op0;
@@ -2370,8 +2366,7 @@ expand_twoval_unop (optab unoptab, rtx o
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (unoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (unoptab, wider_mode) != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (wider_mode);
rtx t1 = gen_reg_rtx (wider_mode);
@@ -2425,9 +2420,9 @@ expand_twoval_binop (optab binoptab, rtx
/* Record where to go back to if we fail. */
last = get_last_insn ();
- if (optab_handler (binoptab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (binoptab, mode) != CODE_FOR_nothing)
{
- int icode = (int) optab_handler (binoptab, mode)->insn_code;
+ int icode = (int) OPTAB_HANDLER (binoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
enum machine_mode mode1 = insn_data[icode].operand[2].mode;
rtx pat;
@@ -2487,8 +2482,7 @@ expand_twoval_binop (optab binoptab, rtx
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (binoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (binoptab, wider_mode) != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (wider_mode);
rtx t1 = gen_reg_rtx (wider_mode);
@@ -2589,8 +2583,7 @@ widen_clz (enum machine_mode mode, rtx o
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (clz_optab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (clz_optab, wider_mode) != CODE_FOR_nothing)
{
rtx xop0, temp, last;
@@ -2702,7 +2695,7 @@ widen_bswap (enum machine_mode mode, rtx
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- if (optab_handler (bswap_optab, wider_mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (bswap_optab, wider_mode) != CODE_FOR_nothing)
goto found;
return NULL_RTX;
@@ -2764,8 +2757,7 @@ expand_parity (enum machine_mode mode, r
for (wider_mode = mode; wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (popcount_optab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (popcount_optab, wider_mode) != CODE_FOR_nothing)
{
rtx xop0, temp, last;
@@ -2806,7 +2798,7 @@ expand_ctz (enum machine_mode mode, rtx
{
rtx seq, temp;
- if (optab_handler (clz_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (clz_optab, mode) == CODE_FOR_nothing)
return 0;
start_sequence ();
@@ -2849,7 +2841,7 @@ expand_ffs (enum machine_mode mode, rtx
bool defined_at_zero = false;
rtx temp, seq;
- if (optab_handler (ctz_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (ctz_optab, mode) != CODE_FOR_nothing)
{
start_sequence ();
@@ -2859,7 +2851,7 @@ expand_ffs (enum machine_mode mode, rtx
defined_at_zero = (CTZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2);
}
- else if (optab_handler (clz_optab, mode)->insn_code != CODE_FOR_nothing)
+ else if (OPTAB_HANDLER (clz_optab, mode) != CODE_FOR_nothing)
{
start_sequence ();
temp = expand_ctz (mode, op0, 0);
@@ -3037,9 +3029,9 @@ expand_absneg_bit (enum rtx_code code, e
expand_unop_direct (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
int unsignedp)
{
- if (optab_handler (unoptab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (unoptab, mode) != CODE_FOR_nothing)
{
- int icode = (int) optab_handler (unoptab, mode)->insn_code;
+ int icode = (int) OPTAB_HANDLER (unoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
rtx xop0 = op0;
rtx last = get_last_insn ();
@@ -3116,7 +3108,7 @@ expand_unop (enum machine_mode mode, opt
return temp;
if (GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (unoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (unoptab, word_mode) != CODE_FOR_nothing)
{
temp = expand_doubleword_clz (mode, op0, target);
if (temp)
@@ -3134,7 +3126,7 @@ expand_unop (enum machine_mode mode, opt
return temp;
if (GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (unoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (unoptab, word_mode) != CODE_FOR_nothing)
{
temp = expand_doubleword_bswap (mode, op0, target);
if (temp)
@@ -3149,7 +3141,7 @@ expand_unop (enum machine_mode mode, opt
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (unoptab, wider_mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (unoptab, wider_mode) != CODE_FOR_nothing)
{
rtx xop0 = op0;
rtx last = get_last_insn ();
@@ -3189,7 +3181,7 @@ expand_unop (enum machine_mode mode, opt
if (unoptab == one_cmpl_optab
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && optab_handler (unoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (unoptab, word_mode) != CODE_FOR_nothing)
{
int i;
rtx insns;
@@ -3311,8 +3303,7 @@ expand_unop (enum machine_mode mode, opt
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if ((optab_handler (unoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (unoptab, wider_mode) != CODE_FOR_nothing
|| optab_libfunc (unoptab, wider_mode))
{
rtx xop0 = op0;
@@ -3405,7 +3396,7 @@ expand_abs_nojump (enum machine_mode mod
}
/* If we have a MAX insn, we can do this as MAX (x, -x). */
- if (optab_handler (smax_optab, mode)->insn_code != CODE_FOR_nothing
+ if (OPTAB_HANDLER (smax_optab, mode) != CODE_FOR_nothing
&& !HONOR_SIGNED_ZEROS (mode))
{
rtx last = get_last_insn ();
@@ -3508,7 +3499,7 @@ expand_one_cmpl_abs_nojump (enum machine
return NULL_RTX;
/* If we have a MAX insn, we can do this as MAX (x, ~x). */
- if (optab_handler (smax_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (smax_optab, mode) != CODE_FOR_nothing)
{
rtx last = get_last_insn ();
@@ -3562,7 +3553,7 @@ expand_copysign_absneg (enum machine_mod
/* Check if the back end provides an insn that handles signbit for the
argument's mode. */
- icode = (int) signbit_optab->handlers [(int) mode].insn_code;
+ icode = (int) OPTAB_HANDLER (signbit_optab, mode);
if (icode != CODE_FOR_nothing)
{
imode = insn_data[icode].operand[0].mode;
@@ -3762,8 +3753,8 @@ expand_copysign (rtx op0, rtx op1, rtx t
if (fmt->signbit_ro >= 0
&& (GET_CODE (op0) == CONST_DOUBLE
- || (optab_handler (neg_optab, mode)->insn_code != CODE_FOR_nothing
- && optab_handler (abs_optab, mode)->insn_code != CODE_FOR_nothing)))
+ || (OPTAB_HANDLER (neg_optab, mode) != CODE_FOR_nothing
+ && OPTAB_HANDLER (abs_optab, mode) != CODE_FOR_nothing)))
{
temp = expand_copysign_absneg (mode, op0, op1, target,
fmt->signbit_ro, op0_is_abs);
@@ -3975,8 +3966,7 @@ emit_libcall_block (rtx insns, rtx targe
}
last = emit_move_insn (target, result);
- if (optab_handler (mov_optab, GET_MODE (target))->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (mov_optab, GET_MODE (target)) != CODE_FOR_nothing)
set_unique_reg_note (last, REG_EQUAL, copy_rtx (equiv));
if (final_dest != target)
@@ -4002,15 +3992,15 @@ can_compare_p (enum rtx_code code, enum
int icode;
if (purpose == ccp_jump
- && (icode = optab_handler (cbranch_optab, mode)->insn_code) != CODE_FOR_nothing
+ && (icode = OPTAB_HANDLER (cbranch_optab, mode)) != CODE_FOR_nothing
&& insn_data[icode].operand[0].predicate (test, mode))
return 1;
if (purpose == ccp_store_flag
- && (icode = optab_handler (cstore_optab, mode)->insn_code) != CODE_FOR_nothing
+ && (icode = OPTAB_HANDLER (cstore_optab, mode)) != CODE_FOR_nothing
&& insn_data[icode].operand[1].predicate (test, mode))
return 1;
if (purpose == ccp_cmov
- && optab_handler (cmov_optab, mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (cmov_optab, mode) != CODE_FOR_nothing)
return 1;
mode = GET_MODE_WIDER_MODE (mode);
@@ -4166,7 +4156,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx
do
{
enum insn_code icode;
- icode = optab_handler (cbranch_optab, cmp_mode)->insn_code;
+ icode = OPTAB_HANDLER (cbranch_optab, cmp_mode);
if (icode != CODE_FOR_nothing
&& insn_data[icode].operand[0].predicate (test, VOIDmode))
{
@@ -4285,7 +4275,7 @@ emit_cmp_and_jump_insn_1 (rtx test, enum
mclass = GET_MODE_CLASS (mode);
optab_mode = (mclass == MODE_CC) ? CCmode : mode;
- icode = optab_handler (cbranch_optab, optab_mode)->insn_code;
+ icode = OPTAB_HANDLER (cbranch_optab, optab_mode);
gcc_assert (icode != CODE_FOR_nothing);
gcc_assert (insn_data[icode].operand[0].predicate (test, VOIDmode));
@@ -4684,7 +4674,7 @@ emit_conditional_add (rtx target, enum r
if (mode == VOIDmode)
mode = GET_MODE (op2);
- icode = optab_handler (addcc_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (addcc_optab, mode);
if (icode == CODE_FOR_nothing)
return 0;
@@ -4755,7 +4745,7 @@ emit_conditional_add (rtx target, enum r
rtx
gen_add2_insn (rtx x, rtx y)
{
- int icode = (int) optab_handler (add_optab, GET_MODE (x))->insn_code;
+ int icode = (int) OPTAB_HANDLER (add_optab, GET_MODE (x));
gcc_assert (insn_data[icode].operand[0].predicate
(x, insn_data[icode].operand[0].mode));
@@ -4773,7 +4763,7 @@ gen_add2_insn (rtx x, rtx y)
rtx
gen_add3_insn (rtx r0, rtx r1, rtx c)
{
- int icode = (int) optab_handler (add_optab, GET_MODE (r0))->insn_code;
+ int icode = (int) OPTAB_HANDLER (add_optab, GET_MODE (r0));
if (icode == CODE_FOR_nothing
|| !(insn_data[icode].operand[0].predicate
@@ -4794,7 +4784,7 @@ have_add2_insn (rtx x, rtx y)
gcc_assert (GET_MODE (x) != VOIDmode);
- icode = (int) optab_handler (add_optab, GET_MODE (x))->insn_code;
+ icode = (int) OPTAB_HANDLER (add_optab, GET_MODE (x));
if (icode == CODE_FOR_nothing)
return 0;
@@ -4815,7 +4805,7 @@ have_add2_insn (rtx x, rtx y)
rtx
gen_sub2_insn (rtx x, rtx y)
{
- int icode = (int) optab_handler (sub_optab, GET_MODE (x))->insn_code;
+ int icode = (int) OPTAB_HANDLER (sub_optab, GET_MODE (x));
gcc_assert (insn_data[icode].operand[0].predicate
(x, insn_data[icode].operand[0].mode));
@@ -4833,7 +4823,7 @@ gen_sub2_insn (rtx x, rtx y)
rtx
gen_sub3_insn (rtx r0, rtx r1, rtx c)
{
- int icode = (int) optab_handler (sub_optab, GET_MODE (r0))->insn_code;
+ int icode = (int) OPTAB_HANDLER (sub_optab, GET_MODE (r0));
if (icode == CODE_FOR_nothing
|| !(insn_data[icode].operand[0].predicate
@@ -4854,7 +4844,7 @@ have_sub2_insn (rtx x, rtx y)
gcc_assert (GET_MODE (x) != VOIDmode);
- icode = (int) optab_handler (sub_optab, GET_MODE (x))->insn_code;
+ icode = (int) OPTAB_HANDLER (sub_optab, GET_MODE (x));
if (icode == CODE_FOR_nothing)
return 0;
@@ -4900,7 +4890,7 @@ can_extend_p (enum machine_mode to_mode,
#endif
tab = unsignedp ? zext_optab : sext_optab;
- return convert_optab_handler (tab, to_mode, from_mode)->insn_code;
+ return CONVERT_OPTAB_HANDLER (tab, to_mode, from_mode);
}
/* Generate the body of an insn to extend Y (with mode MFROM)
@@ -4931,7 +4921,7 @@ can_fix_p (enum machine_mode fixmode, en
enum insn_code icode;
tab = unsignedp ? ufixtrunc_optab : sfixtrunc_optab;
- icode = convert_optab_handler (tab, fixmode, fltmode)->insn_code;
+ icode = CONVERT_OPTAB_HANDLER (tab, fixmode, fltmode);
if (icode != CODE_FOR_nothing)
{
*truncp_ptr = 0;
@@ -4942,9 +4932,9 @@ can_fix_p (enum machine_mode fixmode, en
for this to work. We need to rework the fix* and ftrunc* patterns
and documentation. */
tab = unsignedp ? ufix_optab : sfix_optab;
- icode = convert_optab_handler (tab, fixmode, fltmode)->insn_code;
+ icode = CONVERT_OPTAB_HANDLER (tab, fixmode, fltmode);
if (icode != CODE_FOR_nothing
- && optab_handler (ftrunc_optab, fltmode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (ftrunc_optab, fltmode) != CODE_FOR_nothing)
{
*truncp_ptr = 1;
return icode;
@@ -4961,7 +4951,7 @@ can_float_p (enum machine_mode fltmode,
convert_optab tab;
tab = unsignedp ? ufloat_optab : sfloat_optab;
- return convert_optab_handler (tab, fltmode, fixmode)->insn_code;
+ return CONVERT_OPTAB_HANDLER (tab, fltmode, fixmode);
}
\f
/* Generate code to convert FROM to floating point
@@ -5295,8 +5285,7 @@ expand_fix (rtx to, rtx from, int unsign
emit_label (lab2);
- if (optab_handler (mov_optab, GET_MODE (to))->insn_code
- != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (mov_optab, GET_MODE (to)) != CODE_FOR_nothing)
{
/* Make a place for a REG_NOTE and add it. */
insn = emit_move_insn (to, to);
@@ -5383,7 +5372,7 @@ expand_fixed_convert (rtx to, rtx from,
tab = satp ? satfract_optab : fract_optab;
this_code = satp ? SAT_FRACT : FRACT_CONVERT;
}
- code = tab->handlers[to_mode][from_mode].insn_code;
+ code = CONVERT_OPTAB_HANDLER (tab, to_mode, from_mode);
if (code != CODE_FOR_nothing)
{
emit_unop_insn (code, to, from, this_code);
@@ -5424,7 +5413,7 @@ expand_sfix_optab (rtx to, rtx from, con
for (imode = GET_MODE (to); imode != VOIDmode;
imode = GET_MODE_WIDER_MODE (imode))
{
- icode = convert_optab_handler (tab, imode, fmode)->insn_code;
+ icode = CONVERT_OPTAB_HANDLER (tab, imode, fmode);
if (icode != CODE_FOR_nothing)
{
rtx last = get_last_insn ();
@@ -5454,7 +5443,7 @@ expand_sfix_optab (rtx to, rtx from, con
have_insn_for (enum rtx_code code, enum machine_mode mode)
{
return (code_to_optab[(int) code] != 0
- && (optab_handler (code_to_optab[(int) code], mode)->insn_code
+ && (OPTAB_HANDLER (code_to_optab[(int) code], mode)
!= CODE_FOR_nothing));
}
@@ -5472,7 +5461,7 @@ init_insn_codes (void)
op = &optab_table[i];
for (j = 0; j < NUM_MACHINE_MODES; j++)
- optab_handler (op, j)->insn_code = CODE_FOR_nothing;
+ SET_OPTAB_HANDLER (op, j, CODE_FOR_nothing);
}
for (i = 0; i < (unsigned int) COI_MAX; i++)
{
@@ -5482,7 +5471,7 @@ init_insn_codes (void)
op = &convert_optab_table[i];
for (j = 0; j < NUM_MACHINE_MODES; j++)
for (k = 0; k < NUM_MACHINE_MODES; k++)
- convert_optab_handler (op, j, k)->insn_code = CODE_FOR_nothing;
+ SET_CONVERT_OPTAB_HANDLER (op, j, k, CODE_FOR_nothing);
}
}
@@ -6211,7 +6200,8 @@ init_optabs (void)
}
#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
- /* We statically initialize the insn_codes with CODE_FOR_nothing. */
+ /* We statically initialize the insn_codes with the equivalent of
+ CODE_FOR_nothing. */
if (reinit)
init_insn_codes ();
#else
@@ -6763,7 +6753,7 @@ gen_cond_trap (enum rtx_code code, rtx o
if (mode == VOIDmode)
return 0;
- icode = optab_handler (ctrap_optab, mode)->insn_code;
+ icode = OPTAB_HANDLER (ctrap_optab, mode);
if (icode == CODE_FOR_nothing)
return 0;
Index: gcc/reload.c
===================================================================
--- gcc/reload.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/reload.c 2010-07-03 18:32:20.000000000 +0100
@@ -5834,8 +5834,7 @@ #define REG_OK_FOR_CONTEXT(CONTEXT, REGN
rtx equiv = (MEM_P (XEXP (x, 0))
? XEXP (x, 0)
: reg_equiv_mem[regno]);
- int icode
- = (int) optab_handler (add_optab, GET_MODE (x))->insn_code;
+ int icode = (int) OPTAB_HANDLER (add_optab, GET_MODE (x));
if (insn && NONJUMP_INSN_P (insn) && equiv
&& memory_operand (equiv, GET_MODE (equiv))
#ifdef HAVE_cc0
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/reload1.c 2010-07-03 18:32:20.000000000 +0100
@@ -8680,7 +8680,7 @@ gen_reload (rtx out, rtx in, int opnum,
DEFINE_PEEPHOLE should be specified that recognizes the sequence
we emit below. */
- code = (int) optab_handler (add_optab, GET_MODE (out))->insn_code;
+ code = (int) OPTAB_HANDLER (add_optab, GET_MODE (out));
if (CONSTANT_P (op1) || MEM_P (op1) || GET_CODE (op1) == SUBREG
|| (REG_P (op1)
Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/stmt.c 2010-07-03 18:32:20.000000000 +0100
@@ -2071,7 +2071,7 @@ #define MAX_CASE_BIT_TESTS 3
/* By default, enable case bit tests on targets with ashlsi3. */
#ifndef CASE_USE_BIT_TESTS
-#define CASE_USE_BIT_TESTS (optab_handler (ashl_optab, word_mode)->insn_code \
+#define CASE_USE_BIT_TESTS (OPTAB_HANDLER (ashl_optab, word_mode) \
!= CODE_FOR_nothing)
#endif
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/targhooks.c 2010-07-03 18:32:20.000000000 +0100
@@ -971,7 +971,7 @@ default_builtin_support_vector_misalignm
bool is_packed
ATTRIBUTE_UNUSED)
{
- if (optab_handler (movmisalign_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (movmisalign_optab, mode) != CODE_FOR_nothing)
return true;
return false;
}
Index: gcc/tree-ssa-loop-prefetch.c
===================================================================
--- gcc/tree-ssa-loop-prefetch.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/tree-ssa-loop-prefetch.c 2010-07-03 18:32:20.000000000 +0100
@@ -1136,7 +1136,7 @@ nontemporal_store_p (struct mem_ref *ref
if (mode == BLKmode)
return false;
- code = optab_handler (storent_optab, mode)->insn_code;
+ code = OPTAB_HANDLER (storent_optab, mode);
return code != CODE_FOR_nothing;
}
Index: gcc/tree-ssa-math-opts.c
===================================================================
--- gcc/tree-ssa-math-opts.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/tree-ssa-math-opts.c 2010-07-03 18:32:20.000000000 +0100
@@ -1113,11 +1113,9 @@ execute_optimize_bswap (void)
return 0;
bswap32_p = (built_in_decls[BUILT_IN_BSWAP32]
- && optab_handler (bswap_optab, SImode)->insn_code !=
- CODE_FOR_nothing);
+ && OPTAB_HANDLER (bswap_optab, SImode) != CODE_FOR_nothing);
bswap64_p = (built_in_decls[BUILT_IN_BSWAP64]
- && (optab_handler (bswap_optab, DImode)->insn_code !=
- CODE_FOR_nothing
+ && (OPTAB_HANDLER (bswap_optab, DImode) != CODE_FOR_nothing
|| (bswap32_p && word_mode == SImode)));
if (!bswap32_p && !bswap64_p)
@@ -1323,18 +1321,18 @@ convert_mult_to_widen (gimple stmt)
likely to pessimize code. */
if ((rhs1_stmt == NULL || TYPE_UNSIGNED (type1))
&& (rhs2_stmt == NULL || TYPE_UNSIGNED (type2))
- && (optab_handler (umul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
+ && (OPTAB_HANDLER (umul_widen_optab, TYPE_MODE (type))
+ == CODE_FOR_nothing))
return false;
else if ((rhs1_stmt == NULL || !TYPE_UNSIGNED (type1))
&& (rhs2_stmt == NULL || !TYPE_UNSIGNED (type2))
- && (optab_handler (smul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
+ && (OPTAB_HANDLER (smul_widen_optab, TYPE_MODE (type))
+ == CODE_FOR_nothing))
return false;
else if (rhs1_stmt != NULL && rhs2_stmt != NULL
&& (TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2))
- && (optab_handler (usmul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
+ && (OPTAB_HANDLER (usmul_widen_optab, TYPE_MODE (type))
+ == CODE_FOR_nothing))
return false;
if ((rhs1_stmt == NULL && !int_fits_type_p (rhs1, type2))
@@ -1385,8 +1383,7 @@ convert_plusminus_to_widen (gimple_stmt_
accumulate in this mode/signedness combination, otherwise
this transformation is likely to pessimize code. */
this_optab = optab_for_tree_code (wmult_code, type, optab_default);
- if (optab_handler (this_optab, TYPE_MODE (type))->insn_code
- == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (this_optab, TYPE_MODE (type)) == CODE_FOR_nothing)
return false;
rhs1 = gimple_assign_rhs1 (stmt);
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/tree-vect-data-refs.c 2010-07-03 18:32:20.000000000 +0100
@@ -2870,10 +2870,8 @@ vect_strided_store_supported (tree vecty
return false;
}
- if (optab_handler (interleave_high_optab, mode)->insn_code
- == CODE_FOR_nothing
- || optab_handler (interleave_low_optab, mode)->insn_code
- == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (interleave_high_optab, mode) == CODE_FOR_nothing
+ || OPTAB_HANDLER (interleave_low_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "interleave op not supported by target.");
@@ -3279,7 +3277,7 @@ vect_strided_load_supported (tree vectyp
return false;
}
- if (optab_handler (perm_even_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (perm_even_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "perm_even op not supported by target.");
@@ -3295,7 +3293,7 @@ vect_strided_load_supported (tree vectyp
return false;
}
- if (optab_handler (perm_odd_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (perm_odd_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "perm_odd op not supported by target.");
@@ -3652,8 +3650,7 @@ vect_supportable_dr_alignment (struct da
bool is_packed = false;
tree type = (TREE_TYPE (DR_REF (dr)));
- if (optab_handler (vec_realign_load_optab, mode)->insn_code !=
- CODE_FOR_nothing
+ if (OPTAB_HANDLER (vec_realign_load_optab, mode) != CODE_FOR_nothing
&& (!targetm.vectorize.builtin_mask_for_load
|| targetm.vectorize.builtin_mask_for_load ()))
{
Index: gcc/tree-vect-generic.c
===================================================================
--- gcc/tree-vect-generic.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/tree-vect-generic.c 2010-07-03 18:32:20.000000000 +0100
@@ -368,7 +368,7 @@ type_for_widest_vector_mode (enum machin
for (; mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode))
if (GET_MODE_INNER (mode) == inner_mode
&& GET_MODE_NUNITS (mode) > best_nunits
- && optab_handler (op, mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (op, mode) != CODE_FOR_nothing)
best_mode = mode, best_nunits = GET_MODE_NUNITS (mode);
if (best_mode == VOIDmode)
@@ -443,8 +443,7 @@ expand_vector_operations_1 (gimple_stmt_
have a vector/vector shift */
op = optab_for_tree_code (code, type, optab_scalar);
if (!op
- || (op->handlers[(int) TYPE_MODE (type)].insn_code
- == CODE_FOR_nothing))
+ || OPTAB_HANDLER (op, TYPE_MODE (type)) == CODE_FOR_nothing)
op = optab_for_tree_code (code, type, optab_vector);
}
}
@@ -498,7 +497,7 @@ expand_vector_operations_1 (gimple_stmt_
|| GET_MODE_CLASS (compute_mode) == MODE_VECTOR_ACCUM
|| GET_MODE_CLASS (compute_mode) == MODE_VECTOR_UACCUM)
&& op != NULL
- && optab_handler (op, compute_mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (op, compute_mode) != CODE_FOR_nothing)
return;
else
/* There is no operation in hardware, so fall back to scalars. */
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/tree-vect-loop.c 2010-07-03 18:32:20.000000000 +0100
@@ -132,7 +132,7 @@ Software Foundation; either version 3, o
Since we only vectorize operations which vector form can be
expressed using existing tree codes, to verify that an operation is
supported, the vectorizer checks the relevant optab at the relevant
- machine_mode (e.g, optab_handler (add_optab, V8HImode)->insn_code). If
+ machine_mode (e.g, OPTAB_HANDLER (add_optab, V8HImode)). If
the value found is CODE_FOR_nothing, then there's no target support, and
we can't vectorize the stmt.
@@ -2421,8 +2421,8 @@ vect_model_reduction_cost (stmt_vec_info
/* We have a whole vector shift available. */
if (VECTOR_MODE_P (mode)
- && optab_handler (optab, mode)->insn_code != CODE_FOR_nothing
- && optab_handler (vec_shr_optab, mode)->insn_code != CODE_FOR_nothing)
+ && OPTAB_HANDLER (optab, mode) != CODE_FOR_nothing
+ && OPTAB_HANDLER (vec_shr_optab, mode) != CODE_FOR_nothing)
/* Final reduction via vector shifts and the reduction operator. Also
requires scalar extract. */
outer_cost += ((exact_log2(nelements) * 2)
@@ -3264,7 +3264,7 @@ vect_create_epilog_for_reduction (VEC (t
int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
tree vec_temp;
- if (optab_handler (vec_shr_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (vec_shr_optab, mode) != CODE_FOR_nothing)
shift_code = VEC_RSHIFT_EXPR;
else
have_whole_vector_shift = false;
@@ -3280,7 +3280,7 @@ vect_create_epilog_for_reduction (VEC (t
else
{
optab optab = optab_for_tree_code (code, vectype, optab_default);
- if (optab_handler (optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (optab, mode) == CODE_FOR_nothing)
have_whole_vector_shift = false;
}
@@ -3939,7 +3939,7 @@ vectorizable_reduction (gimple stmt, gim
return false;
}
- if (optab_handler (optab, vec_mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (optab, vec_mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "op not supported by target.");
@@ -3987,11 +3987,12 @@ vectorizable_reduction (gimple stmt, gim
2. The type (mode) we use to check available target support
for the vector operation to be created in the *epilog*, is
determined by the type of the reduction variable (in the example
- above we'd check this: plus_optab[vect_int_mode]).
+ above we'd check this: OPTAB_HANDLER (plus_optab, vect_int_mode])).
However the type (mode) we use to check available target support
for the vector operation to be created *inside the loop*, is
determined by the type of the other arguments to STMT (in the
- example we'd check this: widen_sum_optab[vect_short_mode]).
+ example we'd check this: OPTAB_HANDLER (widen_sum_optab,
+ vect_short_mode)).
This is contrary to "regular" reductions, in which the types of all
the arguments are the same as the type of the reduction variable.
@@ -4044,8 +4045,7 @@ vectorizable_reduction (gimple stmt, gim
}
if (reduc_optab
- && optab_handler (reduc_optab, vec_mode)->insn_code
- == CODE_FOR_nothing)
+ && OPTAB_HANDLER (reduc_optab, vec_mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "reduc op not supported by target.");
Index: gcc/tree-vect-patterns.c
===================================================================
--- gcc/tree-vect-patterns.c 2010-07-03 18:20:10.000000000 +0100
+++ gcc/tree-vect-patterns.c 2010-07-03 18:32:20.000000000 +0100
@@ -714,8 +714,7 @@ vect_pattern_recog_1 (
optab = optab_for_tree_code (code, type_in, optab_default);
vec_mode = TYPE_MODE (type_in);
if (!optab
- || (icode = optab_handler (optab, vec_mode)->insn_code) ==
- CODE_FOR_nothing
+ || (icode = OPTAB_HANDLER (optab, vec_mode)) == CODE_FOR_nothing
|| (insn_data[icode].operand[0].mode != TYPE_MODE (type_out)))
return;
}
Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/tree-vect-slp.c 2010-07-03 18:32:20.000000000 +0100
@@ -421,8 +421,7 @@ vect_build_slp_tree (loop_vec_info loop_
optab_vector);
if (!optab
- || (optab->handlers[(int) vec_mode].insn_code
- == CODE_FOR_nothing))
+ || OPTAB_HANDLER (optab, vec_mode) == CODE_FOR_nothing)
{
/* No vector/vector shift, try for a vector/scalar shift. */
optab = optab_for_tree_code (rhs_code, vectype,
@@ -434,7 +433,7 @@ vect_build_slp_tree (loop_vec_info loop_
fprintf (vect_dump, "Build SLP failed: no optab.");
return false;
}
- icode = (int) optab->handlers[(int) vec_mode].insn_code;
+ icode = (int) OPTAB_HANDLER (optab, vec_mode);
if (icode == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_SLP))
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c 2010-07-03 18:20:11.000000000 +0100
+++ gcc/tree-vect-stmts.c 2010-07-03 18:32:20.000000000 +0100
@@ -2104,8 +2104,7 @@ vectorizable_operation (gimple stmt, gim
{
optab = optab_for_tree_code (code, vectype, optab_scalar);
if (optab
- && (optab_handler (optab, TYPE_MODE (vectype))->insn_code
- != CODE_FOR_nothing))
+ && OPTAB_HANDLER (optab, TYPE_MODE (vectype)) != CODE_FOR_nothing)
{
scalar_shift_arg = true;
if (vect_print_dump_info (REPORT_DETAILS))
@@ -2115,7 +2114,7 @@ vectorizable_operation (gimple stmt, gim
{
optab = optab_for_tree_code (code, vectype, optab_vector);
if (optab
- && (optab_handler (optab, TYPE_MODE (vectype))->insn_code
+ && (OPTAB_HANDLER (optab, TYPE_MODE (vectype))
!= CODE_FOR_nothing))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -2149,7 +2148,7 @@ vectorizable_operation (gimple stmt, gim
return false;
}
vec_mode = TYPE_MODE (vectype);
- icode = (int) optab_handler (optab, vec_mode)->insn_code;
+ icode = (int) OPTAB_HANDLER (optab, vec_mode);
if (icode == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3051,7 +3050,7 @@ vectorizable_store (gimple stmt, gimple_
vec_mode = TYPE_MODE (vectype);
/* FORNOW. In some cases can vectorize even if data-type not supported
(e.g. - array initialization with 0). */
- if (optab_handler (mov_optab, (int)vec_mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (mov_optab, vec_mode) == CODE_FOR_nothing)
return false;
if (!STMT_VINFO_DATA_REF (stmt_info))
@@ -3434,7 +3433,7 @@ vectorizable_load (gimple stmt, gimple_s
/* FORNOW. In some cases can vectorize even if data-type not supported
(e.g. - data copies). */
- if (optab_handler (mov_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (mov_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "Aligned load, but unsupported type.");
@@ -4886,9 +4885,8 @@ supportable_widening_operation (enum tre
return false;
vec_mode = TYPE_MODE (vectype);
- if ((icode1 = optab_handler (optab1, vec_mode)->insn_code) == CODE_FOR_nothing
- || (icode2 = optab_handler (optab2, vec_mode)->insn_code)
- == CODE_FOR_nothing)
+ if ((icode1 = OPTAB_HANDLER (optab1, vec_mode)) == CODE_FOR_nothing
+ || (icode2 = OPTAB_HANDLER (optab2, vec_mode)) == CODE_FOR_nothing)
return false;
/* Check if it's a multi-step conversion that can be done using intermediate
@@ -4920,16 +4918,16 @@ supportable_widening_operation (enum tre
optab4 = optab_for_tree_code (c2, intermediate_type, optab_default);
if (!optab3 || !optab4
- || (icode1 = optab1->handlers[(int) prev_mode].insn_code)
- == CODE_FOR_nothing
+ || ((icode1 = OPTAB_HANDLER (optab1, prev_mode))
+ == CODE_FOR_nothing)
|| insn_data[icode1].operand[0].mode != intermediate_mode
- || (icode2 = optab2->handlers[(int) prev_mode].insn_code)
- == CODE_FOR_nothing
+ || ((icode2 = OPTAB_HANDLER (optab2, prev_mode))
+ == CODE_FOR_nothing)
|| insn_data[icode2].operand[0].mode != intermediate_mode
- || (icode1 = optab3->handlers[(int) intermediate_mode].insn_code)
- == CODE_FOR_nothing
- || (icode2 = optab4->handlers[(int) intermediate_mode].insn_code)
- == CODE_FOR_nothing)
+ || ((icode1 = OPTAB_HANDLER (optab3, intermediate_mode))
+ == CODE_FOR_nothing)
+ || ((icode2 = OPTAB_HANDLER (optab4, intermediate_mode))
+ == CODE_FOR_nothing))
return false;
VEC_quick_push (tree, *interm_types, intermediate_type);
@@ -5016,8 +5014,7 @@ supportable_narrowing_operation (enum tr
return false;
vec_mode = TYPE_MODE (vectype);
- if ((icode1 = optab_handler (optab1, vec_mode)->insn_code)
- == CODE_FOR_nothing)
+ if ((icode1 = OPTAB_HANDLER (optab1, vec_mode)) == CODE_FOR_nothing)
return false;
/* Check if it's a multi-step conversion that can be done using intermediate
@@ -5040,12 +5037,11 @@ supportable_narrowing_operation (enum tr
interm_optab = optab_for_tree_code (c1, intermediate_type,
optab_default);
if (!interm_optab
- || (icode1 = optab1->handlers[(int) prev_mode].insn_code)
- == CODE_FOR_nothing
+ || ((icode1 = OPTAB_HANDLER (optab1, prev_mode))
+ == CODE_FOR_nothing)
|| insn_data[icode1].operand[0].mode != intermediate_mode
- || (icode1
- = interm_optab->handlers[(int) intermediate_mode].insn_code)
- == CODE_FOR_nothing)
+ || ((icode1 = OPTAB_HANDLER (interm_optab, intermediate_mode))
+ == CODE_FOR_nothing))
return false;
VEC_quick_push (tree, *interm_types, intermediate_type);
Index: gcc/config/m32c/m32c.c
===================================================================
--- gcc/config/m32c/m32c.c 2010-07-03 18:20:10.000000000 +0100
+++ gcc/config/m32c/m32c.c 2010-07-03 18:32:20.000000000 +0100
@@ -1789,9 +1789,9 @@ m32c_init_libfuncs (void)
the right modes are found. */
if (TARGET_A24)
{
- optab_handler (cstore_optab, QImode)->insn_code = CODE_FOR_cstoreqi4_24;
- optab_handler (cstore_optab, HImode)->insn_code = CODE_FOR_cstorehi4_24;
- optab_handler (cstore_optab, PSImode)->insn_code = CODE_FOR_cstorepsi4_24;
+ SET_OPTAB_HANDLER (cstore_optab, QImode, CODE_FOR_cstoreqi4_24);
+ SET_OPTAB_HANDLER (cstore_optab, HImode, CODE_FOR_cstorehi4_24);
+ SET_OPTAB_HANDLER (cstore_optab, PSImode, CODE_FOR_cstorepsi4_24);
}
}
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c 2010-07-03 18:20:10.000000000 +0100
+++ gcc/config/rs6000/rs6000.c 2010-07-03 18:32:20.000000000 +0100
@@ -3327,8 +3327,7 @@ rs6000_builtin_support_vector_misalignme
if (TARGET_VSX)
{
/* Return if movmisalign pattern is not supported for this mode. */
- if (optab_handler (movmisalign_optab, mode)->insn_code ==
- CODE_FOR_nothing)
+ if (OPTAB_HANDLER (movmisalign_optab, mode) == CODE_FOR_nothing)
return false;
if (misalignment == -1)
@@ -16243,7 +16242,7 @@ rs6000_emit_vector_compare (enum rtx_cod
if (rev_code == UNKNOWN)
return NULL_RTX;
- nor_code = optab_handler (one_cmpl_optab, (int)dmode)->insn_code;
+ nor_code = OPTAB_HANDLER (one_cmpl_optab, dmode);
if (nor_code == CODE_FOR_nothing)
return NULL_RTX;
@@ -16288,7 +16287,7 @@ rs6000_emit_vector_compare (enum rtx_cod
gcc_unreachable ();
}
- ior_code = optab_handler (ior_optab, (int)dmode)->insn_code;
+ ior_code = OPTAB_HANDLER (ior_optab, dmode);
if (ior_code == CODE_FOR_nothing)
return NULL_RTX;
@@ -25641,8 +25640,8 @@ rs6000_emit_madd (rtx dst, rtx m1, rtx m
{
/* For the simple ops, use the generator function, rather than assuming
that the RTL is standard. */
- enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
- enum insn_code acode = optab_handler (add_optab, mode)->insn_code;
+ enum insn_code mcode = OPTAB_HANDLER (smul_optab, mode);
+ enum insn_code acode = OPTAB_HANDLER (add_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
gen_2arg_fn_t gen_add = (gen_2arg_fn_t) GEN_FCN (acode);
rtx mreg = gen_reg_rtx (mode);
@@ -25674,8 +25673,8 @@ rs6000_emit_msub (rtx dst, rtx m1, rtx m
{
/* For the simple ops, use the generator function, rather than assuming
that the RTL is standard. */
- enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
- enum insn_code scode = optab_handler (add_optab, mode)->insn_code;
+ enum insn_code mcode = OPTAB_HANDLER (smul_optab, mode);
+ enum insn_code scode = OPTAB_HANDLER (add_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
gen_2arg_fn_t gen_sub = (gen_2arg_fn_t) GEN_FCN (scode);
rtx mreg = gen_reg_rtx (mode);
@@ -25710,8 +25709,8 @@ rs6000_emit_nmsub (rtx dst, rtx m1, rtx
{
/* For the simple ops, use the generator function, rather than assuming
that the RTL is standard. */
- enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
- enum insn_code scode = optab_handler (sub_optab, mode)->insn_code;
+ enum insn_code mcode = OPTAB_HANDLER (smul_optab, mode);
+ enum insn_code scode = OPTAB_HANDLER (sub_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
gen_2arg_fn_t gen_sub = (gen_2arg_fn_t) GEN_FCN (scode);
rtx mreg = gen_reg_rtx (mode);
@@ -25745,7 +25744,7 @@ rs6000_emit_swdiv_high_precision (rtx ds
{
enum machine_mode mode = GET_MODE (dst);
rtx x0, e0, e1, y1, u0, v0;
- enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code code = OPTAB_HANDLER (smul_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
rtx one = rs6000_load_constant_and_splat (mode, dconst1);
@@ -25783,7 +25782,7 @@ rs6000_emit_swdiv_low_precision (rtx dst
{
enum machine_mode mode = GET_MODE (dst);
rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one;
- enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code code = OPTAB_HANDLER (smul_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
gcc_assert (code != CODE_FOR_nothing);
@@ -25854,7 +25853,7 @@ rs6000_emit_swrsqrt (rtx dst, rtx src)
REAL_VALUE_TYPE dconst3_2;
int i;
rtx halfthree;
- enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code code = OPTAB_HANDLER (smul_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
gcc_assert (code != CODE_FOR_nothing);
Index: gcc/config/spu/spu.c
===================================================================
--- gcc/config/spu/spu.c 2010-07-03 18:20:10.000000000 +0100
+++ gcc/config/spu/spu.c 2010-07-03 18:32:20.000000000 +0100
@@ -1139,7 +1139,7 @@ spu_emit_branch_or_set (int is_set, rtx
if (eq_rtx == 0)
abort ();
emit_insn (eq_rtx);
- ior_code = ior_optab->handlers[(int)comp_mode].insn_code;
+ ior_code = OPTAB_HANDLER (ior_optab, comp_mode);
gcc_assert (ior_code != CODE_FOR_nothing);
emit_insn (GEN_FCN (ior_code)
(compare_result, compare_result, eq_result));
@@ -4588,7 +4588,8 @@ spu_expand_mov (rtx * ops, enum machine_
if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (imode))
{
- enum insn_code icode = convert_optab_handler (trunc_optab, mode, imode)->insn_code;
+ enum insn_code icode = CONVERT_OPTAB_HANDLER (trunc_optab,
+ mode, imode);
emit_insn (GEN_FCN (icode) (ops[0], from));
}
else
@@ -6251,7 +6252,7 @@ spu_emit_vector_compare (enum rtx_code r
{
enum insn_code nor_code;
rtx eq_rtx = spu_emit_vector_compare (EQ, op0, op1, dest_mode);
- nor_code = optab_handler (one_cmpl_optab, (int)dest_mode)->insn_code;
+ nor_code = OPTAB_HANDLER (one_cmpl_optab, dest_mode);
gcc_assert (nor_code != CODE_FOR_nothing);
emit_insn (GEN_FCN (nor_code) (mask, eq_rtx));
if (dmode != dest_mode)
@@ -6286,7 +6287,7 @@ spu_emit_vector_compare (enum rtx_code r
c_rtx = spu_emit_vector_compare (new_code, op0, op1, dest_mode);
eq_rtx = spu_emit_vector_compare (EQ, op0, op1, dest_mode);
- ior_code = optab_handler (ior_optab, (int)dest_mode)->insn_code;
+ ior_code = OPTAB_HANDLER (ior_optab, dest_mode);
gcc_assert (ior_code != CODE_FOR_nothing);
emit_insn (GEN_FCN (ior_code) (mask, c_rtx, eq_rtx));
if (dmode != dest_mode)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [2/3] optabs: Bias optabs by -CODE_FOR_nothing
2010-07-03 17:29 [0/3] Allow optabs to be zero-initialised Richard Sandiford
2010-07-03 17:34 ` [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER Richard Sandiford
@ 2010-07-03 17:44 ` Richard Sandiford
2010-07-04 13:46 ` Richard Sandiford
2010-07-03 17:49 ` [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too Richard Sandiford
2 siblings, 1 reply; 19+ messages in thread
From: Richard Sandiford @ 2010-07-03 17:44 UTC (permalink / raw)
To: gcc-patches
This patch biases the opcode "insn_code" by -CODE_FOR_nothing, so that
optabs without insns have an insn_code of 0. The change incurs an extra
addition when determining which generator function to call, but the
cost is going to be dwarfed by the call and rtx generation.
The change often simplifies the common idiom:
OPTAB_HANDLER (...) ==/!= CODE_FOR_nothing
Bootstrapped & regression-tested on x86_64-linux-gnu. OK to intsall?
Richard
gcc/
* optabs.h (optab_handlers): Change type of insn_code to int.
(OPTAB_HANDLER): Treat the insn_code field as "insn_code -
CODE_FOR_nothing".
(SET_OPTAB_HANDLER, CONVERT_OPTAB_HANDLER): Likewise.
(SET_CONVERT_OPTAB_HANDLER): Likewise.
* optabs.c (optab_table, convert_optab_table): Always zero-initialize.
(init_insn_codes): Zero both the above arrays.
(init_optabs): Never call init_insn_codes first time around.
Index: gcc/optabs.h
===================================================================
--- gcc/optabs.h 2010-07-03 18:32:20.000000000 +0100
+++ gcc/optabs.h 2010-07-03 18:39:10.000000000 +0100
@@ -29,10 +29,6 @@ #define GCC_OPTABS_H
For example, add_optab applies to addition.
- The insn_code slot is the enum insn_code that says how to
- generate an insn for this operation on a particular machine mode.
- It is CODE_FOR_nothing if there is no such insn on the target machine.
-
The `lib_call' slot is the name of the library function that
can be used to perform the operation.
@@ -40,7 +36,10 @@ #define GCC_OPTABS_H
struct optab_handlers
{
- enum insn_code insn_code;
+ /* I - CODE_FOR_nothing, where I is either the insn code of the
+ associated insn generator or CODE_FOR_nothing if there is no such
+ insn on the target machine. */
+ int insn_code;
};
struct optab_d
@@ -783,14 +782,18 @@ extern rtx expand_vec_cond_expr (tree, t
extern rtx expand_vec_shift_expr (sepops, rtx);
#define OPTAB_HANDLER(OPTAB, MODE) \
- ((OPTAB)->handlers[(int) (MODE)].insn_code)
+ ((enum insn_code) ((OPTAB)->handlers[(int) (MODE)].insn_code \
+ + (int) CODE_FOR_nothing))
#define SET_OPTAB_HANDLER(OPTAB, MODE, CODE) \
- ((void) ((OPTAB)->handlers[(int) (MODE)].insn_code = (CODE)))
+ ((void) ((OPTAB)->handlers[(int) (MODE)].insn_code \
+ = (int) (CODE) - (int) CODE_FOR_nothing))
#define CONVERT_OPTAB_HANDLER(OPTAB, MODE, MODE2) \
- ((OPTAB)->handlers[(int) (MODE)][(int) (MODE2)].insn_code)
+ ((enum insn_code) ((OPTAB)->handlers[(int) (MODE)][(int) (MODE2)].insn_code \
+ + (int) CODE_FOR_nothing))
#define SET_CONVERT_OPTAB_HANDLER(OPTAB, MODE, MODE2, CODE) \
- ((void) ((OPTAB)->handlers[(int) (MODE)][(int) (MODE2)].insn_code = (CODE)))
+ ((void) ((OPTAB)->handlers[(int) (MODE)][(int) (MODE2)].insn_code \
+ = (int) (CODE) - (int) CODE_FOR_nothing))
extern rtx optab_libfunc (optab optab, enum machine_mode mode);
extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c 2010-07-03 18:32:20.000000000 +0100
+++ gcc/optabs.c 2010-07-03 18:35:34.000000000 +0100
@@ -53,27 +53,12 @@ Software Foundation; either version 3, o
See expr.h for documentation of these optabs. */
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
-__extension__ struct optab_d optab_table[OTI_MAX]
- = { [0 ... OTI_MAX - 1].handlers[0 ... NUM_MACHINE_MODES - 1].insn_code
- = CODE_FOR_nothing };
-#else
-/* init_insn_codes will do runtime initialization otherwise. */
struct optab_d optab_table[OTI_MAX];
-#endif
rtx libfunc_table[LTI_MAX];
/* Tables of patterns for converting one mode to another. */
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
-__extension__ struct convert_optab_d convert_optab_table[COI_MAX]
- = { [0 ... COI_MAX - 1].handlers[0 ... NUM_MACHINE_MODES - 1]
- [0 ... NUM_MACHINE_MODES - 1].insn_code
- = CODE_FOR_nothing };
-#else
-/* init_convert_optab will do runtime initialization otherwise. */
struct convert_optab_d convert_optab_table[COI_MAX];
-#endif
/* Contains the optab used for each rtx code. */
optab code_to_optab[NUM_RTX_CODE + 1];
@@ -5452,27 +5437,8 @@ have_insn_for (enum rtx_code code, enum
static void
init_insn_codes (void)
{
- unsigned int i;
-
- for (i = 0; i < (unsigned int) OTI_MAX; i++)
- {
- unsigned int j;
- optab op;
-
- op = &optab_table[i];
- for (j = 0; j < NUM_MACHINE_MODES; j++)
- SET_OPTAB_HANDLER (op, j, CODE_FOR_nothing);
- }
- for (i = 0; i < (unsigned int) COI_MAX; i++)
- {
- unsigned int j, k;
- convert_optab op;
-
- op = &convert_optab_table[i];
- for (j = 0; j < NUM_MACHINE_MODES; j++)
- for (k = 0; k < NUM_MACHINE_MODES; k++)
- SET_CONVERT_OPTAB_HANDLER (op, j, k, CODE_FOR_nothing);
- }
+ memset (optab_table, 0, sizeof (optab_table));
+ memset (convert_optab_table, 0, sizeof (convert_optab_table));
}
/* Initialize OP's code to CODE, and write it into the code_to_optab table. */
@@ -6181,9 +6147,7 @@ set_conv_libfunc (convert_optab optable,
init_optabs (void)
{
unsigned int i;
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
static bool reinit;
-#endif
libfunc_hash = htab_create_ggc (10, hash_libfunc, eq_libfunc, NULL);
/* Start by initializing all tables to contain CODE_FOR_nothing. */
@@ -6199,14 +6163,10 @@ init_optabs (void)
vcondu_gen_code[i] = CODE_FOR_nothing;
}
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
/* We statically initialize the insn_codes with the equivalent of
CODE_FOR_nothing. */
if (reinit)
init_insn_codes ();
-#else
- init_insn_codes ();
-#endif
init_optab (add_optab, PLUS);
init_optabv (addv_optab, PLUS);
@@ -6681,9 +6641,7 @@ init_optabs (void)
/* Allow the target to add more libcalls or rename some, etc. */
targetm.init_libfuncs ();
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
reinit = true;
-#endif
}
/* Print information about the current contents of the optabs on
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
[not found] ` <AANLkTinjMxQLGLg60mau0LpdCA2GnrkI3ZdlQ1pTvoV3@mail.gmail.com>
@ 2010-07-03 17:48 ` Diego Novillo
2010-07-03 17:54 ` Richard Sandiford
0 siblings, 1 reply; 19+ messages in thread
From: Diego Novillo @ 2010-07-03 17:48 UTC (permalink / raw)
To: rdsandiford, gcc-patches
Make them static inline instead of macros?
Diego.
^ permalink raw reply [flat|nested] 19+ messages in thread
* [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too
2010-07-03 17:29 [0/3] Allow optabs to be zero-initialised Richard Sandiford
2010-07-03 17:34 ` [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER Richard Sandiford
2010-07-03 17:44 ` [2/3] optabs: Bias optabs by -CODE_FOR_nothing Richard Sandiford
@ 2010-07-03 17:49 ` Richard Sandiford
2010-07-04 13:50 ` Richard Sandiford
2 siblings, 1 reply; 19+ messages in thread
From: Richard Sandiford @ 2010-07-03 17:49 UTC (permalink / raw)
To: gcc-patches
All conversion optabs are in a single table (convert_optab_table)
and all other libcall-backed optab are in a single table (optab_table).
However, we also have a lot of optabs that are in their own global
variables. This patch lumps them into a third table for "direct" optabs
(i.e. those that are only ever associated with insn patterns,
never with libcalls). They can then "benefit" from the same
encoding as the others.
Bootstrapped & regression-tested on x86_64-linux-gnu. OK to install?
Richard
gcc/
* optabs.h (reload_in_optab, reload_out_optab, code_to_optab)
(vcond_gen_code, vcondu_gen_code, movmem_optab, setmem_optab)
(cmpstr_optab, cmpstrn_optab, cmpmem_optab, sync_add_optab)
(sync_sub_optab, sync_ior_optab, sync_and_optab, sync_xor_optab)
(sync_nand_optab, sync_old_add_optab, sync_old_sub_optab)
(sync_old_ior_optab, sync_old_and_optab, sync_old_xor_optab)
(sync_old_nand_optab, sync_new_add_optab, sync_new_sub_optab)
(sync_new_ior_optab, sync_new_and_optab, sync_new_xor_optab)
(sync_new_nand_optab): Redefine as macros.
(sync_compare_and_swap): Delete.
(sync_lock_test_and_set, sync_lock_release): Likewise.
(direct_optab_index): New enum.
(direct_optab_d): New structure.
(direct_optab): New typedef.
(direct_optab_table): Declare.
(sync_compare_and_swap_optab): New macro.
(sync_lock_test_and_set_optab, sync_lock_release_optab): Likewise.
* optabs.c (direct_optab_table): New variable.
(movcc_gen_code, vcond_gen_code, vcondu_gen_code): Delete.
(prepare_cmp_insn): Use OPTAB_HANDLER for cmpmem_optab,
cmpstr_optab and cmpstrn_optab.
(emit_conditional_move): Likewise for movcc_optab.
(can_conditionally_move_p): Likewise for movcc_gen_code.
(init_insn_codes): Clear direct_optab_table.
(init_optabs): Don't initialize the new "direct optabs" here.
(get_vcond_icode): Use OPTAB_HANDLER for vcondu_gen_code and
vcond_gen_code.
(expand_val_compare_and_swap): Likewise sync_compare_and_swap_optab.
(expand_bool_compare_and_swap): Likewise sync_compare_and_swap_optab.
(expand_compare_and_swap_loop): Likewise sync_compare_and_swap_optab.
(expand_sync_operation): Likewise other sync_*_optabs.
(expand_sync_fetch_operation): Likewise. Rename sync_compare_and_swap
to sync_compare_and_swap_optab.
(expand_sync_lock_test_and_set): Use OPTAB_HANDLER for
sync_lock_test_and_set and sync_compare_and_swap, adding "_optab"
to the names of both.
* builtins.c (expand_builtin_strcmp): Use OPTAB_HANDLER for
cmpstr_optab and cmpstrn_optab.
(expand_builtin_lock_release): Likewise sync_lock_release.
* expr.c (movmem_optab, setmem_optab, cmpstr_optab, cmpstrn_optab)
(cmpmem_optab, sync_add_optab, sync_sub_optab, sync_ior_optab)
(sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab)
(sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab)
(sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab)
(sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab)
(sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap)
(sync_lock_test_and_set, sync_lock_release): Delete.
(emit_block_move_via_movmem): Use OPTAB_HANDLER for movmem_optab.
(emit_block_move_via_setmem): Use OPTAB_HANDLER for setmem_optab.
* genopinit.c (optabs): Use SET_OPTAB_HANDLER for the new
macro optabs.
* omp-low.c (expand_omp_atomic_fetch_op): Update the type of
the "optab" local variable. Use OPTAB_HANDLER for optab and
sync_compare_and_swap_optab.
* reload1.c (reload_in_optab, reload_out_optab): Delete.
* targhooks.c (default_secondary_reload): Use OPTAB_HANDLER for
reload_in_optab and reload_out_optab.
* config/alpha/alpha.c (alpha_secondary_reload): Likewise.
* config/frv/frv.c (frv_alloc_temp_reg): Likewise.
* config/pa/pa.c (pa_secondary_reload): Likewise.
* java/builtins.c (compareAndSwapInt_builtin): Use OPTAB_HANDLER for
sync_compare_and_swap, renaming it to sync_compare_and_swap_optab.
(compareAndSwapLong_builtin, compareAndSwapObject_builtin): Likewise.
(VMSupportsCS8_builtin): Likewise.
Index: gcc/optabs.h
===================================================================
--- gcc/optabs.h 2010-07-03 12:21:31.000000000 +0100
+++ gcc/optabs.h 2010-07-03 12:34:02.000000000 +0100
@@ -595,79 +595,127 @@ #define fractuns_optab (&convert_optab_t
#define satfract_optab (&convert_optab_table[COI_satfract])
#define satfractuns_optab (&convert_optab_table[COI_satfractuns])
-/* These arrays record the insn_code of insns that may be needed to
- perform input and output reloads of special objects. They provide a
- place to pass a scratch register. */
-extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
-extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
-
/* Contains the optab used for each rtx code. */
extern optab code_to_optab[NUM_RTX_CODE + 1];
\f
typedef rtx (*rtxfun) (rtx);
+/* Enumerates operations that have a named .md pattern associated
+ with them, but which are not implemented as library functions. */
+enum direct_optab_index
+{
#ifdef HAVE_conditional_move
-/* Indexed by the machine mode, gives the insn code to make a conditional
- move insn. */
-
-extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
+ /* Conditional move operations. */
+ DOI_movcc,
#endif
-/* Indexed by the machine mode, gives the insn code for vector conditional
- operation. */
-
-extern enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
-extern enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
-
-/* This array records the insn_code of insns to perform block moves. */
-extern enum insn_code movmem_optab[NUM_MACHINE_MODES];
-
-/* This array records the insn_code of insns to perform block sets. */
-extern enum insn_code setmem_optab[NUM_MACHINE_MODES];
-
-/* These arrays record the insn_code of two different kinds of insns
- to perform block compares. */
-extern enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
-extern enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
-extern enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
-
-/* Synchronization primitives. This first set is atomic operation for
- which we don't care about the resulting value. */
-extern enum insn_code sync_add_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_and_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
-
-/* This second set is atomic operations in which we return the value
- that existed in memory before the operation. */
-extern enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
-
-/* This third set is atomic operations in which we return the value
- that resulted after performing the operation. */
-extern enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
+ /* Operations that use a scratch register to perform input and output
+ reloads of special objects. */
+ DOI_reload_in,
+ DOI_reload_out,
+
+ /* Vector conditional operations. */
+ DOI_vcond,
+ DOI_vcondu,
+
+ /* Block move operation. */
+ DOI_movmem,
+
+ /* Block set operation. */
+ DOI_setmem,
+
+ /* Various types of block compare operation. */
+ DOI_cmpstr,
+ DOI_cmpstrn,
+ DOI_cmpmem,
+
+ /* Synchronization primitives. This first set is atomic operation for
+ which we don't care about the resulting value. */
+ DOI_sync_add,
+ DOI_sync_sub,
+ DOI_sync_ior,
+ DOI_sync_and,
+ DOI_sync_xor,
+ DOI_sync_nand,
+
+ /* This second set is atomic operations in which we return the value
+ that existed in memory before the operation. */
+ DOI_sync_old_add,
+ DOI_sync_old_sub,
+ DOI_sync_old_ior,
+ DOI_sync_old_and,
+ DOI_sync_old_xor,
+ DOI_sync_old_nand,
+
+ /* This third set is atomic operations in which we return the value
+ that resulted after performing the operation. */
+ DOI_sync_new_add,
+ DOI_sync_new_sub,
+ DOI_sync_new_ior,
+ DOI_sync_new_and,
+ DOI_sync_new_xor,
+ DOI_sync_new_nand,
+
+ /* Atomic compare and swap. */
+ DOI_sync_compare_and_swap,
+
+ /* Atomic exchange with acquire semantics. */
+ DOI_sync_lock_test_and_set,
+
+ /* Atomic clear with release semantics. */
+ DOI_sync_lock_release,
+
+ DOI_MAX
+};
+
+/* A structure that says which insn should be used to perform an operation
+ in a particular mode. */
+struct direct_optab_d
+{
+ struct optab_handlers handlers[NUM_MACHINE_MODES];
+};
+typedef struct direct_optab_d *direct_optab;
-/* Atomic compare and swap. */
-extern enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
-
-/* Atomic exchange with acquire semantics. */
-extern enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
-
-/* Atomic clear with release semantics. */
-extern enum insn_code sync_lock_release[NUM_MACHINE_MODES];
+extern struct direct_optab_d direct_optab_table[(int) DOI_MAX];
+#ifdef HAVE_conditional_move
+#define movcc_optab (&direct_optab_table[(int) DOI_movcc])
+#endif
+#define reload_in_optab (&direct_optab_table[(int) DOI_reload_in])
+#define reload_out_optab (&direct_optab_table[(int) DOI_reload_out])
+#define vcond_optab (&direct_optab_table[(int) DOI_vcond])
+#define vcondu_optab (&direct_optab_table[(int) DOI_vcondu])
+#define movmem_optab (&direct_optab_table[(int) DOI_movmem])
+#define setmem_optab (&direct_optab_table[(int) DOI_setmem])
+#define cmpstr_optab (&direct_optab_table[(int) DOI_cmpstr])
+#define cmpstrn_optab (&direct_optab_table[(int) DOI_cmpstrn])
+#define cmpmem_optab (&direct_optab_table[(int) DOI_cmpmem])
+#define sync_add_optab (&direct_optab_table[(int) DOI_sync_add])
+#define sync_sub_optab (&direct_optab_table[(int) DOI_sync_sub])
+#define sync_ior_optab (&direct_optab_table[(int) DOI_sync_ior])
+#define sync_and_optab (&direct_optab_table[(int) DOI_sync_and])
+#define sync_xor_optab (&direct_optab_table[(int) DOI_sync_xor])
+#define sync_nand_optab (&direct_optab_table[(int) DOI_sync_nand])
+#define sync_old_add_optab (&direct_optab_table[(int) DOI_sync_old_add])
+#define sync_old_sub_optab (&direct_optab_table[(int) DOI_sync_old_sub])
+#define sync_old_ior_optab (&direct_optab_table[(int) DOI_sync_old_ior])
+#define sync_old_and_optab (&direct_optab_table[(int) DOI_sync_old_and])
+#define sync_old_xor_optab (&direct_optab_table[(int) DOI_sync_old_xor])
+#define sync_old_nand_optab (&direct_optab_table[(int) DOI_sync_old_nand])
+#define sync_new_add_optab (&direct_optab_table[(int) DOI_sync_new_add])
+#define sync_new_sub_optab (&direct_optab_table[(int) DOI_sync_new_sub])
+#define sync_new_ior_optab (&direct_optab_table[(int) DOI_sync_new_ior])
+#define sync_new_and_optab (&direct_optab_table[(int) DOI_sync_new_and])
+#define sync_new_xor_optab (&direct_optab_table[(int) DOI_sync_new_xor])
+#define sync_new_nand_optab (&direct_optab_table[(int) DOI_sync_new_nand])
+#define sync_compare_and_swap_optab \
+ (&direct_optab_table[(int) DOI_sync_compare_and_swap])
+#define sync_lock_test_and_set_optab \
+ (&direct_optab_table[(int) DOI_sync_lock_test_and_set])
+#define sync_lock_release_optab \
+ (&direct_optab_table[(int) DOI_sync_lock_release])
+\f
/* Define functions given in optabs.c. */
extern rtx expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op,
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/optabs.c 2010-07-03 12:22:21.000000000 +0100
@@ -60,24 +60,13 @@ struct optab_d optab_table[OTI_MAX];
/* Tables of patterns for converting one mode to another. */
struct convert_optab_d convert_optab_table[COI_MAX];
+/* Tables of patterns for direct optabs (i.e. those which cannot be
+ implement using a libcall). */
+struct direct_optab_d direct_optab_table[(int) DOI_MAX];
+
/* Contains the optab used for each rtx code. */
optab code_to_optab[NUM_RTX_CODE + 1];
-#ifdef HAVE_conditional_move
-/* Indexed by the machine mode, gives the insn code to make a conditional
- move insn. This is not indexed by the rtx-code like bcc_gen_fctn and
- setcc_gen_code to cut down on the number of named patterns. Consider a day
- when a lot more rtx codes are conditional (eg: for the ARM). */
-
-enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
-#endif
-
-/* Indexed by the machine mode, gives the insn code for vector conditional
- operation. */
-
-enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
-enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
-
static void prepare_float_lib_cmp (rtx, rtx, enum rtx_code, rtx *,
enum machine_mode *);
static rtx expand_unop_direct (enum machine_mode, optab, rtx, rtx, int);
@@ -4071,11 +4060,11 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx
cmp_mode != VOIDmode;
cmp_mode = GET_MODE_WIDER_MODE (cmp_mode))
{
- cmp_code = cmpmem_optab[cmp_mode];
+ cmp_code = OPTAB_HANDLER (cmpmem_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
- cmp_code = cmpstr_optab[cmp_mode];
+ cmp_code = OPTAB_HANDLER (cmpstr_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
- cmp_code = cmpstrn_optab[cmp_mode];
+ cmp_code = OPTAB_HANDLER (cmpstrn_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
continue;
@@ -4520,7 +4509,7 @@ emit_conditional_move (rtx target, enum
if (mode == VOIDmode)
mode = GET_MODE (op2);
- icode = movcc_gen_code[mode];
+ icode = OPTAB_HANDLER (movcc_optab, mode);
if (icode == CODE_FOR_nothing)
return 0;
@@ -4593,7 +4582,7 @@ emit_conditional_move (rtx target, enum
int
can_conditionally_move_p (enum machine_mode mode)
{
- if (movcc_gen_code[mode] != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (movcc_optab, mode) != CODE_FOR_nothing)
return 1;
return 0;
@@ -5439,6 +5428,7 @@ init_insn_codes (void)
{
memset (optab_table, 0, sizeof (optab_table));
memset (convert_optab_table, 0, sizeof (convert_optab_table));
+ memset (direct_optab_table, 0, sizeof (direct_optab_table));
}
/* Initialize OP's code to CODE, and write it into the code_to_optab table. */
@@ -6146,25 +6136,12 @@ set_conv_libfunc (convert_optab optable,
void
init_optabs (void)
{
- unsigned int i;
static bool reinit;
libfunc_hash = htab_create_ggc (10, hash_libfunc, eq_libfunc, NULL);
- /* Start by initializing all tables to contain CODE_FOR_nothing. */
-
-#ifdef HAVE_conditional_move
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- movcc_gen_code[i] = CODE_FOR_nothing;
-#endif
-
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- vcond_gen_code[i] = CODE_FOR_nothing;
- vcondu_gen_code[i] = CODE_FOR_nothing;
- }
/* We statically initialize the insn_codes with the equivalent of
- CODE_FOR_nothing. */
+ CODE_FOR_nothing. Repeat the process if reinitialising. */
if (reinit)
init_insn_codes ();
@@ -6357,39 +6334,6 @@ init_optabs (void)
init_convert_optab (satfract_optab, SAT_FRACT);
init_convert_optab (satfractuns_optab, UNSIGNED_SAT_FRACT);
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- movmem_optab[i] = CODE_FOR_nothing;
- cmpstr_optab[i] = CODE_FOR_nothing;
- cmpstrn_optab[i] = CODE_FOR_nothing;
- cmpmem_optab[i] = CODE_FOR_nothing;
- setmem_optab[i] = CODE_FOR_nothing;
-
- sync_add_optab[i] = CODE_FOR_nothing;
- sync_sub_optab[i] = CODE_FOR_nothing;
- sync_ior_optab[i] = CODE_FOR_nothing;
- sync_and_optab[i] = CODE_FOR_nothing;
- sync_xor_optab[i] = CODE_FOR_nothing;
- sync_nand_optab[i] = CODE_FOR_nothing;
- sync_old_add_optab[i] = CODE_FOR_nothing;
- sync_old_sub_optab[i] = CODE_FOR_nothing;
- sync_old_ior_optab[i] = CODE_FOR_nothing;
- sync_old_and_optab[i] = CODE_FOR_nothing;
- sync_old_xor_optab[i] = CODE_FOR_nothing;
- sync_old_nand_optab[i] = CODE_FOR_nothing;
- sync_new_add_optab[i] = CODE_FOR_nothing;
- sync_new_sub_optab[i] = CODE_FOR_nothing;
- sync_new_ior_optab[i] = CODE_FOR_nothing;
- sync_new_and_optab[i] = CODE_FOR_nothing;
- sync_new_xor_optab[i] = CODE_FOR_nothing;
- sync_new_nand_optab[i] = CODE_FOR_nothing;
- sync_compare_and_swap[i] = CODE_FOR_nothing;
- sync_lock_test_and_set[i] = CODE_FOR_nothing;
- sync_lock_release[i] = CODE_FOR_nothing;
-
- reload_in_optab[i] = reload_out_optab[i] = CODE_FOR_nothing;
- }
-
/* Fill in the optabs with the insns we support. */
init_all_optabs ();
@@ -6845,9 +6789,9 @@ get_vcond_icode (tree type, enum machine
enum insn_code icode = CODE_FOR_nothing;
if (TYPE_UNSIGNED (type))
- icode = vcondu_gen_code[mode];
+ icode = OPTAB_HANDLER (vcondu_optab, mode);
else
- icode = vcond_gen_code[mode];
+ icode = OPTAB_HANDLER (vcond_optab, mode);
return icode;
}
@@ -6945,7 +6889,7 @@ expand_val_compare_and_swap_1 (rtx mem,
expand_val_compare_and_swap (rtx mem, rtx old_val, rtx new_val, rtx target)
{
enum machine_mode mode = GET_MODE (mem);
- enum insn_code icode = sync_compare_and_swap[mode];
+ enum insn_code icode = OPTAB_HANDLER (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return NULL_RTX;
@@ -6982,7 +6926,7 @@ expand_bool_compare_and_swap (rtx mem, r
/* If the target supports a compare-and-swap pattern that simultaneously
sets some flag for success, then use it. Otherwise use the regular
compare-and-swap and follow that immediately with a compare insn. */
- icode = sync_compare_and_swap[mode];
+ icode = OPTAB_HANDLER (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return NULL_RTX;
@@ -7060,7 +7004,7 @@ expand_compare_and_swap_loop (rtx mem, r
/* If the target supports a compare-and-swap pattern that simultaneously
sets some flag for success, then use it. Otherwise use the regular
compare-and-swap and follow that immediately with a compare insn. */
- icode = sync_compare_and_swap[mode];
+ icode = OPTAB_HANDLER (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return false;
@@ -7104,26 +7048,26 @@ expand_sync_operation (rtx mem, rtx val,
switch (code)
{
case PLUS:
- icode = sync_add_optab[mode];
+ icode = OPTAB_HANDLER (sync_add_optab, mode);
break;
case IOR:
- icode = sync_ior_optab[mode];
+ icode = OPTAB_HANDLER (sync_ior_optab, mode);
break;
case XOR:
- icode = sync_xor_optab[mode];
+ icode = OPTAB_HANDLER (sync_xor_optab, mode);
break;
case AND:
- icode = sync_and_optab[mode];
+ icode = OPTAB_HANDLER (sync_and_optab, mode);
break;
case NOT:
- icode = sync_nand_optab[mode];
+ icode = OPTAB_HANDLER (sync_nand_optab, mode);
break;
case MINUS:
- icode = sync_sub_optab[mode];
+ icode = OPTAB_HANDLER (sync_sub_optab, mode);
if (icode == CODE_FOR_nothing || CONST_INT_P (val))
{
- icode = sync_add_optab[mode];
+ icode = OPTAB_HANDLER (sync_add_optab, mode);
if (icode != CODE_FOR_nothing)
{
val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
@@ -7154,7 +7098,7 @@ expand_sync_operation (rtx mem, rtx val,
/* Failing that, generate a compare-and-swap loop in which we perform the
operation with normal arithmetic instructions. */
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, mode) != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (mode), t1;
@@ -7199,34 +7143,34 @@ expand_sync_fetch_operation (rtx mem, rt
switch (code)
{
case PLUS:
- old_code = sync_old_add_optab[mode];
- new_code = sync_new_add_optab[mode];
+ old_code = OPTAB_HANDLER (sync_old_add_optab, mode);
+ new_code = OPTAB_HANDLER (sync_new_add_optab, mode);
break;
case IOR:
- old_code = sync_old_ior_optab[mode];
- new_code = sync_new_ior_optab[mode];
+ old_code = OPTAB_HANDLER (sync_old_ior_optab, mode);
+ new_code = OPTAB_HANDLER (sync_new_ior_optab, mode);
break;
case XOR:
- old_code = sync_old_xor_optab[mode];
- new_code = sync_new_xor_optab[mode];
+ old_code = OPTAB_HANDLER (sync_old_xor_optab, mode);
+ new_code = OPTAB_HANDLER (sync_new_xor_optab, mode);
break;
case AND:
- old_code = sync_old_and_optab[mode];
- new_code = sync_new_and_optab[mode];
+ old_code = OPTAB_HANDLER (sync_old_and_optab, mode);
+ new_code = OPTAB_HANDLER (sync_new_and_optab, mode);
break;
case NOT:
- old_code = sync_old_nand_optab[mode];
- new_code = sync_new_nand_optab[mode];
+ old_code = OPTAB_HANDLER (sync_old_nand_optab, mode);
+ new_code = OPTAB_HANDLER (sync_new_nand_optab, mode);
break;
case MINUS:
- old_code = sync_old_sub_optab[mode];
- new_code = sync_new_sub_optab[mode];
+ old_code = OPTAB_HANDLER (sync_old_sub_optab, mode);
+ new_code = OPTAB_HANDLER (sync_new_sub_optab, mode);
if ((old_code == CODE_FOR_nothing && new_code == CODE_FOR_nothing)
|| CONST_INT_P (val))
{
- old_code = sync_old_add_optab[mode];
- new_code = sync_new_add_optab[mode];
+ old_code = OPTAB_HANDLER (sync_old_add_optab, mode);
+ new_code = OPTAB_HANDLER (sync_new_add_optab, mode);
if (old_code != CODE_FOR_nothing || new_code != CODE_FOR_nothing)
{
val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
@@ -7316,7 +7260,7 @@ expand_sync_fetch_operation (rtx mem, rt
/* Failing that, generate a compare-and-swap loop in which we perform the
operation with normal arithmetic instructions. */
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, mode) != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (mode), t1;
@@ -7365,7 +7309,7 @@ expand_sync_lock_test_and_set (rtx mem,
rtx insn;
/* If the target supports the test-and-set directly, great. */
- icode = sync_lock_test_and_set[mode];
+ icode = OPTAB_HANDLER (sync_lock_test_and_set_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (!target || !insn_data[icode].operand[0].predicate (target, mode))
@@ -7385,7 +7329,7 @@ expand_sync_lock_test_and_set (rtx mem,
}
/* Otherwise, use a compare-and-swap loop for the exchange. */
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, mode) != CODE_FOR_nothing)
{
if (!target || !register_operand (target, mode))
target = gen_reg_rtx (mode);
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/builtins.c 2010-07-03 12:22:21.000000000 +0100
@@ -4109,8 +4109,8 @@ expand_builtin_strcmp (tree exp, ATTRIBU
return NULL_RTX;
#if defined HAVE_cmpstrsi || defined HAVE_cmpstrnsi
- if (cmpstr_optab[SImode] != CODE_FOR_nothing
- || cmpstrn_optab[SImode] != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (cmpstr_optab, SImode) != CODE_FOR_nothing
+ || OPTAB_HANDLER (cmpstrn_optab, SImode) != CODE_FOR_nothing)
{
rtx arg1_rtx, arg2_rtx;
rtx result, insn = NULL_RTX;
@@ -5677,7 +5677,7 @@ expand_builtin_lock_release (enum machin
mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
/* If there is an explicit operation in the md file, use it. */
- icode = sync_lock_release[mode];
+ icode = OPTAB_HANDLER (sync_lock_release_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (!insn_data[icode].operand[1].predicate (val, mode))
Index: gcc/expr.c
===================================================================
--- gcc/expr.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/expr.c 2010-07-03 12:22:21.000000000 +0100
@@ -201,41 +201,6 @@ #define STORE_BY_PIECES_P(SIZE, ALIGN) \
< (unsigned int) MOVE_RATIO (optimize_insn_for_speed_p ()))
#endif
-/* This array records the insn_code of insns to perform block moves. */
-enum insn_code movmem_optab[NUM_MACHINE_MODES];
-
-/* This array records the insn_code of insns to perform block sets. */
-enum insn_code setmem_optab[NUM_MACHINE_MODES];
-
-/* These arrays record the insn_code of three different kinds of insns
- to perform block compares. */
-enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
-enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
-enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
-
-/* Synchronization primitives. */
-enum insn_code sync_add_optab[NUM_MACHINE_MODES];
-enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
-enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
-enum insn_code sync_and_optab[NUM_MACHINE_MODES];
-enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
-enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
-enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
-enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
-enum insn_code sync_lock_release[NUM_MACHINE_MODES];
-
/* SLOW_UNALIGNED_ACCESS is nonzero if unaligned accesses are very slow. */
#ifndef SLOW_UNALIGNED_ACCESS
@@ -1315,7 +1280,7 @@ emit_block_move_via_movmem (rtx x, rtx y
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- enum insn_code code = movmem_optab[(int) mode];
+ enum insn_code code = OPTAB_HANDLER (movmem_optab, mode);
insn_operand_predicate_fn pred;
if (code != CODE_FOR_nothing
@@ -2791,7 +2756,7 @@ set_storage_via_setmem (rtx object, rtx
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- enum insn_code code = setmem_optab[(int) mode];
+ enum insn_code code = OPTAB_HANDLER (setmem_optab, mode);
insn_operand_predicate_fn pred;
if (code != CODE_FOR_nothing
Index: gcc/genopinit.c
===================================================================
--- gcc/genopinit.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/genopinit.c 2010-07-03 12:22:21.000000000 +0100
@@ -200,40 +200,40 @@ static const char * const optabs[] =
"SET_OPTAB_HANDLER (movmisalign_optab, $A, CODE_FOR_$(movmisalign$a$))",
"SET_OPTAB_HANDLER (storent_optab, $A, CODE_FOR_$(storent$a$))",
"SET_OPTAB_HANDLER (addcc_optab, $A, CODE_FOR_$(add$acc$))",
- "movcc_gen_code[$A] = CODE_FOR_$(mov$acc$)",
+ "SET_OPTAB_HANDLER (movcc_optab, $A, CODE_FOR_$(mov$acc$))",
"SET_OPTAB_HANDLER (cbranch_optab, $A, CODE_FOR_$(cbranch$a4$))",
"SET_OPTAB_HANDLER (cmov_optab, $A, CODE_FOR_$(cmov$a6$))",
"SET_OPTAB_HANDLER (cstore_optab, $A, CODE_FOR_$(cstore$a4$))",
"SET_OPTAB_HANDLER (ctrap_optab, $A, CODE_FOR_$(ctrap$a4$))",
"SET_OPTAB_HANDLER (push_optab, $A, CODE_FOR_$(push$a1$))",
- "reload_in_optab[$A] = CODE_FOR_$(reload_in$a$)",
- "reload_out_optab[$A] = CODE_FOR_$(reload_out$a$)",
- "movmem_optab[$A] = CODE_FOR_$(movmem$a$)",
- "cmpstr_optab[$A] = CODE_FOR_$(cmpstr$a$)",
- "cmpstrn_optab[$A] = CODE_FOR_$(cmpstrn$a$)",
- "cmpmem_optab[$A] = CODE_FOR_$(cmpmem$a$)",
- "setmem_optab[$A] = CODE_FOR_$(setmem$a$)",
- "sync_add_optab[$A] = CODE_FOR_$(sync_add$I$a$)",
- "sync_sub_optab[$A] = CODE_FOR_$(sync_sub$I$a$)",
- "sync_ior_optab[$A] = CODE_FOR_$(sync_ior$I$a$)",
- "sync_and_optab[$A] = CODE_FOR_$(sync_and$I$a$)",
- "sync_xor_optab[$A] = CODE_FOR_$(sync_xor$I$a$)",
- "sync_nand_optab[$A] = CODE_FOR_$(sync_nand$I$a$)",
- "sync_old_add_optab[$A] = CODE_FOR_$(sync_old_add$I$a$)",
- "sync_old_sub_optab[$A] = CODE_FOR_$(sync_old_sub$I$a$)",
- "sync_old_ior_optab[$A] = CODE_FOR_$(sync_old_ior$I$a$)",
- "sync_old_and_optab[$A] = CODE_FOR_$(sync_old_and$I$a$)",
- "sync_old_xor_optab[$A] = CODE_FOR_$(sync_old_xor$I$a$)",
- "sync_old_nand_optab[$A] = CODE_FOR_$(sync_old_nand$I$a$)",
- "sync_new_add_optab[$A] = CODE_FOR_$(sync_new_add$I$a$)",
- "sync_new_sub_optab[$A] = CODE_FOR_$(sync_new_sub$I$a$)",
- "sync_new_ior_optab[$A] = CODE_FOR_$(sync_new_ior$I$a$)",
- "sync_new_and_optab[$A] = CODE_FOR_$(sync_new_and$I$a$)",
- "sync_new_xor_optab[$A] = CODE_FOR_$(sync_new_xor$I$a$)",
- "sync_new_nand_optab[$A] = CODE_FOR_$(sync_new_nand$I$a$)",
- "sync_compare_and_swap[$A] = CODE_FOR_$(sync_compare_and_swap$I$a$)",
- "sync_lock_test_and_set[$A] = CODE_FOR_$(sync_lock_test_and_set$I$a$)",
- "sync_lock_release[$A] = CODE_FOR_$(sync_lock_release$I$a$)",
+ "SET_OPTAB_HANDLER (reload_in_optab, $A, CODE_FOR_$(reload_in$a$))",
+ "SET_OPTAB_HANDLER (reload_out_optab, $A, CODE_FOR_$(reload_out$a$))",
+ "SET_OPTAB_HANDLER (movmem_optab, $A, CODE_FOR_$(movmem$a$))",
+ "SET_OPTAB_HANDLER (cmpstr_optab, $A, CODE_FOR_$(cmpstr$a$))",
+ "SET_OPTAB_HANDLER (cmpstrn_optab, $A, CODE_FOR_$(cmpstrn$a$))",
+ "SET_OPTAB_HANDLER (cmpmem_optab, $A, CODE_FOR_$(cmpmem$a$))",
+ "SET_OPTAB_HANDLER (setmem_optab, $A, CODE_FOR_$(setmem$a$))",
+ "SET_OPTAB_HANDLER (sync_add_optab, $A, CODE_FOR_$(sync_add$I$a$))",
+ "SET_OPTAB_HANDLER (sync_sub_optab, $A, CODE_FOR_$(sync_sub$I$a$))",
+ "SET_OPTAB_HANDLER (sync_ior_optab, $A, CODE_FOR_$(sync_ior$I$a$))",
+ "SET_OPTAB_HANDLER (sync_and_optab, $A, CODE_FOR_$(sync_and$I$a$))",
+ "SET_OPTAB_HANDLER (sync_xor_optab, $A, CODE_FOR_$(sync_xor$I$a$))",
+ "SET_OPTAB_HANDLER (sync_nand_optab, $A, CODE_FOR_$(sync_nand$I$a$))",
+ "SET_OPTAB_HANDLER (sync_old_add_optab, $A, CODE_FOR_$(sync_old_add$I$a$))",
+ "SET_OPTAB_HANDLER (sync_old_sub_optab, $A, CODE_FOR_$(sync_old_sub$I$a$))",
+ "SET_OPTAB_HANDLER (sync_old_ior_optab, $A, CODE_FOR_$(sync_old_ior$I$a$))",
+ "SET_OPTAB_HANDLER (sync_old_and_optab, $A, CODE_FOR_$(sync_old_and$I$a$))",
+ "SET_OPTAB_HANDLER (sync_old_xor_optab, $A, CODE_FOR_$(sync_old_xor$I$a$))",
+ "SET_OPTAB_HANDLER (sync_old_nand_optab, $A, CODE_FOR_$(sync_old_nand$I$a$))",
+ "SET_OPTAB_HANDLER (sync_new_add_optab, $A, CODE_FOR_$(sync_new_add$I$a$))",
+ "SET_OPTAB_HANDLER (sync_new_sub_optab, $A, CODE_FOR_$(sync_new_sub$I$a$))",
+ "SET_OPTAB_HANDLER (sync_new_ior_optab, $A, CODE_FOR_$(sync_new_ior$I$a$))",
+ "SET_OPTAB_HANDLER (sync_new_and_optab, $A, CODE_FOR_$(sync_new_and$I$a$))",
+ "SET_OPTAB_HANDLER (sync_new_xor_optab, $A, CODE_FOR_$(sync_new_xor$I$a$))",
+ "SET_OPTAB_HANDLER (sync_new_nand_optab, $A, CODE_FOR_$(sync_new_nand$I$a$))",
+ "SET_OPTAB_HANDLER (sync_compare_and_swap_optab, $A, CODE_FOR_$(sync_compare_and_swap$I$a$))",
+ "SET_OPTAB_HANDLER (sync_lock_test_and_set_optab, $A, CODE_FOR_$(sync_lock_test_and_set$I$a$))",
+ "SET_OPTAB_HANDLER (sync_lock_release_optab, $A, CODE_FOR_$(sync_lock_release$I$a$))",
"SET_OPTAB_HANDLER (vec_set_optab, $A, CODE_FOR_$(vec_set$a$))",
"SET_OPTAB_HANDLER (vec_extract_optab, $A, CODE_FOR_$(vec_extract$a$))",
"SET_OPTAB_HANDLER (vec_extract_even_optab, $A, CODE_FOR_$(vec_extract_even$a$))",
@@ -244,8 +244,8 @@ static const char * const optabs[] =
"SET_OPTAB_HANDLER (vec_shl_optab, $A, CODE_FOR_$(vec_shl_$a$))",
"SET_OPTAB_HANDLER (vec_shr_optab, $A, CODE_FOR_$(vec_shr_$a$))",
"SET_OPTAB_HANDLER (vec_realign_load_optab, $A, CODE_FOR_$(vec_realign_load_$a$))",
- "vcond_gen_code[$A] = CODE_FOR_$(vcond$a$)",
- "vcondu_gen_code[$A] = CODE_FOR_$(vcondu$a$)",
+ "SET_OPTAB_HANDLER (vcond_optab, $A, CODE_FOR_$(vcond$a$))",
+ "SET_OPTAB_HANDLER (vcondu_optab, $A, CODE_FOR_$(vcondu$a$))",
"SET_OPTAB_HANDLER (ssum_widen_optab, $A, CODE_FOR_$(widen_ssum$I$a3$))",
"SET_OPTAB_HANDLER (usum_widen_optab, $A, CODE_FOR_$(widen_usum$I$a3$))",
"SET_OPTAB_HANDLER (udot_prod_optab, $A, CODE_FOR_$(udot_prod$I$a$))",
Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/omp-low.c 2010-07-03 12:22:21.000000000 +0100
@@ -4918,7 +4918,7 @@ expand_omp_atomic_fetch_op (basic_block
{
enum built_in_function base;
tree decl, itype, call;
- enum insn_code *optab;
+ direct_optab optab;
tree rhs;
basic_block store_bb = single_succ (load_bb);
gimple_stmt_iterator gsi;
@@ -4990,7 +4990,7 @@ expand_omp_atomic_fetch_op (basic_block
decl = built_in_decls[base + index + 1];
itype = TREE_TYPE (TREE_TYPE (decl));
- if (optab[TYPE_MODE (itype)] == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (optab, TYPE_MODE (itype)) == CODE_FOR_nothing)
return false;
gsi = gsi_last_bb (load_bb);
@@ -5042,7 +5042,8 @@ expand_omp_atomic_pipeline (basic_block
type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
itype = TREE_TYPE (TREE_TYPE (cmpxchg));
- if (sync_compare_and_swap[TYPE_MODE (itype)] == CODE_FOR_nothing)
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, TYPE_MODE (itype))
+ == CODE_FOR_nothing)
return false;
/* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/reload1.c 2010-07-03 12:22:21.000000000 +0100
@@ -275,12 +275,6 @@ VEC(rtx,gc) *reg_equiv_memory_loc_vec;
Required by some machines to handle any generated moves differently. */
int reload_in_progress = 0;
-/* These arrays record the insn_code of insns that may be needed to
- perform input and output reloads of special objects. They provide a
- place to pass a scratch register. */
-enum insn_code reload_in_optab[NUM_MACHINE_MODES];
-enum insn_code reload_out_optab[NUM_MACHINE_MODES];
-
/* This obstack is used for allocation of rtl during register elimination.
The allocated storage can be freed once find_reloads has processed the
insn. */
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/targhooks.c 2010-07-03 12:22:21.000000000 +0100
@@ -846,8 +846,9 @@ default_secondary_reload (bool in_p ATTR
#endif
if (rclass != NO_REGS)
{
- enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
- : reload_out_optab[(int) reload_mode]);
+ enum insn_code icode = (in_p
+ ? OPTAB_HANDLER (reload_in_optab, reload_mode)
+ : OPTAB_HANDLER (reload_out_optab, reload_mode));
if (icode != CODE_FOR_nothing
&& insn_data[(int) icode].operand[in_p].predicate
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/config/alpha/alpha.c 2010-07-03 12:22:21.000000000 +0100
@@ -1584,10 +1584,10 @@ alpha_secondary_reload (bool in_p, rtx x
if (in_p)
{
if (!aligned_memory_operand (x, mode))
- sri->icode = reload_in_optab[mode];
+ sri->icode = OPTAB_HANDLER (reload_in_optab, mode);
}
else
- sri->icode = reload_out_optab[mode];
+ sri->icode = OPTAB_HANDLER (reload_out_optab, mode);
return NO_REGS;
}
}
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/config/frv/frv.c 2010-07-03 12:22:21.000000000 +0100
@@ -6510,8 +6510,9 @@ frv_secondary_reload (bool in_p, rtx x,
if (rclass != NO_REGS)
{
- enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
- : reload_out_optab[(int) reload_mode]);
+ enum insn_code icode = (in_p
+ ? OPTAB_HANDLER (reload_in_optab, reload_mode)
+ : OPTAB_HANDLER (reload_out_optab, reload_mode));
if (icode == 0)
{
/* This happens when then the reload_[in|out]_optabs have
Index: gcc/config/pa/pa.c
===================================================================
--- gcc/config/pa/pa.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/config/pa/pa.c 2010-07-03 12:22:21.000000000 +0100
@@ -5767,7 +5767,9 @@ pa_secondary_reload (bool in_p, rtx x, r
/* Request a secondary reload with a general scratch register
for everthing else. ??? Could symbolic operands be handled
directly when generating non-pic PA 2.0 code? */
- sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
+ sri->icode = (in_p
+ ? OPTAB_HANDLER (reload_in_optab, mode)
+ : OPTAB_HANDLER (reload_out_optab, mode));
return NO_REGS;
}
@@ -5775,7 +5777,9 @@ pa_secondary_reload (bool in_p, rtx x, r
and anything other than a general register. */
if (rclass == SHIFT_REGS && (regno <= 0 || regno >= 32))
{
- sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
+ sri->icode = (in_p
+ ? OPTAB_HANDLER (reload_in_optab, mode)
+ : OPTAB_HANDLER (reload_out_optab, mode));
return NO_REGS;
}
@@ -5785,7 +5789,9 @@ pa_secondary_reload (bool in_p, rtx x, r
&& (REGNO_REG_CLASS (regno) == SHIFT_REGS
&& FP_REG_CLASS_P (rclass)))
{
- sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
+ sri->icode = (in_p
+ ? OPTAB_HANDLER (reload_in_optab, mode)
+ : OPTAB_HANDLER (reload_out_optab, mode));
return NO_REGS;
}
Index: gcc/java/builtins.c
===================================================================
--- gcc/java/builtins.c 2010-07-03 12:21:31.000000000 +0100
+++ gcc/java/builtins.c 2010-07-03 12:22:21.000000000 +0100
@@ -323,7 +323,7 @@ compareAndSwapInt_builtin (tree method_r
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (int_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, mode) != CODE_FOR_nothing
|| flag_use_atomic_builtins)
{
tree addr, stmt;
@@ -344,7 +344,7 @@ compareAndSwapLong_builtin (tree method_
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (long_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, mode) != CODE_FOR_nothing
|| (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (word_mode)
&& flag_use_atomic_builtins))
/* We don't trust flag_use_atomic_builtins for multi-word
@@ -368,7 +368,7 @@ compareAndSwapObject_builtin (tree metho
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (ptr_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, mode) != CODE_FOR_nothing
|| flag_use_atomic_builtins)
{
tree addr, stmt;
@@ -448,7 +448,7 @@ VMSupportsCS8_builtin (tree method_retur
{
enum machine_mode mode = TYPE_MODE (long_type_node);
gcc_assert (method_return_type == boolean_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (OPTAB_HANDLER (sync_compare_and_swap_optab, mode) != CODE_FOR_nothing)
return boolean_true_node;
else
return boolean_false_node;
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 17:48 ` Diego Novillo
@ 2010-07-03 17:54 ` Richard Sandiford
2010-07-03 20:38 ` Diego Novillo
0 siblings, 1 reply; 19+ messages in thread
From: Richard Sandiford @ 2010-07-03 17:54 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches
Diego Novillo <dnovillo@google.com> writes:
> Make them static inline instead of macros?
I wondered about that, and not having a strong feeling either way,
decided to stick with the current macro idiom. Can change if you like.
Richard
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 17:54 ` Richard Sandiford
@ 2010-07-03 20:38 ` Diego Novillo
2010-07-03 21:07 ` Steven Bosscher
2010-07-04 13:41 ` Richard Sandiford
0 siblings, 2 replies; 19+ messages in thread
From: Diego Novillo @ 2010-07-03 20:38 UTC (permalink / raw)
To: Diego Novillo, gcc-patches, rdsandiford
On Saturday, July 3, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> I wondered about that, and not having a strong feeling either way,
> decided to stick with the current macro idiom. Can change if you like.
Yes, please. I would like to eliminate most of the function-like
macros we have. Let the inliner do its job and improve debuggability
by being able to set proper breakpoints.
Thanks. Diego.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 20:38 ` Diego Novillo
@ 2010-07-03 21:07 ` Steven Bosscher
2010-07-03 21:12 ` Manuel López-Ibáñez
2010-07-04 12:59 ` Diego Novillo
2010-07-04 13:41 ` Richard Sandiford
1 sibling, 2 replies; 19+ messages in thread
From: Steven Bosscher @ 2010-07-03 21:07 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches, rdsandiford
On Sat, Jul 3, 2010 at 10:38 PM, Diego Novillo <dnovillo@google.com> wrote:
> On Saturday, July 3, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
>
>> I wondered about that, and not having a strong feeling either way,
>> decided to stick with the current macro idiom. Can change if you like.
>
> Yes, please. I would like to eliminate most of the function-like
> macros we have. Let the inliner do its job and improve debuggability
> by being able to set proper breakpoints.
... and force us to include headers that exposes things that should
not be exposed. See e.g. all GIMPLE static inlines, which force us to
expose the GIMPLE data structures also. And here the obtabs internals
to files that only use obtabs.
I'm not as big a fan of static inline functions for this reason.
Ciao!
Steven
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 21:07 ` Steven Bosscher
@ 2010-07-03 21:12 ` Manuel López-Ibáñez
2010-07-03 21:48 ` Steven Bosscher
2010-07-04 12:59 ` Diego Novillo
1 sibling, 1 reply; 19+ messages in thread
From: Manuel López-Ibáñez @ 2010-07-03 21:12 UTC (permalink / raw)
To: Steven Bosscher; +Cc: Diego Novillo, gcc-patches, rdsandiford
On 3 July 2010 23:07, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Sat, Jul 3, 2010 at 10:38 PM, Diego Novillo <dnovillo@google.com> wrote:
>> On Saturday, July 3, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
>>
>>> I wondered about that, and not having a strong feeling either way,
>>> decided to stick with the current macro idiom. Can change if you like.
>>
>> Yes, please. I would like to eliminate most of the function-like
>> macros we have. Let the inliner do its job and improve debuggability
>> by being able to set proper breakpoints.
>
> ... and force us to include headers that exposes things that should
> not be exposed. See e.g. all GIMPLE static inlines, which force us to
> expose the GIMPLE data structures also. And here the obtabs internals
> to files that only use obtabs.
Why would this be different when using macros?
Cheers,
Manuel.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 21:12 ` Manuel López-Ibáñez
@ 2010-07-03 21:48 ` Steven Bosscher
2010-07-04 8:40 ` Manuel López-Ibáñez
0 siblings, 1 reply; 19+ messages in thread
From: Steven Bosscher @ 2010-07-03 21:48 UTC (permalink / raw)
To: Manuel López-Ibáñez
Cc: Diego Novillo, gcc-patches, rdsandiford
On Sat, Jul 3, 2010 at 11:11 PM, Manuel López-Ibáñez
<lopezibanez@gmail.com> wrote:
> On 3 July 2010 23:07, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>> On Sat, Jul 3, 2010 at 10:38 PM, Diego Novillo <dnovillo@google.com> wrote:
>>> On Saturday, July 3, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
>>>
>>>> I wondered about that, and not having a strong feeling either way,
>>>> decided to stick with the current macro idiom. Can change if you like.
>>>
>>> Yes, please. I would like to eliminate most of the function-like
>>> macros we have. Let the inliner do its job and improve debuggability
>>> by being able to set proper breakpoints.
>>
>> ... and force us to include headers that exposes things that should
>> not be exposed. See e.g. all GIMPLE static inlines, which force us to
>> expose the GIMPLE data structures also. And here the obtabs internals
>> to files that only use obtabs.
>
> Why would this be different when using macros?
Nothing. Just a point against eliminating macros in favor of static
inline functions in general.
I'd argue for functions not static inline, in a .c file, and _really_
let the inliner do its job (with WHOPR).
Ciao!
Steven
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 21:48 ` Steven Bosscher
@ 2010-07-04 8:40 ` Manuel López-Ibáñez
0 siblings, 0 replies; 19+ messages in thread
From: Manuel López-Ibáñez @ 2010-07-04 8:40 UTC (permalink / raw)
To: Steven Bosscher; +Cc: Diego Novillo, gcc-patches, rdsandiford
On 3 July 2010 23:48, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Sat, Jul 3, 2010 at 11:11 PM, Manuel López-Ibáñez
> <lopezibanez@gmail.com> wrote:
>> On 3 July 2010 23:07, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>>> On Sat, Jul 3, 2010 at 10:38 PM, Diego Novillo <dnovillo@google.com> wrote:
>>>> On Saturday, July 3, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
>>>>
>>>>> I wondered about that, and not having a strong feeling either way,
>>>>> decided to stick with the current macro idiom. Can change if you like.
>>>>
>>>> Yes, please. I would like to eliminate most of the function-like
>>>> macros we have. Let the inliner do its job and improve debuggability
>>>> by being able to set proper breakpoints.
>>>
>>> ... and force us to include headers that exposes things that should
>>> not be exposed. See e.g. all GIMPLE static inlines, which force us to
>>> expose the GIMPLE data structures also. And here the obtabs internals
>>> to files that only use obtabs.
>>
>> Why would this be different when using macros?
>
> Nothing. Just a point against eliminating macros in favor of static
> inline functions in general.
>
> I'd argue for functions not static inline, in a .c file, and _really_
> let the inliner do its job (with WHOPR).
Then, the choice should be between functions and static inline
functions (I can see benefits of both), but never macros. It is also
easier to convert a static inline function to a function in a .c file.
Cheers,
Manuel.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 21:07 ` Steven Bosscher
2010-07-03 21:12 ` Manuel López-Ibáñez
@ 2010-07-04 12:59 ` Diego Novillo
2010-07-06 9:46 ` Eric Botcazou
1 sibling, 1 reply; 19+ messages in thread
From: Diego Novillo @ 2010-07-04 12:59 UTC (permalink / raw)
To: Steven Bosscher; +Cc: gcc-patches, rdsandiford
On Saturday, July 3, 2010, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> ... and force us to include headers that exposes things that should
> not be exposed. See e.g. all GIMPLE static inlines, which force us to
> expose the GIMPLE data structures also. And here the obtabs internals
> to files that only use obtabs.
I understand that, but converting them to inline functions is a step
in that direction. As soon as we get bootstraps going with lto
enabled, we can very easily convert them into regular functions.
Diego.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-03 20:38 ` Diego Novillo
2010-07-03 21:07 ` Steven Bosscher
@ 2010-07-04 13:41 ` Richard Sandiford
2010-07-04 13:43 ` Richard Sandiford
2010-07-04 13:45 ` Diego Novillo
1 sibling, 2 replies; 19+ messages in thread
From: Richard Sandiford @ 2010-07-04 13:41 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches
Diego Novillo <dnovillo@google.com> writes:
> On Saturday, July 3, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
>> I wondered about that, and not having a strong feeling either way,
>> decided to stick with the current macro idiom. Can change if you like.
>
> Yes, please. I would like to eliminate most of the function-like
> macros we have. Let the inliner do its job and improve debuggability
> by being able to set proper breakpoints.
OK, here's the updated version. Tested as before. OK to install?
Richard
gcc/
* optabs.h (optab_handler, convert_optab_handler): Delete.
(OPTAB_HANDLER, SET_OPTAB_HANDLER): New macros.
(CONVERT_OPTAB_HANDLER, SET_CONVERT_OPTAB_HANDLER): Likewise.
* builtins.c: Replace optab_handler(X)->insn_code with
OPTAB_HANDLER or SET_OPTAB_HANDLER thoughout. Likewise
convert_optab_handler(X)->insn_code with CONVERT_OPTAB_HANDLER
and SET_CONVERT_OPTAB_HANDLER.
* expmed.c, expr.c, genopinit.c, ifcvt.c, optabs.c, reload.c,
reload1.c, stmt.c, targhooks.c, tree-ssa-loop-prefetch.c,
tree-ssa-math-opts.c, tree-vect-data-refs.c, tree-vect-generic.c,
tree-vect-loop.c, tree-vect-patterns.c, tree-vect-slp.c,
tree-vect-stmts.c, config/m32c/m32c.c, config/rs6000/rs6000.c,
config/spu/spu.c: Likewise.
Index: gcc/optabs.h
===================================================================
--- gcc/optabs.h 2010-07-03 19:20:34.000000000 +0100
+++ gcc/optabs.h 2010-07-03 20:10:49.000000000 +0100
@@ -782,9 +782,43 @@ extern rtx expand_vec_cond_expr (tree, t
/* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */
extern rtx expand_vec_shift_expr (sepops, rtx);
-#define optab_handler(optab,mode) (&(optab)->handlers[(int) (mode)])
-#define convert_optab_handler(optab,mode,mode2) \
- (&(optab)->handlers[(int) (mode)][(int) (mode2)])
+/* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing
+ if the target does not have such an insn. */
+
+static inline enum insn_code
+optab_handler (optab op, enum machine_mode mode)
+{
+ return op->handlers[(int) mode].insn_code;
+}
+
+/* Record that insn CODE should be used to implement mode MODE of OP. */
+
+static inline void
+set_optab_handler (optab op, enum machine_mode mode, enum insn_code code)
+{
+ op->handlers[(int) mode].insn_code = code;
+}
+
+/* Return the insn used to perform conversion OP from mode FROM_MODE
+ to mode TO_MODE; return CODE_FOR_nothing if the target does not have
+ such an insn. */
+
+static inline enum insn_code
+convert_optab_handler (convert_optab op, enum machine_mode to_mode,
+ enum machine_mode from_mode)
+{
+ return op->handlers[(int) to_mode][(int) from_mode].insn_code;
+}
+
+/* Record that insn CODE should be used to perform conversion OP
+ from mode FROM_MODE to mode TO_MODE. */
+
+static inline void
+set_convert_optab_handler (convert_optab op, enum machine_mode to_mode,
+ enum machine_mode from_mode, enum insn_code code)
+{
+ op->handlers[(int) to_mode][(int) from_mode].insn_code = code;
+}
extern rtx optab_libfunc (optab optab, enum machine_mode mode);
extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/builtins.c 2010-07-03 20:10:45.000000000 +0100
@@ -1994,7 +1994,7 @@ expand_builtin_mathfn (tree exp, rtx tar
errno_set = false;
/* Before working hard, check whether the instruction is available. */
- if (optab_handler (builtin_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (builtin_optab, mode) != CODE_FOR_nothing)
{
target = gen_reg_rtx (mode);
@@ -2096,7 +2096,7 @@ expand_builtin_mathfn_2 (tree exp, rtx t
mode = TYPE_MODE (TREE_TYPE (exp));
/* Before working hard, check whether the instruction is available. */
- if (optab_handler (builtin_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (builtin_optab, mode) == CODE_FOR_nothing)
return NULL_RTX;
target = gen_reg_rtx (mode);
@@ -2173,7 +2173,7 @@ expand_builtin_mathfn_3 (tree exp, rtx t
/* Check if sincos insn is available, otherwise fallback
to sin or cos insn. */
- if (optab_handler (builtin_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (builtin_optab, mode) == CODE_FOR_nothing)
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_FLT_FN (BUILT_IN_SIN):
@@ -2185,7 +2185,7 @@ expand_builtin_mathfn_3 (tree exp, rtx t
}
/* Before working hard, check whether the instruction is available. */
- if (optab_handler (builtin_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (builtin_optab, mode) != CODE_FOR_nothing)
{
target = gen_reg_rtx (mode);
@@ -2282,7 +2282,7 @@ interclass_mathfn_icode (tree arg, tree
mode = TYPE_MODE (TREE_TYPE (arg));
if (builtin_optab)
- return optab_handler (builtin_optab, mode)->insn_code;
+ return optab_handler (builtin_optab, mode);
return CODE_FOR_nothing;
}
@@ -2370,7 +2370,7 @@ expand_builtin_sincos (tree exp)
mode = TYPE_MODE (TREE_TYPE (arg));
/* Check if sincos insn is available, otherwise emit the call. */
- if (optab_handler (sincos_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (sincos_optab, mode) == CODE_FOR_nothing)
return NULL_RTX;
target1 = gen_reg_rtx (mode);
@@ -2417,7 +2417,7 @@ expand_builtin_cexpi (tree exp, rtx targ
/* Try expanding via a sincos optab, fall back to emitting a libcall
to sincos or cexp. We are sure we have sincos or cexp because cexpi
is only generated from sincos, cexp or if we have either of them. */
- if (optab_handler (sincos_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (sincos_optab, mode) != CODE_FOR_nothing)
{
op1 = gen_reg_rtx (mode);
op2 = gen_reg_rtx (mode);
@@ -3080,8 +3080,7 @@ expand_builtin_pow (tree exp, rtx target
smaller than pow (x, 1.5) if sqrt will not be expanded
as a call. */
|| (n == 3
- && (optab_handler (sqrt_optab, mode)->insn_code
- != CODE_FOR_nothing))))
+ && optab_handler (sqrt_optab, mode) != CODE_FOR_nothing)))
{
tree call_expr = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 1,
narg0);
@@ -3272,7 +3271,7 @@ expand_builtin_strlen (tree exp, rtx tar
/* Bail out if we can't compute strlen in the right mode. */
while (insn_mode != VOIDmode)
{
- icode = optab_handler (strlen_optab, insn_mode)->insn_code;
+ icode = optab_handler (strlen_optab, insn_mode);
if (icode != CODE_FOR_nothing)
break;
@@ -5308,7 +5307,7 @@ expand_builtin_signbit (tree exp, rtx ta
/* Check if the back end provides an insn that handles signbit for the
argument's mode. */
- icode = signbit_optab->handlers [(int) fmode].insn_code;
+ icode = optab_handler (signbit_optab, fmode);
if (icode != CODE_FOR_nothing)
{
rtx last = get_last_insn ();
Index: gcc/expmed.c
===================================================================
--- gcc/expmed.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/expmed.c 2010-07-03 19:21:15.000000000 +0100
@@ -419,15 +419,14 @@ store_bit_field_1 (rtx str_rtx, unsigned
available. */
if (VECTOR_MODE_P (GET_MODE (op0))
&& !MEM_P (op0)
- && (optab_handler (vec_set_optab, GET_MODE (op0))->insn_code
- != CODE_FOR_nothing)
+ && optab_handler (vec_set_optab, GET_MODE (op0)) != CODE_FOR_nothing
&& fieldmode == GET_MODE_INNER (GET_MODE (op0))
&& bitsize == GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))
&& !(bitnum % GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))))
{
enum machine_mode outermode = GET_MODE (op0);
enum machine_mode innermode = GET_MODE_INNER (outermode);
- int icode = (int) optab_handler (vec_set_optab, outermode)->insn_code;
+ int icode = (int) optab_handler (vec_set_optab, outermode);
int pos = bitnum / GET_MODE_BITSIZE (innermode);
rtx rtxpos = GEN_INT (pos);
rtx src = value;
@@ -533,10 +532,9 @@ store_bit_field_1 (rtx str_rtx, unsigned
if (!MEM_P (op0)
&& (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0)
&& bitsize == GET_MODE_BITSIZE (fieldmode)
- && (optab_handler (movstrict_optab, fieldmode)->insn_code
- != CODE_FOR_nothing))
+ && optab_handler (movstrict_optab, fieldmode) != CODE_FOR_nothing)
{
- int icode = optab_handler (movstrict_optab, fieldmode)->insn_code;
+ int icode = optab_handler (movstrict_optab, fieldmode);
rtx insn;
rtx start = get_last_insn ();
rtx arg0 = op0;
@@ -1253,14 +1251,13 @@ extract_bit_field_1 (rtx str_rtx, unsign
available. */
if (VECTOR_MODE_P (GET_MODE (op0))
&& !MEM_P (op0)
- && (optab_handler (vec_extract_optab, GET_MODE (op0))->insn_code
- != CODE_FOR_nothing)
+ && optab_handler (vec_extract_optab, GET_MODE (op0)) != CODE_FOR_nothing
&& ((bitnum + bitsize - 1) / GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))
== bitnum / GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (op0)))))
{
enum machine_mode outermode = GET_MODE (op0);
enum machine_mode innermode = GET_MODE_INNER (outermode);
- int icode = (int) optab_handler (vec_extract_optab, outermode)->insn_code;
+ int icode = (int) optab_handler (vec_extract_optab, outermode);
unsigned HOST_WIDE_INT pos = bitnum / GET_MODE_BITSIZE (innermode);
rtx rtxpos = GEN_INT (pos);
rtx src = op0;
@@ -3567,7 +3564,7 @@ expand_mult_highpart_optab (enum machine
/* Try widening multiplication. */
moptab = unsignedp ? umul_widen_optab : smul_widen_optab;
- if (optab_handler (moptab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (optab_handler (moptab, wider_mode) != CODE_FOR_nothing
&& mul_widen_cost[speed][wider_mode] < max_cost)
{
tem = expand_binop (wider_mode, moptab, op0, narrow_op1, 0,
@@ -3577,7 +3574,7 @@ expand_mult_highpart_optab (enum machine
}
/* Try widening the mode and perform a non-widening multiplication. */
- if (optab_handler (smul_optab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (optab_handler (smul_optab, wider_mode) != CODE_FOR_nothing
&& size - 1 < BITS_PER_WORD
&& mul_cost[speed][wider_mode] + shift_cost[speed][mode][size-1] < max_cost)
{
@@ -3604,7 +3601,7 @@ expand_mult_highpart_optab (enum machine
/* Try widening multiplication of opposite signedness, and adjust. */
moptab = unsignedp ? smul_widen_optab : umul_widen_optab;
- if (optab_handler (moptab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (optab_handler (moptab, wider_mode) != CODE_FOR_nothing
&& size - 1 < BITS_PER_WORD
&& (mul_widen_cost[speed][wider_mode] + 2 * shift_cost[speed][mode][size-1]
+ 4 * add_cost[speed][mode] < max_cost))
@@ -3726,7 +3723,7 @@ expand_smod_pow2 (enum machine_mode mode
use a LSHIFTRT, 1 ADD, 1 SUB and an AND. */
temp = gen_rtx_LSHIFTRT (mode, result, shift);
- if (optab_handler (lshr_optab, mode)->insn_code == CODE_FOR_nothing
+ if (optab_handler (lshr_optab, mode) == CODE_FOR_nothing
|| rtx_cost (temp, SET, optimize_insn_for_speed_p ()) > COSTS_N_INSNS (2))
{
temp = expand_binop (mode, xor_optab, op0, signmask,
@@ -4030,8 +4027,8 @@ expand_divmod (int rem_flag, enum tree_c
for (compute_mode = mode; compute_mode != VOIDmode;
compute_mode = GET_MODE_WIDER_MODE (compute_mode))
- if (optab_handler (optab1, compute_mode)->insn_code != CODE_FOR_nothing
- || optab_handler (optab2, compute_mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (optab1, compute_mode) != CODE_FOR_nothing
+ || optab_handler (optab2, compute_mode) != CODE_FOR_nothing)
break;
if (compute_mode == VOIDmode)
@@ -4286,11 +4283,11 @@ expand_divmod (int rem_flag, enum tree_c
optab has an expander for this mode. */
&& ((optab_handler ((rem_flag ? smod_optab
: sdiv_optab),
- compute_mode)->insn_code
+ compute_mode)
!= CODE_FOR_nothing)
- || (optab_handler(sdivmod_optab,
- compute_mode)
- ->insn_code != CODE_FOR_nothing)))
+ || (optab_handler (sdivmod_optab,
+ compute_mode)
+ != CODE_FOR_nothing)))
;
else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d))
{
@@ -4302,9 +4299,9 @@ expand_divmod (int rem_flag, enum tree_c
}
if (sdiv_pow2_cheap[speed][compute_mode]
- && ((optab_handler (sdiv_optab, compute_mode)->insn_code
+ && ((optab_handler (sdiv_optab, compute_mode)
!= CODE_FOR_nothing)
- || (optab_handler (sdivmod_optab, compute_mode)->insn_code
+ || (optab_handler (sdivmod_optab, compute_mode)
!= CODE_FOR_nothing)))
quotient = expand_divmod (0, TRUNC_DIV_EXPR,
compute_mode, op0,
@@ -4952,7 +4949,7 @@ expand_divmod (int rem_flag, enum tree_c
= sign_expand_binop (compute_mode, umod_optab, smod_optab,
op0, op1, target,
unsignedp,
- ((optab_handler (optab2, compute_mode)->insn_code
+ ((optab_handler (optab2, compute_mode)
!= CODE_FOR_nothing)
? OPTAB_DIRECT : OPTAB_WIDEN));
if (remainder == 0)
@@ -4980,7 +4977,7 @@ expand_divmod (int rem_flag, enum tree_c
= sign_expand_binop (compute_mode, udiv_optab, sdiv_optab,
op0, op1, rem_flag ? NULL_RTX : target,
unsignedp,
- ((optab_handler (optab2, compute_mode)->insn_code
+ ((optab_handler (optab2, compute_mode)
!= CODE_FOR_nothing)
? OPTAB_DIRECT : OPTAB_WIDEN));
@@ -5479,7 +5476,7 @@ emit_store_flag_1 (rtx target, enum rtx_
compare_mode = GET_MODE_WIDER_MODE (compare_mode))
{
enum machine_mode optab_mode = mclass == MODE_CC ? CCmode : compare_mode;
- icode = optab_handler (cstore_optab, optab_mode)->insn_code;
+ icode = optab_handler (cstore_optab, optab_mode);
if (icode != CODE_FOR_nothing)
{
do_pending_stack_adjust ();
@@ -5674,7 +5671,7 @@ emit_store_flag (rtx target, enum rtx_co
as "-(int)X >> 31" is still cheaper than inverting "(int)X == 0". */
rcode = reverse_condition (code);
if (can_compare_p (rcode, mode, ccp_store_flag)
- && ! (optab_handler (cstore_optab, mode)->insn_code == CODE_FOR_nothing
+ && ! (optab_handler (cstore_optab, mode) == CODE_FOR_nothing
&& code == NE
&& GET_MODE_SIZE (mode) < UNITS_PER_WORD
&& op1 == const0_rtx))
@@ -5773,9 +5770,9 @@ emit_store_flag (rtx target, enum rtx_co
that is compensated by the subsequent overflow when subtracting
one / negating. */
- if (optab_handler (abs_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (abs_optab, mode) != CODE_FOR_nothing)
tem = expand_unop (mode, abs_optab, op0, subtarget, 1);
- else if (optab_handler (ffs_optab, mode)->insn_code != CODE_FOR_nothing)
+ else if (optab_handler (ffs_optab, mode) != CODE_FOR_nothing)
tem = expand_unop (mode, ffs_optab, op0, subtarget, 1);
else if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
{
Index: gcc/expr.c
===================================================================
--- gcc/expr.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/expr.c 2010-07-03 20:10:46.000000000 +0100
@@ -434,7 +434,7 @@ convert_move (rtx to, rtx from, int unsi
/* Try converting directly if the insn is supported. */
- code = convert_optab_handler (tab, to_mode, from_mode)->insn_code;
+ code = convert_optab_handler (tab, to_mode, from_mode);
if (code != CODE_FOR_nothing)
{
emit_unop_insn (code, to, from,
@@ -468,12 +468,12 @@ convert_move (rtx to, rtx from, int unsi
enum machine_mode full_mode
= smallest_mode_for_size (GET_MODE_BITSIZE (to_mode), MODE_INT);
- gcc_assert (convert_optab_handler (trunc_optab, to_mode, full_mode)->insn_code
+ gcc_assert (convert_optab_handler (trunc_optab, to_mode, full_mode)
!= CODE_FOR_nothing);
if (full_mode != from_mode)
from = convert_to_mode (full_mode, from, unsignedp);
- emit_unop_insn (convert_optab_handler (trunc_optab, to_mode, full_mode)->insn_code,
+ emit_unop_insn (convert_optab_handler (trunc_optab, to_mode, full_mode),
to, from, UNKNOWN);
return;
}
@@ -483,18 +483,19 @@ convert_move (rtx to, rtx from, int unsi
enum machine_mode full_mode
= smallest_mode_for_size (GET_MODE_BITSIZE (from_mode), MODE_INT);
- gcc_assert (convert_optab_handler (sext_optab, full_mode, from_mode)->insn_code
+ gcc_assert (convert_optab_handler (sext_optab, full_mode, from_mode)
!= CODE_FOR_nothing);
if (to_mode == full_mode)
{
- emit_unop_insn (convert_optab_handler (sext_optab, full_mode, from_mode)->insn_code,
+ emit_unop_insn (convert_optab_handler (sext_optab, full_mode,
+ from_mode),
to, from, UNKNOWN);
return;
}
new_from = gen_reg_rtx (full_mode);
- emit_unop_insn (convert_optab_handler (sext_optab, full_mode, from_mode)->insn_code,
+ emit_unop_insn (convert_optab_handler (sext_optab, full_mode, from_mode),
new_from, from, UNKNOWN);
/* else proceed to integer conversions below. */
@@ -695,9 +696,10 @@ convert_move (rtx to, rtx from, int unsi
}
/* Support special truncate insns for certain modes. */
- if (convert_optab_handler (trunc_optab, to_mode, from_mode)->insn_code != CODE_FOR_nothing)
+ if (convert_optab_handler (trunc_optab, to_mode,
+ from_mode) != CODE_FOR_nothing)
{
- emit_unop_insn (convert_optab_handler (trunc_optab, to_mode, from_mode)->insn_code,
+ emit_unop_insn (convert_optab_handler (trunc_optab, to_mode, from_mode),
to, from, UNKNOWN);
return;
}
@@ -990,7 +992,7 @@ move_by_pieces (rtx to, rtx from, unsign
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = optab_handler (mov_optab, mode);
if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode))
move_by_pieces_1 (GEN_FCN (icode), mode, &data);
@@ -1071,7 +1073,7 @@ move_by_pieces_ninsns (unsigned HOST_WID
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = optab_handler (mov_optab, mode);
if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode))
n_insns += l / GET_MODE_SIZE (mode), l %= GET_MODE_SIZE (mode);
@@ -2352,7 +2354,7 @@ can_store_by_pieces (unsigned HOST_WIDE_
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = optab_handler (mov_optab, mode);
if (icode != CODE_FOR_nothing
&& align >= GET_MODE_ALIGNMENT (mode))
{
@@ -2565,7 +2567,7 @@ store_by_pieces_1 (struct store_by_piece
if (mode == VOIDmode)
break;
- icode = optab_handler (mov_optab, mode)->insn_code;
+ icode = optab_handler (mov_optab, mode);
if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode))
store_by_pieces_2 (GEN_FCN (icode), mode, data);
@@ -3034,7 +3036,7 @@ emit_move_via_integer (enum machine_mode
return NULL_RTX;
/* The target must support moves in this mode. */
- code = optab_handler (mov_optab, imode)->insn_code;
+ code = optab_handler (mov_optab, imode);
if (code == CODE_FOR_nothing)
return NULL_RTX;
@@ -3184,7 +3186,7 @@ emit_move_complex (enum machine_mode mod
/* Move floating point as parts. */
if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
- && optab_handler (mov_optab, GET_MODE_INNER (mode))->insn_code != CODE_FOR_nothing)
+ && optab_handler (mov_optab, GET_MODE_INNER (mode)) != CODE_FOR_nothing)
try_int = false;
/* Not possible if the values are inherently not adjacent. */
else if (GET_CODE (x) == CONCAT || GET_CODE (y) == CONCAT)
@@ -3235,7 +3237,7 @@ emit_move_ccmode (enum machine_mode mode
/* Assume all MODE_CC modes are equivalent; if we have movcc, use it. */
if (mode != CCmode)
{
- enum insn_code code = optab_handler (mov_optab, CCmode)->insn_code;
+ enum insn_code code = optab_handler (mov_optab, CCmode);
if (code != CODE_FOR_nothing)
{
x = emit_move_change_mode (CCmode, mode, x, true);
@@ -3375,7 +3377,7 @@ emit_move_insn_1 (rtx x, rtx y)
gcc_assert ((unsigned int) mode < (unsigned int) MAX_MACHINE_MODE);
- code = optab_handler (mov_optab, mode)->insn_code;
+ code = optab_handler (mov_optab, mode);
if (code != CODE_FOR_nothing)
return emit_insn (GEN_FCN (code) (x, y));
@@ -3627,7 +3629,7 @@ emit_single_push_insn (enum machine_mode
stack_pointer_delta += PUSH_ROUNDING (GET_MODE_SIZE (mode));
/* If there is push pattern, use it. Otherwise try old way of throwing
MEM representing push operation to move expander. */
- icode = optab_handler (push_optab, mode)->insn_code;
+ icode = optab_handler (push_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (((pred = insn_data[(int) icode].operand[0].predicate)
@@ -4363,7 +4365,7 @@ expand_assignment (tree to, tree from, b
set_mem_attributes (mem, to, 0);
set_mem_addr_space (mem, as);
- icode = movmisalign_optab->handlers[mode].insn_code;
+ icode = optab_handler (movmisalign_optab, mode);
gcc_assert (icode != CODE_FOR_nothing);
op_mode1 = insn_data[icode].operand[1].mode;
@@ -4496,7 +4498,7 @@ expand_assignment (tree to, tree from, b
emit_storent_insn (rtx to, rtx from)
{
enum machine_mode mode = GET_MODE (to), imode;
- enum insn_code code = optab_handler (storent_optab, mode)->insn_code;
+ enum insn_code code = optab_handler (storent_optab, mode);
rtx pattern;
if (code == CODE_FOR_nothing)
@@ -5703,7 +5705,7 @@ store_constructor (tree exp, rtx target,
{
enum machine_mode mode = GET_MODE (target);
- icode = (int) optab_handler (vec_init_optab, mode)->insn_code;
+ icode = (int) optab_handler (vec_init_optab, mode);
if (icode != CODE_FOR_nothing)
{
unsigned int i;
@@ -7704,7 +7706,7 @@ #define REDUCE_BIT_FIELD(expr) (reduce_b
this_optab = usmul_widen_optab;
if (mode == GET_MODE_2XWIDER_MODE (innermode))
{
- if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (this_optab, mode) != CODE_FOR_nothing)
{
if (TYPE_UNSIGNED (TREE_TYPE (treeop0)))
expand_operands (treeop0, treeop1, subtarget, &op0, &op1,
@@ -7730,7 +7732,7 @@ #define REDUCE_BIT_FIELD(expr) (reduce_b
if (mode == GET_MODE_2XWIDER_MODE (innermode))
{
- if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (this_optab, mode) != CODE_FOR_nothing)
{
expand_operands (treeop0, treeop1, NULL_RTX, &op0, &op1,
EXPAND_NORMAL);
@@ -7738,7 +7740,7 @@ #define REDUCE_BIT_FIELD(expr) (reduce_b
unsignedp, this_optab);
return REDUCE_BIT_FIELD (temp);
}
- if (optab_handler (other_optab, mode)->insn_code != CODE_FOR_nothing
+ if (optab_handler (other_optab, mode) != CODE_FOR_nothing
&& innermode == word_mode)
{
rtx htem, hipart;
@@ -8727,7 +8729,7 @@ expand_expr_real_1 (tree exp, rtx target
|| modifier == EXPAND_STACK_PARM);
/* The vectorizer should have already checked the mode. */
- icode = optab_handler (movmisalign_optab, mode)->insn_code;
+ icode = optab_handler (movmisalign_optab, mode);
gcc_assert (icode != CODE_FOR_nothing);
/* We've already validated the memory, and we're creating a
Index: gcc/genopinit.c
===================================================================
--- gcc/genopinit.c 2010-07-03 19:20:34.000000000 +0100
+++ gcc/genopinit.c 2010-07-03 20:10:45.000000000 +0100
@@ -60,152 +60,152 @@ Software Foundation; either version 3, o
upper-case forms of the comparison, respectively. */
static const char * const optabs[] =
-{ "convert_optab_handler (sext_optab, $B, $A)->insn_code = CODE_FOR_$(extend$a$b2$)",
- "convert_optab_handler (zext_optab, $B, $A)->insn_code = CODE_FOR_$(zero_extend$a$b2$)",
- "convert_optab_handler (sfix_optab, $B, $A)->insn_code = CODE_FOR_$(fix$F$a$I$b2$)",
- "convert_optab_handler (ufix_optab, $B, $A)->insn_code = CODE_FOR_$(fixuns$F$a$b2$)",
- "convert_optab_handler (sfixtrunc_optab, $B, $A)->insn_code = CODE_FOR_$(fix_trunc$F$a$I$b2$)",
- "convert_optab_handler (ufixtrunc_optab, $B, $A)->insn_code = CODE_FOR_$(fixuns_trunc$F$a$I$b2$)",
- "convert_optab_handler (sfloat_optab, $B, $A)->insn_code = CODE_FOR_$(float$I$a$F$b2$)",
- "convert_optab_handler (ufloat_optab, $B, $A)->insn_code = CODE_FOR_$(floatuns$I$a$F$b2$)",
- "convert_optab_handler (trunc_optab, $B, $A)->insn_code = CODE_FOR_$(trunc$a$b2$)",
- "convert_optab_handler (fract_optab, $B, $A)->insn_code = CODE_FOR_$(fract$a$b2$)",
- "convert_optab_handler (fractuns_optab, $B, $A)->insn_code = CODE_FOR_$(fractuns$I$a$Q$b2$)",
- "convert_optab_handler (fractuns_optab, $B, $A)->insn_code = CODE_FOR_$(fractuns$Q$a$I$b2$)",
- "convert_optab_handler (satfract_optab, $B, $A)->insn_code = CODE_FOR_$(satfract$a$Q$b2$)",
- "convert_optab_handler (satfractuns_optab, $B, $A)->insn_code = CODE_FOR_$(satfractuns$I$a$Q$b2$)",
- "optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$P$a3$)",
- "optab_handler (addv_optab, $A)->insn_code =\n\
- optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$F$a3$)",
- "optab_handler (addv_optab, $A)->insn_code = CODE_FOR_$(addv$I$a3$)",
- "optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$Q$a3$)",
- "optab_handler (ssadd_optab, $A)->insn_code = CODE_FOR_$(ssadd$Q$a3$)",
- "optab_handler (usadd_optab, $A)->insn_code = CODE_FOR_$(usadd$Q$a3$)",
- "optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$P$a3$)",
- "optab_handler (subv_optab, $A)->insn_code =\n\
- optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$F$a3$)",
- "optab_handler (subv_optab, $A)->insn_code = CODE_FOR_$(subv$I$a3$)",
- "optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$Q$a3$)",
- "optab_handler (sssub_optab, $A)->insn_code = CODE_FOR_$(sssub$Q$a3$)",
- "optab_handler (ussub_optab, $A)->insn_code = CODE_FOR_$(ussub$Q$a3$)",
- "optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$Q$a3$)",
- "optab_handler (ssmul_optab, $A)->insn_code = CODE_FOR_$(ssmul$Q$a3$)",
- "optab_handler (usmul_optab, $A)->insn_code = CODE_FOR_$(usmul$Q$a3$)",
- "optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$P$a3$)",
- "optab_handler (smulv_optab, $A)->insn_code =\n\
- optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$F$a3$)",
- "optab_handler (smulv_optab, $A)->insn_code = CODE_FOR_$(mulv$I$a3$)",
- "optab_handler (umul_highpart_optab, $A)->insn_code = CODE_FOR_$(umul$a3_highpart$)",
- "optab_handler (smul_highpart_optab, $A)->insn_code = CODE_FOR_$(smul$a3_highpart$)",
- "optab_handler (smul_widen_optab, $B)->insn_code = CODE_FOR_$(mul$a$b3$)$N",
- "optab_handler (umul_widen_optab, $B)->insn_code = CODE_FOR_$(umul$a$b3$)$N",
- "optab_handler (usmul_widen_optab, $B)->insn_code = CODE_FOR_$(usmul$a$b3$)$N",
- "optab_handler (smadd_widen_optab, $B)->insn_code = CODE_FOR_$(madd$a$b4$)$N",
- "optab_handler (umadd_widen_optab, $B)->insn_code = CODE_FOR_$(umadd$a$b4$)$N",
- "optab_handler (ssmadd_widen_optab, $B)->insn_code = CODE_FOR_$(ssmadd$a$b4$)$N",
- "optab_handler (usmadd_widen_optab, $B)->insn_code = CODE_FOR_$(usmadd$a$b4$)$N",
- "optab_handler (smsub_widen_optab, $B)->insn_code = CODE_FOR_$(msub$a$b4$)$N",
- "optab_handler (umsub_widen_optab, $B)->insn_code = CODE_FOR_$(umsub$a$b4$)$N",
- "optab_handler (ssmsub_widen_optab, $B)->insn_code = CODE_FOR_$(ssmsub$a$b4$)$N",
- "optab_handler (usmsub_widen_optab, $B)->insn_code = CODE_FOR_$(usmsub$a$b4$)$N",
- "optab_handler (sdiv_optab, $A)->insn_code = CODE_FOR_$(div$a3$)",
- "optab_handler (ssdiv_optab, $A)->insn_code = CODE_FOR_$(ssdiv$Q$a3$)",
- "optab_handler (sdivv_optab, $A)->insn_code = CODE_FOR_$(div$V$I$a3$)",
- "optab_handler (udiv_optab, $A)->insn_code = CODE_FOR_$(udiv$I$a3$)",
- "optab_handler (udiv_optab, $A)->insn_code = CODE_FOR_$(udiv$Q$a3$)",
- "optab_handler (usdiv_optab, $A)->insn_code = CODE_FOR_$(usdiv$Q$a3$)",
- "optab_handler (sdivmod_optab, $A)->insn_code = CODE_FOR_$(divmod$a4$)",
- "optab_handler (udivmod_optab, $A)->insn_code = CODE_FOR_$(udivmod$a4$)",
- "optab_handler (smod_optab, $A)->insn_code = CODE_FOR_$(mod$a3$)",
- "optab_handler (umod_optab, $A)->insn_code = CODE_FOR_$(umod$a3$)",
- "optab_handler (fmod_optab, $A)->insn_code = CODE_FOR_$(fmod$a3$)",
- "optab_handler (remainder_optab, $A)->insn_code = CODE_FOR_$(remainder$a3$)",
- "optab_handler (ftrunc_optab, $A)->insn_code = CODE_FOR_$(ftrunc$F$a2$)",
- "optab_handler (and_optab, $A)->insn_code = CODE_FOR_$(and$a3$)",
- "optab_handler (ior_optab, $A)->insn_code = CODE_FOR_$(ior$a3$)",
- "optab_handler (xor_optab, $A)->insn_code = CODE_FOR_$(xor$a3$)",
- "optab_handler (ashl_optab, $A)->insn_code = CODE_FOR_$(ashl$a3$)",
- "optab_handler (ssashl_optab, $A)->insn_code = CODE_FOR_$(ssashl$Q$a3$)",
- "optab_handler (usashl_optab, $A)->insn_code = CODE_FOR_$(usashl$Q$a3$)",
- "optab_handler (ashr_optab, $A)->insn_code = CODE_FOR_$(ashr$a3$)",
- "optab_handler (lshr_optab, $A)->insn_code = CODE_FOR_$(lshr$a3$)",
- "optab_handler (rotl_optab, $A)->insn_code = CODE_FOR_$(rotl$a3$)",
- "optab_handler (rotr_optab, $A)->insn_code = CODE_FOR_$(rotr$a3$)",
- "optab_handler (vashr_optab, $A)->insn_code = CODE_FOR_$(vashr$a3$)",
- "optab_handler (vlshr_optab, $A)->insn_code = CODE_FOR_$(vlshr$a3$)",
- "optab_handler (vashl_optab, $A)->insn_code = CODE_FOR_$(vashl$a3$)",
- "optab_handler (vrotl_optab, $A)->insn_code = CODE_FOR_$(vrotl$a3$)",
- "optab_handler (vrotr_optab, $A)->insn_code = CODE_FOR_$(vrotr$a3$)",
- "optab_handler (smin_optab, $A)->insn_code = CODE_FOR_$(smin$a3$)",
- "optab_handler (smax_optab, $A)->insn_code = CODE_FOR_$(smax$a3$)",
- "optab_handler (umin_optab, $A)->insn_code = CODE_FOR_$(umin$I$a3$)",
- "optab_handler (umax_optab, $A)->insn_code = CODE_FOR_$(umax$I$a3$)",
- "optab_handler (pow_optab, $A)->insn_code = CODE_FOR_$(pow$a3$)",
- "optab_handler (atan2_optab, $A)->insn_code = CODE_FOR_$(atan2$a3$)",
- "optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$P$a2$)",
- "optab_handler (negv_optab, $A)->insn_code =\n\
- optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$F$a2$)",
- "optab_handler (negv_optab, $A)->insn_code = CODE_FOR_$(negv$I$a2$)",
- "optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$Q$a2$)",
- "optab_handler (ssneg_optab, $A)->insn_code = CODE_FOR_$(ssneg$Q$a2$)",
- "optab_handler (usneg_optab, $A)->insn_code = CODE_FOR_$(usneg$Q$a2$)",
- "optab_handler (abs_optab, $A)->insn_code = CODE_FOR_$(abs$P$a2$)",
- "optab_handler (absv_optab, $A)->insn_code =\n\
- optab_handler (abs_optab, $A)->insn_code = CODE_FOR_$(abs$F$a2$)",
- "optab_handler (absv_optab, $A)->insn_code = CODE_FOR_$(absv$I$a2$)",
- "optab_handler (copysign_optab, $A)->insn_code = CODE_FOR_$(copysign$F$a3$)",
- "optab_handler (signbit_optab, $A)->insn_code = CODE_FOR_$(signbit$F$a2$)",
- "optab_handler (isinf_optab, $A)->insn_code = CODE_FOR_$(isinf$a2$)",
- "optab_handler (sqrt_optab, $A)->insn_code = CODE_FOR_$(sqrt$a2$)",
- "optab_handler (floor_optab, $A)->insn_code = CODE_FOR_$(floor$a2$)",
- "convert_optab_handler (lfloor_optab, $B, $A)->insn_code = CODE_FOR_$(lfloor$F$a$I$b2$)",
- "optab_handler (ceil_optab, $A)->insn_code = CODE_FOR_$(ceil$a2$)",
- "convert_optab_handler (lceil_optab, $B, $A)->insn_code = CODE_FOR_$(lceil$F$a$I$b2$)",
- "optab_handler (round_optab, $A)->insn_code = CODE_FOR_$(round$a2$)",
- "optab_handler (btrunc_optab, $A)->insn_code = CODE_FOR_$(btrunc$a2$)",
- "optab_handler (nearbyint_optab, $A)->insn_code = CODE_FOR_$(nearbyint$a2$)",
- "optab_handler (rint_optab, $A)->insn_code = CODE_FOR_$(rint$a2$)",
- "convert_optab_handler (lrint_optab, $B, $A)->insn_code = CODE_FOR_$(lrint$F$a$I$b2$)",
- "convert_optab_handler (lround_optab, $B, $A)->insn_code = CODE_FOR_$(lround$F$a$I$b2$)",
- "optab_handler (sincos_optab, $A)->insn_code = CODE_FOR_$(sincos$a3$)",
- "optab_handler (sin_optab, $A)->insn_code = CODE_FOR_$(sin$a2$)",
- "optab_handler (asin_optab, $A)->insn_code = CODE_FOR_$(asin$a2$)",
- "optab_handler (cos_optab, $A)->insn_code = CODE_FOR_$(cos$a2$)",
- "optab_handler (acos_optab, $A)->insn_code = CODE_FOR_$(acos$a2$)",
- "optab_handler (exp_optab, $A)->insn_code = CODE_FOR_$(exp$a2$)",
- "optab_handler (exp10_optab, $A)->insn_code = CODE_FOR_$(exp10$a2$)",
- "optab_handler (exp2_optab, $A)->insn_code = CODE_FOR_$(exp2$a2$)",
- "optab_handler (expm1_optab, $A)->insn_code = CODE_FOR_$(expm1$a2$)",
- "optab_handler (ldexp_optab, $A)->insn_code = CODE_FOR_$(ldexp$a3$)",
- "optab_handler (scalb_optab, $A)->insn_code = CODE_FOR_$(scalb$a3$)",
- "optab_handler (significand_optab, $A)->insn_code = CODE_FOR_$(significand$a2$)",
- "optab_handler (logb_optab, $A)->insn_code = CODE_FOR_$(logb$a2$)",
- "optab_handler (ilogb_optab, $A)->insn_code = CODE_FOR_$(ilogb$a2$)",
- "optab_handler (log_optab, $A)->insn_code = CODE_FOR_$(log$a2$)",
- "optab_handler (log10_optab, $A)->insn_code = CODE_FOR_$(log10$a2$)",
- "optab_handler (log2_optab, $A)->insn_code = CODE_FOR_$(log2$a2$)",
- "optab_handler (log1p_optab, $A)->insn_code = CODE_FOR_$(log1p$a2$)",
- "optab_handler (tan_optab, $A)->insn_code = CODE_FOR_$(tan$a2$)",
- "optab_handler (atan_optab, $A)->insn_code = CODE_FOR_$(atan$a2$)",
- "optab_handler (strlen_optab, $A)->insn_code = CODE_FOR_$(strlen$a$)",
- "optab_handler (one_cmpl_optab, $A)->insn_code = CODE_FOR_$(one_cmpl$a2$)",
- "optab_handler (bswap_optab, $A)->insn_code = CODE_FOR_$(bswap$a2$)",
- "optab_handler (ffs_optab, $A)->insn_code = CODE_FOR_$(ffs$a2$)",
- "optab_handler (clz_optab, $A)->insn_code = CODE_FOR_$(clz$a2$)",
- "optab_handler (ctz_optab, $A)->insn_code = CODE_FOR_$(ctz$a2$)",
- "optab_handler (popcount_optab, $A)->insn_code = CODE_FOR_$(popcount$a2$)",
- "optab_handler (parity_optab, $A)->insn_code = CODE_FOR_$(parity$a2$)",
- "optab_handler (mov_optab, $A)->insn_code = CODE_FOR_$(mov$a$)",
- "optab_handler (movstrict_optab, $A)->insn_code = CODE_FOR_$(movstrict$a$)",
- "optab_handler (movmisalign_optab, $A)->insn_code = CODE_FOR_$(movmisalign$a$)",
- "optab_handler (storent_optab, $A)->insn_code = CODE_FOR_$(storent$a$)",
- "optab_handler (addcc_optab, $A)->insn_code = CODE_FOR_$(add$acc$)",
+{ "set_convert_optab_handler (sext_optab, $B, $A, CODE_FOR_$(extend$a$b2$))",
+ "set_convert_optab_handler (zext_optab, $B, $A, CODE_FOR_$(zero_extend$a$b2$))",
+ "set_convert_optab_handler (sfix_optab, $B, $A, CODE_FOR_$(fix$F$a$I$b2$))",
+ "set_convert_optab_handler (ufix_optab, $B, $A, CODE_FOR_$(fixuns$F$a$b2$))",
+ "set_convert_optab_handler (sfixtrunc_optab, $B, $A, CODE_FOR_$(fix_trunc$F$a$I$b2$))",
+ "set_convert_optab_handler (ufixtrunc_optab, $B, $A, CODE_FOR_$(fixuns_trunc$F$a$I$b2$))",
+ "set_convert_optab_handler (sfloat_optab, $B, $A, CODE_FOR_$(float$I$a$F$b2$))",
+ "set_convert_optab_handler (ufloat_optab, $B, $A, CODE_FOR_$(floatuns$I$a$F$b2$))",
+ "set_convert_optab_handler (trunc_optab, $B, $A, CODE_FOR_$(trunc$a$b2$))",
+ "set_convert_optab_handler (fract_optab, $B, $A, CODE_FOR_$(fract$a$b2$))",
+ "set_convert_optab_handler (fractuns_optab, $B, $A, CODE_FOR_$(fractuns$I$a$Q$b2$))",
+ "set_convert_optab_handler (fractuns_optab, $B, $A, CODE_FOR_$(fractuns$Q$a$I$b2$))",
+ "set_convert_optab_handler (satfract_optab, $B, $A, CODE_FOR_$(satfract$a$Q$b2$))",
+ "set_convert_optab_handler (satfractuns_optab, $B, $A, CODE_FOR_$(satfractuns$I$a$Q$b2$))",
+ "set_optab_handler (add_optab, $A, CODE_FOR_$(add$P$a3$))",
+ "set_optab_handler (addv_optab, $A, CODE_FOR_$(add$F$a3$)),\n\
+ set_optab_handler (add_optab, $A, CODE_FOR_$(add$F$a3$))",
+ "set_optab_handler (addv_optab, $A, CODE_FOR_$(addv$I$a3$))",
+ "set_optab_handler (add_optab, $A, CODE_FOR_$(add$Q$a3$))",
+ "set_optab_handler (ssadd_optab, $A, CODE_FOR_$(ssadd$Q$a3$))",
+ "set_optab_handler (usadd_optab, $A, CODE_FOR_$(usadd$Q$a3$))",
+ "set_optab_handler (sub_optab, $A, CODE_FOR_$(sub$P$a3$))",
+ "set_optab_handler (subv_optab, $A, CODE_FOR_$(sub$F$a3$)),\n\
+ set_optab_handler (sub_optab, $A, CODE_FOR_$(sub$F$a3$))",
+ "set_optab_handler (subv_optab, $A, CODE_FOR_$(subv$I$a3$))",
+ "set_optab_handler (sub_optab, $A, CODE_FOR_$(sub$Q$a3$))",
+ "set_optab_handler (sssub_optab, $A, CODE_FOR_$(sssub$Q$a3$))",
+ "set_optab_handler (ussub_optab, $A, CODE_FOR_$(ussub$Q$a3$))",
+ "set_optab_handler (smul_optab, $A, CODE_FOR_$(mul$Q$a3$))",
+ "set_optab_handler (ssmul_optab, $A, CODE_FOR_$(ssmul$Q$a3$))",
+ "set_optab_handler (usmul_optab, $A, CODE_FOR_$(usmul$Q$a3$))",
+ "set_optab_handler (smul_optab, $A, CODE_FOR_$(mul$P$a3$))",
+ "set_optab_handler (smulv_optab, $A, CODE_FOR_$(mul$F$a3$)),\n\
+ set_optab_handler (smul_optab, $A, CODE_FOR_$(mul$F$a3$))",
+ "set_optab_handler (smulv_optab, $A, CODE_FOR_$(mulv$I$a3$))",
+ "set_optab_handler (umul_highpart_optab, $A, CODE_FOR_$(umul$a3_highpart$))",
+ "set_optab_handler (smul_highpart_optab, $A, CODE_FOR_$(smul$a3_highpart$))",
+ "set_optab_handler (smul_widen_optab, $B, CODE_FOR_$(mul$a$b3$)$N)",
+ "set_optab_handler (umul_widen_optab, $B, CODE_FOR_$(umul$a$b3$)$N)",
+ "set_optab_handler (usmul_widen_optab, $B, CODE_FOR_$(usmul$a$b3$)$N)",
+ "set_optab_handler (smadd_widen_optab, $B, CODE_FOR_$(madd$a$b4$)$N)",
+ "set_optab_handler (umadd_widen_optab, $B, CODE_FOR_$(umadd$a$b4$)$N)",
+ "set_optab_handler (ssmadd_widen_optab, $B, CODE_FOR_$(ssmadd$a$b4$)$N)",
+ "set_optab_handler (usmadd_widen_optab, $B, CODE_FOR_$(usmadd$a$b4$)$N)",
+ "set_optab_handler (smsub_widen_optab, $B, CODE_FOR_$(msub$a$b4$)$N)",
+ "set_optab_handler (umsub_widen_optab, $B, CODE_FOR_$(umsub$a$b4$)$N)",
+ "set_optab_handler (ssmsub_widen_optab, $B, CODE_FOR_$(ssmsub$a$b4$)$N)",
+ "set_optab_handler (usmsub_widen_optab, $B, CODE_FOR_$(usmsub$a$b4$)$N)",
+ "set_optab_handler (sdiv_optab, $A, CODE_FOR_$(div$a3$))",
+ "set_optab_handler (ssdiv_optab, $A, CODE_FOR_$(ssdiv$Q$a3$))",
+ "set_optab_handler (sdivv_optab, $A, CODE_FOR_$(div$V$I$a3$))",
+ "set_optab_handler (udiv_optab, $A, CODE_FOR_$(udiv$I$a3$))",
+ "set_optab_handler (udiv_optab, $A, CODE_FOR_$(udiv$Q$a3$))",
+ "set_optab_handler (usdiv_optab, $A, CODE_FOR_$(usdiv$Q$a3$))",
+ "set_optab_handler (sdivmod_optab, $A, CODE_FOR_$(divmod$a4$))",
+ "set_optab_handler (udivmod_optab, $A, CODE_FOR_$(udivmod$a4$))",
+ "set_optab_handler (smod_optab, $A, CODE_FOR_$(mod$a3$))",
+ "set_optab_handler (umod_optab, $A, CODE_FOR_$(umod$a3$))",
+ "set_optab_handler (fmod_optab, $A, CODE_FOR_$(fmod$a3$))",
+ "set_optab_handler (remainder_optab, $A, CODE_FOR_$(remainder$a3$))",
+ "set_optab_handler (ftrunc_optab, $A, CODE_FOR_$(ftrunc$F$a2$))",
+ "set_optab_handler (and_optab, $A, CODE_FOR_$(and$a3$))",
+ "set_optab_handler (ior_optab, $A, CODE_FOR_$(ior$a3$))",
+ "set_optab_handler (xor_optab, $A, CODE_FOR_$(xor$a3$))",
+ "set_optab_handler (ashl_optab, $A, CODE_FOR_$(ashl$a3$))",
+ "set_optab_handler (ssashl_optab, $A, CODE_FOR_$(ssashl$Q$a3$))",
+ "set_optab_handler (usashl_optab, $A, CODE_FOR_$(usashl$Q$a3$))",
+ "set_optab_handler (ashr_optab, $A, CODE_FOR_$(ashr$a3$))",
+ "set_optab_handler (lshr_optab, $A, CODE_FOR_$(lshr$a3$))",
+ "set_optab_handler (rotl_optab, $A, CODE_FOR_$(rotl$a3$))",
+ "set_optab_handler (rotr_optab, $A, CODE_FOR_$(rotr$a3$))",
+ "set_optab_handler (vashr_optab, $A, CODE_FOR_$(vashr$a3$))",
+ "set_optab_handler (vlshr_optab, $A, CODE_FOR_$(vlshr$a3$))",
+ "set_optab_handler (vashl_optab, $A, CODE_FOR_$(vashl$a3$))",
+ "set_optab_handler (vrotl_optab, $A, CODE_FOR_$(vrotl$a3$))",
+ "set_optab_handler (vrotr_optab, $A, CODE_FOR_$(vrotr$a3$))",
+ "set_optab_handler (smin_optab, $A, CODE_FOR_$(smin$a3$))",
+ "set_optab_handler (smax_optab, $A, CODE_FOR_$(smax$a3$))",
+ "set_optab_handler (umin_optab, $A, CODE_FOR_$(umin$I$a3$))",
+ "set_optab_handler (umax_optab, $A, CODE_FOR_$(umax$I$a3$))",
+ "set_optab_handler (pow_optab, $A, CODE_FOR_$(pow$a3$))",
+ "set_optab_handler (atan2_optab, $A, CODE_FOR_$(atan2$a3$))",
+ "set_optab_handler (neg_optab, $A, CODE_FOR_$(neg$P$a2$))",
+ "set_optab_handler (negv_optab, $A, CODE_FOR_$(neg$F$a2$)),\n\
+ set_optab_handler (neg_optab, $A, CODE_FOR_$(neg$F$a2$))",
+ "set_optab_handler (negv_optab, $A, CODE_FOR_$(negv$I$a2$))",
+ "set_optab_handler (neg_optab, $A, CODE_FOR_$(neg$Q$a2$))",
+ "set_optab_handler (ssneg_optab, $A, CODE_FOR_$(ssneg$Q$a2$))",
+ "set_optab_handler (usneg_optab, $A, CODE_FOR_$(usneg$Q$a2$))",
+ "set_optab_handler (abs_optab, $A, CODE_FOR_$(abs$P$a2$))",
+ "set_optab_handler (absv_optab, $A, CODE_FOR_$(abs$F$a2$)),\n\
+ set_optab_handler (abs_optab, $A, CODE_FOR_$(abs$F$a2$))",
+ "set_optab_handler (absv_optab, $A, CODE_FOR_$(absv$I$a2$))",
+ "set_optab_handler (copysign_optab, $A, CODE_FOR_$(copysign$F$a3$))",
+ "set_optab_handler (signbit_optab, $A, CODE_FOR_$(signbit$F$a2$))",
+ "set_optab_handler (isinf_optab, $A, CODE_FOR_$(isinf$a2$))",
+ "set_optab_handler (sqrt_optab, $A, CODE_FOR_$(sqrt$a2$))",
+ "set_optab_handler (floor_optab, $A, CODE_FOR_$(floor$a2$))",
+ "set_convert_optab_handler (lfloor_optab, $B, $A, CODE_FOR_$(lfloor$F$a$I$b2$))",
+ "set_optab_handler (ceil_optab, $A, CODE_FOR_$(ceil$a2$))",
+ "set_convert_optab_handler (lceil_optab, $B, $A, CODE_FOR_$(lceil$F$a$I$b2$))",
+ "set_optab_handler (round_optab, $A, CODE_FOR_$(round$a2$))",
+ "set_optab_handler (btrunc_optab, $A, CODE_FOR_$(btrunc$a2$))",
+ "set_optab_handler (nearbyint_optab, $A, CODE_FOR_$(nearbyint$a2$))",
+ "set_optab_handler (rint_optab, $A, CODE_FOR_$(rint$a2$))",
+ "set_convert_optab_handler (lrint_optab, $B, $A, CODE_FOR_$(lrint$F$a$I$b2$))",
+ "set_convert_optab_handler (lround_optab, $B, $A, CODE_FOR_$(lround$F$a$I$b2$))",
+ "set_optab_handler (sincos_optab, $A, CODE_FOR_$(sincos$a3$))",
+ "set_optab_handler (sin_optab, $A, CODE_FOR_$(sin$a2$))",
+ "set_optab_handler (asin_optab, $A, CODE_FOR_$(asin$a2$))",
+ "set_optab_handler (cos_optab, $A, CODE_FOR_$(cos$a2$))",
+ "set_optab_handler (acos_optab, $A, CODE_FOR_$(acos$a2$))",
+ "set_optab_handler (exp_optab, $A, CODE_FOR_$(exp$a2$))",
+ "set_optab_handler (exp10_optab, $A, CODE_FOR_$(exp10$a2$))",
+ "set_optab_handler (exp2_optab, $A, CODE_FOR_$(exp2$a2$))",
+ "set_optab_handler (expm1_optab, $A, CODE_FOR_$(expm1$a2$))",
+ "set_optab_handler (ldexp_optab, $A, CODE_FOR_$(ldexp$a3$))",
+ "set_optab_handler (scalb_optab, $A, CODE_FOR_$(scalb$a3$))",
+ "set_optab_handler (significand_optab, $A, CODE_FOR_$(significand$a2$))",
+ "set_optab_handler (logb_optab, $A, CODE_FOR_$(logb$a2$))",
+ "set_optab_handler (ilogb_optab, $A, CODE_FOR_$(ilogb$a2$))",
+ "set_optab_handler (log_optab, $A, CODE_FOR_$(log$a2$))",
+ "set_optab_handler (log10_optab, $A, CODE_FOR_$(log10$a2$))",
+ "set_optab_handler (log2_optab, $A, CODE_FOR_$(log2$a2$))",
+ "set_optab_handler (log1p_optab, $A, CODE_FOR_$(log1p$a2$))",
+ "set_optab_handler (tan_optab, $A, CODE_FOR_$(tan$a2$))",
+ "set_optab_handler (atan_optab, $A, CODE_FOR_$(atan$a2$))",
+ "set_optab_handler (strlen_optab, $A, CODE_FOR_$(strlen$a$))",
+ "set_optab_handler (one_cmpl_optab, $A, CODE_FOR_$(one_cmpl$a2$))",
+ "set_optab_handler (bswap_optab, $A, CODE_FOR_$(bswap$a2$))",
+ "set_optab_handler (ffs_optab, $A, CODE_FOR_$(ffs$a2$))",
+ "set_optab_handler (clz_optab, $A, CODE_FOR_$(clz$a2$))",
+ "set_optab_handler (ctz_optab, $A, CODE_FOR_$(ctz$a2$))",
+ "set_optab_handler (popcount_optab, $A, CODE_FOR_$(popcount$a2$))",
+ "set_optab_handler (parity_optab, $A, CODE_FOR_$(parity$a2$))",
+ "set_optab_handler (mov_optab, $A, CODE_FOR_$(mov$a$))",
+ "set_optab_handler (movstrict_optab, $A, CODE_FOR_$(movstrict$a$))",
+ "set_optab_handler (movmisalign_optab, $A, CODE_FOR_$(movmisalign$a$))",
+ "set_optab_handler (storent_optab, $A, CODE_FOR_$(storent$a$))",
+ "set_optab_handler (addcc_optab, $A, CODE_FOR_$(add$acc$))",
"movcc_gen_code[$A] = CODE_FOR_$(mov$acc$)",
- "optab_handler (cbranch_optab, $A)->insn_code = CODE_FOR_$(cbranch$a4$)",
- "optab_handler (cmov_optab, $A)->insn_code = CODE_FOR_$(cmov$a6$)",
- "optab_handler (cstore_optab, $A)->insn_code = CODE_FOR_$(cstore$a4$)",
- "optab_handler (ctrap_optab, $A)->insn_code = CODE_FOR_$(ctrap$a4$)",
- "optab_handler (push_optab, $A)->insn_code = CODE_FOR_$(push$a1$)",
+ "set_optab_handler (cbranch_optab, $A, CODE_FOR_$(cbranch$a4$))",
+ "set_optab_handler (cmov_optab, $A, CODE_FOR_$(cmov$a6$))",
+ "set_optab_handler (cstore_optab, $A, CODE_FOR_$(cstore$a4$))",
+ "set_optab_handler (ctrap_optab, $A, CODE_FOR_$(ctrap$a4$))",
+ "set_optab_handler (push_optab, $A, CODE_FOR_$(push$a1$))",
"reload_in_optab[$A] = CODE_FOR_$(reload_in$a$)",
"reload_out_optab[$A] = CODE_FOR_$(reload_out$a$)",
"movmem_optab[$A] = CODE_FOR_$(movmem$a$)",
@@ -234,45 +234,45 @@ static const char * const optabs[] =
"sync_compare_and_swap[$A] = CODE_FOR_$(sync_compare_and_swap$I$a$)",
"sync_lock_test_and_set[$A] = CODE_FOR_$(sync_lock_test_and_set$I$a$)",
"sync_lock_release[$A] = CODE_FOR_$(sync_lock_release$I$a$)",
- "optab_handler (vec_set_optab, $A)->insn_code = CODE_FOR_$(vec_set$a$)",
- "optab_handler (vec_extract_optab, $A)->insn_code = CODE_FOR_$(vec_extract$a$)",
- "optab_handler (vec_extract_even_optab, $A)->insn_code = CODE_FOR_$(vec_extract_even$a$)",
- "optab_handler (vec_extract_odd_optab, $A)->insn_code = CODE_FOR_$(vec_extract_odd$a$)",
- "optab_handler (vec_interleave_high_optab, $A)->insn_code = CODE_FOR_$(vec_interleave_high$a$)",
- "optab_handler (vec_interleave_low_optab, $A)->insn_code = CODE_FOR_$(vec_interleave_low$a$)",
- "optab_handler (vec_init_optab, $A)->insn_code = CODE_FOR_$(vec_init$a$)",
- "optab_handler (vec_shl_optab, $A)->insn_code = CODE_FOR_$(vec_shl_$a$)",
- "optab_handler (vec_shr_optab, $A)->insn_code = CODE_FOR_$(vec_shr_$a$)",
- "optab_handler (vec_realign_load_optab, $A)->insn_code = CODE_FOR_$(vec_realign_load_$a$)",
+ "set_optab_handler (vec_set_optab, $A, CODE_FOR_$(vec_set$a$))",
+ "set_optab_handler (vec_extract_optab, $A, CODE_FOR_$(vec_extract$a$))",
+ "set_optab_handler (vec_extract_even_optab, $A, CODE_FOR_$(vec_extract_even$a$))",
+ "set_optab_handler (vec_extract_odd_optab, $A, CODE_FOR_$(vec_extract_odd$a$))",
+ "set_optab_handler (vec_interleave_high_optab, $A, CODE_FOR_$(vec_interleave_high$a$))",
+ "set_optab_handler (vec_interleave_low_optab, $A, CODE_FOR_$(vec_interleave_low$a$))",
+ "set_optab_handler (vec_init_optab, $A, CODE_FOR_$(vec_init$a$))",
+ "set_optab_handler (vec_shl_optab, $A, CODE_FOR_$(vec_shl_$a$))",
+ "set_optab_handler (vec_shr_optab, $A, CODE_FOR_$(vec_shr_$a$))",
+ "set_optab_handler (vec_realign_load_optab, $A, CODE_FOR_$(vec_realign_load_$a$))",
"vcond_gen_code[$A] = CODE_FOR_$(vcond$a$)",
"vcondu_gen_code[$A] = CODE_FOR_$(vcondu$a$)",
- "optab_handler (ssum_widen_optab, $A)->insn_code = CODE_FOR_$(widen_ssum$I$a3$)",
- "optab_handler (usum_widen_optab, $A)->insn_code = CODE_FOR_$(widen_usum$I$a3$)",
- "optab_handler (udot_prod_optab, $A)->insn_code = CODE_FOR_$(udot_prod$I$a$)",
- "optab_handler (sdot_prod_optab, $A)->insn_code = CODE_FOR_$(sdot_prod$I$a$)",
- "optab_handler (reduc_smax_optab, $A)->insn_code = CODE_FOR_$(reduc_smax_$a$)",
- "optab_handler (reduc_umax_optab, $A)->insn_code = CODE_FOR_$(reduc_umax_$a$)",
- "optab_handler (reduc_smin_optab, $A)->insn_code = CODE_FOR_$(reduc_smin_$a$)",
- "optab_handler (reduc_umin_optab, $A)->insn_code = CODE_FOR_$(reduc_umin_$a$)",
- "optab_handler (reduc_splus_optab, $A)->insn_code = CODE_FOR_$(reduc_splus_$a$)" ,
- "optab_handler (reduc_uplus_optab, $A)->insn_code = CODE_FOR_$(reduc_uplus_$a$)",
- "optab_handler (vec_widen_umult_hi_optab, $A)->insn_code = CODE_FOR_$(vec_widen_umult_hi_$a$)",
- "optab_handler (vec_widen_umult_lo_optab, $A)->insn_code = CODE_FOR_$(vec_widen_umult_lo_$a$)",
- "optab_handler (vec_widen_smult_hi_optab, $A)->insn_code = CODE_FOR_$(vec_widen_smult_hi_$a$)",
- "optab_handler (vec_widen_smult_lo_optab, $A)->insn_code = CODE_FOR_$(vec_widen_smult_lo_$a$)",
- "optab_handler (vec_unpacks_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_hi_$a$)",
- "optab_handler (vec_unpacks_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_lo_$a$)",
- "optab_handler (vec_unpacku_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_hi_$a$)",
- "optab_handler (vec_unpacku_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_lo_$a$)",
- "optab_handler (vec_unpacks_float_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_float_hi_$a$)",
- "optab_handler (vec_unpacks_float_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacks_float_lo_$a$)",
- "optab_handler (vec_unpacku_float_hi_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_float_hi_$a$)",
- "optab_handler (vec_unpacku_float_lo_optab, $A)->insn_code = CODE_FOR_$(vec_unpacku_float_lo_$a$)",
- "optab_handler (vec_pack_trunc_optab, $A)->insn_code = CODE_FOR_$(vec_pack_trunc_$a$)",
- "optab_handler (vec_pack_ssat_optab, $A)->insn_code = CODE_FOR_$(vec_pack_ssat_$a$)",
- "optab_handler (vec_pack_usat_optab, $A)->insn_code = CODE_FOR_$(vec_pack_usat_$a$)",
- "optab_handler (vec_pack_sfix_trunc_optab, $A)->insn_code = CODE_FOR_$(vec_pack_sfix_trunc_$a$)",
- "optab_handler (vec_pack_ufix_trunc_optab, $A)->insn_code = CODE_FOR_$(vec_pack_ufix_trunc_$a$)"
+ "set_optab_handler (ssum_widen_optab, $A, CODE_FOR_$(widen_ssum$I$a3$))",
+ "set_optab_handler (usum_widen_optab, $A, CODE_FOR_$(widen_usum$I$a3$))",
+ "set_optab_handler (udot_prod_optab, $A, CODE_FOR_$(udot_prod$I$a$))",
+ "set_optab_handler (sdot_prod_optab, $A, CODE_FOR_$(sdot_prod$I$a$))",
+ "set_optab_handler (reduc_smax_optab, $A, CODE_FOR_$(reduc_smax_$a$))",
+ "set_optab_handler (reduc_umax_optab, $A, CODE_FOR_$(reduc_umax_$a$))",
+ "set_optab_handler (reduc_smin_optab, $A, CODE_FOR_$(reduc_smin_$a$))",
+ "set_optab_handler (reduc_umin_optab, $A, CODE_FOR_$(reduc_umin_$a$))",
+ "set_optab_handler (reduc_splus_optab, $A, CODE_FOR_$(reduc_splus_$a$))" ,
+ "set_optab_handler (reduc_uplus_optab, $A, CODE_FOR_$(reduc_uplus_$a$))",
+ "set_optab_handler (vec_widen_umult_hi_optab, $A, CODE_FOR_$(vec_widen_umult_hi_$a$))",
+ "set_optab_handler (vec_widen_umult_lo_optab, $A, CODE_FOR_$(vec_widen_umult_lo_$a$))",
+ "set_optab_handler (vec_widen_smult_hi_optab, $A, CODE_FOR_$(vec_widen_smult_hi_$a$))",
+ "set_optab_handler (vec_widen_smult_lo_optab, $A, CODE_FOR_$(vec_widen_smult_lo_$a$))",
+ "set_optab_handler (vec_unpacks_hi_optab, $A, CODE_FOR_$(vec_unpacks_hi_$a$))",
+ "set_optab_handler (vec_unpacks_lo_optab, $A, CODE_FOR_$(vec_unpacks_lo_$a$))",
+ "set_optab_handler (vec_unpacku_hi_optab, $A, CODE_FOR_$(vec_unpacku_hi_$a$))",
+ "set_optab_handler (vec_unpacku_lo_optab, $A, CODE_FOR_$(vec_unpacku_lo_$a$))",
+ "set_optab_handler (vec_unpacks_float_hi_optab, $A, CODE_FOR_$(vec_unpacks_float_hi_$a$))",
+ "set_optab_handler (vec_unpacks_float_lo_optab, $A, CODE_FOR_$(vec_unpacks_float_lo_$a$))",
+ "set_optab_handler (vec_unpacku_float_hi_optab, $A, CODE_FOR_$(vec_unpacku_float_hi_$a$))",
+ "set_optab_handler (vec_unpacku_float_lo_optab, $A, CODE_FOR_$(vec_unpacku_float_lo_$a$))",
+ "set_optab_handler (vec_pack_trunc_optab, $A, CODE_FOR_$(vec_pack_trunc_$a$))",
+ "set_optab_handler (vec_pack_ssat_optab, $A, CODE_FOR_$(vec_pack_ssat_$a$))",
+ "set_optab_handler (vec_pack_usat_optab, $A, CODE_FOR_$(vec_pack_usat_$a$))",
+ "set_optab_handler (vec_pack_sfix_trunc_optab, $A, CODE_FOR_$(vec_pack_sfix_trunc_$a$))",
+ "set_optab_handler (vec_pack_ufix_trunc_optab, $A, CODE_FOR_$(vec_pack_ufix_trunc_$a$))"
};
static void gen_insn (rtx);
@@ -519,8 +519,9 @@ main (int argc, char **argv)
also convert validly to an unsigned one. */\n\
for (i = 0; i < NUM_MACHINE_MODES; i++)\n\
for (j = 0; j < NUM_MACHINE_MODES; j++)\n\
- convert_optab_handler (ufixtrunc_optab, i, j)->insn_code\n\
- = convert_optab_handler (sfixtrunc_optab, i, j)->insn_code;\n\
+ set_convert_optab_handler\n\
+ (ufixtrunc_optab, i, j,\n\
+ convert_optab_handler (sfixtrunc_optab, i, j));\n\
#endif\n\
}");
Index: gcc/ifcvt.c
===================================================================
--- gcc/ifcvt.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/ifcvt.c 2010-07-03 19:21:15.000000000 +0100
@@ -3156,7 +3156,7 @@ find_if_header (basic_block test_bb, int
goto success;
if (HAVE_trap
- && optab_handler (ctrap_optab, word_mode)->insn_code != CODE_FOR_nothing
+ && optab_handler (ctrap_optab, word_mode) != CODE_FOR_nothing
&& find_cond_trap (test_bb, then_edge, else_edge))
goto success;
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/optabs.c 2010-07-03 20:10:49.000000000 +0100
@@ -563,9 +563,9 @@ expand_widen_pattern_expr (sepops ops, r
if (ops->code == WIDEN_MULT_PLUS_EXPR
|| ops->code == WIDEN_MULT_MINUS_EXPR)
icode = (int) optab_handler (widen_pattern_optab,
- TYPE_MODE (TREE_TYPE (ops->op2)))->insn_code;
+ TYPE_MODE (TREE_TYPE (ops->op2)));
else
- icode = (int) optab_handler (widen_pattern_optab, tmode0)->insn_code;
+ icode = (int) optab_handler (widen_pattern_optab, tmode0);
gcc_assert (icode != CODE_FOR_nothing);
xmode0 = insn_data[icode].operand[1].mode;
@@ -690,7 +690,7 @@ expand_widen_pattern_expr (sepops ops, r
expand_ternary_op (enum machine_mode mode, optab ternary_optab, rtx op0,
rtx op1, rtx op2, rtx target, int unsignedp)
{
- int icode = (int) optab_handler (ternary_optab, mode)->insn_code;
+ int icode = (int) optab_handler (ternary_optab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
enum machine_mode mode1 = insn_data[icode].operand[2].mode;
enum machine_mode mode2 = insn_data[icode].operand[3].mode;
@@ -698,8 +698,7 @@ expand_ternary_op (enum machine_mode mod
rtx pat;
rtx xop0 = op0, xop1 = op1, xop2 = op2;
- gcc_assert (optab_handler (ternary_optab, mode)->insn_code
- != CODE_FOR_nothing);
+ gcc_assert (optab_handler (ternary_optab, mode) != CODE_FOR_nothing);
if (!target || !insn_data[icode].operand[0].predicate (target, mode))
temp = gen_reg_rtx (mode);
@@ -819,7 +818,7 @@ expand_vec_shift_expr (sepops ops, rtx t
gcc_unreachable ();
}
- icode = optab_handler (shift_optab, mode)->insn_code;
+ icode = optab_handler (shift_optab, mode);
gcc_assert (icode != CODE_FOR_nothing);
mode1 = insn_data[icode].operand[1].mode;
@@ -1436,7 +1435,7 @@ expand_binop_directly (enum machine_mode
rtx target, int unsignedp, enum optab_methods methods,
rtx last)
{
- int icode = (int) optab_handler (binoptab, mode)->insn_code;
+ int icode = (int) optab_handler (binoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
enum machine_mode mode1 = insn_data[icode].operand[2].mode;
enum machine_mode tmp_mode;
@@ -1593,7 +1592,7 @@ expand_binop (enum machine_mode mode, op
/* If we can do it with a three-operand insn, do so. */
if (methods != OPTAB_MUST_WIDEN
- && optab_handler (binoptab, mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (binoptab, mode) != CODE_FOR_nothing)
{
temp = expand_binop_directly (mode, binoptab, op0, op1, target,
unsignedp, methods, last);
@@ -1604,9 +1603,9 @@ expand_binop (enum machine_mode mode, op
/* If we were trying to rotate, and that didn't work, try rotating
the other direction before falling back to shifts and bitwise-or. */
if (((binoptab == rotl_optab
- && optab_handler (rotr_optab, mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (rotr_optab, mode) != CODE_FOR_nothing)
|| (binoptab == rotr_optab
- && optab_handler (rotl_optab, mode)->insn_code != CODE_FOR_nothing))
+ && optab_handler (rotl_optab, mode) != CODE_FOR_nothing))
&& mclass == MODE_INT)
{
optab otheroptab = (binoptab == rotl_optab ? rotr_optab : rotl_optab);
@@ -1633,8 +1632,8 @@ expand_binop (enum machine_mode mode, op
if (binoptab == smul_optab
&& GET_MODE_WIDER_MODE (mode) != VOIDmode
- && ((optab_handler ((unsignedp ? umul_widen_optab : smul_widen_optab),
- GET_MODE_WIDER_MODE (mode))->insn_code)
+ && (optab_handler ((unsignedp ? umul_widen_optab : smul_widen_optab),
+ GET_MODE_WIDER_MODE (mode))
!= CODE_FOR_nothing))
{
temp = expand_binop (GET_MODE_WIDER_MODE (mode),
@@ -1662,12 +1661,12 @@ expand_binop (enum machine_mode mode, op
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (binoptab, wider_mode)->insn_code != CODE_FOR_nothing
+ if (optab_handler (binoptab, wider_mode) != CODE_FOR_nothing
|| (binoptab == smul_optab
&& GET_MODE_WIDER_MODE (wider_mode) != VOIDmode
- && ((optab_handler ((unsignedp ? umul_widen_optab
- : smul_widen_optab),
- GET_MODE_WIDER_MODE (wider_mode))->insn_code)
+ && (optab_handler ((unsignedp ? umul_widen_optab
+ : smul_widen_optab),
+ GET_MODE_WIDER_MODE (wider_mode))
!= CODE_FOR_nothing)))
{
rtx xop0 = op0, xop1 = op1;
@@ -1734,7 +1733,7 @@ expand_binop (enum machine_mode mode, op
if ((binoptab == and_optab || binoptab == ior_optab || binoptab == xor_optab)
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (binoptab, word_mode) != CODE_FOR_nothing)
{
int i;
rtx insns;
@@ -1778,9 +1777,9 @@ expand_binop (enum machine_mode mode, op
&& mclass == MODE_INT
&& (CONST_INT_P (op1) || optimize_insn_for_speed_p ())
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (ashl_optab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (lshr_optab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (binoptab, word_mode) != CODE_FOR_nothing
+ && optab_handler (ashl_optab, word_mode) != CODE_FOR_nothing
+ && optab_handler (lshr_optab, word_mode) != CODE_FOR_nothing)
{
unsigned HOST_WIDE_INT shift_mask, double_shift_mask;
enum machine_mode op1_mode;
@@ -1848,8 +1847,8 @@ expand_binop (enum machine_mode mode, op
&& mclass == MODE_INT
&& CONST_INT_P (op1)
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (ashl_optab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (lshr_optab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (ashl_optab, word_mode) != CODE_FOR_nothing
+ && optab_handler (lshr_optab, word_mode) != CODE_FOR_nothing)
{
rtx insns;
rtx into_target, outof_target;
@@ -1960,7 +1959,7 @@ expand_binop (enum machine_mode mode, op
if ((binoptab == add_optab || binoptab == sub_optab)
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) >= 2 * UNITS_PER_WORD
- && optab_handler (binoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (binoptab, word_mode) != CODE_FOR_nothing)
{
unsigned int i;
optab otheroptab = binoptab == add_optab ? sub_optab : add_optab;
@@ -2057,7 +2056,7 @@ expand_binop (enum machine_mode mode, op
if (i == GET_MODE_BITSIZE (mode) / (unsigned) BITS_PER_WORD)
{
- if (optab_handler (mov_optab, mode)->insn_code != CODE_FOR_nothing
+ if (optab_handler (mov_optab, mode) != CODE_FOR_nothing
|| ! rtx_equal_p (target, xtarget))
{
rtx temp = emit_move_insn (target, xtarget);
@@ -2086,13 +2085,12 @@ expand_binop (enum machine_mode mode, op
if (binoptab == smul_optab
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (smul_optab, word_mode)->insn_code != CODE_FOR_nothing
- && optab_handler (add_optab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (smul_optab, word_mode) != CODE_FOR_nothing
+ && optab_handler (add_optab, word_mode) != CODE_FOR_nothing)
{
rtx product = NULL_RTX;
- if (optab_handler (umul_widen_optab, mode)->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (umul_widen_optab, mode) != CODE_FOR_nothing)
{
product = expand_doubleword_mult (mode, op0, op1, target,
true, methods);
@@ -2101,8 +2099,7 @@ expand_binop (enum machine_mode mode, op
}
if (product == NULL_RTX
- && optab_handler (smul_widen_optab, mode)->insn_code
- != CODE_FOR_nothing)
+ && optab_handler (smul_widen_optab, mode) != CODE_FOR_nothing)
{
product = expand_doubleword_mult (mode, op0, op1, target,
false, methods);
@@ -2112,7 +2109,7 @@ expand_binop (enum machine_mode mode, op
if (product != NULL_RTX)
{
- if (optab_handler (mov_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (mov_optab, mode) != CODE_FOR_nothing)
{
temp = emit_move_insn (target ? target : product, product);
set_unique_reg_note (temp,
@@ -2193,8 +2190,7 @@ expand_binop (enum machine_mode mode, op
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if ((optab_handler (binoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (binoptab, wider_mode) != CODE_FOR_nothing
|| (methods == OPTAB_LIB
&& optab_libfunc (binoptab, wider_mode)))
{
@@ -2270,7 +2266,7 @@ sign_expand_binop (enum machine_mode mod
/* Try widening to a signed int. Make a fake signed optab that
hides any signed insn for direct use. */
wide_soptab = *soptab;
- optab_handler (&wide_soptab, mode)->insn_code = CODE_FOR_nothing;
+ set_optab_handler (&wide_soptab, mode, CODE_FOR_nothing);
/* We don't want to generate new hash table entries from this fake
optab. */
wide_soptab.libcall_gen = NULL;
@@ -2332,9 +2328,9 @@ expand_twoval_unop (optab unoptab, rtx o
/* Record where to go back to if we fail. */
last = get_last_insn ();
- if (optab_handler (unoptab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (unoptab, mode) != CODE_FOR_nothing)
{
- int icode = (int) optab_handler (unoptab, mode)->insn_code;
+ int icode = (int) optab_handler (unoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[2].mode;
rtx pat;
rtx xop0 = op0;
@@ -2370,8 +2366,7 @@ expand_twoval_unop (optab unoptab, rtx o
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (unoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (unoptab, wider_mode) != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (wider_mode);
rtx t1 = gen_reg_rtx (wider_mode);
@@ -2425,9 +2420,9 @@ expand_twoval_binop (optab binoptab, rtx
/* Record where to go back to if we fail. */
last = get_last_insn ();
- if (optab_handler (binoptab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (binoptab, mode) != CODE_FOR_nothing)
{
- int icode = (int) optab_handler (binoptab, mode)->insn_code;
+ int icode = (int) optab_handler (binoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
enum machine_mode mode1 = insn_data[icode].operand[2].mode;
rtx pat;
@@ -2487,8 +2482,7 @@ expand_twoval_binop (optab binoptab, rtx
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (binoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (binoptab, wider_mode) != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (wider_mode);
rtx t1 = gen_reg_rtx (wider_mode);
@@ -2589,8 +2583,7 @@ widen_clz (enum machine_mode mode, rtx o
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (clz_optab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (clz_optab, wider_mode) != CODE_FOR_nothing)
{
rtx xop0, temp, last;
@@ -2702,7 +2695,7 @@ widen_bswap (enum machine_mode mode, rtx
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- if (optab_handler (bswap_optab, wider_mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (bswap_optab, wider_mode) != CODE_FOR_nothing)
goto found;
return NULL_RTX;
@@ -2764,8 +2757,7 @@ expand_parity (enum machine_mode mode, r
for (wider_mode = mode; wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (popcount_optab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (popcount_optab, wider_mode) != CODE_FOR_nothing)
{
rtx xop0, temp, last;
@@ -2806,7 +2798,7 @@ expand_ctz (enum machine_mode mode, rtx
{
rtx seq, temp;
- if (optab_handler (clz_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (clz_optab, mode) == CODE_FOR_nothing)
return 0;
start_sequence ();
@@ -2849,7 +2841,7 @@ expand_ffs (enum machine_mode mode, rtx
bool defined_at_zero = false;
rtx temp, seq;
- if (optab_handler (ctz_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (ctz_optab, mode) != CODE_FOR_nothing)
{
start_sequence ();
@@ -2859,7 +2851,7 @@ expand_ffs (enum machine_mode mode, rtx
defined_at_zero = (CTZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2);
}
- else if (optab_handler (clz_optab, mode)->insn_code != CODE_FOR_nothing)
+ else if (optab_handler (clz_optab, mode) != CODE_FOR_nothing)
{
start_sequence ();
temp = expand_ctz (mode, op0, 0);
@@ -3037,9 +3029,9 @@ expand_absneg_bit (enum rtx_code code, e
expand_unop_direct (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
int unsignedp)
{
- if (optab_handler (unoptab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (unoptab, mode) != CODE_FOR_nothing)
{
- int icode = (int) optab_handler (unoptab, mode)->insn_code;
+ int icode = (int) optab_handler (unoptab, mode);
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
rtx xop0 = op0;
rtx last = get_last_insn ();
@@ -3116,7 +3108,7 @@ expand_unop (enum machine_mode mode, opt
return temp;
if (GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (unoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (unoptab, word_mode) != CODE_FOR_nothing)
{
temp = expand_doubleword_clz (mode, op0, target);
if (temp)
@@ -3134,7 +3126,7 @@ expand_unop (enum machine_mode mode, opt
return temp;
if (GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && optab_handler (unoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (unoptab, word_mode) != CODE_FOR_nothing)
{
temp = expand_doubleword_bswap (mode, op0, target);
if (temp)
@@ -3149,7 +3141,7 @@ expand_unop (enum machine_mode mode, opt
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if (optab_handler (unoptab, wider_mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (unoptab, wider_mode) != CODE_FOR_nothing)
{
rtx xop0 = op0;
rtx last = get_last_insn ();
@@ -3189,7 +3181,7 @@ expand_unop (enum machine_mode mode, opt
if (unoptab == one_cmpl_optab
&& mclass == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && optab_handler (unoptab, word_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (unoptab, word_mode) != CODE_FOR_nothing)
{
int i;
rtx insns;
@@ -3311,8 +3303,7 @@ expand_unop (enum machine_mode mode, opt
wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
- if ((optab_handler (unoptab, wider_mode)->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (unoptab, wider_mode) != CODE_FOR_nothing
|| optab_libfunc (unoptab, wider_mode))
{
rtx xop0 = op0;
@@ -3405,7 +3396,7 @@ expand_abs_nojump (enum machine_mode mod
}
/* If we have a MAX insn, we can do this as MAX (x, -x). */
- if (optab_handler (smax_optab, mode)->insn_code != CODE_FOR_nothing
+ if (optab_handler (smax_optab, mode) != CODE_FOR_nothing
&& !HONOR_SIGNED_ZEROS (mode))
{
rtx last = get_last_insn ();
@@ -3508,7 +3499,7 @@ expand_one_cmpl_abs_nojump (enum machine
return NULL_RTX;
/* If we have a MAX insn, we can do this as MAX (x, ~x). */
- if (optab_handler (smax_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (smax_optab, mode) != CODE_FOR_nothing)
{
rtx last = get_last_insn ();
@@ -3562,7 +3553,7 @@ expand_copysign_absneg (enum machine_mod
/* Check if the back end provides an insn that handles signbit for the
argument's mode. */
- icode = (int) signbit_optab->handlers [(int) mode].insn_code;
+ icode = (int) optab_handler (signbit_optab, mode);
if (icode != CODE_FOR_nothing)
{
imode = insn_data[icode].operand[0].mode;
@@ -3762,8 +3753,8 @@ expand_copysign (rtx op0, rtx op1, rtx t
if (fmt->signbit_ro >= 0
&& (GET_CODE (op0) == CONST_DOUBLE
- || (optab_handler (neg_optab, mode)->insn_code != CODE_FOR_nothing
- && optab_handler (abs_optab, mode)->insn_code != CODE_FOR_nothing)))
+ || (optab_handler (neg_optab, mode) != CODE_FOR_nothing
+ && optab_handler (abs_optab, mode) != CODE_FOR_nothing)))
{
temp = expand_copysign_absneg (mode, op0, op1, target,
fmt->signbit_ro, op0_is_abs);
@@ -3975,8 +3966,7 @@ emit_libcall_block (rtx insns, rtx targe
}
last = emit_move_insn (target, result);
- if (optab_handler (mov_optab, GET_MODE (target))->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (mov_optab, GET_MODE (target)) != CODE_FOR_nothing)
set_unique_reg_note (last, REG_EQUAL, copy_rtx (equiv));
if (final_dest != target)
@@ -4002,15 +3992,15 @@ can_compare_p (enum rtx_code code, enum
int icode;
if (purpose == ccp_jump
- && (icode = optab_handler (cbranch_optab, mode)->insn_code) != CODE_FOR_nothing
+ && (icode = optab_handler (cbranch_optab, mode)) != CODE_FOR_nothing
&& insn_data[icode].operand[0].predicate (test, mode))
return 1;
if (purpose == ccp_store_flag
- && (icode = optab_handler (cstore_optab, mode)->insn_code) != CODE_FOR_nothing
+ && (icode = optab_handler (cstore_optab, mode)) != CODE_FOR_nothing
&& insn_data[icode].operand[1].predicate (test, mode))
return 1;
if (purpose == ccp_cmov
- && optab_handler (cmov_optab, mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (cmov_optab, mode) != CODE_FOR_nothing)
return 1;
mode = GET_MODE_WIDER_MODE (mode);
@@ -4166,7 +4156,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx
do
{
enum insn_code icode;
- icode = optab_handler (cbranch_optab, cmp_mode)->insn_code;
+ icode = optab_handler (cbranch_optab, cmp_mode);
if (icode != CODE_FOR_nothing
&& insn_data[icode].operand[0].predicate (test, VOIDmode))
{
@@ -4285,7 +4275,7 @@ emit_cmp_and_jump_insn_1 (rtx test, enum
mclass = GET_MODE_CLASS (mode);
optab_mode = (mclass == MODE_CC) ? CCmode : mode;
- icode = optab_handler (cbranch_optab, optab_mode)->insn_code;
+ icode = optab_handler (cbranch_optab, optab_mode);
gcc_assert (icode != CODE_FOR_nothing);
gcc_assert (insn_data[icode].operand[0].predicate (test, VOIDmode));
@@ -4684,7 +4674,7 @@ emit_conditional_add (rtx target, enum r
if (mode == VOIDmode)
mode = GET_MODE (op2);
- icode = optab_handler (addcc_optab, mode)->insn_code;
+ icode = optab_handler (addcc_optab, mode);
if (icode == CODE_FOR_nothing)
return 0;
@@ -4755,7 +4745,7 @@ emit_conditional_add (rtx target, enum r
rtx
gen_add2_insn (rtx x, rtx y)
{
- int icode = (int) optab_handler (add_optab, GET_MODE (x))->insn_code;
+ int icode = (int) optab_handler (add_optab, GET_MODE (x));
gcc_assert (insn_data[icode].operand[0].predicate
(x, insn_data[icode].operand[0].mode));
@@ -4773,7 +4763,7 @@ gen_add2_insn (rtx x, rtx y)
rtx
gen_add3_insn (rtx r0, rtx r1, rtx c)
{
- int icode = (int) optab_handler (add_optab, GET_MODE (r0))->insn_code;
+ int icode = (int) optab_handler (add_optab, GET_MODE (r0));
if (icode == CODE_FOR_nothing
|| !(insn_data[icode].operand[0].predicate
@@ -4794,7 +4784,7 @@ have_add2_insn (rtx x, rtx y)
gcc_assert (GET_MODE (x) != VOIDmode);
- icode = (int) optab_handler (add_optab, GET_MODE (x))->insn_code;
+ icode = (int) optab_handler (add_optab, GET_MODE (x));
if (icode == CODE_FOR_nothing)
return 0;
@@ -4815,7 +4805,7 @@ have_add2_insn (rtx x, rtx y)
rtx
gen_sub2_insn (rtx x, rtx y)
{
- int icode = (int) optab_handler (sub_optab, GET_MODE (x))->insn_code;
+ int icode = (int) optab_handler (sub_optab, GET_MODE (x));
gcc_assert (insn_data[icode].operand[0].predicate
(x, insn_data[icode].operand[0].mode));
@@ -4833,7 +4823,7 @@ gen_sub2_insn (rtx x, rtx y)
rtx
gen_sub3_insn (rtx r0, rtx r1, rtx c)
{
- int icode = (int) optab_handler (sub_optab, GET_MODE (r0))->insn_code;
+ int icode = (int) optab_handler (sub_optab, GET_MODE (r0));
if (icode == CODE_FOR_nothing
|| !(insn_data[icode].operand[0].predicate
@@ -4854,7 +4844,7 @@ have_sub2_insn (rtx x, rtx y)
gcc_assert (GET_MODE (x) != VOIDmode);
- icode = (int) optab_handler (sub_optab, GET_MODE (x))->insn_code;
+ icode = (int) optab_handler (sub_optab, GET_MODE (x));
if (icode == CODE_FOR_nothing)
return 0;
@@ -4900,7 +4890,7 @@ can_extend_p (enum machine_mode to_mode,
#endif
tab = unsignedp ? zext_optab : sext_optab;
- return convert_optab_handler (tab, to_mode, from_mode)->insn_code;
+ return convert_optab_handler (tab, to_mode, from_mode);
}
/* Generate the body of an insn to extend Y (with mode MFROM)
@@ -4931,7 +4921,7 @@ can_fix_p (enum machine_mode fixmode, en
enum insn_code icode;
tab = unsignedp ? ufixtrunc_optab : sfixtrunc_optab;
- icode = convert_optab_handler (tab, fixmode, fltmode)->insn_code;
+ icode = convert_optab_handler (tab, fixmode, fltmode);
if (icode != CODE_FOR_nothing)
{
*truncp_ptr = 0;
@@ -4942,9 +4932,9 @@ can_fix_p (enum machine_mode fixmode, en
for this to work. We need to rework the fix* and ftrunc* patterns
and documentation. */
tab = unsignedp ? ufix_optab : sfix_optab;
- icode = convert_optab_handler (tab, fixmode, fltmode)->insn_code;
+ icode = convert_optab_handler (tab, fixmode, fltmode);
if (icode != CODE_FOR_nothing
- && optab_handler (ftrunc_optab, fltmode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (ftrunc_optab, fltmode) != CODE_FOR_nothing)
{
*truncp_ptr = 1;
return icode;
@@ -4961,7 +4951,7 @@ can_float_p (enum machine_mode fltmode,
convert_optab tab;
tab = unsignedp ? ufloat_optab : sfloat_optab;
- return convert_optab_handler (tab, fltmode, fixmode)->insn_code;
+ return convert_optab_handler (tab, fltmode, fixmode);
}
\f
/* Generate code to convert FROM to floating point
@@ -5295,8 +5285,7 @@ expand_fix (rtx to, rtx from, int unsign
emit_label (lab2);
- if (optab_handler (mov_optab, GET_MODE (to))->insn_code
- != CODE_FOR_nothing)
+ if (optab_handler (mov_optab, GET_MODE (to)) != CODE_FOR_nothing)
{
/* Make a place for a REG_NOTE and add it. */
insn = emit_move_insn (to, to);
@@ -5383,7 +5372,7 @@ expand_fixed_convert (rtx to, rtx from,
tab = satp ? satfract_optab : fract_optab;
this_code = satp ? SAT_FRACT : FRACT_CONVERT;
}
- code = tab->handlers[to_mode][from_mode].insn_code;
+ code = convert_optab_handler (tab, to_mode, from_mode);
if (code != CODE_FOR_nothing)
{
emit_unop_insn (code, to, from, this_code);
@@ -5424,7 +5413,7 @@ expand_sfix_optab (rtx to, rtx from, con
for (imode = GET_MODE (to); imode != VOIDmode;
imode = GET_MODE_WIDER_MODE (imode))
{
- icode = convert_optab_handler (tab, imode, fmode)->insn_code;
+ icode = convert_optab_handler (tab, imode, fmode);
if (icode != CODE_FOR_nothing)
{
rtx last = get_last_insn ();
@@ -5454,7 +5443,7 @@ expand_sfix_optab (rtx to, rtx from, con
have_insn_for (enum rtx_code code, enum machine_mode mode)
{
return (code_to_optab[(int) code] != 0
- && (optab_handler (code_to_optab[(int) code], mode)->insn_code
+ && (optab_handler (code_to_optab[(int) code], mode)
!= CODE_FOR_nothing));
}
@@ -5472,7 +5461,7 @@ init_insn_codes (void)
op = &optab_table[i];
for (j = 0; j < NUM_MACHINE_MODES; j++)
- optab_handler (op, j)->insn_code = CODE_FOR_nothing;
+ set_optab_handler (op, (enum machine_mode) j, CODE_FOR_nothing);
}
for (i = 0; i < (unsigned int) COI_MAX; i++)
{
@@ -5482,7 +5471,8 @@ init_insn_codes (void)
op = &convert_optab_table[i];
for (j = 0; j < NUM_MACHINE_MODES; j++)
for (k = 0; k < NUM_MACHINE_MODES; k++)
- convert_optab_handler (op, j, k)->insn_code = CODE_FOR_nothing;
+ set_convert_optab_handler (op, (enum machine_mode) j,
+ (enum machine_mode) k, CODE_FOR_nothing);
}
}
@@ -6211,7 +6201,8 @@ init_optabs (void)
}
#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
- /* We statically initialize the insn_codes with CODE_FOR_nothing. */
+ /* We statically initialize the insn_codes with the equivalent of
+ CODE_FOR_nothing. */
if (reinit)
init_insn_codes ();
#else
@@ -6763,7 +6754,7 @@ gen_cond_trap (enum rtx_code code, rtx o
if (mode == VOIDmode)
return 0;
- icode = optab_handler (ctrap_optab, mode)->insn_code;
+ icode = optab_handler (ctrap_optab, mode);
if (icode == CODE_FOR_nothing)
return 0;
Index: gcc/reload.c
===================================================================
--- gcc/reload.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/reload.c 2010-07-03 19:21:15.000000000 +0100
@@ -5834,8 +5834,7 @@ #define REG_OK_FOR_CONTEXT(CONTEXT, REGN
rtx equiv = (MEM_P (XEXP (x, 0))
? XEXP (x, 0)
: reg_equiv_mem[regno]);
- int icode
- = (int) optab_handler (add_optab, GET_MODE (x))->insn_code;
+ int icode = (int) optab_handler (add_optab, GET_MODE (x));
if (insn && NONJUMP_INSN_P (insn) && equiv
&& memory_operand (equiv, GET_MODE (equiv))
#ifdef HAVE_cc0
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/reload1.c 2010-07-03 20:10:46.000000000 +0100
@@ -8680,7 +8680,7 @@ gen_reload (rtx out, rtx in, int opnum,
DEFINE_PEEPHOLE should be specified that recognizes the sequence
we emit below. */
- code = (int) optab_handler (add_optab, GET_MODE (out))->insn_code;
+ code = (int) optab_handler (add_optab, GET_MODE (out));
if (CONSTANT_P (op1) || MEM_P (op1) || GET_CODE (op1) == SUBREG
|| (REG_P (op1)
Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/stmt.c 2010-07-03 19:21:15.000000000 +0100
@@ -2071,7 +2071,7 @@ #define MAX_CASE_BIT_TESTS 3
/* By default, enable case bit tests on targets with ashlsi3. */
#ifndef CASE_USE_BIT_TESTS
-#define CASE_USE_BIT_TESTS (optab_handler (ashl_optab, word_mode)->insn_code \
+#define CASE_USE_BIT_TESTS (optab_handler (ashl_optab, word_mode) \
!= CODE_FOR_nothing)
#endif
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/targhooks.c 2010-07-03 20:10:46.000000000 +0100
@@ -971,7 +971,7 @@ default_builtin_support_vector_misalignm
bool is_packed
ATTRIBUTE_UNUSED)
{
- if (optab_handler (movmisalign_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (movmisalign_optab, mode) != CODE_FOR_nothing)
return true;
return false;
}
Index: gcc/tree-ssa-loop-prefetch.c
===================================================================
--- gcc/tree-ssa-loop-prefetch.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-ssa-loop-prefetch.c 2010-07-03 19:21:15.000000000 +0100
@@ -1136,7 +1136,7 @@ nontemporal_store_p (struct mem_ref *ref
if (mode == BLKmode)
return false;
- code = optab_handler (storent_optab, mode)->insn_code;
+ code = optab_handler (storent_optab, mode);
return code != CODE_FOR_nothing;
}
Index: gcc/tree-ssa-math-opts.c
===================================================================
--- gcc/tree-ssa-math-opts.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-ssa-math-opts.c 2010-07-03 19:21:15.000000000 +0100
@@ -1113,11 +1113,9 @@ execute_optimize_bswap (void)
return 0;
bswap32_p = (built_in_decls[BUILT_IN_BSWAP32]
- && optab_handler (bswap_optab, SImode)->insn_code !=
- CODE_FOR_nothing);
+ && optab_handler (bswap_optab, SImode) != CODE_FOR_nothing);
bswap64_p = (built_in_decls[BUILT_IN_BSWAP64]
- && (optab_handler (bswap_optab, DImode)->insn_code !=
- CODE_FOR_nothing
+ && (optab_handler (bswap_optab, DImode) != CODE_FOR_nothing
|| (bswap32_p && word_mode == SImode)));
if (!bswap32_p && !bswap64_p)
@@ -1324,17 +1322,17 @@ convert_mult_to_widen (gimple stmt)
if ((rhs1_stmt == NULL || TYPE_UNSIGNED (type1))
&& (rhs2_stmt == NULL || TYPE_UNSIGNED (type2))
&& (optab_handler (umul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
+ == CODE_FOR_nothing))
return false;
else if ((rhs1_stmt == NULL || !TYPE_UNSIGNED (type1))
&& (rhs2_stmt == NULL || !TYPE_UNSIGNED (type2))
&& (optab_handler (smul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
+ == CODE_FOR_nothing))
return false;
else if (rhs1_stmt != NULL && rhs2_stmt != NULL
&& (TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2))
&& (optab_handler (usmul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
+ == CODE_FOR_nothing))
return false;
if ((rhs1_stmt == NULL && !int_fits_type_p (rhs1, type2))
@@ -1385,8 +1383,7 @@ convert_plusminus_to_widen (gimple_stmt_
accumulate in this mode/signedness combination, otherwise
this transformation is likely to pessimize code. */
this_optab = optab_for_tree_code (wmult_code, type, optab_default);
- if (optab_handler (this_optab, TYPE_MODE (type))->insn_code
- == CODE_FOR_nothing)
+ if (optab_handler (this_optab, TYPE_MODE (type)) == CODE_FOR_nothing)
return false;
rhs1 = gimple_assign_rhs1 (stmt);
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-vect-data-refs.c 2010-07-03 19:51:40.000000000 +0100
@@ -2854,9 +2854,9 @@ vect_create_destination_var (tree scalar
vect_strided_store_supported (tree vectype)
{
optab interleave_high_optab, interleave_low_optab;
- int mode;
+ enum machine_mode mode;
- mode = (int) TYPE_MODE (vectype);
+ mode = TYPE_MODE (vectype);
/* Check that the operation is supported. */
interleave_high_optab = optab_for_tree_code (VEC_INTERLEAVE_HIGH_EXPR,
@@ -2870,10 +2870,8 @@ vect_strided_store_supported (tree vecty
return false;
}
- if (optab_handler (interleave_high_optab, mode)->insn_code
- == CODE_FOR_nothing
- || optab_handler (interleave_low_optab, mode)->insn_code
- == CODE_FOR_nothing)
+ if (optab_handler (interleave_high_optab, mode) == CODE_FOR_nothing
+ || optab_handler (interleave_low_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "interleave op not supported by target.");
@@ -3266,9 +3264,9 @@ vect_setup_realignment (gimple stmt, gim
vect_strided_load_supported (tree vectype)
{
optab perm_even_optab, perm_odd_optab;
- int mode;
+ enum machine_mode mode;
- mode = (int) TYPE_MODE (vectype);
+ mode = TYPE_MODE (vectype);
perm_even_optab = optab_for_tree_code (VEC_EXTRACT_EVEN_EXPR, vectype,
optab_default);
@@ -3279,7 +3277,7 @@ vect_strided_load_supported (tree vectyp
return false;
}
- if (optab_handler (perm_even_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (perm_even_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "perm_even op not supported by target.");
@@ -3295,7 +3293,7 @@ vect_strided_load_supported (tree vectyp
return false;
}
- if (optab_handler (perm_odd_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (perm_odd_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "perm_odd op not supported by target.");
@@ -3652,8 +3650,7 @@ vect_supportable_dr_alignment (struct da
bool is_packed = false;
tree type = (TREE_TYPE (DR_REF (dr)));
- if (optab_handler (vec_realign_load_optab, mode)->insn_code !=
- CODE_FOR_nothing
+ if (optab_handler (vec_realign_load_optab, mode) != CODE_FOR_nothing
&& (!targetm.vectorize.builtin_mask_for_load
|| targetm.vectorize.builtin_mask_for_load ()))
{
Index: gcc/tree-vect-generic.c
===================================================================
--- gcc/tree-vect-generic.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-vect-generic.c 2010-07-03 19:21:15.000000000 +0100
@@ -368,7 +368,7 @@ type_for_widest_vector_mode (enum machin
for (; mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode))
if (GET_MODE_INNER (mode) == inner_mode
&& GET_MODE_NUNITS (mode) > best_nunits
- && optab_handler (op, mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (op, mode) != CODE_FOR_nothing)
best_mode = mode, best_nunits = GET_MODE_NUNITS (mode);
if (best_mode == VOIDmode)
@@ -443,8 +443,7 @@ expand_vector_operations_1 (gimple_stmt_
have a vector/vector shift */
op = optab_for_tree_code (code, type, optab_scalar);
if (!op
- || (op->handlers[(int) TYPE_MODE (type)].insn_code
- == CODE_FOR_nothing))
+ || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
op = optab_for_tree_code (code, type, optab_vector);
}
}
@@ -498,7 +497,7 @@ expand_vector_operations_1 (gimple_stmt_
|| GET_MODE_CLASS (compute_mode) == MODE_VECTOR_ACCUM
|| GET_MODE_CLASS (compute_mode) == MODE_VECTOR_UACCUM)
&& op != NULL
- && optab_handler (op, compute_mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (op, compute_mode) != CODE_FOR_nothing)
return;
else
/* There is no operation in hardware, so fall back to scalars. */
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-vect-loop.c 2010-07-03 19:21:15.000000000 +0100
@@ -132,7 +132,7 @@ Software Foundation; either version 3, o
Since we only vectorize operations which vector form can be
expressed using existing tree codes, to verify that an operation is
supported, the vectorizer checks the relevant optab at the relevant
- machine_mode (e.g, optab_handler (add_optab, V8HImode)->insn_code). If
+ machine_mode (e.g, optab_handler (add_optab, V8HImode)). If
the value found is CODE_FOR_nothing, then there's no target support, and
we can't vectorize the stmt.
@@ -2421,8 +2421,8 @@ vect_model_reduction_cost (stmt_vec_info
/* We have a whole vector shift available. */
if (VECTOR_MODE_P (mode)
- && optab_handler (optab, mode)->insn_code != CODE_FOR_nothing
- && optab_handler (vec_shr_optab, mode)->insn_code != CODE_FOR_nothing)
+ && optab_handler (optab, mode) != CODE_FOR_nothing
+ && optab_handler (vec_shr_optab, mode) != CODE_FOR_nothing)
/* Final reduction via vector shifts and the reduction operator. Also
requires scalar extract. */
outer_cost += ((exact_log2(nelements) * 2)
@@ -3264,7 +3264,7 @@ vect_create_epilog_for_reduction (VEC (t
int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
tree vec_temp;
- if (optab_handler (vec_shr_optab, mode)->insn_code != CODE_FOR_nothing)
+ if (optab_handler (vec_shr_optab, mode) != CODE_FOR_nothing)
shift_code = VEC_RSHIFT_EXPR;
else
have_whole_vector_shift = false;
@@ -3280,7 +3280,7 @@ vect_create_epilog_for_reduction (VEC (t
else
{
optab optab = optab_for_tree_code (code, vectype, optab_default);
- if (optab_handler (optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (optab, mode) == CODE_FOR_nothing)
have_whole_vector_shift = false;
}
@@ -3939,7 +3939,7 @@ vectorizable_reduction (gimple stmt, gim
return false;
}
- if (optab_handler (optab, vec_mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (optab, vec_mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "op not supported by target.");
@@ -3987,11 +3987,12 @@ vectorizable_reduction (gimple stmt, gim
2. The type (mode) we use to check available target support
for the vector operation to be created in the *epilog*, is
determined by the type of the reduction variable (in the example
- above we'd check this: plus_optab[vect_int_mode]).
+ above we'd check this: optab_handler (plus_optab, vect_int_mode])).
However the type (mode) we use to check available target support
for the vector operation to be created *inside the loop*, is
determined by the type of the other arguments to STMT (in the
- example we'd check this: widen_sum_optab[vect_short_mode]).
+ example we'd check this: optab_handler (widen_sum_optab,
+ vect_short_mode)).
This is contrary to "regular" reductions, in which the types of all
the arguments are the same as the type of the reduction variable.
@@ -4044,8 +4045,7 @@ vectorizable_reduction (gimple stmt, gim
}
if (reduc_optab
- && optab_handler (reduc_optab, vec_mode)->insn_code
- == CODE_FOR_nothing)
+ && optab_handler (reduc_optab, vec_mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "reduc op not supported by target.");
Index: gcc/tree-vect-patterns.c
===================================================================
--- gcc/tree-vect-patterns.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-vect-patterns.c 2010-07-03 19:21:15.000000000 +0100
@@ -714,8 +714,7 @@ vect_pattern_recog_1 (
optab = optab_for_tree_code (code, type_in, optab_default);
vec_mode = TYPE_MODE (type_in);
if (!optab
- || (icode = optab_handler (optab, vec_mode)->insn_code) ==
- CODE_FOR_nothing
+ || (icode = optab_handler (optab, vec_mode)) == CODE_FOR_nothing
|| (insn_data[icode].operand[0].mode != TYPE_MODE (type_out)))
return;
}
Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-vect-slp.c 2010-07-03 19:21:15.000000000 +0100
@@ -421,8 +421,7 @@ vect_build_slp_tree (loop_vec_info loop_
optab_vector);
if (!optab
- || (optab->handlers[(int) vec_mode].insn_code
- == CODE_FOR_nothing))
+ || optab_handler (optab, vec_mode) == CODE_FOR_nothing)
{
/* No vector/vector shift, try for a vector/scalar shift. */
optab = optab_for_tree_code (rhs_code, vectype,
@@ -434,7 +433,7 @@ vect_build_slp_tree (loop_vec_info loop_
fprintf (vect_dump, "Build SLP failed: no optab.");
return false;
}
- icode = (int) optab->handlers[(int) vec_mode].insn_code;
+ icode = (int) optab_handler (optab, vec_mode);
if (icode == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_SLP))
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c 2010-07-03 19:20:35.000000000 +0100
+++ gcc/tree-vect-stmts.c 2010-07-03 19:51:23.000000000 +0100
@@ -2104,8 +2104,7 @@ vectorizable_operation (gimple stmt, gim
{
optab = optab_for_tree_code (code, vectype, optab_scalar);
if (optab
- && (optab_handler (optab, TYPE_MODE (vectype))->insn_code
- != CODE_FOR_nothing))
+ && optab_handler (optab, TYPE_MODE (vectype)) != CODE_FOR_nothing)
{
scalar_shift_arg = true;
if (vect_print_dump_info (REPORT_DETAILS))
@@ -2115,7 +2114,7 @@ vectorizable_operation (gimple stmt, gim
{
optab = optab_for_tree_code (code, vectype, optab_vector);
if (optab
- && (optab_handler (optab, TYPE_MODE (vectype))->insn_code
+ && (optab_handler (optab, TYPE_MODE (vectype))
!= CODE_FOR_nothing))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -2149,7 +2148,7 @@ vectorizable_operation (gimple stmt, gim
return false;
}
vec_mode = TYPE_MODE (vectype);
- icode = (int) optab_handler (optab, vec_mode)->insn_code;
+ icode = (int) optab_handler (optab, vec_mode);
if (icode == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -3051,7 +3050,7 @@ vectorizable_store (gimple stmt, gimple_
vec_mode = TYPE_MODE (vectype);
/* FORNOW. In some cases can vectorize even if data-type not supported
(e.g. - array initialization with 0). */
- if (optab_handler (mov_optab, (int)vec_mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (mov_optab, vec_mode) == CODE_FOR_nothing)
return false;
if (!STMT_VINFO_DATA_REF (stmt_info))
@@ -3349,7 +3348,7 @@ vectorizable_load (gimple stmt, gimple_s
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info), *first_dr;
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree new_temp;
- int mode;
+ enum machine_mode mode;
gimple new_stmt = NULL;
tree dummy;
enum dr_alignment_support alignment_support_scheme;
@@ -3430,11 +3429,11 @@ vectorizable_load (gimple stmt, gimple_s
return false;
scalar_type = TREE_TYPE (DR_REF (dr));
- mode = (int) TYPE_MODE (vectype);
+ mode = TYPE_MODE (vectype);
/* FORNOW. In some cases can vectorize even if data-type not supported
(e.g. - data copies). */
- if (optab_handler (mov_optab, mode)->insn_code == CODE_FOR_nothing)
+ if (optab_handler (mov_optab, mode) == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "Aligned load, but unsupported type.");
@@ -4886,9 +4885,8 @@ supportable_widening_operation (enum tre
return false;
vec_mode = TYPE_MODE (vectype);
- if ((icode1 = optab_handler (optab1, vec_mode)->insn_code) == CODE_FOR_nothing
- || (icode2 = optab_handler (optab2, vec_mode)->insn_code)
- == CODE_FOR_nothing)
+ if ((icode1 = optab_handler (optab1, vec_mode)) == CODE_FOR_nothing
+ || (icode2 = optab_handler (optab2, vec_mode)) == CODE_FOR_nothing)
return false;
/* Check if it's a multi-step conversion that can be done using intermediate
@@ -4920,16 +4918,16 @@ supportable_widening_operation (enum tre
optab4 = optab_for_tree_code (c2, intermediate_type, optab_default);
if (!optab3 || !optab4
- || (icode1 = optab1->handlers[(int) prev_mode].insn_code)
- == CODE_FOR_nothing
+ || ((icode1 = optab_handler (optab1, prev_mode))
+ == CODE_FOR_nothing)
|| insn_data[icode1].operand[0].mode != intermediate_mode
- || (icode2 = optab2->handlers[(int) prev_mode].insn_code)
- == CODE_FOR_nothing
+ || ((icode2 = optab_handler (optab2, prev_mode))
+ == CODE_FOR_nothing)
|| insn_data[icode2].operand[0].mode != intermediate_mode
- || (icode1 = optab3->handlers[(int) intermediate_mode].insn_code)
- == CODE_FOR_nothing
- || (icode2 = optab4->handlers[(int) intermediate_mode].insn_code)
- == CODE_FOR_nothing)
+ || ((icode1 = optab_handler (optab3, intermediate_mode))
+ == CODE_FOR_nothing)
+ || ((icode2 = optab_handler (optab4, intermediate_mode))
+ == CODE_FOR_nothing))
return false;
VEC_quick_push (tree, *interm_types, intermediate_type);
@@ -5016,8 +5014,7 @@ supportable_narrowing_operation (enum tr
return false;
vec_mode = TYPE_MODE (vectype);
- if ((icode1 = optab_handler (optab1, vec_mode)->insn_code)
- == CODE_FOR_nothing)
+ if ((icode1 = optab_handler (optab1, vec_mode)) == CODE_FOR_nothing)
return false;
/* Check if it's a multi-step conversion that can be done using intermediate
@@ -5040,12 +5037,11 @@ supportable_narrowing_operation (enum tr
interm_optab = optab_for_tree_code (c1, intermediate_type,
optab_default);
if (!interm_optab
- || (icode1 = optab1->handlers[(int) prev_mode].insn_code)
- == CODE_FOR_nothing
+ || ((icode1 = optab_handler (optab1, prev_mode))
+ == CODE_FOR_nothing)
|| insn_data[icode1].operand[0].mode != intermediate_mode
- || (icode1
- = interm_optab->handlers[(int) intermediate_mode].insn_code)
- == CODE_FOR_nothing)
+ || ((icode1 = optab_handler (interm_optab, intermediate_mode))
+ == CODE_FOR_nothing))
return false;
VEC_quick_push (tree, *interm_types, intermediate_type);
Index: gcc/config/m32c/m32c.c
===================================================================
--- gcc/config/m32c/m32c.c 2010-07-03 19:20:34.000000000 +0100
+++ gcc/config/m32c/m32c.c 2010-07-03 19:21:15.000000000 +0100
@@ -1789,9 +1789,9 @@ m32c_init_libfuncs (void)
the right modes are found. */
if (TARGET_A24)
{
- optab_handler (cstore_optab, QImode)->insn_code = CODE_FOR_cstoreqi4_24;
- optab_handler (cstore_optab, HImode)->insn_code = CODE_FOR_cstorehi4_24;
- optab_handler (cstore_optab, PSImode)->insn_code = CODE_FOR_cstorepsi4_24;
+ set_optab_handler (cstore_optab, QImode, CODE_FOR_cstoreqi4_24);
+ set_optab_handler (cstore_optab, HImode, CODE_FOR_cstorehi4_24);
+ set_optab_handler (cstore_optab, PSImode, CODE_FOR_cstorepsi4_24);
}
}
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c 2010-07-03 19:20:34.000000000 +0100
+++ gcc/config/rs6000/rs6000.c 2010-07-03 19:21:15.000000000 +0100
@@ -3327,8 +3327,7 @@ rs6000_builtin_support_vector_misalignme
if (TARGET_VSX)
{
/* Return if movmisalign pattern is not supported for this mode. */
- if (optab_handler (movmisalign_optab, mode)->insn_code ==
- CODE_FOR_nothing)
+ if (optab_handler (movmisalign_optab, mode) == CODE_FOR_nothing)
return false;
if (misalignment == -1)
@@ -16243,7 +16242,7 @@ rs6000_emit_vector_compare (enum rtx_cod
if (rev_code == UNKNOWN)
return NULL_RTX;
- nor_code = optab_handler (one_cmpl_optab, (int)dmode)->insn_code;
+ nor_code = optab_handler (one_cmpl_optab, dmode);
if (nor_code == CODE_FOR_nothing)
return NULL_RTX;
@@ -16288,7 +16287,7 @@ rs6000_emit_vector_compare (enum rtx_cod
gcc_unreachable ();
}
- ior_code = optab_handler (ior_optab, (int)dmode)->insn_code;
+ ior_code = optab_handler (ior_optab, dmode);
if (ior_code == CODE_FOR_nothing)
return NULL_RTX;
@@ -25641,8 +25640,8 @@ rs6000_emit_madd (rtx dst, rtx m1, rtx m
{
/* For the simple ops, use the generator function, rather than assuming
that the RTL is standard. */
- enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
- enum insn_code acode = optab_handler (add_optab, mode)->insn_code;
+ enum insn_code mcode = optab_handler (smul_optab, mode);
+ enum insn_code acode = optab_handler (add_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
gen_2arg_fn_t gen_add = (gen_2arg_fn_t) GEN_FCN (acode);
rtx mreg = gen_reg_rtx (mode);
@@ -25674,8 +25673,8 @@ rs6000_emit_msub (rtx dst, rtx m1, rtx m
{
/* For the simple ops, use the generator function, rather than assuming
that the RTL is standard. */
- enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
- enum insn_code scode = optab_handler (add_optab, mode)->insn_code;
+ enum insn_code mcode = optab_handler (smul_optab, mode);
+ enum insn_code scode = optab_handler (add_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
gen_2arg_fn_t gen_sub = (gen_2arg_fn_t) GEN_FCN (scode);
rtx mreg = gen_reg_rtx (mode);
@@ -25710,8 +25709,8 @@ rs6000_emit_nmsub (rtx dst, rtx m1, rtx
{
/* For the simple ops, use the generator function, rather than assuming
that the RTL is standard. */
- enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
- enum insn_code scode = optab_handler (sub_optab, mode)->insn_code;
+ enum insn_code mcode = optab_handler (smul_optab, mode);
+ enum insn_code scode = optab_handler (sub_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
gen_2arg_fn_t gen_sub = (gen_2arg_fn_t) GEN_FCN (scode);
rtx mreg = gen_reg_rtx (mode);
@@ -25745,7 +25744,7 @@ rs6000_emit_swdiv_high_precision (rtx ds
{
enum machine_mode mode = GET_MODE (dst);
rtx x0, e0, e1, y1, u0, v0;
- enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code code = optab_handler (smul_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
rtx one = rs6000_load_constant_and_splat (mode, dconst1);
@@ -25783,7 +25782,7 @@ rs6000_emit_swdiv_low_precision (rtx dst
{
enum machine_mode mode = GET_MODE (dst);
rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one;
- enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code code = optab_handler (smul_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
gcc_assert (code != CODE_FOR_nothing);
@@ -25854,7 +25853,7 @@ rs6000_emit_swrsqrt (rtx dst, rtx src)
REAL_VALUE_TYPE dconst3_2;
int i;
rtx halfthree;
- enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code code = optab_handler (smul_optab, mode);
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
gcc_assert (code != CODE_FOR_nothing);
Index: gcc/config/spu/spu.c
===================================================================
--- gcc/config/spu/spu.c 2010-07-03 19:20:34.000000000 +0100
+++ gcc/config/spu/spu.c 2010-07-03 19:21:15.000000000 +0100
@@ -1139,7 +1139,7 @@ spu_emit_branch_or_set (int is_set, rtx
if (eq_rtx == 0)
abort ();
emit_insn (eq_rtx);
- ior_code = ior_optab->handlers[(int)comp_mode].insn_code;
+ ior_code = optab_handler (ior_optab, comp_mode);
gcc_assert (ior_code != CODE_FOR_nothing);
emit_insn (GEN_FCN (ior_code)
(compare_result, compare_result, eq_result));
@@ -4588,7 +4588,8 @@ spu_expand_mov (rtx * ops, enum machine_
if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (imode))
{
- enum insn_code icode = convert_optab_handler (trunc_optab, mode, imode)->insn_code;
+ enum insn_code icode = convert_optab_handler (trunc_optab,
+ mode, imode);
emit_insn (GEN_FCN (icode) (ops[0], from));
}
else
@@ -6251,7 +6252,7 @@ spu_emit_vector_compare (enum rtx_code r
{
enum insn_code nor_code;
rtx eq_rtx = spu_emit_vector_compare (EQ, op0, op1, dest_mode);
- nor_code = optab_handler (one_cmpl_optab, (int)dest_mode)->insn_code;
+ nor_code = optab_handler (one_cmpl_optab, dest_mode);
gcc_assert (nor_code != CODE_FOR_nothing);
emit_insn (GEN_FCN (nor_code) (mask, eq_rtx));
if (dmode != dest_mode)
@@ -6286,7 +6287,7 @@ spu_emit_vector_compare (enum rtx_code r
c_rtx = spu_emit_vector_compare (new_code, op0, op1, dest_mode);
eq_rtx = spu_emit_vector_compare (EQ, op0, op1, dest_mode);
- ior_code = optab_handler (ior_optab, (int)dest_mode)->insn_code;
+ ior_code = optab_handler (ior_optab, dest_mode);
gcc_assert (ior_code != CODE_FOR_nothing);
emit_insn (GEN_FCN (ior_code) (mask, c_rtx, eq_rtx));
if (dmode != dest_mode)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-04 13:41 ` Richard Sandiford
@ 2010-07-04 13:43 ` Richard Sandiford
2010-07-04 13:45 ` Diego Novillo
1 sibling, 0 replies; 19+ messages in thread
From: Richard Sandiford @ 2010-07-04 13:43 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches
Richard Sandiford <rdsandiford@googlemail.com> writes:
> Diego Novillo <dnovillo@google.com> writes:
>> On Saturday, July 3, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
>>> I wondered about that, and not having a strong feeling either way,
>>> decided to stick with the current macro idiom. Can change if you like.
>>
>> Yes, please. I would like to eliminate most of the function-like
>> macros we have. Let the inliner do its job and improve debuggability
>> by being able to set proper breakpoints.
>
> OK, here's the updated version.
...but with the old changelog, *sigh*. Pretend I sent this one.
Richard
gcc/
* optabs.h (optab_handler, convert_optab_handler): Turn into
inline functions that return an insn code.
(set_optab_handler, set_convert_optab_handler): New functions.
* builtins.c: Replace optab_handler(X)->insn_code with
optab_handler or set_optab_handler thoughout. Likewise
convert_optab_handler(X)->insn_code with convert_optab_handler
and set_convert_optab_handler.
* expmed.c, expr.c, genopinit.c, ifcvt.c, optabs.c, reload.c,
reload1.c, stmt.c, targhooks.c, tree-ssa-loop-prefetch.c,
tree-ssa-math-opts.c, tree-vect-data-refs.c, tree-vect-generic.c,
tree-vect-loop.c, tree-vect-patterns.c, tree-vect-slp.c,
tree-vect-stmts.c, config/m32c/m32c.c, config/rs6000/rs6000.c,
config/spu/spu.c: Likewise.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-04 13:41 ` Richard Sandiford
2010-07-04 13:43 ` Richard Sandiford
@ 2010-07-04 13:45 ` Diego Novillo
1 sibling, 0 replies; 19+ messages in thread
From: Diego Novillo @ 2010-07-04 13:45 UTC (permalink / raw)
To: Diego Novillo, gcc-patches, rdsandiford
On Sunday, July 4, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> OK, here's the updated version. Tested as before. OK to install?
The ChanfeLog needs to be adjusted. OK with that change.
Diego.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [2/3] optabs: Bias optabs by -CODE_FOR_nothing
2010-07-03 17:44 ` [2/3] optabs: Bias optabs by -CODE_FOR_nothing Richard Sandiford
@ 2010-07-04 13:46 ` Richard Sandiford
0 siblings, 0 replies; 19+ messages in thread
From: Richard Sandiford @ 2010-07-04 13:46 UTC (permalink / raw)
To: gcc-patches
Richard Sandiford <rdsandiford@googlemail.com> writes:
> This patch biases the opcode "insn_code" by -CODE_FOR_nothing, so that
> optabs without insns have an insn_code of 0. The change incurs an extra
> addition when determining which generator function to call, but the
> cost is going to be dwarfed by the call and rtx generation.
> The change often simplifies the common idiom:
>
> OPTAB_HANDLER (...) ==/!= CODE_FOR_nothing
>
> Bootstrapped & regression-tested on x86_64-linux-gnu. OK to intsall?
Now updated to use inlines. Tested as before. OK to install?
Richard
gcc/
* optabs.h (optab_handlers): Change type of insn_code to int.
(optab_handler, set_optab_handler, convert_optab_handler)
(set_convert_optab_handler): Treat the insn_code field as "insn_code -
CODE_FOR_nothing".
* optabs.c (optab_table, convert_optab_table): Always zero-initialize.
(init_insn_codes): Zero both the above arrays.
(init_optabs): Never call init_insn_codes first time around.
Index: gcc/optabs.h
===================================================================
--- gcc/optabs.h 2010-07-03 20:07:57.000000000 +0100
+++ gcc/optabs.h 2010-07-03 20:10:45.000000000 +0100
@@ -29,10 +29,6 @@ #define GCC_OPTABS_H
For example, add_optab applies to addition.
- The insn_code slot is the enum insn_code that says how to
- generate an insn for this operation on a particular machine mode.
- It is CODE_FOR_nothing if there is no such insn on the target machine.
-
The `lib_call' slot is the name of the library function that
can be used to perform the operation.
@@ -40,7 +36,10 @@ #define GCC_OPTABS_H
struct optab_handlers
{
- enum insn_code insn_code;
+ /* I - CODE_FOR_nothing, where I is either the insn code of the
+ associated insn generator or CODE_FOR_nothing if there is no such
+ insn on the target machine. */
+ int insn_code;
};
struct optab_d
@@ -788,7 +787,8 @@ extern rtx expand_vec_shift_expr (sepops
static inline enum insn_code
optab_handler (optab op, enum machine_mode mode)
{
- return op->handlers[(int) mode].insn_code;
+ return (enum insn_code) (op->handlers[(int) mode].insn_code
+ + (int) CODE_FOR_nothing);
}
/* Record that insn CODE should be used to implement mode MODE of OP. */
@@ -796,7 +796,7 @@ optab_handler (optab op, enum machine_mo
static inline void
set_optab_handler (optab op, enum machine_mode mode, enum insn_code code)
{
- op->handlers[(int) mode].insn_code = code;
+ op->handlers[(int) mode].insn_code = (int) code - (int) CODE_FOR_nothing;
}
/* Return the insn used to perform conversion OP from mode FROM_MODE
@@ -807,7 +807,9 @@ set_optab_handler (optab op, enum machin
convert_optab_handler (convert_optab op, enum machine_mode to_mode,
enum machine_mode from_mode)
{
- return op->handlers[(int) to_mode][(int) from_mode].insn_code;
+ return ((enum insn_code)
+ (op->handlers[(int) to_mode][(int) from_mode].insn_code
+ + (int) CODE_FOR_nothing));
}
/* Record that insn CODE should be used to perform conversion OP
@@ -817,7 +819,8 @@ convert_optab_handler (convert_optab op,
set_convert_optab_handler (convert_optab op, enum machine_mode to_mode,
enum machine_mode from_mode, enum insn_code code)
{
- op->handlers[(int) to_mode][(int) from_mode].insn_code = code;
+ op->handlers[(int) to_mode][(int) from_mode].insn_code
+ = (int) code - (int) CODE_FOR_nothing;
}
extern rtx optab_libfunc (optab optab, enum machine_mode mode);
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c 2010-07-03 20:07:43.000000000 +0100
+++ gcc/optabs.c 2010-07-03 20:10:45.000000000 +0100
@@ -53,27 +53,12 @@ Software Foundation; either version 3, o
See expr.h for documentation of these optabs. */
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
-__extension__ struct optab_d optab_table[OTI_MAX]
- = { [0 ... OTI_MAX - 1].handlers[0 ... NUM_MACHINE_MODES - 1].insn_code
- = CODE_FOR_nothing };
-#else
-/* init_insn_codes will do runtime initialization otherwise. */
struct optab_d optab_table[OTI_MAX];
-#endif
rtx libfunc_table[LTI_MAX];
/* Tables of patterns for converting one mode to another. */
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
-__extension__ struct convert_optab_d convert_optab_table[COI_MAX]
- = { [0 ... COI_MAX - 1].handlers[0 ... NUM_MACHINE_MODES - 1]
- [0 ... NUM_MACHINE_MODES - 1].insn_code
- = CODE_FOR_nothing };
-#else
-/* init_convert_optab will do runtime initialization otherwise. */
struct convert_optab_d convert_optab_table[COI_MAX];
-#endif
/* Contains the optab used for each rtx code. */
optab code_to_optab[NUM_RTX_CODE + 1];
@@ -5452,28 +5437,8 @@ have_insn_for (enum rtx_code code, enum
static void
init_insn_codes (void)
{
- unsigned int i;
-
- for (i = 0; i < (unsigned int) OTI_MAX; i++)
- {
- unsigned int j;
- optab op;
-
- op = &optab_table[i];
- for (j = 0; j < NUM_MACHINE_MODES; j++)
- set_optab_handler (op, (enum machine_mode) j, CODE_FOR_nothing);
- }
- for (i = 0; i < (unsigned int) COI_MAX; i++)
- {
- unsigned int j, k;
- convert_optab op;
-
- op = &convert_optab_table[i];
- for (j = 0; j < NUM_MACHINE_MODES; j++)
- for (k = 0; k < NUM_MACHINE_MODES; k++)
- set_convert_optab_handler (op, (enum machine_mode) j,
- (enum machine_mode) k, CODE_FOR_nothing);
- }
+ memset (optab_table, 0, sizeof (optab_table));
+ memset (convert_optab_table, 0, sizeof (convert_optab_table));
}
/* Initialize OP's code to CODE, and write it into the code_to_optab table. */
@@ -6182,9 +6147,7 @@ set_conv_libfunc (convert_optab optable,
init_optabs (void)
{
unsigned int i;
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
static bool reinit;
-#endif
libfunc_hash = htab_create_ggc (10, hash_libfunc, eq_libfunc, NULL);
/* Start by initializing all tables to contain CODE_FOR_nothing. */
@@ -6200,14 +6163,10 @@ init_optabs (void)
vcondu_gen_code[i] = CODE_FOR_nothing;
}
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
/* We statically initialize the insn_codes with the equivalent of
CODE_FOR_nothing. */
if (reinit)
init_insn_codes ();
-#else
- init_insn_codes ();
-#endif
init_optab (add_optab, PLUS);
init_optabv (addv_optab, PLUS);
@@ -6682,9 +6641,7 @@ init_optabs (void)
/* Allow the target to add more libcalls or rename some, etc. */
targetm.init_libfuncs ();
-#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
reinit = true;
-#endif
}
/* Print information about the current contents of the optabs on
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too
2010-07-03 17:49 ` [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too Richard Sandiford
@ 2010-07-04 13:50 ` Richard Sandiford
2010-07-04 14:10 ` Diego Novillo
0 siblings, 1 reply; 19+ messages in thread
From: Richard Sandiford @ 2010-07-04 13:50 UTC (permalink / raw)
To: gcc-patches
Richard Sandiford <rdsandiford@googlemail.com> writes:
> All conversion optabs are in a single table (convert_optab_table)
> and all other libcall-backed optab are in a single table (optab_table).
> However, we also have a lot of optabs that are in their own global
> variables. This patch lumps them into a third table for "direct" optabs
> (i.e. those that are only ever associated with insn patterns,
> never with libcalls). They can then "benefit" from the same
> encoding as the others.
>
> Bootstrapped & regression-tested on x86_64-linux-gnu. OK to install?
Now updated to use inlines. Tested as before. OK to install?
Richard
gcc/
* optabs.h (reload_in_optab, reload_out_optab, code_to_optab)
(vcond_gen_code, vcondu_gen_code, movmem_optab, setmem_optab)
(cmpstr_optab, cmpstrn_optab, cmpmem_optab, sync_add_optab)
(sync_sub_optab, sync_ior_optab, sync_and_optab, sync_xor_optab)
(sync_nand_optab, sync_old_add_optab, sync_old_sub_optab)
(sync_old_ior_optab, sync_old_and_optab, sync_old_xor_optab)
(sync_old_nand_optab, sync_new_add_optab, sync_new_sub_optab)
(sync_new_ior_optab, sync_new_and_optab, sync_new_xor_optab)
(sync_new_nand_optab): Redefine as macros.
(sync_compare_and_swap, sync_lock_test_and_set, sync_lock_release):
Delete.
(direct_optab_index): New enum.
(direct_optab_d): New structure.
(direct_optab): New typedef.
(direct_optab_table): Declare.
(direct_optab_handler, set_direct_optab_handler): New functions.
(sync_compare_and_swap_optab, sync_lock_test_and_set_optab)
(sync_lock_release_optab): New macros.
* optabs.c (direct_optab_table): New variable.
(movcc_gen_code, vcond_gen_code, vcondu_gen_code): Delete.
(prepare_cmp_insn): Use direct_optab_handler for cmpmem_optab,
cmpstr_optab and cmpstrn_optab.
(emit_conditional_move): Likewise for movcc_optab.
(can_conditionally_move_p): Likewise for movcc_gen_code.
(init_insn_codes): Clear direct_optab_table.
(init_optabs): Don't initialize the new "direct optabs" here.
(get_vcond_icode): Use direct_optab_handler for vcondu_gen_code and
vcond_gen_code.
(expand_val_compare_and_swap): Likewise sync_compare_and_swap_optab.
(expand_bool_compare_and_swap): Likewise sync_compare_and_swap_optab.
(expand_compare_and_swap_loop): Likewise sync_compare_and_swap_optab.
(expand_sync_operation): Likewise other sync_*_optabs.
(expand_sync_fetch_operation): Likewise. Rename sync_compare_and_swap
to sync_compare_and_swap_optab.
(expand_sync_lock_test_and_set): Use direct_optab_handler for
sync_lock_test_and_set and sync_compare_and_swap, adding "_optab"
to the names of both.
* builtins.c (expand_builtin_strcmp): Use direct_optab_handler for
cmpstr_optab and cmpstrn_optab.
(expand_builtin_lock_release): Likewise sync_lock_release.
* expr.c (movmem_optab, setmem_optab, cmpstr_optab, cmpstrn_optab)
(cmpmem_optab, sync_add_optab, sync_sub_optab, sync_ior_optab)
(sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab)
(sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab)
(sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab)
(sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab)
(sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap)
(sync_lock_test_and_set, sync_lock_release): Delete.
(emit_block_move_via_movmem): Use direct_optab_handler for movmem_optab.
(emit_block_move_via_setmem): Use direct_optab_handler for setmem_optab.
* genopinit.c (optabs): Use set_direct_optab_handler for the new
macro optabs.
* omp-low.c (expand_omp_atomic_fetch_op): Update the type of
the "optab" local variable. Use direct_optab_handler for optab and
sync_compare_and_swap_optab.
* reload1.c (reload_in_optab, reload_out_optab): Delete.
* targhooks.c (default_secondary_reload): Use direct_optab_handler for
reload_in_optab and reload_out_optab.
* config/alpha/alpha.c (alpha_secondary_reload): Likewise.
* config/frv/frv.c (frv_alloc_temp_reg): Likewise.
* config/pa/pa.c (pa_secondary_reload): Likewise.
* java/builtins.c (compareAndSwapInt_builtin): Use direct_optab_handler
for sync_compare_and_swap, renaming it to sync_compare_and_swap_optab.
(compareAndSwapLong_builtin, compareAndSwapObject_builtin): Likewise.
(VMSupportsCS8_builtin): Likewise.
Index: gcc/optabs.h
===================================================================
--- gcc/optabs.h 2010-07-03 20:13:57.000000000 +0100
+++ gcc/optabs.h 2010-07-03 20:15:10.000000000 +0100
@@ -594,79 +594,127 @@ #define fractuns_optab (&convert_optab_t
#define satfract_optab (&convert_optab_table[COI_satfract])
#define satfractuns_optab (&convert_optab_table[COI_satfractuns])
-/* These arrays record the insn_code of insns that may be needed to
- perform input and output reloads of special objects. They provide a
- place to pass a scratch register. */
-extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
-extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
-
/* Contains the optab used for each rtx code. */
extern optab code_to_optab[NUM_RTX_CODE + 1];
\f
typedef rtx (*rtxfun) (rtx);
+/* Enumerates operations that have a named .md pattern associated
+ with them, but which are not implemented as library functions. */
+enum direct_optab_index
+{
#ifdef HAVE_conditional_move
-/* Indexed by the machine mode, gives the insn code to make a conditional
- move insn. */
-
-extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
+ /* Conditional move operations. */
+ DOI_movcc,
#endif
-/* Indexed by the machine mode, gives the insn code for vector conditional
- operation. */
-
-extern enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
-extern enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
+ /* Operations that use a scratch register to perform input and output
+ reloads of special objects. */
+ DOI_reload_in,
+ DOI_reload_out,
+
+ /* Vector conditional operations. */
+ DOI_vcond,
+ DOI_vcondu,
+
+ /* Block move operation. */
+ DOI_movmem,
+
+ /* Block set operation. */
+ DOI_setmem,
+
+ /* Various types of block compare operation. */
+ DOI_cmpstr,
+ DOI_cmpstrn,
+ DOI_cmpmem,
+
+ /* Synchronization primitives. This first set is atomic operation for
+ which we don't care about the resulting value. */
+ DOI_sync_add,
+ DOI_sync_sub,
+ DOI_sync_ior,
+ DOI_sync_and,
+ DOI_sync_xor,
+ DOI_sync_nand,
+
+ /* This second set is atomic operations in which we return the value
+ that existed in memory before the operation. */
+ DOI_sync_old_add,
+ DOI_sync_old_sub,
+ DOI_sync_old_ior,
+ DOI_sync_old_and,
+ DOI_sync_old_xor,
+ DOI_sync_old_nand,
+
+ /* This third set is atomic operations in which we return the value
+ that resulted after performing the operation. */
+ DOI_sync_new_add,
+ DOI_sync_new_sub,
+ DOI_sync_new_ior,
+ DOI_sync_new_and,
+ DOI_sync_new_xor,
+ DOI_sync_new_nand,
+
+ /* Atomic compare and swap. */
+ DOI_sync_compare_and_swap,
-/* This array records the insn_code of insns to perform block moves. */
-extern enum insn_code movmem_optab[NUM_MACHINE_MODES];
+ /* Atomic exchange with acquire semantics. */
+ DOI_sync_lock_test_and_set,
-/* This array records the insn_code of insns to perform block sets. */
-extern enum insn_code setmem_optab[NUM_MACHINE_MODES];
-
-/* These arrays record the insn_code of two different kinds of insns
- to perform block compares. */
-extern enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
-extern enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
-extern enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
-
-/* Synchronization primitives. This first set is atomic operation for
- which we don't care about the resulting value. */
-extern enum insn_code sync_add_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_and_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
-
-/* This second set is atomic operations in which we return the value
- that existed in memory before the operation. */
-extern enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
-
-/* This third set is atomic operations in which we return the value
- that resulted after performing the operation. */
-extern enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
-extern enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
+ /* Atomic clear with release semantics. */
+ DOI_sync_lock_release,
-/* Atomic compare and swap. */
-extern enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
+ DOI_MAX
+};
-/* Atomic exchange with acquire semantics. */
-extern enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
+/* A structure that says which insn should be used to perform an operation
+ in a particular mode. */
+struct direct_optab_d
+{
+ struct optab_handlers handlers[NUM_MACHINE_MODES];
+};
+typedef struct direct_optab_d *direct_optab;
-/* Atomic clear with release semantics. */
-extern enum insn_code sync_lock_release[NUM_MACHINE_MODES];
+extern struct direct_optab_d direct_optab_table[(int) DOI_MAX];
+#ifdef HAVE_conditional_move
+#define movcc_optab (&direct_optab_table[(int) DOI_movcc])
+#endif
+#define reload_in_optab (&direct_optab_table[(int) DOI_reload_in])
+#define reload_out_optab (&direct_optab_table[(int) DOI_reload_out])
+#define vcond_optab (&direct_optab_table[(int) DOI_vcond])
+#define vcondu_optab (&direct_optab_table[(int) DOI_vcondu])
+#define movmem_optab (&direct_optab_table[(int) DOI_movmem])
+#define setmem_optab (&direct_optab_table[(int) DOI_setmem])
+#define cmpstr_optab (&direct_optab_table[(int) DOI_cmpstr])
+#define cmpstrn_optab (&direct_optab_table[(int) DOI_cmpstrn])
+#define cmpmem_optab (&direct_optab_table[(int) DOI_cmpmem])
+#define sync_add_optab (&direct_optab_table[(int) DOI_sync_add])
+#define sync_sub_optab (&direct_optab_table[(int) DOI_sync_sub])
+#define sync_ior_optab (&direct_optab_table[(int) DOI_sync_ior])
+#define sync_and_optab (&direct_optab_table[(int) DOI_sync_and])
+#define sync_xor_optab (&direct_optab_table[(int) DOI_sync_xor])
+#define sync_nand_optab (&direct_optab_table[(int) DOI_sync_nand])
+#define sync_old_add_optab (&direct_optab_table[(int) DOI_sync_old_add])
+#define sync_old_sub_optab (&direct_optab_table[(int) DOI_sync_old_sub])
+#define sync_old_ior_optab (&direct_optab_table[(int) DOI_sync_old_ior])
+#define sync_old_and_optab (&direct_optab_table[(int) DOI_sync_old_and])
+#define sync_old_xor_optab (&direct_optab_table[(int) DOI_sync_old_xor])
+#define sync_old_nand_optab (&direct_optab_table[(int) DOI_sync_old_nand])
+#define sync_new_add_optab (&direct_optab_table[(int) DOI_sync_new_add])
+#define sync_new_sub_optab (&direct_optab_table[(int) DOI_sync_new_sub])
+#define sync_new_ior_optab (&direct_optab_table[(int) DOI_sync_new_ior])
+#define sync_new_and_optab (&direct_optab_table[(int) DOI_sync_new_and])
+#define sync_new_xor_optab (&direct_optab_table[(int) DOI_sync_new_xor])
+#define sync_new_nand_optab (&direct_optab_table[(int) DOI_sync_new_nand])
+#define sync_compare_and_swap_optab \
+ (&direct_optab_table[(int) DOI_sync_compare_and_swap])
+#define sync_lock_test_and_set_optab \
+ (&direct_optab_table[(int) DOI_sync_lock_test_and_set])
+#define sync_lock_release_optab \
+ (&direct_optab_table[(int) DOI_sync_lock_release])
+\f
/* Define functions given in optabs.c. */
extern rtx expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op,
@@ -823,6 +871,25 @@ set_convert_optab_handler (convert_optab
= (int) code - (int) CODE_FOR_nothing;
}
+/* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing
+ if the target does not have such an insn. */
+
+static inline enum insn_code
+direct_optab_handler (direct_optab op, enum machine_mode mode)
+{
+ return (enum insn_code) (op->handlers[(int) mode].insn_code
+ + (int) CODE_FOR_nothing);
+}
+
+/* Record that insn CODE should be used to implement mode MODE of OP. */
+
+static inline void
+set_direct_optab_handler (direct_optab op, enum machine_mode mode,
+ enum insn_code code)
+{
+ op->handlers[(int) mode].insn_code = (int) code - (int) CODE_FOR_nothing;
+}
+
extern rtx optab_libfunc (optab optab, enum machine_mode mode);
extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
enum machine_mode mode2);
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/optabs.c 2010-07-03 20:15:10.000000000 +0100
@@ -60,24 +60,13 @@ struct optab_d optab_table[OTI_MAX];
/* Tables of patterns for converting one mode to another. */
struct convert_optab_d convert_optab_table[COI_MAX];
+/* Tables of patterns for direct optabs (i.e. those which cannot be
+ implement using a libcall). */
+struct direct_optab_d direct_optab_table[(int) DOI_MAX];
+
/* Contains the optab used for each rtx code. */
optab code_to_optab[NUM_RTX_CODE + 1];
-#ifdef HAVE_conditional_move
-/* Indexed by the machine mode, gives the insn code to make a conditional
- move insn. This is not indexed by the rtx-code like bcc_gen_fctn and
- setcc_gen_code to cut down on the number of named patterns. Consider a day
- when a lot more rtx codes are conditional (eg: for the ARM). */
-
-enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
-#endif
-
-/* Indexed by the machine mode, gives the insn code for vector conditional
- operation. */
-
-enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
-enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
-
static void prepare_float_lib_cmp (rtx, rtx, enum rtx_code, rtx *,
enum machine_mode *);
static rtx expand_unop_direct (enum machine_mode, optab, rtx, rtx, int);
@@ -4071,11 +4060,11 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx
cmp_mode != VOIDmode;
cmp_mode = GET_MODE_WIDER_MODE (cmp_mode))
{
- cmp_code = cmpmem_optab[cmp_mode];
+ cmp_code = direct_optab_handler (cmpmem_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
- cmp_code = cmpstr_optab[cmp_mode];
+ cmp_code = direct_optab_handler (cmpstr_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
- cmp_code = cmpstrn_optab[cmp_mode];
+ cmp_code = direct_optab_handler (cmpstrn_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
continue;
@@ -4520,7 +4509,7 @@ emit_conditional_move (rtx target, enum
if (mode == VOIDmode)
mode = GET_MODE (op2);
- icode = movcc_gen_code[mode];
+ icode = direct_optab_handler (movcc_optab, mode);
if (icode == CODE_FOR_nothing)
return 0;
@@ -4593,7 +4582,7 @@ emit_conditional_move (rtx target, enum
int
can_conditionally_move_p (enum machine_mode mode)
{
- if (movcc_gen_code[mode] != CODE_FOR_nothing)
+ if (direct_optab_handler (movcc_optab, mode) != CODE_FOR_nothing)
return 1;
return 0;
@@ -5439,6 +5428,7 @@ init_insn_codes (void)
{
memset (optab_table, 0, sizeof (optab_table));
memset (convert_optab_table, 0, sizeof (convert_optab_table));
+ memset (direct_optab_table, 0, sizeof (direct_optab_table));
}
/* Initialize OP's code to CODE, and write it into the code_to_optab table. */
@@ -6146,25 +6136,12 @@ set_conv_libfunc (convert_optab optable,
void
init_optabs (void)
{
- unsigned int i;
static bool reinit;
libfunc_hash = htab_create_ggc (10, hash_libfunc, eq_libfunc, NULL);
- /* Start by initializing all tables to contain CODE_FOR_nothing. */
-
-#ifdef HAVE_conditional_move
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- movcc_gen_code[i] = CODE_FOR_nothing;
-#endif
-
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- vcond_gen_code[i] = CODE_FOR_nothing;
- vcondu_gen_code[i] = CODE_FOR_nothing;
- }
/* We statically initialize the insn_codes with the equivalent of
- CODE_FOR_nothing. */
+ CODE_FOR_nothing. Repeat the process if reinitialising. */
if (reinit)
init_insn_codes ();
@@ -6357,39 +6334,6 @@ init_optabs (void)
init_convert_optab (satfract_optab, SAT_FRACT);
init_convert_optab (satfractuns_optab, UNSIGNED_SAT_FRACT);
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- movmem_optab[i] = CODE_FOR_nothing;
- cmpstr_optab[i] = CODE_FOR_nothing;
- cmpstrn_optab[i] = CODE_FOR_nothing;
- cmpmem_optab[i] = CODE_FOR_nothing;
- setmem_optab[i] = CODE_FOR_nothing;
-
- sync_add_optab[i] = CODE_FOR_nothing;
- sync_sub_optab[i] = CODE_FOR_nothing;
- sync_ior_optab[i] = CODE_FOR_nothing;
- sync_and_optab[i] = CODE_FOR_nothing;
- sync_xor_optab[i] = CODE_FOR_nothing;
- sync_nand_optab[i] = CODE_FOR_nothing;
- sync_old_add_optab[i] = CODE_FOR_nothing;
- sync_old_sub_optab[i] = CODE_FOR_nothing;
- sync_old_ior_optab[i] = CODE_FOR_nothing;
- sync_old_and_optab[i] = CODE_FOR_nothing;
- sync_old_xor_optab[i] = CODE_FOR_nothing;
- sync_old_nand_optab[i] = CODE_FOR_nothing;
- sync_new_add_optab[i] = CODE_FOR_nothing;
- sync_new_sub_optab[i] = CODE_FOR_nothing;
- sync_new_ior_optab[i] = CODE_FOR_nothing;
- sync_new_and_optab[i] = CODE_FOR_nothing;
- sync_new_xor_optab[i] = CODE_FOR_nothing;
- sync_new_nand_optab[i] = CODE_FOR_nothing;
- sync_compare_and_swap[i] = CODE_FOR_nothing;
- sync_lock_test_and_set[i] = CODE_FOR_nothing;
- sync_lock_release[i] = CODE_FOR_nothing;
-
- reload_in_optab[i] = reload_out_optab[i] = CODE_FOR_nothing;
- }
-
/* Fill in the optabs with the insns we support. */
init_all_optabs ();
@@ -6845,9 +6789,9 @@ get_vcond_icode (tree type, enum machine
enum insn_code icode = CODE_FOR_nothing;
if (TYPE_UNSIGNED (type))
- icode = vcondu_gen_code[mode];
+ icode = direct_optab_handler (vcondu_optab, mode);
else
- icode = vcond_gen_code[mode];
+ icode = direct_optab_handler (vcond_optab, mode);
return icode;
}
@@ -6945,7 +6889,8 @@ expand_val_compare_and_swap_1 (rtx mem,
expand_val_compare_and_swap (rtx mem, rtx old_val, rtx new_val, rtx target)
{
enum machine_mode mode = GET_MODE (mem);
- enum insn_code icode = sync_compare_and_swap[mode];
+ enum insn_code icode
+ = direct_optab_handler (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return NULL_RTX;
@@ -6982,7 +6927,7 @@ expand_bool_compare_and_swap (rtx mem, r
/* If the target supports a compare-and-swap pattern that simultaneously
sets some flag for success, then use it. Otherwise use the regular
compare-and-swap and follow that immediately with a compare insn. */
- icode = sync_compare_and_swap[mode];
+ icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return NULL_RTX;
@@ -7060,7 +7005,7 @@ expand_compare_and_swap_loop (rtx mem, r
/* If the target supports a compare-and-swap pattern that simultaneously
sets some flag for success, then use it. Otherwise use the regular
compare-and-swap and follow that immediately with a compare insn. */
- icode = sync_compare_and_swap[mode];
+ icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return false;
@@ -7104,26 +7049,26 @@ expand_sync_operation (rtx mem, rtx val,
switch (code)
{
case PLUS:
- icode = sync_add_optab[mode];
+ icode = direct_optab_handler (sync_add_optab, mode);
break;
case IOR:
- icode = sync_ior_optab[mode];
+ icode = direct_optab_handler (sync_ior_optab, mode);
break;
case XOR:
- icode = sync_xor_optab[mode];
+ icode = direct_optab_handler (sync_xor_optab, mode);
break;
case AND:
- icode = sync_and_optab[mode];
+ icode = direct_optab_handler (sync_and_optab, mode);
break;
case NOT:
- icode = sync_nand_optab[mode];
+ icode = direct_optab_handler (sync_nand_optab, mode);
break;
case MINUS:
- icode = sync_sub_optab[mode];
+ icode = direct_optab_handler (sync_sub_optab, mode);
if (icode == CODE_FOR_nothing || CONST_INT_P (val))
{
- icode = sync_add_optab[mode];
+ icode = direct_optab_handler (sync_add_optab, mode);
if (icode != CODE_FOR_nothing)
{
val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
@@ -7154,7 +7099,8 @@ expand_sync_operation (rtx mem, rtx val,
/* Failing that, generate a compare-and-swap loop in which we perform the
operation with normal arithmetic instructions. */
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (direct_optab_handler (sync_compare_and_swap_optab, mode)
+ != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (mode), t1;
@@ -7199,34 +7145,34 @@ expand_sync_fetch_operation (rtx mem, rt
switch (code)
{
case PLUS:
- old_code = sync_old_add_optab[mode];
- new_code = sync_new_add_optab[mode];
+ old_code = direct_optab_handler (sync_old_add_optab, mode);
+ new_code = direct_optab_handler (sync_new_add_optab, mode);
break;
case IOR:
- old_code = sync_old_ior_optab[mode];
- new_code = sync_new_ior_optab[mode];
+ old_code = direct_optab_handler (sync_old_ior_optab, mode);
+ new_code = direct_optab_handler (sync_new_ior_optab, mode);
break;
case XOR:
- old_code = sync_old_xor_optab[mode];
- new_code = sync_new_xor_optab[mode];
+ old_code = direct_optab_handler (sync_old_xor_optab, mode);
+ new_code = direct_optab_handler (sync_new_xor_optab, mode);
break;
case AND:
- old_code = sync_old_and_optab[mode];
- new_code = sync_new_and_optab[mode];
+ old_code = direct_optab_handler (sync_old_and_optab, mode);
+ new_code = direct_optab_handler (sync_new_and_optab, mode);
break;
case NOT:
- old_code = sync_old_nand_optab[mode];
- new_code = sync_new_nand_optab[mode];
+ old_code = direct_optab_handler (sync_old_nand_optab, mode);
+ new_code = direct_optab_handler (sync_new_nand_optab, mode);
break;
case MINUS:
- old_code = sync_old_sub_optab[mode];
- new_code = sync_new_sub_optab[mode];
+ old_code = direct_optab_handler (sync_old_sub_optab, mode);
+ new_code = direct_optab_handler (sync_new_sub_optab, mode);
if ((old_code == CODE_FOR_nothing && new_code == CODE_FOR_nothing)
|| CONST_INT_P (val))
{
- old_code = sync_old_add_optab[mode];
- new_code = sync_new_add_optab[mode];
+ old_code = direct_optab_handler (sync_old_add_optab, mode);
+ new_code = direct_optab_handler (sync_new_add_optab, mode);
if (old_code != CODE_FOR_nothing || new_code != CODE_FOR_nothing)
{
val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
@@ -7316,7 +7262,8 @@ expand_sync_fetch_operation (rtx mem, rt
/* Failing that, generate a compare-and-swap loop in which we perform the
operation with normal arithmetic instructions. */
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (direct_optab_handler (sync_compare_and_swap_optab, mode)
+ != CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (mode), t1;
@@ -7365,7 +7312,7 @@ expand_sync_lock_test_and_set (rtx mem,
rtx insn;
/* If the target supports the test-and-set directly, great. */
- icode = sync_lock_test_and_set[mode];
+ icode = direct_optab_handler (sync_lock_test_and_set_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (!target || !insn_data[icode].operand[0].predicate (target, mode))
@@ -7385,7 +7332,8 @@ expand_sync_lock_test_and_set (rtx mem,
}
/* Otherwise, use a compare-and-swap loop for the exchange. */
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (direct_optab_handler (sync_compare_and_swap_optab, mode)
+ != CODE_FOR_nothing)
{
if (!target || !register_operand (target, mode))
target = gen_reg_rtx (mode);
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/builtins.c 2010-07-03 20:15:10.000000000 +0100
@@ -4109,8 +4109,8 @@ expand_builtin_strcmp (tree exp, ATTRIBU
return NULL_RTX;
#if defined HAVE_cmpstrsi || defined HAVE_cmpstrnsi
- if (cmpstr_optab[SImode] != CODE_FOR_nothing
- || cmpstrn_optab[SImode] != CODE_FOR_nothing)
+ if (direct_optab_handler (cmpstr_optab, SImode) != CODE_FOR_nothing
+ || direct_optab_handler (cmpstrn_optab, SImode) != CODE_FOR_nothing)
{
rtx arg1_rtx, arg2_rtx;
rtx result, insn = NULL_RTX;
@@ -5677,7 +5677,7 @@ expand_builtin_lock_release (enum machin
mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
/* If there is an explicit operation in the md file, use it. */
- icode = sync_lock_release[mode];
+ icode = direct_optab_handler (sync_lock_release_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (!insn_data[icode].operand[1].predicate (val, mode))
Index: gcc/expr.c
===================================================================
--- gcc/expr.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/expr.c 2010-07-03 20:15:10.000000000 +0100
@@ -201,41 +201,6 @@ #define STORE_BY_PIECES_P(SIZE, ALIGN) \
< (unsigned int) MOVE_RATIO (optimize_insn_for_speed_p ()))
#endif
-/* This array records the insn_code of insns to perform block moves. */
-enum insn_code movmem_optab[NUM_MACHINE_MODES];
-
-/* This array records the insn_code of insns to perform block sets. */
-enum insn_code setmem_optab[NUM_MACHINE_MODES];
-
-/* These arrays record the insn_code of three different kinds of insns
- to perform block compares. */
-enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
-enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
-enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
-
-/* Synchronization primitives. */
-enum insn_code sync_add_optab[NUM_MACHINE_MODES];
-enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
-enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
-enum insn_code sync_and_optab[NUM_MACHINE_MODES];
-enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
-enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
-enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
-enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
-enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
-enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
-enum insn_code sync_lock_release[NUM_MACHINE_MODES];
-
/* SLOW_UNALIGNED_ACCESS is nonzero if unaligned accesses are very slow. */
#ifndef SLOW_UNALIGNED_ACCESS
@@ -1315,7 +1280,7 @@ emit_block_move_via_movmem (rtx x, rtx y
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- enum insn_code code = movmem_optab[(int) mode];
+ enum insn_code code = direct_optab_handler (movmem_optab, mode);
insn_operand_predicate_fn pred;
if (code != CODE_FOR_nothing
@@ -2791,7 +2756,7 @@ set_storage_via_setmem (rtx object, rtx
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- enum insn_code code = setmem_optab[(int) mode];
+ enum insn_code code = direct_optab_handler (setmem_optab, mode);
insn_operand_predicate_fn pred;
if (code != CODE_FOR_nothing
Index: gcc/genopinit.c
===================================================================
--- gcc/genopinit.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/genopinit.c 2010-07-03 20:15:10.000000000 +0100
@@ -200,40 +200,40 @@ static const char * const optabs[] =
"set_optab_handler (movmisalign_optab, $A, CODE_FOR_$(movmisalign$a$))",
"set_optab_handler (storent_optab, $A, CODE_FOR_$(storent$a$))",
"set_optab_handler (addcc_optab, $A, CODE_FOR_$(add$acc$))",
- "movcc_gen_code[$A] = CODE_FOR_$(mov$acc$)",
+ "set_direct_optab_handler (movcc_optab, $A, CODE_FOR_$(mov$acc$))",
"set_optab_handler (cbranch_optab, $A, CODE_FOR_$(cbranch$a4$))",
"set_optab_handler (cmov_optab, $A, CODE_FOR_$(cmov$a6$))",
"set_optab_handler (cstore_optab, $A, CODE_FOR_$(cstore$a4$))",
"set_optab_handler (ctrap_optab, $A, CODE_FOR_$(ctrap$a4$))",
"set_optab_handler (push_optab, $A, CODE_FOR_$(push$a1$))",
- "reload_in_optab[$A] = CODE_FOR_$(reload_in$a$)",
- "reload_out_optab[$A] = CODE_FOR_$(reload_out$a$)",
- "movmem_optab[$A] = CODE_FOR_$(movmem$a$)",
- "cmpstr_optab[$A] = CODE_FOR_$(cmpstr$a$)",
- "cmpstrn_optab[$A] = CODE_FOR_$(cmpstrn$a$)",
- "cmpmem_optab[$A] = CODE_FOR_$(cmpmem$a$)",
- "setmem_optab[$A] = CODE_FOR_$(setmem$a$)",
- "sync_add_optab[$A] = CODE_FOR_$(sync_add$I$a$)",
- "sync_sub_optab[$A] = CODE_FOR_$(sync_sub$I$a$)",
- "sync_ior_optab[$A] = CODE_FOR_$(sync_ior$I$a$)",
- "sync_and_optab[$A] = CODE_FOR_$(sync_and$I$a$)",
- "sync_xor_optab[$A] = CODE_FOR_$(sync_xor$I$a$)",
- "sync_nand_optab[$A] = CODE_FOR_$(sync_nand$I$a$)",
- "sync_old_add_optab[$A] = CODE_FOR_$(sync_old_add$I$a$)",
- "sync_old_sub_optab[$A] = CODE_FOR_$(sync_old_sub$I$a$)",
- "sync_old_ior_optab[$A] = CODE_FOR_$(sync_old_ior$I$a$)",
- "sync_old_and_optab[$A] = CODE_FOR_$(sync_old_and$I$a$)",
- "sync_old_xor_optab[$A] = CODE_FOR_$(sync_old_xor$I$a$)",
- "sync_old_nand_optab[$A] = CODE_FOR_$(sync_old_nand$I$a$)",
- "sync_new_add_optab[$A] = CODE_FOR_$(sync_new_add$I$a$)",
- "sync_new_sub_optab[$A] = CODE_FOR_$(sync_new_sub$I$a$)",
- "sync_new_ior_optab[$A] = CODE_FOR_$(sync_new_ior$I$a$)",
- "sync_new_and_optab[$A] = CODE_FOR_$(sync_new_and$I$a$)",
- "sync_new_xor_optab[$A] = CODE_FOR_$(sync_new_xor$I$a$)",
- "sync_new_nand_optab[$A] = CODE_FOR_$(sync_new_nand$I$a$)",
- "sync_compare_and_swap[$A] = CODE_FOR_$(sync_compare_and_swap$I$a$)",
- "sync_lock_test_and_set[$A] = CODE_FOR_$(sync_lock_test_and_set$I$a$)",
- "sync_lock_release[$A] = CODE_FOR_$(sync_lock_release$I$a$)",
+ "set_direct_optab_handler (reload_in_optab, $A, CODE_FOR_$(reload_in$a$))",
+ "set_direct_optab_handler (reload_out_optab, $A, CODE_FOR_$(reload_out$a$))",
+ "set_direct_optab_handler (movmem_optab, $A, CODE_FOR_$(movmem$a$))",
+ "set_direct_optab_handler (cmpstr_optab, $A, CODE_FOR_$(cmpstr$a$))",
+ "set_direct_optab_handler (cmpstrn_optab, $A, CODE_FOR_$(cmpstrn$a$))",
+ "set_direct_optab_handler (cmpmem_optab, $A, CODE_FOR_$(cmpmem$a$))",
+ "set_direct_optab_handler (setmem_optab, $A, CODE_FOR_$(setmem$a$))",
+ "set_direct_optab_handler (sync_add_optab, $A, CODE_FOR_$(sync_add$I$a$))",
+ "set_direct_optab_handler (sync_sub_optab, $A, CODE_FOR_$(sync_sub$I$a$))",
+ "set_direct_optab_handler (sync_ior_optab, $A, CODE_FOR_$(sync_ior$I$a$))",
+ "set_direct_optab_handler (sync_and_optab, $A, CODE_FOR_$(sync_and$I$a$))",
+ "set_direct_optab_handler (sync_xor_optab, $A, CODE_FOR_$(sync_xor$I$a$))",
+ "set_direct_optab_handler (sync_nand_optab, $A, CODE_FOR_$(sync_nand$I$a$))",
+ "set_direct_optab_handler (sync_old_add_optab, $A, CODE_FOR_$(sync_old_add$I$a$))",
+ "set_direct_optab_handler (sync_old_sub_optab, $A, CODE_FOR_$(sync_old_sub$I$a$))",
+ "set_direct_optab_handler (sync_old_ior_optab, $A, CODE_FOR_$(sync_old_ior$I$a$))",
+ "set_direct_optab_handler (sync_old_and_optab, $A, CODE_FOR_$(sync_old_and$I$a$))",
+ "set_direct_optab_handler (sync_old_xor_optab, $A, CODE_FOR_$(sync_old_xor$I$a$))",
+ "set_direct_optab_handler (sync_old_nand_optab, $A, CODE_FOR_$(sync_old_nand$I$a$))",
+ "set_direct_optab_handler (sync_new_add_optab, $A, CODE_FOR_$(sync_new_add$I$a$))",
+ "set_direct_optab_handler (sync_new_sub_optab, $A, CODE_FOR_$(sync_new_sub$I$a$))",
+ "set_direct_optab_handler (sync_new_ior_optab, $A, CODE_FOR_$(sync_new_ior$I$a$))",
+ "set_direct_optab_handler (sync_new_and_optab, $A, CODE_FOR_$(sync_new_and$I$a$))",
+ "set_direct_optab_handler (sync_new_xor_optab, $A, CODE_FOR_$(sync_new_xor$I$a$))",
+ "set_direct_optab_handler (sync_new_nand_optab, $A, CODE_FOR_$(sync_new_nand$I$a$))",
+ "set_direct_optab_handler (sync_compare_and_swap_optab, $A, CODE_FOR_$(sync_compare_and_swap$I$a$))",
+ "set_direct_optab_handler (sync_lock_test_and_set_optab, $A, CODE_FOR_$(sync_lock_test_and_set$I$a$))",
+ "set_direct_optab_handler (sync_lock_release_optab, $A, CODE_FOR_$(sync_lock_release$I$a$))",
"set_optab_handler (vec_set_optab, $A, CODE_FOR_$(vec_set$a$))",
"set_optab_handler (vec_extract_optab, $A, CODE_FOR_$(vec_extract$a$))",
"set_optab_handler (vec_extract_even_optab, $A, CODE_FOR_$(vec_extract_even$a$))",
@@ -244,8 +244,8 @@ static const char * const optabs[] =
"set_optab_handler (vec_shl_optab, $A, CODE_FOR_$(vec_shl_$a$))",
"set_optab_handler (vec_shr_optab, $A, CODE_FOR_$(vec_shr_$a$))",
"set_optab_handler (vec_realign_load_optab, $A, CODE_FOR_$(vec_realign_load_$a$))",
- "vcond_gen_code[$A] = CODE_FOR_$(vcond$a$)",
- "vcondu_gen_code[$A] = CODE_FOR_$(vcondu$a$)",
+ "set_direct_optab_handler (vcond_optab, $A, CODE_FOR_$(vcond$a$))",
+ "set_direct_optab_handler (vcondu_optab, $A, CODE_FOR_$(vcondu$a$))",
"set_optab_handler (ssum_widen_optab, $A, CODE_FOR_$(widen_ssum$I$a3$))",
"set_optab_handler (usum_widen_optab, $A, CODE_FOR_$(widen_usum$I$a3$))",
"set_optab_handler (udot_prod_optab, $A, CODE_FOR_$(udot_prod$I$a$))",
Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/omp-low.c 2010-07-03 20:15:10.000000000 +0100
@@ -4918,7 +4918,7 @@ expand_omp_atomic_fetch_op (basic_block
{
enum built_in_function base;
tree decl, itype, call;
- enum insn_code *optab;
+ direct_optab optab;
tree rhs;
basic_block store_bb = single_succ (load_bb);
gimple_stmt_iterator gsi;
@@ -4990,7 +4990,7 @@ expand_omp_atomic_fetch_op (basic_block
decl = built_in_decls[base + index + 1];
itype = TREE_TYPE (TREE_TYPE (decl));
- if (optab[TYPE_MODE (itype)] == CODE_FOR_nothing)
+ if (direct_optab_handler (optab, TYPE_MODE (itype)) == CODE_FOR_nothing)
return false;
gsi = gsi_last_bb (load_bb);
@@ -5042,7 +5042,8 @@ expand_omp_atomic_pipeline (basic_block
type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
itype = TREE_TYPE (TREE_TYPE (cmpxchg));
- if (sync_compare_and_swap[TYPE_MODE (itype)] == CODE_FOR_nothing)
+ if (direct_optab_handler (sync_compare_and_swap_optab, TYPE_MODE (itype))
+ == CODE_FOR_nothing)
return false;
/* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/reload1.c 2010-07-03 20:15:10.000000000 +0100
@@ -275,12 +275,6 @@ VEC(rtx,gc) *reg_equiv_memory_loc_vec;
Required by some machines to handle any generated moves differently. */
int reload_in_progress = 0;
-/* These arrays record the insn_code of insns that may be needed to
- perform input and output reloads of special objects. They provide a
- place to pass a scratch register. */
-enum insn_code reload_in_optab[NUM_MACHINE_MODES];
-enum insn_code reload_out_optab[NUM_MACHINE_MODES];
-
/* This obstack is used for allocation of rtl during register elimination.
The allocated storage can be freed once find_reloads has processed the
insn. */
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/targhooks.c 2010-07-03 20:15:10.000000000 +0100
@@ -846,8 +846,9 @@ default_secondary_reload (bool in_p ATTR
#endif
if (rclass != NO_REGS)
{
- enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
- : reload_out_optab[(int) reload_mode]);
+ enum insn_code icode
+ = direct_optab_handler (in_p ? reload_in_optab : reload_out_optab,
+ reload_mode);
if (icode != CODE_FOR_nothing
&& insn_data[(int) icode].operand[in_p].predicate
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c 2010-07-03 20:13:57.000000000 +0100
+++ gcc/config/alpha/alpha.c 2010-07-03 20:15:10.000000000 +0100
@@ -1584,10 +1584,10 @@ alpha_secondary_reload (bool in_p, rtx x
if (in_p)
{
if (!aligned_memory_operand (x, mode))
- sri->icode = reload_in_optab[mode];
+ sri->icode = direct_optab_handler (reload_in_optab, mode);
}
else
- sri->icode = reload_out_optab[mode];
+ sri->icode = direct_optab_handler (reload_out_optab, mode);
return NO_REGS;
}
}
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c 2010-07-03 20:13:57.000000000 +0100
+++ gcc/config/frv/frv.c 2010-07-03 20:15:10.000000000 +0100
@@ -6510,8 +6510,9 @@ frv_secondary_reload (bool in_p, rtx x,
if (rclass != NO_REGS)
{
- enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
- : reload_out_optab[(int) reload_mode]);
+ enum insn_code icode
+ = direct_optab_handler (in_p ? reload_in_optab : reload_out_optab,
+ reload_mode);
if (icode == 0)
{
/* This happens when then the reload_[in|out]_optabs have
Index: gcc/config/pa/pa.c
===================================================================
--- gcc/config/pa/pa.c 2010-07-03 20:13:57.000000000 +0100
+++ gcc/config/pa/pa.c 2010-07-03 20:15:10.000000000 +0100
@@ -5767,7 +5767,9 @@ pa_secondary_reload (bool in_p, rtx x, r
/* Request a secondary reload with a general scratch register
for everthing else. ??? Could symbolic operands be handled
directly when generating non-pic PA 2.0 code? */
- sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
+ sri->icode = (in_p
+ ? direct_optab_handler (reload_in_optab, mode)
+ : direct_optab_handler (reload_out_optab, mode));
return NO_REGS;
}
@@ -5775,7 +5777,9 @@ pa_secondary_reload (bool in_p, rtx x, r
and anything other than a general register. */
if (rclass == SHIFT_REGS && (regno <= 0 || regno >= 32))
{
- sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
+ sri->icode = (in_p
+ ? direct_optab_handler (reload_in_optab, mode)
+ : direct_optab_handler (reload_out_optab, mode));
return NO_REGS;
}
@@ -5785,7 +5789,9 @@ pa_secondary_reload (bool in_p, rtx x, r
&& (REGNO_REG_CLASS (regno) == SHIFT_REGS
&& FP_REG_CLASS_P (rclass)))
{
- sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
+ sri->icode = (in_p
+ ? direct_optab_handler (reload_in_optab, mode)
+ : direct_optab_handler (reload_out_optab, mode));
return NO_REGS;
}
Index: gcc/java/builtins.c
===================================================================
--- gcc/java/builtins.c 2010-07-03 20:13:58.000000000 +0100
+++ gcc/java/builtins.c 2010-07-03 20:15:10.000000000 +0100
@@ -323,7 +323,8 @@ compareAndSwapInt_builtin (tree method_r
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (int_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ if (direct_optab_handler (sync_compare_and_swap_optab, mode)
+ != CODE_FOR_nothing
|| flag_use_atomic_builtins)
{
tree addr, stmt;
@@ -344,7 +345,8 @@ compareAndSwapLong_builtin (tree method_
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (long_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ if (direct_optab_handler (sync_compare_and_swap_optab, mode)
+ != CODE_FOR_nothing
|| (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (word_mode)
&& flag_use_atomic_builtins))
/* We don't trust flag_use_atomic_builtins for multi-word
@@ -368,7 +370,8 @@ compareAndSwapObject_builtin (tree metho
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (ptr_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ if (direct_optab_handler (sync_compare_and_swap_optab, mode)
+ != CODE_FOR_nothing
|| flag_use_atomic_builtins)
{
tree addr, stmt;
@@ -448,7 +451,8 @@ VMSupportsCS8_builtin (tree method_retur
{
enum machine_mode mode = TYPE_MODE (long_type_node);
gcc_assert (method_return_type == boolean_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (direct_optab_handler (sync_compare_and_swap_optab, mode)
+ != CODE_FOR_nothing)
return boolean_true_node;
else
return boolean_false_node;
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too
2010-07-04 13:50 ` Richard Sandiford
@ 2010-07-04 14:10 ` Diego Novillo
0 siblings, 0 replies; 19+ messages in thread
From: Diego Novillo @ 2010-07-04 14:10 UTC (permalink / raw)
To: gcc-patches, rdsandiford
On Sunday, July 4, 2010, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> Richard Sandiford <rdsandiford@googlemail.com> writes:
>> All conversion optabs are in a single table (convert_optab_table)
>> and all other libcall-backed optab are in a single table (optab_table).
>> However, we also have a lot of optabs that are in their own global
>> variables. This patch lumps them into a third table for "direct" optabs
>> (i.e. those that are only ever associated with insn patterns,
>> never with libcalls). They can then "benefit" from the same
>> encoding as the others.
>>
>> Bootstrapped & regression-tested on x86_64-linux-gnu. OK to install?
>
> Now updated to use inlines. Tested as before. OK to install?
Yes. All 3 parts.
Diego.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER
2010-07-04 12:59 ` Diego Novillo
@ 2010-07-06 9:46 ` Eric Botcazou
0 siblings, 0 replies; 19+ messages in thread
From: Eric Botcazou @ 2010-07-06 9:46 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches, Steven Bosscher, rdsandiford
> I understand that, but converting them to inline functions is a step
> in that direction. As soon as we get bootstraps going with lto
> enabled, we can very easily convert them into regular functions.
The compiler isn't always bootstrapped though.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2010-07-06 9:46 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-03 17:29 [0/3] Allow optabs to be zero-initialised Richard Sandiford
2010-07-03 17:34 ` [1/3] optabs: introduce {SET_,}{CONVERT_,}OPTAB_HANDLER Richard Sandiford
[not found] ` <AANLkTinjMxQLGLg60mau0LpdCA2GnrkI3ZdlQ1pTvoV3@mail.gmail.com>
2010-07-03 17:48 ` Diego Novillo
2010-07-03 17:54 ` Richard Sandiford
2010-07-03 20:38 ` Diego Novillo
2010-07-03 21:07 ` Steven Bosscher
2010-07-03 21:12 ` Manuel López-Ibáñez
2010-07-03 21:48 ` Steven Bosscher
2010-07-04 8:40 ` Manuel López-Ibáñez
2010-07-04 12:59 ` Diego Novillo
2010-07-06 9:46 ` Eric Botcazou
2010-07-04 13:41 ` Richard Sandiford
2010-07-04 13:43 ` Richard Sandiford
2010-07-04 13:45 ` Diego Novillo
2010-07-03 17:44 ` [2/3] optabs: Bias optabs by -CODE_FOR_nothing Richard Sandiford
2010-07-04 13:46 ` Richard Sandiford
2010-07-03 17:49 ` [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too Richard Sandiford
2010-07-04 13:50 ` Richard Sandiford
2010-07-04 14:10 ` Diego Novillo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).