This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ppc 8/16-bit sync builtins (PR target/36498)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]