This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ppc 8/16-bit sync builtins (PR target/36498)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: David Edelsohn <dje at watson dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 7 Mar 2008 17:45:54 -0500
- Subject: [PATCH] Fix ppc 8/16-bit sync builtins (PR target/36498)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The newly added libgomp/testsuite/libgomp.c/atomic-3.c testcase
sometimes fails on ppc-linux, the problem seems to be with 16-bit
(and 8-bit too) atomic builtins if the address is at multiple of 4 address
for 16-bit (and (addr & 3) != 3 for 8-bit).
Bootstrapped/regtested on ppc-linux and ppc64-linux, ok for trunk and 4.3?
2008-03-07 Jakub Jelinek <jakub@redhat.com>
PR target/35498
* config/rs6000/rs6000.c (rs6000_expand_compare_and_swapqhi): Shift
wdst back after sync_compare_and_swapqhi_internal.
--- gcc/config/rs6000/rs6000.c.jj 2008-02-29 09:11:54.000000000 +0100
+++ gcc/config/rs6000/rs6000.c 2008-03-07 17:22:27.000000000 +0100
@@ -13858,6 +13858,9 @@ rs6000_expand_compare_and_swapqhi (rtx d
emit_insn (gen_sync_compare_and_swapqhi_internal (wdst, mask,
oldval, newval, mem));
+ /* Shift the result back. */
+ emit_insn (gen_lshrsi3 (wdst, wdst, shift));
+
emit_move_insn (dst, gen_lowpart (mode, wdst));
}
Jakub