------- Comment #3 from pinskia at gcc dot gnu dot org 2009-01-01 16:01 ------- ;; Recall that xchg implicitly sets LOCK#, so adding it again wastes space. (define_insn "sync_lock_test_and_set<mode>" [(set (match_operand:IMODE 0 "register_operand" "=<modeconstraint>") (unspec_volatile:IMODE [(match_operand:IMODE 1 "memory_operand" "+m")] UNSPECV_XCHG)) (set (match_dup 1) (match_operand:IMODE 2 "register_operand" "0"))]
So this is invalid as xchg implicitly sets LOCK. why do you want to waste space in the icache for something that is already done implicitly? See also http://groups.google.com/group/alt.lang.asm/browse_thread/thread/7ae1bc600fe8aadc?pli=1 . -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38688