On 06/23/2011 03:50 PM, Andrew MacLeod wrote: > * doc/extend.texi (__sync_mem_load): Document. > * c-family/c-common.c (resolve_overloaded_builtin): Add > BUILT_IN_SYNC_MEM_LOAD_N. > * optabs.c (expand_sync_mem_load): New. > * optabs.h (enum direct_optab_index): Add DOI_sync_mem_load. > (sync_mem_load_optab): Define. > * genopinit.c: Add entry for sync_mem_load. > * builtins.c (expand_builtin_sync_mem_load): New. > (expand_builtin): Handle BUILT_IN_SYNC_MEM_LOAD_* > * sync-bultins.def: Add entries for BUILT_IN_SYNC_MEM_LOAD_*. > * testsuite/gcc.dg/sync-mem-invalid.c: Add invalid load tests. > * testsuite/gcc.dg/sync-mem.h: Add load executable tests. > * builtin-types.def (BT_FN_I{1,2,4,8,16}_VPTR_INT): New. > * expr.h (expand_sync_mem_load): Declare. > * fortran/types.def (BT_FN_I{1,2,4,8,16}_VPTR_INT): New. > * config/i386/sync.md (sync_mem_load<mode>): New pattern.
Looks good. > + (define_expand "sync_mem_load<mode>" > + [(match_operand:SWI 0 "register_operand" "") ;; output > + (match_operand:SWI 1 "memory_operand" "") ;; memory > + (match_operand:SI 2 "const_int_operand" "")] ;; memory model > + "" > + { > + if (INTVAL (operands[2]) == MEMMODEL_ACQUIRE || > + INTVAL (operands[2]) == MEMMODEL_SEQ_CST) > + expand_builtin_sync_synchronize (); > + ix86_expand_move (<MODE>mode, operands); > + DONE; > + }) Formatting error (|| operator on next line). Invoke gen_memory_barrier directly instead of a call back into expand_builtin_sync_synchronize. Isn't there a MEMMODEL setting that would call for the use of LFENCE instead of MFENCE? r~