[hjl@gnu-14 prev-gcc]$ cat /tmp/x.c #include <ia64intrin.h> int foo (int *p) { return __sync_lock_test_and_set (p, 0); } [hjl@gnu-14 prev-gcc]$ ./xgcc -B./ -O2 -S /tmp/x.c [hjl@gnu-14 prev-gcc]$ cat x.s .file "x.c" .pred.safe_across_calls p1-p5,p16-p63 .text .align 16 .align 64 .global foo# .type foo#, @function .proc foo# foo: .prologue .body .mmi nop 0 mov r8 = r0 nop 0 ;; .mib xchg4 r8 = [r32], r8 nop 0 br.ret.sptk.many b0 .endp foo# .ident "GCC: (GNU) 4.4.0 20081106 (experimental) [trunk revision 141649]" [hjl@gnu-14 prev-gcc]$ We don't need mov r8 = r0 We should generate xchg4 r8 = [r32], r0
Created attachment 16629 [details] gcc44-pr38034.patch Untested patch to fix it.
A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00674.html
Subject: Bug 38034 Author: hjl Date: Fri Mar 27 22:28:20 2009 New Revision: 145135 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145135 Log: gcc/ 2009-03-27 H.J. Lu <hongjiu.lu@intel.com> Jakub Jelinek <jakub@redhat.com> PR target/38034 * config/ia64/sync.md (cmpxchg_rel_<mode>): Replace input gr_register_operand with gr_reg_or_0_operand. (cmpxchg_rel_di): Likewise. (sync_lock_test_and_set<mode>): Likewise. gcc/testsuite/ 2009-03-27 H.J. Lu <hongjiu.lu@intel.com> PR target/38034 * gcc.target/ia64/sync-1.c: New. Added: trunk/gcc/testsuite/gcc.target/ia64/sync-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/ia64/sync.md trunk/gcc/testsuite/ChangeLog
Closing this out since it is now fixed for 4.5.