Re: [PATCH] Fix PR63798

2014-11-10 Thread Václav Zeman
On 10 November 2014 10:55, Richard Biener wrote:
>
>
> The following patch fixes a latent bug uncovered by stmt folding
> that expansion of FMA_EXPR didn't consider the multiplication
> commutative when looking for feeding negates.
>
> Bootstrap & regtest pending.
>
> Richard.
>
> 2014-11-10  Richard Biener  
>
> PR middle-end/63798
> * expr.c (expand_expr_real_2): When expanding FMA_EXPRs
> properly treat the embedded multiplication as commutative
> when looking for feeding negates.
>
> Index: gcc/expr.c
> ===
> --- gcc/expr.c  (revision 217281)
> +++ gcc/expr.c  (working copy)
> @@ -8621,6 +8621,19 @@ expand_expr_real_2 (sepops ops, rtx targ
>   }
>
> def0 = get_def_for_expr (treeop0, NEGATE_EXPR);
> +   /* The multiplication is commutative - look at its 2nd operand
> +  if the first isn't fed by a negate.  */
> +   if (!def0)
> + {
> +   def0 = get_def_for_expr (treeop1, NEGATE_EXPR);
> +   /* Swap operands if the 2nd operand is fed by a negate.  */
> +   if (def0)
> + {
> +   tree tem = treeop0;
> +   treeop0 = treeop1;
> +   treeop1 = tem;

What about using std::swap() maybe?

> + }
> + }
> def2 = get_def_for_expr (treeop2, NEGATE_EXPR);
>
> op0 = op2 = NULL;


-- 
VZ


Re: [PATCH 2/2] Autogenerated part of introduction of GCC_OPTION macro

2014-05-09 Thread Václav Zeman
On 9.5.2014 23:14, David Malcolm wrote:
> This patch is 2.2MB in size, so I've uploaded it to:
> http://dmalcolm.fedorapeople.org/gcc/large-patches/6fb783b39f914574a1889aa51d06c08cf55678b4-0002-Autogenerated-part-of-introduction-of-GCC_OPTION-mac.patch
> 
> (even just the ChangeLog would be 160KB)
> 

I have only skimmed through the patch but I have found one replacement
that does not seem correct:

> diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
> index a6afb6c..d03cdfb 100644
> --- a/gcc/config/rs6000/rs6000.h
> +++ b/gcc/config/rs6000/rs6000.h
> @@ -394,13 +394,13 @@ extern const char *host_detect_local_cpu (int argc, 
> const char **argv);
>| MASK_DEBUG_TARGET \
>| MASK_DEBUG_BUILTIN)
>  
> -#define  TARGET_DEBUG_STACK  (rs6000_debug & MASK_DEBUG_STACK)
> -#define  TARGET_DEBUG_ARG(rs6000_debug & MASK_DEBUG_ARG)

The above two lines are replaced...

> -#define TARGET_DEBUG_REG (rs6000_debug & MASK_DEBUG_REG)
> -#define TARGET_DEBUG_ADDR(rs6000_debug & MASK_DEBUG_ADDR)
> -#define TARGET_DEBUG_COST(rs6000_debug & MASK_DEBUG_COST)
> -#define TARGET_DEBUG_TARGET  (rs6000_debug & MASK_DEBUG_TARGET)
> -#define TARGET_DEBUG_BUILTIN (rs6000_debug & MASK_DEBUG_BUILTIN)
> +#define  GCC_OPTION (TARGET_DEBUG_STACK) (GCC_OPTION (rs6000_debug) & 
> MASK_DEBUG_STACK)
> +#define  GCC_OPTION (TARGET_DEBUG_ARG)   (GCC_OPTION (rs6000_debug) & 
> MASK_DEBUG_ARG)

...by the lines above. That does not seem right.

> +#define TARGET_DEBUG_REG (GCC_OPTION (rs6000_debug) & MASK_DEBUG_REG)
> +#define TARGET_DEBUG_ADDR(GCC_OPTION (rs6000_debug) & MASK_DEBUG_ADDR)
> +#define TARGET_DEBUG_COST(GCC_OPTION (rs6000_debug) & MASK_DEBUG_COST)
> +#define TARGET_DEBUG_TARGET  (GCC_OPTION (rs6000_debug) & MASK_DEBUG_TARGET)
> +#define TARGET_DEBUG_BUILTIN (GCC_OPTION (rs6000_debug) & MASK_DEBUG_BUILTIN)
>  
>  /* Describe the vector unit used for arithmetic operations.  */
>  extern enum rs6000_vector rs6000_vector_unit[];

-- 
VZ




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] remove nolonger needed {cgraph,varpool}_node_{,asm_}name () functions

2013-11-07 Thread Václav Zeman
On 11/07/2013 01:58 AM, tsaund...@mozilla.com wrote:
> From: Trevor Saunders 
>
> Hi,
>
> I admit its another c++ification, but the functions are useless, and if I'm
> changing the name of the called function its just easier to drop the class 
> name
> bit all together.
>
> Trev
>
>[...]
> diff --git a/gcc/cgraph.h b/gcc/cgraph.h
> index 4f93713..754d245 100644
> --- a/gcc/cgraph.h
> +++ b/gcc/cgraph.h
> @@ -44,6 +44,12 @@ class GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"),
>symtab_node
>  {
>  public:
> +  /* Return name.  */
> +  const char *name () const;
> +
> +  /* Return asm name.  */
> +const char * asm_name () const;
> +
Missing indentation?

-- 
VZ


Re: C++14 digit separators..

2013-10-28 Thread Václav Zeman
On 10/28/2013 03:51 AM, Ed Smith-Rowland wrote:
> Here is an implementation for C++14 digit separators (single quote).
> 
> It's still testing on x86_64-linux but I wanted to give folks a chance
> to check it out.
> 
> Ed
> 
> Index: gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C
> ===
> --- gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C(revision 0)
> +++ gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C(working copy)
> @@ -0,0 +1,17 @@
> +// { dg-options -std=c++1y }
> +
> +#define assert(E) if(!(E))__builtin_abort();
> +
> +int
> +main()
> +{
> +  (1048576 == 1048''576);
> +  (1048576 == 0X'10);
> +  (1048576 == 0x'10);
> +  (1048576 == 0'004'000'000);
> +  (1048576 == 0B1);
> +  (1048576 == 0b0001''''');
> +
> +  (1.'602'176'565e-19 == 1.602176565e-19);
> +  (1.602'176'565e'-19 == 1.602176565e-19);
> +}
These tests seem to be missing the 'assert' there.

-- 
VZ




signature.asc
Description: OpenPGP digital signature


Re: [Patch-v2] Adjustments for Windows x64 SEH

2012-06-21 Thread Václav Zeman
On 21 June 2012 09:48, Tristan Gingold wrote:
> Here is the new version.  It is now possible to use __builtin_frame_address 
> (0) to get the current establisher frame thanks to a tiny adjustment.
>
> No regressions on x86_64-linux, and an x86_64-windows native gdb can be built 
> and run.
>
> Tristan.
> [...]
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index ddb3645..44533e0 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -729,6 +729,18 @@ enum target_cpu_default
>  /* Boundary (in *bits*) on which the incoming stack is aligned.  */
>  #define INCOMING_STACK_BOUNDARY ix86_incoming_stack_boundary
>
> +/* According to Windows x64 software convention, the maximum stack 
> allocatable
> +   in the prologue is 4G - 8 bytes.  Furthermore, there is a limited set of
> +   instructions allowed to adjust the stack pointer in the epilog, forcing 
> the
> +   use of frame pointer for frames larger than 2 GB.  This theorical limit
> +   is reduced by 256, an over-estimated upper bound for the stack use by the
> +   prologue.
> +   We define only one threshold for both the prolog and the epilog.  When the
> +   frame size is larger than this threshold, we allocate the are to save SSE
A typo there? s/the are/the area/

> +   regs, then save them, and then allocate the remaining.  There is no SEH
> +   unwind info for this later allocation.  */
> +#define SEH_MAX_FRAME_SIZE ((2U << 30) - 256)
> [...]

-- 
VZ