Re: [x86, 3/n] Replace builtins with vector extensions

2014-11-09 Thread Uros Bizjak
On Sat, Nov 8, 2014 at 1:47 PM, Marc Glisse marc.gli...@inria.fr wrote:
 Hello,

 this patch mechanically extends +-* for integer vectors of size 256 and
 512 (the previous patch only handled 128).

 Regtested together with the next patch.

 2014-11-10  Marc Glisse  marc.gli...@inria.fr

 * config/i386/avxintrin.h (__v4du, __v8su, __v16hu, __v32qu):
 New typedefs.
 * config/i386/avx512fintrin.h (__v8du, __v16su, __v32hu, __v64qu):
 Likewise.
 (_mm512_mullo_epi32, _mm512_add_epi64, _mm512_sub_epi64,
 _mm512_add_epi32, _mm512_sub_epi32): Use vector extensions
 instead of builtins.
 * config/i386/avx2intrin.h (_mm256_add_epi8, _mm256_add_epi16,
 _mm256_add_epi32, _mm256_add_epi64, _mm256_mullo_epi16,
 _mm256_mullo_epi32, _mm256_sub_epi8, _mm256_sub_epi16,
 _mm256_sub_epi32, _mm256_sub_epi64): Likewise.
 * config/i386/avx512bwintrin.h (_mm512_mullo_epi16, _mm512_add_epi8,
 _mm512_sub_epi8, _mm512_sub_epi16, _mm512_add_epi16): Likewise.
 * config/i386/avx512dqintrin.h (_mm512_mullo_epi64): Likewise.
 * config/i386/avx512vldqintrin.h (_mm256_mullo_epi64,
 _mm_mullo_epi64):
 Likewise.

OK.

Uros.


Re: [RFC, C] add warning for unpromoted bit-field uses

2014-11-09 Thread Marc Glisse

On Sat, 8 Nov 2014, Sandra Loosemore wrote:

+   warning_at (EXPR_LOCATION (exp), OPT_Wbitfield_conversion,
+   suggest casting bit-field to its declared type);

I think it would be nice to print this declared type. It can be done 
directly in this message, or by adding a note that points to the 
declaration. (I don't think the fix-it functions have been added yet)


--
Marc Glisse


Re: [RFC, C] add warning for unpromoted bit-field uses

2014-11-09 Thread Manuel López-Ibáñez
 We had a request from a customer to add a warning to the C front end to
 diagnose cases where bit-fields larger than an int are used in shift
 expressions; confusingly, the operation is done in the precision of the
 bit-field size rather than its declared type. This is a symptom of a larger
 problem, of course, as it affects bit-field uses in other expressions
 besides shifts, too.


 The C standard specifies that bit-fields have an integral type of the
 specified number of bits. On the other hand, in C++, bit-fields do have
 their declared type, so it seems appropriate to tie the new proposed warning
 to -Wc++-compat.

The message:
 +warning_at (EXPR_LOCATION (exp), OPT_Wbitfield_conversion,
 +suggest casting bit-field to its declared type);

is not very clear without the context of your email. Could it explain
what is (or could) be wrong? For example, ISO C specifies that this
bit-field is implicitly converted to type %qT rather than its declared
type (%qT). And a note at lhs location could say use an explicit
cast to silence this warning.

Nonetheless, perhaps I'm missing something but Wconversion seems to
think that the promotion of sp-a and sp-c is always to 'int':

test.c:17:10: warning: conversion to 'long long unsigned int' from
'int' may change the sign of the result [-Wsign-conversion]
   temp = sp-a  1;
  ^
test.c:18:10: warning: conversion to 'long long unsigned int' from
'int' may change the sign of the result [-Wsign-conversion]
   temp = sp-a + 1;
  ^
test.c:19:10: warning: conversion to 'long long unsigned int' from
'int' may change the sign of the result [-Wsign-conversion]
   temp = sp-a * 2;
  ^
test.c:28:10: warning: conversion to 'long long unsigned int' from
'int' may change the sign of the result [-Wsign-conversion]
   temp = sp-c  1;  /* { dg-warning suggest casting bit-field to
its declared type } */
  ^
test.c:29:10: warning: conversion to 'long long unsigned int' from
'int' may change the sign of the result [-Wsign-conversion]
   temp = sp-c + 1;  /* { dg-warning suggest casting bit-field to
its declared type } */
  ^
test.c:30:10: warning: conversion to 'long long unsigned int' from
'int' may change the sign of the result [-Wsign-conversion]
   temp = sp-c * 2;  /* { dg-warning suggest casting bit-field to
its declared type } */
  ^

And clang (mostly) agrees:

test.c:17:16: warning: implicit conversion changes signedness: 'int'
to 'unsigned long long' [-Wsign-conversion]
  temp = sp-a  1;
   ~ ~~^~~~
test.c:28:16: warning: implicit conversion changes signedness: 'int'
to 'unsigned long long' [-Wsign-conversion]
  temp = sp-c  1;  /* { dg-warning suggest casting bit-field to
its declared type } */
   ~ ~~^~~~

Cheers,

Manuel.


[PATCH][13/n] Merge from match-and-simplify, more conversion patterns

2014-11-09 Thread Richard Biener

This moves the two-conversions-in-a-row foldings from fold_unary to
patterns.  This exposed a bug in the genmatch code-gen which failed
to check whether we may follow SSA use-def chains for the outermost
expression operands which is fixed by this patch as well.

I've XFAILed g++.dg/cpp0x/constexpr-reinterpret1.C as Jason told me
and I've also XFAILed gcc.dg/tree-ssa/pr21031.c for now which is
still optimized but needs the 2nd forwprop pass (due to the fact
that a single-use check is confused by dead code that is now left
around by fold_stmt as opposed to the manual simplification done
by tree-ssa-forwprop.c).  I have opened PR63790 to track them
and the XFAIL of pr21031 should resolve itself after more patterns
are merged from the branch.

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

Richard.

2014-11-09  Richard Biener  rguent...@suse.de

* match.pd: Add patterns convering two conversions in a row
from fold-const.c.
* fold-const.c (fold_unary_loc): Remove them here.
* tree-ssa-forwprop.c (combine_conversions): Likewise.
* genmatch.c (dt_node::gen_kids): Check whether we may
follow SSA use-def chains.

* g++.dg/cpp0x/constexpr-reinterpret1.C: XFAIL.
* gcc.dg/tree-ssa/pr21031.c: XFAIL.

Index: trunk/gcc/fold-const.c
===
*** trunk.orig/gcc/fold-const.c 2014-11-07 17:52:10.615694814 +0100
--- trunk/gcc/fold-const.c  2014-11-07 18:00:02.757674153 +0100
*** fold_unary_loc (location_t loc, enum tre
*** 7692,7785 
   constant_boolean_node (false, type));
}
  
-   /* Handle cases of two conversions in a row.  */
-   if (CONVERT_EXPR_P (op0))
-   {
- tree inside_type = TREE_TYPE (TREE_OPERAND (op0, 0));
- tree inter_type = TREE_TYPE (op0);
- int inside_int = INTEGRAL_TYPE_P (inside_type);
- int inside_ptr = POINTER_TYPE_P (inside_type);
- int inside_float = FLOAT_TYPE_P (inside_type);
- int inside_vec = TREE_CODE (inside_type) == VECTOR_TYPE;
- unsigned int inside_prec = TYPE_PRECISION (inside_type);
- int inside_unsignedp = TYPE_UNSIGNED (inside_type);
- int inter_int = INTEGRAL_TYPE_P (inter_type);
- int inter_ptr = POINTER_TYPE_P (inter_type);
- int inter_float = FLOAT_TYPE_P (inter_type);
- int inter_vec = TREE_CODE (inter_type) == VECTOR_TYPE;
- unsigned int inter_prec = TYPE_PRECISION (inter_type);
- int inter_unsignedp = TYPE_UNSIGNED (inter_type);
- int final_int = INTEGRAL_TYPE_P (type);
- int final_ptr = POINTER_TYPE_P (type);
- int final_float = FLOAT_TYPE_P (type);
- int final_vec = TREE_CODE (type) == VECTOR_TYPE;
- unsigned int final_prec = TYPE_PRECISION (type);
- int final_unsignedp = TYPE_UNSIGNED (type);
- 
- /* In addition to the cases of two conversions in a row
-handled below, if we are converting something to its own
-type via an object of identical or wider precision, neither
-conversion is needed.  */
- if (TYPE_MAIN_VARIANT (inside_type) == TYPE_MAIN_VARIANT (type)
-  (((inter_int || inter_ptr)  final_int)
- || (inter_float  final_float))
-  inter_prec = final_prec)
-   return fold_build1_loc (loc, code, type, TREE_OPERAND (op0, 0));
- 
- /* Likewise, if the intermediate and initial types are either both
-float or both integer, we don't need the middle conversion if the
-former is wider than the latter and doesn't change the signedness
-(for integers).  Avoid this if the final type is a pointer since
-then we sometimes need the middle conversion.  Likewise if the
-final type has a precision not equal to the size of its mode.  */
- if (((inter_int  inside_int)
-  || (inter_float  inside_float)
-  || (inter_vec  inside_vec))
-  inter_prec = inside_prec
-  (inter_float || inter_vec
- || inter_unsignedp == inside_unsignedp)
-  ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type))
-TYPE_MODE (type) == TYPE_MODE (inter_type))
-  ! final_ptr
-  (! final_vec || inter_prec == inside_prec))
-   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.  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)
- || final_prec == inter_prec))
- 

[match-and-simplify] Merge from trunk

2014-11-09 Thread Richard Biener

2014-11-09  Richard Biener  rguent...@suse.de

Merge from trunk r217075 through r217260.

Brings back next merge piece.



gnu11 fallout: powerpc

2014-11-09 Thread Andreas Schwab
Tested on powerpc64-suse-linux and committed as obvious.

Andreas.

* gcc.target/powerpc/pr51623.c: Fix implicit declarations.

diff --git a/gcc/testsuite/gcc.target/powerpc/pr51623.c 
b/gcc/testsuite/gcc.target/powerpc/pr51623.c
index 2ac118c..0e13463 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr51623.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr51623.c
@@ -16,6 +16,7 @@ struct mtd_info {
 };
 
 extern int strcmp(const char *,const char *);
+extern int strncmp(const char *,const char *,size_t);
 extern char * strchr(const char *,int);
 
 struct cmd_tbl_s {
@@ -24,13 +25,17 @@ struct cmd_tbl_s {
 
 
 int printf(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2)));
+int putc (int);
 void* malloc(size_t);
 void free(void*);
 
+extern unsigned long simple_strtoul(const char *,char **,unsigned int);
 
 extern int nand_curr_device;
 extern struct mtd_info nand_info[];
 
+extern void cmd_usage(struct cmd_tbl_s *);
+
 static int nand_dump(struct mtd_info *nand, unsigned long off, int only_oob)
 {
   int i;
-- 
2.1.3

-- 
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: [PATCH] Don't bootstrap libcc1

2014-11-09 Thread Iain Sandoe
Jack, Dominique,

I think we have two issues here - let's make sure we don't derail dealing with 
the first one.

On 8 Nov 2014, at 22:08, Jack Howarth wrote:

That is curious. I wouldn't have thought that the compiler
 selection would have had such a radical effect on the linkage flags
 emitted for the build directories.
  Jack
 
 
 On Sat, Nov 8, 2014 at 4:59 PM, Dominique d'Humières domi...@lps.ens.fr 
 wrote:
 
 Le 8 nov. 2014 à 22:55, Jack Howarth howarth.at@gmail.com a écrit :
 
 Iain,
Any idea why this isn't failing universally? On all of the
 machines tested here with 'make bootstrap', the linkage of libcc1.so
 finds
 the necessary libstdc++ from the set of flags...
 
 -L/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/x86_64-apple-darwin13.4.0/libstdc++-v3/src
 -L/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/x86_64-apple-darwin13.4.0/libstdc++-v3/src/.libs
 -L/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/x86_64-apple-darwin13.4.0/libstdc++-v3/libsupc++/.libs
 
 as I posted earlier in this thread. Why wouldn't Dominique be getting
 those emitted in his build and shouldn't they suffice?
 Jack
 
 Because you bootstrap with clang (I confirm it) while I am bootstrapping 
 with gcc 4.9 for Ada.

We all agree that it's not obvious that the bootstrap compiler should make any 
difference to this.

Looking at the logs for my trunk build from last night:
 * x86_64-darwin12
 * bootstrap compiler = gcc-4.9
 * trunk checkout 217252
 * with alias fix for ipa-icf
 * with a temporary mod to put -B options for libstdc++ and libsupc++ for 
libcc1.
 * all langs including objc++, java and Ada.

- The [libcc1] config is using the stage#3 compiler (according to 
libcc1/config.log)
- The [libcc1] build is using the stage#3 compiler as far as my build logs 
record.
- my stage3 gcc/auto-host.h does not differ in any material way from the 
stage1-gcc/suto-host.h

So I think we need to do some analysis; in particular, the config and build 
logs for libcc1 when clang is the bootstrap compiler.  Let's take this off-list 
and raise a PR if we find a separate problem.



As for the initial reported problem here, my analysis remains the same - we 
need to provide -B options for the libraries that are mentioned, so that spec 
substitutution works.

Iain



Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-11-09 Thread Chen Gang

At present, I use simplified sshd, ssh and scp (dropbear open source
program) to communicate with microblaze qemu successfully, and let gcc
'make check' have real effect.

It is just testing, at least after almost 10 hours, the log output is
OK. For each ssh login, it will wast 10 - 20 seconds, so I guess, the
make check may run a week!!  The recent operations is below:

 - zlib (for dropbear):

   export CHOST=microblaze-gchen-linux
   export PATH=/upstream/release/bin:$PATH
   ./configure --prefix=/upstream/release  make  make install

 - dropbear (it is a simple sshd, ssh and scp):

   export PATH=/upstream/release/bin:$PATH
   ./configure --prefix=/upstream/release \
 --host=microblaze-gchen-linux \
 CC=microblaze-gchen-linux-gcc

   modify /ustream/release/include/stdio.h to avoid redefining sscanf to
   iso99_sscanf

   link libz.a (static lib) to 'dropbear' (sshd) and 'dbclient' (ssh).
   and make scp to generate 'scp' command.

   for supporting 'none' username:

 under ramfs, echo 'none:x:0:0:none:/:/bin/sh'  ./etc/passwd

   for supporting no passwords (it is temporary fix):

 modify  common-session.c: ses.authstate.pw_passwd[0] = '\0';

   put 'dropbear', 'dbclient' and 'scp' to ./sbin of ramfs and symbol
   links to ./usr/bin of ramfs.

   for temporary fix its stable issue, need modify code to let it 'fork'
   as soon as startup, and only permit one child connection each time.

   usage:

 in microblaze qemu:

   /sbin/dropbear -F -E -B -p 192.168.122.2:22

 in host (x86_64), use system scp and ssh is OK (without password):

   ssh none@192.168.122.2 cd /test; ./test
   scp test.c none@192.168.122.2:/test/
   scp none@192.168.122.2:/test/* ./

 - For dejagnu:

   need `echo 192.168.122.2   microblaze-xilinx-gdb  /etc/hosts`
   under /usr/local/share/dejagnu/*, use ssh/scp instead of rsh/rcp.
 (need replace all, or will cause failure during make check).
   for /usr/local/share/dejagnu/baseboards/microblaze-xilinx-gdb.exp,
   need add additional variables:

 set_board_info sockethost 192.168.122.2
 set_board_info username none
 set timeout 600

Current left issues are:

 - Linux kernel built by current upstream microblaze toolchain will be
   dead lock. I shall analyze it (I guess it may be kernel self issue,
   which may caused by include/compiler-gcc5.h).

 - One patch for qemu microblaze dtb file, just checking by related
   members (originally I though it was kernel issue, but after
   communicate with kernel members, it is more suitable to change qemu).

 - One or more issues for dropbear (at least include stable issues), and
   one or more issues for glibc. Sorry for I have to bypass them, since
   I have no enough time resource on it.


Welcome any ideas, suggestions or completions.

Thanks.


On 11/01/2014 01:07 AM, Chen Gang wrote:
 
 At present, I use telnet (without password), login to microblaze qemu
 successfully!  :-)
 
  - I compile busy box with the glibc in orginal 'ramfs', so get telnetd:
use new busybox replace the old one, and add symbol link 'telnetd' to
busybox in /bin.
 
  - configure qemu with network support (device xlnx.xps-ethernetlite).
 
yum install libvirt
yum install tunctl
tunctl -b
ip link set tap0 up
brctl addif virbr0 tap0
./microblaze-softmmu/qemu-system-microblaze -M petalogix-s3adsp1800 \
  -kernel ../linux-stable.microblaze/arch/microblaze/boot/linux.bin \
  -no-reboot -append console=ttyUL0,115200 doreboot -nographic \
  -net nic,vlan=0,model=xlnx.xps-ethernetlite,macaddr=00:16:35:AF:94:00 \
  -net tap,vlan=0,ifname=tap0,script=no,downscript=no
 
  - fix a kernel bug: add xlnx,xps-ethernetlite-2.00.b for compatible
with its firmware (can find it under /sys/firmware/compatible,
within microblaze qemu bash environments). Related diff:
 
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c 
 b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 28dbbdc..298fad3 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1236,6 +1236,7 @@ static struct of_device_id xemaclite_of_match[] = {
{ .compatible = xlnx,opb-ethernetlite-1.01.b, },
{ .compatible = xlnx,xps-ethernetlite-1.00.a, },
{ .compatible = xlnx,xps-ethernetlite-2.00.a, },
+   { .compatible = xlnx,xps-ethernetlite-2.00.b, },
{ .compatible = xlnx,xps-ethernetlite-2.01.a, },
{ .compatible = xlnx,xps-ethernetlite-3.00.a, },
{ /* end of list */ },
 
 Next, I shall send related kernel patch for upstream kernel, and continue
 for microbaze DejaGNU with microbaze qemu, and sorry again, I did not
 finish it within this month.
 
 
 Thanks.
 
 
 On 10/30/14 22:04, Chen Gang wrote:
 On 10/29/14 23:58, Chen Gang wrote:
 On 10/27/14 9:42, Chen Gang wrote:
 On 10/27/14 2:22, Michael Eager wrote:

 Microblaze-sim provides basic instruction 

Re: [PATCH][Revisedx2] Fix PR63750

2014-11-09 Thread Iain Sandoe
Hi Jack,

comments below apply also to the patch for PR63699

On 7 Nov 2014, at 17:13, Jack Howarth wrote:

  The attached revised patch eliminates the compilation error...
 
 error: use of undeclared
  identifier 'do_not_use_toupper_with_safe_ctype'
 
 on x86_64-apple-darwin14 when bootstrapping using the Clang 6.0
 compiler by moving the include for strings earlier.
  Okay for gcc trunk?
  Jack
 PR63750_v3.patch

Since you have two instances of this (and given that the other required headers 
are included in system.h)
ISTM, that the right place for this (and the fix for PR63699) is in system.h 
with appropriate guards for cplusplus and an explanation of why the fix is 
needed.

Need to make sure we're not just burying some other problem, right?
0.02GBP as always
Iain

2014-10-07  Jack Howarth howarth.at@gmail.com

PR other/63750
* gcc/ipa-chkp.c: Include string earlier.

In any event, if the existing patch is preferred by the maintainers,  please 
make this ^ something like 
Include string before system.h 
to give to poor reader some idea of what the change was about ;)



[x86, 5/n] Replace builtins with vector extensions

2014-11-09 Thread Marc Glisse

Hello,

|^ of size 256 and 512. Regtested with 6/n.

2014-11-10  Marc Glisse  marc.gli...@inria.fr

* config/i386/avx2intrin.h (_mm256_and_si256, _mm256_or_si256,
_mm256_xor_si256): Use vector extensions instead of builtins.
* config/i386/avx512fintrin.h (_mm512_or_si512, _mm512_or_epi32,
_mm512_or_epi64, _mm512_xor_si512, _mm512_xor_epi32, _mm512_xor_epi64,
_mm512_and_si512, _mm512_and_epi32, _mm512_and_epi64): Likewise.


--
Marc GlisseIndex: avx2intrin.h
===
--- avx2intrin.h(revision 217262)
+++ avx2intrin.h(working copy)
@@ -171,21 +171,21 @@ _mm256_alignr_epi8 (__m256i __A, __m256i
 #define _mm256_alignr_epi8(A, B, N)   \
   ((__m256i) __builtin_ia32_palignr256 ((__v4di)(__m256i)(A), \
(__v4di)(__m256i)(B),  \
(int)(N) * 8))
 #endif
 
 extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_and_si256 (__m256i __A, __m256i __B)
 {
-  return (__m256i) __builtin_ia32_andsi256 ((__v4di)__A, (__v4di)__B);
+  return (__m256i) ((__v4du)__A  (__v4du)__B);
 }
 
 extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_andnot_si256 (__m256i __A, __m256i __B)
 {
   return (__m256i) __builtin_ia32_andnotsi256 ((__v4di)__A, (__v4di)__B);
 }
 
 extern __inline __m256i
@@ -569,21 +569,21 @@ extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_mul_epu32 (__m256i __A, __m256i __B)
 {
   return (__m256i)__builtin_ia32_pmuludq256 ((__v8si)__A, (__v8si)__B);
 }
 
 extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_or_si256 (__m256i __A, __m256i __B)
 {
-  return (__m256i)__builtin_ia32_por256 ((__v4di)__A, (__v4di)__B);
+  return (__m256i) ((__v4du)__A | (__v4du)__B);
 }
 
 extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_sad_epu8 (__m256i __A, __m256i __B)
 {
   return (__m256i)__builtin_ia32_psadbw256 ((__v32qi)__A, (__v32qi)__B);
 }
 
 extern __inline __m256i
@@ -890,21 +890,21 @@ extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_unpacklo_epi64 (__m256i __A, __m256i __B)
 {
   return (__m256i)__builtin_ia32_punpcklqdq256 ((__v4di)__A, (__v4di)__B);
 }
 
 extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_xor_si256 (__m256i __A, __m256i __B)
 {
-  return (__m256i)__builtin_ia32_pxor256 ((__v4di)__A, (__v4di)__B);
+  return (__m256i) ((__v4du)__A ^ (__v4du)__B);
 }
 
 extern __inline __m256i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_stream_load_si256 (__m256i const *__X)
 {
   return (__m256i) __builtin_ia32_movntdqa256 ((__v4di *) __X);
 }
 
 extern __inline __m128
Index: avx512fintrin.h
===
--- avx512fintrin.h (revision 217262)
+++ avx512fintrin.h (working copy)
@@ -6774,36 +6774,28 @@ _mm512_maskz_moveldup_ps (__mmask16 __U,
   return (__m512) __builtin_ia32_movsldup512_mask ((__v16sf) __A,
   (__v16sf)
   _mm512_setzero_ps (),
   (__mmask16) __U);
 }
 
 extern __inline __m512i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm512_or_si512 (__m512i __A, __m512i __B)
 {
-  return (__m512i) __builtin_ia32_pord512_mask ((__v16si) __A,
-   (__v16si) __B,
-   (__v16si)
-   _mm512_undefined_si512 (),
-   (__mmask16) -1);
+  return (__m512i) ((__v16su) __A | (__v16su) __B);
 }
 
 extern __inline __m512i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm512_or_epi32 (__m512i __A, __m512i __B)
 {
-  return (__m512i) __builtin_ia32_pord512_mask ((__v16si) __A,
-   (__v16si) __B,
-   (__v16si)
-   _mm512_undefined_si512 (),
-   (__mmask16) -1);
+  return (__m512i) ((__v16su) __A | (__v16su) __B);
 }
 
 extern __inline __m512i
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm512_mask_or_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
 {
   return (__m512i) __builtin_ia32_pord512_mask ((__v16si) __A,
(__v16si) __B,
(__v16si) __W,
(__mmask16) __U);

RFA: fix avr C++ preprocessing to pick up device defines

2014-11-09 Thread Joern Rennecke
The defaults.h definition of
#define CPLUSPLUS_CPP_SPEC CPP_SPEC
does not do the right thing with the cpp spec picked up from a spec file,
which is now needed for -mmcu processing.
Also, a spec file can't override CPLUSPLUS_CPP_SPEC as such, since
that string is hard-coded into the compiler.
By setting CPLUSPLUS_CPP_SPEC to %(cpp), we let the cc1plus
preprocessor look up the actual value of the preprocessor specs.

OK to apply?
2014-11-09  Joern Rennecke  joern.renne...@embecosm.com

* /config/avr/avr.h (CPLUSPLUS_CPP_SPEC): Define.

diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 0b48423..46ed0a4 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -505,6 +505,10 @@ typedef struct avr_args
 #define DRIVER_SELF_SPECS  %{mmcu=*:-specs=device-specs/specs-%*%s %mmcu=*} 
 #define CPP_SPEC 
 
+/* We want cc1plus used as a preprocessor to pick up the cpp spec from the
+   per-device spec files  */
+#define CPLUSPLUS_CPP_SPEC %(cpp)
+
 #define CC1_SPEC 
 
 #define CC1PLUS_SPEC %{!frtti:-fno-rtti} \


[x86, 6/n] Replace builtins with vector extensions

2014-11-09 Thread Marc Glisse

Hello,

  and == for integer vectors of size 128. I was surprised not to find 
_mm_cmplt_epi64 anywhere. Note that I can do the same for size 256, but 
not 512, there is no corresponding intrinsic, there are only _mask 
versions that return a mask.


For gcc-5, we should stop either after 5/n or after 7/n (avx2 version of 
6/n).


Regtested with 5/n.

2014-11-10  Marc Glisse  marc.gli...@inria.fr

* config/i386/emmintrin.h (_mm_cmpeq_epi8, _mm_cmpeq_epi16,
_mm_cmpeq_epi32, _mm_cmplt_epi8, _mm_cmplt_epi16, _mm_cmplt_epi32,
_mm_cmpgt_epi8, _mm_cmpgt_epi16, _mm_cmpgt_epi32): Use vector
extensions instead of builtins.
* config/i386/smmintrin.h (_mm_cmpeq_epi64, _mm_cmpgt_epi64):
Likewise.


--
Marc GlisseIndex: emmintrin.h
===
--- emmintrin.h (revision 217263)
+++ emmintrin.h (working copy)
@@ -1268,69 +1268,69 @@ _mm_or_si128 (__m128i __A, __m128i __B)
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_xor_si128 (__m128i __A, __m128i __B)
 {
   return (__m128i) ((__v2du)__A ^ (__v2du)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmpeq_epi8 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpeqb128 ((__v16qi)__A, (__v16qi)__B);
+  return (__m128i) ((__v16qi)__A == (__v16qi)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmpeq_epi16 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpeqw128 ((__v8hi)__A, (__v8hi)__B);
+  return (__m128i) ((__v8hi)__A == (__v8hi)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmpeq_epi32 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpeqd128 ((__v4si)__A, (__v4si)__B);
+  return (__m128i) ((__v4si)__A == (__v4si)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmplt_epi8 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__B, (__v16qi)__A);
+  return (__m128i) ((__v16qi)__A  (__v16qi)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmplt_epi16 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__B, (__v8hi)__A);
+  return (__m128i) ((__v8hi)__A  (__v8hi)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmplt_epi32 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__B, (__v4si)__A);
+  return (__m128i) ((__v4si)__A  (__v4si)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmpgt_epi8 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__A, (__v16qi)__B);
+  return (__m128i) ((__v16qi)__A  (__v16qi)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmpgt_epi16 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__A, (__v8hi)__B);
+  return (__m128i) ((__v8hi)__A  (__v8hi)__B);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmpgt_epi32 (__m128i __A, __m128i __B)
 {
-  return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__A, (__v4si)__B);
+  return (__m128i) ((__v4si)__A  (__v4si)__B);
 }
 
 #ifdef __OPTIMIZE__
 extern __inline int __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_extract_epi16 (__m128i const __A, int const __N)
 {
   return (unsigned short) __builtin_ia32_vec_ext_v8hi ((__v8hi)__A, __N);
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
Index: smmintrin.h
===
--- smmintrin.h (revision 217259)
+++ smmintrin.h (working copy)
@@ -260,21 +260,21 @@ _mm_dp_pd (__m128d __X, __m128d __Y, con
 #define _mm_dp_pd(X, Y, M) \
   ((__m128d) __builtin_ia32_dppd ((__v2df)(__m128d)(X),
\
  (__v2df)(__m128d)(Y), (int)(M)))
 #endif
 
 /* Packed integer 64-bit comparison, zeroing or filling with ones
corresponding parts of result.  */
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_cmpeq_epi64 (__m128i __X, __m128i __Y)
 {
-  return (__m128i) __builtin_ia32_pcmpeqq ((__v2di)__X, (__v2di)__Y);
+  return (__m128i) ((__v2di)__X == (__v2di)__Y);
 }
 
 /*  Min/max packed integer instructions.  */
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_min_epi8 (__m128i __X, __m128i __Y)
 {
   return (__m128i) __builtin_ia32_pminsb128 ((__v16qi)__X, (__v16qi)__Y);

PATCH: PR bootstrap/63784: [5 Regression] profiledbootstrap failure with bootstrap-lto

2014-11-09 Thread H.J. Lu
Hi,

r216964 disables bootstrap for libcc1 which exposed 2 things:

1. libcc1 isn't compiled with LTO even when GCC is configured with
--with-build-config=bootstrap-lto.  It may be intentional since
libcc1 is disabled for bootstrap.
2. -fPIC isn't used to created libcc1.so, which is OK if libcc1 is
compiled with LTO which remembers PIC option.

libiberty is bootstrapped with LTO.  When libcc1 isn't compiled with
LTO, we are creating libcc1.so without -fPIC, which leads to linker
failure when linking with slim-lto libiberty.  This patch from

https://gcc.gnu.org/ml/gcc-patches/2012-09/msg00991.html

adds -fPIC to -shared so that -fPIC is always used to create shared
object.  Tested on Linux/x86-64.  OK for trunk?

Thanks.


H.J.
---
2014-11-09  Markus Trippelsdorf  mar...@trippelsdorf.de

PR bootstrap/63784
* libtool.m4: Add $pic_flag with -shared.

boehm-gc/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

gcc/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libatomic/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libbacktrace/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libcc1/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libcilkrts/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libffi/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libgfortran/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libgomp/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libitm/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libjava/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libjava/classpath/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libobjc/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libquadmath/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libsanitizer/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libssp/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libstdc++-v3/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

libvtv/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

lto-plugin/

2014-11-09  H.J. Lu  hongjiu...@intel.com

PR bootstrap/63784
* configure: Regenerated.

diff --git a/ChangeLog b/ChangeLog
index 5c7f649..25bc026 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-09  Markus Trippelsdorf  mar...@trippelsdorf.de
+
+   PR bootstrap/63784
+   * libtool.m4: Add $pic_flag with -shared.
+
 2014-10-31  Jakub Jelinek  ja...@redhat.com
 
* Makefile.def (libcc1): Remove bootstrap=true;.
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 1c8cbda..7a2750f 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-09  H.J. Lu  hongjiu...@intel.com
+
+   PR bootstrap/63784
+   * configure: Regenerated.
+
 2014-10-23  Rainer Orth  r...@cebitec.uni-bielefeld.de
 
* include/gc.h [(sparc || __sparc)  sun] (GC_INIT): Remove
diff --git a/boehm-gc/configure b/boehm-gc/configure
index 025003c..efaf7b8 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -9081,7 +9081,7 @@ _LT_EOF
   if $LD --help 21 | $EGREP ': supported targets:.* elf'  /dev/null \
  test $tmp_diet = no
   then
-   tmp_addflag=
+   tmp_addflag=' $pic_flag'
tmp_sharedflag='-shared'
case $cc_basename,$host_cpu in
 pgcc*) # Portland Group C compiler
@@ -12019,8 +12019,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
   # Check if GNU C++ uses GNU ld as the underlying linker, since the
   # archiving commands below assume that GNU ld is being used.
   if test $with_gnu_ld = yes; then
-archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs 
$deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname 
${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects 
$libobjs $deplibs 

patch to fix PR63620

2014-11-09 Thread Vladimir Makarov

The following patch solves PR63620.  The details can be found

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620

The patch is more than just the problem solution.  It adds global live
analysis for pseudos when it is necessary (live info change on a BB
border triggers it).  The patch opens a door for global optimizations
and transformations in LRA and it will be also useful for performance
problems reported by people in coming LRA rematerialization.

The impact on compiler time is insignificant about 0.3% on whole
SPEC2000 compilation (and about the same on a compilation of 500K
lines FORTRAN file).

The patch was successfully bootstrapped	on x86/x86-64, ppc64, and ARM 
and tested on x86/x86-64 and ppc64.


Committed as rev. 217265.


2014-11-09  Vladimir Makarov  vmaka...@redhat.com

PR rtl-optimization/63620
* lra-constraints.c (substitute_pseudo): Add prefix lra_ to the
name.  Move to lra.c.  Make it external.
(substitute_pseudo_within_insn): Ditto.
(inherit_reload_reg, split_reg, remove_inheritance_pseudos): Use
the new names.
(undo_optional_reloads): Ditto.
* lra-int.h (lra_dump_bitmap_with_title, lra_substitute_pseudo):
New prototypes.
(lra_substitute_pseudo_within_insn): Ditto.
* lra-lives.c (bb_killed_pseudos, bb_gen_pseudos): New.
(mark_regno_live): Add parameter.  Update bb_gen_pseudos.
(mark_regno_dead): Add parameter.  Update bb_gen_pseudos and
bb_killed_pseudos.
(struct bb_data, bb_data_t, bb_data): New.
(get_bb_data, get_bb_data_by_index): Ditto.
(all_hard_regs_bitmap): New.
(live_trans_fun, live_con_fun_0, live_con_fun_n, all_blocks): New.
(initiate_live_solver, finish_live_solver): New.
(process_bb_lives): Change return type.  Add code updating local
live data and removing dead insns.  Pass new argument to
mark_regno_live and mark_regno_dead.  Check changing bb pseudo
life info.  Return the result.
(lra_create_live_ranges): Add code to do global pseudo live
analysis.
(lra_live_ranges_init): Call initiate_live_solver.
(lra_live_ranges_finish): Call finish_live_solver.
* lra.c (lra_dump_bitmap_with_title): New.
(lra_substitute_pseudo, lra_substitute_pseudo_within_insn): Move
from lra-constraints.c.
Index: lra-constraints.c
===
--- lra-constraints.c   (revision 217200)
+++ lra-constraints.c   (working copy)
@@ -4366,67 +4366,6 @@ add_next_usage_insn (int regno, rtx insn
 usage_insns[regno].check = 0;
 }
 
-/* Replace all references to register OLD_REGNO in *LOC with pseudo
-   register NEW_REG.  Return true if any change was made.  */
-static bool
-substitute_pseudo (rtx *loc, int old_regno, rtx new_reg)
-{
-  rtx x = *loc;
-  bool result = false;
-  enum rtx_code code;
-  const char *fmt;
-  int i, j;
-
-  if (x == NULL_RTX)
-return false;
-
-  code = GET_CODE (x);
-  if (code == REG  (int) REGNO (x) == old_regno)
-{
-  machine_mode mode = GET_MODE (*loc);
-  machine_mode inner_mode = GET_MODE (new_reg);
-
-  if (mode != inner_mode)
-   {
- if (GET_MODE_SIZE (mode) = GET_MODE_SIZE (inner_mode)
- || ! SCALAR_INT_MODE_P (inner_mode))
-   new_reg = gen_rtx_SUBREG (mode, new_reg, 0);
- else
-   new_reg = gen_lowpart_SUBREG (mode, new_reg);
-   }
-  *loc = new_reg;
-  return true;
-}
-
-  /* Scan all the operand sub-expressions.  */
-  fmt = GET_RTX_FORMAT (code);
-  for (i = GET_RTX_LENGTH (code) - 1; i = 0; i--)
-{
-  if (fmt[i] == 'e')
-   {
- if (substitute_pseudo (XEXP (x, i), old_regno, new_reg))
-   result = true;
-   }
-  else if (fmt[i] == 'E')
-   {
- for (j = XVECLEN (x, i) - 1; j = 0; j--)
-   if (substitute_pseudo (XVECEXP (x, i, j), old_regno, new_reg))
- result = true;
-   }
-}
-  return result;
-}
-
-/* Call substitute_pseudo within an insn.  This won't update the insn ptr,
-   just the contents of the insn.  */
-
-static bool
-substitute_pseudo_within_insn (rtx_insn *insn, int old_regno, rtx new_reg)
-{
-  rtx loc = insn;
-  return substitute_pseudo (loc, old_regno, new_reg);
-}
-
 /* Return first non-debug insn in list USAGE_INSNS.  */
 static rtx_insn *
 skip_usage_debug_insns (rtx usage_insns)
@@ -4588,7 +4527,7 @@ inherit_reload_reg (bool def_p, int orig
}
   return false;
 }
-  substitute_pseudo_within_insn (insn, original_regno, new_reg);
+  lra_substitute_pseudo_within_insn (insn, original_regno, new_reg);
   lra_update_insn_regno_info (insn);
   if (! def_p)
 /* We now have a new usage insn for original regno.  */
@@ -4620,7 +4559,7 @@ inherit_reload_reg (bool def_p, int orig
  lra_assert (DEBUG_INSN_P (usage_insn));
  next_usage_insns = XEXP (next_usage_insns, 1);
}

Re: [PATCH][Revisedx2] Fix PR63750

2014-11-09 Thread Jack Howarth
Iain,
 It doesn't look like it will be that simple. If I replace the
proposed patches with a change like...

Index: gcc/system.h
===
--- gcc/system.h(revision 217238)
+++ gcc/system.h(working copy)
@@ -194,6 +194,13 @@ extern int fprintf_unlocked (FILE *, con
 #undef fread_unlocked
 #undef fwrite_unlocked

+/* Include string before safe-ctype.h to avoid avoid GCC poisoning
+the ctype macros through safe-ctype.h */
+
+#ifdef __cplusplus
+# include string
+#endif
+
 /* There are an extraordinary number of issues with ctype.h.
The last straw is that it varies with the locale.  Use libiberty's
replacement instead.  */

The bootstrap fails at a new place with...

make[3]: Entering directory
'/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc'
g++ -c   -g  -DIN_GCC-fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wno-format -Wmissing-format-attribute
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I.
-I../../gcc-5.0-20141107/gcc -I../../gcc-5.0-20141107/gcc/.
-I../../gcc-5.0-20141107/gcc/../include
-I../../gcc-5.0-20141107/gcc/../libcpp/include -I/sw/include
-I/sw/include  -I../../gcc-5.0-20141107/gcc/../libdecnumber
-I../../gcc-5.0-20141107/gcc/../libdecnumber/dpd -I../libdecnumber
-I../../gcc-5.0-20141107/gcc/../libbacktrace -DCLOOG_INT_GMP
-I/sw/include -DCLOOG_INT_GMP -I/sw/include -I/sw/include -o
simplify-rtx.o -MT simplify-rtx.o -MMD -MP -MF
./.deps/simplify-rtx.TPo ../../gcc-5.0-20141107/gcc/simplify-rtx.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this
behavior is deprecated
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:23:
../../gcc-5.0-20141107/gcc/coretypes.h:62:1: warning: class 'rtx_def'
was previously declared as a struct [-Wmismatched-tags]
class rtx_def;
^
../../gcc-5.0-20141107/gcc/coretypes.h:55:8: note: previous use is here
struct rtx_def;
   ^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:27:
In file included from ../../gcc-5.0-20141107/gcc/real.h:25:
../../gcc-5.0-20141107/gcc/wide-int.h:370:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:377:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:384:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:394:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:401:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:411:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:422:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:886:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:965:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
../../gcc-5.0-20141107/gcc/wide-int.h:1127:1: warning:
'fixed_wide_int_storage' defined as a class template here but
previously declared as a struct template
  [-Wmismatched-tags]
class GTY(()) fixed_wide_int_storage
^
../../gcc-5.0-20141107/gcc/wide-int.h:286:18: note: did you mean class here?
template int N struct fixed_wide_int_storage;
 ^~
 class
../../gcc-5.0-20141107/gcc/wide-int.h:1152:3: warning: extraneous
template parameter list in template specialization
  template 
  ^~~
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:28:
In file included from ../../gcc-5.0-20141107/gcc/vec.h:44:
../../gcc-5.0-20141107/gcc/ggc.h:315:15: warning: struct 'rtx_def' was
previously declared as a class [-Wmismatched-tags]
static inline struct rtx_def *
  ^
../../gcc-5.0-20141107/gcc/coretypes.h:62:7: note: previous use is here
class rtx_def;
  ^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:28:
In file included from ../../gcc-5.0-20141107/gcc/vec.h:44:
../../gcc-5.0-20141107/gcc/ggc.h:318:11: warning: struct 'rtx_def' was
previously declared as a class [-Wmismatched-tags]
  return (struct rtx_def *) ggc_internal_alloc (s PASS_MEM_STAT);
  ^
../../gcc-5.0-20141107/gcc/coretypes.h:62:7: note: previous use is here
class rtx_def;
  ^
In 

Re: [RFC, C] add warning for unpromoted bit-field uses

2014-11-09 Thread Sandra Loosemore

On 11/09/2014 02:28 AM, Manuel López-Ibáñez wrote:

We had a request from a customer to add a warning to the C front end to
diagnose cases where bit-fields larger than an int are used in shift
expressions; confusingly, the operation is done in the precision of the
bit-field size rather than its declared type. This is a symptom of a larger
problem, of course, as it affects bit-field uses in other expressions
besides shifts, too.


The C standard specifies that bit-fields have an integral type of the
specified number of bits. On the other hand, in C++, bit-fields do have
their declared type, so it seems appropriate to tie the new proposed warning
to -Wc++-compat.


The message:

+warning_at (EXPR_LOCATION (exp), OPT_Wbitfield_conversion,
+suggest casting bit-field to its declared type);


is not very clear without the context of your email. Could it explain
what is (or could) be wrong? For example, ISO C specifies that this
bit-field is implicitly converted to type %qT rather than its declared
type (%qT). And a note at lhs location could say use an explicit
cast to silence this warning.


Yes, I know the text of the warning in my patch needed improvement.  But 
I don't think your suggested improvement is quite correct, either; e.g. 
in the case of sp-b, ISO C specifies that the bit-field type is 40-bit 
unsigned integer, and that it is *not* converted implicitly to anything 
else.  Maybe


ISO C specifies that the promoted type of this bit-field differs from 
that of its declared type (%qT)


??


Nonetheless, perhaps I'm missing something but Wconversion seems to
think that the promotion of sp-a and sp-c is always to 'int'.


Hrmmm.  In C, sp-a has type 3-bit unsigned integer which is promoted 
to int by the integral promotions since all values are representable as 
int.   sp-c has type 5-bit unsigned integer which is likewise 
promoted to int.  In C++, sp-a has type unsigned char and sp-c has 
type unsigned long long.  By the C++ conversion rules, unsigned char 
is promoted to int (again since all values are representable), and 
unsigned long long is not promoted to anything else.


Now I'm worried, though, that I didn't account for signed-ness properly 
in the test about whether or not to give a warning.  Maybe a better test 
would be to actually do the promotions of both types and warn if they 
don't match in signedness as well as size?


-Sandra



Committed: Fix typo in low_io_address_operand

2014-11-09 Thread Joern Rennecke
I forgot the 'x' number base specifier in r216034.
Committed as obvious.
2014-11-09  Joern Rennecke  joern.renne...@embecosm.com

	* config/avr/predicates.md (low_io_address_operand): Fix typo.

Index: config/avr/predicates.md
===
--- config/avr/predicates.md	(revision 217265)
+++ config/avr/predicates.md	(working copy)
@@ -46,7 +46,7 @@ (define_predicate stack_register_operan
 (define_special_predicate low_io_address_operand
   (ior (and (match_code const_int)
 	(match_test IN_RANGE (INTVAL (op) - avr_current_arch-sfr_offset,
-   0, 020 - GET_MODE_SIZE (mode
+   0, 0x20 - GET_MODE_SIZE (mode
(and (match_code symbol_ref)
 	(match_test SYMBOL_REF_FLAGS (op)  SYMBOL_FLAG_IO_LOW
 


Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-09 Thread Roman Gareev
Hi Tobias,

I've attached a patch which removes using of CLooG library from
Graphite. Is it fine for trunk?


-- 
Cheers, Roman Gareev.
Index: gcc/Makefile.in
===
--- gcc/Makefile.in (revision 217264)
+++ gcc/Makefile.in (working copy)
@@ -1244,7 +1244,6 @@
graphds.o \
graphite.o \
graphite-blocking.o \
-   graphite-clast-to-gimple.o \
graphite-isl-ast-to-gimple.o \
graphite-dependences.o \
graphite-interchange.o \
Index: gcc/graphite-blocking.c
===
--- gcc/graphite-blocking.c (revision 217264)
+++ gcc/graphite-blocking.c (working copy)
@@ -28,11 +28,7 @@
 #include isl/map.h
 #include isl/union_map.h
 #include isl/constraint.h
-#ifdef HAVE_cloog
-#include cloog/cloog.h
-#include cloog/isl/domain.h
 #endif
-#endif
 
 #include system.h
 #include coretypes.h
Index: gcc/graphite-clast-to-gimple.c
===
--- gcc/graphite-clast-to-gimple.c  (revision 217264)
+++ gcc/graphite-clast-to-gimple.c  (working copy)
@@ -1,1736 +0,0 @@
-/* Translation of CLAST (CLooG AST) to Gimple.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-   Contributed by Sebastian Pop sebastian@amd.com.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-http://www.gnu.org/licenses/.  */
-
-#include config.h
-
-#ifdef HAVE_cloog
-#include isl/set.h
-#include isl/map.h
-#include isl/union_map.h
-#include isl/list.h
-#include isl/constraint.h
-#include isl/ilp.h
-#include isl/aff.h
-#include isl/val.h
-#if defined(__cplusplus)
-extern C {
-#endif
-#include isl/val_gmp.h
-#if defined(__cplusplus)
-}
-#endif
-#include cloog/cloog.h
-#include cloog/isl/domain.h
-#endif
-
-#include system.h
-#include coretypes.h
-#include diagnostic-core.h
-#include tree.h
-#include predict.h
-#include vec.h
-#include hashtab.h
-#include hash-set.h
-#include machmode.h
-#include tm.h
-#include hard-reg-set.h
-#include input.h
-#include function.h
-#include dominance.h
-#include cfg.h
-#include basic-block.h
-#include tree-ssa-alias.h
-#include internal-fn.h
-#include gimple-expr.h
-#include is-a.h
-#include gimple.h
-#include gimple-iterator.h
-#include gimplify-me.h
-#include gimple-ssa.h
-#include tree-ssa-loop-manip.h
-#include tree-ssa-loop.h
-#include tree-into-ssa.h
-#include tree-pass.h
-#include cfgloop.h
-#include tree-chrec.h
-#include tree-data-ref.h
-#include tree-scalar-evolution.h
-#include sese.h
-
-#ifdef HAVE_cloog
-#include cloog/cloog.h
-#include graphite-poly.h
-#include graphite-clast-to-gimple.h
-#include graphite-htab.h
-
-typedef const struct clast_expr *clast_name_p;
-
-#ifndef CLOOG_LANGUAGE_C
-#define CLOOG_LANGUAGE_C LANGUAGE_C
-#endif
-
-
-/* Converts a GMP constant VAL to a tree and returns it.  */
-
-static tree
-gmp_cst_to_tree (tree type, mpz_t val)
-{
-  tree t = type ? type : integer_type_node;
-  mpz_t tmp;
-
-  mpz_init (tmp);
-  mpz_set (tmp, val);
-  wide_int wi = wi::from_mpz (t, tmp, true);
-  mpz_clear (tmp);
-
-  return wide_int_to_tree (t, wi);
-}
-
-/* Sets RES to the min of V1 and V2.  */
-
-static void
-value_min (mpz_t res, mpz_t v1, mpz_t v2)
-{
-  if (mpz_cmp (v1, v2)  0)
-mpz_set (res, v1);
-  else
-mpz_set (res, v2);
-}
-
-/* Sets RES to the max of V1 and V2.  */
-
-static void
-value_max (mpz_t res, mpz_t v1, mpz_t v2)
-{
-  if (mpz_cmp (v1, v2)  0)
-mpz_set (res, v2);
-  else
-mpz_set (res, v1);
-}
-
-
-/* This flag is set when an error occurred during the translation of
-   CLAST to Gimple.  */
-static bool graphite_regenerate_error;
-
-/* Verifies properties that GRAPHITE should maintain during translation.  */
-
-static inline void
-graphite_verify (void)
-{
-#ifdef ENABLE_CHECKING
-  verify_loop_structure ();
-  verify_loop_closed_ssa (true);
-#endif
-}
-
-/* Stores the INDEX in a vector and the loop nesting LEVEL for a given
-   clast NAME.  BOUND_ONE and BOUND_TWO represent the exact lower and
-   upper bounds that can be inferred from the polyhedral representation.  */
-
-typedef struct clast_name_index {
-  int index;
-  int level;
-  mpz_t bound_one, bound_two;
-  const char *name;
-  /* If free_name is set, the content of name was allocated by us and needs
- to be freed.  */
-  char *free_name;
-} *clast_name_index_p;
-
-/* Helper 

Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-09 Thread Tobias Grosser

On 09.11.2014 18:16, Roman Gareev wrote:

Hi Tobias,

I've attached a patch which removes using of CLooG library from
Graphite. Is it fine for trunk?


The patch looks great. The only piece I think we missed is the 
fgraphite-code-generator flag. I would propose to remove it as well in 
this commit, as it does not have any effect any more.


See r212124 for the files that have changed when it was added.

In case you agree, feel free to commit the modified patch and just 
repost the final version of the patch that you applied.


We still need to update configure and the documentation, but I believe 
this can be done in a separate patch.


Cheers,
Tobias



Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-09 Thread Tobias Burnus

Roman Gareev wrote:

* Makefile.in: Remove the compilation of graphite-clast-to-gimple.o.
* graphite.c: Remove using of CLooG.
* graphite-blocking.c: Likewise.
* graphite-dependences.c: Likewise.
* graphite-poly.c: Likewise.
* graphite-poly.h: Likewise.
* graphite-scop-detection.c: Likewise.
* graphite-sese-to-poly.c: Likewise.
* graphite-clast-to-gimple.c: Removed.
* graphite-clast-to-gimple.h: Likewise.
* graphite-htab.h: Likewise.


When that's in, I think one can also remove cloog from the main 
configure.ac and Makefile.tpl (assuming that no one at sourceware.org 
needs it). Additionally, CLooG could then be removed from 
doc/install.texi's prerequisites list and from the trunk's 
contrib/download_prerequisites.


Is there something to add to https://gcc.gnu.org/gcc-5/changes.html – 
either to caveats or to general optimizer improvements?


Tobias


Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-09 Thread Tobias Grosser

On 09.11.2014 18:35, Tobias Burnus wrote:

Roman Gareev wrote:

* Makefile.in: Remove the compilation of graphite-clast-to-gimple.o.
* graphite.c: Remove using of CLooG.
* graphite-blocking.c: Likewise.
* graphite-dependences.c: Likewise.
* graphite-poly.c: Likewise.
* graphite-poly.h: Likewise.
* graphite-scop-detection.c: Likewise.
* graphite-sese-to-poly.c: Likewise.
* graphite-clast-to-gimple.c: Removed.
* graphite-clast-to-gimple.h: Likewise.
* graphite-htab.h: Likewise.


When that's in, I think one can also remove cloog from the main
configure.ac and Makefile.tpl (assuming that no one at sourceware.org
needs it). Additionally, CLooG could then be removed from
doc/install.texi's prerequisites list and from the trunk's
contrib/download_prerequisites.


Right.


Is there something to add to https://gcc.gnu.org/gcc-5/changes.html –
either to caveats or to general optimizer improvements?


We now have a new AST generator. It produces in several cases better 
code, but that must not necessarily show up in performance numbers. The

two main benefits are:

- One run-time dependence less
- A set of advanced features

  Mircea just demonstrated one of them, but there are several others.

Cheers,
Tobias


PATCH: PR testsuite/63305: ASan reported heap-buffer-overflow in gcc.target/i386/avx256-unaligned-load{store}-7.c

2014-11-09 Thread H.J. Lu
Hi,

I checked in this patch to fix buffer overflow in
avx256-unaligned-load-7.c and avx256-unaligned-store-7.c.


H.J.
---
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0e469f0..e7f0b22 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-09  H.J. Lu  hongjiu...@intel.com
+
+   PR testsuite/63305
+   * gcc.target/i386/avx256-unaligned-load-7.c (avx_test): Fix
+   buffer overflow.
+   * gcc.target/i386/avx256-unaligned-store-7.c (avx_test): Likewise.
+
 2014-11-09  Andreas Schwab  sch...@linux-m68k.org
 
* gcc.target/powerpc/pr51623.c: Fix implicit declarations.
diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c 
b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
index 4a94e03..4c6054c 100644
--- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
+++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
@@ -34,7 +34,7 @@ avx_test (void)
   cp = mp;
   dp = lp;
 
-  for (i = N; i = 0; i--)
+  for (i = N; i  0; i--)
 {
   *cp++ = str;
   *dp++ = str;
@@ -45,13 +45,13 @@ avx_test (void)
   cp = mp;
   dp = lp;
 
-  for (i = N; i = 0; i--)
+  for (i = N; i  0; i--)
 {
   *ap++ = *cp++;
   *bp++ = *dp++;
 }
 
-  for (i = N; i = 0; i--)
+  for (i = N; i  0; i--)
 {
   if (strcmp (*--ap, STR) != 0)
abort ();
diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c 
b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
index 85e387a..99a0c71 100644
--- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
+++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
@@ -30,13 +30,13 @@ avx_test (void)
   ap = ep;
   bp = fp;
 
-  for (i = N; i = 0; i--)
+  for (i = N; i  0; i--)
 {
   *ap++ = str;
   *bp++ = str;
 }
 
-  for (i = N; i = 0; i--)
+  for (i = N; i  0; i--)
 {
   if (strcmp (*--ap, STR) != 0)
abort ();


Re: PATCH: PR testsuite/63305: ASan reported heap-buffer-overflow in gcc.target/i386/avx256-unaligned-load{store}-7.c

2014-11-09 Thread H.J. Lu
On Sun, Nov 9, 2014 at 9:56 AM, H.J. Lu hongjiu...@intel.com wrote:
 Hi,

 I checked in this patch to fix buffer overflow in
 avx256-unaligned-load-7.c and avx256-unaligned-store-7.c.


 H.J.
 ---
 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
 index 0e469f0..e7f0b22 100644
 --- a/gcc/testsuite/ChangeLog
 +++ b/gcc/testsuite/ChangeLog
 @@ -1,3 +1,10 @@
 +2014-11-09  H.J. Lu  hongjiu...@intel.com
 +
 +   PR testsuite/63305
 +   * gcc.target/i386/avx256-unaligned-load-7.c (avx_test): Fix
 +   buffer overflow.
 +   * gcc.target/i386/avx256-unaligned-store-7.c (avx_test): Likewise.
 +
  2014-11-09  Andreas Schwab  sch...@linux-m68k.org

 * gcc.target/powerpc/pr51623.c: Fix implicit declarations.
 diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c 
 b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
 index 4a94e03..4c6054c 100644
 --- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
 +++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
 @@ -34,7 +34,7 @@ avx_test (void)
cp = mp;
dp = lp;

 -  for (i = N; i = 0; i--)
 +  for (i = N; i  0; i--)
  {
*cp++ = str;
*dp++ = str;
 @@ -45,13 +45,13 @@ avx_test (void)
cp = mp;
dp = lp;

 -  for (i = N; i = 0; i--)
 +  for (i = N; i  0; i--)
  {
*ap++ = *cp++;
*bp++ = *dp++;
  }

 -  for (i = N; i = 0; i--)
 +  for (i = N; i  0; i--)
  {
if (strcmp (*--ap, STR) != 0)
 abort ();
 diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c 
 b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
 index 85e387a..99a0c71 100644
 --- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
 +++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
 @@ -30,13 +30,13 @@ avx_test (void)
ap = ep;
bp = fp;

 -  for (i = N; i = 0; i--)
 +  for (i = N; i  0; i--)
  {
*ap++ = str;
*bp++ = str;
  }

 -  for (i = N; i = 0; i--)
 +  for (i = N; i  0; i--)
  {
if (strcmp (*--ap, STR) != 0)
 abort ();

I also backported it to 4.9 branch.

-- 
H.J.


[Patch, libstdc++/63775] Fix regex bracket expression parsing

2014-11-09 Thread Tim Shen
Bootstrapped and tested.

Thanks!


-- 
Regards,
Tim Shen
commit 1cb5f4e018e52d94e4902bd2424b8d5e75d917c2
Author: timshen tims...@google.com
Date:   Sat Nov 8 18:19:56 2014 -0800

PR libstdc++/63775
* include/bits/regex_compiler.h (_Compiler::_M_expression_term,
_BracketMatcher::_M_make_range): Throw regex_erorr on invalid range
like [z-a]. Change _M_expression_term interface.
* include/bits/regex_compiler.tcc (
_Compiler::_M_insert_bracket_matcher,
_Compiler::_M_expression_term): Rewrite bracket expression parsing.
* testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
Add testcases and move file out of extended.

diff --git a/libstdc++-v3/include/bits/regex_compiler.h 
b/libstdc++-v3/include/bits/regex_compiler.h
index 1bbc09d..d8880cc 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -118,7 +118,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   templatebool __icase, bool __collate
void
-   _M_expression_term(_BracketMatcher_TraitsT, __icase, __collate
+   _M_expression_term(pairbool, _CharT __last_char,
+  _BracketMatcher_TraitsT, __icase, __collate
   __matcher);
 
   int
@@ -390,6 +391,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   void
   _M_make_range(_CharT __l, _CharT __r)
   {
+   if (__l  __r)
+ __throw_regex_error(regex_constants::error_range);
_M_range_set.push_back(make_pair(_M_translator._M_transform(__l),
 _M_translator._M_transform(__r)));
 #ifdef _GLIBCXX_DEBUG
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc 
b/libstdc++-v3/include/bits/regex_compiler.tcc
index 349d92a..b9da491 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -415,8 +415,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _M_insert_bracket_matcher(bool __neg)
 {
   _BracketMatcher_TraitsT, __icase, __collate __matcher(__neg, 
_M_traits);
+  pairbool, _CharT __last_char; // Optional_CharT
+  __last_char.first = false;
+  if (!(_M_flags  regex_constants::ECMAScript))
+   if (_M_try_char())
+ {
+   __matcher._M_add_char(_M_value[0]);
+   __last_char.first = true;
+   __last_char.second = _M_value[0];
+ }
   while (!_M_match_token(_ScannerT::_S_token_bracket_end))
-   _M_expression_term(__matcher);
+   _M_expression_term(__last_char, __matcher);
   __matcher._M_ready();
   _M_stack.push(_StateSeqT(
  *_M_nfa,
@@ -427,7 +436,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   templatebool __icase, bool __collate
 void
 _Compiler_TraitsT::
-_M_expression_term(_BracketMatcher_TraitsT, __icase, __collate 
__matcher)
+_M_expression_term(pairbool, _CharT __last_char,
+  _BracketMatcher_TraitsT, __icase, __collate __matcher)
 {
   if (_M_match_token(_ScannerT::_S_token_collsymbol))
__matcher._M_add_collating_element(_M_value);
@@ -435,27 +445,50 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__matcher._M_add_equivalence_class(_M_value);
   else if (_M_match_token(_ScannerT::_S_token_char_class_name))
__matcher._M_add_character_class(_M_value, false);
-  else if (_M_try_char()) // [a
+  // POSIX doesn't permit '-' as a start-range char (say [a-z--0]),
+  // except that the '-' is the first character in the bracket expression
+  // ([--0]). ECMAScript treats all '-' after a range as a normal 
character.
+  // Also see above, where _M_expression_term gets called.
+  //
+  // As a result, POSIX rejects [-], but ECMAScript doesn't.
+  // Boost (1.57.0) always uses POSIX style even in its ECMAScript syntax.
+  // Clang (3.5) always uses ECMAScript style even in its POSIX syntax.
+  //
+  // It turns out that no one reads BNFs ;)
+  else if (_M_try_char())
{
- auto __ch = _M_value[0];
- if (_M_try_char())
+ if (!__last_char.first)
+   {
+ if (_M_value[0] == '-'
+  !(_M_flags  regex_constants::ECMAScript))
+   __throw_regex_error(regex_constants::error_range);
+ __matcher._M_add_char(_M_value[0]);
+ __last_char.first = true;
+ __last_char.second = _M_value[0];
+   }
+ else
{
- if (_M_value[0] == '-') // [a-
+ if (_M_value[0] == '-')
{
- if (_M_try_char()) // [a-z]
+ if (_M_try_char())
{
- __matcher._M_make_range(__ch, _M_value[0]);
- return;
+ __matcher._M_make_range(__last_char.second , _M_value[0]);
+ __last_char.first = false;
+   }
+ else
+   {

Re: patch to fix PR63620

2014-11-09 Thread Uros Bizjak
Hello!

 The following patch solves PR63620.  The details can be found

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620

 The patch is more than just the problem solution.  It adds global live
 analysis for pseudos when it is necessary (live info change on a BB
 border triggers it).  The patch opens a door for global optimizations
 and transformations in LRA and it will be also useful for performance
 problems reported by people in coming LRA rematerialization.

 The impact on compiler time is insignificant about 0.3% on whole
 SPEC2000 compilation (and about the same on a compilation of 500K
 lines FORTRAN file).

 The patch was successfully bootstrapped on x86/x86-64, ppc64, and ARM and 
 tested on
 x86/x86-64 and ppc64.

Did you also try to bootstrap with r216987 [1] reverted? This revision
adds a workaround for this problem on i686.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620#c24

Uros.


Re: patch to fix PR63620

2014-11-09 Thread Uros Bizjak
On Sun, Nov 9, 2014 at 8:16 PM, Uros Bizjak ubiz...@gmail.com wrote:

 The following patch solves PR63620.  The details can be found

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620

 The patch is more than just the problem solution.  It adds global live
 analysis for pseudos when it is necessary (live info change on a BB
 border triggers it).  The patch opens a door for global optimizations
 and transformations in LRA and it will be also useful for performance
 problems reported by people in coming LRA rematerialization.

 The impact on compiler time is insignificant about 0.3% on whole
 SPEC2000 compilation (and about the same on a compilation of 500K
 lines FORTRAN file).

 The patch was successfully bootstrapped on x86/x86-64, ppc64, and ARM and 
 tested on
 x86/x86-64 and ppc64.

 Did you also try to bootstrap with r216987 [1] reverted? This revision
 adds a workaround for this problem on i686.

 [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620#c24

Unfortunately, the patch doesn't fix the original problem when
mentioned revision is reverted. I have attached patch to the message.

The testcase from the PR that fails to reload PIC register is:

--cut here--
/* { dg-do compile { target i?86-*-* } } */
/* { dg-options -O2 -mfpmath=sse -msse -fPIC } */

static const __float128 cf = 0.1E+30Q;

typedef __float128 (*func)(__float128 x);

__float128
test (__float128 x, int p, func f)
{
  x = f (x);
  if (p)
x = f (cf);
  return x;
}

/* { dg-final { scan-assembler get_pc_thunk } } */
--cut here--

Uros.
Index: config/i386/i386.md
===
--- config/i386/i386.md (revision 217269)
+++ config/i386/i386.md (working copy)
@@ -2783,11 +2783,7 @@
 (define_insn *pushtf
   [(set (match_operand:TF 0 push_operand =,)
(match_operand:TF 1 general_no_elim_operand x,*roF))]
-  (TARGET_64BIT || TARGET_SSE)
-(!ix86_use_pseudo_pic_reg ()
-   || !can_create_pseudo_p ()
-   || GET_CODE (operands[1]) != CONST_DOUBLE
-   || standard_sse_constant_p (operands[1]))
+  TARGET_64BIT || TARGET_SSE
 {
   /* This insn should be already split before reg-stack.  */
   gcc_unreachable ();
@@ -2813,10 +2809,7 @@
 (define_insn *pushxf
   [(set (match_operand:XF 0 push_operand =,)
(match_operand:XF 1 general_no_elim_operand f,Yx*roF))]
-  !ix86_use_pseudo_pic_reg ()
-   || !can_create_pseudo_p ()
-   || GET_CODE (operands[1]) != CONST_DOUBLE
-   || standard_80387_constant_p (operands[1])  0
+  
 {
   /* This insn should be already split before reg-stack.  */
   gcc_unreachable ();
@@ -2848,13 +2841,7 @@
 (define_insn *pushdf
   [(set (match_operand:DF 0 push_operand =,,,)
(match_operand:DF 1 general_no_elim_operand f,Yd*roF,rmF,x))]
-  !ix86_use_pseudo_pic_reg ()
-   || !can_create_pseudo_p ()
-   || GET_CODE (operands[1]) != CONST_DOUBLE
-   || (!(TARGET_SSE2  TARGET_SSE_MATH)
-standard_80387_constant_p (operands[1])  0)
-   || (TARGET_SSE2  TARGET_SSE_MATH
-standard_sse_constant_p (operands[1]))
+  
 {
   /* This insn should be already split before reg-stack.  */
   gcc_unreachable ();


Re: [PATCH] FreeBSD arm support, EABI.

2014-11-09 Thread Andreas Tobler

Hi Richard,

On 07.11.14 14:45, Richard Earnshaw wrote:

On 02/11/14 22:11, Andreas Tobler wrote:

Hello all,

this is a patch which brings support for arm*-*-freebsd* to trunk.
The architectures supported are arm-*-*freebsd*, armv6-*-freebsd* and
armv6hf-*-freebsd*.
armv6 stands for ARM_ARCH == 6, arm stands for ARM_ARCH  6.

There is kernel development for armv8 aka. aarch64 ongoing but this is
not covered here. This patch only covers 32-bit arm in a basic manner.

The patch is built and tested against armv6, armv6hf and arm. The former
two tests (lots of) were done on a WANDBOARD-QUAD, the latter on a
MARVELL board with 256MB Ram and 200MHz cpu (around 72h+ for a build
and test.)

Results for armv6hf are on the list. Only one entry but locally I ran
several dozens runs...

Once if this patch is accepted a few test suite additions will follow.
(arm*-*-*eabi* - arm_eabi)

The patch itself is also prepared for arm*eb*-*-freebsd*, but I could
not test since I lack the HW.


[snip]


This mostly looks OK, but a couple of nits.


Thank you for the review.


Index: gcc/config/arm/arm.c
===
--- gcc/config/arm/arm.c(revision 217020)
+++ gcc/config/arm/arm.c(working copy)
@@ -2202,7 +2202,11 @@
  {
/* For Linux, we have access to kernel support for atomic operations.  */
if (arm_abi == ARM_ABI_AAPCS_LINUX)
+#ifndef __FreeBSD__
  init_sync_libfuncs (2 * UNITS_PER_WORD);
+#else
+init_sync_libfuncs (UNITS_PER_WORD);
+#endif


This would be better handled by some refactoring, so that we can
eliminate the conditionalized code in the main function.  Define
something like MAX_SYNC_LIBFUNC_SIZE and then override it in the
FreeBSD-specific header.


Done.


@@ -3036,6 +3040,9 @@
warning (0, target CPU does not support unaligned accesses);
unaligned_access = 0;
  }
+#ifdef __FreeBSD__
+  unaligned_access = 0;
+#endif



This really should be fixed in the OS; you're not really supporting the
architecture properly if you don't allow this on v6 or later.  In the
mean time, the code should be moved to SUBTARGET_OVERRIDE_OPTIONS.


Agreed, for now as you suggested included it in the 
SUBTARGET_OVERRIDE_OPTIONS of config/arm/freebsd.h



Index: gcc/config/arm/freebsd.h
===
--- gcc/config/arm/freebsd.h(revision 0)
+++ gcc/config/arm/freebsd.h(working copy)



+
+/*  Use the AAPCS type for wchar_t, override the one from config/freebsd.h.  */
+#undef  WCHAR_TYPE
+#define WCHAR_TYPE (TARGET_AAPCS_BASED ? unsigned int : long int)


I don't think you should really be targeting anything that is not AAPCS
based; so this should surely collapse to 'unsigned int'.


Done.

Attached the revised version with adapted Changelog (thanks Gerald).
Bootstraped and tested (results sent).

Ok for trunk?

Thanks again for your time.
Andreas

toplevel:

2014-11-08  Andreas Tobler  andre...@gcc.gnu.org

* configure.ac: Don't add ${libgcj} for arm*-*-freebsd*.
* configure: Regenerate.

gcc:
2014-11-08  Andreas Tobler  andre...@gcc.gnu.org

* config.gcc (arm*-*-freebsd*): New configuration.
* config/arm/freebsd.h: New file.
* config.host: Add extra components for arm*-*-freebsd*.
* config/arm/arm.h: Introduce MAX_SYNC_LIBFUNC_SIZE.
* config/arm/arm.c (arm_init_libfuncs): Use MAX_SYNC_LIBFUNC_SIZE.


libgcc:
2014-11-08  Andreas Tobler  andre...@gcc.gnu.org

* config.host (arm*-*-freebsd*): Add new configuration for
arm*-*-freebsd*.
* config/arm/freebsd-atomic.c: New file.
* config/arm/t-freebsd: Likewise.
* config/arm/unwind-arm.h: Add __FreeBSD__ to the list of
'PC-relative indirect' OS's.


libstdc++-v3:
2014-11-08  Andreas Tobler  andre...@gcc.gnu.org

* configure.host: Add arm*-*-freebsd* port_specific_symbol_files.

Index: configure
===
--- configure   (revision 217256)
+++ configure   (working copy)
@@ -3352,6 +3352,9 @@
   alpha*-*-*vms*)
 noconfigdirs=$noconfigdirs ${libgcj}
 ;;
+  arm*-*-freebsd*)
+noconfigdirs=$noconfigdirs ${libgcj}
+;;
   arm-wince-pe)
 noconfigdirs=$noconfigdirs ${libgcj}
 ;;
Index: configure.ac
===
--- configure.ac(revision 217256)
+++ configure.ac(working copy)
@@ -711,6 +711,9 @@
   alpha*-*-*vms*)
 noconfigdirs=$noconfigdirs ${libgcj}
 ;;
+  arm*-*-freebsd*)
+noconfigdirs=$noconfigdirs ${libgcj}
+;;
   arm-wince-pe)
 noconfigdirs=$noconfigdirs ${libgcj}
 ;;
Index: gcc/config/arm/arm.c
===
--- gcc/config/arm/arm.c(revision 217256)
+++ gcc/config/arm/arm.c(working copy)
@@ -2229,7 +2229,7 @@
 {
   /* For Linux, we have access to kernel support for 

Re: patch to fix PR63620

2014-11-09 Thread H.J. Lu
On Sun, Nov 9, 2014 at 8:47 AM, Vladimir Makarov vmaka...@redhat.com wrote:
 The following patch solves PR63620.  The details can be found

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620

 The patch is more than just the problem solution.  It adds global live
 analysis for pseudos when it is necessary (live info change on a BB
 border triggers it).  The patch opens a door for global optimizations
 and transformations in LRA and it will be also useful for performance
 problems reported by people in coming LRA rematerialization.

 The impact on compiler time is insignificant about 0.3% on whole
 SPEC2000 compilation (and about the same on a compilation of 500K
 lines FORTRAN file).

 The patch was successfully bootstrapped on x86/x86-64, ppc64, and ARM and
 tested on x86/x86-64 and ppc64.

 Committed as rev. 217265.


 2014-11-09  Vladimir Makarov  vmaka...@redhat.com

 PR rtl-optimization/63620
 * lra-constraints.c (substitute_pseudo): Add prefix lra_ to the
 name.  Move to lra.c.  Make it external.
 (substitute_pseudo_within_insn): Ditto.
 (inherit_reload_reg, split_reg, remove_inheritance_pseudos): Use
 the new names.
 (undo_optional_reloads): Ditto.
 * lra-int.h (lra_dump_bitmap_with_title, lra_substitute_pseudo):
 New prototypes.
 (lra_substitute_pseudo_within_insn): Ditto.
 * lra-lives.c (bb_killed_pseudos, bb_gen_pseudos): New.
 (mark_regno_live): Add parameter.  Update bb_gen_pseudos.
 (mark_regno_dead): Add parameter.  Update bb_gen_pseudos and
 bb_killed_pseudos.
 (struct bb_data, bb_data_t, bb_data): New.
 (get_bb_data, get_bb_data_by_index): Ditto.
 (all_hard_regs_bitmap): New.
 (live_trans_fun, live_con_fun_0, live_con_fun_n, all_blocks): New.
 (initiate_live_solver, finish_live_solver): New.
 (process_bb_lives): Change return type.  Add code updating local
 live data and removing dead insns.  Pass new argument to
 mark_regno_live and mark_regno_dead.  Check changing bb pseudo
 life info.  Return the result.
 (lra_create_live_ranges): Add code to do global pseudo live
 analysis.
 (lra_live_ranges_init): Call initiate_live_solver.
 (lra_live_ranges_finish): Call finish_live_solver.
 * lra.c (lra_dump_bitmap_with_title): New.
 (lra_substitute_pseudo, lra_substitute_pseudo_within_insn): Move
 from lra-constraints.c.

It caused libjava failures:

FAIL: Array_3 execution - source compiled test
FAIL: Array_3 -findirect-dispatch execution - source compiled test
FAIL: Array_3 -O3 -findirect-dispatch execution - source compiled test
FAIL: Divide_2 execution - source compiled test
FAIL: Divide_2 -findirect-dispatch execution - source compiled test

on Linux/ia32.

-- 
H.J.


[PATCH][ARM] testsuite, use arm_eabi iso arm*-*-*eabi*

2014-11-09 Thread Andreas Tobler

Hi,

the subject says it already.

The upcoming FreeBSD ARM target does not have eabi in the target 
triplet. But it is EABI based.


Patching these test cases makes them work under arm*-*-freebsd*.

I have not tested them under arm*-*-*eabi*, yet.
If a kind sould could help me out here? Would be great! I'd expect them 
to work.


There are probably more, but I want to split them to keep the overview :)

Ok for trunk?

TIA,
Andreas

2014-11-09  Andreas Tobler  andre...@gcc.gnu.org

* gcc.dg/fshort-wchar.c: Use arm_eabi instead of arm*-*-*eabi*.
* gcc.target/arm/aapcs/neon-vect1.c: Likewise.
* gcc.target/arm/aapcs/neon-vect2.c: Likewise.
* gcc.target/arm/aapcs/neon-vect3.c: Likewise.
* gcc.target/arm/aapcs/neon-vect4.c: Likewise.
* gcc.target/arm/aapcs/neon-vect5.c: Likewise.
* gcc.target/arm/aapcs/neon-vect6.c: Likewise.
* gcc.target/arm/aapcs/neon-vect7.c: Likewise.
* gcc.target/arm/aapcs/neon-vect8.c: Likewise.
* gcc.target/arm/aapcs/vfp1.c: Likewise.
* gcc.target/arm/aapcs/vfp2.c: Likewise.
* gcc.target/arm/aapcs/vfp3.c: Likewise.
* gcc.target/arm/aapcs/vfp4.c: Likewise.
* gcc.target/arm/aapcs/vfp5.c: Likewise.
* gcc.target/arm/aapcs/vfp6.c: Likewise.
* gcc.target/arm/aapcs/vfp7.c: Likewise.
* gcc.target/arm/aapcs/vfp8.c: Likewise.
* gcc.target/arm/aapcs/vfp9.c: Likewise.
* gcc.target/arm/aapcs/vfp10.c: Likewise.
* gcc.target/arm/aapcs/vfp11.c: Likewise.
* gcc.target/arm/aapcs/vfp12.c: Likewise.
* gcc.target/arm/aapcs/vfp13.c: Likewise.
* gcc.target/arm/aapcs/vfp14.c: Likewise.
* gcc.target/arm/aapcs/vfp15.c: Likewise.
* gcc.target/arm/aapcs/vfp16.c: Likewise.
* gcc.target/arm/aapcs/vfp17.c: Likewise.
Index: gcc.dg/fshort-wchar.c
===
--- gcc.dg/fshort-wchar.c   (revision 217256)
+++ gcc.dg/fshort-wchar.c   (working copy)
@@ -2,7 +2,7 @@
 
 /* { dg-do run } */
 /* { dg-options -fshort-wchar } */
-/* { dg-options -fshort-wchar -Wl,--no-wchar-size-warning { target 
arm*-*-*eabi* } } */
+/* { dg-options -fshort-wchar -Wl,--no-wchar-size-warning { target arm_eabi 
} } */
 
 /* Source: Neil Booth, 10 Dec 2002.
 
Index: gcc.target/arm/aapcs/neon-vect1.c
===
--- gcc.target/arm/aapcs/neon-vect1.c   (revision 217256)
+++ gcc.target/arm/aapcs/neon-vect1.c   (working copy)
@@ -1,6 +1,6 @@
 /* Test AAPCS layout (VFP variant for Neon types) */
 
-/* { dg-do run { target arm*-*-*eabi* } } */
+/* { dg-do run { target arm_eabi } } */
 /* { dg-require-effective-target arm_hard_vfp_ok  } */
 /* { dg-require-effective-target arm_neon_ok  } */
 /* { dg-require-effective-target arm32 } */
Index: gcc.target/arm/aapcs/neon-vect2.c
===
--- gcc.target/arm/aapcs/neon-vect2.c   (revision 217256)
+++ gcc.target/arm/aapcs/neon-vect2.c   (working copy)
@@ -1,6 +1,6 @@
 /* Test AAPCS layout (VFP variant for Neon types) */
 
-/* { dg-do run { target arm*-*-*eabi* } } */
+/* { dg-do run { target arm_eabi } } */
 /* { dg-require-effective-target arm_hard_vfp_ok } */
 /* { dg-require-effective-target arm_neon_ok } */
 /* { dg-require-effective-target arm32 } */
Index: gcc.target/arm/aapcs/neon-vect3.c
===
--- gcc.target/arm/aapcs/neon-vect3.c   (revision 217256)
+++ gcc.target/arm/aapcs/neon-vect3.c   (working copy)
@@ -1,6 +1,6 @@
 /* Test AAPCS layout (VFP variant for Neon types) */
 
-/* { dg-do run { target arm*-*-*eabi* } } */
+/* { dg-do run { target arm_eabi } } */
 /* { dg-require-effective-target arm_hard_vfp_ok } */
 /* { dg-require-effective-target arm_neon_ok } */
 /* { dg-require-effective-target arm32 } */
Index: gcc.target/arm/aapcs/neon-vect4.c
===
--- gcc.target/arm/aapcs/neon-vect4.c   (revision 217256)
+++ gcc.target/arm/aapcs/neon-vect4.c   (working copy)
@@ -1,6 +1,6 @@
 /* Test AAPCS layout (VFP variant for Neon types) */
 
-/* { dg-do run { target arm*-*-*eabi* } } */
+/* { dg-do run { target arm_eabi } } */
 /* { dg-require-effective-target arm_hard_vfp_ok  } */
 /* { dg-require-effective-target arm_neon_ok } */
 /* { dg-require-effective-target arm32 } */
Index: gcc.target/arm/aapcs/neon-vect5.c
===
--- gcc.target/arm/aapcs/neon-vect5.c   (revision 217256)
+++ gcc.target/arm/aapcs/neon-vect5.c   (working copy)
@@ -1,6 +1,6 @@
 /* Test AAPCS layout (VFP variant for Neon types) */
 
-/* { dg-do run { target arm*-*-*eabi* } } */
+/* { dg-do run { target arm_eabi } } */
 /* { dg-require-effective-target arm_hard_vfp_ok } */
 /* { dg-require-effective-target arm_neon_ok } */
 /* { dg-require-effective-target arm32 } */
Index: 

Re: patch to fix PR63620

2014-11-09 Thread Jack Howarth
I don't see any regressions in the libjava test suite on
x86_64-apple-darwin14 at r217265 for -m32/-m64 regression testing but
I also have...

https://gcc.gnu.org/bugzilla/attachment.cgi?id=33843 from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63622#c3

to prevent alias creation on targets that don't support aliasing and

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63534#c50

to eliminate breakage of the asan tests at -m32 from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63773 installed in my
tree.

On Sun, Nov 9, 2014 at 3:08 PM, H.J. Lu hjl.to...@gmail.com wrote:
 On Sun, Nov 9, 2014 at 8:47 AM, Vladimir Makarov vmaka...@redhat.com wrote:
 The following patch solves PR63620.  The details can be found

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620

 The patch is more than just the problem solution.  It adds global live
 analysis for pseudos when it is necessary (live info change on a BB
 border triggers it).  The patch opens a door for global optimizations
 and transformations in LRA and it will be also useful for performance
 problems reported by people in coming LRA rematerialization.

 The impact on compiler time is insignificant about 0.3% on whole
 SPEC2000 compilation (and about the same on a compilation of 500K
 lines FORTRAN file).

 The patch was successfully bootstrapped on x86/x86-64, ppc64, and ARM and
 tested on x86/x86-64 and ppc64.

 Committed as rev. 217265.


 2014-11-09  Vladimir Makarov  vmaka...@redhat.com

 PR rtl-optimization/63620
 * lra-constraints.c (substitute_pseudo): Add prefix lra_ to the
 name.  Move to lra.c.  Make it external.
 (substitute_pseudo_within_insn): Ditto.
 (inherit_reload_reg, split_reg, remove_inheritance_pseudos): Use
 the new names.
 (undo_optional_reloads): Ditto.
 * lra-int.h (lra_dump_bitmap_with_title, lra_substitute_pseudo):
 New prototypes.
 (lra_substitute_pseudo_within_insn): Ditto.
 * lra-lives.c (bb_killed_pseudos, bb_gen_pseudos): New.
 (mark_regno_live): Add parameter.  Update bb_gen_pseudos.
 (mark_regno_dead): Add parameter.  Update bb_gen_pseudos and
 bb_killed_pseudos.
 (struct bb_data, bb_data_t, bb_data): New.
 (get_bb_data, get_bb_data_by_index): Ditto.
 (all_hard_regs_bitmap): New.
 (live_trans_fun, live_con_fun_0, live_con_fun_n, all_blocks): New.
 (initiate_live_solver, finish_live_solver): New.
 (process_bb_lives): Change return type.  Add code updating local
 live data and removing dead insns.  Pass new argument to
 mark_regno_live and mark_regno_dead.  Check changing bb pseudo
 life info.  Return the result.
 (lra_create_live_ranges): Add code to do global pseudo live
 analysis.
 (lra_live_ranges_init): Call initiate_live_solver.
 (lra_live_ranges_finish): Call finish_live_solver.
 * lra.c (lra_dump_bitmap_with_title): New.
 (lra_substitute_pseudo, lra_substitute_pseudo_within_insn): Move
 from lra-constraints.c.

 It caused libjava failures:

 FAIL: Array_3 execution - source compiled test
 FAIL: Array_3 -findirect-dispatch execution - source compiled test
 FAIL: Array_3 -O3 -findirect-dispatch execution - source compiled test
 FAIL: Divide_2 execution - source compiled test
 FAIL: Divide_2 -findirect-dispatch execution - source compiled test

 on Linux/ia32.

 --
 H.J.


Re: [gofrontend-dev] [PATCH 4/4] Gccgo port to s390[x] -- part II

2014-11-09 Thread Michael Hudson-Doyle
Ian Taylor i...@golang.org writes:

 I don't know what's up with the complex number change.  In general the
 Go compiler and libraries go to some effort to produce the same
 answers on all platforms.  We need to understand why we get different
 answers on s390 (you may understand the differences, but I don't).

Oh, I know this one.  I've even filed yet another bug about it:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59714

I assume s390 has a fused multiply add instruction?  It's because
libgcc's implementation of complex division is written in a way such
that gcc compiles an expression like a*b-c*d as fma(a,b,-c*d) and even if
a==c and b==d the latter expression doesn't return 0 unless things are
in power of 2 ratios with one another.

 I won't change the tests without a clear understanding of why we are
 changing them.

I think the *real* fix is for libgcc to use Kahan's compensated
algorithm for 2 by 2 determinants[1] to compute a*b-c*d when fma is
available.

Cheers,
mwh

[1] That's something like this:

// This implements what is sometimes called Kahan's compensated algorithm 
for
// 2 by 2 determinants.  It returns a*b + c*d to a high degree of precision
// but depends on a fused-multiply add operation that rounds once.
//
// The obvious algorithm has problems when a*b and c*d nearly cancel, but 
the
// trick is the calculation of 'e': a*b = w + e is exact when the operands
// are considered as real numbers.  So if c*d nearly cancels out w, e 
restores
// the result to accuracy.
double
Kahan(double a, double b, double c, double d)
{
  double w, e, f;
  w = b * a;
  e = fma(b, a, -w);
  f = fma(d, c, w);
  return f + e;
}

Algorithms like this is why the fma operation was introduced in the
first place!


pgpEbbVCSQqC8.pgp
Description: PGP signature


[RFC] Elimination of zext/sext - type promotion pass

2014-11-09 Thread Kugan

 Well - the best way would be to expose the target specifics to GIMPLE
 at some point in the optimization pipeline.  My guess would be that it's
 appropriate after loop optimizations (but maybe before induction variable
 optimization).
 
 That is, have a pass that applies register promotion to all SSA names
 in the function, inserting appropriate truncations and extensions.  That
 way you'd never see (set (subreg...) on RTL.  The VRP and DOM
 passes running after that pass would then be able to aggressively
 optimize redundant truncations and extensions.
 
 Effects on debug information are to be considered.  You can change
 the type of SSA names in-place but you don't want to do that for
 user DECLs (and we can't have the SSA name type and its DECL
 type differ - and not sure if we might want to lift that restriction).


Thanks for the comments. Here is a prototype patch that implements a
type promotion pass. This pass records SSA variables that will have
values in higher bits (than the original type precision) if promoted and
uses this information in inserting appropriate truncations and
extensions. This pass also classifies some of the stmts that sets ssa's
to be unsafe to promote. Here is a gimple difference for the type
promotion as compared to previous dump for a testcase.

 crc2 (short unsigned int crc, unsigned char data)
 {
   unsigned char carry;
   unsigned char x16;
   unsigned char i;
-  unsigned char ivtmp_5;
+  unsigned int _2;
+  unsigned char _3;
+  unsigned int _4;
+  unsigned int _5;
   unsigned char _9;
-  unsigned char _10;
-  unsigned char ivtmp_18;
+  unsigned int _10;
+  unsigned int _11;
+  unsigned int _12;
+  unsigned int _13;
+  unsigned int _15;
+  unsigned int _16;
+  unsigned int _18;
+  unsigned int _21;
+  unsigned int _22;
+  unsigned int _24;
+  short unsigned int _26;
+  unsigned char _27;
+  unsigned int _28;
+  unsigned int _29;
+  unsigned int _30;

   bb 2:
+  _12 = (unsigned int) data_8(D);
+  _2 = (unsigned int) crc_7(D);

   bb 3:
-  # crc_28 = PHI crc_2(5), crc_7(D)(2)
-  # data_29 = PHI data_12(5), data_8(D)(2)
-  # ivtmp_18 = PHI ivtmp_5(5), 8(2)
-  _9 = (unsigned char) crc_28;
-  _10 = _9 ^ data_29;
-  x16_11 = _10  1;
-  data_12 = data_29  1;
-  if (x16_11 == 1)
+  # _30 = PHI _28(5), _2(2)
+  # _16 = PHI _29(5), _12(2)
+  # _4 = PHI _18(5), 8(2)
+  _9 = (unsigned char) _30;
+  _5 = (unsigned int) _9;
+  _22 = _5 ^ _16;
+  _10 = _22  1;
+  _29 = _16  1;
+  _27 = (unsigned char) _10;
+  if (_27 == 1)
 goto bb 4;
   else
 goto bb 7;

   bb 4:
-  crc_13 = crc_28 ^ 16386;
-  crc_24 = crc_13  1;
-  crc_15 = crc_24 | 32768;
+  _11 = _30 ^ 16386;
+  _13 = _11  1;
+  _24 = _13 | 32768;

   bb 5:
-  # crc_2 = PHI crc_15(4), crc_21(7)
-  ivtmp_5 = ivtmp_18 - 1;
-  if (ivtmp_5 != 0)
+  # _28 = PHI _24(4), _15(7)
+  _18 = _4 - 1;
+  _3 = (unsigned char) _18;
+  if (_3 != 0)
 goto bb 3;
   else
 goto bb 6;

   bb 6:
-  # crc_19 = PHI crc_2(5)
-  return crc_19;
+  # _21 = PHI _28(5)
+  _26 = (short unsigned int) _21;
+  return _26;

   bb 7:
-  crc_21 = crc_28  1;
+  _15 = _30  1;
   goto bb 5;

 }


I experimented with few simple test-cases and results so far are mixed.
It also seems that subsequent passes are not always optimising as
expected. I haven't looked in detail but will look into it based on the
feedback.

Please also note that this pass still doest handle debug instructions
and there are couple regression failures for ARM.

Thanks,
Kugan


diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a51393..1e26172 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2014-11-08  Kugan Vivekanandarajah  kug...@linaro.org
+
+   * Makefile.in (OBJS): Add tree-type-prmtn.o.
+   * common.opt (ftree-type-prmt): New flag.
+   * opts.c (OPT_ftree_type_prmt): New option added.
+   * passes.def: New pass included.
+   * tree-pass.h: LikeWise.
+   * timevar.def (TV_TREE_TYPE_PRMT): New timevar.
+   * tree-type-prmtn.c: New file.
+
 2014-11-08  Richard Sandiford  richard.sandif...@arm.com
 
* config/aarch64/aarch64.c: Include rtl-iter.h.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 2c3f02e..2c257b9 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1463,6 +1463,7 @@ OBJS = \
tree-vect-slp.o \
tree-vectorizer.o \
tree-vrp.o \
+   tree-type-prmtn.o \
tree.o \
valtrack.o \
value-prof.o \
diff --git a/gcc/common.opt b/gcc/common.opt
index b400636..4556e0a 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2304,6 +2304,10 @@ ftree-vrp
 Common Report Var(flag_tree_vrp) Init(0) Optimization
 Perform Value Range Propagation on trees
 
+ftree-type-prmt
+Common Report Var(flag_tree_type_prmt) Init(0) Optimization
+Perform Type Promotion on trees
+
 funit-at-a-time
 Common Report Var(flag_unit_at_a_time) Init(1) Optimization
 Compile whole compilation unit at a time
diff --git a/gcc/opts.c b/gcc/opts.c
index 752cc84..784c74f 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c

[PATCH] libstdc++ - Add xmethods for associative containers (ordered and unordered)

2014-11-09 Thread Siva Chandra
Hello,

Attached is a patch which adds xmethods for the associative containers
(set, map, multiset and multimap) and their unordered versions. I
think the GDB Python API is not rich enough to implement xmethods for
the more interesting methods like find, count etc. The attached patch
only implements xmethods for size and empty. That way, it is a fairly
straightforward patch.

libstdc++-v3/ChangeLog:

2014-11-09  Siva Chandra Reddy  sivachan...@google.com

* python/libstdcxx/v6/xmethods.py: Add xmethods for associative
containers.
* testsuite/libstdc++-xmethods/associative-containers.cc: New
file.
diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py 
b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
index 6af1c95..2198411 100644
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
@@ -422,6 +422,50 @@ class VectorMethodsMatcher(gdb.xmethod.XMethodMatcher):
 return None
 return method.worker_class(class_type.template_argument(0))
 
+# Xmethods for associative containers
+
+class AssociativeContainerWorkerBase(gdb.xmethod.XMethodWorker):
+def __init__(self, unordered):
+self._unordered = unordered
+
+def node_count(self, obj):
+if self._unordered:
+return obj['_M_h']['_M_element_count']
+else:
+return obj['_M_t']['_M_impl']['_M_node_count']
+
+def get_arg_types(self):
+return None
+
+class AssociativeContainerEmptyWorker(AssociativeContainerWorkerBase):
+def __call__(self, obj):
+return int(self.node_count(obj)) == 0
+
+class AssociativeContainerSizeWorker(AssociativeContainerWorkerBase):
+def __call__(self, obj):
+return self.node_count(obj)
+
+class AssociativeContainerMethodsMatcher(gdb.xmethod.XMethodMatcher):
+def __init__(self, name):
+gdb.xmethod.XMethodMatcher.__init__(self,
+matcher_name_prefix + name)
+self._name = name
+self._method_dict = {
+'size': LibStdCxxXMethod('size', AssociativeContainerSizeWorker),
+'empty': LibStdCxxXMethod('empty',
+  AssociativeContainerEmptyWorker),
+}
+self.methods = [self._method_dict[m] for m in self._method_dict]
+
+def match(self, class_type, method_name):
+if not re.match('^std::%s.*$' % self._name, class_type.tag):
+return None
+method = self._method_dict.get(method_name)
+if method is None or not method.enabled:
+return None
+unordered = 'unordered' in self._name
+return method.worker_class(unordered)
+
 # Xmethods for std::unique_ptr
 
 class UniquePtrGetWorker(gdb.xmethod.XMethodWorker):
@@ -465,4 +509,20 @@ def register_libstdcxx_xmethods(locus):
 gdb.xmethod.register_xmethod_matcher(locus, DequeMethodsMatcher())
 gdb.xmethod.register_xmethod_matcher(locus, ListMethodsMatcher())
 gdb.xmethod.register_xmethod_matcher(locus, VectorMethodsMatcher())
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('set'))
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('map'))
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('multiset'))
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('multimap'))
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('unordered_set'))
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('unordered_map'))
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('unordered_multiset'))
+gdb.xmethod.register_xmethod_matcher(
+locus, AssociativeContainerMethodsMatcher('unordered_multimap'))
 gdb.xmethod.register_xmethod_matcher(locus, UniquePtrMethodsMatcher())
diff --git 
a/libstdc++-v3/testsuite/libstdc++-xmethods/associative-containers.cc 
b/libstdc++-v3/testsuite/libstdc++-xmethods/associative-containers.cc
new file mode 100644
index 000..7949f22
--- /dev/null
+++ b/libstdc++-v3/testsuite/libstdc++-xmethods/associative-containers.cc
@@ -0,0 +1,79 @@
+// { dg-do run }
+// { dg-options -std=gnu++11 -g -O0 }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should 

Re: [PATCH, libfortran] PR 47007, 61847 Locale failures in libgfortran

2014-11-09 Thread Janne Blomqvist
On Sat, Nov 8, 2014 at 2:21 AM, Jerry DeLisle jvdeli...@charter.net wrote:
 On 11/07/2014 02:15 AM, Janne Blomqvist wrote:

 On Thu, Nov 6, 2014 at 12:38 PM, Janne Blomqvist
 blomqvist.ja...@gmail.com wrote:

 On Wed, Nov 5, 2014 at 12:48 PM, Janne Blomqvist
 blomqvist.ja...@gmail.com wrote:

 Hi,

 the attached patch fixes a few locale related failures in libgfortran,
 in the case where the POSIX 2008 extended locale functionality and
 extensions strto{f,d,ld}_l are present.

 These failures typically occur when libgfortran is used from a program
 which has set the locale with setlocale(), and the locale uses a
 different decimal separator than the C locale. The patch fixes this by
 creating a C locale which is then used by strto{f,d,ld}_l, and also is
 installed as the per-thread locale when starting a formatted IO, then
 reset to the previous value when the IO is done. I have chosen to not
 fallback to calling setlocale() in case the POSIX 2008 locale stuff
 isn't available, as that could create nasty hard to debug race
 conditions in a multi-threaded program.

 (I think Jerry's proposed patch which checks the locale for the
 decimal separator is still useful as a fallback in case the POSIX 2008
 locale stuff isn't available)


 Hi,

 updated patch attached. Since the patch sets the per-thread locale
 with uselocale, using the non-standard strto{f,d,ld}_l functions isn't
 necessary. When getting rid of this part of the original patch, I
 noticed a few failures due to the uselocale() calls being in the wrong
 places. These are fixed in the updated patch. Also Jakub's suggestion
 has been incorporated. Further, investigation revealed that some
 targets (Darwin and Freebsd) have the extended locale functionality in
 xlocale.h rather than locale.h as POSIX 2008 specifies. So check for
 that header. Finally, as we set the per-thread locale to C, we'd
 lose localized error messages. So the updated patch fixes this by
 updating the gf_strerror() function as well.


 Hi again!

 Well, for all my ranting against using setlocale() in a library
 potentially used by multi-threaded programs, here's a patch that does
 exactly that, as a fallback in case the POSIX 2008 per-thread locale
 stuff isn't available. So this can be seen as an alternative to the
 approach Jerry suggested in the patch attached in PR 61847.

 - Jerry's patch (use localeconv() to figure out the decimal separator)
- Race condition if locale is set between OPEN (where the separator
 is checked) and READ/WRITE.
- Potential breakage in weird locales where the decimal separator
 isn't . or ,? See
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847#c21
- Other potential issues with weird locales? E.g. are there locales
 which use grouping characters, e.g. 1e6 is 1,000,000.0?

 - My patch (use setlocale(LC_NUMERIC, C) when starting formatted
 I/O, change back when I/O statement is done.)
- Race condition if locale is set concurrently in another thread
 while a formatted I/O is in progress.
- Potential problem if another thread does something dependent on
 LC_NUMERIC while a formatted I/O is in progress in one thread.
- Should be robust against weird locales.

 In both cases IMHO these approaches should be used only if the POSIX
 2008 per-thread locale stuff isn't available. I have no strong
 opinions which is preferable, comments?

 Attached is locale3_top2.diff, which is on top of my previous patch,
 and locale3.diff which includes the previous patch and applies against
 trunk.

 Ok for trunk?


 OK, thanks for doing all the work.  ;)

I realized my setlocale fallback wouldn't work correctly if we have
multiple threads doing formatted I/O concurrently. Committed the patch
with the fallback part per the attached part.


-- 
Janne Blomqvist
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 41d6559..0d19e7a 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1223,10 +1223,26 @@ implemented with the @code{system} function, which need 
not be
 thread-safe.  It is the responsibility of the user to ensure that
 @code{system} is not called concurrently.
 
-Finally, for platforms not supporting thread-safe POSIX functions,
-further functionality might not be thread-safe.  For details, please
-consult the documentation for your operating system.
-
+For platforms not supporting thread-safe POSIX functions, further
+functionality might not be thread-safe.  For details, please consult
+the documentation for your operating system.
+
+The GNU Fortran runtime library uses various C library functions that
+depend on the locale, such as @code{strtod} and @code{snprintf}.  In
+order to work correctly in locale-aware programs that set the locale
+using @code{setlocale}, the locale is reset to the default ``C''
+locale while executing a formatted @code{READ} or @code{WRITE}
+statement.  On targets supporting the POSIX 2008 per-thread locale
+functions (e.g. @code{newlocale}, @code{uselocale},

[PATCH] Fix PR 63748

2014-11-09 Thread Patrick Palka
PR 63748 reports a false-positive uninitialized warning under the
presence of abnormal edges.  The statements for which the uninitialized
warnings are emitted all look like:

  buf_117(ab) = buf_317(D)(ab);

This PR is similar to PR 57287 which also reports false-positive
uninitialized warnings under the presence of abnormal edges.  That PR
fixed the reported issue by allowing to propagate default definitions
which appear in abnormal PHI nodes.  That is, it allowed propagating the
following kinds of copies:

  buf_24 = buf_16(D)(ab);

But it still did not allow propagating copies whose destination operand
occurs in an abnormal PHI node.  To fix PR 63748, this patch extends the
fix to PR 57287 to allow propagating such copies too.

Full bootstrap + regtesting on x86_64-unknown-linux-gnu is in progress.
Is this patch OK if testing succeeds with no new regressions?

2014-11-10  Patrick Palka  ppa...@gcc.gnu.org

gcc/
PR middle-end/63748
* tree-ssa-propagate.c (may_propagate_copy): Allow propagating
SSA copies whose source and destination names both occur in
abnormal edges.

gcc/testsuite/
PR middle-end/63748
* gcc.dg/pr63748.c: New testcase.
---
 gcc/testsuite/gcc.dg/pr63748.c | 36 
 gcc/tree-ssa-propagate.c   | 27 +++
 2 files changed, 51 insertions(+), 12 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/pr63748.c

diff --git a/gcc/testsuite/gcc.dg/pr63748.c b/gcc/testsuite/gcc.dg/pr63748.c
new file mode 100644
index 000..2e50445
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63748.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options -O2 -Wall } */
+
+#include setjmp.h
+
+jmp_buf *alloc_jmp_buf ();
+int foo (void *);
+
+int
+test (int op, int noside)
+{
+  void *argvec = 0;
+
+  if (op)
+{
+  jmp_buf *buf = alloc_jmp_buf (); /* { dg-bogus uninitialized } */
+  setjmp (*buf);
+
+  if (noside)
+goto nosideret;
+
+do_call_it:
+
+  if (noside)
+goto nosideret;
+
+  return foo (argvec);
+}
+
+  argvec = __builtin_alloca (1);
+  goto do_call_it;
+
+nosideret:
+  return 1;
+}
+
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 9f4d381..9e61baf 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1275,21 +1275,24 @@ may_propagate_copy (tree dest, tree orig)
   tree type_d = TREE_TYPE (dest);
   tree type_o = TREE_TYPE (orig);
 
-  /* If ORIG flows in from an abnormal edge, it cannot be propagated.  */
+  /* If ORIG is a default definition which flows in from an abnormal edge
+ then the copy can be propagated.  It is important that we do so to avoid
+ uninitialized regular copies.  */
   if (TREE_CODE (orig) == SSA_NAME
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)
-  /* If it is the default definition and an automatic variable then
- we can though and it is important that we do to avoid
-uninitialized regular copies.  */
-   !(SSA_NAME_IS_DEFAULT_DEF (orig)
-   (SSA_NAME_VAR (orig) == NULL_TREE
-  || TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL)))
+   SSA_NAME_IS_DEFAULT_DEF (orig)
+   (SSA_NAME_VAR (orig) == NULL_TREE
+ || TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL))
+;
+  /* Otherwise if ORIG just flows in from an abnormal edge then the copy cannot
+ be propagated.  */
+  else if (TREE_CODE (orig) == SSA_NAME
+   SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig))
 return false;
-
-  /* If DEST is an SSA_NAME that flows from an abnormal edge, then it
- cannot be replaced.  */
-  if (TREE_CODE (dest) == SSA_NAME
-   SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest))
+  /* Similarly if DEST flows in from an abnormal edge then the copy cannot be
+ propagated.  */
+  else if (TREE_CODE (dest) == SSA_NAME
+   SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest))
 return false;
 
   /* Do not copy between types for which we *do* need a conversion.  */
-- 
2.2.0.rc0.18.ga1ad247



Add the latest C++ SD-6 additions.

2014-11-09 Thread Ed Smith-Rowland
I would like to put this patch out before Stage 1 ends even if there is 
bikeshed renaming of macros in the next couple weeks as the C++ 
committee wraps up after their meeting.


The main part of this patch is a __has_cpp_attribute macro.
#if __has_cpp_attribute(foobar)
#else
#endif

In C++ we can use namespaces as well:
#if __has_cpp_attribute(gnu::foobar)
#else
#endif

I also added __has_attribute with the same sematics as an extension 
since clang has it.

I made these available to C as well as C++.

There are also two C++98 flags in SD-6 added since most compilers allow 
one to switch these features off:
__cpp_rtti, __cpp_exceptions.  These are not defined if -fno-rtti 
-fno-exceptions respectively.


Also, the macro __cpp_attribute_deprecated has been removed in favor of 
__has_cpp_attribute(deprecated).
Since __cpp_attribute_deprecated is out in the wild in the latest 
gcc-4.9 release perhaps I need to support this
even if, in an ironic twist, __cpp_attribute_deprecated is deprecated.  
Let me know.


This builds clean on x86_64-linux.

Is this OK once it passes testing?

Ed

libcpp:

2014-11-10  Edward Smith-Rowland  3dw...@verizon.net

* include/cpplib.h (cpp_callbacks): Add has_attribute.
* internal.h (lexer_state): Add in__has_attribute__.
* directives.c (lex_macro_node): Prevent use of __has_attribute__
as a macro.
* expr.c (parse_has_attribute): New function; (eval_token): Look for
__has_attribute__ and route to parse_has_attribute.
* identifiers.c (_cpp_init_hashtable): Initialize n__has_attribute__.
* pch.c (cpp_read_state): Initialize n__has_attribute__.
* traditional.c (enum ls): Add ls_has_attribute, ls_has_attribute_close;
(_cpp_scan_out_logical_line): Attend to __has_attribute__.


gcc/c-family:

2014-11-10  Edward Smith-Rowland  3dw...@verizon.net

* c-cppbuiltin.c (__has_attribute, __has_cpp_attribute): New macros;
(__cpp_rtti, __cpp_exceptions): New macros for C++98;
(__cpp_range_based_for, __cpp_initializer_lists,
__cpp_delegating_constructors, __cpp_nsdmi,
__cpp_inheriting_constructors, __cpp_ref_qualifiers): New macros
for C++11; (__cpp_attribute_deprecated): Remove in favor of
__has_cpp_attribute.
* c-lex.c (cb_has_attribute): New callback CPP function;
(init_c_lex): Set has_attribute callback.


gcc/testsuite:

2014-11-10  Edward Smith-Rowland  3dw...@verizon.net

* g++.dg/cpp1y/feat-cxx11.C: Test new feature macros for C++98
and C++11; Test existence of __has_cpp_attribute;  Test C++11
attributes.
* g++.dg/cpp1y/feat-cxx11-neg.C: Ditto.
* g++.dg/cpp1y/feat-cxx14.C: Ditto and test for C++14 attributes.
* g++.dg/cpp1y/feat-cxx98.C: Test new feature macros for C++98.
* g++.dg/cpp1y/feat-cxx98-neg.C: Ditto.
* g++.dg/cpp1y/feat-neg.C: Test that __cpp_rtti, _cpp_exceptions
will be undefined for -fno-rtti -fno-exceptions.
Index: libcpp/include/cpplib.h
===
--- libcpp/include/cpplib.h (revision 217269)
+++ libcpp/include/cpplib.h (working copy)
@@ -580,6 +580,9 @@
  Second argument is the location of the start of the current expansion.  */
   void (*used) (cpp_reader *, source_location, cpp_hashnode *);
 
+  /* Callback to identify whether an attribute exists.  */
+  int (*has_attribute) (cpp_reader *);
+
   /* Callback that can change a user builtin into normal macro.  */
   bool (*user_builtin_macro) (cpp_reader *, cpp_hashnode *);
 };
Index: libcpp/internal.h
===
--- libcpp/internal.h   (revision 217269)
+++ libcpp/internal.h   (working copy)
@@ -261,6 +261,9 @@
   /* Nonzero if in a __has_include__ or __has_include_next__ statement.  */
   unsigned char in__has_include__;
 
+  /* Nonzero if in a __has_attribute__ statement.  */
+  unsigned char in__has_attribute__;
+
   /* Nonzero if prevent_expansion is true only because output is
  being discarded.  */
   unsigned char discarding_output;
@@ -284,6 +287,7 @@
   cpp_hashnode *n__VA_ARGS__;  /* C99 vararg macros */
   cpp_hashnode *n__has_include__;  /* __has_include__ operator */
   cpp_hashnode *n__has_include_next__; /* __has_include_next__ operator */
+  cpp_hashnode *n__has_attribute__;/* __has_attribute__ operator */
 };
 
 typedef struct _cpp_line_note _cpp_line_note;
Index: libcpp/directives.c
===
--- libcpp/directives.c (revision 217269)
+++ libcpp/directives.c (working copy)
@@ -571,6 +571,10 @@
 || node == pfile-spec_nodes.n__has_include_next__))
cpp_error (pfile, CPP_DL_ERROR,
   \__has_include__\ cannot be used as a macro name);
+  else if (is_def_or_undef
+node == pfile-spec_nodes.n__has_attribute__)
+   cpp_error (pfile, 

Re: Add the latest C++ SD-6 additions.

2014-11-09 Thread Jason Merrill

On 11/09/2014 08:33 PM, Ed Smith-Rowland wrote:

+  //cpp_hashnode *node = 0;
+  //node = token-val.node.node;
+  //if (node)
+  //  pfile-mi_ind_cmacro = node;


Remove this commented-out code?

The patch is OK.

Jason



C++ PATCH for core DR 2007

2014-11-09 Thread Jason Merrill
DR 2007 points out that there's no need to do argument-dependent lookup 
for operator=, which has to be a member function.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 7601c0b8fb5d7093479f5587057f049bdc6cb622
Author: Jason Merrill ja...@redhat.com
Date:   Sat Nov 8 09:32:15 2014 -0600

	DR 2007
	* call.c (build_new_op_1): Don't do non-class lookup for =, - or [].

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 31864e9..bf191ca 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5309,6 +5309,7 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
 
   arg1 = prep_operand (arg1);
 
+  bool memonly = false;
   switch (code)
 {
 case NEW_EXPR:
@@ -5340,6 +5341,16 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
   code_orig_arg1 = TREE_CODE (TREE_TYPE (arg1));
   code_orig_arg2 = TREE_CODE (TREE_TYPE (arg2));
   break;
+
+  /* =, -, [], () must be non-static member functions.  */
+case MODIFY_EXPR:
+  if (code2 != NOP_EXPR)
+	break;
+case COMPONENT_REF:
+case ARRAY_REF:
+  memonly = true;
+  break;
+
 default:
   break;
 }
@@ -5369,10 +5380,12 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
 
   /* Add namespace-scope operators to the list of functions to
  consider.  */
-  add_candidates (lookup_function_nonclass (fnname, arglist, /*block_p=*/true),
-		  NULL_TREE, arglist, NULL_TREE,
-		  NULL_TREE, false, NULL_TREE, NULL_TREE,
-		  flags, candidates, complain);
+  if (!memonly)
+add_candidates (lookup_function_nonclass (fnname, arglist,
+	  /*block_p=*/true),
+		NULL_TREE, arglist, NULL_TREE,
+		NULL_TREE, false, NULL_TREE, NULL_TREE,
+		flags, candidates, complain);
 
   args[0] = arg1;
   args[1] = arg2;
diff --git a/gcc/testsuite/g++.dg/template/operator14.C b/gcc/testsuite/g++.dg/template/operator14.C
new file mode 100644
index 000..6267dbb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/operator14.C
@@ -0,0 +1,7 @@
+// DR 2007
+// We shouldn't instantiate Avoid to lookup operator=, since operator=
+// must be a non-static member function.
+
+templatetypename T struct A { typename T::error e; };
+templatetypename T struct B { };
+BAvoid  b1, b2 = (b1 = b1);


C++ PATCH to correct DR 799 fix

2014-11-09 Thread Jason Merrill
Someone was noticing that whether the result of reinterpret_castint 
was an lvalue or rvalue depended on constant folding.  It should always 
be an rvalue.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit ff6494228a9bc40c7b78109163054840c1e44855
Author: Jason Merrill ja...@redhat.com
Date:   Sat Nov 8 15:35:38 2014 -0600

	DR 799
	* typeck.c (build_reinterpret_cast_1): reinterpret_cast to the
	same scalar type is an rvalue.

diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 99f4b88..d0f5ccd 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6898,7 +6898,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
 	|| TYPE_PTR_OR_PTRMEM_P (type))
 	same_type_p (type, intype))
 /* DR 799 */
-return fold_if_not_in_template (build_nop (type, expr));
+return rvalue (expr);
   else if ((TYPE_PTRFN_P (type)  TYPE_PTRFN_P (intype))
 	   || (TYPE_PTRMEMFUNC_P (type)  TYPE_PTRMEMFUNC_P (intype)))
 return fold_if_not_in_template (build_nop (type, expr));
diff --git a/gcc/testsuite/g++.dg/conversion/reinterpret1.C b/gcc/testsuite/g++.dg/conversion/reinterpret1.C
index aa55f6f..d456782 100644
--- a/gcc/testsuite/g++.dg/conversion/reinterpret1.C
+++ b/gcc/testsuite/g++.dg/conversion/reinterpret1.C
@@ -3,4 +3,4 @@
 struct Y { Y(int ); };
 
 int v;
-Y y1(reinterpret_castint(v));
+Y y1(reinterpret_castint(v));  // { dg-error  }


PATCH to fix warnings in avx headers

2014-11-09 Thread Jason Merrill
Warnings are suppressed in these headers by default, but I noticed some 
after preprocessing and stripping # lines.  A few functions were missing 
return types, and _mm256_broadcast_f32x2 was passing a constant value 
that overflows the 8-bit type of the parameter.


Tested x86_64-pc-linux-gnu, applying to trunk as obvious.
commit db1c21e59e91f821ef33ab1f324507992ba5ba2f
Author: Jason Merrill ja...@redhat.com
Date:   Fri Nov 7 20:21:56 2014 -0600

	* config/i386/avx512vldqintrin.h (_mm256_broadcast_f32x2): __mmask8.
	* config/i386/avx512vlintrin.h (_mm256_mask_cvtepi32_storeu_epi16)
	(_mm_mask_cvtusepi32_storeu_epi16)
	(_mm_mask_cvtsepi64_storeu_epi32): Return void.

diff --git a/gcc/config/i386/avx512vldqintrin.h b/gcc/config/i386/avx512vldqintrin.h
index 43a7388..4ad1fd7 100644
--- a/gcc/config/i386/avx512vldqintrin.h
+++ b/gcc/config/i386/avx512vldqintrin.h
@@ -453,7 +453,7 @@ _mm256_broadcast_f32x2 (__m128 __A)
 {
   return (__m256) __builtin_ia32_broadcastf32x2_256_mask ((__v4sf) __A,
 		  (__v8sf)_mm256_undefined_ps(),
-			  (__mmask16) -
+			  (__mmask8) -
 			  1);
 }
 
diff --git a/gcc/config/i386/avx512vlintrin.h b/gcc/config/i386/avx512vlintrin.h
index f39f7f3..a042e8c 100644
--- a/gcc/config/i386/avx512vlintrin.h
+++ b/gcc/config/i386/avx512vlintrin.h
@@ -1710,7 +1710,7 @@ _mm256_cvtepi32_epi16 (__m256i __A)
 		  (__mmask8) -1);
 }
 
-extern __inline
+extern __inline void
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_mask_cvtepi32_storeu_epi16 (void *  __P, __mmask8 __M, __m256i __A)
 {
@@ -1813,7 +1813,7 @@ _mm_cvtusepi32_epi16 (__m128i __A)
 		(__mmask8) -1);
 }
 
-extern __inline
+extern __inline void
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_mask_cvtusepi32_storeu_epi16 (void * __P, __mmask8 __M, __m128i __A)
 {
@@ -2360,7 +2360,7 @@ _mm_cvtsepi64_epi32 (__m128i __A)
 		   (__mmask8) -1);
 }
 
-extern __inline
+extern __inline void
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_mask_cvtsepi64_storeu_epi32 (void * __P, __mmask8 __M, __m128i __A)
 {


Re: [PATCH 5/5] Add illegal cilk checks to C++ front.

2014-11-09 Thread Jason Merrill

On 10/01/2014 11:26 PM, Andi Kleen wrote:

+  if (check_no_cilk (cond, in a condition for a for-loop))


Why is this one in while the others are as?

The patch is OK in any case.

Please ping me directly on C++ patches.

Thanks,
Jason




Re: [PR c/52952] More precise locations within format strings

2014-11-09 Thread Jeff Law

On 11/08/14 02:20, Manuel López-Ibáñez wrote:

On 7 November 2014 22:39, Joseph Myers jos...@codesourcery.com wrote:

Neither Per nor Tom are active in GCC anymore. If the FE maintainers
do not feel comfortable reviewing line-map changes, could you nominate
Dodji as line-map maintainer if he is willing to accept it? I think he
is currently the person that understands that code best.


I think Dodji as diagnostics maintainer is better placed than I am to
review line-map patches.


Then, do you mean that line-map falls under the reach of the
diagnostics maintainer? I agree, but Dodji himself does not seem to be
sure about this:

https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02444.html

It would be helpful if one of the FE maintainers clarified this once
and for all.
If the front-end maintainers think Dodji is the best person to handle 
this stuff, and Dodji is willing, then I think we should make add the 
linemap stuff to Dodji's plate.


Jeff


[PATCH, AArch64] Add doloop_end pattern for -fmodulo-sched

2014-11-09 Thread Yangfei (Felix)
Hi, 
This patch adds doloop_end standard pattern for AArch64 port so that 
-fmodulo-sched can do its job. 
Reg-tested for aarch64-linux-gnu with QEMU.  OK for the trunk? 


Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 216838)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2014-11-10  Felix Yang  felix.y...@huawei.com
+
+   * config/aarch64/aarch64.md (doloop_end): New pattern.
+
 2014-10-29  Richard Sandiford  richard.sandif...@arm.com
 
* addresses.h, alias.c, asan.c, auto-inc-dec.c, bt-load.c, builtins.c,
Index: gcc/config/aarch64/aarch64.md
===
--- gcc/config/aarch64/aarch64.md   (revision 216838)
+++ gcc/config/aarch64/aarch64.md   (working copy)
@@ -4087,6 +4087,48 @@
   [(set_attr type mrs)])
 
 
+;; Define the subtract-one-and-jump insns so loop.c
+;; knows what to generate.
+(define_expand doloop_end
+  [(use (match_operand 0  ))  ; loop pseudo
+   (use (match_operand 1  ))] ; label
+  
+  
+{
+  /* Currently SMS relies on the do-loop pattern to recognize loops
+ where (1) the control part consists of all insns defining and/or
+ using a certain 'count' register and (2) the loop count can be
+ adjusted by modifying this register prior to the loop.
+ ??? The possible introduction of a new block to initialize the
+ new IV can potentially affect branch optimizations.  */
+  if (optimize  0  flag_modulo_sched)
+{
+  rtx s0;
+  rtx bcomp;
+  rtx loc_ref;
+  rtx cc_reg;
+  rtx insn;
+  rtx cmp;
+
+  if (GET_MODE (operands[0]) != DImode)
+   FAIL;
+
+  s0 = operands [0];
+  insn = emit_insn (gen_adddi3_compare0 (s0, s0, GEN_INT (-1)));
+
+  cmp = XVECEXP (PATTERN (insn), 0, 0);
+  cc_reg = SET_DEST (cmp);
+  bcomp = gen_rtx_NE (VOIDmode, cc_reg, const0_rtx);
+  loc_ref = gen_rtx_LABEL_REF (VOIDmode, operands [1]);
+  emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
+  gen_rtx_IF_THEN_ELSE (VOIDmode, bcomp,
+loc_ref, pc_rtx)));
+  DONE;
+}
+  else
+FAIL;
+})
+
 ;; AdvSIMD Stuff
 (include aarch64-simd.md)



aarch64-doloop-v1.diff
Description: aarch64-doloop-v1.diff


Re: RFA: fix avr C++ preprocessing to pick up device defines

2014-11-09 Thread Denis Chertykov
2014-11-09 19:23 GMT+03:00 Joern Rennecke joern.renne...@embecosm.com:
 The defaults.h definition of
 #define CPLUSPLUS_CPP_SPEC CPP_SPEC
 does not do the right thing with the cpp spec picked up from a spec file,
 which is now needed for -mmcu processing.
 Also, a spec file can't override CPLUSPLUS_CPP_SPEC as such, since
 that string is hard-coded into the compiler.
 By setting CPLUSPLUS_CPP_SPEC to %(cpp), we let the cc1plus
 preprocessor look up the actual value of the preprocessor specs.

 OK to apply?

Please, apply.