Re: [PATCH, rtl-optimization]: Fix post-reload compare elimination pre-pass

2012-02-11 Thread Uros Bizjak
On Sat, Feb 11, 2012 at 1:26 AM, Richard Henderson r...@redhat.com wrote:
 On 02/09/2012 03:47 PM, Uros Bizjak wrote:
 2012-02-10  Uros Bizjak  ubiz...@gmail.com

       * compare-elim.c (find_comparisons_in_bb): Eliminate only compares
       having mode compatible with the mode of previous compare.  Substitute
       compare mode of previous compare with the mode, compatible
       with eliminated and previous compare.

 This patch is ok for 4.8.

 For 4.6 and 4.7 I would prefer that we simply not eliminate the compare.  I.e.

 For 4.6 and 4.7, there are only two extant users of this pass and neither
 of them use anything besides CCmode before compare-elim.c does its own
 manipulation of the modes later.

Attached patch is what I have committed to 4.6 and 4.7.

2012-02-11  Uros Bizjak  ubiz...@gmail.com

* compare-elim.c (find_comparisons_in_bb): Eliminate only compares
having the same mode as previous compare.

Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32},
together with a target-patch that enables this functionality.

Uros.
Index: compare-elim.c
===
--- compare-elim.c  (revision 184123)
+++ compare-elim.c  (working copy)
@@ -297,8 +297,11 @@ find_comparisons_in_bb (struct dom_walk_data *data
   src = conforming_compare (insn);
   if (src)
{
+ enum machine_mode src_mode = GET_MODE (src);
+
  /* Eliminate a compare that's redundant with the previous.  */
  if (last_cmp_valid
+  src_mode == last_cmp-orig_mode
   rtx_equal_p (last_cmp-in_a, XEXP (src, 0))
   rtx_equal_p (last_cmp-in_b, XEXP (src, 1)))
{
@@ -311,7 +314,7 @@ find_comparisons_in_bb (struct dom_walk_data *data
  last_cmp-prev_clobber = last_clobber;
  last_cmp-in_a = XEXP (src, 0);
  last_cmp-in_b = XEXP (src, 1);
- last_cmp-orig_mode = GET_MODE (SET_DEST (single_set (insn)));
+ last_cmp-orig_mode = src_mode;
  VEC_safe_push (comparison_struct_p, heap, all_compares, last_cmp);
 
  /* It's unusual, but be prepared for comparison patterns that


Re: [PATCH 4.8 v2, i386]: Make CCZ mode compatible with CCGOC and CCGO modes

2012-02-11 Thread Uros Bizjak
On Tue, Feb 7, 2012 at 5:37 PM, Uros Bizjak ubiz...@gmail.com wrote:

 Attached patch declares CCZmode compatible with CCGOC, CCGO and CCNO modes.

 Actually, CCZ mode is not compatible with CCNO mode, since the later
 only declares that overflow flag is not set. CCGOC and CCGO declare
 garbage in overflow (and carry in case of CCGOC) flag, so implicitly
 declare that CCZ flag is valid. Following this reasoning, CCZ mode
 should be compatible with CCGOC and CCGO modes.

 2012-02-07  Uros Bizjak  ubiz...@gmail.com

       * config/i386/i386.c (ix86_cc_modes_compatible): Declare CCZmode
       compatible with CCGOCmode and CCGCmode.

 Attached patch was bootstrapped and regression tested on x86_64-pc-linux-gnu.

... where it uncovers another problem how RTL optimizer handles
compatible compares!

With attached patch, the example from pr28685

--cut here--
int test(int a, int b)
{
  int lt = a  b;
  int eq = a == b;
  if (lt)
return 1;
  return eq;
}
--cut here--

triggers compare elimination in CSE2 pass. We enter CSE2 pass with:

(insn 8 5 9 2 (set (reg:CCGC 17 flags)
(compare:CCGC (reg/v:SI 62 [ a ])
(reg/v:SI 63 [ b ]))) pr28685.c:7 6 {*cmpsi_1}
 (nil))

(jump_insn 9 8 10 2 (set (pc)
(if_then_else (lt (reg:CCGC 17 flags)
(const_int 0 [0]))
(label_ref:DI 15)
(pc))) pr28685.c:7 599 {*jcc_1}
 (expr_list:REG_DEAD (reg:CCGC 17 flags)
(expr_list:REG_BR_PROB (const_int 3900 [0xf3c])
(nil)))
 - 15)

[...]

(note 10 9 11 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(insn 11 10 12 3 (set (reg:CCZ 17 flags)
(compare:CCZ (reg/v:SI 62 [ a ])
(reg/v:SI 63 [ b ]))) pr28685.c:6 6 {*cmpsi_1}
 (expr_list:REG_DEAD (reg/v:SI 63 [ b ])
(expr_list:REG_DEAD (reg/v:SI 62 [ a ])
(nil

(insn 12 11 13 3 (set (reg:QI 65)
(eq:QI (reg:CCZ 17 flags)
(const_int 0 [0]))) pr28685.c:6 595 {*setcc_qi}
 (expr_list:REG_DEAD (reg:CCZ 17 flags)
(nil)))

After CSE2 pass, we have:

(insn 8 5 9 2 (set (reg:CCGC 17 flags)
(compare:CCGC (reg/v:SI 62 [ a ])
(reg/v:SI 63 [ b ]))) pr28685.c:7 6 {*cmpsi_1}
 (nil))

(jump_insn 9 8 10 2 (set (pc)
(if_then_else (lt (reg:CCGC 17 flags)
(const_int 0 [0]))
(label_ref:DI 15)
(pc))) pr28685.c:7 599 {*jcc_1}
 (expr_list:REG_DEAD (reg:CCGC 17 flags)
(expr_list:REG_BR_PROB (const_int 3900 [0xf3c])
(nil)))
 - 15)

[...]

(note 10 9 12 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(insn 12 10 13 3 (set (reg:QI 65)
(eq:QI (reg:CCGC 17 flags)
(const_int 0 [0]))) pr28685.c:6 595 {*setcc_qi}
 (expr_list:REG_DEAD (reg:CCGC 17 flags)
(nil)))

CSE2 pass eliminated (insn 11), which is OK since CCZ is compatible
with CCGC, so (CCGC, CCZ)-CCGC. However, the pass also changed the
mode of flags register in (insn 12). I don't think this is correct,
the user should not be changed at all.

Uros.


Re: [PATCH] fix PR51910, take 2

2012-02-11 Thread Jason Merrill

On 02/08/2012 03:01 AM, Jakub Jelinek wrote:

On Tue, Feb 07, 2012 at 11:41:03PM -1000, Jason Merrill wrote:

Hmm, I wrote up something quite similar on the plane.  One
difference is that mine synchronizes .rpo files that start with some
variants chosen and others not.  Does this make sense to you?


You mean the maybe_tweak change?  Not sure I understand it.


That and some of the changes in scan_linker_output as well.


Anyway, using VEC is probably cleaner than my patch, on the other
side might be more expensive for the common case where most
symbols don't demangle the same like any other symbol,
because then you allocate a VEC (I think 4 pointers) for each of the
hash table entries, i.e. one extra allocation for each.


It looks like a VEC adds two unsigned ints, whereas your patch adds one 
pointer; not a big difference.



Anyway, the question is if the increases in object sizes with -frepo
(due to bringing in unused ctor or dtor variants from time to time)
will be acceptable to -frepo users (if there are any).


I suppose we would run into this with classes with virtual bases that 
are not themselves derived from; we wouldn't need the base variant in 
that case.  So this changes from a link-failure regression to, I 
suppose, missed-optimization.  I'm OK with that.


Jason


Re: [PATCH 4.8 v2, i386]: Make CCZ mode compatible with CCGOC and CCGO modes

2012-02-11 Thread Uros Bizjak
On Sat, Feb 11, 2012 at 9:41 AM, Uros Bizjak ubiz...@gmail.com wrote:

 Attached patch declares CCZmode compatible with CCGOC, CCGO and CCNO modes.

 Actually, CCZ mode is not compatible with CCNO mode, since the later
 only declares that overflow flag is not set. CCGOC and CCGO declare
 garbage in overflow (and carry in case of CCGOC) flag, so implicitly
 declare that CCZ flag is valid. Following this reasoning, CCZ mode
 should be compatible with CCGOC and CCGO modes.

 2012-02-07  Uros Bizjak  ubiz...@gmail.com

       * config/i386/i386.c (ix86_cc_modes_compatible): Declare CCZmode
       compatible with CCGOCmode and CCGCmode.

 Attached patch was bootstrapped and regression tested on x86_64-pc-linux-gnu.

 ... where it uncovers another problem how RTL optimizer handles
 compatible compares!

 CSE2 pass eliminated (insn 11), which is OK since CCZ is compatible
 with CCGC, so (CCGC, CCZ)-CCGC. However, the pass also changed the
 mode of flags register in (insn 12). I don't think this is correct,
 the user should not be changed at all.

This is also where my proposed patch [1] for post-reload compare
elimination differs from CSE2 pass. The proposed revision doesn't
update the mode of flags reg of users to calculated compatible mode.
FWIW, the mode of flags in users doesn't matter at all on x86, but
which way is correct?

[1] http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00466.html

Uros.


PR 52175: another dbr_schedule-induced cfi ICE

2012-02-11 Thread Richard Sandiford
This patch fixes PR rtl-optimization/52175, which is another case of
dbr_schedule mishandling the result of shrink-wrapping.  There is code
to allow:

add rN,rN,CONST

to be put into a delay slot by adding a compensating:

add rN,rN,-CONST

to the opposite thread.  (Which has caused headaches before because
it increases code size.)  In the testcase, we end up doing this for
a frame-related stack allocation: we allocate stack in the delay
slot, then immediately deallocate it again on the opposite thread.
This triggers an ICE because the deallocation is not marked as
frame-related, so it looks to the cfi code as though we can reach
the same point with two different CFAs.

We don't really want the optimisers to add new frame-related
annotations, and it's difficult to do that anyway in the general
case where the annotation is based on an instruction that had
REG_FRAME_RELATED_EXPR notes attached.  I also can't really think
of many cases where it would be worthwhile.  So this patch stops
us applying for the optimisation in that case, just like we did
for PR 51471.

I strongly suspect that doing this optimisation for the stack pointer is
independently wrong -- e.g. if an alloca is protected by a bounds check --
but since that part isn't a regression, I'm not tackling it here.

And, to really over-egg this one-liner, I thought I'd better
mention why I fixed it this way.  The code reads:

  /* If we haven't found anything for this delay slot and it is very
 likely that the branch will be taken, see if the insn at our target
 increments or decrements a register with an increment that does not
 depend on the destination register.  If so, try to place the opposite
 arithmetic insn after the jump insn and put the arithmetic insn in the
 delay slot.  If we can't do this, return.  */
  if (delay_list == 0  likely
   new_thread  !ANY_RETURN_P (new_thread)
   NONJUMP_INSN_P (new_thread)
   GET_CODE (PATTERN (new_thread)) != ASM_INPUT
   asm_noperands (PATTERN (new_thread))  0)
{
  rtx pat = PATTERN (new_thread);
  rtx dest;
  rtx src;

  trial = new_thread;
  pat = PATTERN (trial);

  if (!NONJUMP_INSN_P (trial)
  || GET_CODE (pat) != SET
  || ! eligible_for_delay (insn, 0, trial, flags)
  || can_throw_internal (trial))
return 0;

And there's obviously some redundancy between the two if blocks here.
So which is the right way to handle the unoptimisable case?
Returning, or falling through?  I think it's falling through,
so that we still redirect the jump in cases where we have skipped
a redundant insn without actually filling a delay slot.  I therefore
added the check to the first if statement rather than the second.

Despite all that, this felt obvious enough to self-approve.
Tested on various mips* targets and applied.

Richard


gcc/
PR rtl-optimization/52175
* reorg.c (fill_slots_from_thread): Don't apply add/sub optimization
to frame-related instructions.

gcc/testsuite/
PR rtl-optimization/52175
* gcc.c-torture/compile/pr52175.c: New test.

Index: gcc/reorg.c
===
--- gcc/reorg.c 2012-02-07 22:28:46.0 +
+++ gcc/reorg.c 2012-02-07 22:40:58.0 +
@@ -2937,6 +2937,7 @@ fill_slots_from_thread (rtx insn, rtx co
   if (delay_list == 0  likely
new_thread  !ANY_RETURN_P (new_thread)
NONJUMP_INSN_P (new_thread)
+   !RTX_FRAME_RELATED_P (new_thread)
GET_CODE (PATTERN (new_thread)) != ASM_INPUT
asm_noperands (PATTERN (new_thread))  0)
 {
Index: gcc/testsuite/gcc.c-torture/compile/pr52175.c
===
--- /dev/null   2012-02-08 18:03:45.062776123 +
+++ gcc/testsuite/gcc.c-torture/compile/pr52175.c   2012-02-08 
19:13:26.0 +
@@ -0,0 +1,25 @@
+void bad (void);
+char *foo (char *src, char **last)
+{
+  char *dst;
+  int ch;
+  dst = src = (src ? src : *last);
+
+  if (*src == 0)
+return 0;
+
+  while (src[0])
+{
+  if (!src[1])
+   {
+ bad ();
+ break;
+   }
+  *dst = *src;
+  dst += 1;
+  src += 2;
+}
+  *last = src;
+  *dst = 0;
+  return *last;
+}




Re: [PATCH] MIPS16 TLS support for GCC

2012-02-11 Thread Maciej W. Rozycki
On Sat, 11 Feb 2012, Richard Henderson wrote:

 On 02/04/2012 02:06 AM, Richard Sandiford wrote:
Actually I had that idea of a link-once function too, but it turned out 
   quite complicated to do without rewriting some generic parts of GCC as 
   it 
   is currently not prepared to emit link-once functions outside C++ 
   compilations.  It's been a while and I did lots of other stuff 
   meanwhile, 
   so please excuse me if I got anything wrong here.
  Hmm, OK, I wouldn't have expected that.  But if you've tried making
  __mips16_rdhwr link-once and had a bad experience with it, then yeah,
  let's go with the hidden libgcc function.  It's just a shame that we're
  having to force static linking of libgcc for this one case.
 
 The i386 target does it all the time for its __x86.get_pc_thunk.?x thingys.
 So I really don't believe the not prepared comment.

 I'm confused then, sorry -- Chung-Lin, can you look into it again then 
please?

  Maciej


Re: [Ada] Do not pass -Werror during linking

2012-02-11 Thread Eric Botcazou
 is having Address be an integer useful any more?  Nowadays it should be
 possible to declare Address to be an access type with no associated storage
 pool.  Even nicer might be to have it be turned into void* when lowering to
 GCC types. After all, Address is really used much like void*; see how GNAT
 declares malloc for example.  Both of these possibilities would probably
 play better with GCC's middle end type system, which considers integers to
 be different to pointers.

The polymorphism pointer/address indeed proves to be problematic in certain 
circumstances (e.g. it breaks on m68k, see PR ada/48835).  My understanding is 
that using pointers in Ada is heavyweight, hence the choice of an integer for 
System.Address; and I'm reluctant to enter the type morphing business in gigi.

But we could investigate changing System.Memory to use an access type instead 
of System.Address.  It's a compiler unit so the impact should be limited, and 
at least this would solve the m68k problem.

-- 
Eric Botcazou


[SPARC] Fix an old oversight in libffi

2012-02-11 Thread Eric Botcazou
The minimum stack frame size is 176 in 64-bit mode, not 128.

Tested on SPARC/Solaris, applied on the mainline.


2012-02-11  Eric Botcazou  ebotca...@adacore.com

* src/sparc/v9.S (STACKFRAME): Bump to 176.


-- 
Eric Botcazou
Index: src/sparc/v9.S
===
--- src/sparc/v9.S	(revision 183864)
+++ src/sparc/v9.S	(working copy)
@@ -32,7 +32,7 @@
 /* Only compile this in for 64bit builds, because otherwise the object file
will have inproper architecture due to used instructions.  */
 
-#define STACKFRAME 128		/* Minimum stack framesize for SPARC */
+#define STACKFRAME 176		/* Minimum stack framesize for SPARC 64-bit */
 #define STACK_BIAS 2047
 #define ARGS (128)		/* Offset of register area in frame */
 


[PATCH] Fix signed bitfield BIT_NOT_EXPR expansion (PR middle-end/52209)

2012-02-11 Thread Jakub Jelinek
Hi!

In July Richard changed reduce_bit_field BIT_NOT_EXPR expansion from
NOT unop to XOR with all the bits in the bitfield's precision set.
Unfortunately that is correct for unsigned bitfields only, for signed
bitfields, where op0 is already sign-extended to its mode before this,
expanding this as NOT is the right thing.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2012-02-11  Jakub Jelinek  ja...@redhat.com

PR middle-end/52209
* expr.c (expand_expr_real_2) case BIT_NOT_EXPR: Only expand using
XOR for reduce_bit_field if type is unsigned.

* gcc.c-torture/execute/pr52209.c: New test.

--- gcc/expr.c.jj   2012-02-07 16:05:51.0 +0100
+++ gcc/expr.c  2012-02-11 10:08:44.162924423 +0100
@@ -8582,8 +8582,9 @@ expand_expr_real_2 (sepops ops, rtx targ
   if (modifier == EXPAND_STACK_PARM)
target = 0;
   /* In case we have to reduce the result to bitfield precision
-expand this as XOR with a proper constant instead.  */
-  if (reduce_bit_field)
+for unsigned bitfield expand this as XOR with a proper constant
+instead.  */
+  if (reduce_bit_field  TYPE_UNSIGNED (type))
temp = expand_binop (mode, xor_optab, op0,
 immed_double_int_const
   (double_int_mask (TYPE_PRECISION (type)), mode),
--- gcc/testsuite/gcc.c-torture/execute/pr52209.c.jj2012-02-11 
10:09:46.080571803 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr52209.c   2012-02-11 
10:09:28.0 +0100
@@ -0,0 +1,14 @@
+/* PR middle-end/52209 */
+
+extern void abort (void);
+struct S0 { int f2 : 1; } c;
+int b;
+
+int
+main ()
+{
+  b = -1 ^ c.f2;
+  if (b != -1)
+abort ();
+  return 0;
+}

Jakub


Re: [v3] libstdc++/51798

2012-02-11 Thread Jonathan Wakely
On 11 February 2012 00:56, Richard Henderson wrote:

 Ok?

OK, thanks.


Re: [Ada] Do not pass -Werror during linking

2012-02-11 Thread Geert Bosch

On Feb 11, 2012, at 05:37, Eric Botcazou wrote:
 The polymorphism pointer/address indeed proves to be problematic in certain 
 circumstances (e.g. it breaks on m68k, see PR ada/48835).  My understanding 
 is 
 that using pointers in Ada is heavyweight, hence the choice of an integer for 
 System.Address; and I'm reluctant to enter the type morphing business in gigi.

There are two issues:

  - In the Ada front end and run time, we rely on Address being an unsigned 
type, so we can do address arithmetic. Ada doesn't have the notion of
pointer arithmetic.

  - Access types (pointers) in Ada carry not only carry the address, but also
the bounds in case of unconstrained types (as you well know)

I agree it doesn't fit well to do that, and seems pointless as one cannot
dereference Address anyway, so we have conversions where needed.

 But we could investigate changing System.Memory to use an access type instead 
 of System.Address.  It's a compiler unit so the impact should be limited, and 
 at least this would solve the m68k problem.

Probably for Convention C, we should convert Address to *void.

So, for

   function Alloc (Size : size_t) return System.Address;
   pragma Export (C, Alloc,   __gnat_malloc);

we probably should do this replacement and add the necessary
type conversions. That would seem to be how this was intended.
However, I'm not sure how much of an earthquake this would
be in gigi.

  -Geert


Re: PATCH: Add capability to contrib/compare_tests to handle directories

2012-02-11 Thread Mike Stump
On Nov 4, 2011, at 8:23 PM, Quentin Neill wrote:
 My scenario about ANY test results changed is what I added with -strict.
 This patch concatenates the common .sum files before comparing.

So, how exactly does this work for you:

+   ( for fname in `cat $lst5`; do cat $1/$fname; done ) $sum1
+   ( for fname in `cat $lst5`; do cat $2/$fname; done ) $sum2
+   echo ## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
+   ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2

sum1 and sum2 appear to be variables that aren't set.


[libitm] Link with -litm and -pthread

2012-02-11 Thread Eric Botcazou
Hi,

this completes the half-implemented linking scheme of libitm and makes it mimic 
that of libgomp entirely.  We need the -pthread thing on Solaris 8.

Tested on SPARC/Solaris 8  9 and i586/Linux, OK for the mainline?


2012-02-11  Eric Botcazou  ebotca...@adacore.com

* gcc.c (LINK_COMMAND_SPEC): Deal with -fgnu-tm.
(GTM_SELF_SPECS): Define if not already defined.
(driver_self_specs): Add GTM_SELF_SPECS.
* config/darwin.h (GTM_SELF_SPECS): Define.
* config/i386/cygwin.h (GTM_SELF_SPECS): Likewise.
* config/i386/mingw32.h (GTM_SELF_SPECS): Likewise.


2012-02-11  Eric Botcazou  ebotca...@adacore.com

* configure.ac (link_itm): Fix comment.
* configure: Regenerate.
* testsuite/lib/libitm.exp: Do not pass -litm for the link.


-- 
Eric Botcazou
Index: gcc/gcc.c
===
--- gcc/gcc.c	(revision 183864)
+++ gcc/gcc.c	(working copy)
@@ -675,6 +675,7 @@ proper position among the other output f
 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
 %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
 %(mflib)  STACK_SPLIT_SPEC \
 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
@@ -839,9 +840,14 @@ static const char *const multilib_defaul
 #define GOMP_SELF_SPECS %{fopenmp|ftree-parallelize-loops=*: -pthread}
 #endif
 
+/* Likewise for -fgnu-tm.  */
+#ifndef GTM_SELF_SPECS
+#define GTM_SELF_SPECS %{fgnu-tm: -pthread}
+#endif
+
 static const char *const driver_self_specs[] = {
   %{fdump-final-insns:-fdump-final-insns=.} %fdump-final-insns,
-  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS
+  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS, GTM_SELF_SPECS
 };
 
 #ifndef OPTION_DEFAULT_SPECS
Index: gcc/config/i386/cygwin.h
===
--- gcc/config/i386/cygwin.h	(revision 183864)
+++ gcc/config/i386/cygwin.h	(working copy)
@@ -126,6 +126,8 @@ along with GCC; see the file COPYING3.
and the -pthread flag is not recognized.  */
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS 
+#undef GTM_SELF_SPECS
+#define GTM_SELF_SPECS 
 
 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
 #if DWARF2_UNWIND_INFO
Index: gcc/config/i386/mingw32.h
===
--- gcc/config/i386/mingw32.h	(revision 183864)
+++ gcc/config/i386/mingw32.h	(working copy)
@@ -187,6 +187,8 @@ do {		 \
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS %{fopenmp|ftree-parallelize-loops=*:  \
 			-mthreads -pthread}
+#undef GTM_SELF_SPECS
+#define GTM_SELF_SPECS %{fgnu-tm:-mthreads -pthread}
 
 /* mingw32 atexit function is safe to use in shared libraries.  Use it
to register C++ static destructors.  */
Index: gcc/config/darwin.h
===
--- gcc/config/darwin.h	(revision 183864)
+++ gcc/config/darwin.h	(working copy)
@@ -915,6 +915,8 @@ void add_framework_path (char *);
 
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS 
+#undef GTM_SELF_SPECS
+#define GTM_SELF_SPECS 
 
 /* Darwin disables section anchors by default.  
They should be enabled per arch where support exists in that arch.  */
Index: libitm/configure.ac
===
--- libitm/configure.ac	(revision 183864)
+++ libitm/configure.ac	(working copy)
@@ -268,7 +268,7 @@ else
 fi
 
 # Set up the set of libraries that we need to link against for libitm.
-# Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp,
+# Note that the GTM_SELF_SPECS in gcc.c will force -pthread for -fgnu-tm,
 # which will force linkage against -lpthread (or equivalent for the system).
 # That's not 100% ideal, but about the best we can do easily.
 if test $enable_shared = yes; then
Index: libitm/testsuite/lib/libitm.exp
===
--- libitm/testsuite/lib/libitm.exp	(revision 183864)
+++ libitm/testsuite/lib/libitm.exp	(working copy)
@@ -140,7 +140,6 @@ proc libitm_init { args } {
 	lappend ALWAYS_CFLAGS ldflags=-L${blddir}/.libs
 }
 lappend ALWAYS_CFLAGS additional_flags=-I${srcdir}/..
-lappend ALWAYS_CFLAGS ldflags=-litm
 
 # We use atomic operations in the testcases to validate results.
 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])


contrib/compare_tests

2012-02-11 Thread Mike Stump
Index: compare_tests
===
--- compare_tests   (revision 184129)
+++ compare_tests   (working copy)
@@ -83,11 +83,14 @@ if [ -d $1 -a -d $2 ] ; then
exit $exit_status
fi
cmnsums=`cat $lst5 | wc -l`
+   sum1=/tmp/$tool-sum-1
+   sum2=/tmp/$tool-sum-2
echo # Comparing $cmnsums common sum files
( for fname in `cat $lst5`; do cat $1/$fname; done ) $sum1
( for fname in `cat $lst5`; do cat $2/$fname; done ) $sum2
echo ## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
+   rm -f $sum1 $sum2
ret=$?
if [ $ret -ne 0 ]; then
exit_status=`expr $exit_status + 1`
Index: ChangeLog
===
--- ChangeLog   (revision 184129)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2012-02-11  Mike Stump  mikest...@comcast.net
+
+   * compare_tests (exit_status): Fix.
+
 2012-02-10   Diego Novillo  dnovi...@google.com
 
* repro_fail: Add --debug and --debug-tui flags.



Re: [Ada] Do not pass -Werror during linking

2012-02-11 Thread Eric Botcazou
 Probably for Convention C, we should convert Address to *void.

 So, for

function Alloc (Size : size_t) return System.Address;
pragma Export (C, Alloc,   __gnat_malloc);

 we probably should do this replacement and add the necessary
 type conversions. That would seem to be how this was intended.
 However, I'm not sure how much of an earthquake this would
 be in gigi.

That sounds like a good idea which, even if it doesn't solve the underlying 
issue in its full generality, would probably be sufficient in the m68k case.

I'll give it a try.  Thanks for the tip!

-- 
Eric Botcazou


Re: [PATCH, rtl-optimization]: Fix post-reload compare elimination pre-pass

2012-02-11 Thread Uros Bizjak
On Sat, Feb 11, 2012 at 1:26 AM, Richard Henderson r...@redhat.com wrote:
 On 02/09/2012 03:47 PM, Uros Bizjak wrote:
 2012-02-10  Uros Bizjak  ubiz...@gmail.com

       * compare-elim.c (find_comparisons_in_bb): Eliminate only compares
       having mode compatible with the mode of previous compare.  Substitute
       compare mode of previous compare with the mode, compatible
       with eliminated and previous compare.

 This patch is ok for 4.8.

Unfortunately, we need to update all uses of flag register with a new,
compatible mode, as well, similar to how compatible mode is handled in
CSE2 pass with cse_condition_code_reg in cse.c

The postreload compare elimination pass should be extended to handle
compare elimination for targets that expose FLAGS_REG early through
SELECT_CC_MODE, taking into account the fact that flags reg can live
past BB boundaries.

Uros.


Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Jack Howarth
On Sat, Feb 11, 2012 at 03:14:40PM +0100, Eric Botcazou wrote:
 Hi,
 
 this completes the half-implemented linking scheme of libitm and makes it 
 mimic 
 that of libgomp entirely.  We need the -pthread thing on Solaris 8.
 
 Tested on SPARC/Solaris 8  9 and i586/Linux, OK for the mainline?

This change causes massive failures at -m32/-m64 on x86_64-apple-darwin11
in the libitm testsuite...

FAIL: libitm.c/cancel.c (test for excess errors)
WARNING: libitm.c/cancel.c compilation failed to produce executable
FAIL: libitm.c/clone-1.c (test for excess errors)
WARNING: libitm.c/clone-1.c compilation failed to produce executable
FAIL: libitm.c/dropref-2.c (test for excess errors)
WARNING: libitm.c/dropref-2.c compilation failed to produce executable
FAIL: libitm.c/dropref.c (test for excess errors)
WARNING: libitm.c/dropref.c compilation failed to produce executable
FAIL: libitm.c/memcpy-1.c (test for excess errors)
WARNING: libitm.c/memcpy-1.c compilation failed to produce executable
FAIL: libitm.c/memset-1.c (test for excess errors)
WARNING: libitm.c/memset-1.c compilation failed to produce executable
FAIL: libitm.c/notx.c (test for excess errors)
WARNING: libitm.c/notx.c compilation failed to produce executable
FAIL: libitm.c/reentrant.c (test for excess errors)
WARNING: libitm.c/reentrant.c compilation failed to produce executable
FAIL: libitm.c/simple-1.c (test for excess errors)
WARNING: libitm.c/simple-1.c compilation failed to produce executable
FAIL: libitm.c/simple-2.c (test for excess errors)
WARNING: libitm.c/simple-2.c compilation failed to produce executable
FAIL: libitm.c/stackundo.c (test for excess errors)
WARNING: libitm.c/stackundo.c compilation failed to produce executable
FAIL: libitm.c/txrelease.c (test for excess errors)
WARNING: libitm.c/txrelease.c compilation failed to produce executable
Running 
/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20120211/libitm/testsuite/libitm.c++/c++.exp
 ...
FAIL: libitm.c++/dropref.C (test for excess errors)
WARNING: libitm.c++/dropref.C compilation failed to produce executable
FAIL: libitm.c++/eh-1.C (test for excess errors)
WARNING: libitm.c++/eh-1.C compilation failed to produce executable

# of expected passes1
# of unexpected failures14
# of unsupported tests  1

These appear in the form...

Executing on host: /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/xgcc 
-B/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/ 
/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20120211/libitm/testsuite/libitm.c/cancel.c
  
-B/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.3.0/./libitm/
 
-I/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.3.0/./libitm
 -I/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20120211/libitm/testsuite/.. 
-shared-libgcc -fmessage-length=0 -fgnu-tm  -O2   
-L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.3.0/./libitm/.libs
 -lm   -m64 -o ./cancel.exe(timeout = 300)
Undefined symbols for architecture x86_64:
  __ITM_registerTMCloneTable, referenced from:
  ___doTMRegistrations in crttms.o
  __ITM_abortTransaction, referenced from:
  _cancel1 in ccSkMYPk.o
  transaction clone for cancel1 in ccSkMYPk.o
  _main in ccSkMYPk.o
  __ITM_beginTransaction, referenced from:
  _main in ccSkMYPk.o
  __ITM_WU4, referenced from:
  _main in ccSkMYPk.o
  __ITM_commitTransaction, referenced from:
  _main in ccSkMYPk.o
  __ITM_inTransaction, referenced from:
  _main in ccSkMYPk.o
  __ITM_deregisterTMCloneTable, referenced from:
  ___doTMdeRegistrations in crttme.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
compiler exited with status 1
output is:
Undefined symbols for architecture x86_64:
  __ITM_registerTMCloneTable, referenced from:
  ___doTMRegistrations in crttms.o
  __ITM_abortTransaction, referenced from:
  _cancel1 in ccSkMYPk.o
  transaction clone for cancel1 in ccSkMYPk.o
  _main in ccSkMYPk.o
  __ITM_beginTransaction, referenced from:
  _main in ccSkMYPk.o
  __ITM_WU4, referenced from:
  _main in ccSkMYPk.o
  __ITM_commitTransaction, referenced from:
  _main in ccSkMYPk.o
  __ITM_inTransaction, referenced from:
  _main in ccSkMYPk.o
  __ITM_deregisterTMCloneTable, referenced from:
  ___doTMdeRegistrations in crttme.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

FAIL: libitm.c/cancel.c (test for excess errors)

 
 
 2012-02-11  Eric Botcazou  ebotca...@adacore.com
 
   * gcc.c (LINK_COMMAND_SPEC): Deal with -fgnu-tm.
   (GTM_SELF_SPECS): Define if not already defined.
   (driver_self_specs): Add GTM_SELF_SPECS.
   * config/darwin.h (GTM_SELF_SPECS): Define.
   * config/i386/cygwin.h (GTM_SELF_SPECS): Likewise.
   * config/i386/mingw32.h (GTM_SELF_SPECS): Likewise.
 
 
 2012-02-11  Eric Botcazou  ebotca...@adacore.com
 
   * configure.ac (link_itm): Fix comment

Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Eric Botcazou
 This change causes massive failures at -m32/-m64 on x86_64-apple-darwin11
 in the libitm testsuite...

How did you test it?

-- 
Eric Botcazou


Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Jack Howarth
);
 }
 
+/* Provide dummy functions to satisfy linkage for versions of the Darwin 
tool-chain that
+   that can't handle undefined weak refs at the link stage.  */
+
+extern void *__cxa_allocate_exception (size_t) WEAK;
+extern void __cxa_throw (void *, void *, void *) WEAK;
+extern void *__cxa_begin_catch (void *) WEAK;
+extern void *__cxa_end_catch (void) WEAK;
+extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK;
+
+void *__cxa_allocate_exception (size_t s UNUSED) { return NULL; }
+void __cxa_throw (void * a UNUSED, void * b UNUSED, void * c UNUSED)
+{ return; }
+void *__cxa_begin_catch (void * a UNUSED) { return NULL; }
+void *__cxa_end_catch (void) { return NULL; }
+void __cxa_tm_cleanup (void * a UNUSED, void * b UNUSED,  unsigned int c 
UNUSED)
+{ return; }
+
+extern void *_ZnwX (size_t) WEAK;
+extern void _ZdlPv (void *) WEAK;
+extern void *_ZnaX (size_t) WEAK;
+extern void _ZdaPv (void *) WEAK;
+
+typedef const struct nothrow_t { } *c_nothrow_p;
+
+extern void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK;
+extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK;
+extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK;
+extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK;
+
+void *_ZnwX (size_t s UNUSED) { return NULL; }
+void _ZdlPv (void * a UNUSED) { return; }
+void *_ZnaX (size_t s UNUSED) { return NULL; }
+void _ZdaPv (void * a UNUSED) { return; }
+
+void *_ZnwXRKSt9nothrow_t (size_t s UNUSED, c_nothrow_p b UNUSED)
+  { return NULL; }
+void _ZdlPvRKSt9nothrow_t (void * a UNUSED, c_nothrow_p b UNUSED)  { return; }
+void *_ZnaXRKSt9nothrow_t (size_t s UNUSED, c_nothrow_p b UNUSED)
+ { return NULL; }
+void _ZdaPvRKSt9nothrow_t (void * a UNUSED, c_nothrow_p b UNUSED) { return; }
+
 #endif

built as...

Using built-in specs.
COLLECT_GCC=gcc-fsf-4.7
COLLECT_LTO_WRAPPER=/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin11.3.0/4.7.0/lto-wrapper
Target: x86_64-apple-darwin11.3.0
Configured with: ../gcc-4.7-20120211/configure --prefix=/sw 
--prefix=/sw/lib/gcc4.7 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.7/info 
--with-build-config=bootstrap-lto --enable-stage1-languages=c,lto 
--enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw 
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw 
--with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib 
--program-suffix=-fsf-4.7 --enable-checking=release --enable-cloog-backend=isl
Thread model: posix
gcc version 4.7.0 20120211 (experimental) (GCC) 

then...

cd darwin_objdir/x86_64-apple-darwin11.3.0/libitm
make -k check RUNTESTFLAGS=--target_board=unix'{-m32,-m64}'

which is exactly how I have been testing Patrick Marlier proposed patch.
  Jack


Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Jack Howarth
On Sat, Feb 11, 2012 at 06:54:05PM +0100, Eric Botcazou wrote:
  This change causes massive failures at -m32/-m64 on x86_64-apple-darwin11
  in the libitm testsuite...
 
 How did you test it?
 
 -- 
 Eric Botcazou

Eric,
   FYI, if I restore -litm to the linkage of the failing tests, they compile
and run fine. I don't understand why we think -litm can be dropped from linking
the tests in the libitm testsuite.
Jack


Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Eric Botcazou
 Applied to gcc trunk (r184130) along with the proposed fix for
 Bug libitm/52042...

OK, I missed the hardcoded(!) spec in config/darwin.h for libgomp, so I guess 
we need the same thing for libitm.  Revised patch attached.


* config/darwin.h (LINK_COMMAND_SPEC_A): Deal with -fgnu-tm.
(GTM_SELF_SPECS): Define.


-- 
Eric Botcazou
Index: gcc/gcc.c
===
--- gcc/gcc.c	(revision 183864)
+++ gcc/gcc.c	(working copy)
@@ -675,6 +675,7 @@ proper position among the other output f
 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
 %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
 %(mflib)  STACK_SPLIT_SPEC \
 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
@@ -839,9 +840,14 @@ static const char *const multilib_defaul
 #define GOMP_SELF_SPECS %{fopenmp|ftree-parallelize-loops=*: -pthread}
 #endif
 
+/* Likewise for -fgnu-tm.  */
+#ifndef GTM_SELF_SPECS
+#define GTM_SELF_SPECS %{fgnu-tm: -pthread}
+#endif
+
 static const char *const driver_self_specs[] = {
   %{fdump-final-insns:-fdump-final-insns=.} %fdump-final-insns,
-  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS
+  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS, GTM_SELF_SPECS
 };
 
 #ifndef OPTION_DEFAULT_SPECS
Index: gcc/config/i386/cygwin.h
===
--- gcc/config/i386/cygwin.h	(revision 183864)
+++ gcc/config/i386/cygwin.h	(working copy)
@@ -126,6 +126,8 @@ along with GCC; see the file COPYING3.
and the -pthread flag is not recognized.  */
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS 
+#undef GTM_SELF_SPECS
+#define GTM_SELF_SPECS 
 
 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
 #if DWARF2_UNWIND_INFO
Index: gcc/config/i386/mingw32.h
===
--- gcc/config/i386/mingw32.h	(revision 183864)
+++ gcc/config/i386/mingw32.h	(working copy)
@@ -187,6 +187,8 @@ do {		 \
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS %{fopenmp|ftree-parallelize-loops=*:  \
 			-mthreads -pthread}
+#undef GTM_SELF_SPECS
+#define GTM_SELF_SPECS %{fgnu-tm:-mthreads -pthread}
 
 /* mingw32 atexit function is safe to use in shared libraries.  Use it
to register C++ static destructors.  */
Index: gcc/config/darwin.h
===
--- gcc/config/darwin.h	(revision 183864)
+++ gcc/config/darwin.h	(working copy)
@@ -183,6 +183,8 @@ extern GTY(()) int darwin_ms_struct;
 %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
 %{fopenmp|ftree-parallelize-loops=*: \
   %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
+%{fgnu-tm: \
+  %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
 %{!nostdlib:%{!nodefaultlibs:\
   %(link_ssp) %(link_gcc_c_sequence)\
 }}\
@@ -915,6 +917,8 @@ void add_framework_path (char *);
 
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS 
+#undef GTM_SELF_SPECS
+#define GTM_SELF_SPECS 
 
 /* Darwin disables section anchors by default.  
They should be enabled per arch where support exists in that arch.  */
Index: libitm/configure.ac
===
--- libitm/configure.ac	(revision 183864)
+++ libitm/configure.ac	(working copy)
@@ -268,7 +268,7 @@ else
 fi
 
 # Set up the set of libraries that we need to link against for libitm.
-# Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp,
+# Note that the GTM_SELF_SPECS in gcc.c will force -pthread for -fgnu-tm,
 # which will force linkage against -lpthread (or equivalent for the system).
 # That's not 100% ideal, but about the best we can do easily.
 if test $enable_shared = yes; then
Index: libitm/testsuite/lib/libitm.exp
===
--- libitm/testsuite/lib/libitm.exp	(revision 183864)
+++ libitm/testsuite/lib/libitm.exp	(working copy)
@@ -140,7 +140,6 @@ proc libitm_init { args } {
 	lappend ALWAYS_CFLAGS ldflags=-L${blddir}/.libs
 }
 lappend ALWAYS_CFLAGS additional_flags=-I${srcdir}/..
-lappend ALWAYS_CFLAGS ldflags=-litm
 
 # We use atomic operations in the testcases to validate results.
 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])


Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Eric Botcazou
FYI, if I restore -litm to the linkage of the failing tests, they
 compile and run fine. I don't understand why we think -litm can be dropped
 from linking the tests in the libitm testsuite.

Because -fgnu-tm will automatically add it on the link line, like for -fopenmp.

-- 
Eric Botcazou


Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Iain Sandoe

Hi Eric,

On 11 Feb 2012, at 14:14, Eric Botcazou wrote:


Hi,

this completes the half-implemented linking scheme of libitm and  
makes it mimic

that of libgomp entirely.  We need the -pthread thing on Solaris 8.

Tested on SPARC/Solaris 8  9 and i586/Linux, OK for the mainline?


2012-02-11  Eric Botcazou  ebotca...@adacore.com

* gcc.c (LINK_COMMAND_SPEC): Deal with -fgnu-tm.
(GTM_SELF_SPECS): Define if not already defined.
(driver_self_specs): Add GTM_SELF_SPECS.
* config/darwin.h (GTM_SELF_SPECS): Define.
* config/i386/cygwin.h (GTM_SELF_SPECS): Likewise.
* config/i386/mingw32.h (GTM_SELF_SPECS): Likewise.


2012-02-11  Eric Botcazou  ebotca...@adacore.com

* configure.ac (link_itm): Fix comment.
* configure: Regenerate.
* testsuite/lib/libitm.exp: Do not pass -litm for the link.


--
Eric Botcazou
p.diff


very little time - about to go out..

... but I suspect

LINK_COMMAND_SPEC_A in config/darwin.h ... which will need the:

+%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\

however, that's a very quick look.
Iain




Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Jack Howarth
On Sat, Feb 11, 2012 at 07:11:11PM +0100, Eric Botcazou wrote:
  Applied to gcc trunk (r184130) along with the proposed fix for
  Bug libitm/52042...
 
 OK, I missed the hardcoded(!) spec in config/darwin.h for libgomp, so I guess 
 we need the same thing for libitm.  Revised patch attached.
 
 
 * config/darwin.h (LINK_COMMAND_SPEC_A): Deal with -fgnu-tm.
   (GTM_SELF_SPECS): Define.
 
 
 -- 
 Eric Botcazou

Eric,
   I missed the regeneration of libitm/configure the first time. The p2.diff
with the regenerated libitm/configure passes make check in libitm now on
x86_64-apple-darwin11...

Native configuration is x86_64-apple-darwin11.3.0

=== libitm tests ===


Running target unix/-m32

=== libitm Summary for unix/-m32 ===

# of expected passes26
# of expected failures  3
# of unsupported tests  1

Running target unix/-m64

=== libitm Summary for unix/-m64 ===

# of expected passes26
# of expected failures  3
# of unsupported tests  1

=== libitm Summary ===

# of expected passes52
# of expected failures  6
# of unsupported tests  2

Compiler version: gcc libitm 
Platform: x86_64-apple-darwin11.3.0
configure flags: --prefix=/sw --prefix=/sw/lib/gcc4.7 --mandir=/sw/share/man 
--infodir=/sw/lib/gcc4.7/info --with-build-config=bootstrap-lto 
--enable-stage1-languages=c,lto 
--enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw 
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw 
--with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib 
--program-suffix=-fsf-4.7 --enable-checking=release --enable-cloog-backend=isl

The addition of support for static libitm in the second version of the patch 
while
probably non-essential is a good idea.
  Jack
ps I'll do a full regression test for p2.diff and will post the results to 
gcc-testresults.


 Index: gcc/gcc.c
 ===
 --- gcc/gcc.c (revision 183864)
 +++ gcc/gcc.c (working copy)
 @@ -675,6 +675,7 @@ proper position among the other output f
  %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
  %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
  %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
 +%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
  %(mflib)  STACK_SPLIT_SPEC \
  %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
  %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
 @@ -839,9 +840,14 @@ static const char *const multilib_defaul
  #define GOMP_SELF_SPECS %{fopenmp|ftree-parallelize-loops=*: -pthread}
  #endif
  
 +/* Likewise for -fgnu-tm.  */
 +#ifndef GTM_SELF_SPECS
 +#define GTM_SELF_SPECS %{fgnu-tm: -pthread}
 +#endif
 +
  static const char *const driver_self_specs[] = {
%{fdump-final-insns:-fdump-final-insns=.} %fdump-final-insns,
 -  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS
 +  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS, GTM_SELF_SPECS
  };
  
  #ifndef OPTION_DEFAULT_SPECS
 Index: gcc/config/i386/cygwin.h
 ===
 --- gcc/config/i386/cygwin.h  (revision 183864)
 +++ gcc/config/i386/cygwin.h  (working copy)
 @@ -126,6 +126,8 @@ along with GCC; see the file COPYING3.
 and the -pthread flag is not recognized.  */
  #undef GOMP_SELF_SPECS
  #define GOMP_SELF_SPECS 
 +#undef GTM_SELF_SPECS
 +#define GTM_SELF_SPECS 
  
  /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
  #if DWARF2_UNWIND_INFO
 Index: gcc/config/i386/mingw32.h
 ===
 --- gcc/config/i386/mingw32.h (revision 183864)
 +++ gcc/config/i386/mingw32.h (working copy)
 @@ -187,6 +187,8 @@ do {  
  \
  #undef GOMP_SELF_SPECS
  #define GOMP_SELF_SPECS %{fopenmp|ftree-parallelize-loops=*:  \
   -mthreads -pthread}
 +#undef GTM_SELF_SPECS
 +#define GTM_SELF_SPECS %{fgnu-tm:-mthreads -pthread}
  
  /* mingw32 atexit function is safe to use in shared libraries.  Use it
 to register C++ static destructors.  */
 Index: gcc/config/darwin.h
 ===
 --- gcc/config/darwin.h   (revision 183864)
 +++ gcc/config/darwin.h   (working copy)
 @@ -183,6 +183,8 @@ extern GTY(()) int darwin_ms_struct;
  %{L*} %(link_libgcc) %o 
 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
  %{fopenmp|ftree-parallelize-loops=*: \
%{static|static-libgcc|static-libstdc++|static-libgfortran: 
 libgomp.a%s; : -lgomp } } \
 +%{fgnu-tm: \
 +  %{static|static-libgcc|static-libstdc++|static-libgfortran: 
 libitm.a%s; : -litm } } \
  %{!nostdlib:%{!nodefaultlibs:\
%(link_ssp) %(link_gcc_c_sequence)\
  }}\
 @@ -915,6 +917,8 @@ 

Re: [libitm] Link with -litm and -pthread

2012-02-11 Thread Eric Botcazou
I missed the regeneration of libitm/configure the first time. The
 p2.diff with the regenerated libitm/configure passes make check in libitm
 now on x86_64-apple-darwin11...

Great, thanks for the testing.

-- 
Eric Botcazou


Re: [PATCH] OpenBSD stdint fix

2012-02-11 Thread Mark Kettenis
 Date: Sun, 5 Feb 2012 00:30:53 +0100 (CET)
 From: Gerald Pfeifer ger...@pfeifer.com
 
 Is this patch upstream on the OpenBSD side?  How and where have 
 you tested it?

Not sure what you mean by upstream in this conext.  We curently ship
GCC 4.2.1 as our system compiler, which is different enough from the
current GCC codebase that it doesn't have the OS-stdint.h files.

I tested this diff on OpenBSD/i386 and OpenBSD/amd64, where it fixes a
couple of test cases in the GCC testsuite.

 I see we do not have a maintainer for OpenBSD, and no other port
 seems to do anything like that, but if this really matches what
 you have in place, I can commit it for you.

Indeed.  I'd be willing to take up that role.  I already have an
account on sourceware.org and a copyright assigment for GCC in place.
But in the mean time it would be great if you could commit this fix
for me.

 On Tue, 3 Jan 2012, Mark Kettenis wrote:
  These are long long on all supported platforms instead of the
  default long on 64-bit, long long on 32-bit that defaults.h
  assumes.
  
  
  2012-01-03  Mark Kettenis  kette...@openbsd.org
  
  * config/openbsd-stdint.h (INTMAX_TYPE, UINTMAX_TYPE): New defines.
  
  
  Index: gcc/config/openbsd-stdint.h
  ===
  --- gcc/config/openbsd-stdint.h (revision 182767)
  +++ gcc/config/openbsd-stdint.h (working copy)
  @@ -26,6 +26,9 @@
   #define UINT_FAST16_TYPE   unsigned int
   #define UINT_FAST32_TYPE   unsigned int
   #define UINT_FAST64_TYPE   long long unsigned int
  +
  +#define INTMAX_TYPElong long int
  +#define UINTMAX_TYPE   long long unsigned int

   #define INTPTR_TYPElong int
   #define UINTPTR_TYPE   long unsigned int
  
 


Re: [PATCH] disable __size_t macro on GNU/kFreeBSD

2012-02-11 Thread Robert Millan
El 6 de febrer de 2012 19:31, Mike Stump mikest...@comcast.net ha escrit:
 Looks obvious to me as well.  I'd say let's put it in...

 Is this patch approved, then?

 I've not seen anyone approve it yet.  I'm not a maintainer for that area, so, 
 I cannot.

Who can approve it?  Looking at the maintainers file it's not clear to
me which area does this belong to.

-- 
Robert Millan


New German PO file for 'gcc' (version 4.7-b20120128)

2012-02-11 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the German team of translators.  The file is available at:

http://translationproject.org/latest/gcc/de.po

(This file, 'gcc-4.7-b20120128.de.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.
coordina...@translationproject.org



Re: [PATCH, rtl-optimization]: Fix post-reload compare elimination pre-pass

2012-02-11 Thread Richard Henderson
On 02/11/2012 07:09 AM, Uros Bizjak wrote:
 On Sat, Feb 11, 2012 at 1:26 AM, Richard Henderson r...@redhat.com wrote:
 On 02/09/2012 03:47 PM, Uros Bizjak wrote:
 2012-02-10  Uros Bizjak  ubiz...@gmail.com

   * compare-elim.c (find_comparisons_in_bb): Eliminate only compares
   having mode compatible with the mode of previous compare.  Substitute
   compare mode of previous compare with the mode, compatible
   with eliminated and previous compare.

 This patch is ok for 4.8.
 
 Unfortunately, we need to update all uses of flag register with a new,
 compatible mode, as well, similar to how compatible mode is handled in
 CSE2 pass with cse_condition_code_reg in cse.c

We do?  What subsequent pass really cares?
What goes wrong leaving things as they are?


r~


Re: RFA: Expand/update documentation on Epiphany interrupt attribute

2012-02-11 Thread Gerald Pfeifer
On Tue, 7 Feb 2012, Joern Rennecke wrote:
 Tested by building 'info' for epiphany-elf, and by bootstrapping
 x86_64-unknown-linux-gnu .

Jörn, you are listed as epihphany maintainer, so you don't needs
to RFA patches like this.

That said...

Index: doc/extend.texi
===
+On Epiphany targets one or more optional parameters may added like this:
   ^^^

...something doesn't seem right here.  Perhaps can be added or
can be specified?

+Permissible values for these parameters are: @w{@code{reset}},
+@w{@code{software_exception}}, @w{@code{page_miss}},
+@w{@code{timer0}}, @w{@code{timer1}}, @w{@code{message}},
+@w{@code{dma0}}, @w{@code{dma1}}, @w{@code{wand}} and @w{@code{swi}}.

Would everyone needing to use these know what these different options
refer to?

+Multiple parameters indicate that multiple entries in the interrupt
+vector table should be initialized for this function.  The
+parameter(s) may be omitted entirely, in which case no interrupt
+vector table entry will be provided.

Is provided the right term here?  I would have expected set
or inserted or something like that, but am not familiar with 
this setting, so feel free to ignore this.


The patch per se is fine.

Gerald

Re: [PATCH] disable __size_t macro on GNU/kFreeBSD

2012-02-11 Thread Gerald Pfeifer
Given that both Mike and me considered this patch on the obvious
side, I now committed the following variation thereof on trunk.

(Note the line break and comment change.  5! = 120 did not seem
like a useful version number. ;-)

Gerald

Index: ginclude/stddef.h
===
--- ginclude/stddef.h   (revision 184130)
+++ ginclude/stddef.h   (working copy)
@@ -200,8 +200,9 @@
 #define ___int_size_t_h
 #define _GCC_SIZE_T
 #define _SIZET_
-#if defined (__FreeBSD__)  (__FreeBSD__ = 5)
-/* __size_t is a typedef on FreeBSD 5!, must not trash it. */
+#if (defined (__FreeBSD__)  (__FreeBSD__ = 5)) \
+  || defined(__FreeBSD_kernel__)
+/* __size_t is a typedef on FreeBSD 5, must not trash it. */
 #else
 #define __size_t
 #endif


Re: [wwwdocs] Add missing Steering Committee member

2012-02-11 Thread Gerald Pfeifer
On Sun, 5 Feb 2012, Joseph S. Myers wrote:
 It has been brought to my attention that we have been missing
 a prominent member of the Steering Committee on our web page.
 Should the list distinguish which members are or are not GNU maintainers 
 of GCC?  fencepost:/gd/gnuorg/maintainers lists only the other twelve 
 people as maintainers for GCC.

I wanted to wait to see whether anyone else would chime in, and
nobody did.  From my perspective, I would not complicate things
too much.

Gerald


[wwwdocs] Remove ia64-unknown-linux-gnu as secondary platform

2012-02-11 Thread Gerald Pfeifer
Based by a request by all three release managers the steering
committee aggreed to remove ia64-unknown-linux-gnu as a secondary
platform for GCC 4.7 and I applied the patch below to update our
documentation accordingly.

Gerald

Index: criteria.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/criteria.html,v
retrieving revision 1.1
diff -u -3 -p -r1.1 criteria.html
--- criteria.html   14 Mar 2011 13:52:00 -  1.1
+++ criteria.html   12 Feb 2012 01:33:09 -
@@ -115,7 +115,6 @@ application testing./p
 lii686-apple-darwin/li
 lii686-pc-cygwin/li
 lii686-mingw32/li
-liia64-unknown-linux-gnu/li
 lis390x-linux-gnu/li
 /ul
 


[google/main] update known test failures (issue5654064)

2012-02-11 Thread Ollie Wild
commit cbd38ef0c58ac4a365913d2bb2a2e0c062516dbb
Author: Ollie Wild a...@google.com
Date:   Sat Feb 11 22:05:52 2012 -0600

Update known failures to reflect current reality.

diff --git a/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail 
b/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail
index 2e651ef..1f9c3d6 100644
--- a/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail
+++ b/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail
@@ -16,21 +16,22 @@ FAIL: gcc.dg/thread_annot_lock-42.c  (test for warnings, 
line 9)
 
 # New regression -- only fail with -std=gnu+11 option
 FAIL: g++.dg/warn/Wself-assign-2.C -std=gnu++11  (test for warnings, line 12)
-FAIL: g++.dg/template/sfinae19.C -std=c++11 (test for excess errors)
 
 # New xray failures
-FAIL: gcc.target/i386/patch-functions-1.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
-FAIL: gcc.target/i386/patch-functions-1.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
-FAIL: gcc.target/i386/patch-functions-3.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
-FAIL: gcc.target/i386/patch-functions-3.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
-FAIL: gcc.target/i386/patch-functions-5.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
-FAIL: gcc.target/i386/patch-functions-5.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
-FAIL: gcc.target/i386/patch-functions-6.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
-FAIL: gcc.target/i386/patch-functions-6.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
-
-
-# gc failure
-FAIL: boehm-gc.c/thread_leak_test.c -O2 (test for excess errors)
+UNRESOLVED: gcc.target/i386/patch-functions-1.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-1.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-2.c scan-assembler-not 
ret(.*).byte\t0x90(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-2.c scan-assembler-not 
.byte\t0xeb,0x09(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-3.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-3.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-4.c scan-assembler-not 
ret(.*).byte\t0x90(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-4.c scan-assembler-not 
.byte\t0xeb,0x09(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-5.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-5.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-6.c scan-assembler 
.byte\t0xeb,0x09(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-6.c scan-assembler 
ret(.*).byte\t0x90(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-7.c scan-assembler-not 
ret(.*).byte\t0x90(.*).byte\t0x90
+UNRESOLVED: gcc.target/i386/patch-functions-7.c scan-assembler-not 
.byte\t0xeb,0x09(.*).byte\t0x90
 
 
 # These tests fail in trunk in all configurations.
@@ -63,7 +64,6 @@ UNRESOLVED: libitm.c++/dropref.C compilation failed to 
produce executable
 UNRESOLVED: libitm.c++/eh-1.C compilation failed to produce executable
 FAIL: libitm.c++/eh-1.C (test for excess errors)
 FAIL: libitm.c++/throwdown.C (test for excess errors)
- .merge-right.r183740
 FAIL: libitm.c/cancel.c (test for excess errors)
 UNRESOLVED: libitm.c/cancel.c compilation failed to produce executable
 FAIL: libitm.c/clone-1.c (test for excess errors)
@@ -82,8 +82,14 @@ FAIL: libitm.c++/dropref.C (test for excess errors)
 UNRESOLVED: libitm.c++/dropref.C compilation failed to produce executable
 FAIL: libitm.c++/eh-1.C (test for excess errors)
 UNRESOLVED: libitm.c++/eh-1.C compilation failed to produce executable
-FAIL: libitm.c++/static_ctor.C (test for excess errors)
-UNRESOLVED: libitm.c++/static_ctor.C compilation failed to produce executable
+UNRESOLVED: libitm.c/notx.c compilation failed to produce executable
+FAIL: libitm.c/notx.c (test for excess errors)
+UNRESOLVED: libitm.c/reentrant.c compilation failed to produce executable
+FAIL: libitm.c/reentrant.c (test for excess errors)
+UNRESOLVED: libitm.c/simple-2.c compilation failed to produce executable
+FAIL: libitm.c/simple-2.c (test for excess errors)
+UNRESOLVED: libitm.c/txrelease.c compilation failed to produce executable
+FAIL: libitm.c/txrelease.c (test for excess errors)
 
 # These are flaky when tested in loaded machines (they exceed the timeout)
 flaky | FAIL: libmudflap.cth/pass40-frag.c (-O2) output pattern test

--
This patch is available for review at http://codereview.appspot.com/5654064


libgo patch committed: Disable inappropriate sync/atomic tests

2012-02-11 Thread Ian Lance Taylor
This patch to the sync/atomic package disables a couple of tests on
systems with an inappropriate pointer size.  The 32-bit test was
clobbering 4 bytes on the heap.  The 64-bit test only worked on
little-endian systems.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r d75f0efa5fc2 libgo/go/sync/atomic/atomic_test.go
--- a/libgo/go/sync/atomic/atomic_test.go	Fri Feb 10 23:04:22 2012 -0800
+++ b/libgo/go/sync/atomic/atomic_test.go	Sat Feb 11 21:54:35 2012 -0800
@@ -636,6 +636,7 @@
 		// 64-bit system; clear uintptr tests
 		hammer32[2].f = nil
 		hammer32[5].f = nil
+		hammer32[6].f = nil
 	}
 }
 
@@ -760,6 +761,7 @@
 		// 32-bit system; clear uintptr tests
 		hammer64[2].f = nil
 		hammer64[5].f = nil
+		hammer64[6].f = nil
 	}
 }
 


Go testsuite patch committed: Don't run nilptr on SPARC Solaris

2012-02-11 Thread Ian Lance Taylor
The nilptr.go test fails on 64-bit SPARC Solaris systems, because the
linker puts the array in a place where the test can not work correctly.
I disabled it on all SPARC Solaris systems.  I changed to disabling to
not run the test, rather than to xfail it.  For this test, an XPASS is
not useful information.  Tested on sparc-sun-solaris2.11 and
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2012-02-11  Ian Lance Taylor  i...@google.com

PR go/51874
* go.test/go-test.exp (go-gc-tests): Don't run nilptr test on
SPARC Solaris.  Don't run the test at all on systems where it may
not work, rather than xfailing it.


Index: gcc/testsuite/go.test/go-test.exp
===
--- gcc/testsuite/go.test/go-test.exp	(revision 184035)
+++ gcc/testsuite/go.test/go-test.exp	(working copy)
@@ -302,9 +302,9 @@ proc go-gc-tests { } {
 	}
 
 	# Handle certain tests in a target-dependant way.
-	if [istarget alpha*-*-*] {
+	if { [istarget alpha*-*-*] || [istarget sparc*-*-solaris*] } {
 	if { [string match *go.test/test/nilptr.go $test] } {
-		go-execute-xfail $test
+		untested $test
 		continue
 	}
 	}


libgo patch committed: Define more __sync function

2012-02-11 Thread Ian Lance Taylor
This patch to libgo defines some more __sync functions that may be
missing on some systems.  PR 52084 reports that these are missing on
PowerPC GNU/Linux.

I'll convert these to the new __atomic functions in gcc 4.8 when the
atomic library is available.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu (which
proves little since that systems does not require the new functions).
Committed to mainline.

Ian

diff -r ac108b661568 libgo/configure.ac
--- a/libgo/configure.ac	Sat Feb 11 21:55:33 2012 -0800
+++ b/libgo/configure.ac	Sat Feb 11 22:18:34 2012 -0800
@@ -497,6 +497,20 @@
 [Define to 1 if the compiler provides the __sync_bool_compare_and_swap function for uint32])
 fi
 
+AC_CACHE_CHECK([for __sync_bool_compare_and_swap_8],
+[libgo_cv_func___sync_bool_compare_and_swap_8],
+[AC_LINK_IFELSE([
+typedef unsigned int uint64  __attribute__ ((mode (DI)));
+uint64 i;
+int main() { return __sync_bool_compare_and_swap (i, 0, 1); }
+],
+[libgo_cv_func___sync_bool_compare_and_swap_8=yes],
+[libgo_cv_func___sync_bool_compare_and_swap_8=no])])
+if test $libgo_cv_func___sync_bool_compare_and_swap_8 = yes; then
+  AC_DEFINE(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8, 1,
+[Define to 1 if the compiler provides the __sync_bool_compare_and_swap function for uint64])
+fi
+
 AC_CACHE_CHECK([for __sync_fetch_and_add_4],
 [libgo_cv_func___sync_fetch_and_add_4],
 [AC_LINK_IFELSE([
@@ -511,6 +525,20 @@
 [Define to 1 if the compiler provides the __sync_fetch_and_add function for uint32])
 fi
 
+AC_CACHE_CHECK([for __sync_add_and_fetch_8],
+[libgo_cv_func___sync_add_and_fetch_8],
+[AC_LINK_IFELSE([
+typedef unsigned int uint64  __attribute__ ((mode (DI)));
+uint64 i;
+int main() { return __sync_add_and_fetch (i, 1); }
+],
+[libgo_cv_func___sync_add_and_fetch_8=yes],
+[libgo_cv_func___sync_add_and_fetch_8=no])])
+if test $libgo_cv_func___sync_add_and_fetch_8 = yes; then
+  AC_DEFINE(HAVE_SYNC_ADD_AND_FETCH_8, 1,
+[Define to 1 if the compiler provides the __sync_add_and_fetch function for uint64])
+fi
+
 dnl For x86 we want to use the -minline-all-stringops option to avoid
 dnl forcing a stack split when calling memcpy and friends.
 AC_CACHE_CHECK([whether compiler supports -minline-all-stringops],
diff -r ac108b661568 libgo/runtime/thread.c
--- a/libgo/runtime/thread.c	Sat Feb 11 21:55:33 2012 -0800
+++ b/libgo/runtime/thread.c	Sat Feb 11 22:18:34 2012 -0800
@@ -11,7 +11,7 @@
 /* For targets which don't have the required sync support.  Really
these should be provided by gcc itself.  FIXME.  */
 
-#if !defined (HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4) || !defined (HAVE_SYNC_FETCH_AND_ADD_4)
+#if !defined (HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4) || !defined (HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8) || !defined (HAVE_SYNC_FETCH_AND_ADD_4) || !defined (HAVE_SYNC_ADD_AND_FETCH_8)
 
 static pthread_mutex_t sync_lock = PTHREAD_MUTEX_INITIALIZER;
 
@@ -48,6 +48,37 @@
 
 #endif
 
+#ifndef HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8
+
+_Bool
+__sync_bool_compare_and_swap_8 (uint64*, uint64, uint64)
+  __attribute__ ((visibility (hidden)));
+
+_Bool
+__sync_bool_compare_and_swap_8 (uint64* ptr, uint64 old, uint64 new)
+{
+  int i;
+  _Bool ret;
+
+  i = pthread_mutex_lock (sync_lock);
+  __go_assert (i == 0);
+
+  if (*ptr != old)
+ret = 0;
+  else
+{
+  *ptr = new;
+  ret = 1;
+}
+
+  i = pthread_mutex_unlock (sync_lock);
+  __go_assert (i == 0);
+
+  return ret;
+}
+
+#endif
+
 #ifndef HAVE_SYNC_FETCH_AND_ADD_4
 
 uint32
@@ -74,6 +105,32 @@
 
 #endif
 
+#ifndef HAVE_SYNC_ADD_AND_FETCH_8
+
+uint64
+__sync_add_and_fetch_8 (uint64*, uint64)
+  __attribute__ ((visibility (hidden)));
+
+uint64
+__sync_add_and_fetch_8 (uint64* ptr, uint64 add)
+{
+  int i;
+  uint64 ret;
+
+  i = pthread_mutex_lock (sync_lock);
+  __go_assert (i == 0);
+
+  *ptr += add;
+  ret = *ptr;
+
+  i = pthread_mutex_unlock (sync_lock);
+  __go_assert (i == 0);
+
+  return ret;
+}
+
+#endif
+
 // Called to initialize a new m (including the bootstrap m).
 void
 runtime_minit(void)