[Patch 1/2] MIPS factor sync instructions out of atomic memory built-ins.
Richard Sandiford
rdsandiford@googlemail.com
Tue Aug 18 19:09:00 GMT 2009
David Daney <ddaney@caviumnetworks.com> writes:
> Richard Sandiford wrote:
>> gcc/
>> * config/mips/mips-protos.h (mips_output_sync): Declare.
>> (mips_sync_loop_insns): Likewise.
>> (mips_output_sync_loop): Replace first two parameters with an rtx.
>> * config/mips/mips.c (mips_pop_asm_switch): Remove '%|' and '%-'.
>> (mips_init_print_operand_punct): Update accordingly.
>> (mips_start_ll_sc_sync_block): New function.
>> (mips_end_ll_sc_sync_block): Likewise.
>> (mips_output_sync): Likewise.
>> (mips_sync_insn1_template): Likewise.
>> (mips_sync_insn2_template): Likewise.
>> (mips_get_sync_operand): Likewise.
>> (mips_process_sync_loop): Likewise.
>> (mips_output_sync_loop): Use mips_process_sync_loop.
>> (mips_sync_loop_insns): New function.
>> * config/mips/mips.h (MIPS_COMPARE_AND_SWAP): Delete.
>> (MIPS_COMPARE_AND_SWAP_12): Likewise.
>> (MIPS_COMPARE_AND_SWAP_12_ZERO_OP): Likewise.
>> (MIPS_COMPARE_AND_SWAP_12_NONZERO_OP): Likewise.
>> (MIPS_SYNC_OP, MIPS_SYNC_OP_12): Likewise.
>> (MIPS_SYNC_OP_12_AND, MIPS_SYNC_OP_12_XOR): Likewise.
>> (MIPS_SYNC_OLD_OP_12): Likewise.
>> (MIPS_SYNC_OLD_OP_12_AND, MIPS_SYNC_OLD_OP_12_XOR): Likewise.
>> (MIPS_SYNC_NEW_OP_12): Likewise.
>> (MIPS_SYNC_NEW_OP_12_AND, MIPS_SYNC_NEW_OP_12_XOR): Likewise.
>> (MIPS_SYNC_OLD_OP, MIPS_SYNC_NEW_OP): Likewise.
>> (MIPS_SYNC_NAND, MIPS_SYNC_OLD_NAND, MIPS_SYNC_NEW_NAND): Likewise.
>> (MIPS_SYNC_EXCHANGE, MIPS_SYNC_EXCHANGE_12): Likewise.
>> (MIPS_SYNC_EXCHANGE_12_ZERO_OP): Likewise.
>> (MIPS_SYNC_EXCHANGE_12_NONZER_OP): Likewise.
>> * config/mips/mips.md (sync_mem): New attribute.
>> (sync_oldval, sync_newval, sync_inclusive_mask): Likewise.
>> (sync_exclusive_mask, sync_required_oldval): Likewise.
>> (sync_insn1_op2, sync_insn1, sync_insn2): Likewise.
>> (sync_release_barrier): Likewise.
>> (length): Handle sync loops.
>> (sync): Use mips_output_sync.
>> * config/mips/sync.md (*memory_barrier): Use mips_output_sync.
>> (sync_compare_and_swap<mode>): Set the new sync_* attributes
>> and use mips_output_sync_loop.
>> (compare_and_swap_12, sync_add<mode>, sync_<optab>_12): Likewise.
>> (sync_old_<optab>_12, sync_new_<optab>_12, sync_nand_12): Likewise.
>> (sync_old_nand_12, sync_new_nand_12, sync_sub<mode>): Likewise.
>> (sync_old_add<mode>, sync_old_sub<mode>): Likewise.
>> (sync_new_add<mode>, sync_new_sub<mode>): Likewise.
>> (sync_<optab><mode>, sync_old_<optab><mode>): Likewise.
>> (sync_new_<optab><mode>, sync_nand<mode>): Likewise.
>> (sync_old_nand<mode>, sync_new_nand<mode>): Likewise.
>> (sync_lock_test_and_set<mode>, test_and_set_12): Likewise.
>
> I haven't reviewed it on a line by line basis, but it looks good to me.
>
> If it doesn't regress in libgomp or libjava when run on a multi-core
> CPU, I say check it in.
Thanks. I'll test it over the next few days and commit if all goes OK.
Richard
More information about the Gcc-patches
mailing list