Several 64-bit atomic-* tests fail to link with a 32-bit Solaris/x86 gcc: Running target unix/-m64 FAIL: gcc.dg/atomic-compare-exchange-5.c (test for excess errors) WARNING: gcc.dg/atomic-compare-exchange-5.c compilation failed to produce executable FAIL: gcc.dg/atomic-exchange-5.c (test for excess errors) WARNING: gcc.dg/atomic-exchange-5.c compilation failed to produce executable FAIL: gcc.dg/atomic-load-5.c execution test FAIL: gcc.dg/atomic-op-5.c (test for excess errors) WARNING: gcc.dg/atomic-op-5.c compilation failed to produce executable FAIL: gcc.dg/atomic-store-5.c (test for excess errors) WARNING: gcc.dg/atomic-store-5.c compilation failed to produce executable E.g. FAIL: gcc.dg/atomic-compare-exchange-5.c (test for excess errors) Excess errors: Undefined first referenced symbol in file __atomic_compare_exchange_16 /var/tmp//ccSEaa.G.o FAIL: gcc.dg/atomic-exchange-5.c (test for excess errors) Excess errors: Undefined first referenced symbol in file __atomic_exchange_16 /var/tmp//cci5aWbI.o FAIL: gcc.dg/atomic-op-5.c (test for excess errors) Excess errors: Undefined first referenced symbol in file __atomic_fetch_nand_16 /var/tmp//ccnFaOtM.o __atomic_fetch_or_16 /var/tmp//ccnFaOtM.o __atomic_fetch_add_16 /var/tmp//ccnFaOtM.o __atomic_fetch_and_16 /var/tmp//ccnFaOtM.o __atomic_fetch_xor_16 /var/tmp//ccnFaOtM.o __atomic_fetch_sub_16 /var/tmp//ccnFaOtM.o FAIL: gcc.dg/atomic-store-5.c (test for excess errors) Excess errors: Undefined first referenced symbol in file __atomic_store_16 /var/tmp//ccV8ayIN.o
32 bit targets don't usually support 128 bit atomic operations natively, and leave calls to be resolved by an external atomic library. There was some issue with X32 support where 32 bit could support it under some circumstances. Now gcc/testsuite/lib/target-supports.exp defines the testsuite check for whether 128 bit is supported as: proc check_effective_target_sync_int_128 { } { if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) && ![is-effective-target ia32] } { return 1 } else { return 0 } } I presume if 32 bit solaris isn't supporting 128 bit operations then this needs to be tweaked...
The quoted test ought to have worked for i386-solaris. If one of those predicates is wrong (e.g. is-effective-target ia32) then there are other tests in the testsuite that are going to be failing unnecessarily.
> --- Comment #1 from Andrew Macleod <amacleod at redhat dot com> 2011-11-21 19:21:30 UTC --- > 32 bit targets don't usually support 128 bit atomic operations natively, and > leave calls to be resolved by an external atomic library. There was some > issue with X32 support where 32 bit could support it under some circumstances. > > Now gcc/testsuite/lib/target-supports.exp defines the testsuite check for > whether 128 bit is supported as: > > proc check_effective_target_sync_int_128 { } { > if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) > && ![is-effective-target ia32] } { > return 1 > } else { > return 0 > } > } > > I presume if 32 bit solaris isn't supporting 128 bit operations then this needs > to be tweaked... There's nothing Solaris-specific here, as I'm seeing the same issue on a bi-arch i386-apple-darwin9.8.0 compiler for the 64-bit multilib. It seems the 32-bit compiler doesn't generate the 128-bit atomic insns when generating 64-bit code. Rainer
I built a compiler in my linux box with a target of i386-apple-darwin. during expanding an atomic_exchange it fails the call to can_compare_and_swap_p(TImode, true). It returns CODE_FOR_nothing for both cases: icode = direct_optab_handler (atomic_compare_and_swap_optab, mode); if (icode != CODE_FOR_nothing) return true; icode = optab_handler (sync_compare_and_swap_optab, mode); if (icode != CODE_FOR_nothing) return true; so something in the config/i386/sync.md file must be wrong for a 32 bit compiler which specifies -m64. It does not set up the optab table for a TI mode compare_and_swap.
(In reply to comment #4) > so something in the config/i386/sync.md file must be wrong for a 32 bit > compiler which specifies -m64. It does not set up the optab table for a TI > mode compare_and_swap. -mcx16 ?
It is a testsuite problem: /* { dg-options "-mcx16" { target { x86_64-*-* } } } */ Something is missing there ... ;)
Can somebody please test following change: --cut here-- Index: atomic-exchange-5.c =================================================================== --- atomic-exchange-5.c (revision 181628) +++ atomic-exchange-5.c (working copy) @@ -2,7 +2,7 @@ values with each valid memory model. */ /* { dg-do run } */ /* { dg-require-effective-target sync_int_128 } */ -/* { dg-options "-mcx16" { target { x86_64-*-* } } } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of the __atomic_X builtin for a 16 byte value. */ --cut here--
yes, presuming that it works, which I think it will, that will have to be applied to all the gcc.dg/atomic*-5.c files, as well as the gcc.dg/simulate-thread/atomic-*-int128.c files.
Should have looked more closely ;-) Patch posted. Rainer
Author: ro Date: Thu Nov 24 16:34:09 2011 New Revision: 181697 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181697 Log: Fix several atomic tests on 32-bit x86 (PR testsuite/51258) PR testsuite/51258 * gcc.dg/atomic-compare-exchange-5.c: Add -mcx16 on i?86-*-*. * gcc.dg/atomic-exchange-5.c: Likewise. * gcc.dg/atomic-load-5.c: Likewise. * gcc.dg/atomic-op-5.c: Likewise. * gcc.dg/atomic-store-5.c: Likewise. * gcc.dg/simulate-thread/atomic-other-int128.c: Fix typo. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c trunk/gcc/testsuite/gcc.dg/atomic-exchange-5.c trunk/gcc/testsuite/gcc.dg/atomic-load-5.c trunk/gcc/testsuite/gcc.dg/atomic-op-5.c trunk/gcc/testsuite/gcc.dg/atomic-store-5.c trunk/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c
I have additional patch that checks cpuid bit_CMPXCHG16B (and bit_CMPXCHG8B fwiw) for runtime support.
> --- Comment #11 from Uros Bizjak <ubizjak at gmail dot com> 2011-11-25 16:26:41 UTC --- > I have additional patch that checks cpuid bit_CMPXCHG16B (and bit_CMPXCHG8B > fwiw) for runtime support. Thanks for the heads up. I've already committed my patch and meant to work on this part over the weekend. Rainer
Author: uros Date: Fri Nov 25 17:41:44 2011 New Revision: 181727 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181727 Log: PR testsuite/51258 * lib/target-supports.exp (check_effective_target_sync_int_128_runtime): New procedure. (check_effective_target_sync_long_long_runtime): Ditto. (check_effective_target_sync_long_long): Add arm*-*-*. (check_effective_target_sync_longlong): Remove. * gcc.dg/atomic-op-5.c: Require sync_int_128_runtime effective target. * gcc.dg/atomic-compare-exchange-5.c: Ditto. * gcc.dg/atomic-exchange-5.c: Ditto. * gcc.dg/atomic-load-5.c: Ditto. * gcc.dg/atomic-store-5.c: Ditto. * gcc.dg/simulate-thread/atomic-load-int128.c: Ditto. * gcc.dg/simulate-thread/atomic-other-int128.c: Ditto. * gcc.dg/atomic-op-4.c: Require sync_long_long_runtime effective target. * gcc.dg/atomic-compare-exchange-4.c: Ditto. * gcc.dg/atomic-exchange-4.c: Ditto. * gcc.dg/atomic-load-4.c: Ditto. * gcc.dg/atomic-store-4.c: Ditto. * gcc.dg/di-longlong64-sync-1.c: Ditto. * gcc.dg/di-sync-multithread.c: Ditto. * gcc.dg/simulate-thread/atomic-load-longlong.c: Ditto. * gcc.dg/simulate-thread/atomic-other-longlong.c: Ditto. Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c trunk/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c trunk/gcc/testsuite/gcc.dg/atomic-exchange-4.c trunk/gcc/testsuite/gcc.dg/atomic-exchange-5.c trunk/gcc/testsuite/gcc.dg/atomic-load-4.c trunk/gcc/testsuite/gcc.dg/atomic-load-5.c trunk/gcc/testsuite/gcc.dg/atomic-op-4.c trunk/gcc/testsuite/gcc.dg/atomic-op-5.c trunk/gcc/testsuite/gcc.dg/atomic-store-4.c trunk/gcc/testsuite/gcc.dg/atomic-store-5.c trunk/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c trunk/gcc/testsuite/gcc.dg/di-sync-multithread.c trunk/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c trunk/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c trunk/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c trunk/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c trunk/gcc/testsuite/lib/target-supports.exp
Author: uros Date: Fri Nov 25 19:30:58 2011 New Revision: 181728 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181728 Log: PR testsuite/51258 * lib/target-supports.exp (check_effective_target_sync_long_long): Also supported on 32bit x86 targets. Add comment about required dg-options. Add alpha*-*-* targets. (check_effective_target_sync_long_long_runtime): Ditto. * gcc.dg/atomic-op-4.c (dg-options): Add -march=pentium for 32bit x86 targets. * gcc.dg/atomic-compare-exchange-4.c: Ditto. * gcc.dg/atomic-exchange-4.c: Ditto. * gcc.dg/atomic-load-4.c: Ditto. * gcc.dg/atomic-store-4.c: Ditto. * gcc.dg/di-longlong64-sync-1.c: Ditto. * gcc.dg/di-sync-multithread.c: Ditto. * gcc.dg/simulate-thread/atomic-load-longlong.c: Ditto. * gcc.dg/simulate-thread/atomic-other-longlong.c: Ditto. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c trunk/gcc/testsuite/gcc.dg/atomic-exchange-4.c trunk/gcc/testsuite/gcc.dg/atomic-load-4.c trunk/gcc/testsuite/gcc.dg/atomic-op-4.c trunk/gcc/testsuite/gcc.dg/atomic-store-4.c trunk/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c trunk/gcc/testsuite/gcc.dg/di-sync-multithread.c trunk/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c trunk/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c trunk/gcc/testsuite/lib/target-supports.exp
On x86_64-apple-darwin11, we are seeing the following failures at -m64 (but not -m32)... Running /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111206/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.exp ... FAIL: gcc.dg/simulate-thread/atomic-load-int128.c -O1 -g thread simulation test FAIL: gcc.dg/simulate-thread/atomic-load-int128.c -O2 -g thread simulation test FAIL: gcc.dg/simulate-thread/atomic-load-int128.c -O3 -g thread simulation test FAIL: gcc.dg/simulate-thread/atomic-load-int128.c -Os -g thread simulation test The output for the first failure is attached.
Created attachment 26009 [details] log of FAIL: gcc.dg/simulate-thread/atomic-load-int128.c -O1 -g thread simulation test failure on x86_64-apple-darwin11
(In reply to comment #16) > Created attachment 26009 [details] > log of FAIL: gcc.dg/simulate-thread/atomic-load-int128.c -O1 -g thread > simulation test failure on x86_64-apple-darwin11 Can you try with increased timeout value? In testsuite/lib/gcc-simulate-thread.exp find following line: # Set timeout to 10 seconds due to huge amount of generated log. remote_expect target 10 { and increase 10. If this fails, you should check if generated executable runs OK outside of the debugger.
The actual binaries for atomic-load-int128.c at -O1 and higher run fine on x86_64-apple-darwin64 at -m64. However they take around 16 seconds to execute on a... Model Name: Mac Pro Model Identifier: MacPro3,1 Processor Name: Quad-Core Intel Xeon Processor Speed: 2.8 GHz Number of Processors: 2 Total Number of Cores: 8 L2 Cache (per Processor): 12 MB Memory: 12 GB Bus Speed: 1.6 GHz Increasing the timeout to 20 seconds allows all of the gcc.dg/simulate-thread/atomic-load-int128.c tests to pass.
GCC 4.7.0 is being released, adjusting target milestone.
Is this not resolved in 4.7? I thought we had changed the timeouts back to normal and added other mechanisms to avoid large infinite loops
Indeed, so closing. Rainer