Re: [Patch,AVR]: Fix PR52488 (insane stack usage)

2012-03-13 Thread Denis Chertykov
2012/3/12 Georg-Johann Lay a...@gjlay.de

 ...and now to the right mailing list...

 This patch cuts down insane stack offsets for 8-bit SP targets to a value
 the
 involved insns can handle.

 Background is that newlib generates such insane offsets (2050 bytes of
 stack
 for a device with 128 bytes of RAM) because of extension PR51345, i.e. new
 multilib variants for 8-bit SP targets.

 The CFA notes still contain the original size as requested by the source
 so
 that -Wstack-usage= will still work as intended.

 The generated code will never be functional, of course, but there should
 never
 be an ICE.

 This patch is less aggressive than the patch proposed in the PR, i.e. it
 is
 silent and does not issue an error so that newlib can still be built. If
 the
 user wants additional sanity checking, he has to use -Wstack-usage= or
 similar
 options.

 Passed testsuite.

 Ok for trunk?

 Johann

        PR target/52488
        * config/avr/avr.c (avr_prologue_setup_frame): Cut down stack
        offset (size) to a value the insns can deal with.
        (expand_epilogue): Ditto.


Approved.

Denis.


Re: PATCH: Properly generate X32 IE sequence

2012-03-13 Thread Uros Bizjak
On Tue, Mar 13, 2012 at 2:20 AM, H.J. Lu hjl.to...@gmail.com wrote:

 Here is the patch which is equivalent to clearing MASK_TLS_DIRECT_SEG_REFS
 when Pmode != word_mode.  We need to keep

          else if (Pmode == SImode)
            {
              /* Always generate
                        movl %fs:0, %reg32
                        addl xgottpoff(%rip), %reg32
                 to support linker IE-LE optimization and avoid
                 fs:(%reg32) as memory operand.  */
              dest = gen_reg_rtx (Pmode);
              emit_insn (gen_tls_initial_exec_x32 (dest, x));
              return dest;
            }

 to support linker IE-LE optimization.  TARGET_TLS_DIRECT_SEG_REFS only 
 affects
 TLS LE access and fs:(%reg) is only generated by combine.

 So the main impact of disabling TARGET_TLS_DIRECT_SEG_REFS is to disable
 fs:immediate memory operand for TLS LE access, which doesn't have any 
 problems
 to begin with.

 I would prefer to keep TARGET_TLS_DIRECT_SEG_REFS and disable only
 fs:(%reg), which is generated by combine.

 Please try attached patch.  It introduces TARGET_TLS_INDIRECT_SEG_REFS
 to block only indirect seg references.

 There is no regression.

Thanks, committed to mainline SVN with following ChangeLog:

2012-03-13  Uros Bizjak  ubiz...@gmail.com

* config/i386/i386.h (TARGET_TLS_INDIRECT_SEG_REFS): New.
* config/i386/i386.c (ix86_decompose_address): Use
TARGET_TLS_INDIRECT_SEG_REFS to prevent %fs:(%reg) addresses.
(legitimize_tls_address): Use TARGET_TLS_INDIRECT_SEG_REFS to load
thread pointer to a register.

Tested on x86_64-pc-linux-gnu {,-m32}.

 BTW, this x32 TLS IE optimization:

 movq%rax, %fs:(%rdx)

This is just looking for troubles. If we said these addresses are
invalid, then we shouldn't generate them.

Uros.


Re: [build] Remove extra_passes

2012-03-13 Thread Richard Guenther
On Mon, Mar 12, 2012 at 5:11 PM, Rainer Orth
r...@cebitec.uni-bielefeld.de wrote:
 As suggested, this patch removes the now unused extra_passes mechanism.

 Bootstrapped with no regressions on i386-pc-solaris2.11, ok for
 mainline?

Ok.

Thanks,
Richard.

        Rainer


 2012-03-09  Rainer Orth  r...@cebitec.uni-bielefeld.de

        * config.gcc (extra_passes): Remove.
        * configure.ac (extra_passes): Don't substitute.
        * configure: Regenerate.
        * Makefile.in (EXTRA_PASSES): Remove.
        (GCC_PASSES): Remove $(EXTRA_PASSES).
        (MOSTLYCLEANFILES): Likewise.
        (native): Likewise.
        (install-common): Likewise.




 --
 -
 Rainer Orth, Center for Biotechnology, Bielefeld University



Re: [google] Add -gfission support to GCC (issue5754090)

2012-03-13 Thread Eric Botcazou
 For google/gcc-4_6 branch. (To be submitted for trunk soon.)

The option name sounds like the brainchild of the marketing department. :-)
Can we avoid going nuclear in the compiler and use something more mundane?

-- 
Eric Botcazou


RE: PING: [PATCH, ARM, iWMMXt][1/5]: ARM code generic change

2012-03-13 Thread Xinyu Qi
PING

At 2012-02-03 10:02:28,Xinyu Qi x...@marvell.com wrote:
 PING
 
 http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01787.html
 
 At 2011-12-29 14:20:20,Xinyu Qi x...@marvell.com wrote:
   At 2011-12-15 00:47:48,Richard Earnshaw rearn...@arm.com wrote:
On 14/07/11 08:35, Xinyu Qi wrote:
 Hi,

 It is the first part of iWMMXt maintenance.

 *config/arm/arm.c (arm_option_override):
   Enable iWMMXt with VFP. iWMMXt and NEON are incompatible.
 iWMMXt unsupported under Thumb-2 mode.
   (arm_expand_binop_builtin): Accept immediate op (with mode
 VOID)
 *config/arm/arm.md:
   Resettle include location of iwmmxt.md so that *arm_movdi
 and *arm_movsi_insn could be used when iWMMXt is enabled.

 With the current work in trunk to handle enabled attributes and
 per-alternative predicable attributes (Thanks Bernd) we should be
 able to get rid of *cond_iwmmxt_movsi_insn  in iwmmxt.md file.
 It's not a matter for this patch but for a follow-up patch.

 Actually we should probably do the same for the various insns
 that are dotted around all over the place with final conditions
 that prevent matching - atleast makes the backend description
 slightly smaller :).

   Add pipeline description file include.

 It is enough to say

  (filename): Include.

 in the changelog entry.

 The include for the pipeline description file should be with the
 patch that you add this in i.e. patch #5. Please add this to
 MD_INCLUDES in t-arm as well.

 Also as a general note, please provide a correct Changelog entry.

 This is not the format that we expect Changelog entries to be in.
 Please look at the coding standards on the website for this or at
 other patches submitted with respect to Changelog entries. Please
 fix this for each patch in the patch stack.


 cheers
 Ramana

 Thanks for reviewing. I have updated the patches and the Changelog.

 *config/arm/arm.c (arm_option_override): Enable iWMMXt with VFP.
  (arm_expand_binop_builtin): Accept VOIDmode op.
 *config/arm/arm.md (*arm_movdi, *arm_movsi_insn): Remove
condition !TARGET_IWMMXT.
  (iwmmxt.md): Include location.

 Thanks,
 Xinyu=

   
+ VFP and iWMMXt however can coexist.  */  if
 (TARGET_IWMMXT
   
+ TARGET_HARD_FLOAT  !TARGET_VFP)
+sorry (iWMMXt and non-VFP floating point unit);
+
+  /* iWMMXt and NEON are incompatible.  */  if (TARGET_IWMMXT
  
+ TARGET_NEON)
+sorry (iWMMXt and NEON);
   
-  /* ??? iWMMXt insn patterns need auditing for Thumb-2.  */
+  /* iWMMXt unsupported under Thumb-2 mode.  */
   if (TARGET_THUMB2  TARGET_IWMMXT)
 sorry (Thumb-2 iWMMXt);
   
Don't use sorry() when a feature is not supported by the hardware;
sorry() is used when GCC is currently unable to support something
that it should.  Use error() in these cases.
   
Secondly, iWMMXt is incompatible with the entire Thumb ISA, not just
the
Thumb-2 extensions to the Thumb ISA.
  
   Done.
  
   
   
+;; Load the Intel Wireless Multimedia Extension patterns (include
+iwmmxt.md)
+
   
   
No, the extension patterns need to come at the end of the main
machine description.  The list at the top of the MD file is purely
for pipeline descriptions.  Why do you think this is needed?
  
   This modification is needless right now since *iwmmxt_movsi_insn and
   *iwmmxt_arm_movdi have been corrected in the fourth part of the patch.
   Revert it.
   The new modified patch is attached.
  
 * config/arm/arm.c (arm_option_override): Enable use of iWMMXt with
   VFP.
 Disable use of iWMMXt with NEON. Disable use of iWMMXt under Thumb
   mode.
 (arm_expand_binop_builtin): Accept VOIDmode op.
  
   Thanks,
   Xinyu
  
   
Other bits are ok.
   
R.
 
  New changlog
 
  * config/arm/arm.c (FL_IWMMXT2): New define.
  (arm_arch_iwmmxt2): New variable.
  (arm_option_override): Enable use of iWMMXt with VFP.
  Disable use of iWMMXt with NEON. Disable use of iWMMXt under Thumb
  mode.
  Set arm_arch_iwmmxt2.
  (arm_expand_binop_builtin): Accept VOIDmode op.
  * config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Define
  __IWMMXT2__.
  (TARGET_IWMMXT2): New define.
  (TARGET_REALLY_IWMMXT2): Likewise.
  (arm_arch_iwmmxt2): Declare.
  * config/arm/arm-cores.def (iwmmxt2): Add FL_IWMMXT2.
  * config/arm/arm-arches.def (iwmmxt2): Likewise.
  * config/arm/arm.md (arch): Add iwmmxt2.
  (arch_enabled): Handle iwmmxt2.
 
  Thanks,
  Xinyu


RE: PING: [PATCH, ARM, iWMMXt][2/5]: intrinsic head file change

2012-03-13 Thread Xinyu Qi
PING

At 2012-02-03 10:05:22,Xinyu Qi x...@marvell.com wrote:
 PING
 
 http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01788.html
 
 At 2011-12-29 14:22:50,Xinyu Qi x...@marvell.com wrote:
  * config/arm/mmintrin.h: Use __IWMMXT__ to enable iWMMXt
  intrinsics.
  Use __IWMMXT2__ to enable iWMMXt2 intrinsics.
  Use C name-mangling for intrinsics.
  (__v8qi): Redefine.
  (_mm_cvtsi32_si64, _mm_andnot_si64, _mm_sad_pu8): Revise.
  (_mm_sad_pu16, _mm_align_si64, _mm_setwcx, _mm_getwcx):
  Likewise.
  (_m_from_int): Likewise.
  (_mm_sada_pu8, _mm_sada_pu16): New intrinsic.
  (_mm_alignr0_si64, _mm_alignr1_si64, _mm_alignr2_si64): Likewise.
  (_mm_alignr3_si64, _mm_tandcb, _mm_tandch, _mm_tandcw): Likewise.
  (_mm_textrcb, _mm_textrch, _mm_textrcw, _mm_torcb): Likewise.
  (_mm_torch, _mm_torcw, _mm_tbcst_pi8, _mm_tbcst_pi16): Likewise.
  (_mm_tbcst_pi32): Likewise.
  (_mm_abs_pi8, _mm_abs_pi16, _mm_abs_pi32): New iWMMXt2
  intrinsic.
  (_mm_addsubhx_pi16, _mm_absdiff_pu8, _mm_absdiff_pu16): Likewise.
  (_mm_absdiff_pu32, _mm_addc_pu16, _mm_addc_pu32): Likewise.
  (_mm_avg4_pu8, _mm_avg4r_pu8, _mm_maddx_pi16,
  _mm_maddx_pu16): Likewise.
  (_mm_msub_pi16, _mm_msub_pu16, _mm_mulhi_pi32): Likewise.
  (_mm_mulhi_pu32, _mm_mulhir_pi16, _mm_mulhir_pi32): Likewise.
  (_mm_mulhir_pu16, _mm_mulhir_pu32, _mm_mullo_pi32): Likewise.
  (_mm_qmulm_pi16, _mm_qmulm_pi32, _mm_qmulmr_pi16): Likewise.
  (_mm_qmulmr_pi32, _mm_subaddhx_pi16, _mm_addbhusl_pu8):
  Likewise.
  (_mm_addbhusm_pu8, _mm_qmiabb_pi32, _mm_qmiabbn_pi32):
  Likewise.
  (_mm_qmiabt_pi32, _mm_qmiabtn_pi32, _mm_qmiatb_pi32): Likewise.
  (_mm_qmiatbn_pi32, _mm_qmiatt_pi32, _mm_qmiattn_pi32): Likewise.
  (_mm_wmiabb_si64, _mm_wmiabbn_si64, _mm_wmiabt_si64): Likewise.
  (_mm_wmiabtn_si64, _mm_wmiatb_si64, _mm_wmiatbn_si64):
  Likewise.
  (_mm_wmiatt_si64, _mm_wmiattn_si64, _mm_wmiawbb_si64):
  Likewise.
  (_mm_wmiawbbn_si64, _mm_wmiawbt_si64, _mm_wmiawbtn_si64):
  Likewise.
  (_mm_wmiawtb_si64, _mm_wmiawtbn_si64, _mm_wmiawtt_si64):
  Likewise.
  (_mm_wmiawttn_si64, _mm_merge_si64): Likewise.
  (_mm_torvscb, _mm_torvsch, _mm_torvscw): Likewise.
  (_m_to_int): New define.
 
  Thanks,
  Xinyu


RE: PING: [PATCH, ARM, iWMMXt][3/5]: built in define and expand

2012-03-13 Thread Xinyu Qi
PING

At 2012-02-03 10:07:56,Xinyu Qi x...@marvell.com wrote:
 PING
 
 http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01789.html
 
 At 2011-12-29 14:25:23,Xinyu Qi x...@marvell.com wrote:
   At 2011-11-24 09:27:04,Xinyu Qi x...@marvell.com wrote:
At 2011-11-19 07:08:22,Ramana Radhakrishnan
ramana.radhakrish...@linaro.org wrote:
 On 20 October 2011 08:39, Xinyu Qi x...@marvell.com wrote:
  Ping
 
  http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01103.html
 
         * config/arm/arm.c (enum arm_builtins): Revise built-in
 fcode.
         (builtin_description bdesc_2arg): Revise built in 
  declaration.
         (builtin_description bdesc_1arg): Likewise.
         (arm_init_iwmmxt_builtins): Revise built in initialization.
         (arm_expand_builtin): Revise built in expansion.
 

 This currently doesn't apply - can you take a look ?
   
Hi Ramana,
   
I resolve the patch conflict with the newest trunk gcc. The resolved
diff is attached.
   
Thanks,
Xinyu
  
   Update the built in expand. Remove some redundant code.
   New diff is attached.
  
   Thanks,
   Xinyu
 
  * config/arm/arm.c (enum arm_builtins): Revise built-in fcode.
  (IWMMXT2_BUILTIN): New define.
  (IWMMXT2_BUILTIN2): Likewise.
  (iwmmx2_mbuiltin): Likewise.
  (builtin_description bdesc_2arg): Revise built in declaration.
  (builtin_description bdesc_1arg): Likewise.
  (arm_init_iwmmxt_builtins): Revise built in initialization.
  (arm_expand_builtin): Revise built in expansion.
 
  Thanks,
  Xinyu


RE: PING: [PATCH, ARM, iWMMXt][4/5]: WMMX machine description

2012-03-13 Thread Xinyu Qi
PING

At 2012-02-03 10:09:55,Xinyu Qi x...@marvell.com wrote:
 PING
 
 http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01786.html
 
 At 2011-12-29 14:12:44,Xinyu Qi x...@marvell.com wrote:
  At 2011-12-22 17:53:45,Richard Earnshaw rearn...@arm.com wrote:
   On 22/12/11 06:38, Xinyu Qi wrote:
At 2011-12-15 01:32:13,Richard Earnshaw rearn...@arm.com
 wrote:
On 24/11/11 01:33, Xinyu Qi wrote:
Hi Ramana,
   
I solve the conflict, please try again. The new diff is attached.
   
Thanks,
Xinyu
   
At 2011-11-19 07:36:15,Ramana Radhakrishnan
ramana.radhakrish...@linaro.org wrote:
   
Hi Xinyu,
   
This doesn't apply cleanly currently on trunk and the reject
appears to come from iwmmxt.md and I've not yet investigated why.
   
Can you have a look ?
   
   
This patch is NOT ok.
   
You're adding features that were new in iWMMXt2 (ie not in the
original
implementation) but you've provided no means by which the compiler
can detect which operations are only available on the new cores.
   
Hi Richard,
   
All of the WMMX chips support WMMX2 instructions.
  
   This may be true for Marvell's current range of processors, but I find
   it hard to reconcile with the assembler support in GAS, which clearly
   distinguishes between iWMMXT and iWMMXT2 instruction sets.  Are you
   telling me that no cores were ever manufactured (even by Intel) that
   only supported iWMMXT?
  
   I'm concerned that this patch will break support for existing users
   who have older chips (for GCC we have to go through a deprecation
   cycle if we want to drop support for something we now believe is
   no-longer worth maintaining).
  
What I do is to complement the WMMX2 intrinsic support in GCC.
  
   I understand that, and I'm not saying the patch can never go in; just
   that it needs to separate out the support for the different
   architecture variants.
  
I don't think it is necessary for users to consider whether one WMMX
insn is a
   WMMX2 insn or not.
  
   Users don't (unless they want their code to run on legacy processors
   that only support the original instruction set), but the compiler
   surely must know what it is targeting.  Remember that the instruction
   patterns are not entirely black boxes, the compiler can do
   optimizations on intrinsics (it's one of the reasons why they are
   better than inline assembly).  Unless the compiler knows exactly what
   instructions are legal, it could end up optimizing something that
   started as a WMMX insn into something that's a WMMX2 insn (for
   example, propagating a constant into a vector shift expression).
  
   R.
 
  Hi, Richard,
 
  You are right. There exist the chips that only support WMMX instructions in
 the
  history.
  I distinguish the iWMMXt and iWMMXt2 in the patch update this time.
 
  In current GCC, -march=iwmmxt and -march=iwmmxt2 (or -mcpu=iwmmxt
 and
  -mcpu=iwmmxt2) are almost no difference in the compiling stage.
  I take advantage of them to do the work, that is, make -march=iwmmxt (or
  -mcpu=iwmmxt) only support iWMMXt intrinsic iWMMXt built in and WMMX
  instructions, and make -march=iwmmxt2 (or -mcpu=iwmmxt2) support fully
  iWMMXt2.
 
  Define a new flag FL_IWMMXT2 to represent the chip support iWMMXt2
  extension, which directly controls the iWMMXt2 built in initialization and 
  the
  followed defines.
  Define __IWMMXT2__ in TARGET_CPU_CPP_BUILTINS to control the access
 of
  iWMMXt2 intrinsics.
  Define TARGET_REALLY_IWMMXT2 to control the access of WMMX2
  instructions' machine description.
  In arm.md, define iwmmxt2 in arch attr to control the access of the
  alternative in shift patterns.
 
  The updated patch 4/5 is attached here. 1/5, 2/5 and 3/5 are updated
  accordingly. Attach them in related mails.
  Please take a look if such modification is proper.
 
  Changelog:
 
  * config/arm/arm.c (arm_output_iwmmxt_shift_immediate): New
  function.
  (arm_output_iwmmxt_tinsr): Likewise.
  * config/arm/arm-protos.h (arm_output_iwmmxt_shift_immediate):
  Declare.
  (arm_output_iwmmxt_tinsr): Likewise.
  * config/arm/iwmmxt.md (WCGR0, WCGR1, WCGR2, WCGR3): New
  constant.
  (iwmmxt_psadbw, iwmmxt_walign, iwmmxt_tmrc, iwmmxt_tmcr):
  Delete.
  (rorv4hi3, rorv2si3, rordi3): Likewise.
  (rorv4hi3_di, rorv2si3_di, rordi3_di): Likewise.
  (ashrv4hi3_di, ashrv2si3_di, ashrdi3_di): Likewise.
  (lshrv4hi3_di, lshrv2si3_di, lshrdi3_di): Likewise.
  (ashlv4hi3_di, ashlv2si3_di, ashldi3_di): Likewise.
  (iwmmxt_tbcstqi, iwmmxt_tbcsthi, iwmmxt_tbcstsi): Likewise
  (*iwmmxt_clrv8qi, *iwmmxt_clrv4hi, *iwmmxt_clrv2si): Likewise.
  (tbcstv8qi, tbcstv4hi, tbsctv2si): New pattern.
  (iwmmxt_clrv8qi, iwmmxt_clrv4hi, iwmmxt_clrv2si): Likewise.
  (*andmode3_iwmmxt, *iormode3_iwmmxt, *xormode3_iwmmxt):
  Likewise.
  (rormode3, rormode3_di): Likewise.
  (ashrmode3_di, lshrmode3_di, ashlmode3_di): Likewise.
  

Re: Remove obsolete Tru64 UNIX V5.1B support

2012-03-13 Thread Tristan Gingold
Rainer,

this chunk:

--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -252,27 +254,27 @@ __gnat_ttyname (int filedes)
 #endif
 ^L
 #if defined (linux) || defined (sun) || defined (sgi) \
-  || (defined (__osf__)  ! defined (__alpha_vxworks)) || defined (WINNT) \
+  || ! defined (__alpha_vxworks) || defined (WINNT) \
   || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
   || (defined (__svr4__)  defined (i386)) || defined (__Lynx__) \
   || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
   || defined (__GLIBC__) || defined (__APPLE__)

is not correct, '! defined (__alpha_vxworks)' should have been removed too.

I will commit this fix (as obvious):

ada/
2012-03-13  Tristan Gingold  ging...@adacore.com

* sysdep.c: Adjust condition after removal of __osf__.
Indent nested directives.

diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 0669c2f..37cb8d7 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -254,27 +254,27 @@ __gnat_ttyname (int filedes)
 #endif
 

 #if defined (linux) || defined (sun) || defined (sgi) \
-  || ! defined (__alpha_vxworks) || defined (WINNT) \
+  || defined (WINNT) \
   || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
   || (defined (__svr4__)  defined (i386)) || defined (__Lynx__) \
   || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
   || defined (__GLIBC__) || defined (__APPLE__)
 
-#ifdef __MINGW32__
-#if OLD_MINGW
-#include termios.h
-#else
-#include conio.h  /* for getch(), kbhit() */
-#endif
-#else
-#include termios.h
-#endif
+# ifdef __MINGW32__
+#  if OLD_MINGW
+#   include termios.h
+#  else
+#   include conio.h  /* for getch(), kbhit() */
+#  endif
+# else
+#  include termios.h
+# endif
 
 #else
-#if defined (VMS)
+# if defined (VMS)
 extern char *decc$ga_stdscr;
 static int initted = 0;
-#endif
+# endif
 #endif
 
 /* Implements the common processing for getc_immediate and



[PATCH] Fix gthr changes

2012-03-13 Thread Richard Guenther

This fixes the duplicate __GTHREAD_MUTEX_INIT_FUNCTION / 
__gthread_mutex_init_function present after my recent gthr change.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-03-13  Richard Guenther  rguent...@suse.de

* gthr-posix.h: Remove duplicate __GTHREAD_MUTEX_INIT_FUNCTION
and __gthread_mutex_init_function definitions.

Index: libgcc/gthr-posix.h
===
--- libgcc/gthr-posix.h (revision 185232)
+++ libgcc/gthr-posix.h (working copy)
@@ -77,7 +77,6 @@ typedef struct timespec __gthread_time_t
 
 #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
 # undef __GTHREAD_MUTEX_INIT
-# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
 #endif
 #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
 # undef __GTHREAD_RECURSIVE_MUTEX_INIT
@@ -745,22 +744,12 @@ __gthread_setspecific (__gthread_key_t _
   return __gthrw_(pthread_setspecific) (__key, __ptr);
 }
 
-#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
 static inline void
 __gthread_mutex_init_function (__gthread_mutex_t *__mutex)
 {
   if (__gthread_active_p ())
 __gthrw_(pthread_mutex_init) (__mutex, NULL);
 }
-#endif
-
-static inline int
-__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
-{
-  if (__gthread_active_p ())
-return __gthrw_(pthread_mutex_init) (__mutex, NULL);
-  return 0;
-}
 
 static inline int
 __gthread_mutex_destroy (__gthread_mutex_t *__mutex)


Re: libgcc gcov_fork failure on AIX

2012-03-13 Thread Richard Guenther
On Mon, 12 Mar 2012, David Edelsohn wrote:

 Richi,
 
 Your patch for PR gcov/49484 now causes a bootstrap failure on AIX:
 
 /farm/dje/src/src/libgcc/libgcov.c: In function '__gcov_fork':
 /farm/dje/src/src/libgcc/libgcov.c:1008:5: error: 'mx' undeclared
 (first use in this function)
 /farm/dje/src/src/libgcc/libgcov.c:1008:5: note: each undeclared
 identifier is reported only once for each function it appears in
 make: *** [_gcov_fork.o] Error 1
 
 # 1000 /farm/dje/src/src/libgcc/libgcov.c
 pid_t
 __gcov_fork (void)
 {
   pid_t pid;
   extern __gthread_mutex_t __gcov_flush_mx;
   __gcov_flush ();
   pid = fork ();
   if (pid == 0)
 (mx) (__gcov_flush_mx);
   return pid;
 }

Fixed with the following, applied as obvious.

Richard.

2012-03-13  Richard Guenther  rguent...@suse.de

* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Fix definition.

Index: libgcc/gthr-single.h
===
--- libgcc/gthr-single.h(revision 185319)
+++ libgcc/gthr-single.h(working copy)
@@ -36,7 +36,7 @@ typedef int __gthread_recursive_mutex_t;
 
 #define __GTHREAD_ONCE_INIT 0
 #define __GTHREAD_MUTEX_INIT 0
-#define __GTHREAD_MUTEX_INIT_FUNCTION (mx)
+#define __GTHREAD_MUTEX_INIT_FUNCTION(mx)
 #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
 
 #define UNUSED __attribute__((unused))


Re: [PATCH] Fix PR49484, gthr requirements update (target maintainers have a looksee)

2012-03-13 Thread Richard Guenther
On Mon, Mar 12, 2012 at 6:44 PM, Gerald Pfeifer ger...@pfeifer.com wrote:
 On Mon, 12 Mar 2012, Richard Guenther wrote:
 2012-01-18  Richard Guenther  rguent...@suse.de

        * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
        * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
        (__gthread_mutex_init_function): New function.
        * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

        PR gcov/49484
        * libgcov.c: Include gthr.h.
        (__gcov_flush_mx): New global variable.
        (init_mx, init_mx_once): New functions.
        (__gcov_flush): Protect self with a mutex.
        (__gcov_fork): Re-initialize mutex after forking.
        * unwind-dw2-fde.c: Change condition under which to use
        __GTHREAD_MUTEX_INIT_FUNCTION.

 Richi, I'm afraid this caused the following on i386-unknown-freebsd10?

 /scratch2/tmp/gerald/gcc-HEAD/libgcc/libgcov.c:710:54: error: 'NULL' 
 undeclared here (not in a function)
 gmake[3]: *** [_gcov.o] Error 1
 gmake[3]: *** Waiting for unfinished jobs
 gmake[3]: Leaving directory 
 `/scratch2/tmp/gerald/OBJ-0312-1454/i386-unknown-freebsd10.0/libgcc'
 gmake[2]: *** [all-stage1-target-libgcc] Error 2

This is

#ifdef __GTHREAD_MUTEX_INIT
ATTRIBUTE_HIDDEN __gthread_mutex_t __gcov_flush_mx = __GTHREAD_MUTEX_INIT;

thus if __GTHREAD_MUTEX_INIT uses NULL and gthr.h does not include
everything to make that initializer valid it is a freebsd header bug, unless
it is

#if defined(inhibit_libc)
#define IN_LIBGCOV (-1)
#else
#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
#include stdio.h

wtf?  This is a target library, why is stdio.h not properly included
by tsystem.h?
It is.  Anyone remembers?

Can you verify that theory, thus remove that #undef and the #include?

Richard.

 Gerald


[PATCH] Fix PR52569

2012-03-13 Thread Richard Guenther

Some targets avoid using gthr.h for some weird reason when compiling
included unwind-dw2-fde.c.  But they do so violating gthrs expectations
as they neither define __GTHREAD_MUTEX_INIT nor 
__GTHREAD_MUTEX_INIT_FUNCTION.

The following patch restores the carefully crafted workaround for
that to make the carefully crafted hacks work again.  It also adds
a comment that hints at this.

I wonder why those targets do not simply include gthr-single.h
in their unwind-dw2 glue!?  What a mess!

Compiled libgcc for x86_64-darwin10, bootstrapped on 
x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-03-13  Richard Guenther  rguent...@suse.de

PR target/52569
* unwind-dw2-fde.c: Make avoid-include-gthr.h hacks work again.

Index: libgcc/unwind-dw2-fde.c
===
--- libgcc/unwind-dw2-fde.c (revision 185319)
+++ libgcc/unwind-dw2-fde.c (working copy)
@@ -49,6 +49,7 @@ static struct object *seen_objects;
 static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT;
 #define init_object_mutex_once()
 #else
+#ifdef __GTHREAD_MUTEX_INIT_FUNCTION
 static __gthread_mutex_t object_mutex;
 
 static void
@@ -63,6 +64,12 @@ init_object_mutex_once (void)
   static __gthread_once_t once = __GTHREAD_ONCE_INIT;
   __gthread_once (once, init_object_mutex);
 }
+#else
+/* ???  Several targets include this file with stubbing parts of gthr.h
+   and expect no locking to be done.  */
+#define init_object_mutex_once()
+static __gthread_mutex_t object_mutex;
+#endif
 #endif
 
 /* Called from crtbegin.o to register the unwind info for an object.  */


Re: [PATCH] Don't insert white space in 'orig_option_with_args_text' for OPT_l

2012-03-13 Thread Ludovic Courtès
Hi,

(Cc: Paul Brook.)

Joseph S. Myers jos...@codesourcery.com skribis:

 On Mon, 12 Mar 2012, Ludovic Courtès wrote:

 The patch below solves the problem in a gfortran-specific way.  WDYT?

 I think that's the right approach for this issue.

The previous patch was produced with ‘diff -b’.  Here’s a fixed one.
Let me know if anything else needs to be done.

Thanks,
Ludo’.

2012-03-09  Ludovic Courtès  ludovic.cour...@inria.fr

* gcc/fortran/gfotranspec.c (lang_specific_driver): When
VERBOSE, make sure `-l' options are printed with no intertwined
white spaces.

diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c
index 2240bfb..55e5e42 100644
--- a/gcc/fortran/gfortranspec.c
+++ b/gcc/fortran/gfortranspec.c
@@ -461,8 +461,15 @@ For more information about these matters, see the file named COPYING\n\n));
 {
   fprintf (stderr, _(Driving:));
   for (i = 0; i  g77_newargc; i++)
-	fprintf (stderr,  %s,
-		 g77_new_decoded_options[i].orig_option_with_args_text);
+	{
+	  if (g77_new_decoded_options[i].opt_index == OPT_l)
+	/* Make sure no white space is inserted after `-l'.  */
+	fprintf (stderr,  -l%s,
+		 g77_new_decoded_options[i].canonical_option[1]);
+	  else
+	fprintf (stderr,  %s,
+		 g77_new_decoded_options[i].orig_option_with_args_text);
+	}
   fprintf (stderr, \n);
 }


Re: [RFA/ARM]: Correct Neon testsuite generation

2012-03-13 Thread Richard Earnshaw
On 12/03/12 17:19, Matthew Gretton-Dann wrote:
 All,
 
 The commit to fix PR51534 did not update the testsuite (as no changes were
 expected there).
 
 Unfortunately, this means that I didn't notice that the Neon testsuite 
 generator
 is broken.  The attached patch fixes the generator.
 
 Checked by re-running the Neon testsuite and arm_neon.h generators and 
 ensuring no
 changes in the generated testsuite/header.
 
 OK for trunk?
 
 OK for backporting to GCC 4.7?
 

This is OK for trunk

It's OK for 4.7 if the RM's agree.

R.

 Thanks,
 
 Matt
 
 gcc/ChangeLog:
 
 2012-03-12  Matthew Gretton-Dann  matthew.gretton-d...@arm.com
 
   * config/arm/neon.ml (ops): Fixup expected instructions for
   unsigned vector compares.
 
 
 1-RFA-GCC32A-569-Correct-Neon-testsuite-generation.txt
 
 
 diff --git a/gcc/config/arm/neon.ml b/gcc/config/arm/neon.ml
 index 363e55c..85eb5ec 100644
 --- a/gcc/config/arm/neon.ml
 +++ b/gcc/config/arm/neon.ml
 @@ -780,14 +780,19 @@ let ops =
  
  (* Comparison, greater-than or equal.  *)
  Vcge, [], All (3, Dreg), vcge, cmp_sign_matters, F32 :: s_8_32;
 -Vcge, [Builtin_name vcgeu], All (3, Dreg), vcge, cmp_sign_matters, 
 u_8_32;
 +Vcge, [Instruction_name [vcge]; Builtin_name vcgeu],
 +  All (3, Dreg), vcge, cmp_sign_matters,
 +  u_8_32;
  Vcge, [], All (3, Qreg), vcgeQ, cmp_sign_matters, F32 :: s_8_32;
 -Vcge, [Builtin_name vcgeu], All (3, Qreg), vcgeQ, cmp_sign_matters, 
 u_8_32;
 +Vcge, [Instruction_name [vcge]; Builtin_name vcgeu],
 +  All (3, Qreg), vcgeQ, cmp_sign_matters,
 +  u_8_32;
  
  (* Comparison, less-than or equal.  *)
  Vcle, [Flipped vcge], All (3, Dreg), vcle, cmp_sign_matters,
F32 :: s_8_32;
 -Vcle, [Flipped vcgeu], All (3, Dreg), vcle, cmp_sign_matters,
 +Vcle, [Instruction_name [vcge]; Flipped vcgeu],
 +  All (3, Dreg), vcle, cmp_sign_matters,
u_8_32;
  Vcle, [Instruction_name [vcge]; Flipped vcgeQ],
All (3, Qreg), vcleQ, cmp_sign_matters,
 @@ -798,14 +803,19 @@ let ops =
  
  (* Comparison, greater-than.  *)
  Vcgt, [], All (3, Dreg), vcgt, cmp_sign_matters, F32 :: s_8_32;
 -Vcgt, [Builtin_name vcgtu], All (3, Dreg), vcgt, cmp_sign_matters, 
 u_8_32;
 +Vcgt, [Instruction_name [vcgt]; Builtin_name vcgtu],
 +  All (3, Dreg), vcgt, cmp_sign_matters,
 +  u_8_32;
  Vcgt, [], All (3, Qreg), vcgtQ, cmp_sign_matters, F32 :: s_8_32;
 -Vcgt, [Builtin_name vcgtu], All (3, Qreg), vcgtQ, cmp_sign_matters, 
 u_8_32;
 +Vcgt, [Instruction_name [vcgt]; Builtin_name vcgtu],
 +  All (3, Qreg), vcgtQ, cmp_sign_matters,
 +  u_8_32;
  
  (* Comparison, less-than.  *)
  Vclt, [Flipped vcgt], All (3, Dreg), vclt, cmp_sign_matters,
F32 :: s_8_32;
 -Vclt, [Flipped vcgtu], All (3, Dreg), vclt, cmp_sign_matters,
 +Vclt, [Instruction_name [vcgt]; Flipped vcgtu],
 +  All (3, Dreg), vclt, cmp_sign_matters,
u_8_32;
  Vclt, [Instruction_name [vcgt]; Flipped vcgtQ],
All (3, Qreg), vcltQ, cmp_sign_matters,




Re: [PATCH] Fix PR49484, gthr requirements update (target maintainers have a looksee)

2012-03-13 Thread Richard Earnshaw
On 13/03/12 10:05, Richard Guenther wrote:
 On Tue, Mar 13, 2012 at 10:44 AM, Richard Guenther
 richard.guent...@gmail.com wrote:
 On Mon, Mar 12, 2012 at 6:44 PM, Gerald Pfeifer ger...@pfeifer.com wrote:
 On Mon, 12 Mar 2012, Richard Guenther wrote:
 2012-01-18  Richard Guenther  rguent...@suse.de

* gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
* gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
(__gthread_mutex_init_function): New function.
* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

PR gcov/49484
* libgcov.c: Include gthr.h.
(__gcov_flush_mx): New global variable.
(init_mx, init_mx_once): New functions.
(__gcov_flush): Protect self with a mutex.
(__gcov_fork): Re-initialize mutex after forking.
* unwind-dw2-fde.c: Change condition under which to use
__GTHREAD_MUTEX_INIT_FUNCTION.

 Richi, I'm afraid this caused the following on i386-unknown-freebsd10?

 /scratch2/tmp/gerald/gcc-HEAD/libgcc/libgcov.c:710:54: error: 'NULL' 
 undeclared here (not in a function)
 gmake[3]: *** [_gcov.o] Error 1
 gmake[3]: *** Waiting for unfinished jobs
 gmake[3]: Leaving directory 
 `/scratch2/tmp/gerald/OBJ-0312-1454/i386-unknown-freebsd10.0/libgcc'
 gmake[2]: *** [all-stage1-target-libgcc] Error 2

 This is

 #ifdef __GTHREAD_MUTEX_INIT
 ATTRIBUTE_HIDDEN __gthread_mutex_t __gcov_flush_mx = __GTHREAD_MUTEX_INIT;

 thus if __GTHREAD_MUTEX_INIT uses NULL and gthr.h does not include
 everything to make that initializer valid it is a freebsd header bug, unless
 it is

 #if defined(inhibit_libc)
 #define IN_LIBGCOV (-1)
 #else
 #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
 #include stdio.h

 wtf?  This is a target library, why is stdio.h not properly included
 by tsystem.h?
 It is.  Anyone remembers?
 
 Goes back to rev. 5880 by rms, at which time tsystem.h did not exist.
 
 I'm going to remove those two lines, bootstrap  test it and commit as
 obvious.
 

Please also check this on a bare-metal build.

R.

 Richard.
 
 Can you verify that theory, thus remove that #undef and the #include?

 Richard.

 Gerald
 




Re: [PATCH] Fix PR49484, gthr requirements update (target maintainers have a looksee)

2012-03-13 Thread Richard Guenther
On Tue, Mar 13, 2012 at 11:22 AM, Richard Earnshaw rearn...@arm.com wrote:
 On 13/03/12 10:05, Richard Guenther wrote:
 On Tue, Mar 13, 2012 at 10:44 AM, Richard Guenther
 richard.guent...@gmail.com wrote:
 On Mon, Mar 12, 2012 at 6:44 PM, Gerald Pfeifer ger...@pfeifer.com wrote:
 On Mon, 12 Mar 2012, Richard Guenther wrote:
 2012-01-18  Richard Guenther  rguent...@suse.de

        * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
        * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
        (__gthread_mutex_init_function): New function.
        * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

        PR gcov/49484
        * libgcov.c: Include gthr.h.
        (__gcov_flush_mx): New global variable.
        (init_mx, init_mx_once): New functions.
        (__gcov_flush): Protect self with a mutex.
        (__gcov_fork): Re-initialize mutex after forking.
        * unwind-dw2-fde.c: Change condition under which to use
        __GTHREAD_MUTEX_INIT_FUNCTION.

 Richi, I'm afraid this caused the following on i386-unknown-freebsd10?

 /scratch2/tmp/gerald/gcc-HEAD/libgcc/libgcov.c:710:54: error: 'NULL' 
 undeclared here (not in a function)
 gmake[3]: *** [_gcov.o] Error 1
 gmake[3]: *** Waiting for unfinished jobs
 gmake[3]: Leaving directory 
 `/scratch2/tmp/gerald/OBJ-0312-1454/i386-unknown-freebsd10.0/libgcc'
 gmake[2]: *** [all-stage1-target-libgcc] Error 2

 This is

 #ifdef __GTHREAD_MUTEX_INIT
 ATTRIBUTE_HIDDEN __gthread_mutex_t __gcov_flush_mx = __GTHREAD_MUTEX_INIT;

 thus if __GTHREAD_MUTEX_INIT uses NULL and gthr.h does not include
 everything to make that initializer valid it is a freebsd header bug, unless
 it is

 #if defined(inhibit_libc)
 #define IN_LIBGCOV (-1)
 #else
 #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
 #include stdio.h

 wtf?  This is a target library, why is stdio.h not properly included
 by tsystem.h?
 It is.  Anyone remembers?

 Goes back to rev. 5880 by rms, at which time tsystem.h did not exist.

 I'm going to remove those two lines, bootstrap  test it and commit as
 obvious.


 Please also check this on a bare-metal build.

Bare-metal should not be affected as that defines inhibit_libc(?).  What
is an example for a bare-metal target triplet?

Richard.

 R.

 Richard.

 Can you verify that theory, thus remove that #undef and the #include?

 Richard.

 Gerald





Re: PATCH: Properly generate X32 IE sequence

2012-03-13 Thread Uros Bizjak
On Tue, Mar 13, 2012 at 8:11 AM, Uros Bizjak ubiz...@gmail.com wrote:

 Please try attached patch.  It introduces TARGET_TLS_INDIRECT_SEG_REFS
 to block only indirect seg references.

 There is no regression.

 Thanks, committed to mainline SVN with following ChangeLog:

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.h (TARGET_TLS_INDIRECT_SEG_REFS): New.
        * config/i386/i386.c (ix86_decompose_address): Use
        TARGET_TLS_INDIRECT_SEG_REFS to prevent %fs:(%reg) addresses.
        (legitimize_tls_address): Use TARGET_TLS_INDIRECT_SEG_REFS to load
        thread pointer to a register.

 Tested on x86_64-pc-linux-gnu {,-m32}.

 BTW, this x32 TLS IE optimization:

      movq    %rax, %fs:(%rdx)

 This is just looking for troubles. If we said these addresses are
 invalid, then we shouldn't generate them.

OTOH,  we can improve rejection test a bit to reject only non-word
mode registers.

2012-03-13  Uros Bizjak  ubiz...@gmail.com

* config/i386/i386.c (ix86_decompose_address): Prevent %fs:(%reg)
addresses only when %reg is not in word mode.

Tested on x86_64-pc-linux-gnu {,-m32}, committed.

Uros.

Index: i386.c
===
--- i386.c  (revision 185278)
+++ i386.c  (working copy)
@@ -11563,8 +11563,10 @@
return 0;
 }

-  if (seg != SEG_DEFAULT  (base || index)
-   !TARGET_TLS_INDIRECT_SEG_REFS)
+/* Address override works only on the (%reg) part of %fs:(%reg).  */
+  if (seg != SEG_DEFAULT
+   ((base  GET_MODE (base) != word_mode)
+ || (index  GET_MODE (index) != word_mode)))
 return 0;

   /* Extract the integral value of scale.  */


Re: Remove obsolete IRIX 6.5 support

2012-03-13 Thread Arnaud Charlet
The gnattools and gcc/ada/gcc-interface changes are OK.

The gcc/ada file removals (*irix*) are also OK

I'd need to review the other gcc/ada changes more carefully before
giving an OK for these and would rather do so with a readily available
patch file uncompressed.

I'd suggest sending me these parts privately once you've got the other OKs.

Arno


Re: [PATCH, i386, Android] -mandroid support for i386 target

2012-03-13 Thread Ilya Enkovich
Ping

27 февраля 2012 г. 6:41 пользователь Ilya Enkovich
enkovich@gmail.com написал:
 You should keep those *_SPEC and define them with new
 GNU_*_SPEC in gnu-user.h since gnu-user.h is also used
 by other non-linux targets.  In linux.h, you undef *_SPEC
 before defining them.


 --
 H.J.

 Thanks for the note. Here is fixed version. Is it OK now?

 Thanks,
 Ilya
 --
 2012-02-27  Enkovich Ilya  ilya.enkov...@intel.com

        * gcc/config/i386/gnu-user.h (GNU_USER_TARGET_CC1_SPEC): New.
        (CC1_SPEC): Use GNU_USER_TARGET_CC1_SPEC.
        (GNU_USER_TARGET_LINK_SPEC): New.
        (LINK_SPEC): Use GNU_USER_TARGET_LINK_SPEC.
        (GNU_USER_TARGET_MATHFILE_SPEC): New.
        (ENDFILE_SPEC): Use GNU_USER_TARGET_MATHFILE_SPEC.

        * gcc/config/i386/linux.h (CC1_SPEC): New.
        (LINK_SPEC): New.
        (LIB_SPEC): New.
        (STARTFILE_SPEC): New.
        (ENDFILE_SPEC): New.


 diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
 index 98d0a25..33ceab7 100644
 --- a/gcc/config/i386/gnu-user.h
 +++ b/gcc/config/i386/gnu-user.h
 @@ -77,8 +77,11 @@ along with GCC; see the file COPYING3.  If not see
  #undef CPP_SPEC
  #define CPP_SPEC %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}

 +#undef GNU_USER_TARGET_CC1_SPEC
 +#define GNU_USER_TARGET_CC1_SPEC %(cc1_cpu) %{profile:-p}
 +
  #undef CC1_SPEC
 -#define CC1_SPEC %(cc1_cpu) %{profile:-p}
 +#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC

  /* Provide a LINK_SPEC appropriate for GNU userspace.  Here we provide 
 support
    for the special GCC options -static and -shared, which allow us to
 @@ -97,22 +100,28 @@ along with GCC; see the file COPYING3.  If not see
   { link_emulation, GNU_USER_LINK_EMULATION },\
   { dynamic_linker, GNU_USER_DYNAMIC_LINKER }

 -#undef LINK_SPEC
 -#define LINK_SPEC -m %(link_emulation) %{shared:-shared} \
 +#define GNU_USER_TARGET_LINK_SPEC \
 +  -m %(link_emulation) %{shared:-shared} \
   %{!shared: \
     %{!static: \
       %{rdynamic:-export-dynamic} \
       -dynamic-linker %(dynamic_linker)} \
       %{static:-static}}

 +#undef LINK_SPEC
 +#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
 +
  /* Similar to standard GNU userspace, but adding -ffast-math support.  */
 -#undef  ENDFILE_SPEC
 -#define ENDFILE_SPEC \
 +#define GNU_USER_TARGET_MATHFILE_SPEC \
   %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{mpc32:crtprec32.o%s} \
    %{mpc64:crtprec64.o%s} \
 -   %{mpc80:crtprec80.o%s} \
 -   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s
 +   %{mpc80:crtprec80.o%s}
 +
 +#undef  ENDFILE_SPEC
 +#define ENDFILE_SPEC \
 +  GNU_USER_TARGET_MATHFILE_SPEC   \
 +  GNU_USER_TARGET_ENDFILE_SPEC

  /* A C statement (sans semicolon) to output to the stdio stream
    FILE the assembler definition of uninitialized global DECL named
 diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
 index 73681fe..a832ddc 100644
 --- a/gcc/config/i386/linux.h
 +++ b/gcc/config/i386/linux.h
 @@ -22,3 +22,30 @@ along with GCC; see the file COPYING3.  If not see

  #define GNU_USER_LINK_EMULATION elf_i386
  #define GLIBC_DYNAMIC_LINKER /lib/ld-linux.so.2
 +
 +#undef CC1_SPEC
 +#define CC1_SPEC \
 +  LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
 +                      GNU_USER_TARGET_CC1_SPEC   ANDROID_CC1_SPEC)
 +
 +#undef LINK_SPEC
 +#define LINK_SPEC \
 +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
 +                      GNU_USER_TARGET_LINK_SPEC   ANDROID_LINK_SPEC)
 +
 +#undef  LIB_SPEC
 +#define LIB_SPEC \
 +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \
 +                      GNU_USER_TARGET_LIB_SPEC   ANDROID_LIB_SPEC)
 +
 +#undef  STARTFILE_SPEC
 +#define STARTFILE_SPEC \
 +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, \
 +                      ANDROID_STARTFILE_SPEC)
 +
 +#undef  ENDFILE_SPEC
 +#define ENDFILE_SPEC \
 +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_MATHFILE_SPEC   \
 +                      GNU_USER_TARGET_ENDFILE_SPEC,     \
 +                      GNU_USER_TARGET_MATHFILE_SPEC   \
 +                      ANDROID_ENDFILE_SPEC)


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Andreas Schwab
Tristan Gingold ging...@adacore.com writes:

 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
 index 34183ba..120628e 100644
 --- a/gcc/ada/gcc-interface/decl.c
 +++ b/gcc/ada/gcc-interface/decl.c
 @@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type 
 mech,
  
/* VMS descriptors are themselves passed by reference.  */
if (mech == By_Short_Descriptor ||
 -  (mech == By_Descriptor  TARGET_ABI_OPEN_VMS  !TARGET_MALLOC64))
 +  (mech == By_Descriptor  TARGET_ABI_OPEN_VMS  !flag_vms_malloc64))

../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
../../gcc/ada/gcc-interface/decl.c:5492: error: 'flag_vms_malloc64' undeclared 
(first use in this function)
../../gcc/ada/gcc-interface/decl.c:5492: error: (Each undeclared identifier is 
reported only once
../../gcc/ada/gcc-interface/decl.c:5492: error: for each function it appears 
in.)
make[3]: *** [ada/decl.o] Error 1

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Tristan Gingold

On Mar 13, 2012, at 12:13 PM, Andreas Schwab wrote:

 Tristan Gingold ging...@adacore.com writes:
 
 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
 index 34183ba..120628e 100644
 --- a/gcc/ada/gcc-interface/decl.c
 +++ b/gcc/ada/gcc-interface/decl.c
 @@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, 
 Mechanism_Type mech,
 
   /* VMS descriptors are themselves passed by reference.  */
   if (mech == By_Short_Descriptor ||
 -  (mech == By_Descriptor  TARGET_ABI_OPEN_VMS  !TARGET_MALLOC64))
 +  (mech == By_Descriptor  TARGET_ABI_OPEN_VMS  !flag_vms_malloc64))
 
 ../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
 ../../gcc/ada/gcc-interface/decl.c:5492: error: 'flag_vms_malloc64' 
 undeclared (first use in this function)
 ../../gcc/ada/gcc-interface/decl.c:5492: error: (Each undeclared identifier 
 is reported only once
 ../../gcc/ada/gcc-interface/decl.c:5492: error: for each function it appears 
 in.)
 make[3]: *** [ada/decl.o] Error 1

For which target ?

On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:

/* Let code know whether we are targetting VMS without need of
   intrusive preprocessor directives.  */
#ifndef TARGET_ABI_OPEN_VMS
#define TARGET_ABI_OPEN_VMS 0

/* VMS option set by default, when clear forces 32bit mallocs and 32bit
   Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
   so no effect on non-VMS systems.  */
#define flag_vms_malloc64 0
#endif

Tristan.



Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Richard Guenther
On Tue, Mar 13, 2012 at 12:20 PM, Tristan Gingold ging...@adacore.com wrote:

 On Mar 13, 2012, at 12:13 PM, Andreas Schwab wrote:

 Tristan Gingold ging...@adacore.com writes:

 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
 index 34183ba..120628e 100644
 --- a/gcc/ada/gcc-interface/decl.c
 +++ b/gcc/ada/gcc-interface/decl.c
 @@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, 
 Mechanism_Type mech,

   /* VMS descriptors are themselves passed by reference.  */
   if (mech == By_Short_Descriptor ||
 -      (mech == By_Descriptor  TARGET_ABI_OPEN_VMS  !TARGET_MALLOC64))
 +      (mech == By_Descriptor  TARGET_ABI_OPEN_VMS  !flag_vms_malloc64))

That looks ugly and should have left a target macro instead of ...

 ../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
 ../../gcc/ada/gcc-interface/decl.c:5492: error: 'flag_vms_malloc64' 
 undeclared (first use in this function)
 ../../gcc/ada/gcc-interface/decl.c:5492: error: (Each undeclared identifier 
 is reported only once
 ../../gcc/ada/gcc-interface/decl.c:5492: error: for each function it appears 
 in.)
 make[3]: *** [ada/decl.o] Error 1

 For which target ?

 On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:

 /* Let code know whether we are targetting VMS without need of
   intrusive preprocessor directives.  */
 #ifndef TARGET_ABI_OPEN_VMS
 #define TARGET_ABI_OPEN_VMS 0

 /* VMS option set by default, when clear forces 32bit mallocs and 32bit
   Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
   so no effect on non-VMS systems.  */
 #define flag_vms_malloc64 0
 #endif

... this.

Richard.

 Tristan.



Re: [google] Add -gfission support to GCC (issue5754090)

2012-03-13 Thread Diego Novillo

On 13/03/12 04:14 , Eric Botcazou wrote:

For google/gcc-4_6 branch. (To be submitted for trunk soon.)


The option name sounds like the brainchild of the marketing department. :-)
Can we avoid going nuclear in the compiler and use something more mundane?


I, for one, welcome our new nuclear overlords.





Re: [PATCH 2/3] Move MEM_REF expansion to a new function

2012-03-13 Thread Michael Matz
Hi,

On Mon, 12 Mar 2012, Martin Jambor wrote:

 OK, the following patch changes the places where I previously called the 
 new function to call expand_expr with EXPAND_WRITE modifier and then 
 makes sure we do not perform reads into rvalues in expand_expr_real_1 in 
 the contexts where I need to avoid that.
 
 So far it has passed bootstrap and testing on x86_64-linux, bootstraps 
 and testsuite runs on the other platforms are still underway.  What do 
 you think?

I like it, but can't approve.


Ciao,
Michael.


[PATCH] Fix PR52134

2012-03-13 Thread Richard Guenther

We fail to fold round_up generated expressions during size expression
folding.

Fixed as follows, bootstrapped and tested on x86_64-unknwon-linux-gnu,
applied to trunk.

Richard.

2012-03-13  Richard Guenther  rguent...@suse.de

PR middle-end/52134
* fold-const.c (fold_binary_loc): Fold (X * Y)  -(1  CST) to X * Y
if Y is a constant multiple of 1  CST.

* gcc.dg/pr52134.c: New testcase.

Index: gcc/fold-const.c
===
*** gcc/fold-const.c(revision 185322)
--- gcc/fold-const.c(working copy)
*** fold_binary_loc (location_t loc,
*** 11398,11403 
--- 11401,11420 
  fold_convert_loc (loc, type, arg0));
}
  
+   /* Fold (X * Y)  -(1  CST) to X * Y if Y is a constant
+  multiple of 1  CST.  */
+   if (TREE_CODE (arg1) == INTEGER_CST)
+   {
+ double_int cst1 = tree_to_double_int (arg1);
+ double_int ncst1 = double_int_ext (double_int_neg (cst1),
+TYPE_PRECISION (TREE_TYPE (arg1)),
+TYPE_UNSIGNED (TREE_TYPE (arg1)));
+ if (double_int_equal_p (double_int_and (cst1, ncst1), ncst1)
+  multiple_of_p (type, arg0,
+   double_int_to_tree (TREE_TYPE (arg1), ncst1)))
+   return fold_convert_loc (loc, type, arg0);
+   }
+ 
/* For constants M and N, if M == (1LL  cst) - 1  (N  M) == M,
 ((A  N) + B)  M - (A + B)  M
 Similarly if (N  M) == 0,
Index: gcc/testsuite/gcc.dg/pr52134.c
===
*** gcc/testsuite/gcc.dg/pr52134.c  (revision 0)
--- gcc/testsuite/gcc.dg/pr52134.c  (revision 0)
***
*** 0 
--- 1,14 
+ /* { dg-do compile } */
+ /* { dg-options -fdump-tree-original } */
+ 
+ unsigned f(unsigned t)
+ {
+ return (t*4)-4;
+ }
+ int f1(int t)
+ {
+ return (t*4)-4;
+ }
+ 
+ /* { dg-final { scan-tree-dump-not \\\ original } } */
+ /* { dg-final { cleanup-tree-dump original } } */


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Andreas Schwab
Tristan Gingold ging...@adacore.com writes:

 For which target ?

ia64-*-* or alpha-*-*

 On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:

 /* Let code know whether we are targetting VMS without need of
intrusive preprocessor directives.  */
 #ifndef TARGET_ABI_OPEN_VMS

TARGET_ABI_OPEN_VMS is always defined.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Tristan Gingold

On Mar 13, 2012, at 2:57 PM, Andreas Schwab wrote:

 Tristan Gingold ging...@adacore.com writes:
 
 For which target ?
 
 ia64-*-* or alpha-*-*
 
 On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:
 
 /* Let code know whether we are targetting VMS without need of
   intrusive preprocessor directives.  */
 #ifndef TARGET_ABI_OPEN_VMS
 
 TARGET_ABI_OPEN_VMS is always defined.

Ok, I see the issue.  Will fix.

Tristan.



Re: [Patch ARM] Fix definition of MALLOC_ABI_ALIGNMENT.

2012-03-13 Thread Richard Earnshaw
On 12/03/12 22:35, Ramana Radhakrishnan wrote:
 Hi,
 
 This sets MALLOC_ABI_ALIGNMENT to 64 bits on ARM which should be safe
 on all AAPCS implementations given that this is a requirement on our
 alignment specifiers. I would expect this to be true for most modern
 malloc implementations on AAPCS targets -
 
 Ok ?
 
 
 Ramana
 
 2012-03-12  Ramana Radhakrishnan  ramana.radhakrish...@linaro.org
 
   * config/arm/arm.h (MALLOC_ABI_ALIGNMENT): Set to biggest
   alignment.
 
 Index: gcc/config/arm/arm.h
 ===
 --- gcc/config/arm/arm.h  (revision 185248)
 +++ gcc/config/arm/arm.h  (working copy)
 @@ -534,6 +534,11 @@
 
  #define BIGGEST_ALIGNMENT (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32)
 
 +#ifndef MALLOC_ABI_ALIGNMENT
 +#define MALLOC_ABI_ALIGNMENT (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : \
 +   BITS_PER_WORD)
 +#endif
 +
 

OK.

R.



Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Tristan Gingold

On Mar 13, 2012, at 2:57 PM, Andreas Schwab wrote:

 Tristan Gingold ging...@adacore.com writes:
 
 For which target ?
 
 ia64-*-* or alpha-*-*
 
 On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:
 
 /* Let code know whether we are targetting VMS without need of
   intrusive preprocessor directives.  */
 #ifndef TARGET_ABI_OPEN_VMS
 
 TARGET_ABI_OPEN_VMS is always defined.

I am committing this patch to fix the build failure.

Tested by (cross) building ia64-linux and ia64-hp-openvms.

Tristan.

gcc/ada/
2012-03-13  Tristan Gingold  ging...@adacore.com

* gcc-interface/gigi.h (flag_vms_malloc64): Refine condition.

Index: gcc-interface/gigi.h
===
--- gcc-interface/gigi.h(revision 185334)
+++ gcc-interface/gigi.h(working copy)
@@ -995,10 +995,12 @@
intrusive preprocessor directives.  */
 #ifndef TARGET_ABI_OPEN_VMS
 #define TARGET_ABI_OPEN_VMS 0
+#endif
 
 /* VMS option set by default, when clear forces 32bit mallocs and 32bit
-   Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
+   Descriptors.  Always used in combination with TARGET_ABI_OPEN_VMS
so no effect on non-VMS systems.  */
+#if TARGET_ABI_OPEN_VMS == 0
 #define flag_vms_malloc64 0
 #endif
 



Re: [PATCH 2/3] Move MEM_REF expansion to a new function

2012-03-13 Thread Richard Guenther
On Tue, 13 Mar 2012, Michael Matz wrote:

 Hi,
 
 On Mon, 12 Mar 2012, Martin Jambor wrote:
 
  OK, the following patch changes the places where I previously called the 
  new function to call expand_expr with EXPAND_WRITE modifier and then 
  makes sure we do not perform reads into rvalues in expand_expr_real_1 in 
  the contexts where I need to avoid that.
  
  So far it has passed bootstrap and testing on x86_64-linux, bootstraps 
  and testsuite runs on the other platforms are still underway.  What do 
  you think?
 
 I like it, but can't approve.

Looks good to me, too.  Thus, ok for trunk if the other platform
tests succeed.

Thanks,
Richard.


Re: PATCH: Properly generate X32 IE sequence

2012-03-13 Thread H.J. Lu
On Tue, Mar 13, 2012 at 3:37 AM, Uros Bizjak ubiz...@gmail.com wrote:
 On Tue, Mar 13, 2012 at 8:11 AM, Uros Bizjak ubiz...@gmail.com wrote:

 Please try attached patch.  It introduces TARGET_TLS_INDIRECT_SEG_REFS
 to block only indirect seg references.

 There is no regression.

 Thanks, committed to mainline SVN with following ChangeLog:

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.h (TARGET_TLS_INDIRECT_SEG_REFS): New.
        * config/i386/i386.c (ix86_decompose_address): Use
        TARGET_TLS_INDIRECT_SEG_REFS to prevent %fs:(%reg) addresses.
        (legitimize_tls_address): Use TARGET_TLS_INDIRECT_SEG_REFS to load
        thread pointer to a register.

 Tested on x86_64-pc-linux-gnu {,-m32}.

 BTW, this x32 TLS IE optimization:

      movq    %rax, %fs:(%rdx)

 This is just looking for troubles. If we said these addresses are
 invalid, then we shouldn't generate them.

 OTOH,  we can improve rejection test a bit to reject only non-word
 mode registers.

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.c (ix86_decompose_address): Prevent %fs:(%reg)
        addresses only when %reg is not in word mode.

 Tested on x86_64-pc-linux-gnu {,-m32}, committed.

 Uros.

 Index: i386.c
 ===
 --- i386.c      (revision 185278)
 +++ i386.c      (working copy)
 @@ -11563,8 +11563,10 @@
        return 0;
     }

 -  if (seg != SEG_DEFAULT  (base || index)
 -       !TARGET_TLS_INDIRECT_SEG_REFS)
 +/* Address override works only on the (%reg) part of %fs:(%reg).  */
 +  if (seg != SEG_DEFAULT
 +       ((base  GET_MODE (base) != word_mode)
 +         || (index  GET_MODE (index) != word_mode)))
     return 0;

   /* Extract the integral value of scale.  */

This works.

-- 
H.J.


Re: PATCH: Call gen_tls_global_dynamic_64_mode and en_tls_local_dynamic_base_64_mode

2012-03-13 Thread Uros Bizjak
On Mon, Mar 12, 2012 at 10:35 PM, H.J. Lu hjl.to...@gmail.com wrote:

 2012-03-12  H.J. Lu  hongjiu...@intel.com

        * config/i386/i386.c (ix86_gen_tls_global_dynamic_64): New.
        (ix86_gen_tls_local_dynamic_base_64): Likewise.
        (ix86_option_override_internal): Set ix86_gen_tls_global_dynamic_64
        and ix86_gen_tls_local_dynamic_base_64.
        (legitimize_tls_address): Use ix86_gen_tls_global_dynamic_64 and
        ix86_gen_tls_local_dynamic_base_64.

        * config/i386/i386.md (*tls_global_dynamic_64): Renamed to ...
        (*tls_global_dynamic_64_mode): This.
        (tls_global_dynamic_64): Renamed to ...
        (tls_global_dynamic_64_mode): This.
        (*tls_local_dynamic_base_64): Renamed to ...
        (*tls_local_dynamic_base_64_mode): This.
        (tls_local_dynamic_base_64): Renamed to ...
        (tls_local_dynamic_base_64_mode): This.

 This patch caused x32 libgcc build failure:

 ../../../../src-trunk/libgcc/generic-morestack-thread.c: In function
 'stack_split_initialize_thread':
 ../../../../src-trunk/libgcc/generic-morestack-thread.c:128:1: error:
 unrecognizable insn:
 (call_insn/u 8 7 9 3 (parallel [
            (set (reg:DI 0 ax)
                (call:DI (mem:QI (symbol_ref:DI (__tls_get_addr)) [0 S1 
 A8])
                    (const_int 0 [0])))
            (unspec:DI [
                    (symbol_ref:SI (__morestack_segments) [flags
 0x50] var_decl 0x77725780 __morestack_segments)
                ] UNSPEC_TLS_GD)
        ]) ../../../../src-trunk/libgcc/generic-morestack-thread.c:117 -1
     (expr_list:REG_EH_REGION (const_int -2147483648 [0x8000])
        (nil))
    (nil))
 ../../../../src-trunk/libgcc/generic-morestack-thread.c:128:1:
 internal compiler error: in extract_insn, at recog.c:2123
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See http://gcc.gnu.org/bugs.html for instructions.
 make[8]: *** [generic-morestack-thread.o] Error 1
 make[8]: *** Waiting for unfinished jobs

 __morestack_segments is always in SImode for x32.  Adding
 :P to

  (unspec:P [(match_operand 1 tls_symbolic_operand )]

 causes it to fail when Pmode == DImode  I checked in this patch
 to revert the part of that change.

 Please better declare tls_symbolic_operand as special predicate, as in
 attached patch.

2012-03-13  Uros Bizjak  ubiz...@gmail.com

* config/i386/predicates.md (tls_symbolic_operand): Declare as
special predicate.
(tls_modbase_operand): Ditto.
* config/i386/i386.md: Remove mode from tls_symbolic_operand and
tls_modbase_operand predicates.

There is no point to pass mode of special predicate operands, so I
remove these from i386.md.

Tested on x86_64-pc-linux-gnu, committed to mainline SVN.

Uros.
Index: i386.md
===
--- i386.md (revision 185277)
+++ i386.md (working copy)
@@ -12591,7 +12591,7 @@
   [(set (match_operand:SI 0 register_operand =a)
(unspec:SI
 [(match_operand:SI 1 register_operand b)
- (match_operand:SI 2 tls_symbolic_operand )
+ (match_operand 2 tls_symbolic_operand )
  (match_operand:SI 3 constant_call_address_operand z)]
 UNSPEC_TLS_GD))
(clobber (match_scratch:SI 4 =d))
@@ -12616,7 +12616,7 @@
   [(parallel
 [(set (match_operand:SI 0 register_operand )
  (unspec:SI [(match_operand:SI 2 register_operand )
- (match_operand:SI 1 tls_symbolic_operand )
+ (match_operand 1 tls_symbolic_operand )
  (match_operand:SI 3 constant_call_address_operand )]
 UNSPEC_TLS_GD))
  (clobber (match_scratch:SI 4 ))
@@ -12727,7 +12727,7 @@
 (match_operand:SI 2 constant_call_address_operand z)]
UNSPEC_TLS_LD_BASE)
 (const:SI (unspec:SI
-   [(match_operand:SI 3 tls_symbolic_operand )]
+   [(match_operand 3 tls_symbolic_operand )]
UNSPEC_DTPOFF
(clobber (match_scratch:SI 4 =d))
(clobber (match_scratch:SI 5 =c))
@@ -12825,7 +12825,7 @@
 (define_insn tls_initial_exec_64_sun
   [(set (match_operand:DI 0 register_operand =a)
(unspec:DI
-[(match_operand:DI 1 tls_symbolic_operand )]
+[(match_operand 1 tls_symbolic_operand )]
 UNSPEC_TLS_IE_SUN))
(clobber (reg:CC FLAGS_REG))]
   TARGET_64BIT  TARGET_SUN_TLS
@@ -12847,7 +12847,7 @@
 (define_insn tls_initial_exec_x32
   [(set (match_operand:SI 0 register_operand =r)
(unspec:SI
-[(match_operand:SI 1 tls_symbolic_operand )]
+[(match_operand 1 tls_symbolic_operand )]
 UNSPEC_TLS_IE_X32))
(clobber (reg:CC FLAGS_REG))]
   TARGET_X32
@@ -12864,7 +12864,7 @@
   [(set (match_dup 3)
(plus:SI (match_operand:SI 2 register_operand )
 (const:SI
- (unspec:SI [(match_operand:SI 1 tls_symbolic_operand )]
+  

[PATCH] Fix PR52578

2012-03-13 Thread Richard Guenther

This makes sure we fold conversion chains where the outermost
conversion is a sign-change only and that we associate expressions
in more cases when two variables appear but they have equal
value.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2012-03-13  Richard Guenther  rguent...@suse.de

PR middle-end/52578
* fold-const.c (fold_unary_loc): Fold (T1)(T2)x to (T1)x if
the outermost conversion is a sign-change only.
(fold_binary_loc): Disregard widening and sign-changing
conversions when we determine if two variables are equal
for reassociation.
* tree-ssa-forwprop.c (combine_conversions): Fold (T1)(T2)x to
(T1)x if the outermost conversion is a sign-change only.

* gcc.dg/pr52578.c: New testcase.

Index: gcc/fold-const.c
===
--- gcc/fold-const.c(revision 185322)
+++ gcc/fold-const.c(working copy)
@@ -7843,10 +7843,13 @@ fold_unary_loc (location_t loc, enum tre
return fold_build1_loc (loc, code, type, TREE_OPERAND (op0, 0));
 
  /* If we have a sign-extension of a zero-extended value, we can
-replace that by a single zero-extension.  */
+replace that by a single zero-extension.  Likewise if the
+final conversion does not change precision we can drop the
+intermediate conversion.  */
  if (inside_int  inter_int  final_int
-  inside_prec  inter_prec  inter_prec  final_prec
-  inside_unsignedp  !inter_unsignedp)
+  ((inside_prec  inter_prec  inter_prec  final_prec
+   inside_unsignedp  !inter_unsignedp)
+ || final_prec == inter_prec))
return fold_build1_loc (loc, code, type, TREE_OPERAND (op0, 0));
 
  /* Two conversions in a row are not needed unless:
@@ -10335,10 +10341,21 @@ fold_binary_loc (location_t loc,
 
  if (TREE_CODE (tmp0) == NEGATE_EXPR)
tmp0 = TREE_OPERAND (tmp0, 0);
+ if (CONVERT_EXPR_P (tmp0)
+  INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (tmp0, 0)))
+  (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (tmp0, 0)))
+ = TYPE_PRECISION (type)))
+   tmp0 = TREE_OPERAND (tmp0, 0);
  if (TREE_CODE (tmp1) == NEGATE_EXPR)
tmp1 = TREE_OPERAND (tmp1, 0);
+ if (CONVERT_EXPR_P (tmp1)
+  INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (tmp1, 0)))
+  (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (tmp1, 0)))
+ = TYPE_PRECISION (type)))
+   tmp1 = TREE_OPERAND (tmp1, 0);
  /* The only case we can still associate with two variables
-is if they are the same, modulo negation.  */
+is if they are the same, modulo negation and bit-pattern
+preserving conversions.  */
  if (!operand_equal_p (tmp0, tmp1, 0))
ok = false;
}
Index: gcc/tree-ssa-forwprop.c
===
--- gcc/tree-ssa-forwprop.c (revision 185322)
+++ gcc/tree-ssa-forwprop.c (working copy)
@@ -2285,10 +2285,13 @@ combine_conversions (gimple_stmt_iterato
}
 
   /* If we have a sign-extension of a zero-extended value, we can
-replace that by a single zero-extension.  */
+replace that by a single zero-extension.  Likewise if the
+final conversion does not change precision we can drop the
+intermediate conversion.  */
   if (inside_int  inter_int  final_int
-  inside_prec  inter_prec  inter_prec  final_prec
-  inside_unsignedp  !inter_unsignedp)
+  ((inside_prec  inter_prec  inter_prec  final_prec
+   inside_unsignedp  !inter_unsignedp)
+ || final_prec == inter_prec))
{
  gimple_assign_set_rhs1 (stmt, defop0);
  update_stmt (stmt);
Index: gcc/testsuite/gcc.dg/pr52578.c
===
--- gcc/testsuite/gcc.dg/pr52578.c  (revision 0)
+++ gcc/testsuite/gcc.dg/pr52578.c  (revision 0)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options -fdump-tree-original } */
+
+long bar (long i)
+{
+  return (long)((unsigned long)i + 2) - (long)i;
+}
+long foo (int i)
+{
+  return (long)((unsigned long)i + 2) - (long)i;
+}
+
+/* { dg-final { scan-tree-dump-times return 2; 2 original } } */
+/* { dg-final { cleanup-tree-dump original } } */


[PATCH][Cilkplus] Fix a bug in array notations

2012-03-13 Thread Iyer, Balaji V
Hello Everyone,
   This patch is for the Cilkplus branch mainly affecting the C compiler. It 
fixes a bug in function calls that take in array notations.

Thanks,

Balaji V. Iyer.Index: gcc/c-typeck.c
===
--- gcc/c-typeck.c  (revision 185342)
+++ gcc/c-typeck.c  (working copy)
@@ -3274,7 +3274,10 @@
 
   if (typetail != 0  TREE_VALUE (typetail) != void_type_node)
 {
-  if (flag_enable_cilk  contains_array_notation_expr (function))
+  if (flag_enable_cilk
+  (contains_array_notation_expr (function)
+ || contains_array_notation_expr
+ (build_tree_list_vec (values
;
   else
{
Index: gcc/c-array-notation.c
===
--- gcc/c-array-notation.c  (revision 185342)
+++ gcc/c-array-notation.c  (working copy)
@@ -134,6 +134,15 @@
   *array_list = new_array_list;
   return;
 }
+  else if (TREE_CODE (node) == TREE_LIST)
+{
+  extract_array_notation_exprs (TREE_PURPOSE (node), ignore_builtin_fn,
+   array_list, list_size);
+  extract_array_notation_exprs (TREE_VALUE (node), ignore_builtin_fn,
+   array_list, list_size);
+  extract_array_notation_exprs (TREE_CHAIN (node), ignore_builtin_fn,
+   array_list, list_size);
+}
   else if (TREE_CODE (node) == STATEMENT_LIST)
 {
   tree_stmt_iterator ii_tsi;
Index: gcc/ChangeLog.cilk
===
--- gcc/ChangeLog.cilk  (revision 185342)
+++ gcc/ChangeLog.cilk  (working copy)
@@ -1,3 +1,9 @@
+2012-03-12  Balaji V. Iyer  balaji.v.i...@intel.com
+
+   * c-typeck.c (convert_arguments): Added array notation check for
+   funtion values.
+   * c-array-notation.c (extract_array_notation_exprs): Handled TREE_LIST.
+
 2012-03-11  Balaji V. Iyer  balaji.v.i...@intel.com
 
* attribs.c (decl_attributes): Concatinated existing attributes with


Re: [gimplefe] [patch] splits cpp_lshift and cpp_rshift tokens into discrete cpp_less and cpp_greater tokens respectively

2012-03-13 Thread Diego Novillo

On 08/03/12 20:47 , Sandeep Soni wrote:


+/* Splits the token TOKEN into two tokens FIRST_TOKEN and SECOND_TOKEN.
+   Note that the split should work only if the type of the TOKEN is
+   either CPP_RSHIFT or CPP_LSHIFT which gets splitted into two tokens


s/splitted/split/


   while (gl_lex_token (lexer, token))
-VEC_safe_push (gimple_token, gc, lexer-tokens, token);
+{
+  if (gl_token_is_of_type (token,CPP_LSHIFT) ||
+ gl_token_is_of_type (token,CPP_RSHIFT))


'||' goes at the start of the second line, aligned with the first 
character after the '('.



OK with those changes.


Diego.


[PATCH, i386]: Handle subregs of AND zero extended address correctly

2012-03-13 Thread Uros Bizjak
Hello!

We allow addresses, zero extended with (AND (Dimode OP)
(0x0)). Since we now track address mode precisely, we should
convert this operand to a SImode subreg before passing it further down
of ix86_decompose_address function. This fixes a small hole, where
operands in wrong mode could squeeze through.

2012-03-13  Uros Bizjak  ubiz...@gmail.com

* config/i386/i386.c (ix86_decompose_address): Handle subregs of
AND zero extended address correctly.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.
Index: i386.c
===
--- i386.c  (revision 185327)
+++ i386.c  (working copy)
@@ -11435,10 +11435,14 @@ ix86_decompose_address (rtx addr, struct ix86_addr
{
  addr = XEXP (addr, 0);
 
- /* Strip subreg.  */
- if (GET_CODE (addr) == SUBREG
-  GET_MODE (SUBREG_REG (addr)) == SImode)
+ /* Adjust SUBREGs.  */
+ if (GET_MODE (addr) == DImode)
+   addr = gen_rtx_SUBREG (SImode, addr, 0);
+ else if (GET_CODE (addr) == SUBREG
+   GET_MODE (SUBREG_REG (addr)) == SImode)
addr = SUBREG_REG (addr);
+ else
+   return 0;
}
 }
 


[pph] Do not emit callgraph nodes to PPH images [1/2] (issue5803043)

2012-03-13 Thread Diego Novillo
Part 1: Add more trees to the preloaded tree cache.

This prevents more common trees, built at compiler
initialization time, to be streamed out to PPH images.

These trees are in:

- type_hash_table: The private hash table used in tree.c to
  record canonical types.  To avoid exposing this table out of
  tree.c, I added a traversal routine with a callback argument
  (type_hash_table_traverse).

- Builtin types registered with record_builtin_type.  I added
  a routine pph_register_builtin_type that is called for every
  builtin type.  We later record those types in
  pph_cache_preload.

Another piece of private state that needs to be written out is
canonical_template_parms and nonstandard_integer_type_cache.  I added
writer and reader routines to pt.c to do deal with
canonical_template_parms and traversal+callback iterators in tree.c to
deal with nonstandard_integer_type_cache (to avoid middle-end routines
to have to know about PPH).

2012-03-13   Diego Novillo  dnovi...@google.com

cp/ChangeLog.pph
* decl.c (record_builtin_type): Call pph_register_builtin_type.
* pph-core.c (pph_cache_add_full_tree_r): New.
(pph_cache_add_full_tree): New.
(nitc_callback): New.
(pph_builtin_types): Declare.
(pph_register_builtin_type): New.
(pph_cache_add_builtin_types): New.
(pph_cache_add_canonical_type): New.
(pph_cache_preload): Call pph_cache_add_full_tree instead of
pph_cache_add.
Call traverse_nonstandard_integer_type_cache with nitc_callback.
Call pph_cache_add_builtin_types.
Call type_hash_table_traverse.
* pph-in.c (pph_in_tcc_type): Read TYP_NEXT_PTR_TO for
POINTER_TYPE types.
(pph_read_file_1): Call pph_in_canonical_template_parms.
* pph-out.c (pph_out_tcc_type): Write TYPE_NEXT_PTR_TO for
POINTER_TYPE types.
(pph_write_file): Call pph_out_canonical_template_parms.
* pph.h (pph_register_builtin_type): Declare.
(pph_out_canonical_template_parms): Declare.
(pph_in_canonical_template_parms): Declare.
* pt.c (pph_out_canonical_template_parms): New.
(pph_in_canonical_template_parms): New.

ChangeLog.pph
* tree.c (type_hash_traverse): Declare.
(type_hash_table_retrieve_entry): New.
(type_hash_table_traverse): New.
(type_hash_table_length): New.
(CACHED_PREC_LEN): Factor out of ...
(nonstandard_integer_type_cache): ... here.
(traverse_nonstandard_integer_type_cache): New.
* tree.h (type_hash_table_traverse): Declare.
(type_hash_table_length): Declare.
(traverse_nonstandard_integer_type_cache): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/pph@185344 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.pph|   13 ++
 gcc/cp/ChangeLog.pph |   27 +
 gcc/cp/decl.c|6 +++
 gcc/cp/pph-core.c|  106 +++---
 gcc/cp/pph-in.c  |   14 +--
 gcc/cp/pph-out.c |   12 -
 gcc/cp/pph.h |5 ++
 gcc/cp/pt.c  |   31 +++
 gcc/tree.c   |   67 +++-
 gcc/tree.h   |4 ++
 10 files changed, 263 insertions(+), 22 deletions(-)

diff --git a/gcc/ChangeLog.pph b/gcc/ChangeLog.pph
index d95c153..2bf6c9a 100644
--- a/gcc/ChangeLog.pph
+++ b/gcc/ChangeLog.pph
@@ -1,5 +1,18 @@
 2012-03-04   Diego Novillo  dnovi...@google.com
 
+   * tree.c (type_hash_traverse): Declare.
+   (type_hash_table_retrieve_entry): New.
+   (type_hash_table_traverse): New.
+   (type_hash_table_length): New.
+   (CACHED_PREC_LEN): Factor out of ...
+   (nonstandard_integer_type_cache): ... here.
+   (traverse_nonstandard_integer_type_cache): New.
+   * tree.h (type_hash_table_traverse): Declare.
+   (type_hash_table_length): Declare.
+   (traverse_nonstandard_integer_type_cache): Declare.
+
+2012-03-04   Diego Novillo  dnovi...@google.com
+
Merge from trunk rev 184817.
 
BASE-VER: Update to 4.8.0-pph.
diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph
index c867ca3..697ae2b 100644
--- a/gcc/cp/ChangeLog.pph
+++ b/gcc/cp/ChangeLog.pph
@@ -1,3 +1,30 @@
+2012-03-13   Diego Novillo  dnovi...@google.com
+
+   * decl.c (record_builtin_type): Call pph_register_builtin_type.
+   * pph-core.c (pph_cache_add_full_tree_r): New.
+   (pph_cache_add_full_tree): New.
+   (nitc_callback): New.
+   (pph_builtin_types): Declare.
+   (pph_register_builtin_type): New.
+   (pph_cache_add_builtin_types): New.
+   (pph_cache_add_canonical_type): New.
+   (pph_cache_preload): Call pph_cache_add_full_tree instead of
+   pph_cache_add.
+   Call traverse_nonstandard_integer_type_cache with nitc_callback.
+   Call pph_cache_add_builtin_types.
+   Call type_hash_table_traverse.

Re: [patch, 4.7] libitm: Fix lost wake-up in serial lock.

2012-03-13 Thread Richard Henderson
On 03/10/12 09:43, Torvald Riegel wrote:
 libitm: Fix lost wake-up in serial lock.
 
   PR libitm/52526
   * config/linux/rwlock.cc (GTM::gtm_rwlock::read_lock): Fix lost
   wake-up.

Ok.

Jakub needs to approve this for 4.7.0; otherwise ok for 4.7.1.


r~


Re: [patch, 4.7] libitm: Fix lost wake-up in serial lock.

2012-03-13 Thread Jakub Jelinek
On Tue, Mar 13, 2012 at 09:54:36AM -0700, Richard Henderson wrote:
 On 03/10/12 09:43, Torvald Riegel wrote:
  libitm: Fix lost wake-up in serial lock.
  
  PR libitm/52526
  * config/linux/rwlock.cc (GTM::gtm_rwlock::read_lock): Fix lost
  wake-up.
 
 Jakub needs to approve this for 4.7.0; otherwise ok for 4.7.1.

Ok for 4.7.0.

Jakub


[PATCH C++] Use next_conversion for better safety

2012-03-13 Thread Dodji Seketeli
Hello,

This patch was accepted[1] before stage-1.  I have rebased,
bootstrapped and tested it against trunk on x86_64-unknown-linux-gnu.

Applying to trunk.

[1]: http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01145.html

gcc/cp/

* call.c (standard_conversion, build_integral_nontype_arg_conv)
(build_new_op_1, convert_like_real, is_subseq)
(maybe_handle_implicit_object, maybe_handle_ref_bind, compare_ics)
(joust): Use next_conversion instead of accessing fields of struct
conversion directly.
---
 gcc/cp/ChangeLog |8 
 gcc/cp/call.c|   50 +-
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1a3ac83..f04ac60 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2011-12-15  Dodji Seketeli  do...@redhat.com
+
+   * call.c (standard_conversion, build_integral_nontype_arg_conv)
+   (build_new_op_1, convert_like_real, is_subseq)
+   (maybe_handle_implicit_object, maybe_handle_ref_bind, compare_ics)
+   (joust): Use next_conversion instead of accessing fields of struct
+   conversion directly.
+
 2012-03-12  Paolo Carlini  paolo.carl...@oracle.com
 
PR c++/52299
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 0bf3bb1..88733f5 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1325,7 +1325,7 @@ standard_conversion (tree to, tree from, tree expr, bool 
c_cast_p,
 
   /* Give this a better rank if it's a promotion.  */
   if (same_type_p (to, type_promotes_to (from))
-  conv-u.next-rank = cr_promotion)
+  next_conversion (conv)-rank = cr_promotion)
conv-rank = cr_promotion;
 }
   else if (fcode == VECTOR_TYPE  tcode == VECTOR_TYPE
@@ -1335,7 +1335,7 @@ standard_conversion (tree to, tree from, tree expr, bool 
c_cast_p,
is_properly_derived_from (from, to))
 {
   if (conv-kind == ck_rvalue)
-   conv = conv-u.next;
+   conv = next_conversion (conv);
   conv = build_conv (ck_base, to, conv);
   /* The derived-to-base conversion indicates the initialization
 of a parameter with base type from an object of a derived
@@ -3697,7 +3697,7 @@ build_integral_nontype_arg_conv (tree type, tree expr, 
tsubst_flags_t complain)
break;
 
   case ck_std:
-   t = conv-u.next-type;
+   t = next_conversion (conv)-type;
if (INTEGRAL_OR_ENUMERATION_TYPE_P (t))
  break;
 
@@ -5145,7 +5145,7 @@ build_new_op_1 (enum tree_code code, int flags, tree 
arg1, tree arg2, tree arg3,
 objects directly.  */
  conv = cand-convs[0];
  if (conv-kind == ck_ref_bind)
-   conv = conv-u.next;
+   conv = next_conversion (conv);
  arg1 = convert_like (conv, arg1, complain);
 
  if (arg2)
@@ -5159,14 +5159,14 @@ build_new_op_1 (enum tree_code code, int flags, tree 
arg1, tree arg2, tree arg3,
 
  conv = cand-convs[1];
  if (conv-kind == ck_ref_bind)
-   conv = conv-u.next;
+   conv = next_conversion (conv);
  arg2 = convert_like (conv, arg2, complain);
}
  if (arg3)
{
  conv = cand-convs[2];
  if (conv-kind == ck_ref_bind)
-   conv = conv-u.next;
+   conv = next_conversion (conv);
  arg3 = convert_like (conv, arg3, complain);
}
 
@@ -5806,7 +5806,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, 
int argnum,
   break;
 };
 
-  expr = convert_like_real (convs-u.next, expr, fn, argnum,
+  expr = convert_like_real (next_conversion (convs), expr, fn, argnum,
convs-kind == ck_ref_bind ? -1 : 1,
convs-kind == ck_ref_bind ? 
issue_conversion_warnings : false, 
c_cast_p,
@@ -5859,7 +5859,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, 
int argnum,
   {
tree ref_type = totype;
 
-   if (convs-bad_p  !convs-u.next-bad_p)
+   if (convs-bad_p  !next_conversion (convs)-bad_p)
  {
gcc_assert (TYPE_REF_IS_RVALUE (ref_type)
 real_lvalue_p (expr));
@@ -5889,7 +5889,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, 
int argnum,
cp_lvalue_kind lvalue = real_lvalue_p (expr);
 
gcc_assert (same_type_ignoring_top_level_qualifiers_p
-   (type, convs-u.next-type));
+   (type, next_conversion (convs)-type));
if (!CP_TYPE_CONST_NON_VOLATILE_P (type)
 !TYPE_REF_IS_RVALUE (ref_type))
  {
@@ -7424,13 +7424,13 @@ is_subseq (conversion *ics1, conversion *ics2)
 
   while (ics1-kind == ck_rvalue
 || ics1-kind == ck_lvalue)
-ics1 = ics1-u.next;
+ics1 = next_conversion (ics1);
 
   while (1)
 {
   while (ics2-kind == ck_rvalue
 

Re: [PATCH] Fix PR 50971 and PR 35629: Only one loop detected when there should be two

2012-03-13 Thread Andrew Pinski
Ping?  Rebootstrapped on x86_64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

On Sat, Jan 21, 2012 at 1:21 PM, Andrew Pinski pins...@gmail.com wrote:
 The problem with these two bug reports is that the cfgloop does not do
 a good job for disambiguating some loops.  This patch rewrites
 find_subloop_latch_edge_by_ivs to be better.  It is able to detect
 much more loops and gets the ones which are referenced in PR 50971 and
 PR 35629.  It does make sure the loops it finds are really loops and
 not ones where the continue would cause a loop not to be done.

 OK for 4.8 when stage 1 comes?  Bootstrapped and tested on
 x86_64-linux-gnu with no regressions.

 ChangeLog:
 cfgloop.c (skip_to_exit): New function.
 (find_subloop_latch_edge_by_ivs): Rewrite to better detect subloop latches by
 IVs.  Also look at the cfg for those IVs to check for a better choice.

 testsuite/ChangeLog:
 * gcc.dg/tree-ssa/loop-25.c: Remove xfails and remove Found latch
 edge/Merged latch edges tests.
 * gcc.dg/tree-ssa/loop-38.c: New testcase.
Index: testsuite/gcc.dg/tree-ssa/loop-25.c
===
--- testsuite/gcc.dg/tree-ssa/loop-25.c (revision 183364)
+++ testsuite/gcc.dg/tree-ssa/loop-25.c (working copy)
@@ -120,10 +120,8 @@ void test5 (void)
 
 /* { dg-final { scan-tree-dump-times Disambiguating loop 5 
profile_estimate } } */
 /* For the following xfail marks, see PR35629.  */
-/* { dg-final { scan-tree-dump-times Found latch edge 5 profile_estimate { 
xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times Merged latch edges 2 profile_estimate 
{ xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times 4 loops found 2 profile_estimate { 
xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times 3 loops found 2 profile_estimate { 
xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times 2 loops found 1 profile_estimate { 
xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times 4 loops found 2 profile_estimate } } 
*/
+/* { dg-final { scan-tree-dump-times 3 loops found 2 profile_estimate } } 
*/
+/* { dg-final { scan-tree-dump-times 2 loops found 1 profile_estimate } } 
*/
 
 /* { dg-final { cleanup-tree-dump profile_estimate } } */
Index: testsuite/gcc.dg/tree-ssa/loop-38.c
===
--- testsuite/gcc.dg/tree-ssa/loop-38.c (revision 0)
+++ testsuite/gcc.dg/tree-ssa/loop-38.c (revision 0)
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options -O1 -fdump-tree-ch } */
+
+typedef struct basket
+{
+int *a;
+int cost;
+int abs_cost;
+} BASKET;
+BASKET *perm[50 +300 +1];
+
+
+int f(int a, int *b, int cut)
+{
+  do {
+  while (perm[a]-abs_cost  cut)
+a++;
+  a++;
+  } while (b[a]);
+  return a;
+}
+
+/* { dg-final { scan-tree-dump-times Disambiguating loop 1 ch } } */
+/* { dg-final { scan-tree-dump-times 3 loops found 1 ch } } */
+
+/* { dg-final { cleanup-tree-dump ch } } */
Index: cfgloop.c
===
--- cfgloop.c   (revision 183364)
+++ cfgloop.c   (working copy)
@@ -548,63 +548,200 @@ find_subloop_latch_edge_by_profile (VEC
   return me;
 }
 
+/* Return the basic block where we might be doing an exit from a loop
+   if we go back up the cfg starting at basic block B skipping other loops
+   on the way and join points too.  */
+static basic_block
+skip_to_exit (basic_block b, struct loop *loop, unsigned succ_edge_count)
+{
+  /* Skip to the begining of the loop if possible, we don't need to check
+ succ_edge count for loops. */
+  if (b-loop_father != loop)
+{
+  edge e;
+  edge_iterator ei;
+  edge preheader_e = NULL;
+
+  struct loop *oloop = b-loop_father;
+  /* There are multiple latches, we can't figure out the preheader,
+just return b. */
+  if (oloop-latch == NULL)
+   return NULL;
+  FOR_EACH_EDGE (e, ei, oloop-header-preds)
+if (e-src != oloop-latch  preheader_e == NULL)
+  preheader_e = e;
+   else if (e-src != oloop-latch  preheader_e != NULL)
+ {
+   preheader_e = NULL;
+   break;
+ }
+  /* Only one preheader edge.  */
+  if (preheader_e != NULL)
+return skip_to_exit (preheader_e-src, loop, 1);
+  else
+   return NULL;
+}
+  if (EDGE_COUNT (b-succs) != succ_edge_count)
+return b;
+  /* Skip basic blocks where it is just a passthrough. */
+  if (single_pred_p (b))
+return skip_to_exit (single_pred_edge (b)-src, loop, 1);
+  /* A join point, find the point where the join was from. */
+  /* FIXME should handle the case where we have more than two
+ predicates. */
+  if (EDGE_COUNT (b-preds) == 2)
+{
+  basic_block c, d;
+  if (EDGE_PRED (b, 0)-flags  EDGE_ABNORMAL
+ || EDGE_PRED (b, 1)-flags  EDGE_ABNORMAL)
+   return NULL;
+  c = skip_to_exit (EDGE_PRED (b, 0)-src, loop, 1);
+  if (c == NULL)
+   return NULL;
+  d = skip_to_exit 

[PATCH, i386]: Declare constant_call_address_operand as special predicate

2012-03-13 Thread Uros Bizjak
Hello!

Similar to tls_symbolic_operand and tls_modbase_operand, we are not
interested in the mode of the operand in the predicate.

2012-03-13  Uros Bizjak  ubiz...@gmail.com

* config/i386/predicates.md (constant_call_address_operand): Declare
as special predicate.  Update all uses.
* config/i386/i386.md: Remove mode from constant_call_address_operand
predicates.
* config/i386/i386.c (ix86_output_call_insn): Call
constant_call_address_operand with VOIDmode.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.
Index: i386.md
===
--- i386.md (revision 185341)
+++ i386.md (working copy)
@@ -12592,7 +12592,7 @@
(unspec:SI
 [(match_operand:SI 1 register_operand b)
  (match_operand 2 tls_symbolic_operand )
- (match_operand:SI 3 constant_call_address_operand z)]
+ (match_operand 3 constant_call_address_operand z)]
 UNSPEC_TLS_GD))
(clobber (match_scratch:SI 4 =d))
(clobber (match_scratch:SI 5 =c))
@@ -12617,7 +12617,7 @@
 [(set (match_operand:SI 0 register_operand )
  (unspec:SI [(match_operand:SI 2 register_operand )
  (match_operand 1 tls_symbolic_operand )
- (match_operand:SI 3 constant_call_address_operand )]
+ (match_operand 3 constant_call_address_operand )]
 UNSPEC_TLS_GD))
  (clobber (match_scratch:SI 4 ))
  (clobber (match_scratch:SI 5 ))
@@ -12626,8 +12626,8 @@
 (define_insn *tls_global_dynamic_64_mode
   [(set (match_operand:P 0 register_operand =a)
(call:P
-(mem:QI (match_operand:P 2 constant_call_address_operand z))
-(match_operand:P 3  )))
+(mem:QI (match_operand 2 constant_call_address_operand z))
+(match_operand 3  )))
(unspec:P [(match_operand 1 tls_symbolic_operand )]
 UNSPEC_TLS_GD)]
   TARGET_64BIT
@@ -12650,7 +12650,7 @@
   [(parallel
 [(set (match_operand:P 0 register_operand )
  (call:P
-  (mem:QI (match_operand:P 2 constant_call_address_operand ))
+  (mem:QI (match_operand 2 constant_call_address_operand ))
   (const_int 0)))
  (unspec:P [(match_operand 1 tls_symbolic_operand )]
   UNSPEC_TLS_GD)])]
@@ -12660,7 +12660,7 @@
   [(set (match_operand:SI 0 register_operand =a)
(unspec:SI
 [(match_operand:SI 1 register_operand b)
- (match_operand:SI 2 constant_call_address_operand z)]
+ (match_operand 2 constant_call_address_operand z)]
 UNSPEC_TLS_LD_BASE))
(clobber (match_scratch:SI 3 =d))
(clobber (match_scratch:SI 4 =c))
@@ -12685,7 +12685,7 @@
  [(set (match_operand:SI 0 register_operand )
   (unspec:SI
[(match_operand:SI 1 register_operand )
-(match_operand:SI 2 constant_call_address_operand )]
+(match_operand 2 constant_call_address_operand )]
UNSPEC_TLS_LD_BASE))
   (clobber (match_scratch:SI 3 ))
   (clobber (match_scratch:SI 4 ))
@@ -12694,8 +12694,8 @@
 (define_insn *tls_local_dynamic_base_64_mode
   [(set (match_operand:P 0 register_operand =a)
(call:P
-(mem:QI (match_operand:P 1 constant_call_address_operand z))
-(match_operand:P 2  )))
+(mem:QI (match_operand 1 constant_call_address_operand z))
+(match_operand 2  )))
(unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)]
   TARGET_64BIT
 {
@@ -12712,7 +12712,7 @@
   [(parallel
  [(set (match_operand:P 0 register_operand )
   (call:P
-   (mem:QI (match_operand:P 1 constant_call_address_operand ))
+   (mem:QI (match_operand 1 constant_call_address_operand ))
(const_int 0)))
   (unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)])]
   TARGET_64BIT)
@@ -12724,7 +12724,7 @@
   [(set (match_operand:SI 0 register_operand =a)
(plus:SI
 (unspec:SI [(match_operand:SI 1 register_operand b)
-(match_operand:SI 2 constant_call_address_operand z)]
+(match_operand 2 constant_call_address_operand z)]
UNSPEC_TLS_LD_BASE)
 (const:SI (unspec:SI
[(match_operand 3 tls_symbolic_operand )]
Index: i386.c
===
--- i386.c  (revision 185343)
+++ i386.c  (working copy)
@@ -23121,7 +23121,7 @@
 const char *
 ix86_output_call_insn (rtx insn, rtx call_op)
 {
-  bool direct_p = constant_call_address_operand (call_op, Pmode);
+  bool direct_p = constant_call_address_operand (call_op, VOIDmode);
   bool seh_nop_p = false;
   const char *xasm;
 
Index: predicates.md
===
--- predicates.md   (revision 185341)
+++ predicates.md   (working copy)
@@ -500,7 +500,7 @@
(match_test op == ix86_tls_module_base (
 
 ;; Test for a 

Re: [google] Add -gfission support to GCC (issue5754090)

2012-03-13 Thread Eric Botcazou
 I, for one, welcome our new nuclear overlords.

AFAICS the internal switch is called dwarf_split_debug_info so a short moniker 
based on it would be more understandable (and avoid a useless pomposity).

-- 
Eric Botcazou


Re: [google] Add -gfission support to GCC (issue5754090)

2012-03-13 Thread Cary Coutant
 I, for one, welcome our new nuclear overlords.

 AFAICS the internal switch is called dwarf_split_debug_info so a short moniker
 based on it would be more understandable (and avoid a useless pomposity).

I wasn't trying to be pompous! It's just our project name, but I
thought fission to be quite appropriate for what it does. How does
-gsplit or -gsplit-dwarf work for you?

-cary


Re: [google] Add -gfission support to GCC (issue5754090)

2012-03-13 Thread Xinliang David Li
On Tue, Mar 13, 2012 at 11:56 AM, Cary Coutant ccout...@google.com wrote:
 I, for one, welcome our new nuclear overlords.

 AFAICS the internal switch is called dwarf_split_debug_info so a short 
 moniker
 based on it would be more understandable (and avoid a useless pomposity).

 I wasn't trying to be pompous! It's just our project name, but I
 thought fission to be quite appropriate for what it does. How does
 -gsplit or -gsplit-dwarf work for you?

Or -gsplit-debug?

David

 -cary


Re: [PATCH, i386]: Handle subregs of AND zero extended address correctly

2012-03-13 Thread H.J. Lu
On Tue, Mar 13, 2012 at 9:21 AM, Uros Bizjak ubiz...@gmail.com wrote:
 Hello!

 We allow addresses, zero extended with (AND (Dimode OP)
 (0x0)). Since we now track address mode precisely, we should
 convert this operand to a SImode subreg before passing it further down
 of ix86_decompose_address function. This fixes a small hole, where
 operands in wrong mode could squeeze through.

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.c (ix86_decompose_address): Handle subregs of
        AND zero extended address correctly.

 Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

I think this caused:

FAIL: gcc.target/i386/pr43766.c scan-assembler-not lea[lq]?[ \t]

with -mx32 on Linux/x86-64.

-- 
H.J.


[committed] Fix up [sn]mmintrin.h

2012-03-13 Thread Jakub Jelinek
Hi!

I've noticed warnings on these two headers that /* is seen inside of
a comment.  Usually this is silenced because the headers are system headers,
but with -Wall -Wsystem-headers or when the dir with the headers
isn't -isystem this shows up.  Committed as obvious, queued for 4.7.1 and
4.6.4.

2012-03-13  Jakub Jelinek  ja...@redhat.com

* config/i386/smmintrin.h: Avoid /* within a comment.
* config/i386/nmmintrin.h: Likewise.

--- gcc/config/i386/smmintrin.h.jj  2011-04-12 09:37:53.0 +0200
+++ gcc/config/i386/smmintrin.h 2012-03-13 09:06:11.844794289 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
 
This file is part of GCC.
 
@@ -19,8 +19,7 @@
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-   http://www.gnu.org/licenses/.
-
+   http://www.gnu.org/licenses/.  */
 
 /* Implemented from the specification included in the Intel C++ Compiler
User Guide and Reference, version 10.0.  */
--- gcc/config/i386/nmmintrin.h.jj  2009-04-14 16:33:49.0 +0200
+++ gcc/config/i386/nmmintrin.h 2012-03-13 09:05:30.648036670 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2009, 2012 Free Software Foundation, Inc.
 
This file is part of GCC.
 
@@ -19,7 +19,7 @@
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-   http://www.gnu.org/licenses/.
+   http://www.gnu.org/licenses/.  */
 
 /* Implemented from the specification included in the Intel C++ Compiler
User Guide and Reference, version 10.0.  */

Jakub


[C PATCH] Fix -Wunused-but-set-* on __builtin_shuffle (PR c/52577)

2012-03-13 Thread Jakub Jelinek
Hi!

We weren't calling mark_exp_read on these and thus we got false positive
-Wunused-but-set-* warnings.

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

For trunk we should add __builtin_shuffle support even for C++ I'd say.

2012-03-13  Jakub Jelinek  ja...@redhat.com

PR c/52577
* c-parser.c (c_parser_postfix_expression)
case RID_BUILTIN_SHUFFLE: Call mark_exp_read on argument values.

* gcc.dg/Wunused-var-3.c: New test.

--- gcc/c-parser.c.jj   2012-01-02 20:39:55.0 +0100
+++ gcc/c-parser.c  2012-03-13 09:51:51.582984837 +0100
@@ -1,7 +1,7 @@
 /* Parser for C and Objective-C.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011,
+   2012 Free Software Foundation, Inc.
 
Parser actions based on the old Bison parser; structure somewhat
influenced by and fragments based on the C++ parser.
@@ -6647,6 +6647,8 @@ c_parser_postfix_expression (c_parser *p
case RID_BUILTIN_SHUFFLE:
  {
VEC(c_expr_t,gc) *cexpr_list;
+   unsigned int i;
+   c_expr_t *p;
 
c_parser_consume_token (parser);
if (!c_parser_get_builtin_args (parser,
@@ -6657,6 +6659,9 @@ c_parser_postfix_expression (c_parser *p
break;
  }
 
+   FOR_EACH_VEC_ELT (c_expr_t, cexpr_list, i, p)
+ mark_exp_read (p-value);
+
if (VEC_length (c_expr_t, cexpr_list) == 2)
  expr.value =
c_build_vec_perm_expr
--- gcc/testsuite/gcc.dg/Wunused-var-3.c.jj 2012-03-13 09:52:53.802619513 
+0100
+++ gcc/testsuite/gcc.dg/Wunused-var-3.c2012-03-13 09:53:00.589578859 
+0100
@@ -0,0 +1,34 @@
+/* PR c/52577 */
+/* { dg-do compile } */
+/* { dg-options -Wunused } */
+
+typedef int V __attribute__((vector_size (sizeof (int) * 4)));
+
+void
+f1 (V *p)
+{
+  V mask = { 1, 2, 3, 0 };
+  *p = __builtin_shuffle (*p, mask);
+}
+
+void
+f2 (V *p, V *q)
+{
+  V mask = { 1, 2, 3, 0 };
+  *p = __builtin_shuffle (*p, *q, mask);
+}
+
+void
+f3 (V *p, V *mask)
+{
+  V a = { 1, 2, 3, 0 };
+  *p = __builtin_shuffle (a, *mask);
+}
+
+void
+f4 (V *p, V *mask)
+{
+  V a = { 1, 2, 3, 0 };
+  V b = { 2, 3, 4, 1 };
+  *p = __builtin_shuffle (a, b, *mask);
+}

Jakub


Re: [PATCH, i386]: Handle subregs of AND zero extended address correctly

2012-03-13 Thread Uros Bizjak
On Tue, Mar 13, 2012 at 9:01 PM, H.J. Lu hjl.to...@gmail.com wrote:
 On Tue, Mar 13, 2012 at 9:21 AM, Uros Bizjak ubiz...@gmail.com wrote:
 Hello!

 We allow addresses, zero extended with (AND (Dimode OP)
 (0x0)). Since we now track address mode precisely, we should
 convert this operand to a SImode subreg before passing it further down
 of ix86_decompose_address function. This fixes a small hole, where
 operands in wrong mode could squeeze through.

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.c (ix86_decompose_address): Handle subregs of
        AND zero extended address correctly.

 Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

 I think this caused:

 FAIL: gcc.target/i386/pr43766.c scan-assembler-not lea[lq]?[ \t]

Ah, we also need to consider:

Failed to match this instruction:
(prefetch (and:DI (subreg:DI (plus:SI (ashift:SI (reg/v:SI 63 [ i ])
(const_int 2 [0x2]))
(subreg:SI (reg/v/f:DI 62 [ a ]) 0)) 0)
(const_int 4294967295 [0x]))
(const_int 0 [0])
(const_int 3 [0x3]))

Will fix tomorrow.

Thanks,
Uros.


Re: [PATCH, i386]: Handle subregs of AND zero extended address correctly

2012-03-13 Thread Uros Bizjak
On Tue, Mar 13, 2012 at 9:09 PM, Uros Bizjak ubiz...@gmail.com wrote:
 On Tue, Mar 13, 2012 at 9:01 PM, H.J. Lu hjl.to...@gmail.com wrote:
 On Tue, Mar 13, 2012 at 9:21 AM, Uros Bizjak ubiz...@gmail.com wrote:
 Hello!

 We allow addresses, zero extended with (AND (Dimode OP)
 (0x0)). Since we now track address mode precisely, we should
 convert this operand to a SImode subreg before passing it further down
 of ix86_decompose_address function. This fixes a small hole, where
 operands in wrong mode could squeeze through.

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.c (ix86_decompose_address): Handle subregs of
        AND zero extended address correctly.

 Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

 I think this caused:

 FAIL: gcc.target/i386/pr43766.c scan-assembler-not lea[lq]?[ \t]

 Ah, we also need to consider:

 Failed to match this instruction:
 (prefetch (and:DI (subreg:DI (plus:SI (ashift:SI (reg/v:SI 63 [ i ])
                    (const_int 2 [0x2]))
                (subreg:SI (reg/v/f:DI 62 [ a ]) 0)) 0)
        (const_int 4294967295 [0x]))
    (const_int 0 [0])
    (const_int 3 [0x3]))

Fixed by attached patch.

Committed.

Uros.

Index: i386.c
===
--- i386.c  (revision 185351)
+++ i386.c  (working copy)
@@ -11436,11 +11436,11 @@
  addr = XEXP (addr, 0);

  /* Adjust SUBREGs.  */
- if (GET_MODE (addr) == DImode)
+ if (GET_CODE (addr) == SUBREG
+  GET_MODE (SUBREG_REG (addr)) == SImode)
+   addr = SUBREG_REG (addr);
+ else if (GET_MODE (addr) == DImode)
addr = gen_rtx_SUBREG (SImode, addr, 0);
- else if (GET_CODE (addr) == SUBREG
-   GET_MODE (SUBREG_REG (addr)) == SImode)
-   addr = SUBREG_REG (addr);
  else
return 0;
}


[C++ PATCH] Fix udlit handling (PR c++/52521)

2012-03-13 Thread Jakub Jelinek
Hi!

As detailed in the PR, we would return
operator  _a (const char *)
when looking for 2 argument const char *, std::size_t literal
operator, because the first argument matched and we ran out of
arguments and didn't check we have them all.
The following patch fixes it.  Bootstrapped/regtested on x86_64-linux
and i686-linux, ok for trunk/4.7.1?

I'm not 100% sure what should be done if some of the literal
operators have default arguments.  In particular, e.g.
int operator  _a (const char *, std::size_t = 0);
int a = 123_a;
I think the above isn't raw literal operator and thus it should
be invalid rather than call operator  _a (123, 0), which would
be what we do with the patch below.  What about
int operator  _a (const char *);
int operator  _a (const char *, std::size_t = 0);
int a = 123_a;
?  Shall we just call oeprator  _a (123); or emit error that
we usually emit for:
int foo (const char *);
int foo (const char *, std::size_t = 0);
int a = foo (abc);
?

2012-03-09  Jakub Jelinek  ja...@redhat.com

PR c++/52521
* parser.c (lookup_literal_operator): Return fn only if
processed all arguments from args vector and argtypes is
void_list_node.

* g++.dg/cpp0x/udlit-args2.C: New test.

--- gcc/cp/parser.c.jj  2012-03-06 17:02:09.0 +0100
+++ gcc/cp/parser.c 2012-03-09 22:02:31.934359645 +0100
@@ -3581,7 +3581,9 @@ lookup_literal_operator (tree name, VEC(
   TREE_TYPE (tparm
found = false;
}
- if (found)
+ if (found
+  ix == VEC_length (tree, args)
+  argtypes == void_list_node)
return fn;
}
 }
--- gcc/testsuite/g++.dg/cpp0x/udlit-args2.C.jj 2012-03-09 22:07:56.138445779 
+0100
+++ gcc/testsuite/g++.dg/cpp0x/udlit-args2.C2012-03-09 22:08:37.742202965 
+0100
@@ -0,0 +1,15 @@
+// PR c++/52521
+// { dg-do compile }
+// { dg-options -std=c++11 }
+
+#include cstddef
+
+int operator  _a (const char *);
+int operator  _a (const char *, std::size_t);
+int a = 123_a;
+int a2 = abc_a;
+
+int operator  _b (const char *, std::size_t);
+int operator  _b (const char *);
+int b = 123_b;
+int b2 = abc_b;

Jakub


Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-13 Thread Mike Stump
On Mar 13, 2012, at 9:38 AM, Bernhard Reutner-Fischer wrote:
 Could some of the testsuite maintainers please eyeball?

I've eyed it, the only thing that stood out was:

-foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.F]] {
-if ![runtest_file_p $runtests $testcase] then {
-   continue
-}
-fortran-torture $testcase
-}
-
-foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.f90]] {
-if ![runtest_file_p $runtests $testcase] then {
-   continue
-}
-fortran-torture $testcase
-}

which, I hope does what you want.

Assuming you like those parts, Ok.

Since it touches non-fortran, please watch for and respond to any problems it 
might cause.


Re: [RFC]: Add support for pragma pointer_size

2012-03-13 Thread Gary Funck
On 03/06/12 14:09:23, Tristan Gingold wrote:
 The patch is simple: the C front-end will now calls
 c_build_pointer_type (instead of build_pointer_type), which in
 turn calls build_pointer_type_for_mode using the right mode.
[...]

Joining this discussion a bit late ... I have a few questions.
This change impacts the GUPC branch, mainly because UPC introduces
pointers that are generally larger than conventional C pointers,
and thus some changes were needed in the build pointer area,
and that logic needed to be adjusted to work with this patch.

Here is the new c_build_pointer_type.  It a static function
constrained to be called from within the c-decl.c file wehre
it resides.

static tree
c_build_pointer_type (tree to_type)
{
  addr_space_t as = to_type == error_mark_node? ADDR_SPACE_GENERIC
  : TYPE_ADDR_SPACE (to_type);
  enum machine_mode pointer_mode;

  if (as != ADDR_SPACE_GENERIC || c_default_pointer_mode == VOIDmode)
pointer_mode = targetm.addr_space.pointer_mode (as);
  else
pointer_mode = c_default_pointer_mode;
  return build_pointer_type_for_mode (to_type, pointer_mode, false);
}

Here is the old build_pointer_type() in tree.c.  It is external/public
and is called from various places.

tree
build_pointer_type (tree to_type)
{
  addr_space_t as = to_type == error_mark_node? ADDR_SPACE_GENERIC
  : TYPE_ADDR_SPACE (to_type);
  enum machine_mode pointer_mode = targetm.addr_space.pointer_mode (as);
  return build_pointer_type_for_mode (to_type, pointer_mode, false);
}

c_build_pointer_type () introduces c_default_pointer_mode
and uses it as long as:
   as == ADDR_SPACE_GENERIC  c_default_pointer_mode != VOIDmode
but build_pointer_type will not use c_default_pointer_mode.

My first question is: are there still contexts where build_pointer_type()
is called to compile C statements/expressions for cases not
covered by the calls within c-decl.c?  I ask, because we tried
moving our checks for UPC pointer-to-shared types from
build_pointer_type() into only c_build_pointer_type() and
ran into calls to build_pointer_type() that still passed
in UPC pointer-to-shared typed objects.  What this may
indicate is that there are situations where the new
c_default_pointer_mode may need to be applied when
build_pointer_type() is called.  I don't recall off-hand
when these situations came up, but it might be easy enough
to put some assertions in build_pointer_type() and then
run the C test suite and see what turns up.

Thus, I wonder if it might not be best to generalize
build_pointer_type() instead of introducing c_build_pointer_type()
and dealing with any C specific checks (somehow) there?

Thanks,
- Gary


libgo patch RFA: Fix handling of timex struct on ARM GNU/Linux

2012-03-13 Thread Ian Lance Taylor
This patch to libgo fixes the handling of the timex struct on ARM
GNU/Linux.  This is PR go/52557: a boostrap failure on ARM.
Bootstrapped on x86_64-unknown-linux-gnu (I don't have an ARM GNU/Linux
system).  Committed to mainline.

OK for 4.7 branch?

Ian

diff -r ca4aaf510222 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Fri Mar 09 00:20:49 2012 -0800
+++ b/libgo/mksysinfo.sh	Tue Mar 13 13:52:59 2012 -0700
@@ -834,7 +834,15 @@
  ${OUT}
 
 # The timex struct.
-grep '^type _timex ' gen-sysinfo.go | \
+timex=`grep '^type _timex ' gen-sysinfo.go || true`
+if test $timex = ; then
+  timex=`grep '^// type _timex ' gen-sysinfo.go || true`
+  if test $timex != ; then
+timex=`echo $timex | sed -e 's|// ||' -e 's/INVALID-bit-field/int32/g'`
+  fi
+fi
+if test $timex != ; then
+  echo $timex | \
 sed -e 's/_timex/Timex/' \
   -e 's/modes/Modes/' \
   -e 's/offset/Offset/' \
@@ -858,6 +866,7 @@
   -e 's/tai/Tai/' \
   -e 's/_timeval/Timeval/' \
  ${OUT}
+fi
 
 # The rlimit struct.
 grep '^type _rlimit ' gen-sysinfo.go | \


Re: [C PATCH] Fix -Wunused-but-set-* on __builtin_shuffle (PR c/52577)

2012-03-13 Thread Joseph S. Myers
On Tue, 13 Mar 2012, Jakub Jelinek wrote:

 2012-03-13  Jakub Jelinek  ja...@redhat.com
 
   PR c/52577
   * c-parser.c (c_parser_postfix_expression)
   case RID_BUILTIN_SHUFFLE: Call mark_exp_read on argument values.
 
   * gcc.dg/Wunused-var-3.c: New test.

OK.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: libgo patch RFA: Fix handling of timex struct on ARM GNU/Linux

2012-03-13 Thread Jakub Jelinek
On Tue, Mar 13, 2012 at 01:59:00PM -0700, Ian Lance Taylor wrote:
 This patch to libgo fixes the handling of the timex struct on ARM
 GNU/Linux.  This is PR go/52557: a boostrap failure on ARM.
 Bootstrapped on x86_64-unknown-linux-gnu (I don't have an ARM GNU/Linux
 system).  Committed to mainline.
 
 OK for 4.7 branch?

Ok.

Jakub


Re: [PATCH] PR c++/50852 - Revisit dependant template parameter

2012-03-13 Thread Jason Merrill

On 03/08/2012 08:21 AM, Dodji Seketeli wrote:

So I needed to say somehow that the P in the pack expansion
(in the pattern) is actually a Pr in spirit.


Ah, I see.


+/*we will fixup the siblings for


Space and capital W.


+get_root_index_same_level (tree index)
+{
+  tree i = index;
+
+  if (TREE_CODE (TEMPLATE_PARM_DECL (i)) == CONST_DECL)
+{
+  if (TEMPLATE_PARM_ORIG_LEVEL (i) == TEMPLATE_PARM_LEVEL (index))
+   i = TEMPLATE_PARM_ORIG_INDEX (i);


If the levels are the same, shouldn't the ORIG_INDEX already be the same 
as index?



+  else
+{
+  if (template_type_parameter_type_p (TREE_TYPE (i))
+  TREE_CODE (TEMPLATE_PARM_DECL (i)) != CONST_DECL
+  TYPE_CANONICAL (TREE_TYPE (i)) != NULL_TREE)


You already checked the TREE_CODE of TEMPLATE_PARM_DECL in the outer if. 
 And if it's not a CONST_DECL, it must be either a type parameter or 
template parameter.  So I think you only need the last test here.



+get_template_parameter_level_and_index (tree parameter, int *level, int *index)
+{
+  int l = 0, i = -1;
+  tree parm;
+
+  if (TREE_CODE (parameter) == TYPE_DECL
+  || TREE_CODE (parameter) == TEMPLATE_DECL)
+parm = TREE_TYPE (parameter);
+  else if (TREE_CODE (parameter) == PARM_DECL)
+parm = DECL_INITIAL (parameter);
+  else
+parm = parameter;
+
+  template_parm_level_and_index (parm, l, i);


Why not extend template_parm_level_and_index to handle these cases as well?


+properly appends the descender of INDEX to that


descendant


+  if (*where == NULL_TREE)
+   TREE_VEC_ELT (TEMPLATE_PARM_DESCENDANTS (index),
+ TEMPLATE_PARM_LEVEL (descendant) - 1) = descendant;


Why not *where = descendant?


+  (DECL_SOURCE_LOCATION (TEMPLATE_PARM_DECL (result))
+ != DECL_SOURCE_LOCATION (TEMPLATE_PARM_DECL (orig_index
+   {
+ /*  We have gotten an equivalent index, that was reduced
+ from index from ORIG_INDEX, but which (location of)
+ DECL is different.  This can lead to having error
+ messages pointing to the wrong location, so let's
+ build an equivalent TEMPLATE_PARM_INDEX with a DECL
+ pointing to the same location as ORIG_INDEX for
+ RESULT.  */


How can this happen?  Hmm, I guess it's because of


+   i = TEMPLATE_TYPE_PARM_INDEX (TYPE_CANONICAL (TREE_TYPE (i)));


Why do we want to go to the canonical type parameter (which has no name) 
rather than just TYPE_MAIN_VARIANT?


I think it makes more sense to reduce the index we have, rather than 
reduce the canonical index and then adjust the result to match the index 
we have.



+  /* Template parms ought to be fixed-up from left to right.  */
+  parms = nreverse (parms);


I'm a bit nervous about something called by fixup getting confused by 
this change to the template parms before we change it back.



+/*  Transform a template parameter into an argument, suitable to be
+passed to tsubst as an element of its ARGS parameter.  */
+
+static tree
+template_parms_to_args (tree parms)


The comment seems to be talking about a single parm.


+  /* This can happen for template parms of a template template
+parameter, e.g:
+
+templatetemplateclass T, class U class TT struct S;
+
+Consider the level of the parms of TT; T and U both have
+level 2; TT has no template parm of level 1. So in this case
+the first element of full_template_args is NULL_TREE. If we
+leave it like this TMPL_ARG_DEPTH on args returns 1 instead
+of 2. This will make tsubst wrongly consider that T and U
+have level 1. Instead, let's create a dummy vector as the
+first element of full_template_args so that TMPL_ARG_DEPTH
+returns the correct depth for args.  */


Hmm, it seems odd that the parms wouldn't have level 1.  I wonder if 
changing that would also avoid needing to use structural equality for 
template template parameters.



   FIXME: This function does an approximation, as it only checks that
   the levels of PARM_PACK/EXPANSION and ARG_PACK do match.  For it to
   be precise, I think the TEMPLATE_PARM_INDEX of PARM_PACK should
   track its pre-fixup type, so that ARG_PACK could be compared with
   that type instead.  But that would increase the size of the
   template_parm_index_s struct, as I don't see where else I could
   store the pre-fixup type.  */


Doesn't ...ORIG_INDEX work for this?  Indeed, I'd think you could change 
arg_from_parm_pack_p to compare ORIG_INDEX and then it would handle both 
cases.



+  if (tinfo  TREE_CODE (TI_TEMPLATE (tinfo)) == TEMPLATE_DECL)
+   {
+ ++processing_template_decl;
+ /* prepare possible partial instantiation of member
+template by fixing-up template parms which level are
+going to be reduced by the partial instantiation.  */
+ 

[patch libffi SH] Fix failures for libffi.call/err_bad_abi.c

2012-03-13 Thread Kaz Kojima
Hi,

I've applied the attached patch which fixes failures for
libffi.call/err_bad_abi.c on SH.  It's similar to the changes
done already on other targets.  Tested on sh-linux.

Regards,
kaz
--
2012-03-13  Kaz Kojima  kkoj...@gcc.gnu.org

* src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
just return FFI_BAD_ABI when things are wrong.
* src/sh64/ffi.c (ffi_prep_closure_loc): Ditto.

diff -upr ORIG/trunk/libffi/src/sh/ffi.c trunk/libffi/src/sh/ffi.c
--- ORIG/trunk/libffi/src/sh/ffi.c  2009-06-06 13:12:01.0 +0900
+++ trunk/libffi/src/sh/ffi.c   2012-03-12 22:06:43.0 +0900
@@ -1,5 +1,5 @@
 /* ---
-   ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima
+   ffi.c - Copyright (c) 2002-2008, 2012 Kaz Kojima
Copyright (c) 2008 Red Hat, Inc.

SuperH Foreign Function Interface 
@@ -463,7 +463,8 @@ ffi_prep_closure_loc (ffi_closure* closu
   unsigned int *tramp;
   unsigned int insn;
 
-  FFI_ASSERT (cif-abi == FFI_GCC_SYSV);
+  if (cif-abi != FFI_SYSV)
+return FFI_BAD_ABI;
 
   tramp = (unsigned int *) closure-tramp[0];
   /* Set T bit if the function returns a struct pointed with R2.  */
diff -upr ORIG/trunk/libffi/src/sh64/ffi.c trunk/libffi/src/sh64/ffi.c
--- ORIG/trunk/libffi/src/sh64/ffi.c2009-06-06 13:12:00.0 +0900
+++ trunk/libffi/src/sh64/ffi.c 2012-03-12 22:07:28.0 +0900
@@ -1,5 +1,5 @@
 /* ---
-   ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima
+   ffi.c - Copyright (c) 2003, 2004, 2006, 2007, 2012 Kaz Kojima
Copyright (c) 2008 Anthony Green

SuperH SHmedia Foreign Function Interface 
@@ -302,7 +302,8 @@ ffi_prep_closure_loc (ffi_closure *closu
 {
   unsigned int *tramp;
 
-  FFI_ASSERT (cif-abi == FFI_GCC_SYSV);
+  if (cif-abi != FFI_SYSV)
+return FFI_BAD_ABI;
 
   tramp = (unsigned int *) closure-tramp[0];
   /* Since ffi_closure is an aligned object, the ffi trampoline is


libgo patch RFA: Export {enter,exit}syscall

2012-03-13 Thread Ian Lance Taylor
The cooperative threading model used by Go works by calling entersyscall
whenever we are about to make a call to a C function that may block.
That was not being done for a call to getaddrinfo used when doing a DNS
lookup.  This patch fixes that problem by exporting the entersyscall and
exitsyscall functions from the syscall package.  Exporting a function in
Go is done by naming it with a capital letter, so this patch simply
consistently renames the entersyscall and exitsyscall functions and all
their uses.  This will also be useful for SWIG, which faces a similar
issue.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

OK for 4.7 branch?

Thanks.

Ian

diff -r 89c0a966e4d6 libgo/go/net/cgo_unix.go
--- a/libgo/go/net/cgo_unix.go	Tue Mar 13 13:54:11 2012 -0700
+++ b/libgo/go/net/cgo_unix.go	Tue Mar 13 15:56:25 2012 -0700
@@ -75,7 +75,10 @@
 	}
 
 	s := syscall.StringBytePtr(service)
-	if libc_getaddrinfo(nil, s, hints, res) == 0 {
+	syscall.Entersyscall()
+	gerrno := libc_getaddrinfo(nil, s, hints, res)
+	syscall.Exitsyscall()
+	if gerrno == 0 {
 		defer libc_freeaddrinfo(res)
 		for r := res; r != nil; r = r.Ai_next {
 			switch r.Ai_family {
@@ -108,7 +111,9 @@
 	hints.Ai_flags = int32((syscall.AI_ALL | syscall.AI_V4MAPPED | syscall.AI_CANONNAME)  cgoAddrInfoMask())
 
 	h := syscall.StringBytePtr(name)
+	syscall.Entersyscall()
 	gerrno := libc_getaddrinfo(h, nil, hints, res)
+	syscall.Exitsyscall()
 	if gerrno != 0 {
 		var str string
 		if gerrno == syscall.EAI_NONAME {
diff -r 89c0a966e4d6 libgo/go/syscall/libcall_linux.go
--- a/libgo/go/syscall/libcall_linux.go	Tue Mar 13 13:54:11 2012 -0700
+++ b/libgo/go/syscall/libcall_linux.go	Tue Mar 13 15:56:25 2012 -0700
@@ -202,13 +202,13 @@
 	} else {
 		p = (*byte)(unsafe.Pointer(_zero))
 	}
-	entersyscall()
+	Entersyscall()
 	r1, _, errno := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(len(buf)))
 	n = int(r1)
 	if n  0 {
 		err = errno
 	}
-	exitsyscall()
+	Exitsyscall()
 	return
 }
 
diff -r 89c0a966e4d6 libgo/go/syscall/libcall_support.go
--- a/libgo/go/syscall/libcall_support.go	Tue Mar 13 13:54:11 2012 -0700
+++ b/libgo/go/syscall/libcall_support.go	Tue Mar 13 15:56:25 2012 -0700
@@ -6,7 +6,7 @@
 
 package syscall
 
-func entersyscall()
-func exitsyscall()
+func Entersyscall()
+func Exitsyscall()
 func GetErrno() Errno
 func SetErrno(Errno)
diff -r 89c0a966e4d6 libgo/go/syscall/mksyscall.awk
--- a/libgo/go/syscall/mksyscall.awk	Tue Mar 13 13:54:11 2012 -0700
+++ b/libgo/go/syscall/mksyscall.awk	Tue Mar 13 15:56:25 2012 -0700
@@ -190,7 +190,7 @@
 }
 
 if (blocking) {
-	print \tentersyscall()
+	print \tEntersyscall()
 }
 
 printf(\t)
@@ -240,7 +240,7 @@
 }
 
 if (blocking) {
-	print \texitsyscall()
+	print \tExitsyscall()
 }
 
 if (gofnresults != ) {
diff -r 89c0a966e4d6 libgo/go/syscall/syscall_unix.go
--- a/libgo/go/syscall/syscall_unix.go	Tue Mar 13 13:54:11 2012 -0700
+++ b/libgo/go/syscall/syscall_unix.go	Tue Mar 13 15:56:25 2012 -0700
@@ -30,7 +30,7 @@
 // the arguments, so that we don't pass a 64-bit value when the function
 // expects a 32-bit one.
 func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
-	entersyscall()
+	Entersyscall()
 	var r uintptr
 	if unsafe.Sizeof(r) == 4 {
 		r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3), 0, 0, 0)
@@ -40,12 +40,12 @@
 		r = uintptr(r1)
 	}
 	err = GetErrno()
-	exitsyscall()
+	Exitsyscall()
 	return r, 0, err
 }
 
 func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
-	entersyscall()
+	Entersyscall()
 	var r uintptr
 	if unsafe.Sizeof(r) == 4 {
 		r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3),
@@ -57,7 +57,7 @@
 		r = uintptr(r1)
 	}
 	err = GetErrno()
-	exitsyscall()
+	Exitsyscall()
 	return r, 0, err
 }
 
diff -r 89c0a966e4d6 libgo/runtime/runtime.h
--- a/libgo/runtime/runtime.h	Tue Mar 13 13:54:11 2012 -0700
+++ b/libgo/runtime/runtime.h	Tue Mar 13 15:56:25 2012 -0700
@@ -298,8 +298,8 @@
 void	runtime_tsleep(int64);
 M*	runtime_newm(void);
 void	runtime_goexit(void);
-void	runtime_entersyscall(void) __asm__(libgo_syscall.syscall.entersyscall);
-void	runtime_exitsyscall(void) __asm__(libgo_syscall.syscall.exitsyscall);
+void	runtime_entersyscall(void) __asm__(libgo_syscall.syscall.Entersyscall);
+void	runtime_exitsyscall(void) __asm__(libgo_syscall.syscall.Exitsyscall);
 void	siginit(void);
 bool	__go_sigsend(int32 sig);
 int32	runtime_callers(int32, uintptr*, int32);


[Patch, fortran] PR 49010/24518 MOD/MODULO fixes

2012-03-13 Thread Janne Blomqvist
Hi,

the attached patch implements a few fixes and cleanups for the MOD and
MODULO intrinsics.

- When the arguments are constant, use mpfr_fmod instead of the naive
algorithms which are numerically unstable for large arguments. This
extends the PR 24518 fix to constant arguments as well, and makes the
compile-time evaluation match the runtime implementation which also
uses fmod in the same manner.

- Remove the old fallback path for the case builtin_fmod is not
available, as the builtin is AFAICS always available.

The patch does not per se fix the corner-case bug as reported in PR
49010, in fact it makes it worse in a way as with the patch the result
if the arguments are parameters is the same as the runtime result
(previously, the compile-time result was correct). But, I think we
should leave it as it is. Due to the reasons above, we're not using
the naive algorithms anyway, and IMHO -0.0 is quite a good
approximation for +0.0 anyway. One might even argue that due to the
numerical instability, specifying the naive algorithms is a bug in the
standard.

The patch adds notes to the documentation about the usage of fmod, so
users interested in corner-case behavior can look up how that function
is supposed to behave on their target. FWIW, AFAICS MPFR and glibc
fmod conform to the behavior specified in C99 Annex F.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?

2012-03-14  Janne Blomqvist  j...@gcc.gnu.org

PR fortran/49010
PR fortran/24518
* intrinsic.texi (MOD,MODULO): Mention usage of fmod instead of
naive algorithm.
* simplify.c (gfc_simplify_mod): Use mpfr_fmod.
(gfc_simplify_modulo): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_mod): Remove fallback as
builtin_fmod is always available.


-- 
Janne Blomqvist
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 294818e..171c5d2 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -8991,8 +8991,7 @@ cases, the result is of the same type and kind as @var{ARRAY}.
 
 @table @asis
 @item @emph{Description}:
-@code{MOD(A,P)} computes the remainder of the division of A by P@. It is
-calculated as @code{A - (INT(A/P) * P)}.
+@code{MOD(A,P)} computes the remainder of the division of A by P@. 
 
 @item @emph{Standard}:
 Fortran 77 and later
@@ -9011,8 +9010,14 @@ equal to zero
 @end multitable
 
 @item @emph{Return value}:
-The kind of the return value is the result of cross-promoting
-the kinds of the arguments.
+The return value is the result of @code{A - (INT(A/P) * P)}. The kind
+of the return value is the result of cross-promoting the kinds of the
+arguments.
+
+@item @emph{Note}:
+The obvious algorithm as specified above is unstable for large real
+inputs. Hence, for real inputs the result is calculated by using the
+@code{fmod} function in the C math library.
 
 @item @emph{Example}:
 @smallexample
@@ -9082,6 +9087,11 @@ The type and kind of the result are those of the arguments.
 @end table
 In all cases, if @var{P} is zero the result is processor-dependent.
 
+@item @emph{Note}:
+The obvious algorithm as specified above is unstable for large real
+inputs. Hence, for real inputs the result is based on using the
+@code{fmod} function in the C math library.
+
 @item @emph{Example}:
 @smallexample
 program test_modulo
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 706dab4..7e3bc8c 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4222,7 +4222,6 @@ gfc_expr *
 gfc_simplify_mod (gfc_expr *a, gfc_expr *p)
 {
   gfc_expr *result;
-  mpfr_t tmp;
   int kind;
 
   if (a-expr_type != EXPR_CONSTANT || p-expr_type != EXPR_CONSTANT)
@@ -4254,12 +4253,8 @@ gfc_simplify_mod (gfc_expr *a, gfc_expr *p)
 	  }
 
 	gfc_set_model_kind (kind);
-	mpfr_init (tmp);
-	mpfr_div (tmp, a-value.real, p-value.real, GFC_RND_MODE);
-	mpfr_trunc (tmp, tmp);
-	mpfr_mul (tmp, tmp, p-value.real, GFC_RND_MODE);
-	mpfr_sub (result-value.real, a-value.real, tmp, GFC_RND_MODE);
-	mpfr_clear (tmp);
+	mpfr_fmod (result-value.real, a-value.real, p-value.real, 
+		   GFC_RND_MODE);
 	break;
 
   default:
@@ -4274,7 +4269,6 @@ gfc_expr *
 gfc_simplify_modulo (gfc_expr *a, gfc_expr *p)
 {
   gfc_expr *result;
-  mpfr_t tmp;
   int kind;
 
   if (a-expr_type != EXPR_CONSTANT || p-expr_type != EXPR_CONSTANT)
@@ -4308,12 +4302,12 @@ gfc_simplify_modulo (gfc_expr *a, gfc_expr *p)
 	  }
 
 	gfc_set_model_kind (kind);
-	mpfr_init (tmp);
-	mpfr_div (tmp, a-value.real, p-value.real, GFC_RND_MODE);
-	mpfr_floor (tmp, tmp);
-	mpfr_mul (tmp, tmp, p-value.real, GFC_RND_MODE);
-	mpfr_sub (result-value.real, a-value.real, tmp, GFC_RND_MODE);
-	mpfr_clear (tmp);
+	mpfr_fmod (result-value.real, a-value.real, p-value.real, 
+		   GFC_RND_MODE);
+	if ((mpfr_cmp_ui (result-value.real, 0) != 0)
+	 (mpfr_signbit (a-value.real) != mpfr_signbit (p-value.real)))
+	  mpfr_add (result-value.real, result-value.real, p-value.real,
+		GFC_RND_MODE);
 	break;
 
 

[SH] Fix PR 49468 testcases

2012-03-13 Thread Oleg Endo
Hi,

The attach patch just swaps the dg directive lines for the PR 49468
testcases.  Having 'dg-skip-if' as the first directive doesn't seem to
work and always gets ignored.

OK to apply?

Cheers,
Oleg

testsuite/ChangeLog

PR target/49468
* gcc.target/sh/pr49468-si.c: Make dg-skip-if not the first
directive.
* gcc.target/sh/pr49468-di.c: Likewise.
Index: gcc/testsuite/gcc.target/sh/pr49468-si.c
===
--- gcc/testsuite/gcc.target/sh/pr49468-si.c	(revision 185360)
+++ gcc/testsuite/gcc.target/sh/pr49468-si.c	(working copy)
@@ -1,8 +1,8 @@
 /* Check that 32 bit integer abs is generated as neg instruction and
conditional branch instead of default branch-free code.  */
-/* { dg-skip-if  { sh*-*-* } { -m5*} {  } }  */
 /* { dg-do compile { target sh*-*-* } } */
 /* { dg-options -O1 } */
+/* { dg-skip-if  { sh*-*-* } { -m5*} {  } }  */
 /* { dg-final { scan-assembler-times neg 2 } } */
 
 
Index: gcc/testsuite/gcc.target/sh/pr49468-di.c
===
--- gcc/testsuite/gcc.target/sh/pr49468-di.c	(revision 185360)
+++ gcc/testsuite/gcc.target/sh/pr49468-di.c	(working copy)
@@ -1,8 +1,8 @@
 /* Check that 64 bit integer abs is generated as negc instruction pairs
and conditional branch instead of default branch-free code.  */
-/* { dg-skip-if  { sh*-*-* } { -m5*} {  } }  */
 /* { dg-do compile { target sh*-*-* } } */
 /* { dg-options -O1 } */
+/* { dg-skip-if  { sh*-*-* } { -m5*} {  } }  */
 /* { dg-final { scan-assembler-times negc 4 } } */
 
 


Re: [google] Add -gfission support to GCC (issue5754090)

2012-03-13 Thread Diego Novillo

On 13/03/12 15:43 , Xinliang David Li wrote:

On Tue, Mar 13, 2012 at 11:56 AM, Cary Coutantccout...@google.com  wrote:

I, for one, welcome our new nuclear overlords.


AFAICS the internal switch is called dwarf_split_debug_info so a short moniker
based on it would be more understandable (and avoid a useless pomposity).


I wasn't trying to be pompous! It's just our project name, but I
thought fission to be quite appropriate for what it does. How does
-gsplit or -gsplit-dwarf work for you?


Or -gsplit-debug?

David


You guys are boring ;)



Re: [PATCH, i386]: Declare constant_call_address_operand as special predicate

2012-03-13 Thread H.J. Lu
On Tue, Mar 13, 2012 at 11:42 AM, Uros Bizjak ubiz...@gmail.com wrote:
 Hello!

 Similar to tls_symbolic_operand and tls_modbase_operand, we are not
 interested in the mode of the operand in the predicate.

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/predicates.md (constant_call_address_operand): Declare
        as special predicate.  Update all uses.
        * config/i386/i386.md: Remove mode from constant_call_address_operand
        predicates.
        * config/i386/i386.c (ix86_output_call_insn): Call
        constant_call_address_operand with VOIDmode.

 Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.


gcc.c-torture/compile/20020129-1.c fails to compile with -mx32 -O:

[hjl@gnu-6 gcc]$ ./xgcc -B./ -mx32
/export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
-S -O
/export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:
In function \u2018foo\u2019:
/export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:17:1:
error: unrecognizable insn:
(call_insn 10 9 11 3 (set (reg:SI 0 ax)
(call (mem:QI (symbol_ref:SI (a.1707) [flags 0x2] var_decl
0x715a01e0 a) [0 *a.0_1 S1 A8])
(const_int 0 [0])))
/export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:16
-1
 (nil)
(expr_list:REG_BR_PRED (use (reg:SI 5 di))
(nil)))
/export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:17:1:
internal compiler error: in extract_insn, at recog.c:2123
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.
[hjl@gnu-6 gcc]$


-- 
H.J.


4.7 version of c99status.html

2012-03-13 Thread Joseph S. Myers
I've created the 4.7 version of c99status.html and made the 4.7 branch 
manual refer to it instead of the mainline version of the page.  Doc patch 
tested with make info html pdf.

Index: c99status.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/c99status.html,v
retrieving revision 1.57
diff -u -r1.57 c99status.html
--- c99status.html  18 Mar 2011 17:47:35 -  1.57
+++ c99status.html  13 Mar 2012 23:11:10 -
@@ -21,6 +21,7 @@
 
 pThis page describes the C99 support in mainline GCC, not in any
 particular release.  Information is also available on a
+href=gcc-4.7/c99status.htmlC99 support in GCC 4.7/a, a
 href=gcc-4.6/c99status.htmlC99 support in GCC 4.6/a, a
 href=gcc-4.5/c99status.htmlC99 support in GCC 4.5/a, a
 href=gcc-4.4/c99status.htmlC99 support in GCC 4.4/a, a
Index: gcc-4.7/c99status.html
===
RCS file: gcc-4.7/c99status.html
diff -N gcc-4.7/c99status.html
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gcc-4.7/c99status.html  13 Mar 2012 23:11:10 -
@@ -0,0 +1,372 @@
+html
+
+head
+titleStatus of C99 features in GCC 4.7/title
+/head
+
+body
+h1Status of C99 features in GCC 4.7/h1
+
+pThis table is based on the list in the foreword to a
+href=http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf;N1256/a
+(ISO/IEC 9899:1999 (E), consolidated with ISO/IEC 9899:1999/Cor.1:2001
+(E), ISO/IEC 9899:1999/Cor.2:2004 (E) and ISO/IEC 9899:1999/Cor.3:2007
+(E))./p
+
+pWhere Library Issue is listed in conjunction with some other
+status, this means that some compiler support is needed for the
+library support, or desirable in conjunction with it.  Note that the
+headers required of conforming freestanding implementations (clause 4
+paragraph 6) do not count as library issues./p
+
+pThis page describes the C99 support in GCC 4.7.  Information on a
+href=../c99status.htmlC99 support in mainline GCC/a is also
+available./p
+
+pSee below the table for further notes on some issues./p
+
+table border=1
+trthFeature/th
+thLibrary Issue/th
+thDone/th
+thBroken/th
+thMissing/th
+/tr
+
+trtdemrestricted character set support via digraphs and
+br /codelt;iso646.hgt;/code (originally specified in 
AMD1)/em/td
+td/td
+tdDone/tdtd/tdtd/td
+/tr
+
+trtdemwide character library support in
+codelt;wchar.hgt;/codebr /and codelt;wctype.hgt;/code
+(originally specified in AMD1)/em/td
+tdLibrary Issue/td
+td/tdtd/tdtdMissing/td
+/tr
+
+trtdemmore precise aliasing rules via effective type/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemrestricted pointers/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemvariable-length arrays/em/td
+td/tdtdDone/tdtd/td
+td/td
+/tr
+
+trtdemflexible array members/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdemcodestatic/code and type qualifiersbr /in parameter array 
declarators/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdemcomplex (and imaginary) support in 
codelt;complex.hgt;/code/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdemtype-generic math macros in codelt;tgmath.hgt;/code/em/td
+tdLibrary Issue/td
+tdDone/tdtd/tdtd/td
+/tr
+
+trtdemthe codelong long int/code type and library functions/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemincreased minimum translation limits/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemadditional floating-point characteristicsbr /in 
codelt;float.hgt;/code/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemremove implicit codeint/code/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemreliable integer division/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdemuniversal character names (code\u/code and 
code\U/code)/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdemextended identifiers/em/td
+td/tdtd/tdtd/tdtdMissing/td
+/tr
+
+trtdemhexadecimal floating-point constants and
+code%a/codebr / and code%A/code
+codeprintf/code/codescanf/code conversion specifiers/em/td
+tdLibrary Issue/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemcompound literals/em/td
+td/tdtdDone/tdtd/td
+td/td
+/tr
+
+trtdemdesignated initializers/em/td
+td/tdtdDone/tdtd/td
+td/td
+/tr
+
+trtdemcode///code comments/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdemlibrary functions in codelt;inttypes.hgt;/code/em/td
+tdLibrary Issue/td
+td/tdtd/tdtd/td
+/tr
+
+trtdemextended integer types in codelt;stdint.hgt;/code/em/td
+td/td
+td/tdtd/tdtdMissing/td
+/tr
+
+trtdemremove implicit function declaration/em/td
+td/tdtdDone/td
+td/tdtd/td
+/tr
+
+trtdempreprocessor arithmeticbr /done in 
codeintmax_t/code/codeuintmax_t/code/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdemmixed declarations and code/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdemnew block scopes for selectionbr /and iteration 
statements/em/td
+td/tdtdDone/tdtd/tdtd/td
+/tr
+
+trtdeminteger constant type 

Update contrib/gennews for 4.7

2012-03-13 Thread Joseph S. Myers
I've applied this patch to contrib/gennews on trunk and 4.7 branch to make 
it include release notes for 4.7 in the files it processes.  (Checking 
this file is in the release checklist, but updating it in advance means 
one fewer thing that could be missed when making the final release.)

Index: ChangeLog
===
--- ChangeLog   (revision 185364)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2012-03-13  Joseph Myers  jos...@codesourcery.com
+
+   * gennews (files): Add files for GCC 4.7.
+
 2012-03-12  Rainer Orth  r...@cebitec.uni-bielefeld.de
 
* config-list.mk (LIST): Remove mips-openbsd.
Index: gennews
===
--- gennews (revision 185364)
+++ gennews (working copy)
@@ -3,8 +3,8 @@
 # Script to generate the NEWS file from online release notes.
 # Contributed by Joseph Myers js...@cam.ac.uk.
 #
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010, 2011
-# Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010, 2011,
+# 2012 Free Software Foundation, Inc.
 # This file is part of GCC.
 #
 # GCC is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
 
 website=http://gcc.gnu.org/
 files=
+gcc-4.7/index.html gcc-4.7/changes.html
 gcc-4.6/index.html gcc-4.6/changes.html
 gcc-4.5/index.html gcc-4.5/changes.html
 gcc-4.4/index.html gcc-4.4/changes.html

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [SH] Fix PR 49468 testcases

2012-03-13 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 The attach patch just swaps the dg directive lines for the PR 49468
 testcases.  Having 'dg-skip-if' as the first directive doesn't seem to
 work and always gets ignored.
 
 OK to apply?

OK.

Regards,
kaz


Re: [C++ PATCH] Fix udlit handling (PR c++/52521)

2012-03-13 Thread Jason Merrill

On 03/13/2012 04:17 PM, Jakub Jelinek wrote:

I'm not 100% sure what should be done if some of the literal
operators have default arguments.


I'm not, either.  Please add a comment about that; perhaps the 
comparison to void_list_node should be a call to sufficient_parms_p.


OK with the added comment; I'll open a DR.

Jason