From patchwork Sat Jul 3 17:49:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 57820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CCCFFB6F1B for ; Sun, 4 Jul 2010 03:50:06 +1000 (EST) Received: (qmail 17969 invoked by alias); 3 Jul 2010 17:49:59 -0000 Received: (qmail 17957 invoked by uid 22791); 3 Jul 2010 17:49:55 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL, BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, TW_TM, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 03 Jul 2010 17:49:47 +0000 Received: by wye20 with SMTP id 20so2356626wye.20 for ; Sat, 03 Jul 2010 10:49:44 -0700 (PDT) Received: by 10.227.152.67 with SMTP id f3mr587073wbw.195.1278179384220; Sat, 03 Jul 2010 10:49:44 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id p29sm15595083wbc.19.2010.07.03.10.49.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 03 Jul 2010 10:49:43 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [3/3] optabs: Use {SET_,}OPTAB_HANDLER for direct optabs too References: <87r5jk4gos.fsf@firetop.home> Date: Sat, 03 Jul 2010 18:49:41 +0100 In-Reply-To: <87r5jk4gos.fsf@firetop.home> (Richard Sandiford's message of "Sat, 03 Jul 2010 18:29:39 +0100") Message-ID: <87eifk4fre.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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]; 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]) + /* 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;