From 065cf3cac2472daf09ea9b40e4d4bb4af929ec05 Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Wed, 8 Jun 2016 17:00:23 +0000 Subject: [PATCH 1/2][AArch64] Implement AAPCS64 updates for alignment attribute gcc/ChangeLog: * config/aarch64/aarch64.c (aarch64_function_arg_alignment): Rewrite, looking one level down for records and arrays. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237224 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/aarch64/aarch64.c | 31 ++++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c1a79cb90d..0634872332b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-08 Alan Lawrence + + * config/aarch64/aarch64.c (aarch64_function_arg_alignment): + Rewrite, looking one level down for records and arrays. + 2016-06-08 David Malcolm * pretty-print.c: Include "selftest.h". diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b60e5c52df6..a0db3a4f632 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1961,22 +1961,23 @@ aarch64_vfp_is_call_candidate (cumulative_args_t pcum_v, machine_mode mode, static unsigned int aarch64_function_arg_alignment (machine_mode mode, const_tree type) { - unsigned int alignment; + if (!type) + return GET_MODE_ALIGNMENT (mode); + if (integer_zerop (TYPE_SIZE (type))) + return 0; - if (type) - { - if (!integer_zerop (TYPE_SIZE (type))) - { - if (TYPE_MODE (type) == mode) - alignment = TYPE_ALIGN (type); - else - alignment = GET_MODE_ALIGNMENT (mode); - } - else - alignment = 0; - } - else - alignment = GET_MODE_ALIGNMENT (mode); + gcc_assert (TYPE_MODE (type) == mode); + + if (!AGGREGATE_TYPE_P (type)) + return TYPE_ALIGN (TYPE_MAIN_VARIANT (type)); + + if (TREE_CODE (type) == ARRAY_TYPE) + return TYPE_ALIGN (TREE_TYPE (type)); + + unsigned int alignment = 0; + + for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) + alignment = std::max (alignment, DECL_ALIGN (field)); return alignment; } -- cgit v1.2.3 From 1632691dea931866bab363c88009bee11a415b2d Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Wed, 8 Jun 2016 17:02:24 +0000 Subject: [PATCH 2/2][AArch64] Tests of AAPCS64 updates for alignment attribute gcc/testsuite/ * gcc.target/aarch64/aapcs64/aapcs64.exp: Also execute rec_*.c * gcc.target/aarch64/aapcs64/rec_align-5.c: New. * gcc.target/aarch64/aapcs64/rec_align-6.c: New. * gcc.target/aarch64/aapcs64/rec_align-7.c: New. * gcc.target/aarch64/aapcs64/rec_align-8.c: New. * gcc.target/aarch64/aapcs64/rec_align-9.c: New. * gcc.target/aarch64/aapcs64/test_align-5.c: New. * gcc.target/aarch64/aapcs64/test_align-6.c: New. * gcc.target/aarch64/aapcs64/test_align-7.c: New. * gcc.target/aarch64/aapcs64/test_align-8.c: New. * gcc.target/aarch64/aapcs64/test_align-9.c: New. * gcc.target/aarch64/aapcs64/rec_vaarg-1.c: New. * gcc.target/aarch64/aapcs64/rec_vaarg-2.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237225 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 16 ++++++++ .../gcc.target/aarch64/aapcs64/aapcs64.exp | 10 +++++ .../gcc.target/aarch64/aapcs64/rec_align-5.c | 44 ++++++++++++++++++++ .../gcc.target/aarch64/aapcs64/rec_align-6.c | 45 +++++++++++++++++++++ .../gcc.target/aarch64/aapcs64/rec_align-7.c | 47 ++++++++++++++++++++++ .../gcc.target/aarch64/aapcs64/rec_align-8.c | 37 +++++++++++++++++ .../gcc.target/aarch64/aapcs64/rec_align-9.c | 41 +++++++++++++++++++ .../gcc.target/aarch64/aapcs64/rec_align_vaarg-1.c | 38 +++++++++++++++++ .../gcc.target/aarch64/aapcs64/rec_align_vaarg-2.c | 28 +++++++++++++ .../gcc.target/aarch64/aapcs64/test_align-5.c | 35 ++++++++++++++++ .../gcc.target/aarch64/aapcs64/test_align-6.c | 36 +++++++++++++++++ .../gcc.target/aarch64/aapcs64/test_align-7.c | 38 +++++++++++++++++ .../gcc.target/aarch64/aapcs64/test_align-8.c | 33 +++++++++++++++ .../gcc.target/aarch64/aapcs64/test_align-9.c | 47 ++++++++++++++++++++++ 14 files changed, 495 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-7.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-7.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-9.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6c78af3a7f6..93062fd78ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2016-06-08 Alan Lawrence + + * gcc.target/aarch64/aapcs64/aapcs64.exp: Also execute rec_*.c + * gcc.target/aarch64/aapcs64/rec_align-5.c: New. + * gcc.target/aarch64/aapcs64/rec_align-6.c: New. + * gcc.target/aarch64/aapcs64/rec_align-7.c: New. + * gcc.target/aarch64/aapcs64/rec_align-8.c: New. + * gcc.target/aarch64/aapcs64/rec_align-9.c: New. + * gcc.target/aarch64/aapcs64/test_align-5.c: New. + * gcc.target/aarch64/aapcs64/test_align-6.c: New. + * gcc.target/aarch64/aapcs64/test_align-7.c: New. + * gcc.target/aarch64/aapcs64/test_align-8.c: New. + * gcc.target/aarch64/aapcs64/test_align-9.c: New. + * gcc.target/aarch64/aapcs64/rec_vaarg-1.c: New. + * gcc.target/aarch64/aapcs64/rec_vaarg-2.c: New. + 2016-06-08 Richard Biener PR tree-optimization/68558 diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp index ad92994fe6c..9998d0bda23 100644 --- a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp @@ -38,6 +38,16 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] { } } +# Test parameter receiving. +set additional_flags_for_rec $additional_flags +append additional_flags_for_rec " -fno-inline" +foreach src [lsort [glob -nocomplain $srcdir/$subdir/rec_*.c]] { + if {[runtest_file_p $runtests $src]} { + c-torture-execute [list $src] \ + $additional_flags_for_rec + } +} + # Test unnamed argument retrieval via the va_arg macro. foreach src [lsort [glob -nocomplain $srcdir/$subdir/va_arg-*.c]] { if {[runtest_file_p $runtests $src]} { diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-5.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-5.c new file mode 100644 index 00000000000..1b42c92ae59 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-5.c @@ -0,0 +1,44 @@ +/* Test AAPCS layout (alignment) for callee. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +extern void abort (void); + +typedef __attribute__ ((__aligned__ (8))) int alignedint; + +alignedint a = 11; +alignedint b = 13; +alignedint c = 17; +alignedint d = 19; +alignedint e = 23; +alignedint f = 29; +alignedint g = 31; +alignedint h = 37; +alignedint i = 41; +alignedint j = 43; + +void +test_passing_many_alignedint (alignedint x0, alignedint x1, alignedint x2, + alignedint x3, alignedint x4, alignedint x5, + alignedint x6, alignedint x7, alignedint stack, + alignedint stack8) +{ + if (x0 != a + || x1 != b + || x2 != c + || x3 != d + || x4 != e + || x5 != f + || x6 != g + || x7 != h + || stack != i + || stack8 !=j) + abort (); +} + +int +main (int argc, char **argv) +{ + test_passing_many_alignedint (a, b, c, d, e, f, g, h, i, j); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-6.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-6.c new file mode 100644 index 00000000000..a8d8b1bd1cb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-6.c @@ -0,0 +1,45 @@ +/* Test AAPCS layout (alignment) for callee. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n); +extern void abort (void); + +/* The underlying struct here has alignment 8. */ +typedef struct __attribute__ ((__aligned__ (16))) + { + long x; + long y; + } overaligned; + +overaligned a = { 2, 3 }; +overaligned b = { 5, 8 }; +overaligned c = { 13, 21 }; + +void +test_passing_overaligned_struct (int x0, overaligned x1, int x3, int x4, + overaligned x5, int x7, int stack, + overaligned stack8) +{ + if (x0 != 7 || x3 != 9 || x4 != 11 || x7 != 15 || stack != 10) + abort (); + if (memcmp ((void *) &x1, (void *)&a, sizeof (overaligned))) + abort (); + if (memcmp ((void *) &x5, (void *)&b, sizeof (overaligned))) + abort (); + if (memcmp ((void *)&stack8, (void *)&c, sizeof (overaligned))) + abort (); + long addr = ((long) &stack8) & 15; + if (addr != 0) + { + __builtin_printf ("Alignment was %d\n", addr); + abort (); + } +} + +int +main (int argc, char **argv) +{ + test_passing_overaligned_struct (7, a, 9, 11, b, 15, 10, c); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-7.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-7.c new file mode 100644 index 00000000000..61e3c118183 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-7.c @@ -0,0 +1,47 @@ +/* Test AAPCS layout (alignment) for callee. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n); +extern void abort (void); + +struct s + { + long x; + long y; + }; + +/* This still has size 16, so is still passed by value. */ +typedef __attribute__ ((__aligned__ (32))) struct s overaligned; + +/* A few structs, at 32-byte-aligned memory locations. */ +overaligned a = { 2, 3 }; +overaligned b = { 5, 8 }; +overaligned c = { 13, 21 }; + +void +test_pass_by_value (int x0, overaligned x1, int x3, int x4, overaligned x5, + int x7, int stack, overaligned stack8) +{ + if (x0 != 7 || x3 != 9 || x4 != 11 || x7 != 15 || stack != 10) + abort (); + if (memcmp ((void *) &x1, (void *)&a, sizeof (overaligned))) + abort (); + if (memcmp ((void *) &x5, (void *)&b, sizeof (overaligned))) + abort (); + if (memcmp ((void *)&stack8, (void *)&c, sizeof (overaligned))) + abort (); + long addr = ((long) &stack8) & 15; + if (addr != 0) + { + __builtin_printf ("Alignment was %d\n", addr); + abort (); + } +} + +int +main (int argc, char **argv) +{ + test_pass_by_value (7, a, 9, 11, b, 15, 10, c); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-8.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-8.c new file mode 100644 index 00000000000..c9351802191 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-8.c @@ -0,0 +1,37 @@ +/* Test AAPCS layout (alignment) for callee. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n); +extern void abort (void); + +/* The alignment also gives this size 32, so will be passed by reference. */ +typedef struct __attribute__ ((__aligned__ (32))) + { + long x; + long y; + } overaligned; + +overaligned a = { 2, 3 }; + +void +test_pass_by_ref (int x0, overaligned x1, int x2) +{ + if (x0 != 7 || x2 != 9) + abort (); + if (memcmp ((void *) &x1, (void *)&a, sizeof (overaligned))) + abort (); + long addr = ((long) &x1) & 31; + if (addr != 0) + { + __builtin_printf ("Alignment was %d\n", addr); + abort (); + } +} + +int +main (int argc, char **argv) +{ + test_pass_by_ref (7, a, 9); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c new file mode 100644 index 00000000000..81139f58269 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c @@ -0,0 +1,41 @@ +/* Test AAPCS layout (alignment) for callee. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n); +extern void abort (void); + +struct s + { + /* This forces the alignment and size of the struct to 16. */ + __attribute__ ((__aligned__ (16))) long x; + int y; + /* 4 bytes padding. */ + }; + +typedef struct s __attribute__ ((__aligned__ (8))) underaligned; + +underaligned a = { 1, 4 }; +underaligned b = { 9, 16 }; +underaligned c = { 25, 36 }; + +void +test_underaligned_struct (int x0, underaligned x2, int x4, underaligned x6, + int stack, underaligned stack16) +{ + if (x0 != 3 || x4 != 5 || stack != 7) + abort (); + if (memcmp ((void *) &x2, (void *)&a, sizeof (underaligned))) + abort (); + if (memcmp ((void *)&x6, (void *)&b, sizeof (underaligned))) + abort (); + if (memcmp ((void *)&stack16, (void *)&c, sizeof (underaligned))) + abort (); +} + +int +main (int argc, char **argv) +{ + test_underaligned_struct (3, a, 5, b, 7, c); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-1.c new file mode 100644 index 00000000000..109ddc214e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-1.c @@ -0,0 +1,38 @@ +/* Test AAPCS layout (alignment of varargs) for callee. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#include + +extern void abort (void); + +typedef __attribute__ ((__aligned__ (16))) long alignedlong; + +void +test_pass_overaligned_long_vaargs (long l, ...) +{ + va_list va; + va_start (va, l); + /* Arguments should be passed in the same registers as if they were ints. */ + while (l-- > 0) + if (va_arg (va, long) != l) + abort (); + va_end (va); +} + +int +main (int argc, char **argv) +{ + alignedlong a = 9; + alignedlong b = 8; + alignedlong c = 7; + alignedlong d = 6; + alignedlong e = 5; + alignedlong f = 4; + alignedlong g = 3; + alignedlong h = 2; + alignedlong i = 1; + alignedlong j = 0; + test_pass_overaligned_long_vaargs (a, b, c, d, e, f, g, h, i, j); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-2.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-2.c new file mode 100644 index 00000000000..dc4eb2fb382 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align_vaarg-2.c @@ -0,0 +1,28 @@ +/* Test AAPCS layout (alignment of varargs) for callee. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#include + +extern void abort (void); + +typedef __attribute__ ((__aligned__ (16))) int alignedint; + +void +test_pass_overaligned_int_vaargs (int i, ...) +{ + va_list va; + va_start (va, i); + /* alignedint should be pulled out of regs/stack just like an int. */ + while (i-- > 0) + if (va_arg (va, alignedint) != i) + abort (); + va_end (va); +} + +int +main (int argc, char **argv) +{ + test_pass_overaligned_int_vaargs (9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-5.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-5.c new file mode 100644 index 00000000000..ac5673ee5c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-5.c @@ -0,0 +1,35 @@ +/* Test AAPCS layout (alignment). */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_align-5.c" + +typedef __attribute__ ((__aligned__ (16))) long alignedint; + +alignedint a = 11; +alignedint b = 13; +alignedint c = 17; +alignedint d = 19; +alignedint e = 23; +alignedint f = 29; +alignedint g = 31; +alignedint h = 37; +alignedint i = 41; +alignedint j = 43; + +#include "abitest.h" +#else + ARG (alignedint, a, X0) + /* Attribute suggests R2, but we should use only natural alignment: */ + ARG (alignedint, b, X1) + ARG (alignedint, c, X2) + ARG (alignedint, d, X3) + ARG (alignedint, e, X4) + ARG (alignedint, f, X5) + ARG (alignedint, g, X6) + ARG (alignedint, h, X7) + ARG (alignedint, i, STACK) + /* Attribute would suggest STACK + 16 but should be ignored: */ + LAST_ARG (alignedint, j, STACK + 8) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-6.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-6.c new file mode 100644 index 00000000000..20cbd941939 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-6.c @@ -0,0 +1,36 @@ +/* Test AAPCS layout (alignment). */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_align-6.c" + +/* The underlying struct here has alignment 8. */ +typedef struct __attribute__ ((__aligned__ (16))) + { + long x; + long y; + } overaligned; + +/* A couple of instances, at 16-byte-aligned memory locations. */ +overaligned a = { 2, 3 }; +overaligned b = { 5, 8 }; +overaligned c = { 13, 21 }; + +#include "abitest.h" +#else + ARG (int, 7, W0) + /* Natural alignment should be 8. */ + ARG (overaligned, a, X1) + ARG (int, 9, W3) + ARG (int, 11, W4) + ARG (overaligned, b, X5) + ARG (int, 15, W7) +#ifndef __AAPCS64_BIG_ENDIAN__ + ARG (int, 10, STACK) +#else + ARG (int, 10, STACK + 4) +#endif + /* Natural alignment should be 8. */ + LAST_ARG (overaligned, c, STACK + 8) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-7.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-7.c new file mode 100644 index 00000000000..6af422f27e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-7.c @@ -0,0 +1,38 @@ +/* Test AAPCS layout (alignment). */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_align-7.c" + +struct s + { + long x; + long y; + }; + +/* This still has size 16, so is still passed by value. */ +typedef __attribute__ ((__aligned__ (32))) struct s overaligned; + +/* A few structs, at 32-byte-aligned memory locations. */ +overaligned a = { 2, 3 }; +overaligned b = { 5, 8 }; +overaligned c = { 13, 21 }; + +#include "abitest.h" +#else + ARG (int, 7, W0) + /* Alignment should be 8. */ + ARG (overaligned, a, X1) + ARG (int, 9, W3) + ARG (int, 11, W4) + ARG (overaligned, b, X5) + ARG (int, 15, W7) +#ifndef __AAPCS64_BIG_ENDIAN__ + ARG (int, 10, STACK) +#else + ARG (int, 10, STACK + 4) +#endif + /* Natural alignment should be 8. */ + LAST_ARG (overaligned, c, STACK + 8) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c new file mode 100644 index 00000000000..ad4dfe4b62c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c @@ -0,0 +1,33 @@ +/* Test AAPCS layout (alignment). */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_align-8.c" + +/* The alignment also gives this size 32, so will be passed by reference. */ +typedef struct __attribute__ ((__aligned__ (32))) + { + long x; + long y; + } overaligned; + +#define EXPECTED_STRUCT_SIZE 32 +extern void link_failure (void); +int +foo () +{ + /* Optimization gets rid of this before linking. */ + if (sizeof (overaligned) != EXPECTED_STRUCT_SIZE) + link_failure (); +} + +overaligned a = { 2, 3 }; + +#include "abitest.h" +#else + ARG (int, 7, W0) + /* Alignment should be 8. */ + PTR (overaligned, a, X1) + LAST_ARG (int, 9, W2) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-9.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-9.c new file mode 100644 index 00000000000..0f5fa352a91 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-9.c @@ -0,0 +1,47 @@ +/* Test AAPCS layout (alignment). */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_align-9.c" + +struct s + { + /* This forces the alignment and size of the struct to 16. */ + __attribute__ ((__aligned__ (16))) long x; + int y; + /* 4 bytes padding. */ + }; + +typedef struct s __attribute__ ((__aligned__ (8))) underaligned; + +#define EXPECTED_STRUCT_SIZE 16 +extern void link_failure (void); +int +foo () +{ + /* Optimization gets rid of this before linking. */ + if (sizeof (struct s) != EXPECTED_STRUCT_SIZE) + link_failure (); +} + +underaligned a = { 1, 4 }; +underaligned b = { 9, 16 }; +underaligned c = { 25, 36 }; + +#include "abitest.h" +#else + ARG (int, 3, W0) + /* Object alignment is 16, so skip X1. */ + ARG (underaligned, a, X2) + ARG (int, 5, W4) + /* Object alignment is 16, so skip X5. */ + ARG (underaligned, b, X6) +#ifndef __AAPCS64_BIG_ENDIAN__ + ARG (int, 7, STACK) +#else + ARG (int, 7, STACK + 4) +#endif + /* Natural alignment should be 16. */ + LAST_ARG (underaligned, c, STACK + 16) +#endif -- cgit v1.2.3 From e69523b2a67914319194d4e461d707bf5bc45673 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 8 Jun 2016 17:57:30 +0000 Subject: PR c++/71442 * pt.c (tsubst_copy): Only set TREE_USED on DECLs. * g++.dg/cpp0x/Wunused-variable-1.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237232 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 ++++ gcc/cp/pt.c | 3 +- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C | 37 +++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 86dddd210d7..1627fd214c0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-06-08 Jakub Jelinek + + PR c++/71442 + * pt.c (tsubst_copy): Only set TREE_USED on DECLs. + 2016-06-06 Jakub Jelinek Patrick Palka diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 64fef68c9e3..4ccdd45b73b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14160,7 +14160,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) len = TREE_VEC_LENGTH (expanded); /* Set TREE_USED for the benefit of -Wunused. */ for (int i = 0; i < len; i++) - TREE_USED (TREE_VEC_ELT (expanded, i)) = true; + if (DECL_P (TREE_VEC_ELT (expanded, i))) + TREE_USED (TREE_VEC_ELT (expanded, i)) = true; } if (expanded == error_mark_node) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 93062fd78ef..2f3e4e16766 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-08 Jakub Jelinek + + PR c++/71442 + * g++.dg/cpp0x/Wunused-variable-1.C: New test. + 2016-06-08 Alan Lawrence * gcc.target/aarch64/aapcs64/aapcs64.exp: Also execute rec_*.c diff --git a/gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C b/gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C new file mode 100644 index 00000000000..39592b26a58 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C @@ -0,0 +1,37 @@ +// PR c++/71442 +// { dg-do compile { target c++11 } } +// { dg-options "-Wunused-variable" } + +struct C +{ + template + int operator()(Ts &&...) + { + return sizeof...(Ts); + } +}; + +int +foo () +{ + C {} (1, 1L, 1LL, 1.0); +} + +template +void +bar () +{ + char a; // { dg-warning "unused variable" } + short b; // { dg-warning "unused variable" } + int c; // { dg-warning "unused variable" } + long d; // { dg-warning "unused variable" } + long long e; // { dg-warning "unused variable" } + float f; // { dg-warning "unused variable" } + double g; // { dg-warning "unused variable" } +} + +void +baz () +{ + bar <0> (); +} -- cgit v1.2.3 From 49bde126f8144bb9732469b4133fba177b6851fb Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 8 Jun 2016 18:29:42 +0000 Subject: 2016-06-08 Paolo Carlini * pt.c (tsubst, case TYPENAME_TYPE): Don't delay checking the return value of tsubst_aggr_type for error_mark_node. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237236 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1627fd214c0..55b473e0dcc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-06-08 Paolo Carlini + + * pt.c (tsubst, case TYPENAME_TYPE): Don't delay checking the + return value of tsubst_aggr_type for error_mark_node. + 2016-06-08 Jakub Jelinek PR c++/71442 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4ccdd45b73b..3a3d9b8f439 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13430,10 +13430,12 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) { tree ctx = tsubst_aggr_type (TYPE_CONTEXT (t), args, complain, in_decl, /*entering_scope=*/1); + if (ctx == error_mark_node) + return error_mark_node; + tree f = tsubst_copy (TYPENAME_TYPE_FULLNAME (t), args, complain, in_decl); - - if (ctx == error_mark_node || f == error_mark_node) + if (f == error_mark_node) return error_mark_node; if (!MAYBE_CLASS_TYPE_P (ctx)) -- cgit v1.2.3 From 6aa332495f0adb8091b75f3ace7b87f228d7aee1 Mon Sep 17 00:00:00 2001 From: "Jose E. Marchesi" Date: Wed, 8 Jun 2016 18:32:16 +0000 Subject: 2016-06-08 Jose E. Marchesi * config/sparc/driver-sparc.c (cpu_names): Fix the entry for the SPARC-M7 and add an entry for SPARC-S7 cpus (Sonoma). git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237237 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/sparc/driver-sparc.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0634872332b..d3d5200d45c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-08 Jose E. Marchesi + + * config/sparc/driver-sparc.c (cpu_names): Fix the entry for the + SPARC-M7 and add an entry for SPARC-S7 cpus (Sonoma). + 2016-06-08 Alan Lawrence * config/aarch64/aarch64.c (aarch64_function_arg_alignment): diff --git a/gcc/config/sparc/driver-sparc.c b/gcc/config/sparc/driver-sparc.c index b81763e4c4f..ea174bf3dc5 100644 --- a/gcc/config/sparc/driver-sparc.c +++ b/gcc/config/sparc/driver-sparc.c @@ -57,7 +57,6 @@ static const struct cpu_names { { "UltraSPARC-T2+", "niagara2" }, { "SPARC-T3", "niagara3" }, { "SPARC-T4", "niagara4" }, - { "SPARC-M7", "niagara7" }, #else { "SuperSparc", "supersparc" }, { "HyperSparc", "hypersparc" }, @@ -74,9 +73,10 @@ static const struct cpu_names { { "UltraSparc T2", "niagara2" }, { "UltraSparc T3", "niagara3" }, { "UltraSparc T4", "niagara4" }, - { "UltraSparc M7", "niagara7" }, { "LEON", "leon3" }, #endif + { "SPARC-M7", "niagara7" }, + { "SPARC-S7", "niagara7" }, { NULL, NULL } }; -- cgit v1.2.3 From 61cccd460c38afb48ffde0e5dbe7ec01f50154f5 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 8 Jun 2016 19:03:17 +0000 Subject: PR c++/70507 PR c/68120 * builtins.def (BUILT_IN_ADD_OVERFLOW_P, BUILT_IN_SUB_OVERFLOW_P, BUILT_IN_MUL_OVERFLOW_P): New builtins. * builtins.c: Include gimple-fold.h. (fold_builtin_arith_overflow): Handle BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. (fold_builtin_3): Likewise. * doc/extend.texi (Integer Overflow Builtins): Document __builtin_{add,sub,mul}_overflow_p. gcc/c/ * c-typeck.c (convert_arguments): Don't promote last argument of BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. gcc/cp/ * constexpr.c: Include gimple-fold.h. (cxx_eval_internal_function): New function. (cxx_eval_call_expression): Call it. (potential_constant_expression_1): Handle integer arithmetic overflow built-ins. * tree.c (builtin_valid_in_constant_expr_p): Handle BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. gcc/c-family/ * c-common.c (check_builtin_function_arguments): Handle BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. gcc/testsuite/ * c-c++-common/builtin-arith-overflow-1.c: Add test cases. * c-c++-common/builtin-arith-overflow-2.c: New test. * g++.dg/ext/builtin-arith-overflow-1.C: New test. * g++.dg/cpp0x/constexpr-arith-overflow.C: New test. * g++.dg/cpp1y/constexpr-arith-overflow.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237238 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 + gcc/builtins.c | 54 ++- gcc/builtins.def | 3 + gcc/c-family/ChangeLog | 8 + gcc/c-family/c-common.c | 17 + gcc/c/ChangeLog | 8 + gcc/c/c-typeck.c | 17 +- gcc/cp/ChangeLog | 13 + gcc/cp/constexpr.c | 107 ++++- gcc/cp/tree.c | 6 + gcc/doc/extend.texi | 41 ++ gcc/testsuite/ChangeLog | 11 + .../c-c++-common/builtin-arith-overflow-1.c | 16 + .../c-c++-common/builtin-arith-overflow-2.c | 493 +++++++++++++++++++++ .../g++.dg/cpp0x/constexpr-arith-overflow.C | 212 +++++++++ .../g++.dg/cpp1y/constexpr-arith-overflow.C | 229 ++++++++++ .../g++.dg/ext/builtin-arith-overflow-1.C | 11 + 17 files changed, 1235 insertions(+), 25 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/builtin-arith-overflow-2.c create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-arith-overflow.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C create mode 100644 gcc/testsuite/g++.dg/ext/builtin-arith-overflow-1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3d5200d45c..89c9f766cce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2016-06-08 Martin Sebor + Jakub Jelinek + + PR c++/70507 + PR c/68120 + * builtins.def (BUILT_IN_ADD_OVERFLOW_P, BUILT_IN_SUB_OVERFLOW_P, + BUILT_IN_MUL_OVERFLOW_P): New builtins. + * builtins.c: Include gimple-fold.h. + (fold_builtin_arith_overflow): Handle + BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. + (fold_builtin_3): Likewise. + * doc/extend.texi (Integer Overflow Builtins): Document + __builtin_{add,sub,mul}_overflow_p. + 2016-06-08 Jose E. Marchesi * config/sparc/driver-sparc.c (cpu_names): Fix the entry for the diff --git a/gcc/builtins.c b/gcc/builtins.c index d5191761680..5d234a5c827 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -64,6 +64,7 @@ along with GCC; see the file COPYING3. If not see #include "rtl-chkp.h" #include "internal-fn.h" #include "case-cfn-macros.h" +#include "gimple-fold.h" struct target_builtins default_target_builtins; @@ -7943,18 +7944,28 @@ fold_builtin_unordered_cmp (location_t loc, tree fndecl, tree arg0, tree arg1, /* Fold __builtin_{,s,u}{add,sub,mul}{,l,ll}_overflow, either into normal arithmetics if it can never overflow, or into internal functions that return both result of arithmetics and overflowed boolean flag in - a complex integer result, or some other check for overflow. */ + a complex integer result, or some other check for overflow. + Similarly fold __builtin_{add,sub,mul}_overflow_p to just the overflow + checking part of that. */ static tree fold_builtin_arith_overflow (location_t loc, enum built_in_function fcode, tree arg0, tree arg1, tree arg2) { enum internal_fn ifn = IFN_LAST; - tree type = TREE_TYPE (TREE_TYPE (arg2)); - tree mem_arg2 = build_fold_indirect_ref_loc (loc, arg2); + /* The code of the expression corresponding to the type-generic + built-in, or ERROR_MARK for the type-specific ones. */ + enum tree_code opcode = ERROR_MARK; + bool ovf_only = false; + switch (fcode) { + case BUILT_IN_ADD_OVERFLOW_P: + ovf_only = true; + /* FALLTHRU */ case BUILT_IN_ADD_OVERFLOW: + opcode = PLUS_EXPR; + /* FALLTHRU */ case BUILT_IN_SADD_OVERFLOW: case BUILT_IN_SADDL_OVERFLOW: case BUILT_IN_SADDLL_OVERFLOW: @@ -7963,7 +7974,12 @@ fold_builtin_arith_overflow (location_t loc, enum built_in_function fcode, case BUILT_IN_UADDLL_OVERFLOW: ifn = IFN_ADD_OVERFLOW; break; + case BUILT_IN_SUB_OVERFLOW_P: + ovf_only = true; + /* FALLTHRU */ case BUILT_IN_SUB_OVERFLOW: + opcode = MINUS_EXPR; + /* FALLTHRU */ case BUILT_IN_SSUB_OVERFLOW: case BUILT_IN_SSUBL_OVERFLOW: case BUILT_IN_SSUBLL_OVERFLOW: @@ -7972,7 +7988,12 @@ fold_builtin_arith_overflow (location_t loc, enum built_in_function fcode, case BUILT_IN_USUBLL_OVERFLOW: ifn = IFN_SUB_OVERFLOW; break; + case BUILT_IN_MUL_OVERFLOW_P: + ovf_only = true; + /* FALLTHRU */ case BUILT_IN_MUL_OVERFLOW: + opcode = MULT_EXPR; + /* FALLTHRU */ case BUILT_IN_SMUL_OVERFLOW: case BUILT_IN_SMULL_OVERFLOW: case BUILT_IN_SMULLL_OVERFLOW: @@ -7984,6 +8005,25 @@ fold_builtin_arith_overflow (location_t loc, enum built_in_function fcode, default: gcc_unreachable (); } + + /* For the "generic" overloads, the first two arguments can have different + types and the last argument determines the target type to use to check + for overflow. The arguments of the other overloads all have the same + type. */ + tree type = ovf_only ? TREE_TYPE (arg2) : TREE_TYPE (TREE_TYPE (arg2)); + + /* For the __builtin_{add,sub,mul}_overflow_p builtins, when the first two + arguments are constant, attempt to fold the built-in call into a constant + expression indicating whether or not it detected an overflow. */ + if (ovf_only + && TREE_CODE (arg0) == INTEGER_CST + && TREE_CODE (arg1) == INTEGER_CST) + /* Perform the computation in the target type and check for overflow. */ + return omit_one_operand_loc (loc, boolean_type_node, + arith_overflowed_p (opcode, type, arg0, arg1) + ? boolean_true_node : boolean_false_node, + arg2); + tree ctype = build_complex_type (type); tree call = build_call_expr_internal_loc (loc, ifn, ctype, 2, arg0, arg1); @@ -7991,6 +8031,11 @@ fold_builtin_arith_overflow (location_t loc, enum built_in_function fcode, tree intres = build1_loc (loc, REALPART_EXPR, type, tgt); tree ovfres = build1_loc (loc, IMAGPART_EXPR, type, tgt); ovfres = fold_convert_loc (loc, boolean_type_node, ovfres); + + if (ovf_only) + return omit_one_operand_loc (loc, boolean_type_node, ovfres, arg2); + + tree mem_arg2 = build_fold_indirect_ref_loc (loc, arg2); tree store = fold_build2_loc (loc, MODIFY_EXPR, void_type_node, mem_arg2, intres); return build2_loc (loc, COMPOUND_EXPR, boolean_type_node, store, ovfres); @@ -8340,6 +8385,9 @@ fold_builtin_3 (location_t loc, tree fndecl, case BUILT_IN_ADD_OVERFLOW: case BUILT_IN_SUB_OVERFLOW: case BUILT_IN_MUL_OVERFLOW: + case BUILT_IN_ADD_OVERFLOW_P: + case BUILT_IN_SUB_OVERFLOW_P: + case BUILT_IN_MUL_OVERFLOW_P: case BUILT_IN_SADD_OVERFLOW: case BUILT_IN_SADDL_OVERFLOW: case BUILT_IN_SADDLL_OVERFLOW: diff --git a/gcc/builtins.def b/gcc/builtins.def index 527503800ff..ca9bafcbf2f 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -710,6 +710,9 @@ DEF_C94_BUILTIN (BUILT_IN_TOWUPPER, "towupper", BT_FN_WINT_WINT, ATTR_PUR DEF_GCC_BUILTIN (BUILT_IN_ADD_OVERFLOW, "add_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_TYPEGENERIC_LEAF) DEF_GCC_BUILTIN (BUILT_IN_SUB_OVERFLOW, "sub_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_TYPEGENERIC_LEAF) DEF_GCC_BUILTIN (BUILT_IN_MUL_OVERFLOW, "mul_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_TYPEGENERIC_LEAF) +DEF_GCC_BUILTIN (BUILT_IN_ADD_OVERFLOW_P, "add_overflow_p", BT_FN_BOOL_VAR, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF) +DEF_GCC_BUILTIN (BUILT_IN_SUB_OVERFLOW_P, "sub_overflow_p", BT_FN_BOOL_VAR, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF) +DEF_GCC_BUILTIN (BUILT_IN_MUL_OVERFLOW_P, "mul_overflow_p", BT_FN_BOOL_VAR, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF) /* Clang compatibility. */ DEF_GCC_BUILTIN (BUILT_IN_SADD_OVERFLOW, "sadd_overflow", BT_FN_BOOL_INT_INT_INTPTR, ATTR_NOTHROW_LEAF_LIST) DEF_GCC_BUILTIN (BUILT_IN_SADDL_OVERFLOW, "saddl_overflow", BT_FN_BOOL_LONG_LONG_LONGPTR, ATTR_NOTHROW_LEAF_LIST) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 1cd8aa7ad32..5ebeaf90ff5 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2016-06-08 Martin Sebor + Jakub Jelinek + + PR c++/70507 + PR c/68120 + * c-common.c (check_builtin_function_arguments): Handle + BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. + 2016-06-08 Richard Biener * c-common.c (parse_optimize_options): Improve diagnostic messages. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 4e75e51c013..d008b040d0d 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -9989,6 +9989,23 @@ check_builtin_function_arguments (location_t loc, vec arg_loc, } return false; + case BUILT_IN_ADD_OVERFLOW_P: + case BUILT_IN_SUB_OVERFLOW_P: + case BUILT_IN_MUL_OVERFLOW_P: + if (builtin_function_validate_nargs (loc, fndecl, nargs, 3)) + { + unsigned i; + for (i = 0; i < 3; i++) + if (!INTEGRAL_TYPE_P (TREE_TYPE (args[i]))) + { + error_at (ARG_LOCATION (i), "argument %u in call to function " + "%qE does not have integral type", i + 1, fndecl); + return false; + } + return true; + } + return false; + default: return true; } diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 9f0b91afb6a..4d302453ee4 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2016-06-08 Martin Sebor + Jakub Jelinek + + PR c++/70507 + PR c/68120 + * c-typeck.c (convert_arguments): Don't promote last argument + of BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. + 2016-06-08 Marek Polacek PR c/71418 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index cd8e9e57b3a..a681d7696d0 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3186,6 +3186,7 @@ convert_arguments (location_t loc, vec arg_loc, tree typelist, const bool type_generic = fundecl && lookup_attribute ("type generic", TYPE_ATTRIBUTES (TREE_TYPE (fundecl))); bool type_generic_remove_excess_precision = false; + bool type_generic_overflow_p = false; tree selector; /* Change pointer to function to the function itself for @@ -3215,8 +3216,15 @@ convert_arguments (location_t loc, vec arg_loc, tree typelist, type_generic_remove_excess_precision = true; break; + case BUILT_IN_ADD_OVERFLOW_P: + case BUILT_IN_SUB_OVERFLOW_P: + case BUILT_IN_MUL_OVERFLOW_P: + /* The last argument of these type-generic builtins + should not be promoted. */ + type_generic_overflow_p = true; + break; + default: - type_generic_remove_excess_precision = false; break; } } @@ -3466,9 +3474,12 @@ convert_arguments (location_t loc, vec arg_loc, tree typelist, parmval = convert (double_type_node, val); } } - else if (excess_precision && !type_generic) + else if ((excess_precision && !type_generic) + || (type_generic_overflow_p && parmnum == 2)) /* A "double" argument with excess precision being passed - without a prototype or in variable arguments. */ + without a prototype or in variable arguments. + The last argument of __builtin_*_overflow_p should not be + promoted. */ parmval = convert (valtype, val); else if ((invalid_func_diag = targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 55b473e0dcc..4162e20ded7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2016-06-08 Martin Sebor + Jakub Jelinek + + PR c++/70507 + PR c/68120 + * constexpr.c: Include gimple-fold.h. + (cxx_eval_internal_function): New function. + (cxx_eval_call_expression): Call it. + (potential_constant_expression_1): Handle integer arithmetic + overflow built-ins. + * tree.c (builtin_valid_in_constant_expr_p): Handle + BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P. + 2016-06-08 Paolo Carlini * pt.c (tsubst, case TYPENAME_TYPE): Don't delay checking the diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 482f8afaeb6..ba40435ef67 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "tree-inline.h" #include "ubsan.h" +#include "gimple-fold.h" static bool verify_constant (tree, bool, bool *, bool *); #define VERIFY_CONSTANT(X) \ @@ -1255,6 +1256,69 @@ cx_error_context (void) return r; } +/* Evaluate a call T to a GCC internal function when possible and return + the evaluated result or, under the control of CTX, give an error, set + NON_CONSTANT_P, and return the unevaluated call T otherwise. */ + +static tree +cxx_eval_internal_function (const constexpr_ctx *ctx, tree t, + bool lval, + bool *non_constant_p, bool *overflow_p) +{ + enum tree_code opcode = ERROR_MARK; + + switch (CALL_EXPR_IFN (t)) + { + case IFN_UBSAN_NULL: + case IFN_UBSAN_BOUNDS: + case IFN_UBSAN_VPTR: + return void_node; + + case IFN_ADD_OVERFLOW: + opcode = PLUS_EXPR; + break; + case IFN_SUB_OVERFLOW: + opcode = MINUS_EXPR; + break; + case IFN_MUL_OVERFLOW: + opcode = MULT_EXPR; + break; + + default: + if (!ctx->quiet) + error_at (EXPR_LOC_OR_LOC (t, input_location), + "call to internal function %qE", t); + *non_constant_p = true; + return t; + } + + /* Evaluate constant arguments using OPCODE and return a complex + number containing the result and the overflow bit. */ + tree arg0 = cxx_eval_constant_expression (ctx, CALL_EXPR_ARG (t, 0), lval, + non_constant_p, overflow_p); + tree arg1 = cxx_eval_constant_expression (ctx, CALL_EXPR_ARG (t, 1), lval, + non_constant_p, overflow_p); + + if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST) + { + location_t loc = EXPR_LOC_OR_LOC (t, input_location); + tree type = TREE_TYPE (TREE_TYPE (t)); + tree result = fold_binary_loc (loc, opcode, type, + fold_convert_loc (loc, type, arg0), + fold_convert_loc (loc, type, arg1)); + tree ovf + = build_int_cst (type, arith_overflowed_p (opcode, type, arg0, arg1)); + /* Reset TREE_OVERFLOW to avoid warnings for the overflow. */ + if (TREE_OVERFLOW (result)) + TREE_OVERFLOW (result) = 0; + + return build_complex (TREE_TYPE (t), result, ovf); + } + + *non_constant_p = true; + return t; +} + /* Subroutine of cxx_eval_constant_expression. Evaluate the call expression tree T in the context of OLD_CALL expression evaluation. */ @@ -1270,18 +1334,8 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, bool depth_ok; if (fun == NULL_TREE) - switch (CALL_EXPR_IFN (t)) - { - case IFN_UBSAN_NULL: - case IFN_UBSAN_BOUNDS: - case IFN_UBSAN_VPTR: - return void_node; - default: - if (!ctx->quiet) - error_at (loc, "call to internal function"); - *non_constant_p = true; - return t; - } + return cxx_eval_internal_function (ctx, t, lval, + non_constant_p, overflow_p); if (TREE_CODE (fun) != FUNCTION_DECL) { @@ -4588,6 +4642,10 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, if (fun == NULL_TREE) { + /* Reset to allow the function to continue past the end + of the block below. Otherwise return early. */ + bool bail = true; + if (TREE_CODE (t) == CALL_EXPR && CALL_EXPR_FN (t) == NULL_TREE) switch (CALL_EXPR_IFN (t)) @@ -4598,16 +4656,27 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, case IFN_UBSAN_BOUNDS: case IFN_UBSAN_VPTR: return true; + + case IFN_ADD_OVERFLOW: + case IFN_SUB_OVERFLOW: + case IFN_MUL_OVERFLOW: + bail = false; + default: break; } - /* fold_call_expr can't do anything with IFN calls. */ - if (flags & tf_error) - error_at (EXPR_LOC_OR_LOC (t, input_location), - "call to internal function"); - return false; + + if (bail) + { + /* fold_call_expr can't do anything with IFN calls. */ + if (flags & tf_error) + error_at (EXPR_LOC_OR_LOC (t, input_location), + "call to internal function %qE", t); + return false; + } } - if (is_overloaded_fn (fun)) + + if (fun && is_overloaded_fn (fun)) { if (TREE_CODE (fun) == FUNCTION_DECL) { @@ -4652,7 +4721,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, i = num_artificial_parms_for (fun); fun = DECL_ORIGIN (fun); } - else + else if (fun) { if (RECUR (fun, rval)) /* Might end up being a constant function pointer. */; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 04702ee1c00..abda6e4f729 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -352,6 +352,12 @@ builtin_valid_in_constant_expr_p (const_tree decl) case BUILT_IN_FUNCTION: case BUILT_IN_LINE: + /* The following built-ins are valid in constant expressions + when their arguments are. */ + case BUILT_IN_ADD_OVERFLOW_P: + case BUILT_IN_SUB_OVERFLOW_P: + case BUILT_IN_MUL_OVERFLOW_P: + /* These have constant results even if their operands are non-constant. */ case BUILT_IN_CONSTANT_P: diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 7208f33e76c..7da516d7827 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -9869,6 +9869,47 @@ functions above, except they perform multiplication, instead of addition. @end deftypefn +The following built-in functions allow checking if simple arithmetic operation +would overflow. + +@deftypefn {Built-in Function} bool __builtin_add_overflow_p (@var{type1} a, @var{type2} b, @var{type3} c) +@deftypefnx {Built-in Function} bool __builtin_sub_overflow_p (@var{type1} a, @var{type2} b, @var{type3} c) +@deftypefnx {Built-in Function} bool __builtin_mul_overflow_p (@var{type1} a, @var{type2} b, @var{type3} c) + +These built-in functions are similar to @code{__builtin_add_overflow}, +@code{__builtin_sub_overflow}, or @code{__builtin_mul_overflow}, except that +they don't store the result of the arithmetic operation anywhere and the +last argument is not a pointer, but some integral expression. + +The built-in functions promote the first two operands into infinite precision signed type +and perform addition on those promoted operands. The result is then +cast to the type of the third argument. If the cast result is equal to the infinite +precision result, the built-in functions return false, otherwise they return true. +The value of the third argument is ignored, just the side-effects in the third argument +are evaluated, and no integral argument promotions are performed on the last argument. + +For example, the following macro can be used to portably check, at +compile-time, whether or not adding two constant integers will overflow, +and perform the addition only when it is known to be safe and not to trigger +a @option{-Woverflow} warning. + +@smallexample +#define INT_ADD_OVERFLOW_P(a, b) \ + __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) + +enum @{ + A = INT_MAX, B = 3, + C = INT_ADD_OVERFLOW_P (A, B) ? 0 : A + B, + D = __builtin_add_overflow_p (1, SCHAR_MAX, (signed char) 0) +@}; +@end smallexample + +The compiler will attempt to use hardware instructions to implement +these built-in functions where possible, like conditional jump on overflow +after addition, conditional jump on carry etc. + +@end deftypefn + @node x86 specific memory model extensions for transactional memory @section x86-Specific Memory Model Extensions for Transactional Memory diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2f3e4e16766..cb704589deb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-06-08 Martin Sebor + Jakub Jelinek + + PR c++/70507 + PR c/68120 + * c-c++-common/builtin-arith-overflow-1.c: Add test cases. + * c-c++-common/builtin-arith-overflow-2.c: New test. + * g++.dg/ext/builtin-arith-overflow-1.C: New test. + * g++.dg/cpp0x/constexpr-arith-overflow.C: New test. + * g++.dg/cpp1y/constexpr-arith-overflow.C: New test. + 2016-06-08 Jakub Jelinek PR c++/71442 diff --git a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c index 69b508386d5..0d97f6a9fad 100644 --- a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c +++ b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c @@ -6,6 +6,9 @@ f1 (void) int x = __builtin_add_overflow (); /* { dg-error "not enough arguments to function" } */ x += __builtin_sub_overflow (); /* { dg-error "not enough arguments to function" } */ x += __builtin_mul_overflow (); /* { dg-error "not enough arguments to function" } */ + x += __builtin_add_overflow_p (); /* { dg-error "not enough arguments to function" } */ + x += __builtin_sub_overflow_p (); /* { dg-error "not enough arguments to function" } */ + x += __builtin_mul_overflow_p (); /* { dg-error "not enough arguments to function" } */ return x; } @@ -15,6 +18,10 @@ f2 (int a, int b, int *c, int d) int x = __builtin_add_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ x += __builtin_sub_overflow (a, b, c, d, d, d); /* { dg-error "too many arguments to function" } */ x += __builtin_mul_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_add_overflow_p (a, b, d, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_sub_overflow_p (a, b, d, d, 1, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_mul_overflow_p (a, b, d, d); /* { dg-error "too many arguments to function" } */ + return x; } @@ -33,6 +40,15 @@ f3 (float fa, int a, _Complex long int ca, double fb, void *pb, int b, enum E eb x += __builtin_add_overflow (a, pb, c); /* { dg-error "argument 2 in call to function\[^\n\r]*does not have integral type" } */ x += __builtin_sub_overflow (a, eb, c); x += __builtin_mul_overflow (a, bb, c); + x += __builtin_add_overflow_p (fa, b, a); /* { dg-error "argument 1 in call to function\[^\n\r]*does not have integral type" } */ + x += __builtin_sub_overflow_p (ca, b, eb); /* { dg-error "argument 1 in call to function\[^\n\r]*does not have integral type" } */ + x += __builtin_mul_overflow_p (a, fb, bb); /* { dg-error "argument 2 in call to function\[^\n\r]*does not have integral type" } */ + x += __builtin_add_overflow_p (a, pb, a); /* { dg-error "argument 2 in call to function\[^\n\r]*does not have integral type" } */ + x += __builtin_sub_overflow_p (a, eb, eb); + x += __builtin_mul_overflow_p (a, bb, bb); + x += __builtin_add_overflow_p (a, b, fa); /* { dg-error "argument 3 in call to function\[^\n\r]*does not have integral type" } */ + x += __builtin_sub_overflow_p (a, b, ca); /* { dg-error "argument 3 in call to function\[^\n\r]*does not have integral type" } */ + x += __builtin_mul_overflow_p (a, b, c); /* { dg-error "argument 3 in call to function\[^\n\r]*does not have integral type" } */ return x; } diff --git a/gcc/testsuite/c-c++-common/builtin-arith-overflow-2.c b/gcc/testsuite/c-c++-common/builtin-arith-overflow-2.c new file mode 100644 index 00000000000..4cbceff3ed2 --- /dev/null +++ b/gcc/testsuite/c-c++-common/builtin-arith-overflow-2.c @@ -0,0 +1,493 @@ +/* PR c/68120 - can't easily deal with integer overflow at compile time */ +/* { dg-do run } */ +/* { dg-additional-options "-Wno-long-long" } */ + +#define SCHAR_MAX __SCHAR_MAX__ +#define SHRT_MAX __SHRT_MAX__ +#define INT_MAX __INT_MAX__ +#define LONG_MAX __LONG_MAX__ +#define LLONG_MAX __LONG_LONG_MAX__ + +#define SCHAR_MIN (-__SCHAR_MAX__ - 1) +#define SHRT_MIN (-__SHRT_MAX__ - 1) +#define INT_MIN (-__INT_MAX__ - 1) +#define LONG_MIN (-__LONG_MAX__ - 1) +#define LLONG_MIN (-__LONG_LONG_MAX__ - 1) + +#define UCHAR_MAX (SCHAR_MAX * 2U + 1) +#define USHRT_MAX (SHRT_MAX * 2U + 1) +#define UINT_MAX (INT_MAX * 2U + 1) +#define ULONG_MAX (LONG_MAX * 2LU + 1) +#define ULLONG_MAX (LLONG_MAX * 2LLU + 1) + +#define USCHAR_MIN (-__USCHAR_MAX__ - 1) +#define USHRT_MIN (-__USHRT_MAX__ - 1) +#define UINT_MIN (-__UINT_MAX__ - 1) +#define ULONG_MIN (-__ULONG_MAX__ - 1) +#define ULLONG_MIN (-__ULONG_LONG_MAX__ - 1) + +/* Number of failed runtime assertions. */ +int nfails; + +void __attribute__ ((noclone, noinline)) +runtime_assert (int expr, int line) +{ + if (!expr) + { + __builtin_printf ("line %i: assertion failed\n", line); + ++nfails; + } +} + +/* Helper macros for run-time testing. */ +#define add(x, y) ((x) + (y)) +#define sadd(x, y) ((x) + (y)) +#define saddl(x, y) ((x) + (y)) +#define saddll(x, y) ((x) + (y)) +#define uadd(x, y) ((x) + (y)) +#define uaddl(x, y) ((x) + (y)) +#define uaddll(x, y) ((x) + (y)) +#define sub(x, y) ((x) - (y)) +#define ssub(x, y) ((x) - (y)) +#define ssubl(x, y) ((x) - (y)) +#define ssubll(x, y) ((x) - (y)) +#define usub(x, y) ((x) - (y)) +#define usubl(x, y) ((x) - (y)) +#define usubll(x, y) ((x) - (y)) +#define mul(x, y) ((x) * (y)) +#define smul(x, y) ((x) * (y)) +#define smull(x, y) ((x) * (y)) +#define smulll(x, y) ((x) * (y)) +#define umul(x, y) ((x) * (y)) +#define umull(x, y) ((x) * (y)) +#define umulll(x, y) ((x) * (y)) + +int main (void) +{ + +#if __cplusplus >= 201103L +# define StaticAssert(expr) static_assert ((expr), #expr) +#elif __STDC_VERSION__ >= 201112L +# define StaticAssert(expr) _Static_assert ((expr), #expr) +#else + /* The following pragma has no effect due to bug 70888 - #pragma + diagnostic ignored -Wlong-long ineffective with __LONG_LONG_MAX__ + in c++98 mode. */ +# pragma GCC diagnostic ignored "-Wlong-long" +# pragma GCC diagnostic ignored "-Wunused-local-typedefs" + +# define CONCAT(a, b) a ## b +# define CAT(a, b) CONCAT (a, b) +# define StaticAssert(expr) \ + typedef int CAT (StaticAssert_, __LINE__) [1 - 2 * !(expr)] +#endif + + /* Make extra effort to prevent constant folding seeing the constant + values of the arguments and optimizing the run-time test into + a constant. */ +#define RuntimeAssert(op, T, U, x, y, vflow) \ + do { \ + volatile T a = (x), b = (y); \ + U c = 0; \ + volatile int vf = __builtin_ ## op ## _overflow (a, b, &c); \ + runtime_assert ((vf == vflow), __LINE__); \ + if (vf == 0) \ + runtime_assert (op (a, b) == c, __LINE__); \ + } while (0) + + /* Verify that each call to the type-generic __builtin_op_overflow(x, y) + yields a constant expression equal to z indicating whether or not + the constant expression (x op y) overflows when evaluated in type T. */ +# define G_TEST(op, T, x, y, vflow) \ + RuntimeAssert(op, __typeof__ (op (x, y)), T, x, y, vflow); \ + StaticAssert ((vflow) == __builtin_ ## op ## _overflow_p ((x), (y), (T)0)) + + /* Addition. */ + G_TEST (add, signed char, 0, 0, 0); + G_TEST (add, signed char, 0, SCHAR_MAX, 0); + G_TEST (add, signed char, 1, SCHAR_MAX, 1); + G_TEST (add, signed char, SCHAR_MAX, SCHAR_MAX, 1); + G_TEST (add, signed char, 0, SCHAR_MIN, 0); + G_TEST (add, signed char, -1, SCHAR_MIN, 1); + /* Verify any slicing in the result type doesn't prevent the overflow + from being detected. */ + G_TEST (add, signed char, UCHAR_MAX + 1, 0, 1); + G_TEST (add, signed char, UCHAR_MAX + 1, 1, 1); + G_TEST (add, signed char, 1, UCHAR_MAX + 1, 1); + + G_TEST (add, unsigned char, 0, 0, 0); + /* Verify any slicing in the result type doesn't prevent the overflow + from being detected. */ + G_TEST (add, unsigned char, UCHAR_MAX + 1, 0, 1); + G_TEST (add, unsigned char, UCHAR_MAX + 1, 1, 1); + G_TEST (add, unsigned char, 1, UCHAR_MAX + 1, 1); + + G_TEST (add, short, 0, 0, 0); + G_TEST (add, short, 0, SHRT_MAX, 0); + G_TEST (add, short, 1, SHRT_MAX, 1); + G_TEST (add, short, SHRT_MAX, SHRT_MAX, 1); + G_TEST (add, short, 0, SHRT_MIN, 0); + G_TEST (add, short, -1, SHRT_MIN, 1); + G_TEST (add, short, SHRT_MIN, SHRT_MIN, 1); + + G_TEST (add, int, 0, 0, 0); + G_TEST (add, int, 0, INT_MAX, 0); + G_TEST (add, int, 1, INT_MAX, 1); + G_TEST (add, int, INT_MAX, INT_MAX, 1); + G_TEST (add, int, 0, INT_MIN, 0); + G_TEST (add, int, -1, INT_MIN, 1); + G_TEST (add, int, INT_MIN, INT_MIN, 1); + + G_TEST (add, long, 0, 0, 0); + G_TEST (add, long, 0, LONG_MAX, 0); + G_TEST (add, long, 1, LONG_MAX, 1); + G_TEST (add, long, LONG_MAX, LONG_MAX, 1); + G_TEST (add, long, 0, LONG_MIN, 0); + G_TEST (add, long, -1, LONG_MIN, 1); + G_TEST (add, long, LONG_MIN, LONG_MIN, 1); + + G_TEST (add, long long, 0, 0, 0); + G_TEST (add, long long, 0, LLONG_MAX, 0); + G_TEST (add, long long, 1, LLONG_MAX, 1); + G_TEST (add, long long, LLONG_MAX, LLONG_MAX, 1); + G_TEST (add, long long, 0, LLONG_MIN, 0); + G_TEST (add, long long, -1, LLONG_MIN, 1); + G_TEST (add, long long, LLONG_MIN, LLONG_MIN, 1); + + /* Subtraction */ + G_TEST (sub, unsigned char, 0, 0, 0); + G_TEST (sub, unsigned char, 0, UCHAR_MAX, 1); + G_TEST (sub, unsigned char, 1, UCHAR_MAX, 1); + + G_TEST (sub, unsigned char, UCHAR_MAX, UCHAR_MAX, 0); + G_TEST (sub, unsigned short, 0, 0, 0); + G_TEST (sub, unsigned short, 0, USHRT_MAX, 1); + G_TEST (sub, unsigned short, 1, USHRT_MAX, 1); + G_TEST (sub, unsigned short, USHRT_MAX, USHRT_MAX, 0); + + G_TEST (sub, unsigned, 0, 0, 0); + G_TEST (sub, unsigned, 0, UINT_MAX, 1); + G_TEST (sub, unsigned, 1, UINT_MAX, 1); + G_TEST (sub, unsigned, UINT_MAX, UINT_MAX, 0); + + G_TEST (sub, unsigned long, 0, 0, 0); + G_TEST (sub, unsigned long, 0, ULONG_MAX, 1); + G_TEST (sub, unsigned long, 1, ULONG_MAX, 1); + G_TEST (sub, unsigned long, ULONG_MAX, ULONG_MAX, 0); + + G_TEST (sub, unsigned long long, 0, 0, 0); + G_TEST (sub, unsigned long long, 0, ULLONG_MAX, 1); + G_TEST (sub, unsigned long long, 1, ULLONG_MAX, 1); + G_TEST (sub, unsigned long long, ULLONG_MAX, ULLONG_MAX, 0); + + G_TEST (sub, signed char, 0, 0, 0); + G_TEST (sub, signed char, 0, SCHAR_MAX, 0); + G_TEST (sub, signed char, 1, SCHAR_MAX, 0); + G_TEST (sub, signed char, SCHAR_MAX, SCHAR_MAX, 0); + G_TEST (sub, signed char, SCHAR_MIN, 1, 1); + G_TEST (sub, signed char, 0, SCHAR_MIN, 1); + G_TEST (sub, signed char, -1, SCHAR_MIN, 0); + + G_TEST (sub, short, 0, 0, 0); + G_TEST (sub, short, 0, SHRT_MAX, 0); + G_TEST (sub, short, 1, SHRT_MAX, 0); + G_TEST (sub, short, SHRT_MAX, SHRT_MAX, 0); + G_TEST (sub, short, 0, SHRT_MIN, 1); + G_TEST (sub, short, -1, SHRT_MIN, 0); + G_TEST (sub, short, SHRT_MIN, SHRT_MIN, 0); + + G_TEST (sub, int, 0, 0, 0); + G_TEST (sub, int, 0, INT_MAX, 0); + G_TEST (sub, int, 1, INT_MAX, 0); + G_TEST (sub, int, INT_MAX, INT_MAX, 0); + G_TEST (sub, int, 0, INT_MIN, 1); + G_TEST (sub, int, -1, INT_MIN, 0); + G_TEST (sub, int, INT_MIN, INT_MIN, 0); + + G_TEST (sub, long, 0, 0, 0); + G_TEST (sub, long, 0, LONG_MAX, 0); + G_TEST (sub, long, 1, LONG_MAX, 0); + G_TEST (sub, long, LONG_MAX, LONG_MAX, 0); + G_TEST (sub, long, 0, LONG_MIN, 1); + G_TEST (sub, long, -1, LONG_MIN, 0); + G_TEST (sub, long, LONG_MIN, LONG_MIN, 0); + + G_TEST (sub, long long, 0, 0, 0); + G_TEST (sub, long long, 0, LLONG_MAX, 0); + G_TEST (sub, long long, 1, LLONG_MAX, 0); + G_TEST (sub, long long, LLONG_MAX, LLONG_MAX, 0); + G_TEST (sub, long long, 0, LLONG_MIN, 1); + G_TEST (sub, long long, -1, LLONG_MIN, 0); + G_TEST (sub, long long, LLONG_MIN, LLONG_MIN, 0); + + G_TEST (sub, unsigned char, 0, 0, 0); + G_TEST (sub, unsigned char, 0, UCHAR_MAX, 1); + G_TEST (sub, unsigned char, 1, UCHAR_MAX, 1); + G_TEST (sub, unsigned char, UCHAR_MAX, UCHAR_MAX, 0); + + G_TEST (sub, unsigned short, 0, 0, 0); + G_TEST (sub, unsigned short, 0, USHRT_MAX, 1); + G_TEST (sub, unsigned short, 1, USHRT_MAX, 1); + G_TEST (sub, unsigned short, USHRT_MAX, USHRT_MAX, 0); + + G_TEST (sub, unsigned, 0, 0, 0); + G_TEST (sub, unsigned, 0, UINT_MAX, 1); + G_TEST (sub, unsigned, 1, UINT_MAX, 1); + G_TEST (sub, unsigned, UINT_MAX, UINT_MAX, 0); + + G_TEST (sub, unsigned long, 0, 0, 0); + G_TEST (sub, unsigned long, 0, ULONG_MAX, 1); + G_TEST (sub, unsigned long, 1, ULONG_MAX, 1); + G_TEST (sub, unsigned long, ULONG_MAX, ULONG_MAX, 0); + + G_TEST (sub, unsigned long long, 0, 0, 0); + G_TEST (sub, unsigned long long, 0, ULLONG_MAX, 1); + G_TEST (sub, unsigned long long, 1, ULLONG_MAX, 1); + G_TEST (sub, unsigned long long, ULLONG_MAX, ULLONG_MAX, 0); + + /* Multiplication. */ + G_TEST (mul, unsigned char, 0, 0, 0); + G_TEST (mul, unsigned char, 0, UCHAR_MAX, 0); + G_TEST (mul, unsigned char, 1, UCHAR_MAX, 0); + G_TEST (mul, unsigned char, 2, UCHAR_MAX, 1); + G_TEST (mul, unsigned char, UCHAR_MAX, UCHAR_MAX, 1); + + G_TEST (mul, unsigned short, 0, 0, 0); + G_TEST (mul, unsigned short, 0, USHRT_MAX, 0); + G_TEST (mul, unsigned short, 1, USHRT_MAX, 0); + G_TEST (mul, unsigned short, USHRT_MAX, 2, 1); + G_TEST (mul, unsigned short, USHRT_MAX, USHRT_MAX, 1); + + G_TEST (mul, unsigned, 0, 0, 0); + G_TEST (mul, unsigned, 0, UINT_MAX, 0); + G_TEST (mul, unsigned, 1, UINT_MAX, 0); + G_TEST (mul, unsigned, 2, UINT_MAX, 1); + G_TEST (mul, unsigned, UINT_MAX, UINT_MAX, 1); + + G_TEST (mul, unsigned long, 0, 0, 0); + G_TEST (mul, unsigned long, 0, ULONG_MAX, 0); + G_TEST (mul, unsigned long, 1, ULONG_MAX, 0); + G_TEST (mul, unsigned long, 2, ULONG_MAX, 1); + G_TEST (mul, unsigned long, ULONG_MAX, ULONG_MAX, 1); + + G_TEST (mul, unsigned long long, 0, 0, 0); + G_TEST (mul, unsigned long long, 0, ULLONG_MAX, 0); + G_TEST (mul, unsigned long long, 1, ULLONG_MAX, 0); + G_TEST (mul, unsigned long long, 2, ULLONG_MAX, 1); + G_TEST (mul, unsigned long long, ULLONG_MAX, ULLONG_MAX, 1); + + G_TEST (mul, signed char, 0, 0, 0); + G_TEST (mul, signed char, 0, SCHAR_MAX, 0); + G_TEST (mul, signed char, 1, SCHAR_MAX, 0); + G_TEST (mul, signed char, SCHAR_MAX, SCHAR_MAX, 1); + G_TEST (mul, signed char, SCHAR_MIN, 1, 0); + G_TEST (mul, signed char, 0, SCHAR_MIN, 0); + G_TEST (mul, signed char, -1, SCHAR_MIN, 1); + + G_TEST (mul, short, 0, 0, 0); + G_TEST (mul, short, 0, SHRT_MAX, 0); + G_TEST (mul, short, 1, SHRT_MAX, 0); + G_TEST (mul, short, SHRT_MAX, SHRT_MAX, 1); + G_TEST (mul, short, 0, SHRT_MIN, 0); + G_TEST (mul, short, -1, SHRT_MIN, 1); + G_TEST (mul, short, SHRT_MIN, SHRT_MIN, 1); + + G_TEST (mul, int, 0, 0, 0); + G_TEST (mul, int, 0, INT_MAX, 0); + G_TEST (mul, int, 1, INT_MAX, 0); + G_TEST (mul, int, INT_MAX, INT_MAX, 1); + G_TEST (mul, int, 0, INT_MIN, 0); + G_TEST (mul, int, -1, INT_MIN, 1); + G_TEST (mul, int, INT_MIN, INT_MIN, 1); + + G_TEST (mul, long, 0, 0, 0); + G_TEST (mul, long, 0, LONG_MAX, 0); + G_TEST (mul, long, 1, LONG_MAX, 0); + G_TEST (mul, long, LONG_MAX, LONG_MAX, 1); + G_TEST (mul, long, 0, LONG_MIN, 0); + G_TEST (mul, long, -1, LONG_MIN, 1); + G_TEST (mul, long, LONG_MIN, LONG_MIN, 1); + + G_TEST (mul, long long, 0, 0, 0); + G_TEST (mul, long long, 0, LLONG_MAX, 0); + G_TEST (mul, long long, 1, LLONG_MAX, 0); + G_TEST (mul, long long, LLONG_MAX, LLONG_MAX, 1); + G_TEST (mul, long long, 0, LLONG_MIN, 0); + G_TEST (mul, long long, -1, LLONG_MIN, 1); + G_TEST (mul, long long, LLONG_MIN, LLONG_MIN, 1); + + G_TEST (mul, unsigned char, 0, 0, 0); + G_TEST (mul, unsigned char, 0, UCHAR_MAX, 0); + G_TEST (mul, unsigned char, 1, UCHAR_MAX, 0); + G_TEST (mul, unsigned char, UCHAR_MAX, UCHAR_MAX, 1); + + G_TEST (mul, unsigned short, 0, 0, 0); + G_TEST (mul, unsigned short, 0, USHRT_MAX, 0); + G_TEST (mul, unsigned short, 1, USHRT_MAX, 0); + G_TEST (mul, unsigned short, USHRT_MAX, USHRT_MAX, 1); + + G_TEST (mul, unsigned, 0, 0, 0); + G_TEST (mul, unsigned, 0, UINT_MAX, 0); + G_TEST (mul, unsigned, 1, UINT_MAX, 0); + G_TEST (mul, unsigned, UINT_MAX, UINT_MAX, 1); + + G_TEST (mul, unsigned long, 0, 0, 0); + G_TEST (mul, unsigned long, 0, ULONG_MAX, 0); + G_TEST (mul, unsigned long, 1, ULONG_MAX, 0); + G_TEST (mul, unsigned long, ULONG_MAX, ULONG_MAX, 1); + + G_TEST (mul, unsigned long long, 0, 0, 0); + G_TEST (mul, unsigned long long, 0, ULLONG_MAX, 0); + G_TEST (mul, unsigned long long, 1, ULLONG_MAX, 0); + G_TEST (mul, unsigned long long, ULLONG_MAX, ULLONG_MAX, 1); + + /* Verify that each call to the type-specific __builtin_op_overflow + evaluates to a (not-necessarily constant) expression indicating + whether or not the constant expression (x op y) overflows. + The type-specific forms of the built-ins detect overflow after + arithmetic promotions and so unlike the type-generic overloads + cannot detect overflow in char or short types. */ + +#define T_TEST(op, T, x, y, vflow) \ + RuntimeAssert (op, T, __typeof__ ((x) + (y)), x, y, vflow) + + /* Signed int addition. */ + T_TEST (sadd, signed char, 0, 0, 0); + T_TEST (sadd, signed char, 0, SCHAR_MAX, 0); + T_TEST (sadd, signed char, 1, SCHAR_MAX, 0); + T_TEST (sadd, signed char, SCHAR_MAX, SCHAR_MAX, 0); + T_TEST (sadd, signed char, 0, SCHAR_MIN, 0); + T_TEST (sadd, signed char, -1, SCHAR_MIN, 0); + + T_TEST (sadd, short, 0, 0, 0); + T_TEST (sadd, short, 0, SHRT_MAX, 0); + T_TEST (sadd, short, 1, SHRT_MAX, 0); + T_TEST (sadd, short, SHRT_MAX, SHRT_MAX, 0); + T_TEST (sadd, short, 0, SHRT_MIN, 0); + T_TEST (sadd, short, -1, SHRT_MIN, 0); + T_TEST (sadd, short, SHRT_MIN, SHRT_MIN, 0); + + T_TEST (sadd, int, 0, 0, 0); + T_TEST (sadd, int, 0, INT_MAX, 0); + T_TEST (sadd, int, 1, INT_MAX, 1); + T_TEST (sadd, int, INT_MAX, INT_MAX, 1); + T_TEST (sadd, int, 0, INT_MIN, 0); + T_TEST (sadd, int, -1, INT_MIN, 1); + T_TEST (sadd, int, INT_MIN, INT_MIN, 1); + + /* Signed long addition. */ + T_TEST (saddl, long, 0L, 0L, 0); + T_TEST (saddl, long, 0L, LONG_MAX, 0); + T_TEST (saddl, long, 1L, LONG_MAX, 1); + T_TEST (saddl, long, LONG_MAX, LONG_MAX, 1); + T_TEST (saddl, long, 0L, LONG_MIN, 0); + T_TEST (saddl, long, -1L, LONG_MIN, 1); + T_TEST (saddl, long, LONG_MIN, LONG_MIN, 1); + + T_TEST (saddll, long long, 0LL, 0LL, 0); + T_TEST (saddll, long long, 0LL, LLONG_MAX, 0); + T_TEST (saddll, long long, 1LL, LLONG_MAX, 1); + T_TEST (saddll, long long, LLONG_MAX, LLONG_MAX, 1); + T_TEST (saddll, long long, 0LL, LLONG_MIN, 0); + T_TEST (saddll, long long, -1LL, LLONG_MIN, 1); + T_TEST (saddll, long long, LLONG_MIN, LLONG_MIN, 1); + + /* Unsigned int addition. */ + T_TEST (uadd, unsigned char, 0U, 0U, 0); + T_TEST (uadd, unsigned char, 0U, UCHAR_MAX, 0); + T_TEST (uadd, unsigned char, 1U, UCHAR_MAX, 0); + T_TEST (uadd, unsigned char, UCHAR_MAX, UCHAR_MAX, 0); + + T_TEST (uadd, unsigned short, 0U, 0U, 0); + T_TEST (uadd, unsigned short, 0U, USHRT_MAX, 0); + T_TEST (uadd, unsigned short, 1U, USHRT_MAX, 0); + T_TEST (uadd, unsigned short, USHRT_MAX, USHRT_MAX, 0); + + T_TEST (uadd, unsigned, 0U, 0U, 0); + T_TEST (uadd, unsigned, 0U, UINT_MAX, 0); + T_TEST (uadd, unsigned, 1U, UINT_MAX, 1); + T_TEST (uadd, unsigned, UINT_MAX, UINT_MAX, 1); + + /* Unsigned long addition. */ + T_TEST (uaddl, unsigned long, 0UL, 0UL, 0); + T_TEST (uaddl, unsigned long, 0UL, ULONG_MAX, 0); + T_TEST (uaddl, unsigned long, 1UL, ULONG_MAX, 1); + T_TEST (uaddl, unsigned long, ULONG_MAX, ULONG_MAX, 1); + + T_TEST (uaddll, unsigned long long, 0ULL, 0ULL, 0); + T_TEST (uaddll, unsigned long long, 0ULL, ULLONG_MAX, 0); + T_TEST (uaddll, unsigned long long, 1ULL, ULLONG_MAX, 1); + T_TEST (uaddll, unsigned long long, ULLONG_MAX, ULLONG_MAX, 1); + + /* Signed int subtraction. */ + T_TEST (ssub, signed char, 0, 0, 0); + T_TEST (ssub, signed char, 0, SCHAR_MAX, 0); + T_TEST (ssub, signed char, 1, SCHAR_MAX, 0); + T_TEST (ssub, signed char, SCHAR_MAX, SCHAR_MAX, 0); + T_TEST (ssub, signed char, 0, SCHAR_MIN, 0); + T_TEST (ssub, signed char, -1, SCHAR_MIN, 0); + + T_TEST (ssub, short, 0, 0, 0); + T_TEST (ssub, short, 0, SHRT_MAX, 0); + T_TEST (ssub, short, 1, SHRT_MAX, 0); + T_TEST (ssub, short, SHRT_MAX, SHRT_MAX, 0); + T_TEST (ssub, short, 0, SHRT_MIN, 0); + T_TEST (ssub, short, -1, SHRT_MIN, 0); + T_TEST (ssub, short, SHRT_MIN, SHRT_MIN, 0); + + T_TEST (ssub, int, 0, 0, 0); + T_TEST (ssub, int, 0, INT_MAX, 0); + T_TEST (ssub, int, 1, INT_MAX, 0); + T_TEST (ssub, int, INT_MAX, INT_MAX, 0); + T_TEST (ssub, int, 0, INT_MIN, 1); + T_TEST (ssub, int, -1, INT_MIN, 0); + T_TEST (ssub, int, INT_MIN, INT_MIN, 0); + + /* Signed long subtraction. */ + T_TEST (ssubl, long, 0L, 0L, 0); + T_TEST (ssubl, long, 0L, LONG_MAX, 0); + T_TEST (ssubl, long, 1L, LONG_MAX, 0); + T_TEST (ssubl, long, LONG_MAX, LONG_MAX, 0); + T_TEST (ssubl, long, 0L, LONG_MIN, 1); + T_TEST (ssubl, long, -1L, LONG_MIN, 0); + T_TEST (ssubl, long, LONG_MIN, LONG_MIN, 0); + + /* Signed long long subtraction. */ + T_TEST (ssubll, long long, 0LL, 0LL, 0); + T_TEST (ssubll, long long, 0LL, LLONG_MAX, 0); + T_TEST (ssubll, long long, 1LL, LLONG_MAX, 0); + T_TEST (ssubll, long long, LLONG_MAX, LLONG_MAX, 0); + T_TEST (ssubll, long long, 0LL, LLONG_MIN, 1); + T_TEST (ssubll, long long, -1LL, LLONG_MIN, 0); + T_TEST (ssubll, long long, LLONG_MIN, LLONG_MIN, 0); + + /* Unsigned int subtraction. */ + T_TEST (usub, unsigned char, 0U, 0U, 0); + T_TEST (usub, unsigned char, 0U, UCHAR_MAX, 1); + T_TEST (usub, unsigned char, 1U, UCHAR_MAX, 1); + T_TEST (usub, unsigned char, UCHAR_MAX, UCHAR_MAX, 0); + + T_TEST (usub, unsigned short, 0U, 0U, 0); + T_TEST (usub, unsigned short, 0U, USHRT_MAX, 1); + T_TEST (usub, unsigned short, 1U, USHRT_MAX, 1); + T_TEST (usub, unsigned short, USHRT_MAX, USHRT_MAX, 0); + + T_TEST (usub, unsigned, 0U, 0U, 0); + T_TEST (usub, unsigned, 0U, UINT_MAX, 1); + T_TEST (usub, unsigned, 1U, UINT_MAX, 1); + T_TEST (usub, unsigned, UINT_MAX, UINT_MAX, 0); + + /* Unsigned long subtraction. */ + T_TEST (usubl, unsigned long, 0UL, 0UL, 0); + T_TEST (usubl, unsigned long, 0UL, ULONG_MAX, 1); + T_TEST (usubl, unsigned long, 1UL, ULONG_MAX, 1); + T_TEST (usubl, unsigned long, ULONG_MAX, ULONG_MAX, 0); + + /* Unsigned long long subtraction. */ + T_TEST (usubll, unsigned long long, 0ULL, 0ULL, 0); + T_TEST (usubll, unsigned long long, 0ULL, ULLONG_MAX, 1); + T_TEST (usubll, unsigned long long, 1ULL, ULLONG_MAX, 1); + T_TEST (usubll, unsigned long long, ULLONG_MAX, ULLONG_MAX, 0); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-arith-overflow.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-arith-overflow.C new file mode 100644 index 00000000000..a63c0a1ef54 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-arith-overflow.C @@ -0,0 +1,212 @@ +// PR c++/70507 - integer overflow builtins not constant expressions +// { dg-do compile { target c++11 } } + +#define SCHAR_MAX __SCHAR_MAX__ +#define SHRT_MAX __SHRT_MAX__ +#define INT_MAX __INT_MAX__ +#define LONG_MAX __LONG_MAX__ +#define LLONG_MAX __LONG_LONG_MAX__ + +#define SCHAR_MIN (-__SCHAR_MAX__ - 1) +#define SHRT_MIN (-__SHRT_MAX__ - 1) +#define INT_MIN (-__INT_MAX__ - 1) +#define LONG_MIN (-__LONG_MAX__ - 1) +#define LLONG_MIN (-__LONG_LONG_MAX__ - 1) + +#define UCHAR_MAX (SCHAR_MAX * 2U + 1) +#define USHRT_MAX (SHRT_MAX * 2U + 1) +#define UINT_MAX (INT_MAX * 2U + 1) +#define ULONG_MAX (LONG_MAX * 2LU + 1) +#define ULLONG_MAX (LLONG_MAX * 2LLU + 1) + +#define USCHAR_MIN (-__USCHAR_MAX__ - 1) +#define USHRT_MIN (-__USHRT_MAX__ - 1) +#define UINT_MIN (-__UINT_MAX__ - 1) +#define ULONG_MIN (-__ULONG_MAX__ - 1) +#define ULLONG_MIN (-__ULONG_LONG_MAX__ - 1) + +#define Assert(expr) static_assert ((expr), #expr) + +template +constexpr T add (T x, T y, T z = T ()) +{ + return __builtin_add_overflow (x, y, &z) ? 0 : z; +} + +template +constexpr T sub (T x, T y, T z = T ()) +{ + return __builtin_sub_overflow (x, y, &z) ? 0 : z; +} + +template +constexpr T mul (T x, T y, T z = T ()) +{ + return __builtin_mul_overflow (x, y, &z) ? 0 : z; +} + +#define TEST_ADD(T, x, y, z) Assert (z == add(x, y)) +#define TEST_SUB(T, x, y, z) Assert (z == sub(x, y)) +#define TEST_MUL(T, x, y, z) Assert (z == mul(x, y)) + + +TEST_ADD (signed char, 0, 0, 0); +TEST_ADD (signed char, 0, SCHAR_MAX, SCHAR_MAX); +TEST_ADD (signed char, 1, SCHAR_MAX, 0); // overflow +TEST_ADD (signed char, SCHAR_MAX, SCHAR_MAX, 0); // overflow +TEST_ADD (signed char, 0, SCHAR_MIN, SCHAR_MIN); +TEST_ADD (signed char, -1, SCHAR_MIN, 0); // overflow + +TEST_ADD (short, 0, 0, 0); +TEST_ADD (short, 0, SHRT_MAX, SHRT_MAX); +TEST_ADD (short, 1, SHRT_MAX, 0); // overflow +TEST_ADD (short, SHRT_MAX, SHRT_MAX, 0); // overflow +TEST_ADD (short, 0, SHRT_MIN, SHRT_MIN); +TEST_ADD (short, -1, SHRT_MIN, 0); // overflow +TEST_ADD (short, SHRT_MIN, SHRT_MIN, 0); // overflow + +TEST_ADD (int, 0, 0, 0); +TEST_ADD (int, 0, INT_MAX, INT_MAX); +TEST_ADD (int, 1, INT_MAX, 0); // overflow +TEST_ADD (int, INT_MAX, INT_MAX, 0); // overflow +TEST_ADD (int, 0, INT_MIN, INT_MIN); +TEST_ADD (int, -1, INT_MIN, 0); // overflow +TEST_ADD (int, INT_MIN, INT_MIN, 0); // overflow + +TEST_ADD (long, 0, 0, 0); +TEST_ADD (long, 0, LONG_MAX, LONG_MAX); +TEST_ADD (long, 1, LONG_MAX, 0); // overflow +TEST_ADD (long, LONG_MAX, LONG_MAX, 0); // overflow +TEST_ADD (long, 0, LONG_MIN, LONG_MIN); +TEST_ADD (long, -1, LONG_MIN, 0); // overflow +TEST_ADD (long, LONG_MIN, LONG_MIN, 0); // overflow + +TEST_ADD (long long, 0, 0, 0); +TEST_ADD (long long, 0, LLONG_MAX, LLONG_MAX); +TEST_ADD (long long, 1, LLONG_MAX, 0); // overflow +TEST_ADD (long long, LLONG_MAX, LLONG_MAX, 0); // overflow +TEST_ADD (long long, 0, LLONG_MIN, LLONG_MIN); +TEST_ADD (long long, -1, LLONG_MIN, 0); // overflow +TEST_ADD (long long, LLONG_MIN, LLONG_MIN, 0); // overflow + +TEST_ADD (unsigned char, 0, 0, 0); +TEST_ADD (unsigned char, 0, UCHAR_MAX, UCHAR_MAX); +TEST_ADD (unsigned char, 1, UCHAR_MAX, 0); // overflow + +TEST_ADD (unsigned char, UCHAR_MAX, UCHAR_MAX, 0); // overflow +TEST_ADD (unsigned short, 0, 0, 0); +TEST_ADD (unsigned short, 0, USHRT_MAX, USHRT_MAX); +TEST_ADD (unsigned short, 1, USHRT_MAX, 0); // overflow +TEST_ADD (unsigned short, USHRT_MAX, USHRT_MAX, 0); // overflow + +TEST_ADD (unsigned, 0, 0, 0); +TEST_ADD (unsigned, 0, UINT_MAX, UINT_MAX); +TEST_ADD (unsigned, 1, UINT_MAX, 0); // overflow +TEST_ADD (unsigned, UINT_MAX, UINT_MAX, 0); // overflow + +TEST_ADD (unsigned long, 0, 0, 0); +TEST_ADD (unsigned long, 0, ULONG_MAX, ULONG_MAX); +TEST_ADD (unsigned long, 1, ULONG_MAX, 0); // overflow +TEST_ADD (unsigned long, ULONG_MAX, ULONG_MAX, 0); // overflow + +TEST_ADD (unsigned long long, 0, 0, 0); +TEST_ADD (unsigned long long, 0, ULLONG_MAX, ULLONG_MAX); +TEST_ADD (unsigned long long, 1, ULLONG_MAX, 0); // overflow +TEST_ADD (unsigned long long, ULLONG_MAX, ULLONG_MAX, 0); // overflow + + +// Make sure the built-ins are accepted in the following contexts +// where constant expressions are required and that they return +// the expected overflow value. + +namespace Enum { + +enum Add { + a0 = __builtin_add_overflow_p ( 1, 1, 0), + a1 = __builtin_add_overflow_p (INT_MAX, 1, 0) +}; + +Assert (a0 == 0); +Assert (a1 == 1); + +enum Sub { + s0 = __builtin_sub_overflow_p ( 1, 1, 0), + s1 = __builtin_sub_overflow_p (INT_MIN, 1, 0) +}; + +Assert (s0 == 0); +Assert (s1 == 1); + +enum Mul { + m0 = __builtin_add_overflow_p ( 1, 1, 0), + m1 = __builtin_add_overflow_p (INT_MAX, INT_MAX, 0) +}; + +Assert (m0 == 0); +Assert (m1 == 1); + +} // namespace Enum + +namespace TemplateArg { + +template +struct Add { + Assert (z == v); +}; + +template +struct Sub { + Assert (z == v); +}; + +template +struct Mul { + Assert (z == v); +}; + +template struct Add; +template struct Add; + +template struct Sub; +template struct Sub; + +template struct Mul; +template struct Mul; + +} // namespace TemplateArg + +#if __cplusplus >= 201402L + +namespace Initializer { + +struct Result { + int res; + bool vflow; +}; + +constexpr Result +add_vflow (int a, int b) +{ +#if 1 + Result res = { a + b, __builtin_add_overflow_p (a, b, int ()) }; +#else + // The following fails to compile because of c++/71391 - error + // on aggregate initialization with side-effects in a constexpr + // function + int c = 0; + Result res = { 0, __builtin_add_overflow (a, b, &c) }; + res.c = c; +#endif + return res; +} + +constexpr Result sum = add_vflow (123, 456); +Assert (sum.res == 123 + 456); +Assert (!sum.vflow); + +} // namespace Initializer + +#endif // __cplusplus >= 201402L diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C new file mode 100644 index 00000000000..7ca0033d217 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C @@ -0,0 +1,229 @@ +// Test to exercise that the type-specific integer arithmetic built-ins +// with overflow checking can be used in C++ 14 constant expressions. +// -Woverflow is disabled to prevent (bogus?) G++ warnings. +// { dg-do compile { target c++14 } } +// { dg-additional-options "-Wno-overflow" } + +#define SCHAR_MAX __SCHAR_MAX__ +#define SHRT_MAX __SHRT_MAX__ +#define INT_MAX __INT_MAX__ +#define LONG_MAX __LONG_MAX__ +#define LLONG_MAX __LONG_LONG_MAX__ + +#define SCHAR_MIN (-__SCHAR_MAX__ - 1) +#define SHRT_MIN (-__SHRT_MAX__ - 1) +#define INT_MIN (-__INT_MAX__ - 1) +#define LONG_MIN (-__LONG_MAX__ - 1) +#define LLONG_MIN (-__LONG_LONG_MAX__ - 1) + +#define UCHAR_MAX (SCHAR_MAX * 2U + 1) +#define USHRT_MAX (SHRT_MAX * 2U + 1) +#define UINT_MAX (INT_MAX * 2U + 1) +#define ULONG_MAX (LONG_MAX * 2LU + 1) +#define ULLONG_MAX (LLONG_MAX * 2LLU + 1) + +#define USCHAR_MIN (-__USCHAR_MAX__ - 1) +#define USHRT_MIN (-__USHRT_MAX__ - 1) +#define UINT_MIN (-__UINT_MAX__ - 1) +#define ULONG_MIN (-__ULONG_MAX__ - 1) +#define ULLONG_MIN (-__ULONG_LONG_MAX__ - 1) + +// Helper macros. +#define sadd(x, y) ((x) + (y)) +#define saddl(x, y) ((x) + (y)) +#define saddll(x, y) ((x) + (y)) +#define uadd(x, y) ((x) + (y)) +#define uaddl(x, y) ((x) + (y)) +#define uaddll(x, y) ((x) + (y)) +#define ssub(x, y) ((x) - (y)) +#define ssubl(x, y) ((x) - (y)) +#define ssubll(x, y) ((x) - (y)) +#define usub(x, y) ((x) - (y)) +#define usubl(x, y) ((x) - (y)) +#define usubll(x, y) ((x) - (y)) +#define smul(x, y) ((x) * (y)) +#define smull(x, y) ((x) * (y)) +#define smulll(x, y) ((x) * (y)) +#define umul(x, y) ((x) * (y)) +#define umull(x, y) ((x) * (y)) +#define umulll(x, y) ((x) * (y)) + +// Result object. +template +struct Res +{ + constexpr Res (T a, bool v): z (a), v (v) { } + T z; bool v; +}; + +template +constexpr bool operator== (Res a, Res b) +{ + return a.z == b.z && a.v == b.v; +} + +#define StaticAssert(expr) static_assert ((expr), #expr) + +#define CONCAT(a, b) a ## b +#define CAT(a, b) CONCAT (a, b) + +// Helper to determine the type of the result of the arithmetic +// as specified by the built-ins. +template struct ResType { typedef T type; }; +template <> struct ResType { typedef int type; }; +template <> struct ResType { typedef unsigned type; }; +template <> struct ResType { typedef int type; }; +template <> struct ResType { typedef unsigned type; }; + +// Macro to define a single test case verifying that integer overflow +// is detected when expected, and when not, that the result matches +// the result computed using ordinary arithmetic. The result cannot +// be tested in the presence of overflow since it's not a core +// constant expression. +#define TEST(op, T, x, y, vflow) \ + constexpr Res CAT (op, __LINE__)(T a, T b) \ + { \ + ResType::type c = 0; \ + bool v = __builtin_ ## op ## _overflow (a, b, &c); \ + return Res(c, v); \ + } \ + StaticAssert (vflow ? CAT (op, __LINE__)(x, y).v \ + : CAT (op, __LINE__)(x, y) == Res(op (x, y), vflow)) + +/* Signed int addition. */ +TEST (sadd, signed char, 0, 0, 0); +TEST (sadd, signed char, 0, SCHAR_MAX, 0); +TEST (sadd, signed char, 1, SCHAR_MAX, 0); +TEST (sadd, signed char, SCHAR_MAX, SCHAR_MAX, 0); +TEST (sadd, signed char, 0, SCHAR_MIN, 0); +TEST (sadd, signed char, -1, SCHAR_MIN, 0); + +TEST (sadd, short, 0, 0, 0); +TEST (sadd, short, 0, SHRT_MAX, 0); +TEST (sadd, short, 1, SHRT_MAX, 0); +TEST (sadd, short, SHRT_MAX, SHRT_MAX, 0); +TEST (sadd, short, 0, SHRT_MIN, 0); +TEST (sadd, short, -1, SHRT_MIN, 0); +TEST (sadd, short, SHRT_MIN, SHRT_MIN, 0); + +TEST (sadd, int, 0, 0, 0); +TEST (sadd, int, 0, INT_MAX, 0); +TEST (sadd, int, 1, INT_MAX, 1); +TEST (sadd, int, INT_MAX, INT_MAX, 1); +TEST (sadd, int, 0, INT_MIN, 0); +TEST (sadd, int, -1, INT_MIN, 1); +TEST (sadd, int, INT_MIN, INT_MIN, 1); + +/* Signed long addition. */ +TEST (saddl, long, 0L, 0L, 0); +TEST (saddl, long, 0L, LONG_MAX, 0); +TEST (saddl, long, 1L, LONG_MAX, 1); +TEST (saddl, long, LONG_MAX, LONG_MAX, 1); +TEST (saddl, long, 0L, LONG_MIN, 0); +TEST (saddl, long, -1L, LONG_MIN, 1); +TEST (saddl, long, LONG_MIN, LONG_MIN, 1); + +TEST (saddll, long long, 0LL, 0LL, 0); +TEST (saddll, long long, 0LL, LLONG_MAX, 0); +TEST (saddll, long long, 1LL, LLONG_MAX, 1); +TEST (saddll, long long, LLONG_MAX, LLONG_MAX, 1); +TEST (saddll, long long, 0LL, LLONG_MIN, 0); +TEST (saddll, long long, -1LL, LLONG_MIN, 1); +TEST (saddll, long long, LLONG_MIN, LLONG_MIN, 1); + +/* Unsigned int addition. */ +TEST (uadd, unsigned char, 0U, 0U, 0); +TEST (uadd, unsigned char, 0U, UCHAR_MAX, 0); +TEST (uadd, unsigned char, 1U, UCHAR_MAX, 0); +TEST (uadd, unsigned char, UCHAR_MAX, UCHAR_MAX, 0); + +TEST (uadd, unsigned short, 0U, 0U, 0); +TEST (uadd, unsigned short, 0U, USHRT_MAX, 0); +TEST (uadd, unsigned short, 1U, USHRT_MAX, 0); +TEST (uadd, unsigned short, USHRT_MAX, USHRT_MAX, 0); + +TEST (uadd, unsigned, 0U, 0U, 0); +TEST (uadd, unsigned, 0U, UINT_MAX, 0); +TEST (uadd, unsigned, 1U, UINT_MAX, 1); +TEST (uadd, unsigned, UINT_MAX, UINT_MAX, 1); + +/* Unsigned long addition. */ +TEST (uaddl, unsigned long, 0UL, 0UL, 0); +TEST (uaddl, unsigned long, 0UL, ULONG_MAX, 0); +TEST (uaddl, unsigned long, 1UL, ULONG_MAX, 1); +TEST (uaddl, unsigned long, ULONG_MAX, ULONG_MAX, 1); + +TEST (uaddll, unsigned long long, 0ULL, 0ULL, 0); +TEST (uaddll, unsigned long long, 0ULL, ULLONG_MAX, 0); +TEST (uaddll, unsigned long long, 1ULL, ULLONG_MAX, 1); +TEST (uaddll, unsigned long long, ULLONG_MAX, ULLONG_MAX, 1); + +/* Signed int subtraction. */ +TEST (ssub, signed char, 0, 0, 0); +TEST (ssub, signed char, 0, SCHAR_MAX, 0); +TEST (ssub, signed char, 1, SCHAR_MAX, 0); +TEST (ssub, signed char, SCHAR_MAX, SCHAR_MAX, 0); +TEST (ssub, signed char, 0, SCHAR_MIN, 0); +TEST (ssub, signed char, -1, SCHAR_MIN, 0); + +TEST (ssub, short, 0, 0, 0); +TEST (ssub, short, 0, SHRT_MAX, 0); +TEST (ssub, short, 1, SHRT_MAX, 0); +TEST (ssub, short, SHRT_MAX, SHRT_MAX, 0); +TEST (ssub, short, 0, SHRT_MIN, 0); +TEST (ssub, short, -1, SHRT_MIN, 0); +TEST (ssub, short, SHRT_MIN, SHRT_MIN, 0); + +TEST (ssub, int, 0, 0, 0); +TEST (ssub, int, 0, INT_MAX, 0); +TEST (ssub, int, 1, INT_MAX, 0); +TEST (ssub, int, INT_MAX, INT_MAX, 0); +TEST (ssub, int, 0, INT_MIN, 1); +TEST (ssub, int, -1, INT_MIN, 0); +TEST (ssub, int, INT_MIN, INT_MIN, 0); + +/* Signed long subtraction. */ +TEST (ssubl, long, 0L, 0L, 0); +TEST (ssubl, long, 0L, LONG_MAX, 0); +TEST (ssubl, long, 1L, LONG_MAX, 0); +TEST (ssubl, long, LONG_MAX, LONG_MAX, 0); +TEST (ssubl, long, 0L, LONG_MIN, 1); +TEST (ssubl, long, -1L, LONG_MIN, 0); +TEST (ssubl, long, LONG_MIN, LONG_MIN, 0); + +/* Signed long long subtraction. */ +TEST (ssubll, long long, 0LL, 0LL, 0); +TEST (ssubll, long long, 0LL, LLONG_MAX, 0); +TEST (ssubll, long long, 1LL, LLONG_MAX, 0); +TEST (ssubll, long long, LLONG_MAX, LLONG_MAX, 0); +TEST (ssubll, long long, 0LL, LLONG_MIN, 1); +TEST (ssubll, long long, -1LL, LLONG_MIN, 0); +TEST (ssubll, long long, LLONG_MIN, LLONG_MIN, 0); + +/* Unsigned int subtraction. */ +TEST (usub, unsigned char, 0U, 0U, 0); +TEST (usub, unsigned char, 0U, UCHAR_MAX, 1); +TEST (usub, unsigned char, 1U, UCHAR_MAX, 1); +TEST (usub, unsigned char, UCHAR_MAX, UCHAR_MAX, 0); + +TEST (usub, unsigned short, 0U, 0U, 0); +TEST (usub, unsigned short, 0U, USHRT_MAX, 1); +TEST (usub, unsigned short, 1U, USHRT_MAX, 1); +TEST (usub, unsigned short, USHRT_MAX, USHRT_MAX, 0); + +TEST (usub, unsigned, 0U, 0U, 0); +TEST (usub, unsigned, 0U, UINT_MAX, 1); +TEST (usub, unsigned, 1U, UINT_MAX, 1); +TEST (usub, unsigned, UINT_MAX, UINT_MAX, 0); + +/* Unsigned long subtraction. */ +TEST (usubl, unsigned long, 0UL, 0UL, 0); +TEST (usubl, unsigned long, 0UL, ULONG_MAX, 1); +TEST (usubl, unsigned long, 1UL, ULONG_MAX, 1); +TEST (usubl, unsigned long, ULONG_MAX, ULONG_MAX, 0); + +/* Unsigned long long subtraction. */ +TEST (usubll, unsigned long long, 0ULL, 0ULL, 0); +TEST (usubll, unsigned long long, 0ULL, ULLONG_MAX, 1); +TEST (usubll, unsigned long long, 1ULL, ULLONG_MAX, 1); +TEST (usubll, unsigned long long, ULLONG_MAX, ULLONG_MAX, 0); diff --git a/gcc/testsuite/g++.dg/ext/builtin-arith-overflow-1.C b/gcc/testsuite/g++.dg/ext/builtin-arith-overflow-1.C new file mode 100644 index 00000000000..669eea2cbd2 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/builtin-arith-overflow-1.C @@ -0,0 +1,11 @@ +// { dg-do compile } + +enum A { B = 1, C = 2, D = __builtin_add_overflow_p (B, C, C) }; +int e[__builtin_add_overflow_p (B, C, C) + 1]; +template int foo (int); + +void +bar () +{ + foo <__builtin_add_overflow_p (B, C, C) + 1> (0); +} -- cgit v1.2.3 From 641338cc89496500ef2ea9d7fc1a0344d2a518c5 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 8 Jun 2016 19:31:55 +0000 Subject: /cp 2016-06-08 Paolo Carlini * decl.c (maybe_deduce_size_from_array_init): Use DECL_SOURCE_LOCATION in error_at. (layout_var_decl): Likewise. (check_array_initializer): Likewise. (check_initializer): Likewise. (duplicate_decls, check_elaborated_type_specifier): Tidy. /testsuite 2016-06-08 Paolo Carlini * g++.dg/init/array42.C: New. * g++.dg/init/array43.C: Likewise. * g++.dg/init/array44.C: Likewise. * g++.dg/init/array45.C: Likewise. * g++.dg/cpp0x/constexpr-ice10.C: Test column number too. * g++.dg/cpp0x/constexpr-incomplete1.C: Likewise. * g++.dg/cpp1y/auto-fn27.C: Likewise. * g++.dg/gomp/pr35751.C: Likewise. * g++.dg/init/array23.C: Likewise. * g++.dg/init/brace2.C: Likewise. * g++.dg/init/brace6.C: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237240 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++ gcc/cp/decl.c | 47 ++++++++++++++-------- gcc/testsuite/ChangeLog | 14 +++++++ gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C | 2 +- gcc/testsuite/g++.dg/cpp1y/auto-fn27.C | 2 +- gcc/testsuite/g++.dg/gomp/pr35751.C | 4 +- gcc/testsuite/g++.dg/init/array23.C | 2 +- gcc/testsuite/g++.dg/init/array42.C | 1 + gcc/testsuite/g++.dg/init/array43.C | 2 + gcc/testsuite/g++.dg/init/array44.C | 1 + gcc/testsuite/g++.dg/init/array45.C | 1 + gcc/testsuite/g++.dg/init/brace2.C | 2 +- gcc/testsuite/g++.dg/init/brace6.C | 4 +- 14 files changed, 67 insertions(+), 26 deletions(-) create mode 100644 gcc/testsuite/g++.dg/init/array42.C create mode 100644 gcc/testsuite/g++.dg/init/array43.C create mode 100644 gcc/testsuite/g++.dg/init/array44.C create mode 100644 gcc/testsuite/g++.dg/init/array45.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4162e20ded7..54c838bfeaa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2016-06-08 Paolo Carlini + + * decl.c (maybe_deduce_size_from_array_init): Use + DECL_SOURCE_LOCATION in error_at. + (layout_var_decl): Likewise. + (check_array_initializer): Likewise. + (check_initializer): Likewise. + (duplicate_decls, check_elaborated_type_specifier): Tidy. + 2016-06-08 Martin Sebor Jakub Jelinek diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3328e7158aa..ca36171d4f5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1393,7 +1393,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) { if (DECL_INITIAL (olddecl)) inform (DECL_SOURCE_LOCATION (olddecl), - "previous definition of %q+D was here", olddecl); + "previous definition of %qD was here", olddecl); else inform (DECL_SOURCE_LOCATION (olddecl), "previous declaration of %qD was here", olddecl); @@ -5266,13 +5266,16 @@ maybe_deduce_size_from_array_init (tree decl, tree init) do_default); if (failure == 1) { - error ("initializer fails to determine size of %qD", decl); + error_at (EXPR_LOC_OR_LOC (initializer, + DECL_SOURCE_LOCATION (decl)), + "initializer fails to determine size of %qD", decl); } else if (failure == 2) { if (do_default) { - error ("array size missing in %qD", decl); + error_at (DECL_SOURCE_LOCATION (decl), + "array size missing in %qD", decl); } /* If a `static' var's size isn't known, make it extern as well as static, so it does not get allocated. If it's not @@ -5283,7 +5286,8 @@ maybe_deduce_size_from_array_init (tree decl, tree init) } else if (failure == 3) { - error ("zero-size array %qD", decl); + error_at (DECL_SOURCE_LOCATION (decl), + "zero-size array %qD", decl); } } @@ -5322,7 +5326,8 @@ layout_var_decl (tree decl) /* An automatic variable with an incomplete type: that is an error. Don't talk about array types here, since we took care of that message in grokdeclarator. */ - error ("storage size of %qD isn%'t known", decl); + error_at (DECL_SOURCE_LOCATION (decl), + "storage size of %qD isn%'t known", decl); TREE_TYPE (decl) = error_mark_node; } #if 0 @@ -5345,7 +5350,8 @@ layout_var_decl (tree decl) constant_expression_warning (DECL_SIZE (decl)); else { - error ("storage size of %qD isn%'t constant", decl); + error_at (DECL_SOURCE_LOCATION (decl), + "storage size of %qD isn%'t constant", decl); TREE_TYPE (decl) = error_mark_node; } } @@ -5954,7 +5960,8 @@ check_array_initializer (tree decl, tree type, tree init) if (!COMPLETE_TYPE_P (complete_type (element_type))) { if (decl) - error ("elements of array %q#D have incomplete type", decl); + error_at (DECL_SOURCE_LOCATION (decl), + "elements of array %q#D have incomplete type", decl); else error ("elements of array %q#T have incomplete type", type); return true; @@ -6018,7 +6025,8 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) } else if (!COMPLETE_TYPE_P (type)) { - error ("%q#D has incomplete type", decl); + error_at (DECL_SOURCE_LOCATION (decl), + "%q#D has incomplete type", decl); TREE_TYPE (decl) = error_mark_node; return NULL_TREE; } @@ -6038,8 +6046,9 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) } else if (init_len != 1 && TREE_CODE (type) != COMPLEX_TYPE) { - error ("scalar object %qD requires one element in initializer", - decl); + error_at (EXPR_LOC_OR_LOC (init, DECL_SOURCE_LOCATION (decl)), + "scalar object %qD requires one element in " + "initializer", decl); TREE_TYPE (decl) = error_mark_node; return NULL_TREE; } @@ -6081,9 +6090,10 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) { /* Don't reshape if the class has constructors. */ if (cxx_dialect == cxx98) - error ("in C++98 %qD must be initialized by constructor, " - "not by %<{...}%>", - decl); + error_at (EXPR_LOC_OR_LOC (init, DECL_SOURCE_LOCATION (decl)), + "in C++98 %qD must be initialized by " + "constructor, not by %<{...}%>", + decl); } else if (VECTOR_TYPE_P (type) && TYPE_VECTOR_OPAQUE (type)) { @@ -6175,8 +6185,11 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) && DECL_INITIAL (decl) && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST && PAREN_STRING_LITERAL_P (DECL_INITIAL (decl))) - warning (0, "array %qD initialized by parenthesized string literal %qE", - decl, DECL_INITIAL (decl)); + warning_at (EXPR_LOC_OR_LOC (DECL_INITIAL (decl), + DECL_SOURCE_LOCATION (decl)), + 0, "array %qD initialized by parenthesized " + "string literal %qE", + decl, DECL_INITIAL (decl)); init = NULL; } } @@ -12528,14 +12541,14 @@ check_elaborated_type_specifier (enum tag_types tag_code, && tag_code != typename_type) { error ("%qT referred to as %qs", type, tag_name (tag_code)); - inform (input_location, "%q+T has a previous declaration here", type); + inform (location_of (type), "%qT has a previous declaration here", type); return error_mark_node; } else if (TREE_CODE (type) != ENUMERAL_TYPE && tag_code == enum_type) { error ("%qT referred to as enum", type); - inform (input_location, "%q+T has a previous declaration here", type); + inform (location_of (type), "%qT has a previous declaration here", type); return error_mark_node; } else if (!allow_template_p diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb704589deb..ab6395e9051 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2016-06-08 Paolo Carlini + + * g++.dg/init/array42.C: New. + * g++.dg/init/array43.C: Likewise. + * g++.dg/init/array44.C: Likewise. + * g++.dg/init/array45.C: Likewise. + * g++.dg/cpp0x/constexpr-ice10.C: Test column number too. + * g++.dg/cpp0x/constexpr-incomplete1.C: Likewise. + * g++.dg/cpp1y/auto-fn27.C: Likewise. + * g++.dg/gomp/pr35751.C: Likewise. + * g++.dg/init/array23.C: Likewise. + * g++.dg/init/brace2.C: Likewise. + * g++.dg/init/brace6.C: Likewise. + 2016-06-08 Martin Sebor Jakub Jelinek diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C index f6fc80cdc70..51612737847 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C @@ -4,5 +4,5 @@ struct A { constexpr A() {} - static constexpr A a[2] = {}; // { dg-error "incomplete" } + static constexpr A a[2] = {}; // { dg-error "22:elements of array 'constexpr const A A::a \\\[2\\\]' have incomplete type" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C index 514cca59c33..7b0d83e608d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C @@ -2,6 +2,6 @@ struct A { - static constexpr A a = 1; // { dg-error "incomplete" } + static constexpr A a = 1; // { dg-error "22:'constexpr const A A::a' has incomplete type" } constexpr A(int i) { } }; diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn27.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn27.C index c9291c2b8e4..b114df2fdd5 100644 --- a/gcc/testsuite/g++.dg/cpp1y/auto-fn27.C +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn27.C @@ -31,7 +31,7 @@ F::bar (const G &) { auto s = I; typedef decltype (s) L; - auto u =[&](L) { auto t = foo (J::K (), 0); }; // { dg-error "" } + auto u =[&](L) { auto t = foo (J::K (), 0); }; // { dg-error "25:'void t' has incomplete type" } } struct B { typedef int G; diff --git a/gcc/testsuite/g++.dg/gomp/pr35751.C b/gcc/testsuite/g++.dg/gomp/pr35751.C index 0b6cded5929..a8acce05f51 100644 --- a/gcc/testsuite/g++.dg/gomp/pr35751.C +++ b/gcc/testsuite/g++.dg/gomp/pr35751.C @@ -5,8 +5,8 @@ void foo (int i) { - extern int a[i]; // { dg-error "storage size of" } - static int b[i]; // { dg-error "storage size of" } + extern int a[i]; // { dg-error "14:storage size of" } + static int b[i]; // { dg-error "14:storage size of" } #pragma omp parallel { diff --git a/gcc/testsuite/g++.dg/init/array23.C b/gcc/testsuite/g++.dg/init/array23.C index 80ffb0a98cc..fbcd39e2c3a 100644 --- a/gcc/testsuite/g++.dg/init/array23.C +++ b/gcc/testsuite/g++.dg/init/array23.C @@ -3,4 +3,4 @@ // array struct A {A();int A::* t;}; -A x[]; // { dg-error "size" } +A x[]; // { dg-error "3:array size missing" } diff --git a/gcc/testsuite/g++.dg/init/array42.C b/gcc/testsuite/g++.dg/init/array42.C new file mode 100644 index 00000000000..d16a9ea11ce --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array42.C @@ -0,0 +1 @@ +char a[] = ("abc"); // { dg-warning "6:array 'a' initialized by parenthesized string literal" } diff --git a/gcc/testsuite/g++.dg/init/array43.C b/gcc/testsuite/g++.dg/init/array43.C new file mode 100644 index 00000000000..37ef2411518 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array43.C @@ -0,0 +1,2 @@ +int a[] = 0; // { dg-error "5:initializer fails to determine size" } +// { dg-error "11:array must be initialized" "" { target *-*-* } 1 } diff --git a/gcc/testsuite/g++.dg/init/array44.C b/gcc/testsuite/g++.dg/init/array44.C new file mode 100644 index 00000000000..5643c81f218 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array44.C @@ -0,0 +1 @@ +int a[] = { }; // { dg-error "5:zero-size array" } diff --git a/gcc/testsuite/g++.dg/init/array45.C b/gcc/testsuite/g++.dg/init/array45.C new file mode 100644 index 00000000000..ee4451df5ff --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array45.C @@ -0,0 +1 @@ +int a[]; // { dg-error "5:storage size" } diff --git a/gcc/testsuite/g++.dg/init/brace2.C b/gcc/testsuite/g++.dg/init/brace2.C index 50dc4813954..e6307525fbf 100644 --- a/gcc/testsuite/g++.dg/init/brace2.C +++ b/gcc/testsuite/g++.dg/init/brace2.C @@ -3,6 +3,6 @@ int x = { 2 }; const char * y = { "hello" }; int a = 2; -int b = { 2,3 }; // { dg-error "requires one element in initializer" } +int b = { 2,3 }; // { dg-error "5:scalar object 'b' requires one element in initializer" } int c = { { 2 } } ; // { dg-error "braces around scalar initializer" } int d = {}; // { dg-error "initializer" "" { target { ! c++11 } } } diff --git a/gcc/testsuite/g++.dg/init/brace6.C b/gcc/testsuite/g++.dg/init/brace6.C index 0fa818c80c0..f8452351d12 100644 --- a/gcc/testsuite/g++.dg/init/brace6.C +++ b/gcc/testsuite/g++.dg/init/brace6.C @@ -17,8 +17,8 @@ struct D { int c; }; int main() { int i = { 1 }; - int j = { 1, 2 }; /* { dg-error "requires one element" } */ - A a = { 6 }; /* { dg-error "initialize" "" { target { ! c++11 } } } */ + int j = { 1, 2 }; /* { dg-error "8:scalar object 'j' requires one element" } */ + A a = { 6 }; /* { dg-error "6:in C\\+\\+98 'a' must be initialized" "" { target { ! c++11 } } } */ B b = { 6 }; /* { dg-error "" } */ C c = { 6 }; /* { dg-error "too many initializers" } */ D d = { 6 }; -- cgit v1.2.3 From 56d44cc8c6cf0ae7850350275f7fa964d2ac6ddf Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 9 Jun 2016 00:17:08 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237248 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 67def45676b..5b26204f4eb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160608 +20160609 -- cgit v1.2.3 From 9d81f66dd954c6cdfb2d8bff2ee6834e22d83658 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 9 Jun 2016 08:45:22 +0000 Subject: [AArch64] Model CSEL instruction in Cortex-A57 scheduling model * config/arm/cortex-a57.md (cortex_a57_alu): Handle csel type. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237249 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/arm/cortex-a57.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 89c9f766cce..da572a41a7d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-09 Kyrylo Tkachov + + * config/arm/cortex-a57.md (cortex_a57_alu): + Handle csel type. + 2016-06-08 Martin Sebor Jakub Jelinek diff --git a/gcc/config/arm/cortex-a57.md b/gcc/config/arm/cortex-a57.md index 37912db4643..c8cf80f4ba7 100644 --- a/gcc/config/arm/cortex-a57.md +++ b/gcc/config/arm/cortex-a57.md @@ -297,7 +297,7 @@ (eq_attr "type" "alu_imm,alus_imm,logic_imm,logics_imm,\ alu_sreg,alus_sreg,logic_reg,logics_reg,\ adc_imm,adcs_imm,adc_reg,adcs_reg,\ - adr,bfm,clz,rbit,rev,alu_dsp_reg,\ + adr,bfm,clz,csel,rbit,rev,alu_dsp_reg,\ rotate_imm,shift_imm,shift_reg,\ mov_imm,mov_reg,\ mvn_imm,mvn_reg,\ -- cgit v1.2.3 From 8cddb6dfad2968ea73ad19c52647c9e17d2ae374 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 9 Jun 2016 08:48:10 +0000 Subject: [RTL ifcvt] Print name of noce trasform that succeeded in dump file * ifcvt.c (struct noce_if_info): Add transform_name field. (noce_try_move): Set if_info->transform_name to the function name. (noce_try_ifelse_collapse): Likewise. (noce_try_store_flag): Likewise. (noce_try_inverse_constants): Likewise. (noce_try_store_flag_constants): Likewise. (noce_try_addcc): Likewise. (noce_try_store_flag_mask): Likewise. (noce_try_cmove): Likewise. (noce_try_cmove_arith): Likewise. (noce_try_minmax): Likewise. (noce_try_abs): Likewise. (noce_try_sign_mask): Likewise. (noce_try_bitop): Likewise. (noce_convert_multiple_sets): Likewise. (noce_process_if_block): Print if_info->transform_name to dump_file if transformation succeeded. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237250 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 20 ++++++++++++++++++++ gcc/ifcvt.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index da572a41a7d..4c1cab324e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2016-06-09 Kyrylo Tkachov + + * ifcvt.c (struct noce_if_info): Add transform_name field. + (noce_try_move): Set if_info->transform_name to the function name. + (noce_try_ifelse_collapse): Likewise. + (noce_try_store_flag): Likewise. + (noce_try_inverse_constants): Likewise. + (noce_try_store_flag_constants): Likewise. + (noce_try_addcc): Likewise. + (noce_try_store_flag_mask): Likewise. + (noce_try_cmove): Likewise. + (noce_try_cmove_arith): Likewise. + (noce_try_minmax): Likewise. + (noce_try_abs): Likewise. + (noce_try_sign_mask): Likewise. + (noce_try_bitop): Likewise. + (noce_convert_multiple_sets): Likewise. + (noce_process_if_block): Print if_info->transform_name to + dump_file if transformation succeeded. + 2016-06-09 Kyrylo Tkachov * config/arm/cortex-a57.md (cortex_a57_alu): diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 05fac71409d..4a277db7dcc 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -813,6 +813,10 @@ struct noce_if_info /* Estimated cost of the particular branch instruction. */ unsigned int branch_cost; + + /* The name of the noce transform that succeeded in if-converting + this structure. Used for debugging. */ + const char *transform_name; }; static rtx noce_emit_store_flag (struct noce_if_info *, rtx, int, int); @@ -1116,6 +1120,7 @@ noce_try_move (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); } + if_info->transform_name = "noce_try_move"; return TRUE; } return FALSE; @@ -1148,6 +1153,8 @@ noce_try_ifelse_collapse (struct noce_if_info * if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + + if_info->transform_name = "noce_try_ifelse_collapse"; return TRUE; } @@ -1195,6 +1202,7 @@ noce_try_store_flag (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_store_flag"; return TRUE; } else @@ -1273,6 +1281,7 @@ noce_try_inverse_constants (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_inverse_constants"; return true; } @@ -1493,6 +1502,8 @@ noce_try_store_flag_constants (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_store_flag_constants"; + return TRUE; } @@ -1545,6 +1556,8 @@ noce_try_addcc (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_addcc"; + return TRUE; } end_sequence (); @@ -1585,6 +1598,7 @@ noce_try_addcc (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_addcc"; return TRUE; } end_sequence (); @@ -1649,6 +1663,8 @@ noce_try_store_flag_mask (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_store_flag_mask"; + return TRUE; } @@ -1799,6 +1815,8 @@ noce_try_cmove (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_cmove"; + return TRUE; } /* If both a and b are constants try a last-ditch transformation: @@ -1852,6 +1870,7 @@ noce_try_cmove (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_cmove"; return TRUE; } else @@ -2305,6 +2324,7 @@ noce_try_cmove_arith (struct noce_if_info *if_info) emit_insn_before_setloc (ifcvt_seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_cmove_arith"; return TRUE; end_seq_and_fail: @@ -2561,6 +2581,7 @@ noce_try_minmax (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); if_info->cond = cond; if_info->cond_earliest = earliest; + if_info->transform_name = "noce_try_minmax"; return TRUE; } @@ -2727,6 +2748,7 @@ noce_try_abs (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); if_info->cond = cond; if_info->cond_earliest = earliest; + if_info->transform_name = "noce_try_abs"; return TRUE; } @@ -2808,6 +2830,8 @@ noce_try_sign_mask (struct noce_if_info *if_info) return FALSE; emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); + if_info->transform_name = "noce_try_sign_mask"; + return TRUE; } @@ -2913,6 +2937,7 @@ noce_try_bitop (struct noce_if_info *if_info) emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a)); } + if_info->transform_name = "noce_try_bitop"; return TRUE; } @@ -3276,6 +3301,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) } num_updated_if_blocks++; + if_info->transform_name = "noce_convert_multiple_sets"; return TRUE; } @@ -3372,7 +3398,12 @@ noce_process_if_block (struct noce_if_info *if_info) && bb_ok_for_noce_convert_multiple_sets (then_bb, if_info)) { if (noce_convert_multiple_sets (if_info)) - return TRUE; + { + if (dump_file && if_info->transform_name) + fprintf (dump_file, "if-conversion succeeded through %s\n", + if_info->transform_name); + return TRUE; + } } if (! bb_valid_for_noce_process_p (then_bb, cond, &if_info->then_cost, @@ -3571,6 +3602,9 @@ noce_process_if_block (struct noce_if_info *if_info) return FALSE; success: + if (dump_file && if_info->transform_name) + fprintf (dump_file, "if-conversion succeeded through %s\n", + if_info->transform_name); /* If we used a temporary, fix it up now. */ if (orig_x != x) -- cgit v1.2.3 From 3376502cae53cbedd09da6f0511d58fe1d18b7d1 Mon Sep 17 00:00:00 2001 From: Stefan Bruens Date: Thu, 9 Jun 2016 08:59:23 +0000 Subject: Update documentation for ARM architecture 2016-06-09 Stefan Bruens * doc/invoke.texi (ARM Options): Use lexicographical ordering. Correct usage of @samp vs @option, add @samp where appropriate. Add -march={armv6k,armv6z,arm6zk}, remove -march=ep9312. Add armv6s-m and document it, as it is no official ARM name. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237251 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/doc/invoke.texi | 21 ++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c1cab324e5..ee271d44ab8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-09 Stefan Bruens + + * doc/invoke.texi (ARM Options): Use lexicographical ordering. + Correct usage of @samp vs @option, add @samp where appropriate. + Add -march={armv6k,armv6z,arm6zk}, remove -march=ep9312. + Add armv6s-m and document it, as it is no official ARM name. + 2016-06-09 Kyrylo Tkachov * ifcvt.c (struct noce_if_info): Add transform_name field. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2e92dcb44ca..aa11209895c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -14069,16 +14069,23 @@ name to determine what kind of instructions it can emit when generating assembly code. This option can be used in conjunction with or instead of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, -@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te}, -@samp{armv6}, @samp{armv6j}, -@samp{armv6t2}, @samp{armv6z}, @samp{armv6kz}, @samp{armv6-m}, -@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m}, +@samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te}, +@samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k}, +@samp{armv6kz}, @samp{armv6s-m}, +@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, +@samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m}, @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a}, -@samp{armv8.1-a+crc}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. +@samp{armv8.1-a+crc}, @samp{iwmmxt}, @samp{iwmmxt2}. -Architecture revisions older than @option{armv4t} are deprecated. +Architecture revisions older than @samp{armv4t} are deprecated. -@option{-march=armv7ve} is the armv7-a architecture with virtualization +@option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for +the (now mandatory) SVC instruction. + +@option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards +compatibility. + +@option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization extensions. @option{-march=armv8-a+crc} enables code generation for the ARMv8-A -- cgit v1.2.3 From 544dee3f0527bd302bdcd4f6e37dfc931a34a1e1 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 9 Jun 2016 10:16:19 +0000 Subject: PR c/65471 * gcc.dg/c11-generic-3.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237252 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/c11-generic-3.c | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/c11-generic-3.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab6395e9051..844f0f5e0c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-09 Marek Polacek + + PR c/65471 + * gcc.dg/c11-generic-3.c: New test. + 2016-06-08 Paolo Carlini * g++.dg/init/array42.C: New. diff --git a/gcc/testsuite/gcc.dg/c11-generic-3.c b/gcc/testsuite/gcc.dg/c11-generic-3.c new file mode 100644 index 00000000000..8bac21ed31f --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-generic-3.c @@ -0,0 +1,10 @@ +/* Test C11 _Generic. Test we follow the resolution of DR#423. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +char const *a = _Generic ("bla", char *: ""); +char const *b = _Generic ("bla", char[4]: ""); /* { dg-error "not compatible with any association" } */ +char const *c = _Generic ((int const) { 0 }, int: ""); +char const *d = _Generic ((int const) { 0 }, int const: ""); /* { dg-error "not compatible with any association" } */ +char const *e = _Generic (+(int const) { 0 }, int: ""); +char const *f = _Generic (+(int const) { 0 }, int const: ""); /* { dg-error "not compatible with any association" } */ -- cgit v1.2.3 From a684d4bdf9c9a25f47f29acc6930682463264734 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 9 Jun 2016 11:26:32 +0000 Subject: Introduce filtering for edge_predictions. * predict.c (filter_predictions): New function. (remove_predictions_associated_with_edge): Use the filter function. (equal_edge_p): New function. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237253 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/predict.c | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee271d44ab8..3484047c15c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-09 Martin Liska + + * predict.c (filter_predictions): New function. + (remove_predictions_associated_with_edge): Use the filter + function. + (equal_edge_p): New function. + 2016-06-09 Stefan Bruens * doc/invoke.texi (ARM Options): Use lexicographical ordering. diff --git a/gcc/predict.c b/gcc/predict.c index 837c2f3274f..f00428fb8ae 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -609,16 +609,16 @@ gimple_predict_edge (edge e, enum br_predictor predictor, int probability) } } -/* Remove all predictions on given basic block that are attached - to edge E. */ +/* Filter edge predictions PREDS by a function FILTER. DATA are passed + to the filter function. */ + void -remove_predictions_associated_with_edge (edge e) +filter_predictions (edge_prediction **preds, + bool (*filter) (edge_prediction *, void *), void *data) { if (!bb_predictions) return; - edge_prediction **preds = bb_predictions->get (e->src); - if (preds) { struct edge_prediction **prediction = preds; @@ -626,18 +626,39 @@ remove_predictions_associated_with_edge (edge e) while (*prediction) { - if ((*prediction)->ep_edge == e) + if ((*filter) (*prediction, data)) + prediction = &((*prediction)->ep_next); + else { next = (*prediction)->ep_next; free (*prediction); *prediction = next; } - else - prediction = &((*prediction)->ep_next); } } } +/* Filter function predicate that returns true for a edge predicate P + if its edge is equal to DATA. */ + +bool +equal_edge_p (edge_prediction *p, void *data) +{ + return p->ep_edge == (edge)data; +} + +/* Remove all predictions on given basic block that are attached + to edge E. */ +void +remove_predictions_associated_with_edge (edge e) +{ + if (!bb_predictions) + return; + + edge_prediction **preds = bb_predictions->get (e->src); + filter_predictions (preds, equal_edge_p, e); +} + /* Clears the list of predictions stored for BB. */ static void -- cgit v1.2.3 From e33c7bf39a31462bd730b8f4c77e196313755704 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 9 Jun 2016 11:36:22 +0000 Subject: 2016-06-09 Richard Biener PR tree-optimization/71462 * tree-ssa-loop-manip.c (find_uses_to_rename): Guard against removed blocks. * gcc.dg/torture/pr71462.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237254 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr71462.c | 28 ++++++++++++++++++++++++++++ gcc/tree-ssa-loop-manip.c | 7 +++++-- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr71462.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3484047c15c..134f2249396 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-09 Richard Biener + + PR tree-optimization/71462 + * tree-ssa-loop-manip.c (find_uses_to_rename): Guard against + removed blocks. + 2016-06-09 Martin Liska * predict.c (filter_predictions): New function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 844f0f5e0c7..8ee01b77e85 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-09 Richard Biener + + PR tree-optimization/71462 + * gcc.dg/torture/pr71462.c: New testcase. + 2016-06-09 Marek Polacek PR c/65471 diff --git a/gcc/testsuite/gcc.dg/torture/pr71462.c b/gcc/testsuite/gcc.dg/torture/pr71462.c new file mode 100644 index 00000000000..390b88673e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr71462.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +short a; +long b; +void fn1() +{ + int c = a = 1; + for (; a; a++) + { + for (; 9 <= 8;) + for (;;) { + a = 20; + for (; a <= 35; a++) + ; +line:; + } + if ((c += 264487869) == 9) + { + unsigned *d = 0; + for (; b;) + d = (unsigned *)&c; + if (d) + for (;;) + ; + } + } + goto line; +} diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 77c5eb49f14..e87d29055d9 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -472,8 +472,11 @@ find_uses_to_rename (bitmap changed_bbs, bitmap *use_blocks, bitmap need_phis, if (changed_bbs) EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi) - find_uses_to_rename_bb (BASIC_BLOCK_FOR_FN (cfun, index), use_blocks, - need_phis, use_flags); + { + bb = BASIC_BLOCK_FOR_FN (cfun, index); + if (bb) + find_uses_to_rename_bb (bb, use_blocks, need_phis, use_flags); + } else FOR_EACH_BB_FN (bb, cfun) find_uses_to_rename_bb (bb, use_blocks, need_phis, use_flags); -- cgit v1.2.3 From d31a93debaec62ac72d311408e3c44920bb32e93 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 9 Jun 2016 11:37:41 +0000 Subject: Add edge predictions pruning * analyze_brprob.py: Cover new dump output format. * predict.c (dump_prediction): Add new argument. (enum predictor_reason): New enum. (struct predictor_hash): New struct. (predictor_hash::hash): New function. (predictor_hash::equal): Likewise. (not_removed_prediction_p): New function. (prune_predictions_for_bb): Likewise. (combine_predictions_for_bb): Prune predictions. * g++.dg/predict-loop-exit-1.C: Scan for a new dump format. * g++.dg/predict-loop-exit-2.C: Likewise. * g++.dg/predict-loop-exit-3.C: Likewise. * gcc.dg/predict-1.c: Likewise. * gcc.dg/predict-2.c: Likewise. * gcc.dg/predict-3.c: Likewise. * gcc.dg/predict-4.c: Likewise. * gcc.dg/predict-5.c: Likewise. * gcc.dg/predict-6.c: Likewise. * gcc.dg/predict-7.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237255 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 + contrib/analyze_brprob.py | 10 +- gcc/ChangeLog | 11 ++ gcc/predict.c | 184 +++++++++++++++++++++++++---- gcc/testsuite/ChangeLog | 13 ++ gcc/testsuite/g++.dg/predict-loop-exit-1.C | 4 +- gcc/testsuite/g++.dg/predict-loop-exit-2.C | 4 +- gcc/testsuite/g++.dg/predict-loop-exit-3.C | 4 +- gcc/testsuite/gcc.dg/predict-1.c | 2 +- gcc/testsuite/gcc.dg/predict-2.c | 2 +- gcc/testsuite/gcc.dg/predict-3.c | 2 +- gcc/testsuite/gcc.dg/predict-4.c | 2 +- gcc/testsuite/gcc.dg/predict-5.c | 2 +- gcc/testsuite/gcc.dg/predict-6.c | 2 +- gcc/testsuite/gcc.dg/predict-7.c | 2 +- 15 files changed, 210 insertions(+), 38 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index edb1df7b311..6c80c1edbe3 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-06-09 Martin Liska + + * analyze_brprob.py: Cover new dump output format. + 2016-06-07 Rainer Orth * update-copyright.py (LibMudflapFilter): Remove. diff --git a/contrib/analyze_brprob.py b/contrib/analyze_brprob.py index 36371ff26ff..9416eed3b44 100755 --- a/contrib/analyze_brprob.py +++ b/contrib/analyze_brprob.py @@ -122,14 +122,14 @@ if len(sys.argv) != 2: exit(1) profile = Profile(sys.argv[1]) -r = re.compile(' (.*) heuristics: (.*)%.*exec ([0-9]*) hit ([0-9]*)') +r = re.compile(' (.*) heuristics( of edge [0-9]*->[0-9]*)?( \\(.*\\))?: (.*)%.*exec ([0-9]*) hit ([0-9]*)') for l in open(profile.filename).readlines(): m = r.match(l) - if m != None: + if m != None and m.group(3) == None: name = m.group(1) - prediction = float(m.group(2)) - count = int(m.group(3)) - hits = int(m.group(4)) + prediction = float(m.group(4)) + count = int(m.group(5)) + hits = int(m.group(6)) profile.add(name, prediction, count, hits) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 134f2249396..9c7a0b42c7d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -4,6 +4,17 @@ * tree-ssa-loop-manip.c (find_uses_to_rename): Guard against removed blocks. +2016-06-09 Martin Liska + + * predict.c (dump_prediction): Add new argument. + (enum predictor_reason): New enum. + (struct predictor_hash): New struct. + (predictor_hash::hash): New function. + (predictor_hash::equal): Likewise. + (not_removed_prediction_p): New function. + (prune_predictions_for_bb): Likewise. + (combine_predictions_for_bb): Prune predictions. + 2016-06-09 Martin Liska * predict.c (filter_predictions): New function. diff --git a/gcc/predict.c b/gcc/predict.c index f00428fb8ae..0fa8c5b09e3 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -55,13 +55,29 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-loop.h" #include "tree-scalar-evolution.h" +/* Enum with reasons why a predictor is ignored. */ + +enum predictor_reason +{ + NONE, + IGNORED, + SINGLE_EDGE_DUPLICATE, + EDGE_PAIR_DUPLICATE +}; + +/* String messages for the aforementioned enum. */ + +static const char *reason_messages[] = {"", " (ignored)", + " (single edge duplicate)", " (edge pair duplicate)"}; + /* real constants: 0, 1, 1-1/REG_BR_PROB_BASE, REG_BR_PROB_BASE, 1/REG_BR_PROB_BASE, 0.5, BB_FREQ_MAX. */ static sreal real_almost_one, real_br_prob_base, real_inv_br_prob_base, real_one_half, real_bb_freq_max; static void combine_predictions_for_insn (rtx_insn *, basic_block); -static void dump_prediction (FILE *, enum br_predictor, int, basic_block, int); +static void dump_prediction (FILE *, enum br_predictor, int, basic_block, + enum predictor_reason, edge); static void predict_paths_leading_to (basic_block, enum br_predictor, enum prediction); static void predict_paths_leading_to_edge (edge, enum br_predictor, enum prediction); static bool can_predict_insn_p (const rtx_insn *); @@ -723,21 +739,31 @@ invert_br_probabilities (rtx insn) static void dump_prediction (FILE *file, enum br_predictor predictor, int probability, - basic_block bb, int used) + basic_block bb, enum predictor_reason reason = NONE, + edge ep_edge = NULL) { - edge e; + edge e = ep_edge; edge_iterator ei; if (!file) return; - FOR_EACH_EDGE (e, ei, bb->succs) - if (! (e->flags & EDGE_FALLTHRU)) - break; + if (e == NULL) + FOR_EACH_EDGE (e, ei, bb->succs) + if (! (e->flags & EDGE_FALLTHRU)) + break; + + char edge_info_str[128]; + if (ep_edge) + sprintf (edge_info_str, " of edge %d->%d", ep_edge->src->index, + ep_edge->dest->index); + else + edge_info_str[0] = '\0'; - fprintf (file, " %s heuristics%s: %.1f%%", + fprintf (file, " %s heuristics%s%s: %.1f%%", predictor_info[predictor].name, - used ? "" : " (ignored)", probability * 100.0 / REG_BR_PROB_BASE); + edge_info_str, reason_messages[reason], + probability * 100.0 / REG_BR_PROB_BASE); if (bb->count) { @@ -834,18 +860,18 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) if (!found) dump_prediction (dump_file, PRED_NO_PREDICTION, - combined_probability, bb, true); + combined_probability, bb); else { dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, - bb, !first_match); + bb, !first_match ? NONE : IGNORED); dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, - bb, first_match); + bb, first_match ? NONE: IGNORED); } if (first_match) combined_probability = best_probability; - dump_prediction (dump_file, PRED_COMBINED, combined_probability, bb, true); + dump_prediction (dump_file, PRED_COMBINED, combined_probability, bb); while (*pnote) { @@ -856,7 +882,8 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) int probability = INTVAL (XEXP (XEXP (*pnote, 0), 1)); dump_prediction (dump_file, predictor, probability, bb, - !first_match || best_predictor == predictor); + (!first_match || best_predictor == predictor) + ? NONE : IGNORED); *pnote = XEXP (*pnote, 1); } else @@ -887,6 +914,121 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) single_succ_edge (bb)->probability = REG_BR_PROB_BASE; } +/* Edge prediction hash traits. */ + +struct predictor_hash: pointer_hash +{ + + static inline hashval_t hash (const edge_prediction *); + static inline bool equal (const edge_prediction *, const edge_prediction *); +}; + +/* Calculate hash value of an edge prediction P based on predictor and + normalized probability. */ + +inline hashval_t +predictor_hash::hash (const edge_prediction *p) +{ + inchash::hash hstate; + hstate.add_int (p->ep_predictor); + + int prob = p->ep_probability; + if (prob > REG_BR_PROB_BASE / 2) + prob = REG_BR_PROB_BASE - prob; + + hstate.add_int (prob); + + return hstate.end (); +} + +/* Return true whether edge predictions P1 and P2 use the same predictor and + have equal (or opposed probability). */ + +inline bool +predictor_hash::equal (const edge_prediction *p1, const edge_prediction *p2) +{ + return (p1->ep_predictor == p2->ep_predictor + && (p1->ep_probability == p2->ep_probability + || p1->ep_probability == REG_BR_PROB_BASE - p2->ep_probability)); +} + +struct predictor_hash_traits: predictor_hash, + typed_noop_remove {}; + +/* Return true if edge prediction P is not in DATA hash set. */ + +static bool +not_removed_prediction_p (edge_prediction *p, void *data) +{ + hash_set *remove = (hash_set *) data; + return !remove->contains (p); +} + +/* Prune predictions for a basic block BB. Currently we do following + clean-up steps: + + 1) remove duplicate prediction that is guessed with the same probability + (different than 1/2) to both edge + 2) remove duplicates for a prediction that belongs with the same probability + to a single edge + + */ + +static void +prune_predictions_for_bb (basic_block bb) +{ + edge_prediction **preds = bb_predictions->get (bb); + + if (preds) + { + hash_table s (13); + hash_set remove; + + /* Step 1: identify predictors that should be removed. */ + for (edge_prediction *pred = *preds; pred; pred = pred->ep_next) + { + edge_prediction *existing = s.find (pred); + if (existing) + { + if (pred->ep_edge == existing->ep_edge + && pred->ep_probability == existing->ep_probability) + { + /* Remove a duplicate predictor. */ + dump_prediction (dump_file, pred->ep_predictor, + pred->ep_probability, bb, + SINGLE_EDGE_DUPLICATE, pred->ep_edge); + + remove.add (pred); + } + else if (pred->ep_edge != existing->ep_edge + && pred->ep_probability == existing->ep_probability + && pred->ep_probability != REG_BR_PROB_BASE / 2) + { + /* Remove both predictors as they predict the same + for both edges. */ + dump_prediction (dump_file, existing->ep_predictor, + pred->ep_probability, bb, + EDGE_PAIR_DUPLICATE, + existing->ep_edge); + dump_prediction (dump_file, pred->ep_predictor, + pred->ep_probability, bb, + EDGE_PAIR_DUPLICATE, + pred->ep_edge); + + remove.add (existing); + remove.add (pred); + } + } + + edge_prediction **slot2 = s.find_slot (pred, INSERT); + *slot2 = pred; + } + + /* Step 2: Remove predictors. */ + filter_predictions (preds, not_removed_prediction_p, &remove); + } +} + /* Combine predictions into single probability and store them into CFG. Remove now useless prediction entries. If DRY_RUN is set, only produce dumps and do not modify profile. */ @@ -935,7 +1077,10 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) if (dump_file) fprintf (dump_file, "Predictions for bb %i\n", bb->index); + prune_predictions_for_bb (bb); + edge_prediction **preds = bb_predictions->get (bb); + if (preds) { /* We implement "first match" heuristics and use probability guessed @@ -1001,18 +1146,18 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) first_match = true; if (!found) - dump_prediction (dump_file, PRED_NO_PREDICTION, combined_probability, bb, true); + dump_prediction (dump_file, PRED_NO_PREDICTION, combined_probability, bb); else { dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, bb, - !first_match); + !first_match ? NONE : IGNORED); dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, bb, - first_match); + first_match ? NONE : IGNORED); } if (first_match) combined_probability = best_probability; - dump_prediction (dump_file, PRED_COMBINED, combined_probability, bb, true); + dump_prediction (dump_file, PRED_COMBINED, combined_probability, bb); if (preds) { @@ -1021,10 +1166,9 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) enum br_predictor predictor = pred->ep_predictor; int probability = pred->ep_probability; - if (pred->ep_edge != EDGE_SUCC (bb, 0)) - probability = REG_BR_PROB_BASE - probability; dump_prediction (dump_file, predictor, probability, bb, - !first_match || best_predictor == predictor); + (!first_match || best_predictor == predictor) + ? NONE : IGNORED, pred->ep_edge); } } clear_bb_predictions (bb); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8ee01b77e85..155dc1144fe 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2016-06-09 Martin Liska + + * g++.dg/predict-loop-exit-1.C: Scan for a new dump format. + * g++.dg/predict-loop-exit-2.C: Likewise. + * g++.dg/predict-loop-exit-3.C: Likewise. + * gcc.dg/predict-1.c: Likewise. + * gcc.dg/predict-2.c: Likewise. + * gcc.dg/predict-3.c: Likewise. + * gcc.dg/predict-4.c: Likewise. + * gcc.dg/predict-5.c: Likewise. + * gcc.dg/predict-6.c: Likewise. + * gcc.dg/predict-7.c: Likewise. + 2016-06-09 Richard Biener PR tree-optimization/71462 diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-1.C b/gcc/testsuite/g++.dg/predict-loop-exit-1.C index 357397f512b..88262eb9d00 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-1.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-1.C @@ -9,5 +9,5 @@ void test() { return; } -/* { dg-final { scan-tree-dump-times "extra loop exit heuristics:" 2 "profile_estimate"} } */ -/* { dg-final { scan-tree-dump-times "loop exit heuristics:" 3 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "extra loop exit heuristics of edge\[^:\]*:" 2 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop exit heuristics of edge\[^:\]*:" 3 "profile_estimate"} } */ diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-2.C b/gcc/testsuite/g++.dg/predict-loop-exit-2.C index 172fab120c8..15e9866d897 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-2.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-2.C @@ -9,5 +9,5 @@ void test() { return; } -/* { dg-final { scan-tree-dump-times "extra loop exit heuristics:" 1 "profile_estimate"} } */ -/* { dg-final { scan-tree-dump-times "loop exit heuristics:" 2 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "extra loop exit heuristics of edge\[^:\]*:" 1 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop exit heuristics of edge\[^:\]*:" 2 "profile_estimate"} } */ diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-3.C b/gcc/testsuite/g++.dg/predict-loop-exit-3.C index e6ceec80159..61af84b6f56 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-3.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-3.C @@ -9,5 +9,5 @@ void test() { return; } -/* { dg-final { scan-tree-dump-times "extra loop exit heuristics:" 2 "profile_estimate"} } */ -/* { dg-final { scan-tree-dump-times "loop exit heuristics:" 3 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "extra loop exit heuristics of edge\[^:\]*:" 2 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop exit heuristics of edge\[^:\]*:" 3 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-1.c b/gcc/testsuite/gcc.dg/predict-1.c index 94f6b0190a1..d0924f27bdf 100644 --- a/gcc/testsuite/gcc.dg/predict-1.c +++ b/gcc/testsuite/gcc.dg/predict-1.c @@ -23,4 +23,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics: 2.0%" 5 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 2.0%" 5 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-2.c b/gcc/testsuite/gcc.dg/predict-2.c index f2fc49ddc47..30116864d5d 100644 --- a/gcc/testsuite/gcc.dg/predict-2.c +++ b/gcc/testsuite/gcc.dg/predict-2.c @@ -23,4 +23,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-not "loop iv compare heuristics" "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-not "loop iv compare heuristics of edge\[^:\]*:" "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-3.c b/gcc/testsuite/gcc.dg/predict-3.c index 08db59a559f..663f1411025 100644 --- a/gcc/testsuite/gcc.dg/predict-3.c +++ b/gcc/testsuite/gcc.dg/predict-3.c @@ -25,4 +25,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics: 98.0%" 3 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 98.0%" 3 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-4.c b/gcc/testsuite/gcc.dg/predict-4.c index 3e7fb7488a9..5779da36ee9 100644 --- a/gcc/testsuite/gcc.dg/predict-4.c +++ b/gcc/testsuite/gcc.dg/predict-4.c @@ -15,4 +15,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump "loop iv compare heuristics: 50.0%" "profile_estimate"} } */ +/* { dg-final { scan-tree-dump "loop iv compare heuristics of edge\[^:\]*: 50.0%" "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-5.c b/gcc/testsuite/gcc.dg/predict-5.c index 32178a8ea5f..56ada306b97 100644 --- a/gcc/testsuite/gcc.dg/predict-5.c +++ b/gcc/testsuite/gcc.dg/predict-5.c @@ -21,4 +21,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics: 98.0%" 4 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 98.0%" 4 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-6.c b/gcc/testsuite/gcc.dg/predict-6.c index 16ad16fdb25..9ed41ed0d92 100644 --- a/gcc/testsuite/gcc.dg/predict-6.c +++ b/gcc/testsuite/gcc.dg/predict-6.c @@ -21,4 +21,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics: 2.0%" 4 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 2.0%" 4 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-7.c b/gcc/testsuite/gcc.dg/predict-7.c index a0ea37bdfa8..fe34ca5f744 100644 --- a/gcc/testsuite/gcc.dg/predict-7.c +++ b/gcc/testsuite/gcc.dg/predict-7.c @@ -13,4 +13,4 @@ void foo (int base) bar (i); } -/* { dg-final { scan-tree-dump-times "loop branch heuristics" 0 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "loop branch heuristics of edge\[^:\]*" 0 "profile_estimate"} } */ -- cgit v1.2.3 From 43d8a7d436f6acebc0200e4b9e6829ce8610315e Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 9 Jun 2016 11:38:23 +0000 Subject: Add sorting support to analyze_brprob script * analyze_brprob.py: Add new argument --sorting. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237256 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 ++++ contrib/analyze_brprob.py | 26 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 6c80c1edbe3..8017e48d9a1 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-06-09 Martin Liska + + * analyze_brprob.py: Add new argument --sorting. + 2016-06-09 Martin Liska * analyze_brprob.py: Cover new dump output format. diff --git a/contrib/analyze_brprob.py b/contrib/analyze_brprob.py index 9416eed3b44..9808c46de16 100755 --- a/contrib/analyze_brprob.py +++ b/contrib/analyze_brprob.py @@ -65,6 +65,7 @@ import sys import os import re +import argparse def percentage(a, b): return 100.0 * a / b @@ -77,6 +78,9 @@ class Summary: self.hits = 0 self.fits = 0 + def get_hitrate(self): + return self.hits / self.count + def count_formatted(self): v = self.count for unit in ['','K','M','G','T','P','E','Z']: @@ -108,22 +112,30 @@ class Profile: def count_max(self): return max([v.count for k, v in self.heuristics.items()]) - def dump(self): + def dump(self, sorting): + sorter = lambda x: x[1].branches + if sorting == 'hitrate': + sorter = lambda x: x[1].get_hitrate() + elif sorting == 'coverage': + sorter = lambda x: x[1].count + print('%-36s %8s %6s %-16s %14s %8s %6s' % ('HEURISTICS', 'BRANCHES', '(REL)', 'HITRATE', 'COVERAGE', 'COVERAGE', '(REL)')) - for (k, v) in sorted(self.heuristics.items(), key = lambda x: x[1].branches): + for (k, v) in sorted(self.heuristics.items(), key = sorter): print('%-36s %8i %5.1f%% %6.2f%% / %6.2f%% %14i %8s %5.1f%%' % (k, v.branches, percentage(v.branches, self.branches_max ()), percentage(v.hits, v.count), percentage(v.fits, v.count), v.count, v.count_formatted(), percentage(v.count, self.count_max()) )) -if len(sys.argv) != 2: - print('Usage: ./analyze_brprob.py dump_file') - exit(1) +parser = argparse.ArgumentParser() +parser.add_argument('dump_file', metavar = 'dump_file', help = 'IPA profile dump file') +parser.add_argument('-s', '--sorting', dest = 'sorting', choices = ['branches', 'hitrate', 'coverage'], default = 'branches') + +args = parser.parse_args() profile = Profile(sys.argv[1]) r = re.compile(' (.*) heuristics( of edge [0-9]*->[0-9]*)?( \\(.*\\))?: (.*)%.*exec ([0-9]*) hit ([0-9]*)') -for l in open(profile.filename).readlines(): +for l in open(args.dump_file).readlines(): m = r.match(l) if m != None and m.group(3) == None: name = m.group(1) @@ -133,4 +145,4 @@ for l in open(profile.filename).readlines(): profile.add(name, prediction, count, hits) -profile.dump() +profile.dump(args.sorting) -- cgit v1.2.3 From d50a30e0268350c9ae6263c74ddf8b8282713b44 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 9 Jun 2016 11:39:08 +0000 Subject: Add new analyze_brprob_spec.py script * analyze_brprob_spec.py: New file. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237257 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 +++ contrib/analyze_brprob_spec.py | 58 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100755 contrib/analyze_brprob_spec.py diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 8017e48d9a1..71835a080b9 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-06-09 Martin Liska + + * analyze_brprob_spec.py: New file. + 2016-06-09 Martin Liska * analyze_brprob.py: Add new argument --sorting. diff --git a/contrib/analyze_brprob_spec.py b/contrib/analyze_brprob_spec.py new file mode 100755 index 00000000000..a28eaac39d5 --- /dev/null +++ b/contrib/analyze_brprob_spec.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +# 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 +# . */ + +import sys +import os +import subprocess +import tempfile +import argparse + +script_location = os.path.realpath(__file__) + +parser = argparse.ArgumentParser() +parser.add_argument('location', metavar = 'dump_file', help = 'Location with SPEC benchmarks') +parser.add_argument('-s', '--sorting', dest = 'sorting', choices = ['branches', 'hitrate', 'coverage'], default = 'branches') + +args = parser.parse_args() + +benchmarks = os.listdir(args.location) + +for b in sorted(benchmarks): + dumps = [] + for root, dirs, files in os.walk(os.path.join(args.location, b)): + for x in files: + if x.endswith('.profile'): + dumps.append(os.path.join(root, x)) + + if len(dumps) == 0: + continue + + temp = tempfile.NamedTemporaryFile(delete = False) + for d in dumps: + temp.write(open(d, 'rb').read()) + + temp.close() + + print() + print(b) + sys.stdout.flush() + p = [os.path.join(os.path.dirname(script_location), 'analyze_brprob.py'), temp.name, '--sorting', args.sorting] + p = subprocess.check_call(p) + sys.stdout.flush() + + os.remove(temp.name) -- cgit v1.2.3 From a0c31702e03486a5741d18d5e2a651966fa9fed1 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 9 Jun 2016 12:02:17 +0000 Subject: /cp 2016-06-09 Paolo Carlini PR c++/71465 Revert: 2016-06-04 Paolo Carlini PR c++/70202 * parser.c (cp_parser_class_head): When xref_basetypes fails and emits an error do not zero the type. /testsuite 2016-06-09 Paolo Carlini PR c++/71465 * g++.dg/inherit/crash5.C: New. Revert: 2016-06-04 Paolo Carlini PR c++/70202 * g++.dg/inherit/crash5.C: New. * g++.dg/inherit/virtual1.C: Adjust. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237258 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/parser.c | 5 +++-- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/g++.dg/inherit/crash5.C | 14 +++++--------- gcc/testsuite/g++.dg/inherit/virtual1.C | 6 +++--- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 54c838bfeaa..a94cebea7dc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2016-06-09 Paolo Carlini + + PR c++/71465 + Revert: + 2016-06-04 Paolo Carlini + + PR c++/70202 + * parser.c (cp_parser_class_head): When xref_basetypes fails and + emits an error do not zero the type. + 2016-06-08 Paolo Carlini * decl.c (maybe_deduce_size_from_array_init): Use diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 2fccc5acf01..e01353d5dc1 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22050,8 +22050,9 @@ cp_parser_class_head (cp_parser* parser, /* If we're really defining a class, process the base classes. If they're invalid, fail. */ - if (type && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) - xref_basetypes (type, bases); + if (type && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE) + && !xref_basetypes (type, bases)) + type = NULL_TREE; done: /* Leave the scope given by the nested-name-specifier. We will diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 155dc1144fe..b1ea45ada40 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-06-09 Paolo Carlini + + PR c++/71465 + * g++.dg/inherit/crash5.C: New. + Revert: + 2016-06-04 Paolo Carlini + + PR c++/70202 + * g++.dg/inherit/crash5.C: New. + * g++.dg/inherit/virtual1.C: Adjust. + 2016-06-09 Martin Liska * g++.dg/predict-loop-exit-1.C: Scan for a new dump format. diff --git a/gcc/testsuite/g++.dg/inherit/crash5.C b/gcc/testsuite/g++.dg/inherit/crash5.C index bce999ccbe5..5a4002e0f8a 100644 --- a/gcc/testsuite/g++.dg/inherit/crash5.C +++ b/gcc/testsuite/g++.dg/inherit/crash5.C @@ -1,10 +1,6 @@ -// PR c++/70202 +// PR c++/71465 -class A -{ - virtual void foo () { } -}; -class B : public A, A { }; // { dg-error "duplicate base type" } - -B b1, &b2 = b1; -A a = b2; +struct A { virtual void foo () {} }; +struct B : virtual A {}; +struct C : virtual A {}; +struct D : C, B, C {}; // { dg-error "duplicate base type" } diff --git a/gcc/testsuite/g++.dg/inherit/virtual1.C b/gcc/testsuite/g++.dg/inherit/virtual1.C index 1199b815f56..08bcbb143cf 100644 --- a/gcc/testsuite/g++.dg/inherit/virtual1.C +++ b/gcc/testsuite/g++.dg/inherit/virtual1.C @@ -5,8 +5,8 @@ struct A virtual ~A() {} }; -struct B : A, virtual A {}; // { dg-error "duplicate base" } +struct B : A, virtual A {}; // { dg-error "duplicate base|forward declaration" } -struct C : A, B {}; // { dg-error "duplicate base" } +struct C : A, B {}; // { dg-error "duplicate base|invalid use" } -C c; +C c; // { dg-error "aggregate" } -- cgit v1.2.3 From 5e07f338fbd1804f7cd7a731797b295ddfd3b8ed Mon Sep 17 00:00:00 2001 From: Senthil Kumar Selvaraj Date: Thu, 9 Jun 2016 14:32:08 +0000 Subject: 2016-06-09 Senthil Kumar Selvaraj * gcc.c-torture/execute/bswap-2.c: Require int32plus. * gcc.dg/torture/pr68067-1.c: Likewise. * gcc.dg/torture/pr68067-2.c: Likewise. 2016-06-09 Senthil Kumar Selvaraj * gcc.dg/stack-usage-1.c (SIZE): Consider return address when setting SIZE. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237266 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/gcc.c-torture/execute/bswap-2.c | 2 ++ gcc/testsuite/gcc.dg/stack-usage-1.c | 6 +++++- gcc/testsuite/gcc.dg/torture/pr68067-1.c | 1 + gcc/testsuite/gcc.dg/torture/pr68067-2.c | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1ea45ada40..6e792aad5ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-06-09 Senthil Kumar Selvaraj + + * gcc.c-torture/execute/bswap-2.c: Require int32plus. + * gcc.dg/torture/pr68067-1.c: Likewise. + * gcc.dg/torture/pr68067-2.c: Likewise. + +2016-06-09 Senthil Kumar Selvaraj + + * gcc.dg/stack-usage-1.c (SIZE): Consider return address + when setting SIZE. + 2016-06-09 Paolo Carlini PR c++/71465 diff --git a/gcc/testsuite/gcc.c-torture/execute/bswap-2.c b/gcc/testsuite/gcc.c-torture/execute/bswap-2.c index 88132fe7859..63e7807d3d9 100644 --- a/gcc/testsuite/gcc.c-torture/execute/bswap-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/bswap-2.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target int32plus } */ + #ifdef __UINT32_TYPE__ typedef __UINT32_TYPE__ uint32_t; #else diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index 7864c6a282b..bdc56565d97 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-1.c +++ b/gcc/testsuite/gcc.dg/stack-usage-1.c @@ -64,7 +64,11 @@ # define SIZE 240 # endif #elif defined (__AVR__) -# define SIZE 254 +#if defined (__AVR_3_BYTE_PC__ ) +# define SIZE 251 /* 256 - 2 bytes for Y - 3 bytes for return address */ +#else +# define SIZE 252 /* 256 - 2 bytes for Y - 2 bytes for return address */ +#endif #elif defined (__s390x__) # define SIZE 96 /* 256 - 160 bytes for register save area */ #elif defined (__s390__) diff --git a/gcc/testsuite/gcc.dg/torture/pr68067-1.c b/gcc/testsuite/gcc.dg/torture/pr68067-1.c index a7b6aa041d9..f8ad3ca0168 100644 --- a/gcc/testsuite/gcc.dg/torture/pr68067-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr68067-1.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ int main() { diff --git a/gcc/testsuite/gcc.dg/torture/pr68067-2.c b/gcc/testsuite/gcc.dg/torture/pr68067-2.c index 38a459bf7f1..e03bf227301 100644 --- a/gcc/testsuite/gcc.dg/torture/pr68067-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr68067-2.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ int main() { -- cgit v1.2.3 From 4c701c37a6e0d81b67488291df7466550575a77a Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Thu, 9 Jun 2016 14:46:25 +0000 Subject: MIPS: Stay within 79 columns in `mips_output_jump' gcc/ * config/mips/mips.c (mips_output_jump): Fix formatting. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237267 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/mips/mips.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c7a0b42c7d..325805f0c41 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-09 Maciej W. Rozycki + + * config/mips/mips.c (mips_output_jump): Fix formatting. + 2016-06-09 Richard Biener PR tree-optimization/71462 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 06acd30ec25..df7b1da42ff 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -13588,8 +13588,9 @@ mips_output_jump (rtx *operands, int target_opno, int size_opno, bool link_p) else s += sprintf (s, "%%*"); - s += sprintf (s, "%s%s%s%s%s\t%%%d%s", insn_name, and_link, reg, compact, short_delay, - target_opno, nop); + s += sprintf (s, "%s%s%s%s%s\t%%%d%s", + insn_name, and_link, reg, compact, short_delay, + target_opno, nop); if (!reg_p && TARGET_ABICALLS_PIC2) s += sprintf (s, "\n\t.option\tpic2"); -- cgit v1.2.3 From 041dc5211bd7490732736c57cccf4b4a337dd053 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 9 Jun 2016 16:32:25 +0000 Subject: PR c/70883 - inconsistent error message for calls to __builtin_add_overflow with too few arguments gcc/c-family/ChangeLog: 2016-06-09 Martin Sebor PR c/70883 * c-common.c (builtin_function_validate_nargs): Make text of error message consistent with others like it. gcc/testsuite/ChangeLog: 2016-06-09 Martin Sebor PR c/70883 * c-c++-common/builtin-arith-overflow-1.c: Adjust diagnostic text. * gcc.dg/builtin-constant_p-1.c: Same. * gcc.dg/builtins-error.c: Same. * gcc.dg/pr70859.c: Same. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237268 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 6 +++++ gcc/c-family/c-common.c | 2 +- gcc/testsuite/ChangeLog | 8 +++++++ .../c-c++-common/builtin-arith-overflow-1.c | 14 ++++++------ gcc/testsuite/gcc.dg/builtin-constant_p-1.c | 4 ++-- gcc/testsuite/gcc.dg/builtins-error.c | 26 +++++++++++----------- gcc/testsuite/gcc.dg/pr70859.c | 10 ++++----- 7 files changed, 42 insertions(+), 28 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 5ebeaf90ff5..23ff800e41f 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2016-06-09 Martin Sebor + + PR c/70883 + * c-common.c (builtin_function_validate_nargs): Make text of error + message consistent with others like it. + 2016-06-08 Martin Sebor Jakub Jelinek diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index d008b040d0d..94005ff8260 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -9828,7 +9828,7 @@ builtin_function_validate_nargs (location_t loc, tree fndecl, int nargs, { if (nargs < required) { - error_at (loc, "not enough arguments to function %qE", fndecl); + error_at (loc, "too few arguments to function %qE", fndecl); return false; } else if (nargs > required) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6e792aad5ef..9ae6294a1ce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2016-06-09 Martin Sebor + + PR c/70883 + * c-c++-common/builtin-arith-overflow-1.c: Adjust diagnostic text. + * gcc.dg/builtin-constant_p-1.c: Same. + * gcc.dg/builtins-error.c: Same. + * gcc.dg/pr70859.c: Same. + 2016-06-09 Senthil Kumar Selvaraj * gcc.c-torture/execute/bswap-2.c: Require int32plus. diff --git a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c index 0d97f6a9fad..3332c4ec44d 100644 --- a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c +++ b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c @@ -3,12 +3,12 @@ int f1 (void) { - int x = __builtin_add_overflow (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_sub_overflow (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_mul_overflow (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_add_overflow_p (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_sub_overflow_p (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_mul_overflow_p (); /* { dg-error "not enough arguments to function" } */ + int x = __builtin_add_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_add_overflow_p (); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow_p (); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow_p (); /* { dg-error "too few arguments to function" } */ return x; } @@ -21,7 +21,7 @@ f2 (int a, int b, int *c, int d) x += __builtin_add_overflow_p (a, b, d, d); /* { dg-error "too many arguments to function" } */ x += __builtin_sub_overflow_p (a, b, d, d, 1, d); /* { dg-error "too many arguments to function" } */ x += __builtin_mul_overflow_p (a, b, d, d); /* { dg-error "too many arguments to function" } */ - + return x; } diff --git a/gcc/testsuite/gcc.dg/builtin-constant_p-1.c b/gcc/testsuite/gcc.dg/builtin-constant_p-1.c index b0b34f4a1e1..f177fe34b2c 100644 --- a/gcc/testsuite/gcc.dg/builtin-constant_p-1.c +++ b/gcc/testsuite/gcc.dg/builtin-constant_p-1.c @@ -2,9 +2,9 @@ int main() { - if (__builtin_constant_p ()) /* { dg-error "not enough" } */ + if (__builtin_constant_p ()) /* { dg-error "too few arguments" } */ return 0; - if (__builtin_constant_p (5, 6)) /* { dg-error "too many" } */ + if (__builtin_constant_p (5, 6)) /* { dg-error "too many arguments" } */ return 1; return 0; } diff --git a/gcc/testsuite/gcc.dg/builtins-error.c b/gcc/testsuite/gcc.dg/builtins-error.c index 9ddf1b1e2ae..945d239d608 100644 --- a/gcc/testsuite/gcc.dg/builtins-error.c +++ b/gcc/testsuite/gcc.dg/builtins-error.c @@ -23,19 +23,19 @@ int test1(struct X x) int test2(double x) { - if (x == 1) return __builtin_fpclassify(1,2,3,4,5); /* { dg-error "not enough arguments" } */ - if (x == 2) return __builtin_isfinite(); /* { dg-error "not enough arguments" } */ - if (x == 3) return __builtin_isinf_sign(); /* { dg-error "not enough arguments" } */ - if (x == 4) return __builtin_isinf(); /* { dg-error "not enough arguments" } */ - if (x == 5) return __builtin_isnan(); /* { dg-error "not enough arguments" } */ - if (x == 6) return __builtin_isnormal(); /* { dg-error "not enough arguments" } */ - if (x == 7) return __builtin_isgreater(x); /* { dg-error "not enough arguments" } */ - if (x == 8) return __builtin_isgreaterequal(x); /* { dg-error "not enough arguments" } */ - if (x == 9) return __builtin_isless(x); /* { dg-error "not enough arguments" } */ - if (x == 10) return __builtin_islessequal(x); /* { dg-error "not enough arguments" } */ - if (x == 11) return __builtin_islessgreater(x); /* { dg-error "not enough arguments" } */ - if (x == 12) return __builtin_isunordered(x); /* { dg-error "not enough arguments" } */ - if (x == 13) return __builtin_signbit(); /* { dg-error "not enough arguments" } */ + if (x == 1) return __builtin_fpclassify(1,2,3,4,5); /* { dg-error "too few arguments" } */ + if (x == 2) return __builtin_isfinite(); /* { dg-error "too few arguments" } */ + if (x == 3) return __builtin_isinf_sign(); /* { dg-error "too few arguments" } */ + if (x == 4) return __builtin_isinf(); /* { dg-error "too few arguments" } */ + if (x == 5) return __builtin_isnan(); /* { dg-error "too few arguments" } */ + if (x == 6) return __builtin_isnormal(); /* { dg-error "too few arguments" } */ + if (x == 7) return __builtin_isgreater(x); /* { dg-error "too few arguments" } */ + if (x == 8) return __builtin_isgreaterequal(x); /* { dg-error "too few arguments" } */ + if (x == 9) return __builtin_isless(x); /* { dg-error "too few arguments" } */ + if (x == 10) return __builtin_islessequal(x); /* { dg-error "too few arguments" } */ + if (x == 11) return __builtin_islessgreater(x); /* { dg-error "too few arguments" } */ + if (x == 12) return __builtin_isunordered(x); /* { dg-error "too few arguments" } */ + if (x == 13) return __builtin_signbit(); /* { dg-error "too few arguments" } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/pr70859.c b/gcc/testsuite/gcc.dg/pr70859.c index 0a3c8437c66..e71b05237b0 100644 --- a/gcc/testsuite/gcc.dg/pr70859.c +++ b/gcc/testsuite/gcc.dg/pr70859.c @@ -41,19 +41,19 @@ fn0 (int n) int fn1 (void) { - if (__builtin_constant_p ()) /* { dg-error "7:not enough" } */ + if (__builtin_constant_p ()) /* { dg-error "7:too few" } */ return 0; if (__builtin_constant_p (1, 2)) /* { dg-error "7:too many" } */ return 1; - if (__builtin_isfinite ()) /* { dg-error "7:not enough" } */ + if (__builtin_isfinite ()) /* { dg-error "7:too few" } */ return 3; if (__builtin_isfinite (1, 2)) /* { dg-error "7:too many" } */ return 4; - if (__builtin_isless (0)) /* { dg-error "7:not enough" } */ + if (__builtin_isless (0)) /* { dg-error "7:too few" } */ return 5; if (__builtin_isless (1, 2, 3)) /* { dg-error "7:too many" } */ return 6; - if (__builtin_fpclassify (1, 2, 3, 4, 5)) /* { dg-error "7:not enough" } */ + if (__builtin_fpclassify (1, 2, 3, 4, 5)) /* { dg-error "7:too few" } */ return 7; if (__builtin_fpclassify (1, 2, 3, 4, 5, r, 6)) /* { dg-error "7:too many" } */ return 8; @@ -61,7 +61,7 @@ fn1 (void) return 9; if (__builtin_assume_aligned (p, r, p, p)) /* { dg-error "7:too many" } */ return 10; - if (__builtin_add_overflow ()) /* { dg-error "7:not enough" } */ + if (__builtin_add_overflow ()) /* { dg-error "7:too few" } */ return 11; if (__builtin_add_overflow (1, 2, 3, &r)) /* { dg-error "7:too many" } */ return 12; -- cgit v1.2.3 From b9f447c097966c1aaca6c5550fa9ffb9ca37f153 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 9 Jun 2016 17:04:13 +0000 Subject: config-list.mk: add GCC_SRC_DIR contrib/ChangeLog: * config-list.mk (GCC_SRC_DIR): New variable. (make-log-dir): Use GCC_SRC_DIR. ($(LIST)): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237269 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 6 ++++++ contrib/config-list.mk | 33 ++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 71835a080b9..02711fd1eaf 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,9 @@ +2016-06-09 David Malcolm + + * config-list.mk (GCC_SRC_DIR): New variable. + (make-log-dir): Use GCC_SRC_DIR. + ($(LIST)): Likewise. + 2016-06-09 Martin Liska * analyze_brprob_spec.py: New file. diff --git a/contrib/config-list.mk b/contrib/config-list.mk index 8210352003c..4a31173579c 100644 --- a/contrib/config-list.mk +++ b/contrib/config-list.mk @@ -3,13 +3,32 @@ host_options='--with-mpc=/opt/cfarm/mpc' # gcc10 TEST=all-gcc # Make sure you have a recent enough gcc (with ada support) in your path so # that --enable-werror-always will work. -# To use, create a sibling directory to the gcc sources and cd into this. +# To use, create a build directory with plenty of free disk space - a build of +# all configurations can take 450GB. +# By default, this file assumes the build directory is in a sibling directory +# to the gcc sources, but you can override GCC_SRC_DIR to specify where to +# find them. GCC_SRC_DIR is used in the directory below the build directory, +# hence the two ".." in the default value; if overriding it, it's easiest to +# supply an absolute path. +GCC_SRC_DIR=../../gcc + # Use -j / -l make arguments and nice to assure a smooth resource-efficient # load on the build machine, e.g. for 24 cores: # svn co svn://gcc.gnu.org/svn/gcc/branches/foo-branch gcc # mkdir multi-mk; cd multi-mk # nohup nice make -j25 -l36 -f ../gcc/contrib/config-list.mk > make.out 2>&1 & # +# Alternatively, if building against an existing gcc source tree: +# +# cd /somewhere/with/plenty/of/disk/space +# mkdir multi-mk; cd multi-mk +# nohup nice make \ +# -j25 -l36 \ +# -f /path/to/contrib/config-list.mk \ +# GCC_SRC_DIR=/path/to/gcc/source/tree \ +# > make.out 2>&1 & +# + # v850e1-elf is rejected by config.sub LIST = aarch64-elf aarch64-linux-gnu aarch64-rtems \ alpha-linux-gnu alpha-freebsd6 alpha-netbsd alpha-openbsd \ @@ -91,17 +110,17 @@ show: empty= -#Check for the presence of the MAINTAINERS file to make sure we are in a -#suitable current working directory. -make-log-dir: ../gcc/MAINTAINERS - mkdir log +#Check for the presence of the MAINTAINERS file to make sure we've located +#the gcc sources. +make-log-dir: $(GCC_SRC_DIR)/MAINTAINERS + -mkdir log $(LIST): make-log-dir -mkdir $@ ( \ cd $@ && \ TGT=`echo $@ | awk 'BEGIN { FS = "OPT" }; { print $$1 }'` && \ - TGT=`../../gcc/config.sub $$TGT` && \ + TGT=`$(GCC_SRC_DIR)/config.sub $$TGT` && \ case $$TGT in \ *-*-darwin* | *-*-cygwin* | *-*-mingw* | *-*-aix*) \ ADDITIONAL_LANGUAGES=""; \ @@ -110,7 +129,7 @@ $(LIST): make-log-dir ADDITIONAL_LANGUAGES=",go"; \ ;; \ esac && \ - ../../gcc/configure \ + $(GCC_SRC_DIR)/configure \ --target=$(subst SCRIPTS,`pwd`/../scripts/,$(subst OPT,$(empty) -,$@)) \ --enable-werror-always ${host_options} \ --enable-languages=all,ada$$ADDITIONAL_LANGUAGES; \ -- cgit v1.2.3 From ded5a8ef7fd86c6625023383c90e1a0c9e12c9de Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 9 Jun 2016 17:06:47 +0000 Subject: config-list.mk: add OPT-enable-obsolete to 4 targets r233165 marked three deprecated rtems targets as obsolete. r233887 marked mep-elf as obsolete. Update config-list.mk to add OPT-enable-obsolete to these 4 targets. contrib/ChangeLog: * config-list.mk (LIST): Add OPT-enable-obsolete to avr-rtems, h8300-rtems, m32r-rtems, mep-elf. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237270 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 5 +++++ contrib/config-list.mk | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 02711fd1eaf..e3e9bfad8bd 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2016-06-09 David Malcolm + + * config-list.mk (LIST): Add OPT-enable-obsolete to avr-rtems, + h8300-rtems, m32r-rtems, mep-elf. + 2016-06-09 David Malcolm * config-list.mk (GCC_SRC_DIR): New variable. diff --git a/contrib/config-list.mk b/contrib/config-list.mk index 4a31173579c..be41d3c9df8 100644 --- a/contrib/config-list.mk +++ b/contrib/config-list.mk @@ -37,11 +37,12 @@ LIST = aarch64-elf aarch64-linux-gnu aarch64-rtems \ arc-linux-uclibcOPT-with-cpu=arc700 arceb-linux-uclibcOPT-with-cpu=arc700 \ arm-wrs-vxworks arm-netbsdelf \ arm-linux-androideabi arm-uclinux_eabi arm-eabi arm-rtems \ - arm-symbianelf avr-rtems avr-elf \ + arm-symbianelf avr-rtemsOPT-enable-obsolete avr-elf \ bfin-elf bfin-uclinux bfin-linux-uclibc bfin-rtems bfin-openbsd \ c6x-elf c6x-uclinux cr16-elf cris-elf cris-linux crisv32-elf crisv32-linux \ epiphany-elf epiphany-elfOPT-with-stack-offset=16 fido-elf \ - fr30-elf frv-elf frv-linux ft32-elf h8300-elf h8300-rtems hppa-linux-gnu \ + fr30-elf frv-elf frv-linux ft32-elf h8300-elf \ + h8300-rtemsOPT-enable-obsolete hppa-linux-gnu \ hppa-linux-gnuOPT-enable-sjlj-exceptions=yes hppa64-linux-gnu \ hppa2.0-hpux10.1 hppa64-hpux11.3 \ hppa64-hpux11.0OPT-enable-sjlj-exceptions=yes hppa2.0-hpux11.9 \ @@ -55,10 +56,11 @@ LIST = aarch64-elf aarch64-linux-gnu aarch64-rtems \ i686-wrs-vxworksae \ i686-cygwinOPT-enable-threads=yes i686-mingw32crt ia64-elf \ ia64-freebsd6 ia64-linux ia64-hpux ia64-hp-vms iq2000-elf lm32-elf \ - lm32-rtems lm32-uclinux m32c-rtems m32c-elf m32r-elf m32rle-elf m32r-rtems \ + lm32-rtems lm32-uclinux m32c-rtems m32c-elf m32r-elf m32rle-elf \ + m32r-rtemsOPT-enable-obsolete \ m32r-linux m32rle-linux m68k-elf m68k-netbsdelf \ m68k-openbsd m68k-uclinux m68k-linux m68k-rtems \ - mcore-elf mep-elf microblaze-linux microblaze-elf \ + mcore-elf mep-elfOPT-enable-obsolete microblaze-linux microblaze-elf \ mips-netbsd \ mips64el-st-linux-gnu mips64octeon-linux mipsisa64r2-linux \ mipsisa32r2-linux-gnu mipsisa64r2-sde-elf mipsisa32-elfoabi \ -- cgit v1.2.3 From a92910f91604ad08437303021721469785ba3cdc Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 9 Jun 2016 17:27:12 +0000 Subject: PR bootstrap/71471: remove selftest for pp_format (%p) gcc/ChangeLog: PR bootstrap/71471 * pretty-print.c (pp_indent): Specify that %p is printed in a host-dependent manner. (test_pp_format): Remove the test for %p. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237271 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/pretty-print.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 325805f0c41..d64511b76cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-09 David Malcolm + + PR bootstrap/71471 + * pretty-print.c (pp_indent): Specify that %p is printed in a + host-dependent manner. + (test_pp_format): Remove the test for %p. + 2016-06-09 Maciej W. Rozycki * config/mips/mips.c (mips_output_jump): Fix formatting. diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index d805da4178c..8febda02f9f 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -279,7 +279,7 @@ pp_indent (pretty_printer *pp) %wd, %wi, %wo, %wu, %wx: HOST_WIDE_INT versions. %c: character. %s: string. - %p: pointer. + %p: pointer (printed in a host-dependent manner). %r: if pp_show_color(pp), switch to color identified by const char *. %R: if pp_show_color(pp), reset color. %m: strerror(text->err_no) - does not consume a value from args_ptr. @@ -1317,8 +1317,8 @@ test_pp_format () assert_pp_format ("A 12345678", "%c %x", 'A', 0x12345678); assert_pp_format ("hello world 12345678", "%s %x", "hello world", 0x12345678); - assert_pp_format ("0xcafebabe 12345678", "%p %x", (void *)0xcafebabe, - 0x12345678); + /* We can't test for %p; the pointer is printed in an implementation-defined + manner. */ assert_pp_format ("normal colored normal 12345678", "normal %rcolored%R normal %x", "error", 0x12345678); -- cgit v1.2.3 From 708b3e42b424ac9acfa9b2c936b2e61de09b2dae Mon Sep 17 00:00:00 2001 From: Julia Koval Date: Thu, 9 Jun 2016 18:31:35 +0000 Subject: Fix x86 interrupt tests for -fpic and -march=corei7 2016-06-09 Julia Koval * gcc.target/i386/interrupt-12.c: Fix test for -fpic and corei7. * gcc.target/i386/interrupt-13.c: Likewise. * gcc.target/i386/interrupt-15.c: Likewise. * gcc.target/i386/interrupt-14.c: Fix test for -fpic. * gcc.target/i386/interrupt-24.c: Likewise. * gcc.target/i386/interrupt-3.c: Fix test for corei7. * gcc.target/i386/interrupt-9.c: Likewise. * gcc.target/i386/interrupt-redzone-2.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237272 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/gcc.target/i386/interrupt-12.c | 10 +++++----- gcc/testsuite/gcc.target/i386/interrupt-13.c | 10 +++++----- gcc/testsuite/gcc.target/i386/interrupt-14.c | 4 ++-- gcc/testsuite/gcc.target/i386/interrupt-15.c | 10 +++++----- gcc/testsuite/gcc.target/i386/interrupt-24.c | 2 +- gcc/testsuite/gcc.target/i386/interrupt-3.c | 4 ++-- gcc/testsuite/gcc.target/i386/interrupt-9.c | 4 ++-- gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c | 2 +- 9 files changed, 34 insertions(+), 23 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9ae6294a1ce..d2f9a702c4b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-06-09 Julia Koval + + * gcc.target/i386/interrupt-12.c: Fix test for -fpic and corei7. + * gcc.target/i386/interrupt-13.c: Likewise. + * gcc.target/i386/interrupt-15.c: Likewise. + * gcc.target/i386/interrupt-14.c: Fix test for -fpic. + * gcc.target/i386/interrupt-24.c: Likewise. + * gcc.target/i386/interrupt-3.c: Fix test for corei7. + * gcc.target/i386/interrupt-9.c: Likewise. + * gcc.target/i386/interrupt-redzone-2.c: Likewise. + 2016-06-09 Martin Sebor PR c/70883 diff --git a/gcc/testsuite/gcc.target/i386/interrupt-12.c b/gcc/testsuite/gcc.target/i386/interrupt-12.c index b04de5fa75d..23780050d76 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-12.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-12.c @@ -15,16 +15,16 @@ fn1 (void *frame, uword_t error) /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */ /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ /* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { { ! ia32 } && nonpic } } } } */ /* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 1 } } */ -/* { dg-final { scan-assembler-times "leave" 1 } } */ +/* { dg-final { scan-assembler-times "leave" 1 { target nonpic } } } */ /* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ -/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 1 { target { { ! ia32 } && nonpic } } } } */ +/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */ +/* { dg-final { scan-assembler "(add|lea)(?:l|q)\[\\t \]*\\\$?8.*,\[\\t \]*%\[re\]?sp" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-13.c b/gcc/testsuite/gcc.target/i386/interrupt-13.c index 018602fd013..378145ec672 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-13.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-13.c @@ -15,16 +15,16 @@ fn1 (void *frame, uword_t error) /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */ /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ /* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { { ! ia32 } && nonpic } } } } */ /* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 1 } } */ -/* { dg-final { scan-assembler-times "leave" 1 } } */ +/* { dg-final { scan-assembler-times "leave" 1 { target nonpic } } } */ /* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ -/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 1 { target { { ! ia32 } && nonpic } } } } */ +/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */ +/* { dg-final { scan-assembler "(add|lea)(?:l|q)\[\\t \]*\\\$?8.*,\[\\t \]*%\[re\]?sp" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-14.c b/gcc/testsuite/gcc.target/i386/interrupt-14.c index 6ed2cf2e42a..f574f4fafac 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-14.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-14.c @@ -18,7 +18,7 @@ fn2 (void *frame) } /* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */ -/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" { target nonpic } } } */ /* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ /* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[8-9\]+" { target { ! ia32 } } } } */ @@ -26,7 +26,7 @@ fn2 (void *frame) /* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 2 } } */ /* { dg-final { scan-assembler-times "leave" 2 { target ia32 } } } */ /* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 2 { target { { ! ia32 } && nonpic } } } } */ /* { dg-final { scan-assembler-times "iret" 2 { target ia32 } } } */ /* { dg-final { scan-assembler-times "iretq" 2 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "\tcld" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-15.c b/gcc/testsuite/gcc.target/i386/interrupt-15.c index 9b53abee652..701ab2f4d33 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-15.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-15.c @@ -22,16 +22,16 @@ fn2 (void *frame, uword_t error) /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */ /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ /* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { { ! ia32 } && nonpic } } } } */ /* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 2 } } */ -/* { dg-final { scan-assembler-times "leave" 2 } } */ +/* { dg-final { scan-assembler-times "leave" 2 { target nonpic } } } */ /* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 2 { target ia32 } } } */ /* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 2 { target ia32 } } } */ /* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 2 { target ia32 } } } */ -/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 2 { target { { ! ia32 } && nonpic } } } } */ +/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */ +/* { dg-final { scan-assembler "(add|lea)(?:l|q)\[\\t \]*\\\$?8.*,\[\\t \]*%\[re\]?sp" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "iret" 2 { target ia32 } } } */ /* { dg-final { scan-assembler-times "iretq" 2 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "\tcld" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-24.c b/gcc/testsuite/gcc.target/i386/interrupt-24.c index 0b95660128e..f7ec9da3f2b 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-24.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-24.c @@ -13,7 +13,7 @@ foo (int i0, int i1, int i2, int i3, int i4, int i5, int i6, } /* { dg-final { scan-assembler-not "movups\[\\t \]*%(x|y|z)mm\[0-9\]+" } } */ -/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" { target nonpic } } } */ /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(d|s)i" } } */ /* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bp" } } */ /* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-3.c b/gcc/testsuite/gcc.target/i386/interrupt-3.c index ec7dc71cfbc..6b53e1347e3 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-3.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-3.c @@ -9,8 +9,8 @@ fn (void* frame, uword_t error) { } -/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler "(add|lea)(?:l|q)\[\\t \]*\\\$?8.*,\[\\t \]*%\[re\]?sp" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */ /* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-9.c b/gcc/testsuite/gcc.target/i386/interrupt-9.c index 490fb9c423b..2a297b25f5e 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-9.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-9.c @@ -15,8 +15,8 @@ foo (void *frame, uword_t error_code) } /* { dg-final { scan-assembler-times "and\[lq\]?\[^\\n\]*-64,\[^\\n\]*sp" 1 } } */ -/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler "(add|lea)(?:l|q)\[\\t \]*\\\$?8.*,\[\\t \]*%\[re\]?sp" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */ /* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ /* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c b/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c index a3fa776e2db..2577f43c916 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c @@ -29,5 +29,5 @@ fn (void *frame) "=m" (i12), "=m" (i13), "=m" (c)); } -/* { dg-final { scan-assembler-times "(?:sub|add)(?:l|q)\[\\t \]*\\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" 2 } } */ +/* { dg-final { scan-assembler "(?:sub|add|lea)(?:l|q)\[\\t \]*.*\\\$?\[0-9\]*.*,\[\\t \]*%\[re\]?sp" } } */ /* { dg-final { scan-assembler-not "\tcld" } } */ -- cgit v1.2.3 From 60ca6c2f1b1aecadaf7a1d3a5bbf4982605ff30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Baczy=C5=84ski?= Date: Thu, 9 Jun 2016 20:43:26 +0000 Subject: =?UTF-8?q?2016-06-09=20=20Marcin=20Baczy=C5=84ski=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * diagnostic.h (diagnostic_line_cutoff, diagnostic_flush_buffer): delete. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237275 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/diagnostic.h | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d64511b76cc..2cdab21c556 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-09 Marcin Baczyński + + * diagnostic.h (diagnostic_line_cutoff, diagnostic_flush_buffer): + delete. + 2016-06-09 David Malcolm PR bootstrap/71471 diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 48ae50d6879..58d77df61c5 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -231,12 +231,6 @@ diagnostic_inhibit_notes (diagnostic_context * context) /* Same as output_prefixing_rule. Works on 'diagnostic_context *'. */ #define diagnostic_prefixing_rule(DC) ((DC)->printer->wrapping.rule) -/* Maximum characters per line in automatic line wrapping mode. - Zero means don't wrap lines. */ -#define diagnostic_line_cutoff(DC) ((DC)->printer->wrapping.line_cutoff) - -#define diagnostic_flush_buffer(DC) pp_flush ((DC)->printer) - /* True if the last module or file in which a diagnostic was reported is different from the current one. */ #define diagnostic_last_module_changed(DC, MAP) \ -- cgit v1.2.3 From 8ca218b4594f3003b9d6b8277f0df2618fbd6c69 Mon Sep 17 00:00:00 2001 From: Jonathan Yong <10walls@gmail.com> Date: Thu, 9 Jun 2016 20:47:48 +0000 Subject: 2016-06-09 Jonathan Yong <10walls@gmail.com> Revert: 2015-09-21 Jonathan Yong <10walls@gmail.com> * config/i386/cygwin.h (STARTFILE_SPEC): Explicitly search sysroot/usr/lib/32api for additional win32 libraries, fixes failing Cygwin bootstrapping. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237276 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/cygwin.h | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cdab21c556..274155fe491 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-06-09 Jonathan Yong <10walls@gmail.com> + + Revert: + 2015-09-21 Jonathan Yong <10walls@gmail.com> + * config/i386/cygwin.h (STARTFILE_SPEC): Explicitly search + sysroot/usr/lib/32api for additional win32 libraries, + fixes failing Cygwin bootstrapping. + 2016-06-09 Marcin Baczyński * diagnostic.h (diagnostic_line_cutoff, diagnostic_flush_buffer): diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 182e4d62658..1d95cd70ad8 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -39,7 +39,6 @@ along with GCC; see the file COPYING3. If not see #undef STARTFILE_SPEC #define STARTFILE_SPEC "\ - -L%R/usr/lib/w32api \ %{!shared: %{!mdll: crt0%O%s \ %{pg:gcrt0%O%s}}}\ %{shared:crtbeginS.o%s;:crtbegin.o%s} \ -- cgit v1.2.3 From 9e05dc44709be9b9cd41a2d2d958bca1b3b896aa Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Thu, 9 Jun 2016 21:28:31 +0000 Subject: [Patch] PR70751, correct the cost for spilling non-pseudo into memory PR rtl-optimization/70751 * lra-constraints.c (process_alt_operands): Recognize Non-pseudo spilled into memory. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237277 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/lra-constraints.c | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 274155fe491..b27dd3f8df6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-09 Vladimir Makarov + Jiong Wang + + PR rtl-optimization/70751 + * lra-constraints.c (process_alt_operands): Recognize Non-pseudo spilled + into memory. + 2016-06-09 Jonathan Yong <10walls@gmail.com> Revert: diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index e4e6c8c47eb..bf08dce2e0a 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2474,14 +2474,27 @@ process_alt_operands (int only_alternative) /* We are trying to spill pseudo into memory. It is usually more costly than moving to a hard register although it might takes the same number of - reloads. */ - if (no_regs_p && REG_P (op) && hard_regno[nop] >= 0) + reloads. + + Non-pseudo spill may happen also. Suppose a target allows both + register and memory in the operand constraint alternatives, + then it's typical that an eliminable register has a substition + of "base + offset" which can either be reloaded by a simple + "new_reg <= base + offset" which will match the register + constraint, or a similar reg addition followed by further spill + to and reload from memory which will match the memory + constraint, but this memory spill will be much more costly + usually. + + Code below increases the reject for both pseudo and non-pseudo + spill. */ + if (no_regs_p && !(REG_P (op) && hard_regno[nop] < 0)) { if (lra_dump_file != NULL) fprintf (lra_dump_file, - " %d Spill pseudo into memory: reject+=3\n", - nop); + " %d Spill %spseudo into memory: reject+=3\n", + nop, REG_P (op) ? "" : "Non-"); reject += 3; if (VECTOR_MODE_P (mode)) { -- cgit v1.2.3 From 20852d1258c3db1aa33fd9ef800d760d9dad5436 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 9 Jun 2016 21:50:55 +0000 Subject: * df-problems.c (df_note_bb_compute): Guard use of DF_INSN_INFO_GET. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237279 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/df-problems.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b27dd3f8df6..d1fcd18815d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-09 Eric Botcazou + + * df-problems.c (df_note_bb_compute): Guard use of DF_INSN_INFO_GET. + 2016-06-09 Vladimir Makarov Jiong Wang diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 132c1276e89..290281ccd4f 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -3498,13 +3498,13 @@ df_note_bb_compute (unsigned int bb_index, FOR_BB_INSNS_REVERSE (bb, insn) { + if (!INSN_P (insn)) + continue; + df_insn_info *insn_info = DF_INSN_INFO_GET (insn); df_mw_hardreg *mw; int debug_insn; - if (!INSN_P (insn)) - continue; - debug_insn = DEBUG_INSN_P (insn); bitmap_clear (do_not_gen); -- cgit v1.2.3 From 8a271001508ab36518eb14732fbfc87f3eb0008e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 10 Jun 2016 00:16:23 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237285 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5b26204f4eb..2ce59ad9c11 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160609 +20160610 -- cgit v1.2.3 From 150808f3fc1977a0199d599d6558373742eff7d6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 10 Jun 2016 01:21:48 +0000 Subject: compiler: fix quoting in error message Reviewed-on: https://go-review.googlesource.com/23966 git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237286 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/expressions.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 8e0fd0fb63e..b812a02e28e 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -a87af72757d9a2e4479062a459a41d4540398005 +054ff1ece3dd5888a445efeaf3ae197b16d4186f The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index da7b4e0e788..5f7e4c9c0e3 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -11463,7 +11463,7 @@ Selector_expression::lower_method_expression(Gogo* gogo) if (method != NULL && !is_pointer && !method->is_value_method()) { - error_at(location, "method requires pointer (use %<(*%s).%s)%>", + error_at(location, "method requires pointer (use %<(*%s).%s%>)", nt->message_name().c_str(), Gogo::message_name(name).c_str()); return Expression::make_error(location); -- cgit v1.2.3 From efad2234806e657eec976ae3e7dd23d10f3f37f4 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 10 Jun 2016 07:30:45 +0000 Subject: 2016-06-10 Richard Biener PR middle-end/71477 * cfgloop.c (alloc_loop): Initialize nb_iterations_likely_upper_bound. * gcc.dg/torture/pr71477.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237287 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/cfgloop.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr71477.c | 11 +++++++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr71477.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1fcd18815d..c589250be68 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Richard Biener + + PR middle-end/71477 + * cfgloop.c (alloc_loop): Initialize nb_iterations_likely_upper_bound. + 2016-06-09 Eric Botcazou * df-problems.c (df_note_bb_compute): Guard use of DF_INSN_INFO_GET. diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 27ccfb226c9..5650f0d92c5 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -331,6 +331,7 @@ alloc_loop (void) loop->exits->next = loop->exits->prev = loop->exits; loop->can_be_parallel = false; loop->nb_iterations_upper_bound = 0; + loop->nb_iterations_likely_upper_bound = 0; loop->nb_iterations_estimate = 0; return loop; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d2f9a702c4b..c93f6fae010 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Richard Biener + + PR middle-end/71477 + * gcc.dg/torture/pr71477.c: New testcase. + 2016-06-09 Julia Koval * gcc.target/i386/interrupt-12.c: Fix test for -fpic and corei7. diff --git a/gcc/testsuite/gcc.dg/torture/pr71477.c b/gcc/testsuite/gcc.dg/torture/pr71477.c new file mode 100644 index 00000000000..c6d0c31817b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr71477.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +#define N 6 +int a; +void fn1() +{ + int k = 0; + for (; k < N;) + for (a = 0; a < N; k++) + a = k + N; +} -- cgit v1.2.3 From 1d68a2ef817e30784e786e70ad920145fc00ae77 Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Fri, 10 Jun 2016 08:46:55 +0000 Subject: 2016-06-10 Alan Hayward gcc/ PR tree-optimization/71407 PR tree-optimization/71416 * tree-vect-loop.c (vectorizable_live_operation): Use vectype for BIT_FIELD_REF type. testsuite/ PR tree-optimization/71407 PR tree-optimization/71416 * gcc.dg/vect/pr71407.c: New * gcc.dg/vect/pr71416-1.c: New * gcc.dg/vect/pr71416-2.c: New git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237288 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/vect/pr71407.c | 16 ++++++++++++++++ gcc/testsuite/gcc.dg/vect/pr71416-1.c | 17 +++++++++++++++++ gcc/testsuite/gcc.dg/vect/pr71416-2.c | 17 +++++++++++++++++ gcc/tree-vect-loop.c | 15 +++++++++------ 6 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr71407.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr71416-1.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr71416-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c589250be68..3f7240cf92f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-10 Alan Hayward + + PR tree-optimization/71407 + PR tree-optimization/71416 + * tree-vect-loop.c (vectorizable_live_operation): Use vectype for + BIT_FIELD_REF type. + 2016-06-10 Richard Biener PR middle-end/71477 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c93f6fae010..ae3f462cbb0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2016-06-10 Alan Hayward + + PR tree-optimization/71407 + PR tree-optimization/71416 + * gcc.dg/vect/pr71407.c: New + * gcc.dg/vect/pr71416-1.c: New + * gcc.dg/vect/pr71416-2.c: New + 2016-06-10 Richard Biener PR middle-end/71477 diff --git a/gcc/testsuite/gcc.dg/vect/pr71407.c b/gcc/testsuite/gcc.dg/vect/pr71407.c new file mode 100644 index 00000000000..761990de9f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr71407.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +int a, c, d; +short b; + +void +fn1 () +{ + int e; + for (; c; c++) + { + for (; a; a++) + b = (short) a || e; + e = d; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/pr71416-1.c b/gcc/testsuite/gcc.dg/vect/pr71416-1.c new file mode 100644 index 00000000000..8a2854889f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr71416-1.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ + +short a; +char b, e; +static short c; +int d, f; +int main() { + short g; + for (; e; ++e) { + d = a; + f = 0; + if (b) + d = f = g >= c; + } + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/vect/pr71416-2.c b/gcc/testsuite/gcc.dg/vect/pr71416-2.c new file mode 100644 index 00000000000..d846ef17ef1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr71416-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +int a, b, d, e, f, g; +int *c; +void fn2 (int *); +void fn1() { fn2(&e); } + +void fn2(int *p1) { + for (;;) { + for (; a; a++) + if (*p1 = g || --f, b) + if (*c) + d = *p1; + if (*p1) + break; + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 1f61c83deaf..1231b95f6a7 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6353,7 +6353,7 @@ vectorizable_live_operation (gimple *stmt, worklist.safe_push (use_stmt); gcc_assert (worklist.length () == 1); - bitsize = TYPE_SIZE (lhs_type); + bitsize = TYPE_SIZE (TREE_TYPE (vectype)); vec_bitsize = TYPE_SIZE (vectype); /* Get the vectorized lhs of STMT and the lane to use (counted in bits). */ @@ -6399,15 +6399,18 @@ vectorizable_live_operation (gimple *stmt, /* Create a new vectorized stmt for the uses of STMT and insert outside the loop. */ - tree new_name = make_ssa_name (lhs_type); - tree new_tree = build3 (BIT_FIELD_REF, lhs_type, vec_lhs, bitsize, bitstart); - gimple *new_stmt = gimple_build_assign (new_name, new_tree); - gsi_insert_on_edge_immediate (single_exit (loop), new_stmt); + gimple_seq stmts = NULL; + tree new_tree = build3 (BIT_FIELD_REF, TREE_TYPE (vectype), vec_lhs, bitsize, + bitstart); + new_tree = force_gimple_operand (fold_convert (lhs_type, new_tree), &stmts, + true, NULL_TREE); + if (stmts) + gsi_insert_seq_on_edge_immediate (single_exit (loop), stmts); /* Replace all uses of the USE_STMT in the worklist with the newly inserted statement. */ use_stmt = worklist.pop (); - replace_uses_by (gimple_phi_result (use_stmt), new_name); + replace_uses_by (gimple_phi_result (use_stmt), new_tree); update_stmt (use_stmt); return true; -- cgit v1.2.3 From 33936efa7812ead6c3545052497378e82d297a95 Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Fri, 10 Jun 2016 08:53:20 +0000 Subject: 2016-06-10 Alan Hayward * check_GNU_style.sh: Fix paste args for BSD git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237289 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 ++++ contrib/check_GNU_style.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index e3e9bfad8bd..e6eda90d5d3 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-06-10 Alan Hayward + + * check_GNU_style.sh: Fix paste args for BSD + 2016-06-09 David Malcolm * config-list.mk (LIST): Add OPT-enable-obsolete to avr-rtems, diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh index a7478f8f573..87a276c9cf4 100755 --- a/contrib/check_GNU_style.sh +++ b/contrib/check_GNU_style.sh @@ -191,7 +191,7 @@ col (){ # Combine prefix back with long lines. # Filter out empty lines. local found=false - paste -d '' "$tmp2" "$tmp3" \ + paste -d '\0' "$tmp2" "$tmp3" \ | grep -v '^[0-9][0-9]*:+$' \ > "$tmp" && found=true -- cgit v1.2.3 From ac3ff523e1f453c744bba9cad475395e37a881cf Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 10 Jun 2016 09:22:38 +0000 Subject: [PR c/71381] C/C++ OpenACC cache directive rejects valid syntax gcc/c/ PR c/71381 * c-parser.c (c_parser_omp_variable_list) : Loosen checking. gcc/cp/ PR c/71381 * parser.c (cp_parser_omp_var_list_no_open) : Loosen checking. gcc/fortran/ PR c/71381 * openmp.c (gfc_match_oacc_cache): Add comment. gcc/testsuite/ PR c/71381 * c-c++-common/goacc/cache-1.c: Update. Move invalid usage tests to... * c-c++-common/goacc/cache-2.c: ... this new file. * gfortran.dg/goacc/cache-1.f95: Move invalid usage tests to... * gfortran.dg/goacc/cache-2.f95: ... this new file. * gfortran.dg/goacc/coarray.f95: Update OpenACC cache directive usage. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. libgomp/ PR c/71381 * testsuite/libgomp.oacc-c-c++-common/cache-1.c: #include "../../../gcc/testsuite/c-c++-common/goacc/cache-1.c". * testsuite/libgomp.oacc-fortran/cache-1.f95: New file. gcc/ * omp-low.c (scan_sharing_clauses): Don't expect OMP_CLAUSE__CACHE_. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237290 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++ gcc/c/ChangeLog | 6 ++ gcc/c/c-parser.c | 21 +------ gcc/cp/ChangeLog | 6 ++ gcc/cp/parser.c | 21 +------ gcc/fortran/ChangeLog | 5 ++ gcc/fortran/openmp.c | 4 ++ gcc/omp-low.c | 6 -- gcc/testsuite/ChangeLog | 13 +++++ gcc/testsuite/c-c++-common/goacc/cache-1.c | 66 ++++++++-------------- gcc/testsuite/c-c++-common/goacc/cache-2.c | 57 +++++++++++++++++++ gcc/testsuite/gfortran.dg/goacc/cache-1.f95 | 7 +-- gcc/testsuite/gfortran.dg/goacc/cache-2.f95 | 12 ++++ gcc/testsuite/gfortran.dg/goacc/coarray.f95 | 2 +- gcc/testsuite/gfortran.dg/goacc/cray.f95 | 3 +- gcc/testsuite/gfortran.dg/goacc/loop-1.f95 | 7 ++- libgomp/ChangeLog | 7 +++ .../testsuite/libgomp.oacc-c-c++-common/cache-1.c | 49 +--------------- libgomp/testsuite/libgomp.oacc-fortran/cache-1.f95 | 6 ++ 19 files changed, 159 insertions(+), 144 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/goacc/cache-2.c create mode 100644 gcc/testsuite/gfortran.dg/goacc/cache-2.f95 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/cache-1.f95 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f7240cf92f..6afbae76146 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Thomas Schwinge + + * omp-low.c (scan_sharing_clauses): Don't expect + OMP_CLAUSE__CACHE_. + 2016-06-10 Alan Hayward PR tree-optimization/71407 diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 4d302453ee4..cd9f230e106 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Thomas Schwinge + + PR c/71381 + * c-parser.c (c_parser_omp_variable_list) : + Loosen checking. + 2016-06-08 Martin Sebor Jakub Jelinek diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 2fef1acebd1..94078a91f4c 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -10613,6 +10613,8 @@ c_parser_omp_variable_list (c_parser *parser, switch (kind) { case OMP_CLAUSE__CACHE_: + /* The OpenACC cache directive explicitly only allows "array + elements or subarrays". */ if (c_parser_peek_token (parser)->type != CPP_OPEN_SQUARE) { c_parser_error (parser, "expected %<[%>"); @@ -10678,25 +10680,6 @@ c_parser_omp_variable_list (c_parser *parser, break; } - if (kind == OMP_CLAUSE__CACHE_) - { - if (TREE_CODE (low_bound) != INTEGER_CST - && !TREE_READONLY (low_bound)) - { - error_at (clause_loc, - "%qD is not a constant", low_bound); - t = error_mark_node; - } - - if (TREE_CODE (length) != INTEGER_CST - && !TREE_READONLY (length)) - { - error_at (clause_loc, - "%qD is not a constant", length); - t = error_mark_node; - } - } - t = tree_cons (low_bound, length, t); } break; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a94cebea7dc..53d55d3b3a6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Thomas Schwinge + + PR c/71381 + * parser.c (cp_parser_omp_var_list_no_open) : + Loosen checking. + 2016-06-09 Paolo Carlini PR c++/71465 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e01353d5dc1..632b25fac95 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -29984,6 +29984,8 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind, switch (kind) { case OMP_CLAUSE__CACHE_: + /* The OpenACC cache directive explicitly only allows "array + elements or subarrays". */ if (cp_lexer_peek_token (parser->lexer)->type != CPP_OPEN_SQUARE) { error_at (token->location, "expected %<[%>"); @@ -30035,25 +30037,6 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind, RT_CLOSE_SQUARE)) goto skip_comma; - if (kind == OMP_CLAUSE__CACHE_) - { - if (TREE_CODE (low_bound) != INTEGER_CST - && !TREE_READONLY (low_bound)) - { - error_at (token->location, - "%qD is not a constant", low_bound); - decl = error_mark_node; - } - - if (TREE_CODE (length) != INTEGER_CST - && !TREE_READONLY (length)) - { - error_at (token->location, - "%qD is not a constant", length); - decl = error_mark_node; - } - } - decl = tree_cons (low_bound, length, decl); } break; diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b2354e7c203..67bc9e88621 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Thomas Schwinge + + PR c/71381 + * openmp.c (gfc_match_oacc_cache): Add comment. + 2016-06-05 Jerry DeLisle PR fortran/71404 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 2689d302c77..2c9279401a2 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1688,6 +1688,10 @@ match gfc_match_oacc_cache (void) { gfc_omp_clauses *c = gfc_get_omp_clauses (); + /* The OpenACC cache directive explicitly only allows "array elements or + subarrays", which we're currently not checking here. Either check this + after the call of gfc_match_omp_variable_list, or add something like a + only_sections variant next to its allow_sections parameter. */ match m = gfc_match_omp_variable_list (" (", &c->lists[OMP_LIST_CACHE], true, NULL, NULL, true); diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 77bdb1810e6..91d5fcfcab0 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2201,9 +2201,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, break; case OMP_CLAUSE__CACHE_: - sorry ("Clause not supported yet"); - break; - default: gcc_unreachable (); } @@ -2368,9 +2365,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, break; case OMP_CLAUSE__CACHE_: - sorry ("Clause not supported yet"); - break; - default: gcc_unreachable (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ae3f462cbb0..e15b009b425 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2016-06-10 Thomas Schwinge + + PR c/71381 + * c-c++-common/goacc/cache-1.c: Update. Move invalid usage tests + to... + * c-c++-common/goacc/cache-2.c: ... this new file. + * gfortran.dg/goacc/cache-1.f95: Move invalid usage tests to... + * gfortran.dg/goacc/cache-2.f95: ... this new file. + * gfortran.dg/goacc/coarray.f95: Update OpenACC cache directive + usage. + * gfortran.dg/goacc/cray.f95: Likewise. + * gfortran.dg/goacc/loop-1.f95: Likewise. + 2016-06-10 Alan Hayward PR tree-optimization/71407 diff --git a/gcc/testsuite/c-c++-common/goacc/cache-1.c b/gcc/testsuite/c-c++-common/goacc/cache-1.c index 950334102db..1d4759e738c 100644 --- a/gcc/testsuite/c-c++-common/goacc/cache-1.c +++ b/gcc/testsuite/c-c++-common/goacc/cache-1.c @@ -1,3 +1,7 @@ +/* OpenACC cache directive: valid usage. */ +/* For execution testing, this file is "#include"d from + libgomp/testsuite/libgomp.oacc-c-c++-common/cache-1.c. */ + int main (int argc, char **argv) { @@ -21,57 +25,31 @@ main (int argc, char **argv) int n = 1; const int len = n; -#pragma acc cache /* { dg-error "expected '\\\(' before end of line" } */ - -#pragma acc cache a[0:N] /* { dg-error "expected '\\\(' before 'a'" } */ - /* { dg-bogus "expected end of line before 'a'" "" { xfail c++ } 26 } */ - -#pragma acc cache (a) /* { dg-error "expected '\\\['" } */ - -#pragma acc cache ( /* { dg-error "expected (identifier|unqualified-id) before end of line" } */ - -#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */ - -#pragma acc cache (,) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" } */ - -#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */ - -#pragma acc cache (a[0:N],) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" "" { xfail c } } */ - -#pragma acc cache (a[0:N]) copyin (a[0:N]) /* { dg-error "expected end of line before 'copyin'" } */ - -#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */ - -#pragma acc cache (a[0:N] b[0:N]) /* { dg-error "expected '\\\)' before 'b'" } */ - -#pragma acc cache (a[0:N] b[0:N}) /* { dg-error "expected '\\\)' before 'b'" } */ - /* { dg-bogus "expected end of line before '\\\}' token" "" { xfail c++ } 47 } */ - -#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */ - -#pragma acc cache (a[ii]) /* { dg-error "'ii' is not a constant" } */ - -#pragma acc cache (a[idx:n]) /* { dg-error "'n' is not a constant" } */ - -#pragma acc cache (a[0:N]) ( /* { dg-error "expected end of line before '\\(' token" } */ - -#pragma acc cache (a[0:N]) ii /* { dg-error "expected end of line before 'ii'" } */ - -#pragma acc cache (a[0:N] ii) /* { dg-error "expected '\\)' before 'ii'" } */ - + /* Have at it, GCC! */ #pragma acc cache (a[0:N]) - #pragma acc cache (a[0:N], a[0:N]) - #pragma acc cache (a[0:N], b[0:N]) - #pragma acc cache (a[0]) - #pragma acc cache (a[0], a[1], b[0:N]) - +#pragma acc cache (a[i - 5]) +#pragma acc cache (a[i + 5:len]) +#pragma acc cache (a[i + 5:len - 1]) +#pragma acc cache (b[i]) +#pragma acc cache (b[i:len]) +#pragma acc cache (a[ii]) +#pragma acc cache (a[ii:len]) +#pragma acc cache (b[ii - 1]) +#pragma acc cache (b[ii - 1:len]) +#pragma acc cache (b[i - ii + 1]) +#pragma acc cache (b[i + ii - 1:len]) +#pragma acc cache (b[i * ii - 1:len + 1]) +#pragma acc cache (a[idx + 2]) +#pragma acc cache (a[idx:len + 2]) #pragma acc cache (a[idx]) - #pragma acc cache (a[idx:len]) +#pragma acc cache (a[idx + 2:len]) +#pragma acc cache (a[idx + 2 + i:len]) +#pragma acc cache (a[idx + 2 + i + ii:len]) b[ii] = a[ii]; } diff --git a/gcc/testsuite/c-c++-common/goacc/cache-2.c b/gcc/testsuite/c-c++-common/goacc/cache-2.c new file mode 100644 index 00000000000..f7175157915 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/cache-2.c @@ -0,0 +1,57 @@ +/* OpenACC cache directive: invalid usage. */ + +int +main (int argc, char **argv) +{ +#define N 2 + int a[N], b[N]; + int i; + + for (i = 0; i < N; i++) + { + a[i] = 3; + b[i] = 0; + } + +#pragma acc parallel copyin (a[0:N]) copyout (b[0:N]) +{ + int ii; + + for (ii = 0; ii < N; ii++) + { + const int idx = ii; + int n = 1; + const int len = n; + +#pragma acc cache /* { dg-error "expected '\\\(' before end of line" } */ +#pragma acc cache a[0:N] /* { dg-error "expected '\\\(' before 'a'" } */ + /* { dg-bogus "expected end of line before 'a'" "" { xfail c++ } 27 } */ +#pragma acc cache (a) /* { dg-error "expected '\\\['" } */ +#pragma acc cache ( /* { dg-error "expected (identifier|unqualified-id) before end of line" } */ +#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */ +#pragma acc cache (,) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" } */ +#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */ +#pragma acc cache (a[0:N],) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" "" { xfail c } } */ +#pragma acc cache (a[0:N]) copyin (a[0:N]) /* { dg-error "expected end of line before 'copyin'" } */ +#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */ +#pragma acc cache (a[0:N] b[0:N]) /* { dg-error "expected '\\\)' before 'b'" } */ +#pragma acc cache (a[0:N] b[0:N}) /* { dg-error "expected '\\\)' before 'b'" } */ + /* { dg-bogus "expected end of line before '\\\}' token" "" { xfail c++ } 38 } */ +#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */ +#pragma acc cache (a[0:N]) ( /* { dg-error "expected end of line before '\\(' token" } */ +#pragma acc cache (a[0:N]) ii /* { dg-error "expected end of line before 'ii'" } */ +#pragma acc cache (a[0:N] ii) /* { dg-error "expected '\\)' before 'ii'" } */ + + b[ii] = a[ii]; + } +} + + + for (i = 0; i < N; i++) + { + if (a[i] != b[i]) + __builtin_abort (); + } + + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/goacc/cache-1.f95 b/gcc/testsuite/gfortran.dg/goacc/cache-1.f95 index 2aa9e053627..39fbf2cf55a 100644 --- a/gcc/testsuite/gfortran.dg/goacc/cache-1.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/cache-1.f95 @@ -1,4 +1,6 @@ -! { dg-do compile } +! OpenACC cache directive: valid usage. +! For execution testing, this file is "#include"d from +! libgomp/testsuite/libgomp.oacc-fortran/cache-1.f95. ! { dg-additional-options "-std=f2008" } program test @@ -6,11 +8,8 @@ program test integer :: i, d(10), e(5,13) do concurrent (i=1:5) - !$acc cache (d) !$acc cache (d(1:3)) !$acc cache (d(i:i+2)) - - !$acc cache (e) !$acc cache (e(1:3,2:4)) !$acc cache (e(i:i+2,i+1:i+3)) enddo diff --git a/gcc/testsuite/gfortran.dg/goacc/cache-2.f95 b/gcc/testsuite/gfortran.dg/goacc/cache-2.f95 new file mode 100644 index 00000000000..be818788556 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/cache-2.f95 @@ -0,0 +1,12 @@ +! OpenACC cache directive: invalid usage. +! { dg-additional-options "-std=f2008" } + +program test + implicit none + integer :: i, d(10), e(5,13) + + do concurrent (i=1:5) + !$acc cache (d) ! { dg-error "" "TODO" { xfail *-*-* } } + !$acc cache (e) ! { dg-error "" "TODO" { xfail *-*-* } } + enddo +end diff --git a/gcc/testsuite/gfortran.dg/goacc/coarray.f95 b/gcc/testsuite/gfortran.dg/goacc/coarray.f95 index 932e1f7fd0d..f30917b8a9c 100644 --- a/gcc/testsuite/gfortran.dg/goacc/coarray.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/coarray.f95 @@ -24,7 +24,7 @@ contains !$acc end parallel loop !$acc parallel loop do i = 1,5 - !$acc cache (a) + !$acc cache (a) ! { dg-error "" "TODO" { xfail *-*-* } } enddo !$acc end parallel loop !$acc update device (a) diff --git a/gcc/testsuite/gfortran.dg/goacc/cray.f95 b/gcc/testsuite/gfortran.dg/goacc/cray.f95 index a35ab0dc995..705c18c992d 100644 --- a/gcc/testsuite/gfortran.dg/goacc/cray.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/cray.f95 @@ -44,7 +44,8 @@ contains !$acc end parallel loop !$acc parallel loop do i = 1,5 - !$acc cache (ptr) ! TODO: This must fail, as in openacc-1_0-branch + !TODO: This must fail, as in openacc-1_0-branch. + !$acc cache (ptr) ! { dg-error "" "TODO" { xfail *-*-* } } enddo !$acc end parallel loop !$acc update device (ptr) diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 index b5f9e038145..a605f038926 100644 --- a/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 @@ -158,15 +158,16 @@ subroutine test1 enddo - !$acc cache (a) ! { dg-error "inside of loop" } + !$acc cache (a(1:10)) ! { dg-error "ACC CACHE directive must be inside of loop" } do i = 1,10 - !$acc cache(a) + !$acc cache(a(i:i+1)) enddo do i = 1,10 + !$acc cache(a(i:i+1)) a(i) = i - !$acc cache(a) + !$acc cache(a(i+2:i+2+1)) enddo end subroutine test1 diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index f6d7dd2a808..5c7f41abf89 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,10 @@ +2016-06-10 Thomas Schwinge + + PR c/71381 + * testsuite/libgomp.oacc-c-c++-common/cache-1.c: #include + "../../../gcc/testsuite/c-c++-common/goacc/cache-1.c". + * testsuite/libgomp.oacc-fortran/cache-1.f95: New file. + 2016-06-03 Chung-Lin Tang * testsuite/libgomp.oacc-fortran/reduction-8.f90: New testcase. diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/cache-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/cache-1.c index 3f1f0bb3764..16aaed5df70 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/cache-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/cache-1.c @@ -1,48 +1,3 @@ -int -main (int argc, char **argv) -{ -#define N 2 - int a[N], b[N]; - int i; +/* OpenACC cache directive. */ - for (i = 0; i < N; i++) - { - a[i] = 3; - b[i] = 0; - } - -#pragma acc parallel copyin (a[0:N]) copyout (b[0:N]) -{ - int ii; - - for (ii = 0; ii < N; ii++) - { - const int idx = ii; - int n = 1; - const int len = n; - -#pragma acc cache (a[0:N]) - -#pragma acc cache (a[0:N], b[0:N]) - -#pragma acc cache (a[0]) - -#pragma acc cache (a[0], a[1], b[0:N]) - -#pragma acc cache (a[idx]) - -#pragma acc cache (a[idx:len]) - - b[ii] = a[ii]; - } -} - - - for (i = 0; i < N; i++) - { - if (a[i] != b[i]) - __builtin_abort (); - } - - return 0; -} +#include "../../../gcc/testsuite/c-c++-common/goacc/cache-1.c" diff --git a/libgomp/testsuite/libgomp.oacc-fortran/cache-1.f95 b/libgomp/testsuite/libgomp.oacc-fortran/cache-1.f95 new file mode 100644 index 00000000000..37313d8c44a --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/cache-1.f95 @@ -0,0 +1,6 @@ +! OpenACC cache directive. +! { dg-do run } +! { dg-additional-options "-std=f2008" } +! { dg-additional-options "-cpp" } + +#include "../../../gcc/testsuite/gfortran.dg/goacc/cache-1.f95" -- cgit v1.2.3 From 432856b62d8ea0d1913bd37badacf2955b51491c Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 10 Jun 2016 09:22:51 +0000 Subject: [PR middle-end/71373] Handle more OMP_CLAUSE_* in nested function decomposition gcc/ * gimplify.c (gimplify_adjust_omp_clauses): Discard OMP_CLAUSE_TILE. * omp-low.c (scan_sharing_clauses): Don't expect OMP_CLAUSE_TILE. gcc/testsuite/ * c-c++-common/goacc/combined-directives.c: XFAIL tree scanning for OpenACC tile clauses. * gfortran.dg/goacc/combined-directives.f90: Likewise. gcc/ PR middle-end/71373 * tree-nested.c (convert_nonlocal_omp_clauses) (convert_local_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE__CACHE_, OMP_CLAUSE_TILE. gcc/testsuite/ PR middle-end/71373 * gcc.dg/goacc/nested-function-1.c: New file. * gcc.dg/goacc/nested-function-2.c: Likewise. * gcc.dg/goacc/pr71373.c: Likewise. * gfortran.dg/goacc/cray-2.f95: Likewise. * gfortran.dg/goacc/loop-1-2.f95: Likewise. * gfortran.dg/goacc/loop-3-2.f95: Likewise. * gfortran.dg/goacc/cray.f95: Update. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/subroutines.f90: Update, and rename to... * gfortran.dg/goacc/nested-function-1.f90: ... this new file. libgomp/testsuite/ PR middle-end/71373 * libgomp.oacc-c/nested-function-1.c: New file. * libgomp.oacc-c/nested-function-2.c: Likewise. * libgomp.oacc-fortran/nested-function-1.f90: Likewise. * libgomp.oacc-fortran/nested-function-2.f90: Likewise. * libgomp.oacc-fortran/nested-function-3.f90: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237291 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 + gcc/gimplify.c | 6 + gcc/omp-low.c | 4 +- gcc/testsuite/ChangeLog | 20 ++ .../c-c++-common/goacc/combined-directives.c | 3 +- gcc/testsuite/gcc.dg/goacc/nested-function-1.c | 100 +++++++++ gcc/testsuite/gcc.dg/goacc/nested-function-2.c | 45 ++++ gcc/testsuite/gcc.dg/goacc/pr71373.c | 41 ++++ .../gfortran.dg/goacc/combined-directives.f90 | 3 +- gcc/testsuite/gfortran.dg/goacc/cray-2.f95 | 56 +++++ gcc/testsuite/gfortran.dg/goacc/cray.f95 | 6 +- gcc/testsuite/gfortran.dg/goacc/loop-1-2.f95 | 176 +++++++++++++++ gcc/testsuite/gfortran.dg/goacc/loop-1.f95 | 30 +-- gcc/testsuite/gfortran.dg/goacc/loop-3-2.f95 | 58 +++++ gcc/testsuite/gfortran.dg/goacc/loop-3.f95 | 11 +- .../gfortran.dg/goacc/nested-function-1.f90 | 93 ++++++++ gcc/testsuite/gfortran.dg/goacc/subroutines.f90 | 73 ------ gcc/tree-nested.c | 30 +++ libgomp/ChangeLog | 10 + .../testsuite/libgomp.oacc-c/nested-function-1.c | 52 +++++ .../testsuite/libgomp.oacc-c/nested-function-2.c | 155 +++++++++++++ .../libgomp.oacc-fortran/nested-function-1.f90 | 70 ++++++ .../libgomp.oacc-fortran/nested-function-2.f90 | 173 +++++++++++++++ .../libgomp.oacc-fortran/nested-function-3.f90 | 244 +++++++++++++++++++++ 24 files changed, 1369 insertions(+), 100 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/goacc/nested-function-1.c create mode 100644 gcc/testsuite/gcc.dg/goacc/nested-function-2.c create mode 100644 gcc/testsuite/gcc.dg/goacc/pr71373.c create mode 100644 gcc/testsuite/gfortran.dg/goacc/cray-2.f95 create mode 100644 gcc/testsuite/gfortran.dg/goacc/loop-1-2.f95 create mode 100644 gcc/testsuite/gfortran.dg/goacc/loop-3-2.f95 create mode 100644 gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 delete mode 100644 gcc/testsuite/gfortran.dg/goacc/subroutines.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-c/nested-function-1.c create mode 100644 libgomp/testsuite/libgomp.oacc-c/nested-function-2.c create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/nested-function-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/nested-function-2.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/nested-function-3.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6afbae76146..9cab3118d65 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2016-06-10 Thomas Schwinge + PR middle-end/71373 + * tree-nested.c (convert_nonlocal_omp_clauses) + (convert_local_omp_clauses): Handle OMP_CLAUSE_ASYNC, + OMP_CLAUSE_WAIT, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, + OMP_CLAUSE__CACHE_, OMP_CLAUSE_TILE. + + * gimplify.c (gimplify_adjust_omp_clauses): Discard + OMP_CLAUSE_TILE. + * omp-low.c (scan_sharing_clauses): Don't expect OMP_CLAUSE_TILE. + * omp-low.c (scan_sharing_clauses): Don't expect OMP_CLAUSE__CACHE_. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index f12c6a11456..7c19cf335be 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -8280,7 +8280,13 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, case OMP_CLAUSE_VECTOR: case OMP_CLAUSE_AUTO: case OMP_CLAUSE_SEQ: + break; + case OMP_CLAUSE_TILE: + /* We're not yet making use of the information provided by OpenACC + tile clauses. Discard these here, to simplify later middle end + processing. */ + remove = true; break; default: diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 91d5fcfcab0..22e59094e82 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2187,7 +2187,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, case OMP_CLAUSE_GANG: case OMP_CLAUSE_WORKER: case OMP_CLAUSE_VECTOR: - case OMP_CLAUSE_TILE: case OMP_CLAUSE_INDEPENDENT: case OMP_CLAUSE_AUTO: case OMP_CLAUSE_SEQ: @@ -2200,6 +2199,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, install_var_local (decl, ctx); break; + case OMP_CLAUSE_TILE: case OMP_CLAUSE__CACHE_: default: gcc_unreachable (); @@ -2357,13 +2357,13 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, case OMP_CLAUSE_GANG: case OMP_CLAUSE_WORKER: case OMP_CLAUSE_VECTOR: - case OMP_CLAUSE_TILE: case OMP_CLAUSE_INDEPENDENT: case OMP_CLAUSE_AUTO: case OMP_CLAUSE_SEQ: case OMP_CLAUSE__GRIDDIM_: break; + case OMP_CLAUSE_TILE: case OMP_CLAUSE__CACHE_: default: gcc_unreachable (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e15b009b425..325de75e271 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,24 @@ 2016-06-10 Thomas Schwinge + Cesar Philippidis + + PR middle-end/71373 + * gcc.dg/goacc/nested-function-1.c: New file. + * gcc.dg/goacc/nested-function-2.c: Likewise. + * gcc.dg/goacc/pr71373.c: Likewise. + * gfortran.dg/goacc/cray-2.f95: Likewise. + * gfortran.dg/goacc/loop-1-2.f95: Likewise. + * gfortran.dg/goacc/loop-3-2.f95: Likewise. + * gfortran.dg/goacc/cray.f95: Update. + * gfortran.dg/goacc/loop-1.f95: Likewise. + * gfortran.dg/goacc/loop-3.f95: Likewise. + * gfortran.dg/goacc/subroutines.f90: Update, and rename to... + * gfortran.dg/goacc/nested-function-1.f90: ... this new file. + +2016-06-10 Thomas Schwinge + + * c-c++-common/goacc/combined-directives.c: XFAIL tree scanning + for OpenACC tile clauses. + * gfortran.dg/goacc/combined-directives.f90: Likewise. PR c/71381 * c-c++-common/goacc/cache-1.c: Update. Move invalid usage tests diff --git a/gcc/testsuite/c-c++-common/goacc/combined-directives.c b/gcc/testsuite/c-c++-common/goacc/combined-directives.c index c2a3c57b48b..3fa800d7bbe 100644 --- a/gcc/testsuite/c-c++-common/goacc/combined-directives.c +++ b/gcc/testsuite/c-c++-common/goacc/combined-directives.c @@ -111,6 +111,7 @@ test () // { dg-final { scan-tree-dump-times "acc loop vector" 2 "gimple" } } // { dg-final { scan-tree-dump-times "acc loop seq" 2 "gimple" } } // { dg-final { scan-tree-dump-times "acc loop auto" 2 "gimple" } } -// { dg-final { scan-tree-dump-times "acc loop tile.2, 3" 2 "gimple" } } +// XFAILed: OpenACC tile clauses are discarded during gimplification. +// { dg-final { scan-tree-dump-times "acc loop tile.2, 3" 2 "gimple" { xfail *-*-* } } } // { dg-final { scan-tree-dump-times "acc loop independent private.i" 2 "gimple" } } // { dg-final { scan-tree-dump-times "private.z" 2 "gimple" } } diff --git a/gcc/testsuite/gcc.dg/goacc/nested-function-1.c b/gcc/testsuite/gcc.dg/goacc/nested-function-1.c new file mode 100644 index 00000000000..e17c0e2227f --- /dev/null +++ b/gcc/testsuite/gcc.dg/goacc/nested-function-1.c @@ -0,0 +1,100 @@ +/* Exercise nested function decomposition, gcc/tree-nested.c. */ +/* See gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 for the Fortran + version. */ + +int main () +{ +#define N 100 + int nonlocal_arg; + int nonlocal_a[N]; + int nonlocal_i; + int nonlocal_j; + + for (int i = 0; i < N; ++i) + nonlocal_a[i] = 5; + nonlocal_arg = 5; + + void local () + { + int local_i; + int local_arg; + int local_a[N]; + int local_j; + + for (int i = 0; i < N; ++i) + local_a[i] = 5; + local_arg = 5; + +#pragma acc kernels loop \ + gang(num:local_arg) worker(local_arg) vector(local_arg) \ + wait async(local_arg) + for (local_i = 0; local_i < N; ++local_i) + { +#pragma acc cache (local_a[local_i:5]) + local_a[local_i] = 100; +#pragma acc loop seq tile(*) + for (local_j = 0; local_j < N; ++local_j) + ; +#pragma acc loop auto independent tile(1) + for (local_j = 0; local_j < N; ++local_j) + ; + } + +#pragma acc kernels loop \ + gang(static:local_arg) worker(local_arg) vector(local_arg) \ + wait(local_arg, local_arg + 1, local_arg + 2) async + for (local_i = 0; local_i < N; ++local_i) + { +#pragma acc cache (local_a[local_i:4]) + local_a[local_i] = 100; +#pragma acc loop seq tile(1) + for (local_j = 0; local_j < N; ++local_j) + ; +#pragma acc loop auto independent tile(*) + for (local_j = 0; local_j < N; ++local_j) + ; + } + } + + void nonlocal () + { + for (int i = 0; i < N; ++i) + nonlocal_a[i] = 5; + nonlocal_arg = 5; + +#pragma acc kernels loop \ + gang(num:nonlocal_arg) worker(nonlocal_arg) vector(nonlocal_arg) \ + wait async(nonlocal_arg) + for (nonlocal_i = 0; nonlocal_i < N; ++nonlocal_i) + { +#pragma acc cache (nonlocal_a[nonlocal_i:3]) + nonlocal_a[nonlocal_i] = 100; +#pragma acc loop seq tile(2) + for (nonlocal_j = 0; nonlocal_j < N; ++nonlocal_j) + ; +#pragma acc loop auto independent tile(3) + for (nonlocal_j = 0; nonlocal_j < N; ++nonlocal_j) + ; + } + +#pragma acc kernels loop \ + gang(static:nonlocal_arg) worker(nonlocal_arg) vector(nonlocal_arg) \ + wait(nonlocal_arg, nonlocal_arg + 1, nonlocal_arg + 2) async + for (nonlocal_i = 0; nonlocal_i < N; ++nonlocal_i) + { +#pragma acc cache (nonlocal_a[nonlocal_i:2]) + nonlocal_a[nonlocal_i] = 100; +#pragma acc loop seq tile(*) + for (nonlocal_j = 0; nonlocal_j < N; ++nonlocal_j) + ; +#pragma acc loop auto independent tile(*) + for (nonlocal_j = 0; nonlocal_j < N; ++nonlocal_j) + ; + } + } + + local (); + nonlocal (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/goacc/nested-function-2.c b/gcc/testsuite/gcc.dg/goacc/nested-function-2.c new file mode 100644 index 00000000000..70c9ec8ebfa --- /dev/null +++ b/gcc/testsuite/gcc.dg/goacc/nested-function-2.c @@ -0,0 +1,45 @@ +/* Exercise nested function decomposition, gcc/tree-nested.c. */ + +int +main (void) +{ + int j = 0, k = 6, l = 7, m = 8; + void simple (void) + { + int i; +#pragma acc parallel + { +#pragma acc loop + for (i = 0; i < m; i+= k) + j = (m + i - j) * l; + } + } + void collapse (void) + { + int x, y, z; +#pragma acc parallel + { +#pragma acc loop collapse (3) + for (x = 0; x < k; x++) + for (y = -5; y < l; y++) + for (z = 0; z < m; z++) + j += x + y + z; + } + } + void reduction (void) + { + int x, y, z; +#pragma acc parallel reduction (+:j) + { +#pragma acc loop reduction (+:j) collapse (3) + for (x = 0; x < k; x++) + for (y = -5; y < l; y++) + for (z = 0; z < m; z++) + j += x + y + z; + } + } + simple(); + collapse(); + reduction(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/goacc/pr71373.c b/gcc/testsuite/gcc.dg/goacc/pr71373.c new file mode 100644 index 00000000000..9381752cc9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/goacc/pr71373.c @@ -0,0 +1,41 @@ +/* Unintentional nested function usage. */ +/* Due to missing right braces '}', the following functions are parsed as + nested functions. This ran into an ICE. */ + +void foo (void) +{ + #pragma acc parallel + { + #pragma acc loop independent + for (int i = 0; i < 16; i++) + ; + // Note right brace '}' commented out here. + //} +} +void bar (void) +{ +} + +// Adding right brace '}' here, to make this compile. +} + + +// ..., and the other way round: + +void BAR (void) +{ +// Note right brace '}' commented out here. +//} + +void FOO (void) +{ + #pragma acc parallel + { + #pragma acc loop independent + for (int i = 0; i < 16; i++) + ; + } +} + +// Adding right brace '}' here, to make this compile. +} diff --git a/gcc/testsuite/gfortran.dg/goacc/combined-directives.f90 b/gcc/testsuite/gfortran.dg/goacc/combined-directives.f90 index 42a447ad06b..abb5e6b6c3d 100644 --- a/gcc/testsuite/gfortran.dg/goacc/combined-directives.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/combined-directives.f90 @@ -143,7 +143,8 @@ end subroutine test ! { dg-final { scan-tree-dump-times "acc loop private.i. private.j. vector" 2 "gimple" } } ! { dg-final { scan-tree-dump-times "acc loop private.i. private.j. seq" 2 "gimple" } } ! { dg-final { scan-tree-dump-times "acc loop private.i. private.j. auto" 2 "gimple" } } -! { dg-final { scan-tree-dump-times "acc loop private.i. private.j. tile.2, 3" 2 "gimple" } } +! XFAILed: OpenACC tile clauses are discarded during gimplification. +! { dg-final { scan-tree-dump-times "acc loop private.i. private.j. tile.2, 3" 2 "gimple" { xfail *-*-* } } } ! { dg-final { scan-tree-dump-times "acc loop private.i. independent" 2 "gimple" } } ! { dg-final { scan-tree-dump-times "private.z" 2 "gimple" } } ! { dg-final { scan-tree-dump-times "omp target oacc_\[^ \]+ map.force_tofrom:y" 2 "gimple" } } diff --git a/gcc/testsuite/gfortran.dg/goacc/cray-2.f95 b/gcc/testsuite/gfortran.dg/goacc/cray-2.f95 new file mode 100644 index 00000000000..51b79b53636 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/cray-2.f95 @@ -0,0 +1,56 @@ +! { dg-additional-options "-fcray-pointer" } +! See also cray.f95. + +program test + call oacc1 +contains + subroutine oacc1 + implicit none + integer :: i + real :: pointee + pointer (ptr, pointee) + !$acc declare device_resident (pointee) + !$acc declare device_resident (ptr) + !$acc data copy (pointee) ! { dg-error "Cray pointee" } + !$acc end data + !$acc data deviceptr (pointee) ! { dg-error "Cray pointee" } + !$acc end data + !$acc parallel private (pointee) ! { dg-error "Cray pointee" } + !$acc end parallel + !$acc host_data use_device (pointee) ! { dg-error "Cray pointee" } + !$acc end host_data + !$acc parallel loop reduction(+:pointee) ! { dg-error "Cray pointee" } + do i = 1,5 + enddo + !$acc end parallel loop + !$acc parallel loop + do i = 1,5 + !$acc cache (pointee) ! { dg-error "Cray pointee" } + enddo + !$acc end parallel loop + !$acc update device (pointee) ! { dg-error "Cray pointee" } + !$acc update host (pointee) ! { dg-error "Cray pointee" } + !$acc update self (pointee) ! { dg-error "Cray pointee" } + !$acc data copy (ptr) + !$acc end data + !$acc data deviceptr (ptr) ! { dg-error "Cray pointer" } + !$acc end data + !$acc parallel private (ptr) + !$acc end parallel + !$acc host_data use_device (ptr) ! { dg-error "Cray pointer" } + !$acc end host_data + !$acc parallel loop reduction(+:ptr) ! { dg-error "Cray pointer" } + do i = 1,5 + enddo + !$acc end parallel loop + !$acc parallel loop + do i = 1,5 + !TODO: This must fail, as in openacc-1_0-branch. + !$acc cache (ptr) ! { dg-error "" "TODO" { xfail *-*-* } } + enddo + !$acc end parallel loop + !$acc update device (ptr) + !$acc update host (ptr) + !$acc update self (ptr) + end subroutine oacc1 +end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/cray.f95 b/gcc/testsuite/gfortran.dg/goacc/cray.f95 index 705c18c992d..d6d531705a6 100644 --- a/gcc/testsuite/gfortran.dg/goacc/cray.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/cray.f95 @@ -1,5 +1,5 @@ -! { dg-do compile } ! { dg-additional-options "-fcray-pointer" } +! See also cray-2.f95. module test contains @@ -8,8 +8,8 @@ contains integer :: i real :: pointee pointer (ptr, pointee) - !$acc declare device_resident (pointee) - !$acc declare device_resident (ptr) + !$acc declare device_resident (pointee) + !$acc declare device_resident (ptr) !$acc data copy (pointee) ! { dg-error "Cray pointee" } !$acc end data !$acc data deviceptr (pointee) ! { dg-error "Cray pointee" } diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-1-2.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-1-2.f95 new file mode 100644 index 00000000000..79665b948c3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/loop-1-2.f95 @@ -0,0 +1,176 @@ +! See also loop-1.f95. + +program test + call test1 +contains + +subroutine test1 + integer :: i, j, k, b(10) + integer, dimension (30) :: a + double precision :: d + real :: r + i = 0 + !$acc loop + do 100 ! { dg-error "cannot be a DO WHILE or DO without loop control" } + if (i .gt. 0) exit ! { dg-error "EXIT statement" } + 100 i = i + 1 + i = 0 + !$acc loop + do ! { dg-error "cannot be a DO WHILE or DO without loop control" } + if (i .gt. 0) exit ! { dg-error "EXIT statement" } + i = i + 1 + end do + i = 0 + !$acc loop + do 200 while (i .lt. 4) ! { dg-error "cannot be a DO WHILE or DO without loop control" } + 200 i = i + 1 + !$acc loop + do while (i .lt. 8) ! { dg-error "cannot be a DO WHILE or DO without loop control" } + i = i + 1 + end do + !$acc loop + do 300 d = 1, 30, 6 + i = d + 300 a(i) = 1 + ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 32 } + ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 32 } + !$acc loop + do d = 1, 30, 5 + i = d + a(i) = 2 + end do + ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 38 } + ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 38 } + !$acc loop + do i = 1, 30 + if (i .eq. 16) exit ! { dg-error "EXIT statement" } + end do + !$acc loop + outer: do i = 1, 30 + do j = 5, 10 + if (i .eq. 6 .and. j .eq. 7) exit outer ! { dg-error "EXIT statement" } + end do + end do outer + last: do i = 1, 30 + end do last + + ! different types of loop are allowed + !$acc loop + do i = 1,10 + end do + !$acc loop + do 400, i = 1,10 +400 a(i) = i + + ! after loop directive must be loop + !$acc loop + a(1) = 1 ! { dg-error "Expected DO loop" } + do i = 1,10 + enddo + + ! combined directives may be used with/without end + !$acc parallel loop + do i = 1,10 + enddo + !$acc parallel loop + do i = 1,10 + enddo + !$acc end parallel loop + !$acc kernels loop + do i = 1,10 + enddo + !$acc kernels loop + do i = 1,10 + enddo + !$acc end kernels loop + + !$acc kernels loop reduction(max:i) + do i = 1,10 + enddo + !$acc kernels + !$acc loop reduction(max:i) + do i = 1,10 + enddo + !$acc end kernels + + !$acc parallel loop collapse(0) ! { dg-error "constant positive integer" } + do i = 1,10 + enddo + + !$acc parallel loop collapse(-1) ! { dg-error "constant positive integer" } + do i = 1,10 + enddo + + !$acc parallel loop collapse(i) ! { dg-error "Constant expression required" } + do i = 1,10 + enddo + + !$acc parallel loop collapse(4) ! { dg-error "not enough DO loops for collapsed" } + do i = 1, 3 + do j = 4, 6 + do k = 5, 7 + a(i+j-k) = i + j + k + end do + end do + end do + !$acc parallel loop collapse(2) + do i = 1, 5, 2 + do j = i + 1, 7, i ! { dg-error "collapsed loops don.t form rectangular iteration space" } + end do + end do + !$acc parallel loop collapse(2) + do i = 1, 3 + do j = 4, 6 + end do + end do + !$acc parallel loop collapse(2) + do i = 1, 3 + do j = 4, 6 + end do + k = 4 + end do + !$acc parallel loop collapse(3-1) + do i = 1, 3 + do j = 4, 6 + end do + k = 4 + end do + !$acc parallel loop collapse(1+1) + do i = 1, 3 + do j = 4, 6 + end do + k = 4 + end do + !$acc parallel loop collapse(2) + do i = 1, 3 + do ! { dg-error "cannot be a DO WHILE or DO without loop control" } + end do + end do + !$acc parallel loop collapse(2) + do i = 1, 3 + do r = 4, 6 + end do + ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 151 } + ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 151 } + end do + + ! Both seq and independent are not allowed + !$acc loop independent seq ! { dg-error "SEQ conflicts with INDEPENDENT" } + do i = 1,10 + enddo + + + !$acc cache (a(1:10)) ! { dg-error "ACC CACHE directive must be inside of loop" } + + do i = 1,10 + !$acc cache(a(i:i+1)) + enddo + + do i = 1,10 + !$acc cache(a(i:i+1)) + a(i) = i + !$acc cache(a(i+2:i+2+1)) + enddo + +end subroutine test1 +end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 index a605f038926..5f81b7a1d19 100644 --- a/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/loop-1.f95 @@ -1,8 +1,10 @@ +! See also loop-1-2.f95. + module test implicit none contains -subroutine test1 +subroutine test1 integer :: i, j, k, b(10) integer, dimension (30) :: a double precision :: d @@ -30,15 +32,15 @@ subroutine test1 do 300 d = 1, 30, 6 i = d 300 a(i) = 1 - ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 30 } - ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 30 } + ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 32 } + ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 32 } !$acc loop do d = 1, 30, 5 i = d a(i) = 2 end do - ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 36 } - ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 36 } + ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 38 } + ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 38 } !$acc loop do i = 1, 30 if (i .eq. 16) exit ! { dg-error "EXIT statement" } @@ -53,7 +55,7 @@ subroutine test1 end do last ! different types of loop are allowed - !$acc loop + !$acc loop do i = 1,10 end do !$acc loop @@ -65,8 +67,8 @@ subroutine test1 a(1) = 1 ! { dg-error "Expected DO loop" } do i = 1,10 enddo - - ! combined directives may be used with/without end + + ! combined directives may be used with/without end !$acc parallel loop do i = 1,10 enddo @@ -82,11 +84,11 @@ subroutine test1 enddo !$acc end kernels loop - !$acc kernels loop reduction(max:i) + !$acc kernels loop reduction(max:i) do i = 1,10 enddo - !$acc kernels - !$acc loop reduction(max:i) + !$acc kernels + !$acc loop reduction(max:i) do i = 1,10 enddo !$acc end kernels @@ -118,7 +120,7 @@ subroutine test1 end do !$acc parallel loop collapse(2) do i = 1, 3 - do j = 4, 6 + do j = 4, 6 end do end do !$acc parallel loop collapse(2) @@ -148,8 +150,8 @@ subroutine test1 do i = 1, 3 do r = 4, 6 end do - ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 149 } - ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 149 } + ! { dg-warning "Deleted feature: Loop variable at .1. must be integer" "" { target *-*-* } 151 } + ! { dg-error "ACC LOOP iteration variable must be of type integer" "" { target *-*-* } 151 } end do ! Both seq and independent are not allowed diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-3-2.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-3-2.f95 new file mode 100644 index 00000000000..9be74a85919 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/loop-3-2.f95 @@ -0,0 +1,58 @@ +! { dg-additional-options "-std=f2008" } +! See also loop-3.f95. + +program test + call test1 +contains +subroutine test1 + implicit none + integer :: i, j + + ! !$acc end loop not required by spec + !$acc loop + do i = 1,5 + enddo + !$acc end loop ! { dg-warning "Redundant" } + + !$acc loop + do i = 1,5 + enddo + j = 1 + !$acc end loop ! { dg-error "Unexpected" } + + !$acc parallel + !$acc loop + do i = 1,5 + enddo + !$acc end parallel + !$acc end loop ! { dg-error "Unexpected" } + + ! OpenACC supports Fortran 2008 do concurrent statement + !$acc loop + do concurrent (i = 1:5) + end do + + !$acc loop + outer_loop: do i = 1, 5 + inner_loop: do j = 1,5 + if (i .eq. j) cycle outer_loop + if (i .ne. j) exit outer_loop ! { dg-error "EXIT statement" } + end do inner_loop + end do outer_loop + + outer_loop1: do i = 1, 5 + !$acc loop + inner_loop1: do j = 1,5 + if (i .eq. j) cycle outer_loop1 ! { dg-error "CYCLE statement" } + end do inner_loop1 + end do outer_loop1 + + !$acc loop collapse(2) + outer_loop2: do i = 1, 5 + inner_loop2: do j = 1,5 + if (i .eq. j) cycle outer_loop2 ! { dg-error "CYCLE statement" } + if (i .ne. j) exit outer_loop2 ! { dg-error "EXIT statement" } + end do inner_loop2 + end do outer_loop2 +end subroutine test1 +end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-3.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-3.f95 index 2a866c79234..30930f404f3 100644 --- a/gcc/testsuite/gfortran.dg/goacc/loop-3.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/loop-3.f95 @@ -1,10 +1,10 @@ -! { dg-do compile } ! { dg-additional-options "-std=f2008" } +! See also loop-3-2.f95. subroutine test1 implicit none integer :: i, j - + ! !$acc end loop not required by spec !$acc loop do i = 1,5 @@ -23,7 +23,7 @@ subroutine test1 enddo !$acc end parallel !$acc end loop ! { dg-error "Unexpected" } - + ! OpenACC supports Fortran 2008 do concurrent statement !$acc loop do concurrent (i = 1:5) @@ -35,7 +35,7 @@ subroutine test1 if (i .eq. j) cycle outer_loop if (i .ne. j) exit outer_loop ! { dg-error "EXIT statement" } end do inner_loop - end do outer_loop + end do outer_loop outer_loop1: do i = 1, 5 !$acc loop @@ -50,6 +50,5 @@ subroutine test1 if (i .eq. j) cycle outer_loop2 ! { dg-error "CYCLE statement" } if (i .ne. j) exit outer_loop2 ! { dg-error "EXIT statement" } end do inner_loop2 - end do outer_loop2 + end do outer_loop2 end subroutine test1 - diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 new file mode 100644 index 00000000000..2fcaa400ee3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 @@ -0,0 +1,93 @@ +! Exercise nested function decomposition, gcc/tree-nested.c. +! See gcc/testsuite/gcc.dg/goacc/nested-function-1.c for the C version. + +program main + integer, parameter :: N = 100 + integer :: nonlocal_arg + integer :: nonlocal_a(N) + integer :: nonlocal_i + integer :: nonlocal_j + + nonlocal_a (:) = 5 + nonlocal_arg = 5 + + call local () + call nonlocal () + +contains + + subroutine local () + integer :: local_i + integer :: local_arg + integer :: local_a(N) + integer :: local_j + + local_a (:) = 5 + local_arg = 5 + + !$acc kernels loop & + !$acc gang(num:local_arg) worker(local_arg) vector(local_arg) & + !$acc wait async(local_arg) + do local_i = 1, N + !$acc cache (local_a(local_i:local_i + 5)) + local_a(local_i) = 100 + !$acc loop seq tile(*) + do local_j = 1, N + enddo + !$acc loop auto independent tile(1) + do local_j = 1, N + enddo + enddo + !$acc end kernels loop + + !$acc kernels loop & + !$acc gang(static:local_arg) worker(local_arg) vector(local_arg) & + !$acc wait(local_arg, local_arg + 1, local_arg + 2) async + do local_i = 1, N + !$acc cache (local_a(local_i:local_i + 4)) + local_a(local_i) = 100 + !$acc loop seq tile(1) + do local_j = 1, N + enddo + !$acc loop auto independent tile(*) + do local_j = 1, N + enddo + enddo + !$acc end kernels loop + end subroutine local + + subroutine nonlocal () + nonlocal_a (:) = 5 + nonlocal_arg = 5 + + !$acc kernels loop & + !$acc gang(num:nonlocal_arg) worker(nonlocal_arg) vector(nonlocal_arg) & + !$acc wait async(nonlocal_arg) + do nonlocal_i = 1, N + !$acc cache (nonlocal_a(nonlocal_i:nonlocal_i + 3)) + nonlocal_a(nonlocal_i) = 100 + !$acc loop seq tile(2) + do nonlocal_j = 1, N + enddo + !$acc loop auto independent tile(3) + do nonlocal_j = 1, N + enddo + enddo + !$acc end kernels loop + + !$acc kernels loop & + !$acc gang(static:nonlocal_arg) worker(nonlocal_arg) vector(nonlocal_arg) & + !$acc wait(nonlocal_arg, nonlocal_arg + 1, nonlocal_arg + 2) async + do nonlocal_i = 1, N + !$acc cache (nonlocal_a(nonlocal_i:nonlocal_i + 2)) + nonlocal_a(nonlocal_i) = 100 + !$acc loop seq tile(*) + do nonlocal_j = 1, N + enddo + !$acc loop auto independent tile(*) + do nonlocal_j = 1, N + enddo + enddo + !$acc end kernels loop + end subroutine nonlocal +end program main diff --git a/gcc/testsuite/gfortran.dg/goacc/subroutines.f90 b/gcc/testsuite/gfortran.dg/goacc/subroutines.f90 deleted file mode 100644 index 6cab798d458..00000000000 --- a/gcc/testsuite/gfortran.dg/goacc/subroutines.f90 +++ /dev/null @@ -1,73 +0,0 @@ -! Exercise how tree-nested.c handles gang, worker vector and seq. - -! { dg-do compile } - -program main - integer, parameter :: N = 100 - integer :: nonlocal_arg - integer :: nonlocal_a(N) - integer :: nonlocal_i - integer :: nonlocal_j - - nonlocal_a (:) = 5 - nonlocal_arg = 5 - - call local () - call nonlocal () - -contains - - subroutine local () - integer :: local_i - integer :: local_arg - integer :: local_a(N) - integer :: local_j - - local_a (:) = 5 - local_arg = 5 - - !$acc kernels loop gang(num:local_arg) worker(local_arg) vector(local_arg) - do local_i = 1, N - local_a(local_i) = 100 - !$acc loop seq - do local_j = 1, N - enddo - enddo - !$acc end kernels loop - - !$acc kernels loop gang(static:local_arg) worker(local_arg) & - !$acc vector(local_arg) - do local_i = 1, N - local_a(local_i) = 100 - !$acc loop seq - do local_j = 1, N - enddo - enddo - !$acc end kernels loop - end subroutine local - - subroutine nonlocal () - nonlocal_a (:) = 5 - nonlocal_arg = 5 - - !$acc kernels loop gang(num:nonlocal_arg) worker(nonlocal_arg) & - !$acc vector(nonlocal_arg) - do nonlocal_i = 1, N - nonlocal_a(nonlocal_i) = 100 - !$acc loop seq - do nonlocal_j = 1, N - enddo - enddo - !$acc end kernels loop - - !$acc kernels loop gang(static:nonlocal_arg) worker(nonlocal_arg) & - !$acc vector(nonlocal_arg) - do nonlocal_i = 1, N - nonlocal_a(nonlocal_i) = 100 - !$acc loop seq - do nonlocal_j = 1, N - enddo - enddo - !$acc end kernels loop - end subroutine nonlocal -end program main diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 25a92aaa04b..6fc63260000 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1114,6 +1114,8 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_GANG: case OMP_CLAUSE_WORKER: case OMP_CLAUSE_VECTOR: + case OMP_CLAUSE_ASYNC: + case OMP_CLAUSE_WAIT: /* Several OpenACC clauses have optional arguments. Check if they are present. */ if (OMP_CLAUSE_OPERAND (clause, 0)) @@ -1197,8 +1199,21 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_SIMD: case OMP_CLAUSE_DEFAULTMAP: case OMP_CLAUSE_SEQ: + case OMP_CLAUSE_INDEPENDENT: + case OMP_CLAUSE_AUTO: break; + case OMP_CLAUSE_TILE: + /* OpenACC tile clauses are discarded during gimplification, so we + don't expect to see anything here. */ + gcc_unreachable (); + + case OMP_CLAUSE__CACHE_: + /* These clauses belong to the OpenACC cache directive, which is + discarded during gimplification, so we don't expect to see + anything here. */ + gcc_unreachable (); + default: gcc_unreachable (); } @@ -1790,6 +1805,8 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_GANG: case OMP_CLAUSE_WORKER: case OMP_CLAUSE_VECTOR: + case OMP_CLAUSE_ASYNC: + case OMP_CLAUSE_WAIT: /* Several OpenACC clauses have optional arguments. Check if they are present. */ if (OMP_CLAUSE_OPERAND (clause, 0)) @@ -1878,8 +1895,21 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_SIMD: case OMP_CLAUSE_DEFAULTMAP: case OMP_CLAUSE_SEQ: + case OMP_CLAUSE_INDEPENDENT: + case OMP_CLAUSE_AUTO: break; + case OMP_CLAUSE_TILE: + /* OpenACC tile clauses are discarded during gimplification, so we + don't expect to see anything here. */ + gcc_unreachable (); + + case OMP_CLAUSE__CACHE_: + /* These clauses belong to the OpenACC cache directive, which is + discarded during gimplification, so we don't expect to see + anything here. */ + gcc_unreachable (); + default: gcc_unreachable (); } diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 5c7f41abf89..cf551f49384 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,13 @@ +2016-06-10 Thomas Schwinge + Cesar Philippidis + + PR middle-end/71373 + * libgomp.oacc-c/nested-function-1.c: New file. + * libgomp.oacc-c/nested-function-2.c: Likewise. + * libgomp.oacc-fortran/nested-function-1.f90: Likewise. + * libgomp.oacc-fortran/nested-function-2.f90: Likewise. + * libgomp.oacc-fortran/nested-function-3.f90: Likewise. + 2016-06-10 Thomas Schwinge PR c/71381 diff --git a/libgomp/testsuite/libgomp.oacc-c/nested-function-1.c b/libgomp/testsuite/libgomp.oacc-c/nested-function-1.c new file mode 100644 index 00000000000..fb2a3acdfa9 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c/nested-function-1.c @@ -0,0 +1,52 @@ +/* Exercise nested function decomposition, gcc/tree-nested.c. */ + +int +main (void) +{ + void test1 () + { + int i, j, k; + int a[4][7][8]; + + __builtin_memset (a, 0, sizeof (a)); + +#pragma acc parallel +#pragma acc loop collapse(4 - 1) + for (i = 1; i <= 3; i++) + for (j = 4; j <= 6; j++) + for (k = 5; k <= 7; k++) + a[i][j][k] = i + j + k; + + for (i = 1; i <= 3; i++) + for (j = 4; j <= 6; j++) + for (k = 5; k <= 7; k++) + if (a[i][j][k] != i + j + k) + __builtin_abort(); + } + + void test2 () + { + int i, j, k; + int a[4][4][4]; + + __builtin_memset (a, 0, sizeof (a)); + +#pragma acc parallel +#pragma acc loop collapse(3) + for (i = 1; i <= 3; i++) + for (j = 1; j <= 3; j++) + for (k = 1; k <= 3; k++) + a[i][j][k] = 1; + + for (i = 1; i <= 3; i++) + for (j = 1; j <= 3; j++) + for (k = 1; k <= 3; k++) + if (a[i][j][k] != 1) + __builtin_abort (); + } + + test1 (); + test2 (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.oacc-c/nested-function-2.c b/libgomp/testsuite/libgomp.oacc-c/nested-function-2.c new file mode 100644 index 00000000000..2c3f3feb7f8 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c/nested-function-2.c @@ -0,0 +1,155 @@ +/* Exercise nested function decomposition, gcc/tree-nested.c. */ + +int +main (void) +{ + int p1 = 2, p2 = 6, p3 = 0, p4 = 4, p5 = 13, p6 = 18, p7 = 1, p8 = 1, p9 = 1; + + void test1 () + { + int i, j, k; + int a[4][4][4]; + + __builtin_memset (a, '\0', sizeof (a)); + +#pragma acc parallel +#pragma acc loop collapse(3) + for (i = 1; i <= 3; i++) + for (j = 1; j <= 3; j++) + for (k = 2; k <= 3; k++) + a[i][j][k] = 1; + + for (i = 1; i <= 3; i++) + for (j = 1; j <= 3; j++) + for (k = 2; k <= 3; k++) + if (a[i][j][k] != 1) + __builtin_abort(); + } + + void test2 (int v1, int v2, int v3, int v4, int v5, int v6) + { + int i, j, k, l = 0, r = 0; + int a[7][5][19]; + int b[7][5][19]; + + __builtin_memset (a, '\0', sizeof (a)); + __builtin_memset (b, '\0', sizeof (b)); + +#pragma acc parallel reduction (||:l) +#pragma acc loop reduction (||:l) collapse(3) + for (i = v1; i <= v2; i++) + for (j = v3; j <= v4; j++) + for (k = v5; k <= v6; k++) + { + l = l || i < 2 || i > 6 || j < 0 || j > 4 || k < 13 || k > 18; + if (!l) + a[i][j][k] += 1; + } + + for (i = v1; i <= v2; i++) + for (j = v3; j <= v4; j++) + for (k = v5; k <= v6; k++) + { + r = r || i < 2 || i > 6 || j < 0 || j > 4 || k < 13 || k > 18; + if (!r) + b[i][j][k] += 1; + } + + if (l != r) + __builtin_abort (); + + for (i = v1; i <= v2; i++) + for (j = v3; j <= v4; j++) + for (k = v5; k <= v6; k++) + if (b[i][j][k] != a[i][j][k]) + __builtin_abort (); + } + + void test3 (int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, + int v9) + { + int i, j, k, l = 0, r = 0; + int a[7][5][19]; + int b[7][5][19]; + + __builtin_memset (a, '\0', sizeof (a)); + __builtin_memset (b, '\0', sizeof (b)); + +#pragma acc parallel reduction (||:l) +#pragma acc loop reduction (||:l) collapse(3) + for (i = v1; i <= v2; i += v7) + for (j = v3; j <= v4; j += v8) + for (k = v5; k <= v6; k += v9) + { + l = l || i < 2 || i > 6 || j < 0 || j > 4 || k < 13 || k > 18; + if (!l) + a[i][j][k] += 1; + } + + for (i = v1; i <= v2; i += v7) + for (j = v3; j <= v4; j += v8) + for (k = v5; k <= v6; k += v9) + { + r = r || i < 2 || i > 6 || j < 0 || j > 4 || k < 13 || k > 18; + if (!r) + b[i][j][k] += 1; + } + + if (l != r) + __builtin_abort (); + + for (i = v1; i <= v2; i++) + for (j = v3; j <= v4; j++) + for (k = v5; k <= v6; k++) + if (b[i][j][k] != a[i][j][k]) + __builtin_abort (); + } + + void test4 () + { + int i, j, k, l = 0, r = 0; + int a[7][5][19]; + int b[7][5][19]; + int v1 = p1, v2 = p2, v3 = p3, v4 = p4, v5 = p5, v6 = p6, v7 = p7, v8 = p8, + v9 = p9; + + __builtin_memset (a, '\0', sizeof (a)); + __builtin_memset (b, '\0', sizeof (b)); + +#pragma acc parallel reduction (||:l) +#pragma acc loop reduction (||:l) collapse(3) + for (i = v1; i <= v2; i += v7) + for (j = v3; j <= v4; j += v8) + for (k = v5; k <= v6; k += v9) + { + l = l || i < 2 || i > 6 || j < 0 || j > 4 || k < 13 || k > 18; + if (!l) + a[i][j][k] += 1; + } + + for (i = v1; i <= v2; i += v7) + for (j = v3; j <= v4; j += v8) + for (k = v5; k <= v6; k += v9) + { + r = r || i < 2 || i > 6 || j < 0 || j > 4 || k < 13 || k > 18; + if (!r) + b[i][j][k] += 1; + } + + if (l != r) + __builtin_abort (); + + for (i = v1; i <= v2; i++) + for (j = v3; j <= v4; j++) + for (k = v5; k <= v6; k++) + if (b[i][j][k] != a[i][j][k]) + __builtin_abort (); + } + + test1 (); + test2 (p1, p2, p3, p4, p5, p6); + test3 (p1, p2, p3, p4, p5, p6, p7, p8, p9); + test4 (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/nested-function-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/nested-function-1.f90 new file mode 100644 index 00000000000..fdbca4481f8 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/nested-function-1.f90 @@ -0,0 +1,70 @@ +! Exercise nested function decomposition, gcc/tree-nested.c. + +! { dg-do run } + +program collapse2 + call test1 + call test2 +contains + subroutine test1 + integer :: i, j, k, a(1:3, 4:6, 5:7) + logical :: l + l = .false. + a(:, :, :) = 0 + !$acc parallel reduction (.or.:l) + !$acc loop worker vector collapse(4 - 1) + do 164 i = 1, 3 + do 164 j = 4, 6 + do 164 k = 5, 7 + a(i, j, k) = i + j + k +164 end do + !$acc loop worker vector reduction(.or.:l) collapse(2) +firstdo: do i = 1, 3 + do j = 4, 6 + do k = 5, 7 + if (a(i, j, k) .ne. (i + j + k)) l = .true. + end do + end do + end do firstdo + !$acc end parallel + if (l) call abort + end subroutine test1 + + subroutine test2 + integer :: a(3,3,3), k, kk, kkk, l, ll, lll + a = 0 + !$acc parallel + ! Use "gang(static:1)" here and below to effectively turn gang-redundant + ! execution mode into something like gang-single. + !$acc loop gang(static:1) collapse(1) + do 115 k=1,3 + !$acc loop collapse(2) + dokk: do kk=1,3 + do kkk=1,3 + a(k,kk,kkk) = 1 + enddo + enddo dokk +115 continue + !$acc loop gang(static:1) collapse(1) + do k=1,3 + if (any(a(k,1:3,1:3).ne.1)) call abort + enddo + ! Use "gang(static:1)" here and below to effectively turn gang-redundant + ! execution mode into something like gang-single. + !$acc loop gang(static:1) collapse(1) + dol: do 120 l=1,3 + !$acc loop collapse(2) + doll: do ll=1,3 + do lll=1,3 + a(l,ll,lll) = 2 + enddo + enddo doll +120 end do dol + !$acc loop gang(static:1) collapse(1) + do l=1,3 + if (any(a(l,1:3,1:3).ne.2)) call abort + enddo + !$acc end parallel + end subroutine test2 + +end program collapse2 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/nested-function-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/nested-function-2.f90 new file mode 100644 index 00000000000..4e2819641ea --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/nested-function-2.f90 @@ -0,0 +1,173 @@ +! Exercise nested function decomposition, gcc/tree-nested.c. + +! { dg-do run } + +program collapse3 + integer :: p1, p2, p3, p4, p5, p6, p7, p8, p9 + p1 = 2 + p2 = 6 + p3 = -2 + p4 = 4 + p5 = 13 + p6 = 18 + p7 = 1 + p8 = 1 + p9 = 1 + call test1 + call test2 (p1, p2, p3, p4, p5, p6) + call test3 (p1, p2, p3, p4, p5, p6, p7, p8, p9) + call test4 +contains + subroutine test1 + integer :: a(3,3,3), k, kk, kkk, l, ll, lll + !$acc parallel + !$acc loop collapse(3) + do 115 k=1,3 +dokk: do kk=1,3 + do kkk=1,3 + a(k,kk,kkk) = 1 + enddo + enddo dokk +115 continue + !$acc end parallel + if (any(a(1:3,1:3,1:3).ne.1)) call abort + !$acc parallel + !$acc loop collapse(3) +dol: do 120 l=1,3 +doll: do ll=1,3 + do lll=1,3 + a(l,ll,lll) = 2 + enddo + enddo doll +120 end do dol + !$acc end parallel + if (any(a(1:3,1:3,1:3).ne.2)) call abort + end subroutine test1 + + subroutine test2(v1, v2, v3, v4, v5, v6) + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + !$acc parallel reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + end do + end do + end do + !$acc end parallel + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.l) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test2 + + subroutine test3(v1, v2, v3, v4, v5, v6, v7, v8, v9) + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + !$acc parallel reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + end do + end do + end do + !$acc end parallel + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.l) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test3 + + subroutine test4 + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + v1 = p1 + v2 = p2 + v3 = p3 + v4 = p4 + v5 = p5 + v6 = p6 + v7 = p7 + v8 = p8 + v9 = p9 + !$acc parallel reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + end do + end do + end do + !$acc end parallel + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.r) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test4 + +end program collapse3 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/nested-function-3.f90 b/libgomp/testsuite/libgomp.oacc-fortran/nested-function-3.f90 new file mode 100644 index 00000000000..2f6485ef8cf --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/nested-function-3.f90 @@ -0,0 +1,244 @@ +! Exercise nested function decomposition, gcc/tree-nested.c. + +! { dg-do run } + +program sub_collapse_3 + call test1 + call test2 (2, 6, -2, 4, 13, 18) + call test3 (2, 6, -2, 4, 13, 18, 1, 1, 1) + call test4 + call test5 (2, 6, -2, 4, 13, 18) + call test6 (2, 6, -2, 4, 13, 18, 1, 1, 1) +contains + subroutine test1 + integer :: a(3,3,3), k, kk, kkk, l, ll, lll + !$acc parallel + !$acc loop collapse(3) + do 115 k=1,3 +dokk: do kk=1,3 + do kkk=1,3 + a(k,kk,kkk) = 1 + enddo + enddo dokk +115 continue + !$acc end parallel + if (any(a(1:3,1:3,1:3).ne.1)) call abort + !$acc parallel + !$acc loop collapse(3) +dol: do 120 l=1,3 +doll: do ll=1,3 + do lll=1,3 + a(l,ll,lll) = 2 + enddo + enddo doll +120 end do dol + !$acc end parallel + if (any(a(1:3,1:3,1:3).ne.2)) call abort + end subroutine test1 + + subroutine test2(v1, v2, v3, v4, v5, v6) + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + !$acc parallel pcopyin (v1, v2, v3, v4, v5, v6) reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + end do + end do + end do + !$acc end parallel + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.l) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test2 + + subroutine test3(v1, v2, v3, v4, v5, v6, v7, v8, v9) + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + !$acc parallel pcopyin (v1, v2, v3, v4, v5, v6, v7, v8, v9) reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + end do + end do + end do + !$acc end parallel + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.l) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test3 + + subroutine test4 + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + v1 = 2 + v2 = 6 + v3 = -2 + v4 = 4 + v5 = 13 + v6 = 18 + v7 = 1 + v8 = 1 + v9 = 1 + !$acc parallel pcopyin (v1, v2, v3, v4, v5, v6, v7, v8, v9) reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + end do + end do + end do + !$acc end parallel + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.r) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test4 + + subroutine test5(v1, v2, v3, v4, v5, v6) + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + !$acc parallel pcopyin (v1, v2, v3, v4, v5, v6) reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + end do + end do + end do + !$acc end parallel + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.r) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2 + do j = v3, v4 + do k = v5, v6 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test5 + + subroutine test6(v1, v2, v3, v4, v5, v6, v7, v8, v9) + integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) + integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9 + logical :: l, r + l = .false. + r = .false. + a(:, :, :) = 0 + b(:, :, :) = 0 + !$acc parallel pcopyin (v1, v2, v3, v4, v5, v6, v7, v8, v9) reduction (.or.:l) + !$acc loop reduction (.or.:l) collapse (3) + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + l = l.or.k.lt.13.or.k.gt.18 + if (.not.l) a(i, j, k) = a(i, j, k) + 1 + m = i * 100 + j * 10 + k + end do + end do + end do + !$acc end parallel + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 + r = r.or.k.lt.13.or.k.gt.18 + if (.not.r) b(i, j, k) = b(i, j, k) + 1 + end do + end do + end do + if (l .neqv. r) call abort + do i = v1, v2, v7 + do j = v3, v4, v8 + do k = v5, v6, v9 + if (a(i, j, k) .ne. b(i, j, k)) call abort + end do + end do + end do + end subroutine test6 + +end program sub_collapse_3 -- cgit v1.2.3 From 3629337e63a5a4354af950b64da1d6d268fa930c Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Fri, 10 Jun 2016 09:23:53 +0000 Subject: libmpx/ 2016-06-10 Ilya Enkovich * mpxwrap/mpx_wrappers.c (move_bounds): Fix overflow bug. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237292 138bc75d-0d04-0410-961f-82ee72b054a4 --- libmpx/ChangeLog | 4 ++++ libmpx/mpxwrap/mpx_wrappers.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libmpx/ChangeLog b/libmpx/ChangeLog index 4d5858122dc..636e9651364 100644 --- a/libmpx/ChangeLog +++ b/libmpx/ChangeLog @@ -1,3 +1,7 @@ +2016-06-10 Ilya Enkovich + + * mpxwrap/mpx_wrappers.c (move_bounds): Fix overflow bug. + 2016-01-20 Matthias Klose * libtool-version: Remove. diff --git a/libmpx/mpxwrap/mpx_wrappers.c b/libmpx/mpxwrap/mpx_wrappers.c index d4c83ef484c..171a780311d 100644 --- a/libmpx/mpxwrap/mpx_wrappers.c +++ b/libmpx/mpxwrap/mpx_wrappers.c @@ -27,6 +27,7 @@ #include "string.h" #include #include +#include #include "mpxrt/mpxrt.h" void * @@ -418,7 +419,16 @@ move_bounds (void *dst, const void *src, size_t n) else elems_to_copy -= src_bt_index_end + 1; } - src_bd_index_end--; + /* Go to previous table but beware of overflow. + We should have copied all required element + in case src_bd_index_end is 0. */ + if (src_bd_index_end) + src_bd_index_end--; + else + { + assert (!elems_to_copy); + return; + } /* For each bounds table we check if there are valid pointers inside. If there are some, we copy table in pre-counted portions. */ for (; src_bd_index_end > src_bd_index; src_bd_index_end--) -- cgit v1.2.3 From a2fffe3357e3ad790f3ed6e02fa9256b667710ae Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 10 Jun 2016 11:44:47 +0000 Subject: 2016-06-10 Richard Biener * gimple-fold.c (gimple_fold_builtin_memory_op): Make sure to fold the RHS to a constant if possible. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237301 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/gimple-fold.c | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9cab3118d65..5038f751ae3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Richard Biener + + * gimple-fold.c (gimple_fold_builtin_memory_op): Make sure + to fold the RHS to a constant if possible. + 2016-06-10 Thomas Schwinge PR middle-end/71373 diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 600aa72f217..885367e9114 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1020,14 +1020,20 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, gimple *new_stmt; if (is_gimple_reg_type (TREE_TYPE (srcvar))) { - new_stmt = gimple_build_assign (NULL_TREE, srcvar); - if (gimple_in_ssa_p (cfun)) - srcvar = make_ssa_name (TREE_TYPE (srcvar), new_stmt); - else - srcvar = create_tmp_reg (TREE_TYPE (srcvar)); - gimple_assign_set_lhs (new_stmt, srcvar); - gimple_set_vuse (new_stmt, gimple_vuse (stmt)); - gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); + tree tem = fold_const_aggregate_ref (srcvar); + if (tem) + srcvar = tem; + if (! is_gimple_min_invariant (srcvar)) + { + new_stmt = gimple_build_assign (NULL_TREE, srcvar); + if (gimple_in_ssa_p (cfun)) + srcvar = make_ssa_name (TREE_TYPE (srcvar), new_stmt); + else + srcvar = create_tmp_reg (TREE_TYPE (srcvar)); + gimple_assign_set_lhs (new_stmt, srcvar); + gimple_set_vuse (new_stmt, gimple_vuse (stmt)); + gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); + } } new_stmt = gimple_build_assign (destvar, srcvar); gimple_set_vuse (new_stmt, gimple_vuse (stmt)); -- cgit v1.2.3 From 468bfaf68bd65c1a41ef8df7aee0b7111ce4b0f0 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 10 Jun 2016 11:45:39 +0000 Subject: 2016-06-10 Richard Biener * targhooks.c (default_builtin_vectorization_cost): Adjust vec_construct cost. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237302 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/targhooks.c | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5038f751ae3..580dbed12c3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Richard Biener + + * targhooks.c (default_builtin_vectorization_cost): Adjust + vec_construct cost. + 2016-06-10 Richard Biener * gimple-fold.c (gimple_fold_builtin_memory_op): Make sure diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 95980f547bd..3e089e759ce 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -564,8 +564,6 @@ default_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, tree vectype, int misalign ATTRIBUTE_UNUSED) { - unsigned elements; - switch (type_of_cost) { case scalar_stmt: @@ -589,8 +587,7 @@ default_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, return 3; case vec_construct: - elements = TYPE_VECTOR_SUBPARTS (vectype); - return elements / 2 + 1; + return TYPE_VECTOR_SUBPARTS (vectype) - 1; default: gcc_unreachable (); -- cgit v1.2.3 From 39f7eab64cfe20fc86e776b37ed8155b06129768 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Fri, 10 Jun 2016 12:22:21 +0000 Subject: gcc: 2016-06-10 Bernd Edlinger PR inline-asm/68843 * reg-stack.c (check_asm_stack_operands): Explicit input arguments must be grouped on top of stack. Don't force early clobber on ordinary reg outputs. testsuite: 2016-06-10 Bernd Edlinger PR inline-asm/68843 * gcc.target/i386/pr68843-1.c: New test. * gcc.target/i386/pr68843-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237303 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/reg-stack.c | 26 +++++++++++++++++++++++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.target/i386/pr68843-1.c | 12 ++++++++++++ gcc/testsuite/gcc.target/i386/pr68843-2.c | 22 ++++++++++++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr68843-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr68843-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 580dbed12c3..d9852c5a25b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-10 Bernd Edlinger + + PR inline-asm/68843 + * reg-stack.c (check_asm_stack_operands): Explicit input arguments + must be grouped on top of stack. Don't force early clobber + on ordinary reg outputs. + 2016-06-10 Richard Biener * targhooks.c (default_builtin_vectorization_cost): Adjust diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 89a7a11e0bc..c931349f0f4 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -97,6 +97,9 @@ All implicitly popped input regs must be closer to the top of the reg-stack than any input that is not implicitly popped. + All explicitly referenced input operands may not "skip" a reg. + Otherwise we can have holes in the stack. + 3. It is possible that if an input dies in an insn, reload might use the input reg for an output reload. Consider this example: @@ -461,6 +464,7 @@ check_asm_stack_operands (rtx_insn *insn) char reg_used_as_output[FIRST_PSEUDO_REGISTER]; char implicitly_dies[FIRST_PSEUDO_REGISTER]; + char explicitly_used[FIRST_PSEUDO_REGISTER]; rtx *clobber_reg = 0; int n_inputs, n_outputs; @@ -568,6 +572,7 @@ check_asm_stack_operands (rtx_insn *insn) popped. */ memset (implicitly_dies, 0, sizeof (implicitly_dies)); + memset (explicitly_used, 0, sizeof (explicitly_used)); for (i = n_outputs; i < n_outputs + n_inputs; i++) if (STACK_REG_P (recog_data.operand[i])) { @@ -581,6 +586,8 @@ check_asm_stack_operands (rtx_insn *insn) if (j < n_clobbers || op_alt[i].matches >= 0) implicitly_dies[REGNO (recog_data.operand[i])] = 1; + else if (reg_class_size[(int) op_alt[i].cl] == 1) + explicitly_used[REGNO (recog_data.operand[i])] = 1; } /* Search for first non-popped reg. */ @@ -600,6 +607,23 @@ check_asm_stack_operands (rtx_insn *insn) malformed_asm = 1; } + /* Search for first not-explicitly used reg. */ + for (i = FIRST_STACK_REG; i < LAST_STACK_REG + 1; i++) + if (! implicitly_dies[i] && ! explicitly_used[i]) + break; + + /* If there are any other explicitly used regs, that's an error. */ + for (; i < LAST_STACK_REG + 1; i++) + if (explicitly_used[i]) + break; + + if (i != LAST_STACK_REG + 1) + { + error_for_asm (insn, + "explicitly used regs must be grouped at top of stack"); + malformed_asm = 1; + } + /* Enforce rule #3: If any input operand uses the "f" constraint, all output constraints must use the "&" earlyclobber. @@ -607,7 +631,7 @@ check_asm_stack_operands (rtx_insn *insn) record any earlyclobber. */ for (i = n_outputs; i < n_outputs + n_inputs; i++) - if (op_alt[i].matches == -1) + if (STACK_REG_P (recog_data.operand[i]) && op_alt[i].matches == -1) { int j; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 325de75e271..07c63895c6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Bernd Edlinger + + PR inline-asm/68843 + * gcc.target/i386/pr68843-1.c: New test. + * gcc.target/i386/pr68843-2.c: New test. + 2016-06-10 Thomas Schwinge Cesar Philippidis diff --git a/gcc/testsuite/gcc.target/i386/pr68843-1.c b/gcc/testsuite/gcc.target/i386/pr68843-1.c new file mode 100644 index 00000000000..da0676aa69b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68843-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double +test () +{ + double x = 1.0; + asm ("fld %1" /* { dg-error "explicitly used regs must be grouped at top of stack" } */ + : "=&t" (x) + : "u" (x)); + return x; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68843-2.c b/gcc/testsuite/gcc.target/i386/pr68843-2.c new file mode 100644 index 00000000000..652a5d3ea45 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68843-2.c @@ -0,0 +1,22 @@ +int +__attribute__((noinline, noclone)) +test (double y) +{ + int a, b; + asm ("fistpl (%1)\n\t" + "movl (%1), %0" + : "=r" (a) + : "r" (&b), "t" (y) + : "st"); + return a; +} + +int +main () +{ + int t = -10; + + if (test (t) != t) + __builtin_abort (); + return 0; +} -- cgit v1.2.3 From 3ca898220399656ecbbf38c2f2c335bd313b39e3 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 10 Jun 2016 12:38:16 +0000 Subject: Use __USER_LABEL_PREFIX__ in asm statement A target may have a prefix in function symbol. Update interrrupt tests to use __USER_LABEL_PREFIX__ for function symbol in asm statement. * gcc.dg/guality/pr68037-1.c (ASMNAME): New. (ASMNAME2): Likewise. (main): Replace fn in asm statement with ASMNAME ("fn"). * gcc.dg/guality/pr68037-2.c: Likewise. * gcc.dg/guality/pr68037-3.c: Likewise. * gcc.dg/torture/pr68037-1.c: Likewise. * gcc.dg/torture/pr68037-2.c: Likewise. * gcc.dg/torture/pr68037-3.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237304 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/gcc.dg/guality/pr68037-1.c | 4 +++- gcc/testsuite/gcc.dg/guality/pr68037-2.c | 4 +++- gcc/testsuite/gcc.dg/guality/pr68037-3.c | 4 +++- gcc/testsuite/gcc.dg/torture/pr68037-1.c | 4 +++- gcc/testsuite/gcc.dg/torture/pr68037-2.c | 4 +++- gcc/testsuite/gcc.dg/torture/pr68037-3.c | 4 +++- 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 07c63895c6e..2e640a5b189 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-06-10 H.J. Lu + + * gcc.dg/guality/pr68037-1.c (ASMNAME): New. + (ASMNAME2): Likewise. + (main): Replace fn in asm statement with ASMNAME ("fn"). + * gcc.dg/guality/pr68037-2.c: Likewise. + * gcc.dg/guality/pr68037-3.c: Likewise. + * gcc.dg/torture/pr68037-1.c: Likewise. + * gcc.dg/torture/pr68037-2.c: Likewise. + * gcc.dg/torture/pr68037-3.c: Likewise. + 2016-06-10 Bernd Edlinger PR inline-asm/68843 diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-1.c b/gcc/testsuite/gcc.dg/guality/pr68037-1.c index c3ea645e92c..74f61ec5f96 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68037-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr68037-1.c @@ -14,6 +14,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__))); #define STRING(x) XSTRING(x) #define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname struct interrupt_frame { @@ -53,7 +55,7 @@ main () push $" STRING (CS) "; \ push $" STRING (IP) "; \ push $" STRING (ERROR) "; \ - jmp fn"); + jmp " ASMNAME ("fn")); return 0; } diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-2.c b/gcc/testsuite/gcc.dg/guality/pr68037-2.c index 6f7e920d106..c3cd73d2a65 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68037-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr68037-2.c @@ -13,6 +13,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__))); #define STRING(x) XSTRING(x) #define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname struct interrupt_frame { @@ -49,7 +51,7 @@ main () push $" STRING (FLAGS) "; \ push $" STRING (CS) "; \ push $" STRING (IP) "; \ - jmp fn"); + jmp " ASMNAME ("fn")); return 0; } diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-3.c b/gcc/testsuite/gcc.dg/guality/pr68037-3.c index 504a931eb33..6e054720f47 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68037-3.c +++ b/gcc/testsuite/gcc.dg/guality/pr68037-3.c @@ -16,6 +16,8 @@ typedef int aligned __attribute__((aligned(64))); #define STRING(x) XSTRING(x) #define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname struct interrupt_frame { @@ -65,7 +67,7 @@ main () push $" STRING (FLAGS) "; \ push $" STRING (CS) "; \ push $" STRING (IP) "; \ - jmp fn"); + jmp " ASMNAME ("fn")); return 0; } diff --git a/gcc/testsuite/gcc.dg/torture/pr68037-1.c b/gcc/testsuite/gcc.dg/torture/pr68037-1.c index 15fe08c156f..23d7c6f397a 100644 --- a/gcc/testsuite/gcc.dg/torture/pr68037-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr68037-1.c @@ -14,6 +14,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__))); #define STRING(x) XSTRING(x) #define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname struct interrupt_frame { @@ -53,6 +55,6 @@ main () push $" STRING (CS) "; \ push $" STRING (IP) "; \ push $" STRING (ERROR) "; \ - jmp fn"); + jmp " ASMNAME ("fn")); return 0; } diff --git a/gcc/testsuite/gcc.dg/torture/pr68037-2.c b/gcc/testsuite/gcc.dg/torture/pr68037-2.c index 00ba7d45464..18f98442ceb 100644 --- a/gcc/testsuite/gcc.dg/torture/pr68037-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr68037-2.c @@ -13,6 +13,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__))); #define STRING(x) XSTRING(x) #define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname struct interrupt_frame { @@ -49,6 +51,6 @@ main () push $" STRING (FLAGS) "; \ push $" STRING (CS) "; \ push $" STRING (IP) "; \ - jmp fn"); + jmp " ASMNAME ("fn")); return 0; } diff --git a/gcc/testsuite/gcc.dg/torture/pr68037-3.c b/gcc/testsuite/gcc.dg/torture/pr68037-3.c index abf8adbc734..86324f1a8fb 100644 --- a/gcc/testsuite/gcc.dg/torture/pr68037-3.c +++ b/gcc/testsuite/gcc.dg/torture/pr68037-3.c @@ -16,6 +16,8 @@ typedef int aligned __attribute__((aligned(64))); #define STRING(x) XSTRING(x) #define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname struct interrupt_frame { @@ -65,6 +67,6 @@ main () push $" STRING (FLAGS) "; \ push $" STRING (CS) "; \ push $" STRING (IP) "; \ - jmp fn"); + jmp " ASMNAME ("fn")); return 0; } -- cgit v1.2.3 From 1e1723dac3960a271550af1f741da209feb3142d Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 10 Jun 2016 12:46:30 +0000 Subject: * profile.c: Include cfgloop.h. (branch_prob): Compute estimated number of iterations. * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Do not recompute estimate number of iterations from profile. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237305 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/profile.c | 13 +++++++++++++ gcc/tree-ssa-loop-niter.c | 33 ++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d9852c5a25b..954adf37947 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-10 Jan Hubicka + + * profile.c: Include cfgloop.h. + (branch_prob): Compute estimated number of iterations. + * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Do not + recompute estimate number of iterations from profile. + 2016-06-10 Bernd Edlinger PR inline-asm/68843 diff --git a/gcc/profile.c b/gcc/profile.c index 9925bb568c6..4519e7d8558 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-iterator.h" #include "tree-cfg.h" #include "dumpfile.h" +#include "cfgloop.h" #include "profile.h" @@ -1329,9 +1330,21 @@ branch_prob (void) coverage_end_function (lineno_checksum, cfg_checksum); if (flag_branch_probabilities && profile_info) { + struct loop *loop; if (dump_file && (dump_flags & TDF_DETAILS)) report_predictor_hitrates (); profile_status_for_fn (cfun) = PROFILE_READ; + + /* At this moment we have precise loop iteration count estimates. + Record them to loop structure before the profile gets out of date. */ + FOR_EACH_LOOP (loop, 0) + if (loop->header->count) + { + gcov_type nit = expected_loop_iterations_unbounded (loop); + widest_int bound = gcov_type_to_wide_int (nit); + loop->any_estimate = false; + record_niter_bound (loop, bound, true, false); + } compute_function_frequency (); } } diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 78040364a97..32fe2f91edd 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3721,8 +3721,26 @@ estimate_numbers_of_iterations_loop (struct loop *loop) return; loop->estimate_state = EST_AVAILABLE; - /* Force estimate compuation but leave any existing upper bound in place. */ - loop->any_estimate = false; + + /* If we have a measured profile, use it to estimate the number of + iterations. Normally this is recorded by branch_prob right after + reading the profile. In case we however found a new loop, record the + information here. + + Explicitly check for profile status so we do not report + wrong prediction hitrates for guessed loop iterations heuristics. + Do not recompute already recorded bounds - we ought to be better on + updating iteration bounds than updating profile in general and thus + recomputing iteration bounds later in the compilation process will just + introduce random roundoff errors. */ + if (!loop->any_estimate + && loop->header->count != 0 + && profile_status_for_fn (cfun) >= PROFILE_READ) + { + gcov_type nit = expected_loop_iterations_unbounded (loop); + bound = gcov_type_to_wide_int (nit); + record_niter_bound (loop, bound, true, false); + } /* Ensure that loop->nb_iterations is computed if possible. If it turns out to be constant, we avoid undefined behavior implied bounds and instead @@ -3756,17 +3774,6 @@ estimate_numbers_of_iterations_loop (struct loop *loop) maybe_lower_iteration_bound (loop); - /* If we have a measured profile, use it to estimate the number of - iterations. Explicitly check for profile status so we do not report - wrong prediction hitrates for guessed loop iterations heuristics. */ - if (loop->header->count != 0 - && profile_status_for_fn (cfun) >= PROFILE_READ) - { - gcov_type nit = expected_loop_iterations_unbounded (loop); - bound = gcov_type_to_wide_int (nit); - record_niter_bound (loop, bound, true, false); - } - /* If we know the exact number of iterations of this loop, try to not break code with undefined behavior by not recording smaller maximum number of iterations. */ -- cgit v1.2.3 From 9261e301dd59a8ab1a92a91818896934653b5259 Mon Sep 17 00:00:00 2001 From: Maxim Ostapenko Date: Fri, 10 Jun 2016 12:57:14 +0000 Subject: 2016-06-10 Maxim Ostapenko PR sanitizer/71480 * varasm.c (place_block_symbol): Adjust alignment for asan protected STRING_CSTs even if TREE_CONSTANT_POOL_ADDRESS_P. * c-c++-common/asan/pr71480.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237306 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 +++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/c-c++-common/asan/pr71480.c | 42 +++++++++++++++++++++++++++++++ gcc/varasm.c | 6 ++++- 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/asan/pr71480.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 954adf37947..73ba814f135 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Maxim Ostapenko + + PR sanitizer/71480 + * varasm.c (place_block_symbol): Adjust alignment for asan protected + STRING_CSTs even if TREE_CONSTANT_POOL_ADDRESS_P. + 2016-06-10 Jan Hubicka * profile.c: Include cfgloop.h. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2e640a5b189..19f37934023 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Maxim Ostapenko + + PR sanitizer/71480 + * c-c++-common/asan/pr71480.c: New test. + 2016-06-10 H.J. Lu * gcc.dg/guality/pr68037-1.c (ASMNAME): New. diff --git a/gcc/testsuite/c-c++-common/asan/pr71480.c b/gcc/testsuite/c-c++-common/asan/pr71480.c new file mode 100644 index 00000000000..c23ea5385b4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pr71480.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ + +__attribute__ ((noinline, noclone)) int +foo (char *c) +{ + asm volatile ("" : : "r" (c) : "memory"); + return 1; +} + +__attribute__ ((noinline, noclone)) void +bar (char *c) +{ + asm volatile ("" : : "r" (c) : "memory"); +} + +int main () +{ + char tpl[20] = "/tmp/test.XXXXXX"; + char tpl2[20] = "/tmp/test.XXXXXX"; + int fd = foo (tpl); + int fd2 = foo (tpl2); + if (fd == -1) + { + if (fd2 != -1) + bar (tpl2); + return 1; + } + + if (fd2 == -1) + return 1; + + bar (tpl); + bar (tpl2); + + if (__builtin_strcmp (tpl, "/tmp/test.XXXXXX") != 0) + return 1; + + if (__builtin_strcmp (tpl, tpl2) != 0) + return 1; + + return 0; +} diff --git a/gcc/varasm.c b/gcc/varasm.c index 4a7124e73be..de8bcd6f20c 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -7201,7 +7201,11 @@ place_block_symbol (rtx symbol) if ((flag_sanitize & SANITIZE_ADDRESS) && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST && asan_protect_global (DECL_INITIAL (decl))) - size += asan_red_zone_size (size); + { + size += asan_red_zone_size (size); + alignment = MAX (alignment, + ASAN_RED_ZONE_SIZE * BITS_PER_UNIT); + } } else { -- cgit v1.2.3 From 3a9f27f4c93761a75c2a14fed0e592ead0d966cf Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Fri, 10 Jun 2016 12:58:53 +0000 Subject: * match.pd (-1 / B < A): Use :c to avoid pattern duplication. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237307 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/match.pd | 14 ++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 73ba814f135..9696ad1b7a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-10 Alexander Monakov + + * match.pd (-1 / B < A): Use :c to avoid pattern duplication. + 2016-06-10 Maxim Ostapenko PR sanitizer/71480 diff --git a/gcc/match.pd b/gcc/match.pd index fe711159df9..7d4beeaa4ed 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2626,22 +2626,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && types_match (TREE_TYPE (@0), TREE_TYPE (@1))) (out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); })))) -/* For unsigned operands, A > -1 / B checks whether A * B would overflow. +/* For unsigned operands, -1 / B < A checks whether A * B would overflow. Simplify it to __builtin_mul_overflow (A, B, ). */ -/* -1 / B < A */ (for cmp (lt ge) out (ne eq) (simplify - (cmp (trunc_div:s integer_all_onesp @1) @0) - (if (TYPE_UNSIGNED (TREE_TYPE (@0)) && !VECTOR_TYPE_P (TREE_TYPE (@0))) - (with { tree t = TREE_TYPE (@0), cpx = build_complex_type (t); } - (out (imagpart (IFN_MUL_OVERFLOW:cpx @0 @1)) { build_zero_cst (t); }))))) - -/* A > -1 / B */ -(for cmp (gt le) - out (ne eq) - (simplify - (cmp @0 (trunc_div:s integer_all_onesp @1)) + (cmp:c (trunc_div:s integer_all_onesp @1) @0) (if (TYPE_UNSIGNED (TREE_TYPE (@0)) && !VECTOR_TYPE_P (TREE_TYPE (@0))) (with { tree t = TREE_TYPE (@0), cpx = build_complex_type (t); } (out (imagpart (IFN_MUL_OVERFLOW:cpx @0 @1)) { build_zero_cst (t); }))))) -- cgit v1.2.3 From 41d9ef5d6265230c434d70706e4a8b5b8ae883e6 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 10 Jun 2016 13:37:35 +0000 Subject: * gcc.target/arm/pr37780_1.c: Use arm_arch_v6t2 effective target and options. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237308 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/arm/pr37780_1.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 19f37934023..98224abb049 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Christophe Lyon + + * gcc.target/arm/pr37780_1.c: Use arm_arch_v6t2 effective target + and options. + 2016-06-10 Maxim Ostapenko PR sanitizer/71480 diff --git a/gcc/testsuite/gcc.target/arm/pr37780_1.c b/gcc/testsuite/gcc.target/arm/pr37780_1.c index b954fe5ceb8..8e069200e9f 100644 --- a/gcc/testsuite/gcc.target/arm/pr37780_1.c +++ b/gcc/testsuite/gcc.target/arm/pr37780_1.c @@ -2,8 +2,9 @@ being defined at zero. */ /* { dg-do compile } */ -/* { dg-require-effective-target arm_arch_v5_ok } */ +/* { dg-require-effective-target arm_arch_v6t2_ok } */ /* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v6t2 } */ int fooctz (int i) -- cgit v1.2.3 From 79fee93178591e8a00f4e0ce2ab47530c99659e9 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 10 Jun 2016 13:41:03 +0000 Subject: Add ggc-tests.c gcc/ChangeLog: * Makefile.in (OBJS): Add ggc-tests.o. (GTFILES): Add ggc-tests.c. * ggc-tests.c: New file. * selftest-run-tests.c (selftest::run_tests): Call selftest::ggc_tests_c_tests. * selftest.h (selftest::ggc_tests_c_tests): New prototype. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237309 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 + gcc/Makefile.in | 2 + gcc/ggc-tests.c | 523 +++++++++++++++++++++++++++++++++++++++++++++++ gcc/selftest-run-tests.c | 1 + gcc/selftest.h | 1 + 5 files changed, 536 insertions(+) create mode 100644 gcc/ggc-tests.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9696ad1b7a4..9be025e4c4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-06-10 David Malcolm + + * Makefile.in (OBJS): Add ggc-tests.o. + (GTFILES): Add ggc-tests.c. + * ggc-tests.c: New file. + * selftest-run-tests.c (selftest::run_tests): Call + selftest::ggc_tests_c_tests. + * selftest.h (selftest::ggc_tests_c_tests): New prototype. + 2016-06-10 Alexander Monakov * match.pd (-1 / B < A): Use :c to avoid pattern duplication. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index fdcc42aa309..776f6d7503b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1270,6 +1270,7 @@ OBJS = \ gcse.o \ gcse-common.o \ ggc-common.o \ + ggc-tests.o \ gimple.o \ gimple-builder.o \ gimple-expr.o \ @@ -2398,6 +2399,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/emit-rtl.c $(srcdir)/except.h $(srcdir)/explow.c $(srcdir)/expr.c \ $(srcdir)/expr.h \ $(srcdir)/function.c $(srcdir)/except.c \ + $(srcdir)/ggc-tests.c \ $(srcdir)/gcse.c $(srcdir)/godump.c \ $(srcdir)/lists.c $(srcdir)/optabs-libfuncs.c \ $(srcdir)/profile.c $(srcdir)/mcf.c \ diff --git a/gcc/ggc-tests.c b/gcc/ggc-tests.c new file mode 100644 index 00000000000..48eac03103b --- /dev/null +++ b/gcc/ggc-tests.c @@ -0,0 +1,523 @@ +/* Unit tests for GCC's garbage collector (and gengtype etc). + Copyright (C) 2015-2016 Free Software Foundation, Inc. + +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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree-core.h" +#include "tree.h" +#include "ggc-internal.h" /* (for ggc_force_collect). */ +#include "selftest.h" + +#if CHECKING_P + +/* The various GTY markers must be outside of a namespace to be seen by + gengtype, so we don't put this file within the selftest namespace. */ + +/* A helper function for writing ggc tests. */ + +static void +forcibly_ggc_collect () +{ + ggc_force_collect = true; + ggc_collect (); + ggc_force_collect = false; +} + + + +/* Verify that a simple struct works, and that it can + own references to non-roots, and have them be marked. */ + +struct GTY(()) test_struct +{ + struct test_struct *other; +}; + +static GTY(()) test_struct *root_test_struct; + +static void +test_basic_struct () +{ + root_test_struct = ggc_cleared_alloc (); + root_test_struct->other = ggc_cleared_alloc (); + + forcibly_ggc_collect (); + + ASSERT_TRUE (ggc_marked_p (root_test_struct)); + ASSERT_TRUE (ggc_marked_p (root_test_struct->other)); +} + + + +/* Selftest for GTY((length)). */ + +/* A test struct using GTY((length)). */ + +struct GTY(()) test_of_length +{ + int num_elem; + struct test_of_length * GTY ((length ("%h.num_elem"))) elem[1]; +}; + +static GTY(()) test_of_length *root_test_of_length; + +static void +test_length () +{ + const int count = 5; + size_t sz = sizeof (test_of_length) + (count- 1) * sizeof (test_of_length *); + root_test_of_length = (test_of_length *)ggc_internal_cleared_alloc (sz); + root_test_of_length->num_elem = count; + for (int i = 0; i < count; i++) + root_test_of_length->elem[i] = ggc_cleared_alloc (); + + forcibly_ggc_collect (); + + ASSERT_TRUE (ggc_marked_p (root_test_of_length)); + for (int i = 0; i < count; i++) + ASSERT_TRUE (ggc_marked_p (root_test_of_length->elem[i])); +} + + + +/* Selftest for unions, GTY((tag)), and GTY((desc)). */ + +/* A struct with a reference that's an a different offset to test_struct, + to ensure that we're using the correct types. */ + +struct GTY(()) test_other +{ + char dummy[256]; + test_struct *m_ptr; +}; + +enum which_field +{ + WHICH_FIELD_USE_TEST_STRUCT, + WHICH_FIELD_USE_TEST_OTHER +}; + +/* An example function for use by a GTY((desc)) marker. */ + +static enum which_field +calc_desc (int kind) +{ + switch (kind) + { + case 0: return WHICH_FIELD_USE_TEST_STRUCT; + case 1: return WHICH_FIELD_USE_TEST_OTHER; + default: + gcc_unreachable (); + } +} + +/* A struct containing an example of a union, showing the "tag" and + "desc" markers. */ + +struct GTY(()) test_of_union +{ + int m_kind; + union u { + test_struct * GTY ((tag ("WHICH_FIELD_USE_TEST_STRUCT") )) u_test_struct; + test_other * GTY ((tag ("WHICH_FIELD_USE_TEST_OTHER") )) u_test_other; + } GTY ((desc ("calc_desc (%0.m_kind)"))) m_u; +}; + +/* Example roots. */ + +static GTY(()) test_of_union *root_test_of_union_1; +static GTY(()) test_of_union *root_test_of_union_2; + +/* Verify that the above work correctly. */ + +static void +test_union () +{ + root_test_of_union_1 = ggc_cleared_alloc (); + root_test_of_union_1->m_kind = 0; + test_struct *ts = ggc_cleared_alloc (); + root_test_of_union_1->m_u.u_test_struct = ts; + + root_test_of_union_2 = ggc_cleared_alloc (); + root_test_of_union_2->m_kind = 1; + test_other *other = ggc_cleared_alloc (); + root_test_of_union_2->m_u.u_test_other = other; + test_struct *referenced_by_other = ggc_cleared_alloc (); + other->m_ptr = referenced_by_other; + + forcibly_ggc_collect (); + + ASSERT_TRUE (ggc_marked_p (root_test_of_union_1)); + ASSERT_TRUE (ggc_marked_p (ts)); + + ASSERT_TRUE (ggc_marked_p (root_test_of_union_2)); + ASSERT_TRUE (ggc_marked_p (other)); + ASSERT_TRUE (ggc_marked_p (referenced_by_other)); +} + + + +/* Verify that destructors get run when instances are collected. */ + +struct GTY(()) test_struct_with_dtor +{ + /* This struct has a destructor; it *ought* to be called + by the ggc machinery when instances are collected. */ + ~test_struct_with_dtor () { dtor_call_count++; } + + static int dtor_call_count; +}; + +int test_struct_with_dtor::dtor_call_count; + +static void +test_finalization () +{ + ASSERT_FALSE (need_finalization_p ()); + ASSERT_TRUE (need_finalization_p ()); + + /* Create some garbage. */ + const int count = 10; + for (int i = 0; i < count; i++) + ggc_cleared_alloc (); + + test_struct_with_dtor::dtor_call_count = 0; + + forcibly_ggc_collect (); + + /* Verify that the destructor was run for each instance. */ + ASSERT_EQ (count, test_struct_with_dtor::dtor_call_count); +} + + + +/* Verify that a global can be marked as "deletable". */ + +static GTY((deletable)) test_struct *test_of_deletable; + +static void +test_deletable_global () +{ + test_of_deletable = ggc_cleared_alloc (); + ASSERT_TRUE (test_of_deletable != NULL); + + forcibly_ggc_collect (); + + ASSERT_EQ (NULL, test_of_deletable); +} + + + +/* Verify that gengtype etc can cope with inheritance. */ + +class GTY((desc("%h.m_kind"), tag("0"))) example_base +{ + public: + example_base () + : m_kind (0), + m_a (ggc_cleared_alloc ()) + {} + + void * + operator new (size_t sz) + { + return ggc_internal_cleared_alloc (sz); + } + + protected: + example_base (int kind) + : m_kind (kind), + m_a (ggc_cleared_alloc ()) + {} + + public: + int m_kind; + test_struct *m_a; +}; + +class GTY((tag("1"))) some_subclass : public example_base +{ + public: + some_subclass () + : example_base (1), + m_b (ggc_cleared_alloc ()) + {} + + test_struct *m_b; +}; + +class GTY((tag("2"))) some_other_subclass : public example_base +{ + public: + some_other_subclass () + : example_base (2), + m_c (ggc_cleared_alloc ()) + {} + + test_struct *m_c; +}; + +/* Various test roots, both expressed as a ptr to the actual class, and + as a ptr to the base class. */ +static GTY(()) example_base *test_example_base; +static GTY(()) some_subclass *test_some_subclass; +static GTY(()) some_other_subclass *test_some_other_subclass; +static GTY(()) example_base *test_some_subclass_as_base_ptr; +static GTY(()) example_base *test_some_other_subclass_as_base_ptr; + +static void +test_inheritance () +{ + test_example_base = new example_base (); + test_some_subclass = new some_subclass (); + test_some_other_subclass = new some_other_subclass (); + test_some_subclass_as_base_ptr = new some_subclass (); + test_some_other_subclass_as_base_ptr = new some_other_subclass (); + + forcibly_ggc_collect (); + + /* Verify that the roots and everything referenced by them got marked + (both for fields in the base class and those in subclasses). */ + ASSERT_TRUE (ggc_marked_p (test_example_base)); + ASSERT_TRUE (ggc_marked_p (test_example_base->m_a)); + + ASSERT_TRUE (ggc_marked_p (test_some_subclass)); + ASSERT_TRUE (ggc_marked_p (test_some_subclass->m_a)); + ASSERT_TRUE (ggc_marked_p (test_some_subclass->m_b)); + + ASSERT_TRUE (ggc_marked_p (test_some_other_subclass)); + ASSERT_TRUE (ggc_marked_p (test_some_other_subclass->m_a)); + ASSERT_TRUE (ggc_marked_p (test_some_other_subclass->m_c)); + + ASSERT_TRUE (ggc_marked_p (test_some_subclass_as_base_ptr)); + ASSERT_TRUE (ggc_marked_p (test_some_subclass_as_base_ptr->m_a)); + ASSERT_TRUE (ggc_marked_p (((some_subclass *) + test_some_subclass_as_base_ptr)->m_b)); + + ASSERT_TRUE (ggc_marked_p (test_some_other_subclass_as_base_ptr)); + ASSERT_TRUE (ggc_marked_p (test_some_other_subclass_as_base_ptr->m_a)); + ASSERT_TRUE (ggc_marked_p (((some_other_subclass *) + test_some_other_subclass_as_base_ptr)->m_c)); +} + + + +/* Test of chain_next/chain_prev + + Construct a very long linked list, so that without + the chain_next/chain_prev optimization we'd have + a stack overflow when gt_ggc_mx_test_node recurses. */ + +struct GTY(( chain_next ("%h.m_next"), + chain_prev ("%h.m_prev") )) test_node +{ + test_node *m_prev; + test_node *m_next; + int m_idx; +}; + +static GTY(()) test_node *root_test_node; + +static void +test_chain_next () +{ + /* Ideally we would construct a long list so that the number of + stack frames would be deep enough to crash if gengtype has created + something that recurses. + + However, as the list is lengthened to increase the chance of + overflowing the stack, the test will require more time and memory + to run. On a Fedora 20 x86_64 box with 128GB of RAM, count=2000000 + without the chain_next optimization reliably overflowed the stack, + but the test took 0.5s to run. + + For now this test runs with a low value for "count", which defeats + the main purpose of the test - though it at least gives us coverage + for walking a GTY((chain_next)) list. + + We could potentially increase this value once we have a better sense + of the time and space requirements of the test on different hosts, + or perhaps find a way to reduce the stack size when running this + testcase. */ + const int count = 10; + + /* Build the linked list. */ + root_test_node = ggc_cleared_alloc (); + test_node *tail_node = root_test_node; + for (int i = 0; i < count; i++) + { + test_node *new_node = ggc_cleared_alloc (); + tail_node->m_next = new_node; + new_node->m_prev = tail_node; + new_node->m_idx = i; + tail_node = new_node; + } + + forcibly_ggc_collect (); + + /* If we got here, we survived. */ + + /* Verify that all nodes in the list were marked. */ + ASSERT_TRUE (ggc_marked_p (root_test_node)); + test_node *iter_node = root_test_node->m_next; + for (int i = 0; i < count; i++) + { + ASSERT_TRUE (ggc_marked_p (iter_node)); + ASSERT_EQ (i, iter_node->m_idx); + iter_node = iter_node->m_next; + } +} + + + +/* Test for GTY((user)). */ + +struct GTY((user)) user_struct +{ + char dummy[16]; + test_struct *m_ptr; +}; + +static GTY(()) user_struct *root_user_struct_ptr; + +/* A global for verifying that the user-provided gt_ggc_mx gets + called. */ +static int num_calls_to_user_gt_ggc_mx; + +/* User-provided implementation of gt_ggc_mx. */ + +static void +gt_ggc_mx (user_struct *p) +{ + num_calls_to_user_gt_ggc_mx++; + gt_ggc_mx_test_struct (p->m_ptr); +} + +/* User-provided implementation of gt_pch_nx. */ + +static void +gt_pch_nx (user_struct *p) +{ + gt_pch_nx_test_struct (p->m_ptr); +} + +/* User-provided implementation of gt_pch_nx. */ + +static void +gt_pch_nx (user_struct *p, gt_pointer_operator op, void *cookie) +{ + op (&(p->m_ptr), cookie); +} + +/* Verify that GTY((user)) works. */ + +static void +test_user_struct () +{ + root_user_struct_ptr = ggc_cleared_alloc (); + test_struct *referenced = ggc_cleared_alloc (); + root_user_struct_ptr->m_ptr = referenced; + + num_calls_to_user_gt_ggc_mx = 0; + + forcibly_ggc_collect (); + + ASSERT_TRUE (ggc_marked_p (root_user_struct_ptr)); + ASSERT_TRUE (ggc_marked_p (referenced)); + ASSERT_TRUE (num_calls_to_user_gt_ggc_mx > 0); +} + + + +/* Smoketest to ensure that the tree type is marked. */ + +static GTY(()) tree dummy_unittesting_tree; + +static void +test_tree_marking () +{ + dummy_unittesting_tree = build_int_cst (integer_type_node, 1066); + + forcibly_ggc_collect (); + + ASSERT_TRUE (ggc_marked_p (dummy_unittesting_tree)); +} + + + +/* Ideas for other tests: + - pch-handling */ + +namespace selftest { + +/* Run all of the selftests within this file. */ + +void +ggc_tests_c_tests () +{ + test_basic_struct (); + test_length (); + test_union (); + test_finalization (); + test_deletable_global (); + test_inheritance (); + test_chain_next (); + test_user_struct (); + test_tree_marking (); +} + +} // namespace selftest + +#include "gt-ggc-tests.h" + +#else /* #if CHECKING_P */ + +/* The #if CHECKING_P code above has various GTY-marked roots. + gengtype has no knowledge of the preprocessor, and so detects + these roots and writes them out to gt-ggc-tests.h. + In a !CHECKING_P build we can ignore gt-ggc-tests.h, but the + root tables are referenced in the various generated gtype-*.c + files like this: + + ...snip... + extern const struct ggc_root_tab gt_ggc_r_gt_ggc_tests_h[]; + ...snip... + + EXPORTED_CONST struct ggc_root_tab * const gt_ggc_rtab[] = { + ...snip... + gt_ggc_r_gt_ggc_tests_h, + ...snip... + }; + + Hence to avoid a link failure, we provide dummy implementations + of these root tables in an unchecked build. + + Note that these conditional roots imply that PCH files are + incompatible between checked and unchecked builds. */ + +EXPORTED_CONST struct ggc_root_tab gt_ggc_r_gt_ggc_tests_h[] = { + LAST_GGC_ROOT_TAB +}; + +EXPORTED_CONST struct ggc_root_tab gt_ggc_rd_gt_ggc_tests_h[] = { + LAST_GGC_ROOT_TAB +}; + +#endif /* #else clause of #if CHECKING_P */ diff --git a/gcc/selftest-run-tests.c b/gcc/selftest-run-tests.c index e9121b89338..934e700b2e1 100644 --- a/gcc/selftest-run-tests.c +++ b/gcc/selftest-run-tests.c @@ -48,6 +48,7 @@ selftest::run_tests () vec_c_tests (); pretty_print_c_tests (); wide_int_cc_tests (); + ggc_tests_c_tests (); /* Mid-level data structures. */ input_c_tests (); diff --git a/gcc/selftest.h b/gcc/selftest.h index dba4bb7624f..d1f8accfe12 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -47,6 +47,7 @@ extern void et_forest_c_tests (); extern void fold_const_c_tests (); extern void function_tests_c_tests (); extern void gimple_c_tests (); +extern void ggc_tests_c_tests (); extern void hash_map_tests_c_tests (); extern void hash_set_tests_c_tests (); extern void input_c_tests (); -- cgit v1.2.3 From b19461fd8b2afc46afe0563925644b6bd232c810 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 10 Jun 2016 14:14:04 +0000 Subject: Remove platform-specific details from must-tail-call-2.c messages gcc/testsuite/ChangeLog: * gcc.dg/plugin/must-tail-call-2.c: Remove all details from the various "cannot tail-call: " messages. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237310 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 98224abb049..71a2db10ab7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 David Malcolm + + * gcc.dg/plugin/must-tail-call-2.c: Remove all details from + the various "cannot tail-call: " messages. + 2016-06-10 Christophe Lyon * gcc.target/arm/pr37780_1.c: Use arm_arch_v6t2 effective target diff --git a/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c index c5504f8eed4..c6dfecd3245 100644 --- a/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c +++ b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c @@ -14,7 +14,7 @@ returns_struct (int i) int __attribute__((noinline,noclone)) test_1 (int i) { - return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: callee returns a structure" } */ + return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: " } */ } int __attribute__((noinline,noclone)) @@ -29,14 +29,14 @@ int __attribute__((noinline,noclone)) test_2_caller (int i) { struct box b; - return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: callee required more stack slots than the caller" } */ + return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: " } */ } extern void setjmp (void); void test_3 (void) { - setjmp (); /* { dg-error "cannot tail-call: callee returns twice" } */ + setjmp (); /* { dg-error "cannot tail-call: " } */ } void @@ -45,7 +45,7 @@ test_4 (void) void nested (void) { } - nested (); /* { dg-error "cannot tail-call: nested function" } */ + nested (); /* { dg-error "cannot tail-call: " } */ } typedef void (fn_ptr_t) (void); @@ -54,5 +54,5 @@ volatile fn_ptr_t fn_ptr; void test_5 (void) { - fn_ptr (); /* { dg-error "cannot tail-call: callee does not return" } */ + fn_ptr (); /* { dg-error "cannot tail-call: " } */ } -- cgit v1.2.3 From 88d84a108643a9010d7490c64b9ca9ff886465ff Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 10 Jun 2016 16:00:24 +0000 Subject: * predict.c (predict_loops): Remove PRED_LOOP_BRANCH. * predict.def (PRED_LOOP_BRANCH): Remove. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237311 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/predict.c | 12 ------------ gcc/predict.def | 6 ------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9be025e4c4b..af960257eae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Jan Hubicka + + * predict.c (predict_loops): Remove PRED_LOOP_BRANCH. + * predict.def (PRED_LOOP_BRANCH): Remove. + 2016-06-10 David Malcolm * Makefile.in (OBJS): Add ggc-tests.o. diff --git a/gcc/predict.c b/gcc/predict.c index 0fa8c5b09e3..7a3398427e4 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1805,18 +1805,6 @@ predict_loops (void) if (predicted_by_p (bb, PRED_CONTINUE)) continue; - /* Loop branch heuristics - predict an edge back to a - loop's head as taken. */ - if (bb == loop->latch) - { - e = find_edge (loop->latch, loop->header); - if (e) - { - header_found = 1; - predict_edge_def (e, PRED_LOOP_BRANCH, TAKEN); - } - } - /* Loop exit heuristics - predict an edge exiting the loop if the conditional has no loop header successors as not taken. */ if (!header_found diff --git a/gcc/predict.def b/gcc/predict.def index e1c5faee258..c0a3f3684a9 100644 --- a/gcc/predict.def +++ b/gcc/predict.def @@ -88,12 +88,6 @@ DEF_PREDICTOR (PRED_NORETURN, "noreturn call", PROB_VERY_LIKELY, DEF_PREDICTOR (PRED_COLD_FUNCTION, "cold function call", PROB_VERY_LIKELY, PRED_FLAG_FIRST_MATCH) -/* Loopback edge is taken. - FIXME: This is currently disabled because loop_optimizer_init force - loops to have simple latches. */ -DEF_PREDICTOR (PRED_LOOP_BRANCH, "loop branch", HITRATE (86), - PRED_FLAG_FIRST_MATCH) - /* Edge causing loop to terminate is probably not taken. */ DEF_PREDICTOR (PRED_LOOP_EXIT, "loop exit", HITRATE (92), PRED_FLAG_FIRST_MATCH) -- cgit v1.2.3 From c06585b5a0408340d5df5548299f0c0baada4c08 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 10 Jun 2016 16:23:06 +0000 Subject: PR tree-optimization/71335 * tree-ssa-threadbackward.c (profitable_jump_thread_path): Filter out zero length paths here. (convert_and_register_jump_thread_path): Remove hacks related to duplicated blocks in the jump thread path. (fsm_find_control_statement_thread_paths): Avoid putting the same block on the thread path twice, but ensure the thread path is unchanged from the caller's point of view. PR tree-optimization/71335 * gcc.c-torture/execute/pr71335.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237312 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.c-torture/execute/pr71335.c | 13 ++++++++ gcc/tree-ssa-threadbackward.c | 44 +++++++++++++-------------- 4 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr71335.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af960257eae..bd9476ea931 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2016-06-10 Jeff Law + + PR tree-optimization/71335 + * tree-ssa-threadbackward.c (profitable_jump_thread_path): Filter out + zero length paths here. + (convert_and_register_jump_thread_path): Remove hacks related to + duplicated blocks in the jump thread path. + (fsm_find_control_statement_thread_paths): Avoid putting the same + block on the thread path twice, but ensure the thread path is + unchanged from the caller's point of view. + 2016-06-10 Jan Hubicka * predict.c (predict_loops): Remove PRED_LOOP_BRANCH. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 71a2db10ab7..b76e477d3e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Jeff Law + + PR tree-optimization/71335 + * gcc.c-torture/execute/pr71335.c: New test. + 2016-06-10 David Malcolm * gcc.dg/plugin/must-tail-call-2.c: Remove all details from diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71335.c b/gcc/testsuite/gcc.c-torture/execute/pr71335.c new file mode 100644 index 00000000000..cbfd99083d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr71335.c @@ -0,0 +1,13 @@ +int a; +int +main () +{ + int b = 0; + while (a < 0 || b) + { + b = 0; + for (; b < 9; b++) + ; + } + exit (0); +} diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 57f1f5c54da..139d376d1cb 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -109,6 +109,19 @@ profitable_jump_thread_path (vec *&path, /* Note BBI is not in the path yet, hence the +1 in the test below to make sure BBI is accounted for in the path length test. */ int path_length = path->length (); + + /* We can get a length of 0 here when the statement that + makes a conditional generate a compile-time constant + result is in the same block as the conditional. + + That's not really a jump threading opportunity, but instead is + simple cprop & simplification. We could handle it here if we + wanted by wiring up all the incoming edges. If we run this + early in IPA, that might be worth doing. For now we just + reject that case. */ + if (path_length == 0) + return NULL; + if (path_length + 1 > PARAM_VALUE (PARAM_MAX_FSM_THREAD_LENGTH)) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -376,34 +389,12 @@ convert_and_register_jump_thread_path (vec *&path, basic_block bb1 = (*path)[path->length () - j - 1]; basic_block bb2 = (*path)[path->length () - j - 2]; - /* This can happen when we have an SSA_NAME as a PHI argument and - its initialization block is the head of the PHI argument's - edge. */ - if (bb1 == bb2) - continue; - edge e = find_edge (bb1, bb2); gcc_assert (e); jump_thread_edge *x = new jump_thread_edge (e, EDGE_FSM_THREAD); jump_thread_path->safe_push (x); } - /* As a consequence of the test for duplicate blocks in the path - above, we can get a path with no blocks. This happens if a - conditional can be fully evaluated at compile time using just - defining statements in the same block as the test. - - When we no longer push the block associated with a PHI argument - onto the stack, then this as well as the test in the loop above - can be removed. */ - if (jump_thread_path->length () == 0) - { - jump_thread_path->release (); - delete jump_thread_path; - path->pop (); - return; - } - /* Add the edge taken when the control variable has value ARG. */ jump_thread_edge *x = new jump_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK); @@ -579,10 +570,19 @@ fsm_find_control_statement_thread_paths (tree name, else { + /* profitable_jump_thread_path is going to push the current + block onto the path. But the path will always have the current + block at this point. So we can just pop it. */ + path->pop (); + edge taken_edge = profitable_jump_thread_path (path, var_bb, name, arg); if (taken_edge) convert_and_register_jump_thread_path (path, taken_edge); + + /* And put the current block back onto the path so that the + state of the stack is unchanged when we leave. */ + vec_safe_push (path, var_bb); } } -- cgit v1.2.3 From 52cd749f15582a3e409a3902c06d7c724876efe0 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Fri, 10 Jun 2016 16:27:27 +0000 Subject: 2016-06-10 Bernd Edlinger * config/arm/arm.h (pool_vector_label, return_used_this_function): Remove. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237313 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/arm/arm.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd9476ea931..34eb9e543d6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Bernd Edlinger + + * config/arm/arm.h (pool_vector_label, + return_used_this_function): Remove. + 2016-06-10 Jeff Law PR tree-optimization/71335 diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 065e7da4bfa..f0cdd669191 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -80,11 +80,6 @@ extern arm_cc arm_current_cc; extern int arm_target_label; extern int arm_ccfsm_state; extern GTY(()) rtx arm_target_insn; -/* The label of the current constant pool. */ -extern rtx pool_vector_label; -/* Set to 1 when a return insn is output, this means that the epilogue - is not needed. */ -extern int return_used_this_function; /* Callback to output language specific object attributes. */ extern void (*arm_lang_output_object_attributes_hook)(void); -- cgit v1.2.3 From d86592763a3f81cb3382d9fd1d969c1a83f5e077 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 10 Jun 2016 17:38:19 +0000 Subject: PR c/71392 - SEGV calling integer overflow built-ins with a null pointer gcc/ChangeLog: 2016-06-10 Martin Sebor PR c/71392 * builtin-attrs.def (ATTR_NOTHROW_NONNULL_LEAF_LIST): New macro. (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF): Same. * builtins.def (BUILT_IN_SADD_OVERFLOW, BUILT_IN_SADDL_OVERFLOW): Use them. (BUILT_IN_SADDLL_OVERFLOW, BUILT_IN_SSUB_OVERFLOW): Same. (BUILT_IN_SSUBL_OVERFLOW, BUILT_IN_SSUBLL_OVERFLOW): Same. (BUILT_IN_SMUL_OVERFLOW, BUILT_IN_SMULL_OVERFLOW): Same. (BUILT_IN_SMULLL_OVERFLOW, BUILT_IN_UADD_OVERFLOW): Same. (BUILT_IN_UADDL_OVERFLOW, BUILT_IN_UADDLL_OVERFLOW): Same. (BUILT_IN_USUB_OVERFLOW, BUILT_IN_USUBL_OVERFLOW): Same. (BUILT_IN_USUBLL_OVERFLOW, BUILT_IN_UMUL_OVERFLOW): Same. (BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW): gcc/ada/ChangeLog: 2016-06-10 Martin Sebor PR c/71392 * gcc/ada/gcc-interface/utils.c (handle_nonnull_attribute): Accept the nonnull attribute in type-generic builtins. gcc/c-family/ChangeLog: 2016-06-10 Martin Sebor PR c/71392 * gcc/c-family/c-common.c (handle_nonnull_attribute): Accept the nonnull attribute in type-generic builtins. gcc/lto/ChangeLog: 2016-06-10 Martin Sebor PR c/71392 * gcc/lto/lto-lang.c (handle_nonnull_attribute): Accept the nonnull attribute in type-generic builtins. gcc/testsuite/ChangeLog: 2016-06-10 Martin Sebor PR c/71392 * c-c++-common/builtin-arith-overflow-1.c: Add test cases. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237314 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 ++ gcc/ada/ChangeLog | 6 + gcc/ada/gcc-interface/utils.c | 8 +- gcc/builtin-attrs.def | 5 + gcc/builtins.def | 42 ++--- gcc/c-family/ChangeLog | 6 + gcc/c-family/c-common.c | 8 +- gcc/lto/ChangeLog | 6 + gcc/lto/lto-lang.c | 9 +- gcc/testsuite/ChangeLog | 5 + .../c-c++-common/builtin-arith-overflow-1.c | 202 ++++++++++++++++++++- 11 files changed, 281 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34eb9e543d6..b4ce8dbaaaa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2016-06-10 Martin Sebor + + PR c/71392 + * builtin-attrs.def (ATTR_NOTHROW_NONNULL_LEAF_LIST): New macro. + (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF): Same. + * builtins.def (BUILT_IN_SADD_OVERFLOW, BUILT_IN_SADDL_OVERFLOW): Use + them. + (BUILT_IN_SADDLL_OVERFLOW, BUILT_IN_SSUB_OVERFLOW): Same. + (BUILT_IN_SSUBL_OVERFLOW, BUILT_IN_SSUBLL_OVERFLOW): Same. + (BUILT_IN_SMUL_OVERFLOW, BUILT_IN_SMULL_OVERFLOW): Same. + (BUILT_IN_SMULLL_OVERFLOW, BUILT_IN_UADD_OVERFLOW): Same. + (BUILT_IN_UADDL_OVERFLOW, BUILT_IN_UADDLL_OVERFLOW): Same. + (BUILT_IN_USUB_OVERFLOW, BUILT_IN_USUBL_OVERFLOW): Same. + (BUILT_IN_USUBLL_OVERFLOW, BUILT_IN_UMUL_OVERFLOW): Same. + (BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW): + 2016-06-10 Bernd Edlinger * config/arm/arm.h (pool_vector_label, diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 20edf04ee22..7576463b453 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Martin Sebor + + PR c/71392 + * gcc/ada/gcc-interface/utils.c (handle_nonnull_attribute): Accept + the nonnull attribute in type-generic builtins. + 2016-06-06 Eric Botcazou * gcc-interface/decl.c (Gigi_Equivalent_Type): Make sure equivalent diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 831b6e035aa..1f1e4d3b814 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -5833,10 +5833,14 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), /* If no arguments are specified, all pointer arguments should be non-null. Verify a full prototype is given so that the arguments - will have the correct types when we actually check them later. */ + will have the correct types when we actually check them later. + Avoid diagnosing type-generic built-ins since those have no + prototype. */ if (!args) { - if (!prototype_p (type)) + if (!prototype_p (type) + && (!TYPE_ATTRIBUTES (type) + || !lookup_attribute ("type generic", TYPE_ATTRIBUTES (type)))) { error ("nonnull attribute without arguments on a non-prototype"); *no_add_attrs = true; diff --git a/gcc/builtin-attrs.def b/gcc/builtin-attrs.def index 089817a5c4d..99658883872 100644 --- a/gcc/builtin-attrs.def +++ b/gcc/builtin-attrs.def @@ -165,6 +165,7 @@ DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL, ATTR_NONNULL, ATTR_NULL, \ /* Nothrow leaf functions whose pointer parameter(s) are all nonnull. */ DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF, ATTR_NONNULL, ATTR_NULL, \ ATTR_NOTHROW_LEAF_LIST) +DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_NONNULL_LEAF) /* Nothrow functions whose first parameter is a nonnull pointer. */ DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, \ ATTR_NOTHROW_LIST) @@ -183,6 +184,10 @@ DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_5, ATTR_NONNULL, ATTR_LIST_5, \ /* Nothrow leaf functions which are type-generic. */ DEF_ATTR_TREE_LIST (ATTR_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \ ATTR_NOTHROW_LEAF_LIST) +/* Nothrow nonnull leaf functions that are type-generic. */ +DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF, + ATTR_TYPEGENERIC, ATTR_NULL, + ATTR_NOTHROW_NONNULL_LEAF) /* Nothrow const functions whose pointer parameter(s) are all nonnull. */ DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL, ATTR_CONST, ATTR_NULL, \ ATTR_NOTHROW_NONNULL) diff --git a/gcc/builtins.def b/gcc/builtins.def index ca9bafcbf2f..33a7626b70a 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -707,31 +707,31 @@ DEF_C94_BUILTIN (BUILT_IN_TOWLOWER, "towlower", BT_FN_WINT_WINT, ATTR_PUR DEF_C94_BUILTIN (BUILT_IN_TOWUPPER, "towupper", BT_FN_WINT_WINT, ATTR_PURE_NOTHROW_LEAF_LIST) /* Category: integer overflow checking builtins. */ -DEF_GCC_BUILTIN (BUILT_IN_ADD_OVERFLOW, "add_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_TYPEGENERIC_LEAF) -DEF_GCC_BUILTIN (BUILT_IN_SUB_OVERFLOW, "sub_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_TYPEGENERIC_LEAF) -DEF_GCC_BUILTIN (BUILT_IN_MUL_OVERFLOW, "mul_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_TYPEGENERIC_LEAF) +DEF_GCC_BUILTIN (BUILT_IN_ADD_OVERFLOW, "add_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF) +DEF_GCC_BUILTIN (BUILT_IN_SUB_OVERFLOW, "sub_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF) +DEF_GCC_BUILTIN (BUILT_IN_MUL_OVERFLOW, "mul_overflow", BT_FN_BOOL_VAR, ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF) DEF_GCC_BUILTIN (BUILT_IN_ADD_OVERFLOW_P, "add_overflow_p", BT_FN_BOOL_VAR, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF) DEF_GCC_BUILTIN (BUILT_IN_SUB_OVERFLOW_P, "sub_overflow_p", BT_FN_BOOL_VAR, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF) DEF_GCC_BUILTIN (BUILT_IN_MUL_OVERFLOW_P, "mul_overflow_p", BT_FN_BOOL_VAR, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF) /* Clang compatibility. */ -DEF_GCC_BUILTIN (BUILT_IN_SADD_OVERFLOW, "sadd_overflow", BT_FN_BOOL_INT_INT_INTPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SADDL_OVERFLOW, "saddl_overflow", BT_FN_BOOL_LONG_LONG_LONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SADDLL_OVERFLOW, "saddll_overflow", BT_FN_BOOL_LONGLONG_LONGLONG_LONGLONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SSUB_OVERFLOW, "ssub_overflow", BT_FN_BOOL_INT_INT_INTPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SSUBL_OVERFLOW, "ssubl_overflow", BT_FN_BOOL_LONG_LONG_LONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SSUBLL_OVERFLOW, "ssubll_overflow", BT_FN_BOOL_LONGLONG_LONGLONG_LONGLONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SMUL_OVERFLOW, "smul_overflow", BT_FN_BOOL_INT_INT_INTPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SMULL_OVERFLOW, "smull_overflow", BT_FN_BOOL_LONG_LONG_LONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_SMULLL_OVERFLOW, "smulll_overflow", BT_FN_BOOL_LONGLONG_LONGLONG_LONGLONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_UADD_OVERFLOW, "uadd_overflow", BT_FN_BOOL_UINT_UINT_UINTPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_UADDL_OVERFLOW, "uaddl_overflow", BT_FN_BOOL_ULONG_ULONG_ULONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_UADDLL_OVERFLOW, "uaddll_overflow", BT_FN_BOOL_ULONGLONG_ULONGLONG_ULONGLONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_USUB_OVERFLOW, "usub_overflow", BT_FN_BOOL_UINT_UINT_UINTPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_USUBL_OVERFLOW, "usubl_overflow", BT_FN_BOOL_ULONG_ULONG_ULONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_USUBLL_OVERFLOW, "usubll_overflow", BT_FN_BOOL_ULONGLONG_ULONGLONG_ULONGLONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_UMUL_OVERFLOW, "umul_overflow", BT_FN_BOOL_UINT_UINT_UINTPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_UMULL_OVERFLOW, "umull_overflow", BT_FN_BOOL_ULONG_ULONG_ULONGPTR, ATTR_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_UMULLL_OVERFLOW, "umulll_overflow", BT_FN_BOOL_ULONGLONG_ULONGLONG_ULONGLONGPTR, ATTR_NOTHROW_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SADD_OVERFLOW, "sadd_overflow", BT_FN_BOOL_INT_INT_INTPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SADDL_OVERFLOW, "saddl_overflow", BT_FN_BOOL_LONG_LONG_LONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SADDLL_OVERFLOW, "saddll_overflow", BT_FN_BOOL_LONGLONG_LONGLONG_LONGLONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SSUB_OVERFLOW, "ssub_overflow", BT_FN_BOOL_INT_INT_INTPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SSUBL_OVERFLOW, "ssubl_overflow", BT_FN_BOOL_LONG_LONG_LONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SSUBLL_OVERFLOW, "ssubll_overflow", BT_FN_BOOL_LONGLONG_LONGLONG_LONGLONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SMUL_OVERFLOW, "smul_overflow", BT_FN_BOOL_INT_INT_INTPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SMULL_OVERFLOW, "smull_overflow", BT_FN_BOOL_LONG_LONG_LONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_SMULLL_OVERFLOW, "smulll_overflow", BT_FN_BOOL_LONGLONG_LONGLONG_LONGLONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_UADD_OVERFLOW, "uadd_overflow", BT_FN_BOOL_UINT_UINT_UINTPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_UADDL_OVERFLOW, "uaddl_overflow", BT_FN_BOOL_ULONG_ULONG_ULONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_UADDLL_OVERFLOW, "uaddll_overflow", BT_FN_BOOL_ULONGLONG_ULONGLONG_ULONGLONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_USUB_OVERFLOW, "usub_overflow", BT_FN_BOOL_UINT_UINT_UINTPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_USUBL_OVERFLOW, "usubl_overflow", BT_FN_BOOL_ULONG_ULONG_ULONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_USUBLL_OVERFLOW, "usubll_overflow", BT_FN_BOOL_ULONGLONG_ULONGLONG_ULONGLONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_UMUL_OVERFLOW, "umul_overflow", BT_FN_BOOL_UINT_UINT_UINTPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_UMULL_OVERFLOW, "umull_overflow", BT_FN_BOOL_ULONG_ULONG_ULONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_UMULLL_OVERFLOW, "umulll_overflow", BT_FN_BOOL_ULONGLONG_ULONGLONG_ULONGLONGPTR, ATTR_NOTHROW_NONNULL_LEAF_LIST) /* Category: miscellaneous builtins. */ DEF_LIB_BUILTIN (BUILT_IN_ABORT, "abort", BT_FN_VOID, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 23ff800e41f..88cbd871d10 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Martin Sebor + + PR c/71392 + * gcc/c-family/c-common.c (handle_nonnull_attribute): Accept + the nonnull attribute in type-generic builtins. + 2016-06-09 Martin Sebor PR c/70883 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 94005ff8260..85f3a03146e 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -9040,10 +9040,14 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), /* If no arguments are specified, all pointer arguments should be non-null. Verify a full prototype is given so that the arguments - will have the correct types when we actually check them later. */ + will have the correct types when we actually check them later. + Avoid diagnosing type-generic built-ins since those have no + prototype. */ if (!args) { - if (!prototype_p (type)) + if (!prototype_p (type) + && (!TYPE_ATTRIBUTES (type) + || !lookup_attribute ("type generic", TYPE_ATTRIBUTES (type)))) { error ("nonnull attribute without arguments on a non-prototype"); *no_add_attrs = true; diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 06458d46033..9323a255151 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Martin Sebor + + PR c/71392 + * gcc/lto/lto-lang.c (handle_nonnull_attribute): Accept the nonnull + attribute in type-generic builtins. + 2016-05-16 Jan Hubicka * lto-partition.c (add_symbol_to_partition_1): Likewise. diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index b5efe3aab7e..301cf2124a6 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -352,10 +352,15 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), /* If no arguments are specified, all pointer arguments should be non-null. Verify a full prototype is given so that the arguments - will have the correct types when we actually check them later. */ + will have the correct types when we actually check them later. + Avoid diagnosing type-generic built-ins since those have no + prototype. */ if (!args) { - gcc_assert (prototype_p (type)); + gcc_assert (prototype_p (type) + || !TYPE_ATTRIBUTES (type) + || lookup_attribute ("type generic", TYPE_ATTRIBUTES (type))); + return NULL_TREE; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b76e477d3e5..932567e1bd4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Martin Sebor + + PR c/71392 + * c-c++-common/builtin-arith-overflow-1.c: Add test cases. + 2016-06-10 Jeff Law PR tree-optimization/71335 diff --git a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c index 3332c4ec44d..3576748e1ee 100644 --- a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c +++ b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c @@ -1,7 +1,18 @@ +/* Test exercising invalid calls to arithmetic overflow checking built-ins, + including PR c/71392 - SEGV calling integer overflow built-ins with a null + pointer, (issuing a warning for such invocations). */ /* { dg-do compile } */ +/* { dg-additional-options "-Wnonnull" } + +/* Verify that calls with fewer or more than 3 arguments to the generic + __builtin_op_overflow functions are rejected. */ + +#ifndef __cplusplus +#define bool _Bool +#endif int -f1 (void) +generic_0 (void) { int x = __builtin_add_overflow (); /* { dg-error "too few arguments to function" } */ x += __builtin_sub_overflow (); /* { dg-error "too few arguments to function" } */ @@ -12,6 +23,191 @@ f1 (void) return x; } +int +generic_1 (int a) +{ + int x = __builtin_add_overflow (a); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (a); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (a); /* { dg-error "too few arguments to function" } */ + + /* Literal argument. */ + x += __builtin_add_overflow (1); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (2); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (3); /* { dg-error "too few arguments to function" } */ + return x; +} + +int +generic_2 (int a, int b) +{ + int x = __builtin_add_overflow (a, b);/* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (a, b); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (a, b); /* { dg-error "too few arguments to function" } */ + x += __builtin_add_overflow (a, 1); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (a, 2); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (a, 3); /* { dg-error "too few arguments to function" } */ + x += __builtin_add_overflow (4, b); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (5, b); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (6, b); /* { dg-error "too few arguments to function" } */ + return x; +} + +/* Verify that calls with the correct number of arguments to the generic + __builtin_op_overflow functions are accepted. */ + +int +generic_3 (int a, int b, int c) +{ + int x = __builtin_add_overflow (a, b, &c); + x += __builtin_sub_overflow (a, b, &c); + x += __builtin_mul_overflow (a, b, &c); + x += __builtin_add_overflow (a, 1, &c); + x += __builtin_sub_overflow (a, 2, &c); + x += __builtin_mul_overflow (a, 3, &c); + x += __builtin_add_overflow (4, b, &c); + x += __builtin_sub_overflow (5, b, &c); + x += __builtin_mul_overflow (6, b, &c); + x += __builtin_add_overflow (7, 8, &c); + x += __builtin_sub_overflow (9, 10, &c); + x += __builtin_mul_overflow (11, 12, &c); + + /* Verify that a null pointer to an integer is diagnosed. */ + + /* The following two are rejected due to c/71479 - error on + __builtin_add_overflow with bool or enum pointer as last argument. + + x += __builtin_add_overflow (0, 0, (bool *)0); + + enum E { e0 }; + x += __builtin_add_overflow (0, 0, (enum E *)0); + */ + + x += __builtin_sub_overflow (0, 0, (char *)0); /* { dg-warning "null argument" } */ + x += __builtin_add_overflow (0, 0, (short *)0); /* { dg-warning "null argument" } */ + x += __builtin_add_overflow (a, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_sub_overflow (a, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_mul_overflow (a, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_add_overflow (a, 1, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_sub_overflow (a, 2, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_mul_overflow (a, 3, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_add_overflow (4, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_sub_overflow (5, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_mul_overflow (6, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_add_overflow (7, 8, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_sub_overflow (9, 10, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_mul_overflow (11, 12, (int *)0); /* { dg-warning "null argument" } */ + + return x; +} + +int +generic_4 (int a, int b, int *c, int d) +{ + int x = __builtin_add_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_sub_overflow (a, b, c, d, d, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_sub_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_mul_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ + return x; +} + +/* Verify that calls with fewer or more than 3 arguments to the type + specific forms of the __builtin_op_overflow functions are rejected. */ + +int +generic_wrong_type (int a, int b) +{ + void *p = 0; + double d = 0; + int x = __builtin_add_overflow (a, b, p); /* { dg-error "does not have pointer to integer type" } */ + x += __builtin_sub_overflow (a, b, &p); /* { dg-error "does not have pointer to integer type" } */ + x += __builtin_mul_overflow (a, b, &d); /* { dg-error "does not have pointer to integer type" } */ + + /* Also verify literal arguments. */ + x += __builtin_add_overflow (1, 1, p); /* { dg-error "does not have pointer to integer type" } */ + x += __builtin_sub_overflow (1, 1, &p); /* { dg-error "does not have pointer to integer type" } */ + x += __builtin_mul_overflow (1, 1, &d); /* { dg-error "does not have pointer to integer type" } */ + return x; +} + +/* Verify that calls with fewer than 2 or more than 3 arguments to + the typed __builtin_op_overflow functions are rejected. */ +int +typed_0 (void) +{ + int x = __builtin_add_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (); /* { dg-error "too few arguments to function" } */ + return x; +} + +int +typed_1 (int a) +{ + int x = __builtin_sadd_overflow (a); /* { dg-error "too few arguments to function" } */ + x += __builtin_ssub_overflow (a); /* { dg-error "too few arguments to function" } */ + x += __builtin_smul_overflow (a); /* { dg-error "too few arguments to function" } */ + return x; +} + +int +typed_2 (int a, int b) +{ + int x = __builtin_sadd_overflow (a, b); /* { dg-error "too few arguments to function" } */ + x += __builtin_ssub_overflow (a, b); /* { dg-error "too few arguments to function" } */ + x += __builtin_smul_overflow (a, b); /* { dg-error "too few arguments to function" } */ + return x; +} + +/* Exercise PR c/71392 - SEGV calling integer overflow built-ins with + a null pointer. Verify that calls with a null argument are diagnosed + with -Wnonnull. */ + +int +typed_3_null (int a, int b) +{ + int x = 0; + + x += __builtin_sadd_overflow (a, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_uadd_overflow (a, b, (unsigned *)0); /* { dg-warning "null argument" } */ + + x += __builtin_saddl_overflow (a, b, (long *)0); /* { dg-warning "null argument" } */ + x += __builtin_uaddl_overflow (a, b, (unsigned long *)0); /* { dg-warning "null argument" } */ + + x += __builtin_saddll_overflow (a, b, (long long *)0); /* { dg-warning "null argument" } */ + x += __builtin_uaddll_overflow (a, b, (unsigned long long *)0); /* { dg-warning "null argument" } */ + + + x += __builtin_ssub_overflow (a, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_usub_overflow (a, b, (unsigned *)0); /* { dg-warning "null argument" } */ + + x += __builtin_ssubl_overflow (a, b, (long *)0); /* { dg-warning "null argument" } */ + x += __builtin_usubl_overflow (a, b, (unsigned long *)0); /* { dg-warning "null argument" } */ + + x += __builtin_ssubll_overflow (a, b, (long long *)0); /* { dg-warning "null argument" } */ + x += __builtin_usubll_overflow (a, b, (unsigned long long *)0); /* { dg-warning "null argument" } */ + + + x += __builtin_smul_overflow (a, b, (int *)0); /* { dg-warning "null argument" } */ + x += __builtin_umul_overflow (a, b, (unsigned *)0); /* { dg-warning "null argument" } */ + + x += __builtin_smull_overflow (a, b, (long *)0); /* { dg-warning "null argument" } */ + x += __builtin_umull_overflow (a, b, (unsigned long *)0); /* { dg-warning "null argument" } */ + + x += __builtin_smulll_overflow (a, b, (long long *)0); /* { dg-warning "null argument" } */ + x += __builtin_umulll_overflow (a, b, (unsigned long long *)0); /* { dg-warning "null argument" } */ + + return x; +} + +int +typed_4 (int a, int b, int *c, int d) +{ + int x = __builtin_sadd_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_ssub_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ + x += __builtin_smul_overflow (a, b, c, d); /* { dg-error "too many arguments to function" } */ + return x; +} + int f2 (int a, int b, int *c, int d) { @@ -27,10 +223,6 @@ f2 (int a, int b, int *c, int d) enum E { e0 = 0, e1 = 1 }; -#ifndef __cplusplus -#define bool _Bool -#endif - int f3 (float fa, int a, _Complex long int ca, double fb, void *pb, int b, enum E eb, bool bb, int *c) { -- cgit v1.2.3 From a588a099e969f0a16645f7e141b210f32903a3c4 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 10 Jun 2016 18:40:37 +0000 Subject: PR inline-asm/68843 * gcc.target/i386/pr68843-2.c: Add dg-do run and empty dg-options. (test): Add -masm=intel alternatives. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237315 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.target/i386/pr68843-2.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 932567e1bd4..f866a434087 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Jakub Jelinek + + PR inline-asm/68843 + * gcc.target/i386/pr68843-2.c: Add dg-do run and empty dg-options. + (test): Add -masm=intel alternatives. + 2016-06-10 Martin Sebor PR c/71392 diff --git a/gcc/testsuite/gcc.target/i386/pr68843-2.c b/gcc/testsuite/gcc.target/i386/pr68843-2.c index 652a5d3ea45..a7bd86c2c5a 100644 --- a/gcc/testsuite/gcc.target/i386/pr68843-2.c +++ b/gcc/testsuite/gcc.target/i386/pr68843-2.c @@ -1,10 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "" } */ + int __attribute__((noinline, noclone)) test (double y) { int a, b; - asm ("fistpl (%1)\n\t" - "movl (%1), %0" + asm ("fistp{l (%1)| DWORD PTR [%1]}\n\t" + "mov{l (%1), %0| %0, DWORD PTR [%1]}" : "=r" (a) : "r" (&b), "t" (y) : "st"); -- cgit v1.2.3 From f9383fbbf49bf53d427f7a4845af3098f33eb677 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 10 Jun 2016 19:46:13 +0000 Subject: PR c/68657 * c.opt (Wpsabi): Add Warning flag. * gcc.target/i386/pr68657.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237316 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c.opt | 2 +- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr68657.c | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr68657.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 88cbd871d10..a53fc9cceb5 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2016-06-10 Jakub Jelinek + + PR c/68657 + * c.opt (Wpsabi): Add Warning flag. + 2016-06-10 Martin Sebor PR c/71392 diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 918df16ea99..761a83bcfb3 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -265,7 +265,7 @@ C++ ObjC++ Var(warn_abi_tag) Warning Warn if a subobject has an abi_tag attribute that the complete object type does not have. Wpsabi -C ObjC C++ ObjC++ LTO Var(warn_psabi) Init(1) Undocumented LangEnabledBy(C ObjC C++ ObjC++,Wabi) +C ObjC C++ ObjC++ LTO Var(warn_psabi) Init(1) Warning Undocumented LangEnabledBy(C ObjC C++ ObjC++,Wabi) Waddress C ObjC C++ ObjC++ Var(warn_address) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f866a434087..cf9c24bb40e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-06-10 Jakub Jelinek + PR c/68657 + * gcc.target/i386/pr68657.c: New test. + PR inline-asm/68843 * gcc.target/i386/pr68843-2.c: Add dg-do run and empty dg-options. (test): Add -masm=intel alternatives. diff --git a/gcc/testsuite/gcc.target/i386/pr68657.c b/gcc/testsuite/gcc.target/i386/pr68657.c new file mode 100644 index 00000000000..6f0d4987d39 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68657.c @@ -0,0 +1,15 @@ +/* PR c/68657 */ +/* { dg-options "-mno-avx512f -Werror=psabi" } */ + +typedef int V __attribute__((vector_size (64))); + +void foo (V x, V *y) { /* { dg-error "AVX512F vector argument without AVX512F enabled" } */ + *y = x; +} + +V bar (V *x) { /* { dg-error "AVX512F vector return without AVX512F enabled" } */ + return *x; +} + +/* { dg-message "The ABI for passing parameters with 64-byte alignment has changed" "" { target *-*-* } 6 } */ +/* { dg-message "some warnings being treated as errors" "" { target *-*-* } 0 } */ -- cgit v1.2.3 From 61b8b9b5c652e6b72b500ee935a429019e4568c1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 10 Jun 2016 19:49:05 +0000 Subject: PR middle-end/71494 * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO without LABEL_DECL, set *handled_ops_p to false instead of true. * gcc.c-torture/execute/pr71494.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237317 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 +++++++++--- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.c-torture/execute/pr71494.c | 22 ++++++++++++++++++++++ gcc/tree-nested.c | 2 +- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr71494.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4ce8dbaaaa..0af20baea1f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Jakub Jelinek + + PR middle-end/71494 + * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO + without LABEL_DECL, set *handled_ops_p to false instead of true. + 2016-06-10 Martin Sebor PR c/71392 @@ -12,7 +18,7 @@ (BUILT_IN_UADDL_OVERFLOW, BUILT_IN_UADDLL_OVERFLOW): Same. (BUILT_IN_USUB_OVERFLOW, BUILT_IN_USUBL_OVERFLOW): Same. (BUILT_IN_USUBLL_OVERFLOW, BUILT_IN_UMUL_OVERFLOW): Same. - (BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW): + (BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW): Same. 2016-06-10 Bernd Edlinger @@ -124,7 +130,7 @@ sysroot/usr/lib/32api for additional win32 libraries, fixes failing Cygwin bootstrapping. -2016-06-09 Marcin Baczyński +2016-06-09 Marcin Baczyński * diagnostic.h (diagnostic_line_cutoff, diagnostic_flush_buffer): delete. @@ -834,7 +840,7 @@ only edges out of BB are EH edges. 2016-06-04 Martin Sebor - Marcin Baczyński + Marcin Baczyński PR c/48116 * doc/invoke.texi (-Wreturn-type): Mention not warning on return with diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cf9c24bb40e..c35bcb69d52 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-06-10 Jakub Jelinek + PR middle-end/71494 + * gcc.c-torture/execute/pr71494.c: New test. + PR c/68657 * gcc.target/i386/pr68657.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71494.c b/gcc/testsuite/gcc.c-torture/execute/pr71494.c new file mode 100644 index 00000000000..f962f2c2e21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr71494.c @@ -0,0 +1,22 @@ +/* PR middle-end/71494 */ + +int +main () +{ + void *label = &&out; + int i = 0; + void test (void) + { + label = &&out2; + goto *label; + out2:; + i++; + } + goto *label; + out: + i += 2; + test (); + if (i != 3) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 6fc63260000..812f619c05f 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1347,7 +1347,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, { wi->val_only = true; wi->is_lhs = false; - *handled_ops_p = true; + *handled_ops_p = false; return NULL_TREE; } break; -- cgit v1.2.3 From d5b272f4c85657fd9651a567299ccd39d71a7024 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Fri, 10 Jun 2016 21:57:01 +0000 Subject: gcc/testsuite/ChangeLog: 2016-06-11 Kugan Vivekanandarajah PR middle-end/71478 * gcc.dg/pr71478.c: New test. gcc/ChangeLog: 2016-06-11 Kugan Vivekanandarajah PR middle-end/71478 * tree-ssa-reassoc.c (reassociate_bb): Remove (-1) from ops list for vector integer type. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237318 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr71478.c | 21 +++++++++++++++++++++ gcc/tree-ssa-reassoc.c | 3 +-- 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr71478.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0af20baea1f..508ff0eb0bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-11 Kugan Vivekanandarajah + + PR middle-end/71478 + * tree-ssa-reassoc.c (reassociate_bb): Remove (-1) from ops list for + vector integer type. + 2016-06-10 Jakub Jelinek PR middle-end/71494 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c35bcb69d52..deeeff54bb8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-11 Kugan Vivekanandarajah + + PR middle-end/71478 + * gcc.dg/pr71478.c: New test. + 2016-06-10 Jakub Jelinek PR middle-end/71494 diff --git a/gcc/testsuite/gcc.dg/pr71478.c b/gcc/testsuite/gcc.dg/pr71478.c new file mode 100644 index 00000000000..5a3480701e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr71478.c @@ -0,0 +1,21 @@ +/* PR middle-end/71478 */ +/* { dg-require-effective-target vect_int } */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +typedef unsigned int __attribute__ ((vector_size (8))) uv2si; +typedef int __attribute__ ((vector_size (8))) v2si; + +uv2si bar (v2si); + +uv2si +foo (void) +{ + v2si x = (v2si) (0x00007fff80008000UL); + v2si y = (v2si) (0x8f997fff00000000UL); + uv2si z = x >= y; + uv2si k = bar (x); + uv2si j = k * __builtin_shuffle (z, z, (uv2si) {1, 3}); + return k * j; +} + diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 36b34d37380..e32d503bfef 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -5303,8 +5303,7 @@ reassociate_bb (basic_block bb) && rhs_code == MULT_EXPR) { last = ops.last (); - if (((TREE_CODE (last->op) == INTEGER_CST - && integer_minus_onep (last->op)) + if ((integer_minus_onep (last->op) || real_minus_onep (last->op)) && !HONOR_SNANS (TREE_TYPE (lhs)) && (!HONOR_SIGNED_ZEROS (TREE_TYPE (lhs)) -- cgit v1.2.3 From bbccd2b179b802e44a9e9dff3850deeef25821d2 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Fri, 10 Jun 2016 23:58:09 +0000 Subject: fold-const: Don't access bit fields with too big mode (PR71310) Currently, optimize_bit_field_compare reads the bitfield in word_mode if it can. If the bit field is normally accessed in a smaller mode, this might be a violation of the memory model, although the "extra" part of the read is not used. But also, previous stores to the bit field will have been done in the smaller mode, and then bigger loads from it cause a LHS problem. PR middle-end/71310 * fold-const.c (optimize_bit_field_compare): Don't try to use word_mode unconditionally for reading the bit field, look at DECL_BIT_FIELD_REPRESENTATIVE instead. gcc/testsuite/ PR middle-end/71310 * gcc.target/powerpc/pr71310.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237319 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/fold-const.c | 13 ++++++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/powerpc/pr71310.c | 23 +++++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr71310.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 508ff0eb0bc..e463219cdf0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-11 Segher Boessenkool + + PR middle-end/71310 + * fold-const.c (optimize_bit_field_compare): Don't try to use + word_mode unconditionally for reading the bit field, look at + DECL_BIT_FIELD_REPRESENTATIVE instead. + 2016-06-11 Kugan Vivekanandarajah PR middle-end/71478 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 0b7ea82c034..7f8803ca57d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3904,13 +3904,24 @@ optimize_bit_field_compare (location_t loc, enum tree_code code, return 0; } + /* Don't use a larger mode for reading the bit field than we will + use in other places accessing the bit field. */ + machine_mode largest_mode = word_mode; + if (TREE_CODE (lhs) == COMPONENT_REF) + { + tree field = TREE_OPERAND (lhs, 1); + tree repr = DECL_BIT_FIELD_REPRESENTATIVE (field); + if (repr) + largest_mode = DECL_MODE (repr); + } + /* See if we can find a mode to refer to this field. We should be able to, but fail if we can't. */ nmode = get_best_mode (lbitsize, lbitpos, 0, 0, const_p ? TYPE_ALIGN (TREE_TYPE (linner)) : MIN (TYPE_ALIGN (TREE_TYPE (linner)), TYPE_ALIGN (TREE_TYPE (rinner))), - word_mode, false); + largest_mode, false); if (nmode == VOIDmode) return 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index deeeff54bb8..2b31ceb5191 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-11 Segher Boessenkool + + PR middle-end/71310 + * gcc.target/powerpc/pr71310.c: New testcase. + 2016-06-11 Kugan Vivekanandarajah PR middle-end/71478 diff --git a/gcc/testsuite/gcc.target/powerpc/pr71310.c b/gcc/testsuite/gcc.target/powerpc/pr71310.c new file mode 100644 index 00000000000..6869a500943 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr71310.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-options "-O2" } */ + +/* { dg-final { scan-assembler-not {\mld} } } */ +/* { dg-final { scan-assembler-not {\mlwz} } } */ +/* { dg-final { scan-assembler-times {\mlbz} 2 } } */ + +struct mmu_gather { + long end; + int fullmm : 1; +}; + +void __tlb_reset_range(struct mmu_gather *p1) +{ + if (p1->fullmm) + p1->end = 0; +} + +void tlb_gather_mmu(struct mmu_gather *p1) +{ + p1->fullmm = 1; + __tlb_reset_range(p1); +} -- cgit v1.2.3 From f934e322adb8d3d0f6a632281a4fe7ace11dae83 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 11 Jun 2016 00:16:23 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237323 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2ce59ad9c11..3ed9caf9d23 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160610 +20160611 -- cgit v1.2.3 From 19cca090cfd0286f2579fc6afe748a2f8eb5c68e Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Sat, 11 Jun 2016 11:23:54 +0000 Subject: * gcc-interface/decl.c (gnat_to_gnu_entity): Do not clobber gnat_entity_name with temporary names for XUP and XUT types. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237324 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/decl.c | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7576463b453..ec42a8b9496 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2016-06-11 Pierre-Marie de Rodat + + * gcc-interface/decl.c (gnat_to_gnu_entity): Do not clobber + gnat_entity_name with temporary names for XUP and XUT types. + 2016-06-10 Martin Sebor PR c/71392 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 45878a7c635..8d4ff3fd76c 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -2335,10 +2335,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) gnat_name = Packed_Array_Impl_Type (gnat_entity); else gnat_name = gnat_entity; - if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL) - gnu_entity_name = create_concat_name (gnat_name, "XUP"); - create_type_decl (gnu_entity_name, gnu_fat_type, artificial_p, - debug_info_p, gnat_entity); + tree xup_name + = (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) + ? get_entity_name (gnat_name) + : create_concat_name (gnat_name, "XUP"); + create_type_decl (xup_name, gnu_fat_type, artificial_p, debug_info_p, + gnat_entity); /* Create the type to be designated by thin pointers: a record type for the array and its template. We used to shift the fields to have the @@ -2348,11 +2350,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) Note that GDB can handle standard DWARF information for them, so we don't have to name them as a GNAT encoding, except if specifically asked to. */ - if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL) - gnu_entity_name = create_concat_name (gnat_name, "XUT"); - else - gnu_entity_name = get_entity_name (gnat_name); - tem = build_unc_object_type (gnu_template_type, tem, gnu_entity_name, + tree xut_name + = (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) + ? get_entity_name (gnat_name) + : create_concat_name (gnat_name, "XUT"); + tem = build_unc_object_type (gnu_template_type, tem, xut_name, debug_info_p); SET_TYPE_UNCONSTRAINED_ARRAY (tem, gnu_type); -- cgit v1.2.3 From 5cc8eb496530e44150b4cb34c19ecb7e06e5ea07 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 11 Jun 2016 11:53:11 +0000 Subject: * gcc-interface/trans.c (Case_Statement_to_gnu): Deal with characters. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237326 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/gcc-interface/trans.c | 13 ++++++++++--- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/case_character.adb | 19 +++++++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/case_character.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ec42a8b9496..f37a42075a8 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2016-06-11 Eric Botcazou + + * gcc-interface/trans.c (Case_Statement_to_gnu): Deal with characters. + 2016-06-11 Pierre-Marie de Rodat * gcc-interface/decl.c (gnat_to_gnu_entity): Do not clobber diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index fb17cb2c381..dd40dbeb207 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -2472,13 +2472,15 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) static tree Case_Statement_to_gnu (Node_Id gnat_node) { - tree gnu_result, gnu_expr, gnu_label; + tree gnu_result, gnu_expr, gnu_type, gnu_label; Node_Id gnat_when; location_t end_locus; bool may_fallthru = false; gnu_expr = gnat_to_gnu (Expression (gnat_node)); gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr); + gnu_expr = maybe_character_value (gnu_expr); + gnu_type = TREE_TYPE (gnu_expr); /* We build a SWITCH_EXPR that contains the code with interspersed CASE_LABEL_EXPRs for each label. */ @@ -2548,6 +2550,11 @@ Case_Statement_to_gnu (Node_Id gnat_node) gcc_assert (!gnu_low || TREE_CODE (gnu_low) == INTEGER_CST); gcc_assert (!gnu_high || TREE_CODE (gnu_high) == INTEGER_CST); + if (gnu_low && TREE_TYPE (gnu_low) != gnu_type) + gnu_low = convert (gnu_type, gnu_low); + if (gnu_high && TREE_TYPE (gnu_high) != gnu_type) + gnu_high = convert (gnu_type, gnu_high); + add_stmt_with_node (build_case_label (gnu_low, gnu_high, label), gnat_choice); choices_added_p = true; @@ -2579,8 +2586,8 @@ Case_Statement_to_gnu (Node_Id gnat_node) /* Now emit a definition of the label the cases branch to, if any. */ if (may_fallthru) add_stmt (build1 (LABEL_EXPR, void_type_node, gnu_label)); - gnu_result = build3 (SWITCH_EXPR, TREE_TYPE (gnu_expr), gnu_expr, - end_stmt_group (), NULL_TREE); + gnu_result + = build3 (SWITCH_EXPR, gnu_type, gnu_expr, end_stmt_group (), NULL_TREE); return gnu_result; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b31ceb5191..62d3450c767 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-06-11 Eric Botcazou + + * gnat.dg/case_character.adb: New test. + 2016-06-11 Segher Boessenkool PR middle-end/71310 diff --git a/gcc/testsuite/gnat.dg/case_character.adb b/gcc/testsuite/gnat.dg/case_character.adb new file mode 100644 index 00000000000..59c9b66987d --- /dev/null +++ b/gcc/testsuite/gnat.dg/case_character.adb @@ -0,0 +1,19 @@ +-- { dg-do run } + +procedure Case_Character is + + function Test (C : Character) return Integer is + begin + case C is + when ASCII.HT | ' ' .. Character'Last => return 1; + when others => return 0; + end case; + end; + +begin + + if Test ('A') /= 1 then + raise Program_Error; + end if; + +end; -- cgit v1.2.3 From cbf3275899c35e07d238bf424f47cf6daa7e8ce2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 11 Jun 2016 12:07:54 +0000 Subject: * gcc-interface/trans.c (build_binary_op_trapv): If no operand is a constant, use the generic implementation of the middle-end; otherwise turn the dynamic conditions into static conditions and simplify. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237328 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 6 + gcc/ada/gcc-interface/trans.c | 249 +++++++++++++++++++++--------------------- 2 files changed, 128 insertions(+), 127 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f37a42075a8..6f2fda6004b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2016-06-11 Eric Botcazou + + * gcc-interface/trans.c (build_binary_op_trapv): If no operand is a + constant, use the generic implementation of the middle-end; otherwise + turn the dynamic conditions into static conditions and simplify. + 2016-06-11 Eric Botcazou * gcc-interface/trans.c (Case_Statement_to_gnu): Deal with characters. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index dd40dbeb207..2f47e9aa63e 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -8875,19 +8875,16 @@ build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left, tree rhs = gnat_protect_expr (right); tree type_max = TYPE_MAX_VALUE (gnu_type); tree type_min = TYPE_MIN_VALUE (gnu_type); - tree zero = build_int_cst (gnu_type, 0); - tree gnu_expr, rhs_lt_zero, tmp1, tmp2; - tree check_pos, check_neg, check; + tree gnu_expr, check; + int sgn; /* Assert that the precision is a power of 2. */ gcc_assert ((precision & (precision - 1)) == 0); - /* Prefer a constant or known-positive rhs to simplify checks. */ - if (!TREE_CONSTANT (rhs) - && commutative_tree_code (code) - && (TREE_CONSTANT (lhs) - || (!tree_expr_nonnegative_p (rhs) - && tree_expr_nonnegative_p (lhs)))) + /* Prefer a constant on the RHS to simplify checks. */ + if (TREE_CODE (rhs) != INTEGER_CST + && TREE_CODE (lhs) == INTEGER_CST + && (code == PLUS_EXPR || code == MULT_EXPR)) { tree tmp = lhs; lhs = rhs; @@ -8898,151 +8895,149 @@ build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left, /* If we can fold the expression to a constant, just return it. The caller will deal with overflow, no need to generate a check. */ - if (TREE_CONSTANT (gnu_expr)) + if (TREE_CODE (gnu_expr) == INTEGER_CST) return gnu_expr; - rhs_lt_zero = tree_expr_nonnegative_p (rhs) - ? boolean_false_node - : build_binary_op (LT_EXPR, boolean_type_node, rhs, zero); - - /* ??? Should use more efficient check for operand_equal_p (lhs, rhs, 0) */ - - /* Try a few strategies that may be cheaper than the general - code at the end of the function, if the rhs is not known. - The strategies are: - - Call library function for 64-bit multiplication (complex) - - Widen, if input arguments are sufficiently small - - Determine overflow using wrapped result for addition/subtraction. */ - - if (!TREE_CONSTANT (rhs)) + /* If no operand is a constant, we use the generic implementation. */ + if (TREE_CODE (lhs) != INTEGER_CST && TREE_CODE (rhs) != INTEGER_CST) { - /* Even for add/subtract double size to get another base type. */ - const unsigned int needed_precision = precision * 2; - - if (code == MULT_EXPR && precision == 64) + /* Never inline a 64-bit mult for a 32-bit target, it's way too long. */ + if (code == MULT_EXPR && precision == 64 && BITS_PER_WORD < 64) { - tree int_64 = gnat_type_for_size (64, 0); - + tree int64 = gnat_type_for_size (64, 0); return convert (gnu_type, build_call_n_expr (mulv64_decl, 2, - convert (int_64, lhs), - convert (int_64, rhs))); + convert (int64, lhs), + convert (int64, rhs))); } - if (needed_precision <= BITS_PER_WORD - || (code == MULT_EXPR && needed_precision <= LONG_LONG_TYPE_SIZE)) - { - tree wide_type = gnat_type_for_size (needed_precision, 0); - tree wide_result = build_binary_op (code, wide_type, - convert (wide_type, lhs), - convert (wide_type, rhs)); - - check = build_binary_op - (TRUTH_ORIF_EXPR, boolean_type_node, - build_binary_op (LT_EXPR, boolean_type_node, wide_result, - convert (wide_type, type_min)), - build_binary_op (GT_EXPR, boolean_type_node, wide_result, - convert (wide_type, type_max))); + enum internal_fn icode; - return - emit_check (check, gnu_expr, CE_Overflow_Check_Failed, gnat_node); - } - - if (code == PLUS_EXPR || code == MINUS_EXPR) + switch (code) { - tree unsigned_type = gnat_type_for_size (precision, 1); - tree wrapped_expr - = convert (gnu_type, - build_binary_op (code, unsigned_type, - convert (unsigned_type, lhs), - convert (unsigned_type, rhs))); - - /* Overflow when (rhs < 0) ^ (wrapped_expr < lhs)), for addition - or when (rhs < 0) ^ (wrapped_expr > lhs) for subtraction. */ - check - = build_binary_op (TRUTH_XOR_EXPR, boolean_type_node, rhs_lt_zero, - build_binary_op (code == PLUS_EXPR - ? LT_EXPR : GT_EXPR, - boolean_type_node, - wrapped_expr, lhs)); - - return - emit_check (check, gnu_expr, CE_Overflow_Check_Failed, gnat_node); + case PLUS_EXPR: + icode = IFN_ADD_OVERFLOW; + break; + case MINUS_EXPR: + icode = IFN_SUB_OVERFLOW; + break; + case MULT_EXPR: + icode = IFN_MUL_OVERFLOW; + break; + default: + gcc_unreachable (); } + + tree gnu_ctype = build_complex_type (gnu_type); + tree call + = build_call_expr_internal_loc (UNKNOWN_LOCATION, icode, gnu_ctype, 2, + lhs, rhs); + tree tgt = save_expr (call); + gnu_expr = build1 (REALPART_EXPR, gnu_type, tgt); + check + = convert (boolean_type_node, build1 (IMAGPART_EXPR, gnu_type, tgt)); + return + emit_check (check, gnu_expr, CE_Overflow_Check_Failed, gnat_node); } + /* If one operand is a constant, we expose the overflow condition to enable + a subsequent simplication or even elimination. */ switch (code) { case PLUS_EXPR: - /* When rhs >= 0, overflow when lhs > type_max - rhs. */ - check_pos = build_binary_op (GT_EXPR, boolean_type_node, lhs, - build_binary_op (MINUS_EXPR, gnu_type, - type_max, rhs)), - - /* When rhs < 0, overflow when lhs < type_min - rhs. */ - check_neg = build_binary_op (LT_EXPR, boolean_type_node, lhs, - build_binary_op (MINUS_EXPR, gnu_type, - type_min, rhs)); + sgn = tree_int_cst_sgn (rhs); + if (sgn > 0) + /* When rhs > 0, overflow when lhs > type_max - rhs. */ + check = build_binary_op (GT_EXPR, boolean_type_node, lhs, + build_binary_op (MINUS_EXPR, gnu_type, + type_max, rhs)); + else if (sgn < 0) + /* When rhs < 0, overflow when lhs < type_min - rhs. */ + check = build_binary_op (LT_EXPR, boolean_type_node, lhs, + build_binary_op (MINUS_EXPR, gnu_type, + type_min, rhs)); + else + return gnu_expr; break; case MINUS_EXPR: - /* When rhs >= 0, overflow when lhs < type_min + rhs. */ - check_pos = build_binary_op (LT_EXPR, boolean_type_node, lhs, - build_binary_op (PLUS_EXPR, gnu_type, - type_min, rhs)), - - /* When rhs < 0, overflow when lhs > type_max + rhs. */ - check_neg = build_binary_op (GT_EXPR, boolean_type_node, lhs, - build_binary_op (PLUS_EXPR, gnu_type, - type_max, rhs)); + if (TREE_CODE (lhs) == INTEGER_CST) + { + sgn = tree_int_cst_sgn (lhs); + if (sgn > 0) + /* When lhs > 0, overflow when rhs < lhs - type_max. */ + check = build_binary_op (LT_EXPR, boolean_type_node, rhs, + build_binary_op (MINUS_EXPR, gnu_type, + lhs, type_max)); + else if (sgn < 0) + /* When lhs < 0, overflow when rhs > lhs - type_min. */ + check = build_binary_op (GT_EXPR, boolean_type_node, rhs, + build_binary_op (MINUS_EXPR, gnu_type, + lhs, type_min)); + else + return gnu_expr; + } + else + { + sgn = tree_int_cst_sgn (rhs); + if (sgn > 0) + /* When rhs > 0, overflow when lhs < type_min + rhs. */ + check = build_binary_op (LT_EXPR, boolean_type_node, lhs, + build_binary_op (PLUS_EXPR, gnu_type, + type_min, rhs)); + else if (sgn < 0) + /* When rhs < 0, overflow when lhs > type_max + rhs. */ + check = build_binary_op (GT_EXPR, boolean_type_node, lhs, + build_binary_op (PLUS_EXPR, gnu_type, + type_max, rhs)); + else + return gnu_expr; + } break; case MULT_EXPR: - /* The check here is designed to be efficient if the rhs is constant, - but it will work for any rhs by using integer division. - Four different check expressions determine whether X * C overflows, - depending on C. - C == 0 => false - C > 0 => X > type_max / C || X < type_min / C - C == -1 => X == type_min - C < -1 => X > type_min / C || X < type_max / C */ - - tmp1 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_max, rhs); - tmp2 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_min, rhs); - - check_pos - = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, - build_binary_op (NE_EXPR, boolean_type_node, zero, - rhs), - build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, - build_binary_op (GT_EXPR, - boolean_type_node, - lhs, tmp1), - build_binary_op (LT_EXPR, - boolean_type_node, - lhs, tmp2))); - - check_neg - = fold_build3 (COND_EXPR, boolean_type_node, - build_binary_op (EQ_EXPR, boolean_type_node, rhs, - build_int_cst (gnu_type, -1)), - build_binary_op (EQ_EXPR, boolean_type_node, lhs, - type_min), - build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, - build_binary_op (GT_EXPR, - boolean_type_node, - lhs, tmp2), - build_binary_op (LT_EXPR, - boolean_type_node, - lhs, tmp1))); + sgn = tree_int_cst_sgn (rhs); + if (sgn > 0) + { + if (integer_onep (rhs)) + return gnu_expr; + + tree lb = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_min, rhs); + tree ub = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_max, rhs); + + /* When rhs > 1, overflow outside [type_min/rhs; type_max/rhs]. */ + check + = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, + build_binary_op (LT_EXPR, boolean_type_node, + lhs, lb), + build_binary_op (GT_EXPR, boolean_type_node, + lhs, ub)); + } + else if (sgn < 0) + { + tree lb = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_max, rhs); + tree ub = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_min, rhs); + + if (integer_minus_onep (rhs)) + /* When rhs == -1, overflow if lhs == type_min. */ + check + = build_binary_op (EQ_EXPR, boolean_type_node, lhs, type_min); + else + /* When rhs < -1, overflow outside [type_max/rhs; type_min/rhs]. */ + check + = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, + build_binary_op (LT_EXPR, boolean_type_node, + lhs, lb), + build_binary_op (GT_EXPR, boolean_type_node, + lhs, ub)); + } + else + return gnu_expr; break; default: gcc_unreachable (); } - check = fold_build3 (COND_EXPR, boolean_type_node, rhs_lt_zero, check_neg, - check_pos); - return emit_check (check, gnu_expr, CE_Overflow_Check_Failed, gnat_node); } -- cgit v1.2.3 From d91e10b54b4a53943454603f4fee4608a1e7b973 Mon Sep 17 00:00:00 2001 From: Dominique d'Humieres Date: Sat, 11 Jun 2016 19:19:43 +0000 Subject: 2016-06-11 Dominique d'Humieres PR fortran/60751 * io.c (gfc_resolve_dt): Replace GFC_STD_GNU with GFC_STD_LEGACY. * gfortran.dg/comma_IO_extension_1.f90: New test. * gfortran.dg/comma_IO_extension_2.f90: Likewise. * gfortran.dg/array_constructor_49.f90: Remove extra comma in WRITE statement. * gfortran.dg/graphite/pr38083.f90: Likewise. * gfortran.dg/integer_exponentiation_6.F90: Likewise and add missing format. --This line M fortran/ChangeLog M fortran/io.c M testsuite/ChangeLog M testsuite/gfortran.dg/array_constructor_49.f90 M testsuite/gfortran.dg/graphite/pr38083.f90 M testsuite/gfortran.dg/integer_exponentiation_6.F90 git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237329 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/io.c | 2 +- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/gfortran.dg/array_constructor_49.f90 | 2 +- gcc/testsuite/gfortran.dg/graphite/pr38083.f90 | 2 +- gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90 | 2 +- 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 67bc9e88621..b557b34e862 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-06-11 Dominique d'Humieres + + PR fortran/60751 + * io.c (gfc_resolve_dt): Replace GFC_STD_GNU with GFC_STD_LEGACY. + 2016-06-10 Thomas Schwinge PR c/71381 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index d538d845033..7c648e93cad 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -3007,7 +3007,7 @@ gfc_resolve_dt (gfc_dt *dt, locus *loc) } if (dt->extra_comma - && !gfc_notify_std (GFC_STD_GNU, "Comma before i/o item list at %L", + && !gfc_notify_std (GFC_STD_LEGACY, "Comma before i/o item list at %L", &dt->extra_comma->where)) return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 62d3450c767..0f17c46b304 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-06-11 Dominique d'Humieres + + PR target/60751 + * gfortran.dg/comma_IO_extension_1.f90: New test. + * gfortran.dg/comma_IO_extension_2.f90: Likewise. + * gfortran.dg/array_constructor_49.f90: Remove extra comma in WRITE + statement. + * gfortran.dg/graphite/pr38083.f90: Likewise. + * gfortran.dg/integer_exponentiation_6.F90: Likewise and add + missing format. + 2016-06-11 Eric Botcazou * gnat.dg/case_character.adb: New test. diff --git a/gcc/testsuite/gfortran.dg/array_constructor_49.f90 b/gcc/testsuite/gfortran.dg/array_constructor_49.f90 index ca963d3ac73..0f5036a03da 100644 --- a/gcc/testsuite/gfortran.dg/array_constructor_49.f90 +++ b/gcc/testsuite/gfortran.dg/array_constructor_49.f90 @@ -6,7 +6,7 @@ program t integer :: ndim=2, ndfp=4, i character (len=8) :: line - write (unit=line,fmt='(4I2)'), (/ ( i, i = 1, ndfp ) /) + ndim + write (unit=line,fmt='(4I2)') (/ ( i, i = 1, ndfp ) /) + ndim if (line /= ' 3 4 5 6') call abort end program t ! { dg-final { scan-tree-dump-times "__var" 3 "original" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/pr38083.f90 b/gcc/testsuite/gfortran.dg/graphite/pr38083.f90 index da8c3cc7914..34d6ca83ad9 100644 --- a/gcc/testsuite/gfortran.dg/graphite/pr38083.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/pr38083.f90 @@ -8,7 +8,7 @@ SUBROUTINE IVSORT (IL,IH,NSEGS,IOUNIT) 10 IF (IL .GE. IH) GO TO 80 20 NSEGS = (IH + IL) / 2 IF (NSEGS .GT. MAXSGS) THEN - WRITE (IOUNIT),MAXSGS + WRITE (IOUNIT) MAXSGS ENDIF 80 NSEGS = NSEGS - 1 90 IF (IH - IL .GE. 11) GO TO 20 diff --git a/gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90 b/gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90 index 55c2543e705..4236ee61b65 100644 --- a/gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90 +++ b/gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90 @@ -1,4 +1,4 @@ ! { dg-options "-fno-range-check" } program test - write (*), (2_8 ** 64009999_8) / 2 + write (*,*) (2_8 ** 64009999_8) / 2 end program test -- cgit v1.2.3 From 28722cde1618b96ec665e2298108018b1798d02e Mon Sep 17 00:00:00 2001 From: Dominique d'Humieres Date: Sat, 11 Jun 2016 19:21:22 +0000 Subject: 2016-06-11 Dominique d'Humieres PR target/60751 * gfortran.dg/comma_IO_extension_1.f90: New test. * gfortran.dg/comma_IO_extension_2.f90: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237330 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90 | 8 ++++++++ gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90 | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90 diff --git a/gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90 b/gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90 new file mode 100644 index 00000000000..abbb69d66f6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR 60751 +! Contributed by Walter Spector +program extracomma + implicit none + + write (*,*), 1, 2, 3 ! { dg-warning "Legacy Extension: Comma before i/o item list" } +end program diff --git a/gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90 b/gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90 new file mode 100644 index 00000000000..5e80a174201 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! { dg-options "-std=legacy" } +! PR 60751 +! Contributed by Walter Spector +program extracomma + implicit none + + write (*,*), 1, 2, 3 +end program -- cgit v1.2.3 From 9b15eaf4e8f275502382d9f1d48fd3993d46e74e Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Sat, 11 Jun 2016 20:42:26 +0000 Subject: [ARM] length pop* pattern in epilogue correctly PR target/71061 * config/arm/arm-protos.h (arm_attr_length_pop_multi): New declaration. * config/arm/arm.c (arm_attr_length_pop_multi): New function to return length for pop patterns. (arm_attr_length_push_multi): Update comments. * config/arm/arm.md (*load_multiple_with_writeback): Set "length" attribute. (*pop_multiple_with_writeback_and_return): Likewise. (*pop_multiple_with_return): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237331 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++ gcc/config/arm/arm-protos.h | 1 + gcc/config/arm/arm.c | 57 ++++++++++++++++++++++++++++++++++++++++++++- gcc/config/arm/arm.md | 16 ++++++++++--- 4 files changed, 82 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e463219cdf0..6266fb35712 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2016-06-11 Jiong Wang + + PR target/71061 + * config/arm/arm-protos.h (arm_attr_length_pop_multi): New declaration. + * config/arm/arm.c (arm_attr_length_pop_multi): New function to return + length for pop patterns. + (arm_attr_length_push_multi): Update comments. + * config/arm/arm.md (*load_multiple_with_writeback): Set "length" + attribute. + (*pop_multiple_with_writeback_and_return): Likewise. + (*pop_multiple_with_return): Likewise. + 2016-06-11 Segher Boessenkool PR middle-end/71310 diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index aaaabb761cf..1ba2ebb630e 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -163,6 +163,7 @@ extern const char *arm_output_iwmmxt_shift_immediate (const char *, rtx *, bool) extern const char *arm_output_iwmmxt_tinsr (rtx *); extern unsigned int arm_sync_loop_insns (rtx , rtx *); extern int arm_attr_length_push_multi(rtx, rtx); +extern int arm_attr_length_pop_multi(rtx *, bool, bool); extern void arm_expand_compare_and_swap (rtx op[]); extern void arm_split_compare_and_swap (rtx op[]); extern void arm_split_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx, rtx); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 47d2447ed34..3503c15420e 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -27793,7 +27793,7 @@ arm_preferred_rename_class (reg_class_t rclass) return NO_REGS; } -/* Compute the atrribute "length" of insn "*push_multi". +/* Compute the attribute "length" of insn "*push_multi". So this function MUST be kept in sync with that insn pattern. */ int arm_attr_length_push_multi(rtx parallel_op, rtx first_op) @@ -27810,6 +27810,11 @@ arm_attr_length_push_multi(rtx parallel_op, rtx first_op) /* Thumb2 mode. */ regno = REGNO (first_op); + /* For PUSH/STM under Thumb2 mode, we can use 16-bit encodings if the register + list is 8-bit. Normally this means all registers in the list must be + LO_REGS, that is (R0 -R7). If any HI_REGS used, then we must use 32-bit + encodings. There is one exception for PUSH that LR in HI_REGS can be used + with 16-bit encoding. */ hi_reg = (REGNO_REG_CLASS (regno) == HI_REGS) && (regno != LR_REGNUM); for (i = 1; i < num_saves && !hi_reg; i++) { @@ -27822,6 +27827,56 @@ arm_attr_length_push_multi(rtx parallel_op, rtx first_op) return 4; } +/* Compute the attribute "length" of insn. Currently, this function is used + for "*load_multiple_with_writeback", "*pop_multiple_with_return" and + "*pop_multiple_with_writeback_and_return". OPERANDS is the toplevel PARALLEL + rtx, RETURN_PC is true if OPERANDS contains return insn. WRITE_BACK_P is + true if OPERANDS contains insn which explicit updates base register. */ + +int +arm_attr_length_pop_multi (rtx *operands, bool return_pc, bool write_back_p) +{ + /* ARM mode. */ + if (TARGET_ARM) + return 4; + /* Thumb1 mode. */ + if (TARGET_THUMB1) + return 2; + + rtx parallel_op = operands[0]; + /* Initialize to elements number of PARALLEL. */ + unsigned indx = XVECLEN (parallel_op, 0) - 1; + /* Initialize the value to base register. */ + unsigned regno = REGNO (operands[1]); + /* Skip return and write back pattern. + We only need register pop pattern for later analysis. */ + unsigned first_indx = 0; + first_indx += return_pc ? 1 : 0; + first_indx += write_back_p ? 1 : 0; + + /* A pop operation can be done through LDM or POP. If the base register is SP + and if it's with write back, then a LDM will be alias of POP. */ + bool pop_p = (regno == SP_REGNUM && write_back_p); + bool ldm_p = !pop_p; + + /* Check base register for LDM. */ + if (ldm_p && REGNO_REG_CLASS (regno) == HI_REGS) + return 4; + + /* Check each register in the list. */ + for (; indx >= first_indx; indx--) + { + regno = REGNO (XEXP (XVECEXP (parallel_op, 0, indx), 0)); + /* For POP, PC in HI_REGS can be used with 16-bit encoding. See similar + comment in arm_attr_length_push_multi. */ + if (REGNO_REG_CLASS (regno) == HI_REGS + && (regno != PC_REGNUM || ldm_p)) + return 4; + } + + return 2; +} + /* Compute the number of instructions emitted by output_move_double. */ int arm_count_output_move_double_insns (rtx *operands) diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 04714a1335e..16498316bee 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -10562,7 +10562,11 @@ } " [(set_attr "type" "load4") - (set_attr "predicable" "yes")] + (set_attr "predicable" "yes") + (set (attr "length") + (symbol_ref "arm_attr_length_pop_multi (operands, + /*return_pc=*/false, + /*write_back_p=*/true)"))] ) ;; Pop with return (as used in epilogue RTL) @@ -10591,7 +10595,10 @@ } " [(set_attr "type" "load4") - (set_attr "predicable" "yes")] + (set_attr "predicable" "yes") + (set (attr "length") + (symbol_ref "arm_attr_length_pop_multi (operands, /*return_pc=*/true, + /*write_back_p=*/true)"))] ) (define_insn "*pop_multiple_with_return" @@ -10611,7 +10618,10 @@ } " [(set_attr "type" "load4") - (set_attr "predicable" "yes")] + (set_attr "predicable" "yes") + (set (attr "length") + (symbol_ref "arm_attr_length_pop_multi (operands, /*return_pc=*/true, + /*write_back_p=*/false)"))] ) ;; Load into PC and return -- cgit v1.2.3 From d1446700a28751334b9f9aba6d64af710cd261b2 Mon Sep 17 00:00:00 2001 From: Dominique d'Humieres Date: Sat, 11 Jun 2016 22:36:50 +0000 Subject: 2016-06-12 Dominique d'Humieres PR target/60751 * gfortran.dg/guality/pr41558.f90: Remove extra comma in WRITE statement. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237332 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/guality/pr41558.f90 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f17c46b304..305af6b92f0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-12 Dominique d'Humieres + + PR target/60751 + * gfortran.dg/guality/pr41558.f90: Remove extra comma in WRITE + statement. + 2016-06-11 Dominique d'Humieres PR target/60751 diff --git a/gcc/testsuite/gfortran.dg/guality/pr41558.f90 b/gcc/testsuite/gfortran.dg/guality/pr41558.f90 index 8a84de48a30..840b2384012 100644 --- a/gcc/testsuite/gfortran.dg/guality/pr41558.f90 +++ b/gcc/testsuite/gfortran.dg/guality/pr41558.f90 @@ -5,7 +5,7 @@ subroutine f (s) character(len=3) :: s - write (*,*), s ! { dg-final { gdb-test 7 "s" "'foo'" } } + write (*,*) s ! { dg-final { gdb-test 7 "s" "'foo'" } } end call f ('foo') end -- cgit v1.2.3 From 6fe1c0a5314a09c7b4002c079496035f7b9b71af Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 12 Jun 2016 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237336 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3ed9caf9d23..100a8bd68c0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160611 +20160612 -- cgit v1.2.3 From 2b2584319be67780c70a7215c17d08a8e51eff4c Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sun, 12 Jun 2016 17:22:16 +0000 Subject: PR target/71241 * config/i386/i386.i386-builtin-types.def (CONST_STRING): New primitive type. (FLOAT128_FTYPE_CONST_STRING): New function type. * config/i386/i386.c (enum ix86_builtins) [IX86_BUILTIN_NANQ]: New. [IX86_BUILTIN_NANSQ]: Ditto. (ix86_fold_builtin): Handle IX86_BUILTIN_NANQ and IX86_BUILTIN_NANSQ. (ix86_init_builtin_types) Declare const_string_type_node. Add __builtin_nanq and __builtin_nansq builtin functions. (ix86_expand_builtin): Handle IX86_BUILTIN_NANQ and IX86_BUILTIN_NANSQ. * doc/extend.texi (x86 Built-in Functions): Document __builtin_nanq and __builtin_nansq. testsuite/ChangeLog: PR target/71241 * testsuite/gcc.dg/torture/float128-nan.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237338 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 35 +++++++--- gcc/config/i386/i386-builtin-types.def | 2 + gcc/config/i386/i386.c | 47 +++++++++++-- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/gcc.dg/torture/float128-nan.c | 101 ++++++++++++++++++++++++++++ 5 files changed, 176 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/float128-nan.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6266fb35712..0a48316e0f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2016-06-12 Uros Bizjak + + PR target/71241 + * config/i386/i386.i386-builtin-types.def (CONST_STRING): + New primitive type. + (FLOAT128_FTYPE_CONST_STRING): New function type. + * config/i386/i386.c (enum ix86_builtins) [IX86_BUILTIN_NANQ]: New. + [IX86_BUILTIN_NANSQ]: Ditto. + (ix86_fold_builtin): Handle IX86_BUILTIN_NANQ and IX86_BUILTIN_NANSQ. + (ix86_init_builtin_types) Declare const_string_type_node. + Add __builtin_nanq and __builtin_nansq builtin functions. + (ix86_expand_builtin): Handle IX86_BUILTIN_NANQ and IX86_BUILTIN_NANSQ. + * doc/extend.texi (x86 Built-in Functions): Document + __builtin_nanq and __builtin_nansq. + 2016-06-11 Jiong Wang PR target/71061 @@ -60,7 +75,7 @@ (fsm_find_control_statement_thread_paths): Avoid putting the same block on the thread path twice, but ensure the thread path is unchanged from the caller's point of view. - + 2016-06-10 Jan Hubicka * predict.c (predict_loops): Remove PRED_LOOP_BRANCH. @@ -144,21 +159,22 @@ Jiong Wang PR rtl-optimization/70751 - * lra-constraints.c (process_alt_operands): Recognize Non-pseudo spilled - into memory. + * lra-constraints.c (process_alt_operands): Recognize Non-pseudo + spilled into memory. -2016-06-09 Jonathan Yong <10walls@gmail.com> +2016-06-09 Jonathan Yong <10walls@gmail.com> Revert: 2015-09-21 Jonathan Yong <10walls@gmail.com> - * config/i386/cygwin.h (STARTFILE_SPEC): Explicitly search - sysroot/usr/lib/32api for additional win32 libraries, - fixes failing Cygwin bootstrapping. + + * config/i386/cygwin.h (STARTFILE_SPEC): Explicitly search + sysroot/usr/lib/32api for additional win32 libraries, + fixes failing Cygwin bootstrapping. 2016-06-09 Marcin Baczyński * diagnostic.h (diagnostic_line_cutoff, diagnostic_flush_buffer): - delete. + Delete. 2016-06-09 David Malcolm @@ -503,8 +519,7 @@ 2016-06-07 Kyrylo Tkachov - * simplify-rtx.c (simplify_cond_clz_ctz): Delete 'mode' local - variable. + * simplify-rtx.c (simplify_cond_clz_ctz): Delete 'mode' local variable. 2016-06-07 Jakub Jelinek diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def index c66f65108f8..7eb6fc96e66 100644 --- a/gcc/config/i386/i386-builtin-types.def +++ b/gcc/config/i386/i386-builtin-types.def @@ -73,6 +73,7 @@ DEF_PRIMITIVE_TYPE (FLOAT, float_type_node) DEF_PRIMITIVE_TYPE (DOUBLE, double_type_node) DEF_PRIMITIVE_TYPE (FLOAT80, float80_type_node) DEF_PRIMITIVE_TYPE (FLOAT128, float128_type_node) +DEF_PRIMITIVE_TYPE (CONST_STRING, const_string_type_node) # MMX vectors DEF_VECTOR_TYPE (V2SF, FLOAT) @@ -191,6 +192,7 @@ DEF_FUNCTION_TYPE (PVOID) DEF_FUNCTION_TYPE (FLOAT, FLOAT) DEF_FUNCTION_TYPE (FLOAT128, FLOAT128) +DEF_FUNCTION_TYPE (FLOAT128, CONST_STRING) DEF_FUNCTION_TYPE (INT, INT) DEF_FUNCTION_TYPE (INT, V16QI) DEF_FUNCTION_TYPE (INT, V2DF) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b807a9a0004..dd47305c5b0 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -32718,6 +32718,8 @@ enum ix86_builtins /* TFmode support builtins. */ IX86_BUILTIN_INFQ, IX86_BUILTIN_HUGE_VALQ, + IX86_BUILTIN_NANQ, + IX86_BUILTIN_NANSQ, IX86_BUILTIN_FABSQ, IX86_BUILTIN_COPYSIGNQ, @@ -38105,11 +38107,28 @@ ix86_fold_builtin (tree fndecl, int n_args, { enum ix86_builtins fn_code = (enum ix86_builtins) DECL_FUNCTION_CODE (fndecl); - if (fn_code == IX86_BUILTIN_CPU_IS - || fn_code == IX86_BUILTIN_CPU_SUPPORTS) + switch (fn_code) { + case IX86_BUILTIN_CPU_IS: + case IX86_BUILTIN_CPU_SUPPORTS: gcc_assert (n_args == 1); - return fold_builtin_cpu (fndecl, args); + return fold_builtin_cpu (fndecl, args); + + case IX86_BUILTIN_NANQ: + case IX86_BUILTIN_NANSQ: + { + tree type = TREE_TYPE (TREE_TYPE (fndecl)); + const char *str = c_getstr (*args); + int quiet = fn_code == IX86_BUILTIN_NANQ; + REAL_VALUE_TYPE real; + + if (str && real_nan (&real, str, quiet, TYPE_MODE (type))) + return build_real (type, real); + return NULL_TREE; + } + + default: + break; } } @@ -38210,7 +38229,7 @@ ix86_init_builtins_va_builtins_abi (void) static void ix86_init_builtin_types (void) { - tree float128_type_node, float80_type_node; + tree float128_type_node, float80_type_node, const_string_type_node; /* The __float80 type. */ float80_type_node = long_double_type_node; @@ -38230,6 +38249,10 @@ ix86_init_builtin_types (void) layout_type (float128_type_node); lang_hooks.types.register_builtin_type (float128_type_node, "__float128"); + const_string_type_node + = build_pointer_type (build_qualified_type + (char_type_node, TYPE_QUAL_CONST)); + /* This macro is built by i386-builtin-types.awk. */ DEFINE_BUILTIN_PRIMITIVE_TYPES; } @@ -38250,6 +38273,18 @@ ix86_init_builtins (void) def_builtin_const (0, "__builtin_huge_valq", FLOAT128_FTYPE_VOID, IX86_BUILTIN_HUGE_VALQ); + t = ix86_get_builtin_func_type (FLOAT128_FTYPE_CONST_STRING); + t = add_builtin_function ("__builtin_nanq", t, IX86_BUILTIN_NANQ, + BUILT_IN_MD, "nanq", NULL_TREE); + TREE_READONLY (t) = 1; + ix86_builtins[(int) IX86_BUILTIN_NANQ] = t; + + t = ix86_get_builtin_func_type (FLOAT128_FTYPE_CONST_STRING); + t = add_builtin_function ("__builtin_nansq", t, IX86_BUILTIN_NANSQ, + BUILT_IN_MD, "nansq", NULL_TREE); + TREE_READONLY (t) = 1; + ix86_builtins[(int) IX86_BUILTIN_NANSQ] = t; + /* We will expand them to normal call if SSE isn't available since they are used by libgcc. */ t = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128); @@ -41463,6 +41498,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, return target; } + case IX86_BUILTIN_NANQ: + case IX86_BUILTIN_NANSQ: + return expand_call (exp, target, ignore); + case IX86_BUILTIN_RDPMC: case IX86_BUILTIN_RDTSC: case IX86_BUILTIN_RDTSCP: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 305af6b92f0..426c8ad1865 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-12 Uros Bizjak + + PR target/71241 + * testsuite/gcc.dg/torture/float128-nan.c: New test. + 2016-06-12 Dominique d'Humieres PR target/60751 diff --git a/gcc/testsuite/gcc.dg/torture/float128-nan.c b/gcc/testsuite/gcc.dg/torture/float128-nan.c new file mode 100644 index 00000000000..b5706234987 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/float128-nan.c @@ -0,0 +1,101 @@ +/* Test __float128 NaN generation. */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-effective-target fenv_exceptions } */ +/* { dg-options "" } */ + +#include +#include + +typedef unsigned long long int uint64_t; + +typedef union +{ + __float128 value; + + struct +#ifdef __MINGW32__ + /* Make sure we are using gnu-style bitfield handling. */ + __attribute__ ((gcc_struct)) +#endif + { +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned negative:1; + unsigned exponent:15; + unsigned quiet_nan:1; + uint64_t mant_high:47; + uint64_t mant_low:64; +#else + uint64_t mant_low:64; + uint64_t mant_high:47; + unsigned quiet_nan:1; + unsigned exponent:15; + unsigned negative:1; +#endif + } nan; + +} ieee854_float128; + +bool +__attribute__((noinline, noclone)) +check_nan (__float128 val, bool quiet) +{ + ieee854_float128 u; + volatile __float128 tmp; + + u.value = val; + + if (u.nan.exponent != 0x7fff + || (u.nan.quiet_nan | u.nan.mant_high | u.nan.mant_low) == 0 + || u.nan.quiet_nan != quiet) + return false; + + if (!__builtin_isnan (u.value)) + return false; + + feclearexcept (FE_INVALID); + + tmp = u.value + u.value; + + if ((fetestexcept (FE_INVALID) != 0) == quiet) + return false; + + return true; +} + +int +main (void) +{ + __float128 nan; + + nan = __builtin_nanq (""); + + if (!check_nan (nan, true)) + __builtin_abort (); + + nan = __builtin_nanq ("0x0"); + + if (!check_nan (nan, true)) + __builtin_abort (); + + nan = __builtin_nanq ("0x1"); + + if (!check_nan (nan, true)) + __builtin_abort (); + + nan = __builtin_nansq (""); + + if (!check_nan (nan, false)) + __builtin_abort (); + + nan = __builtin_nansq ("0x0"); + + if (!check_nan (nan, false)) + __builtin_abort (); + + nan = __builtin_nansq ("0x1"); + + if (!check_nan (nan, false)) + __builtin_abort (); + + return 0; +} -- cgit v1.2.3 From 569453423ac5bd536b76945a4a6d81862ab9644a Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sun, 12 Jun 2016 18:05:36 +0000 Subject: Add missing commit: * doc/extend.texi (x86 Built-in Functions): Document __builtin_nanq and __builtin_nansq. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237339 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/doc/extend.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 7da516d7827..96b4f04234b 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -18476,6 +18476,14 @@ Similar to @code{__builtin_inf}, except the return type is @code{__float128}. @item __float128 __builtin_huge_valq (void) Similar to @code{__builtin_huge_val}, except the return type is @code{__float128}. @findex __builtin_huge_valq + +@item __float128 __builtin_nanq (void) +Similar to @code{__builtin_nan}, except the return type is @code{__float128}. +@findex __builtin_nanq + +@item __float128 __builtin_nansq (void) +Similar to @code{__builtin_nans}, except the return type is @code{__float128}. +@findex __builtin_nansq @end table The following built-in functions are always available and can be used to -- cgit v1.2.3 From fc267acd4b0ce89c2973b5b9b2a77c0e7a8e26b4 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sun, 12 Jun 2016 19:38:42 +0000 Subject: * config/i386/i386.c (ix86_init_builtins): Calculate FLOAT128_FTYPE_CONST_STRING function type only once. * doc/extend.texi (x86 Built-in Functions): Update text, __float128 built-in functions are available for x86-32 and x86-64 targets. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237342 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 44 ++++++++++++++++++++++---------------------- gcc/doc/extend.texi | 25 ++++++++++++------------- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a48316e0f9..c2f2a0b88ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-12 Uros Bizjak + + * config/i386/i386.c (ix86_init_builtins): Calculate + FLOAT128_FTYPE_CONST_STRING function type only once. + * doc/extend.texi (x86 Built-in Functions): Update text, __float128 + built-in functions are available for x86-32 and x86-64 targets. + 2016-06-12 Uros Bizjak PR target/71241 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index dd47305c5b0..c5e5e1238a5 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -38260,7 +38260,7 @@ ix86_init_builtin_types (void) static void ix86_init_builtins (void) { - tree t; + tree ftype, decl; ix86_init_builtin_types (); @@ -38273,31 +38273,31 @@ ix86_init_builtins (void) def_builtin_const (0, "__builtin_huge_valq", FLOAT128_FTYPE_VOID, IX86_BUILTIN_HUGE_VALQ); - t = ix86_get_builtin_func_type (FLOAT128_FTYPE_CONST_STRING); - t = add_builtin_function ("__builtin_nanq", t, IX86_BUILTIN_NANQ, - BUILT_IN_MD, "nanq", NULL_TREE); - TREE_READONLY (t) = 1; - ix86_builtins[(int) IX86_BUILTIN_NANQ] = t; + ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_CONST_STRING); + decl = add_builtin_function ("__builtin_nanq", ftype, IX86_BUILTIN_NANQ, + BUILT_IN_MD, "nanq", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_NANQ] = decl; - t = ix86_get_builtin_func_type (FLOAT128_FTYPE_CONST_STRING); - t = add_builtin_function ("__builtin_nansq", t, IX86_BUILTIN_NANSQ, - BUILT_IN_MD, "nansq", NULL_TREE); - TREE_READONLY (t) = 1; - ix86_builtins[(int) IX86_BUILTIN_NANSQ] = t; + decl = add_builtin_function ("__builtin_nansq", ftype, IX86_BUILTIN_NANSQ, + BUILT_IN_MD, "nansq", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_NANSQ] = decl; /* We will expand them to normal call if SSE isn't available since they are used by libgcc. */ - t = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128); - t = add_builtin_function ("__builtin_fabsq", t, IX86_BUILTIN_FABSQ, - BUILT_IN_MD, "__fabstf2", NULL_TREE); - TREE_READONLY (t) = 1; - ix86_builtins[(int) IX86_BUILTIN_FABSQ] = t; - - t = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128_FLOAT128); - t = add_builtin_function ("__builtin_copysignq", t, IX86_BUILTIN_COPYSIGNQ, - BUILT_IN_MD, "__copysigntf3", NULL_TREE); - TREE_READONLY (t) = 1; - ix86_builtins[(int) IX86_BUILTIN_COPYSIGNQ] = t; + ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128); + decl = add_builtin_function ("__builtin_fabsq", ftype, IX86_BUILTIN_FABSQ, + BUILT_IN_MD, "__fabstf2", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_FABSQ] = decl; + + ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128_FLOAT128); + decl = add_builtin_function ("__builtin_copysignq", ftype, + IX86_BUILTIN_COPYSIGNQ, BUILT_IN_MD, + "__copysigntf3", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_COPYSIGNQ] = decl; ix86_init_tm_builtins (); ix86_init_mmx_sse_builtins (); diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 96b4f04234b..a0633543602 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -18445,28 +18445,19 @@ integers, these use @code{V4SI}. Finally, some instructions operate on an entire vector register, interpreting it as a 128-bit integer, these use mode @code{TI}. -In 64-bit mode, the x86-64 family of processors uses additional built-in +The x86-32 and x86-64 family of processors use additional built-in functions for efficient use of @code{TF} (@code{__float128}) 128-bit floating point and @code{TC} 128-bit complex floating-point values. -The following floating-point built-in functions are available in 64-bit -mode. All of them implement the function that is part of the name. +The following floating-point built-in functions are always available. All +of them implement the function that is part of the name. @smallexample __float128 __builtin_fabsq (__float128) __float128 __builtin_copysignq (__float128, __float128) @end smallexample -The following built-in function is always available. - -@table @code -@item void __builtin_ia32_pause (void) -Generates the @code{pause} machine instruction with a compiler memory -barrier. -@end table - -The following floating-point built-in functions are made available in the -64-bit mode. +The following built-in functions are always available. @table @code @item __float128 __builtin_infq (void) @@ -18486,6 +18477,14 @@ Similar to @code{__builtin_nans}, except the return type is @code{__float128}. @findex __builtin_nansq @end table +The following built-in function is always available. + +@table @code +@item void __builtin_ia32_pause (void) +Generates the @code{pause} machine instruction with a compiler memory +barrier. +@end table + The following built-in functions are always available and can be used to check the target platform type. -- cgit v1.2.3 From e8b15a621787d67af5b0119063a010319f156072 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 13 Jun 2016 00:16:21 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237349 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 100a8bd68c0..aeb82dff722 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160612 +20160613 -- cgit v1.2.3 From 5419fd7944e95ef9f84fd9489ac90bae9040ea76 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 13 Jun 2016 07:17:16 +0000 Subject: Do not enable -fcheck-pointer-bounds w/ -fsanitize=bounds PR sanitizer/71458 * toplev.c (process_options): Do not enable -fcheck-pointer-bounds w/ -fsanitize=bounds. * gcc.target/i386/pr71458.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237353 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/i386/pr71458.c | 7 +++++++ gcc/toplev.c | 9 +++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr71458.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2f2a0b88ea..3ea7a014f5a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Martin Liska + + PR sanitizer/71458 + * toplev.c (process_options): Do not enable -fcheck-pointer-bounds + w/ -fsanitize=bounds. + 2016-06-12 Uros Bizjak * config/i386/i386.c (ix86_init_builtins): Calculate diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 426c8ad1865..f3245154d77 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Martin Liska + + * gcc.target/i386/pr71458.c: New test. + 2016-06-12 Uros Bizjak PR target/71241 diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c new file mode 100644 index 00000000000..27e7764b5a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr71458.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target { ! x32 } } } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=bounds" } */ +/* { dg-error "-fcheck-pointer-bounds is not supported with -fsanitize=bounds" "" { target *-*-* } 0 } */ + +enum {} a[0]; +void fn1(int); +void fn2() { fn1(a[-1]); } diff --git a/gcc/toplev.c b/gcc/toplev.c index 543b8a3dc72..f51d2cb2b77 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1276,6 +1276,15 @@ process_options (void) "Address Sanitizer"); flag_check_pointer_bounds = 0; } + + if (flag_sanitize & SANITIZE_BOUNDS) + { + error_at (UNKNOWN_LOCATION, + "-fcheck-pointer-bounds is not supported with " + "-fsanitize=bounds"); + flag_check_pointer_bounds = 0; + } + } /* One region RA really helps to decrease the code size. */ -- cgit v1.2.3 From d158cccc9750d3fdc52edd47156b1e4d18fdbb77 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 13 Jun 2016 07:28:33 +0000 Subject: 2016-06-13 Paolo Carlini * decl.c (grokdeclarator): Fix typo in pedwarn text. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237354 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 53d55d3b3a6..2b17452d812 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Paolo Carlini + + * decl.c (grokdeclarator): Fix typo in pedwarn text. + 2016-06-10 Thomas Schwinge PR c/71381 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ca36171d4f5..415689f535f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11365,7 +11365,7 @@ grokdeclarator (const cp_declarator *declarator, { if (storage_class == sc_static) pedwarn (input_location, OPT_Wpedantic, - "% specified invalid for function %qs " + "% specifier invalid for function %qs " "declared out of global scope", name); else pedwarn (input_location, OPT_Wpedantic, -- cgit v1.2.3 From bdf131d9ec8bef9361eb87d312cf4d1f28fd9d3a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 13 Jun 2016 07:34:45 +0000 Subject: 2016-06-13 Richard Biener PR middle-end/64516 * fold-const.c (fold_unary_loc): Preserve alignment when folding a VIEW_CONVERT_EXPR into a MEM_REF. * gcc.dg/align-3.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237355 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/align-3.c | 11 +++++++++++ 4 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/align-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ea7a014f5a..690bd02469d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Richard Biener + + PR middle-end/64516 + * fold-const.c (fold_unary_loc): Preserve alignment when + folding a VIEW_CONVERT_EXPR into a MEM_REF. + 2016-06-13 Martin Liska PR sanitizer/71458 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 7f8803ca57d..1a464ec8366 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7975,6 +7975,8 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) case VIEW_CONVERT_EXPR: if (TREE_CODE (op0) == MEM_REF) { + if (TYPE_ALIGN (TREE_TYPE (op0)) != TYPE_ALIGN (type)) + type = build_aligned_type (type, TYPE_ALIGN (TREE_TYPE (op0))); tem = fold_build2_loc (loc, MEM_REF, type, TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1)); REF_REVERSE_STORAGE_ORDER (tem) = REF_REVERSE_STORAGE_ORDER (op0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f3245154d77..a596a54e275 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Richard Biener + + PR middle-end/64516 + * gcc.dg/align-3.c: New testcase. + 2016-06-13 Martin Liska * gcc.target/i386/pr71458.c: New test. diff --git a/gcc/testsuite/gcc.dg/align-3.c b/gcc/testsuite/gcc.dg/align-3.c new file mode 100644 index 00000000000..5c97d5ac3cc --- /dev/null +++ b/gcc/testsuite/gcc.dg/align-3.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-rtl-expand" } */ + +typedef struct { char a[2]; } __attribute__((__packed__)) TU2; +unsigned short get16_unaligned(const void *p) { + unsigned short v; + *(TU2 *)(void *)(&v) = *(const TU2 *)p; + return v; +} + +/* { dg-final { scan-rtl-dump "MEM\[^\n\r\]*A8\\\]" "expand" } } */ -- cgit v1.2.3 From 5748afca43998b0276a0d3fde25598e9f9188f71 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 13 Jun 2016 07:40:47 +0000 Subject: * gcc-interface/utils2.c (known_alignment) : Deal specially with calls to malloc. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237356 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/utils2.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6f2fda6004b..41a6c619fe2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Eric Botcazou + + * gcc-interface/utils2.c (known_alignment) : Deal specially + with calls to malloc. + 2016-06-11 Eric Botcazou * gcc-interface/trans.c (build_binary_op_trapv): If no operand is a diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index a0804e8e86d..aeb6cc3a3f7 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -171,6 +171,10 @@ known_alignment (tree exp) case CALL_EXPR: { + tree func = get_callee_fndecl (exp); + if (func && DECL_IS_MALLOC (func)) + return get_target_system_allocator_alignment () * BITS_PER_UNIT; + tree t = maybe_inline_call_in_expr (exp); if (t) return known_alignment (t); -- cgit v1.2.3 From 93402efa94fd20c78a8857541e0f520badfbb6ef Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 13 Jun 2016 07:47:13 +0000 Subject: * generate_libstdcxx_web_docs: Use realpath to get absolute path. Add comment about LaTeX errors. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237357 138bc75d-0d04-0410-961f-82ee72b054a4 --- maintainer-scripts/ChangeLog | 5 +++++ maintainer-scripts/generate_libstdcxx_web_docs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index 9c50902504c..18513fbe56d 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Jonathan Wakely + + * generate_libstdcxx_web_docs: Use realpath to get absolute path. + Add comment about LaTeX errors. + 2016-04-15 Jakub Jelinek * crontab: Enable snapshots from gcc-6-branch. diff --git a/maintainer-scripts/generate_libstdcxx_web_docs b/maintainer-scripts/generate_libstdcxx_web_docs index 700e522e25c..00ebcbf7f67 100755 --- a/maintainer-scripts/generate_libstdcxx_web_docs +++ b/maintainer-scripts/generate_libstdcxx_web_docs @@ -3,7 +3,7 @@ # i.e. http://gcc.gnu.org/onlinedocs/gcc-x.y.z/libstdc++* SRCDIR=${1} -DOCSDIR=${2} +DOCSDIR=$(realpath ${2}) if ! [ $# -eq 2 -a -x "${SRCDIR}/configure" -a -d "${DOCSDIR}" ] then @@ -34,6 +34,9 @@ set -x ${SRCDIR}/configure --enable-languages=c,c++ --disable-gcc $disabled_libs --docdir=/docs eval `grep '^target=' config.log` make configure-target +# If the following step fails with an error like +# ! LaTeX Error: File `xtab.sty' not found. +# then you need to install the relevant TeX package e.g. texlive-xtab make -C $target/libstdc++-v3 doc-install-html doc-install-xml doc-install-pdf DESTDIR=$DESTDIR cd $DESTDIR/docs mkdir libstdc++ -- cgit v1.2.3 From 350e1bed361e465e6eccfe073aa8ca86973ef7e0 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Mon, 13 Jun 2016 07:48:25 +0000 Subject: 2016-06-13 Paul Thomas PR fortran/70673 * frontend-passes.c (realloc_string_callback): Add a call to gfc_dep_compare_expr. 2016-06-13 Paul Thomas PR fortran/70673 * gfortran.dg/pr70673.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237358 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 +++ gcc/fortran/frontend-passes.c | 71 +++++++++++++++++++---------------- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gfortran.dg/pr70673.f90 | 25 ++++++++++++ 4 files changed, 75 insertions(+), 32 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr70673.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b557b34e862..998255a9bff 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Paul Thomas + + PR fortran/70673 + * frontend-passes.c (realloc_string_callback): Add a call to + gfc_dep_compare_expr. + 2016-06-11 Dominique d'Humieres PR fortran/60751 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 37c42bb5e34..f02a52ace8b 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -45,7 +45,7 @@ static void realloc_strings (gfc_namespace *); static gfc_expr *create_var (gfc_expr *, const char *vname=NULL); static int inline_matmul_assign (gfc_code **, int *, void *); static gfc_code * create_do_loop (gfc_expr *, gfc_expr *, gfc_expr *, - locus *, gfc_namespace *, + locus *, gfc_namespace *, char *vname=NULL); /* How deep we are inside an argument list. */ @@ -108,7 +108,7 @@ static int var_num = 1; enum matrix_case { none=0, A2B2, A2B1, A1B2, A2B2T }; -/* Keep track of the number of expressions we have inserted so far +/* Keep track of the number of expressions we have inserted so far using create_var. */ int n_vars; @@ -142,7 +142,7 @@ gfc_run_passes (gfc_namespace *ns) /* Callback for each gfc_code node invoked from check_realloc_strings. For an allocatable LHS string which also appears as a variable on - the RHS, replace + the RHS, replace a = a(x:y) @@ -175,6 +175,13 @@ realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED, if (!gfc_check_dependency (expr1, expr2, true)) return 0; + /* gfc_check_dependency doesn't always pick up identical expressions. + However, eliminating the above sends the compiler into an infinite + loop on valid expressions. Without this check, the gimplifier emits + an ICE for a = a, where a is deferred character length. */ + if (!gfc_dep_compare_expr (expr1, expr2)) + return 0; + current_code = c; inserted_block = NULL; changed_statement = NULL; @@ -422,7 +429,7 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED, return 0; /* We don't do character functions with unknown charlens. */ - if ((*e)->ts.type == BT_CHARACTER + if ((*e)->ts.type == BT_CHARACTER && ((*e)->ts.u.cl == NULL || (*e)->ts.u.cl->length == NULL || (*e)->ts.u.cl->length->expr_type != EXPR_CONSTANT)) return 0; @@ -446,7 +453,7 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED, if ((*e)->rank > 0 && (*e)->shape == NULL && !flag_realloc_lhs) return 0; - + /* Skip the test for pure functions if -faggressive-function-elimination is specified. */ if ((*e)->value.function.esym) @@ -528,7 +535,7 @@ constant_string_length (gfc_expr *e) { res = gfc_get_constant_expr (BT_INTEGER, gfc_charlen_int_kind, &e->where); - + mpz_add_ui (res->value.integer, value, 1); mpz_clear (value); return res; @@ -568,7 +575,7 @@ insert_block () /* If the statement has a label, make sure it is transferred to the newly created block. */ - if ((*current_code)->here) + if ((*current_code)->here) { inserted_block->here = (*current_code)->here; (*current_code)->here = NULL; @@ -640,12 +647,12 @@ create_var (gfc_expr * e, const char *vname) for (i=0; irank; i++) { gfc_expr *p, *q; - + p = gfc_get_constant_expr (BT_INTEGER, gfc_default_integer_kind, &(e->where)); mpz_set_si (p->value.integer, 1); symbol->as->lower[i] = p; - + q = gfc_get_constant_expr (BT_INTEGER, gfc_index_integer_kind, &(e->where)); mpz_set (q->value.integer, e->shape[i]); @@ -812,7 +819,7 @@ cfe_code (gfc_code **c, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) *walk_subtrees = 0; return 0; } - + return 0; } @@ -1077,8 +1084,8 @@ optimize_binop_array_assignment (gfc_code *c, gfc_expr **rhs, bool seen_op) } } else if (seen_op && e->expr_type == EXPR_FUNCTION && e->rank > 0 - && ! (e->value.function.esym - && (e->value.function.esym->attr.elemental + && ! (e->value.function.esym + && (e->value.function.esym->attr.elemental || e->value.function.esym->attr.allocatable || e->value.function.esym->ts.type != c->expr1->ts.type || e->value.function.esym->ts.kind != c->expr1->ts.kind)) @@ -1104,7 +1111,7 @@ optimize_binop_array_assignment (gfc_code *c, gfc_expr **rhs, bool seen_op) new_expr = gfc_copy_expr (c->expr1); c->expr2 = e; *rhs = new_expr; - + return true; } @@ -1337,7 +1344,7 @@ optimize_power (gfc_expr *e) "_internal_iand", e->where, 2, op2, gfc_get_int_expr (e->ts.kind, &e->where, 1)); - + ishft = gfc_build_intrinsic_call (current_ns, GFC_ISYM_ISHFT, "_internal_ishft", e->where, 2, iand, gfc_get_int_expr (e->ts.kind, @@ -1672,7 +1679,7 @@ optimize_comparison (gfc_expr *e, gfc_intrinsic_op op) case INTRINSIC_EQ: result = eq == 0; break; - + case INTRINSIC_GE: result = eq >= 0; break; @@ -1692,7 +1699,7 @@ optimize_comparison (gfc_expr *e, gfc_intrinsic_op op) case INTRINSIC_LT: result = eq < 0; break; - + default: gfc_internal_error ("illegal OP in optimize_comparison"); break; @@ -1876,12 +1883,12 @@ doloop_code (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED, FOR_EACH_VEC_ELT (doloop_list, i, cl) { gfc_symbol *do_sym; - + if (cl == NULL) break; do_sym = cl->ext.iterator->var->symtree->n.sym; - + if (a->expr && a->expr->symtree && a->expr->symtree->n.sym == do_sym) { @@ -1953,7 +1960,7 @@ do_function (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED, break; do_sym = dl->ext.iterator->var->symtree->n.sym; - + if (a->expr && a->expr->symtree && a->expr->symtree->n.sym == do_sym) { @@ -2184,7 +2191,7 @@ runtime_error_ne (gfc_expr *e1, gfc_expr *e2, const char *msg) /* Handle matrix reallocation. Caller is responsible to insert into the code tree. - For the two-dimensional case, build + For the two-dimensional case, build if (allocated(c)) then if (size(c,1) /= size(a,1) .or. size(c,2) /= size(b,2)) then @@ -2277,7 +2284,7 @@ matmul_lhs_realloc (gfc_expr *c, gfc_expr *a, gfc_expr *b, /* We need two identical allocate statements in two branches of the IF statement. */ - + allocate1 = XCNEW (gfc_code); allocate1->op = EXEC_ALLOCATE; allocate1->ext.alloc.list = gfc_get_alloc (); @@ -2300,7 +2307,7 @@ matmul_lhs_realloc (gfc_expr *c, gfc_expr *a, gfc_expr *b, deallocate->ext.alloc.list->expr = gfc_copy_expr (c); deallocate->next = allocate1; deallocate->loc = c->where; - + if_size_2 = XCNEW (gfc_code); if_size_2->op = EXEC_IF; if_size_2->expr1 = cond; @@ -2580,7 +2587,7 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index, int count_index) /* Loop over the indices. For each index, create the expression index * stride + lbound(e, dim). */ - + i_index = 0; for (i=0; i < ar->dimen; i++) { @@ -2590,9 +2597,9 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index, int count_index) { gfc_expr *lbound, *nindex; gfc_expr *loopvar; - - loopvar = gfc_copy_expr (index[i_index]); - + + loopvar = gfc_copy_expr (index[i_index]); + if (ar->stride[i]) { gfc_expr *tmp; @@ -2610,7 +2617,7 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index, int count_index) } else nindex = loopvar; - + /* Calculate the lower bound of the expression. */ if (ar->start[i]) { @@ -2677,12 +2684,12 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index, int count_index) i + 1); gfc_free_expr (lbound_e); } - + ar->dimen_type[i] = DIMEN_ELEMENT; gfc_free_expr (ar->start[i]); ar->start[i] = get_operand (INTRINSIC_PLUS, nindex, lbound); - + gfc_free_expr (ar->end[i]); ar->end[i] = NULL; gfc_free_expr (ar->stride[i]); @@ -2781,7 +2788,7 @@ check_conjg_transpose_variable (gfc_expr *e, bool *conjg, bool *transpose) end do end do END BLOCK - + */ static int @@ -3213,7 +3220,7 @@ inline_matmul_assign (gfc_code **c, int *walk_subtrees, matrix_a->where, 1, ascalar); if (conjg_b) - bscalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg", + bscalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg", matrix_b->where, 1, bscalar); /* First loop comes after the zero assignment. */ @@ -3586,7 +3593,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn, /* This goto serves as a shortcut to avoid code duplication or a larger if or switch statement. */ goto check_omp_clauses; - + case EXEC_OMP_WORKSHARE: case EXEC_OMP_PARALLEL_WORKSHARE: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a596a54e275..506c7f77b53 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Paul Thomas + + PR fortran/70673 + * gfortran.dg/pr70673.f90: New test. + 2016-06-13 Richard Biener PR middle-end/64516 diff --git a/gcc/testsuite/gfortran.dg/pr70673.f90 b/gcc/testsuite/gfortran.dg/pr70673.f90 new file mode 100644 index 00000000000..67856e0332e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr70673.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! +! Test the fix for PR70673 +! +! Contributed by David Kinniburgh +! +module m +contains + subroutine s(inp) + character(*), intent(in) :: inp + character(:), allocatable :: a + a = a ! This used to ICE. + a = inp + a = a ! This used to ICE too + if ((len (a) .ne. 5) .or. (a .ne. "hello")) call abort + a = a(2:3) ! Make sure that temporary creation is not broken. + if ((len (a) .ne. 2) .or. (a .ne. "el")) call abort + deallocate (a) + a = a ! This would ICE too. + end subroutine s +end module m + + use m + call s("hello") +end -- cgit v1.2.3 From 84ca28c196d5a785a0006c65a600f65a2c3f306c Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 13 Jun 2016 08:00:17 +0000 Subject: * gcc-interface/decl.c (gnat_to_gnu_entity) : Deal with PLUS_EXPR in the expression of a renaming. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237360 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/decl.c | 1 + gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/renaming10.adb | 12 ++++++++++++ gcc/testsuite/gnat.dg/renaming10.ads | 9 +++++++++ 5 files changed, 31 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/renaming10.adb create mode 100644 gcc/testsuite/gnat.dg/renaming10.ads diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 41a6c619fe2..4ab664865a6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Deal with + PLUS_EXPR in the expression of a renaming. + 2016-06-13 Eric Botcazou * gcc-interface/utils2.c (known_alignment) : Deal specially diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 8d4ff3fd76c..985527ea5ec 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1003,6 +1003,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && !call_is_atomic_load (inner)) || TREE_CODE (inner) == ADDR_EXPR || TREE_CODE (inner) == NULL_EXPR + || TREE_CODE (inner) == PLUS_EXPR || TREE_CODE (inner) == CONSTRUCTOR || CONSTANT_CLASS_P (inner) /* We need to detect the case where a temporary is created to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 506c7f77b53..803f9b023ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Eric Botcazou + + * gnat.dg/renaming10.ad[sb]: New test. + 2016-06-13 Paul Thomas PR fortran/70673 diff --git a/gcc/testsuite/gnat.dg/renaming10.adb b/gcc/testsuite/gnat.dg/renaming10.adb new file mode 100644 index 00000000000..07d4312b060 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming10.adb @@ -0,0 +1,12 @@ +-- { dg-do compile } + +package body Renaming10 is + + function F (Input : Rec) return Natural is + Position : Natural renames Input.Position; + Index : Natural renames Natural'Succ(Position); + begin + return Index; + end; + +end Renaming10; diff --git a/gcc/testsuite/gnat.dg/renaming10.ads b/gcc/testsuite/gnat.dg/renaming10.ads new file mode 100644 index 00000000000..aeb9fc1a201 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming10.ads @@ -0,0 +1,9 @@ +package Renaming10 is + + type Rec is record + Position : Natural; + end record; + + function F (Input : Rec) return Natural; + +end Renaming10; -- cgit v1.2.3 From 38f9b2114ed35d23d203f0d85c97297a7f21e86a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 13 Jun 2016 08:17:07 +0000 Subject: * gcc-interface/decl.c (gnat_to_gnu_subprog_type): Build only a minimal PARM_DECL when the parameter type is dummy. * gcc-interface/trans.c (Call_to_gnu): Translate formal types before formal objects. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237362 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/gcc-interface/decl.c | 5 ++++- gcc/ada/gcc-interface/trans.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4ab664865a6..930e86681ff 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2016-06-13 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_subprog_type): Build only a minimal + PARM_DECL when the parameter type is dummy. + * gcc-interface/trans.c (Call_to_gnu): Translate formal types before + formal objects. + 2016-06-13 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Deal with diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 985527ea5ec..0ce2d47f195 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5959,8 +5959,11 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, else { + /* Build a minimal PARM_DECL without DECL_ARG_TYPE so that + Call_to_gnu will stop if it encounters the PARM_DECL. */ gnu_param - = create_param_decl (gnu_param_name, gnu_param_type); + = build_decl (input_location, PARM_DECL, gnu_param_name, + gnu_param_type); associate_subprog_with_dummy_type (gnat_subprog, gnu_param_type); incomplete_profile_p = true; diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 2f47e9aa63e..f110e928b93 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -4341,9 +4341,9 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, gnat_actual = Next_Actual (gnat_actual)) { Entity_Id gnat_formal_type = Etype (gnat_formal); + tree gnu_formal_type = gnat_to_gnu_type (gnat_formal_type); tree gnu_formal = present_gnu_tree (gnat_formal) ? get_gnu_tree (gnat_formal) : NULL_TREE; - tree gnu_formal_type = gnat_to_gnu_type (gnat_formal_type); const bool is_true_formal_parm = gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL; const bool is_by_ref_formal_parm -- cgit v1.2.3 From 9d4a99901f2f3d4c5d021df15aaabb76a4e4bdde Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 13 Jun 2016 08:18:51 +0000 Subject: 2016-06-13 Richard Biener * download_prerequisites (ISL): Bump version to 0.16.1 git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237363 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 ++++ contrib/download_prerequisites | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index e6eda90d5d3..c974b75e358 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Richard Biener + + * download_prerequisites (ISL): Bump version to 0.16.1 + 2016-06-10 Alan Hayward * check_GNU_style.sh: Fix paste args for BSD diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites index b135f5fe5f1..917ee23f3d9 100755 --- a/contrib/download_prerequisites +++ b/contrib/download_prerequisites @@ -48,7 +48,7 @@ ln -sf $MPC mpc || exit 1 # Necessary to build GCC with the Graphite loop optimizations. if [ "$GRAPHITE_LOOP_OPT" = "yes" ] ; then - ISL=isl-0.15 + ISL=isl-0.16.1 wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$ISL.tar.bz2 || exit 1 tar xjf $ISL.tar.bz2 || exit 1 -- cgit v1.2.3 From 565cad693e582c2444803d8447f5643a9c8ee30a Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 13 Jun 2016 08:34:45 +0000 Subject: S/390: Fix MAX_ARGS value. gcc/ChangeLog: 2016-06-13 Andreas Krebbel PR target/71379 * config/s390/s390.c (s390_expand_builtin): Increase MAX_ARGS by one. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237364 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/s390/s390.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 690bd02469d..3992ed3442e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Andreas Krebbel + + PR target/71379 + * config/s390/s390.c (s390_expand_builtin): Increase MAX_ARGS by + one. + 2016-06-13 Richard Biener PR middle-end/64516 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 48b8222bf87..ee0187c67f7 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -791,7 +791,7 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) { -#define MAX_ARGS 5 +#define MAX_ARGS 6 tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); unsigned int fcode = DECL_FUNCTION_CODE (fndecl); -- cgit v1.2.3 From b9266a19e39470d9f8dd67d519e5e8049bcbe99c Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 13 Jun 2016 08:57:02 +0000 Subject: PR middle-end/71476 * gimplify.c (maybe_warn_switch_unreachable): Factored out of gimplify_switch_expr. (warn_switch_unreachable_r): New function. * c-c++-common/Wswitch-unreachable-4.c: New test. * gcc.dg/Wswitch-unreachable-2.c: New test. * g++.dg/tm/jump1.C: Move dg-warning. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237367 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 ++ gcc/gimplify.c | 102 ++++++++++++++------- gcc/testsuite/ChangeLog | 7 ++ gcc/testsuite/c-c++-common/Wswitch-unreachable-4.c | 25 +++++ gcc/testsuite/g++.dg/tm/jump1.C | 4 +- gcc/testsuite/gcc.dg/Wswitch-unreachable-2.c | 12 +++ 6 files changed, 122 insertions(+), 35 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/Wswitch-unreachable-4.c create mode 100644 gcc/testsuite/gcc.dg/Wswitch-unreachable-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3992ed3442e..ae42dc98622 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-13 Marek Polacek + + PR middle-end/71476 + * gimplify.c (maybe_warn_switch_unreachable): Factored out of + gimplify_switch_expr. + (warn_switch_unreachable_r): New function. + 2016-06-13 Andreas Krebbel PR target/71379 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7c19cf335be..ae8b4fcce3c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1559,6 +1559,73 @@ gimplify_statement_list (tree *expr_p, gimple_seq *pre_p) return GS_ALL_DONE; } +/* Callback for walk_gimple_seq. */ + +static tree +warn_switch_unreachable_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p, + struct walk_stmt_info *wi) +{ + gimple *stmt = gsi_stmt (*gsi_p); + + *handled_ops_p = true; + switch (gimple_code (stmt)) + { + case GIMPLE_TRY: + /* A compiler-generated cleanup or a user-written try block. + If it's empty, don't dive into it--that would result in + worse location info. */ + if (gimple_try_eval (stmt) == NULL) + { + wi->info = stmt; + return integer_zero_node; + } + /* Fall through. */ + case GIMPLE_BIND: + case GIMPLE_CATCH: + case GIMPLE_EH_FILTER: + case GIMPLE_TRANSACTION: + /* Walk the sub-statements. */ + *handled_ops_p = false; + break; + default: + /* Save the first "real" statement (not a decl/lexical scope/...). */ + wi->info = stmt; + return integer_zero_node; + } + return NULL_TREE; +} + +/* Possibly warn about unreachable statements between switch's controlling + expression and the first case. SEQ is the body of a switch expression. */ + +static void +maybe_warn_switch_unreachable (gimple_seq seq) +{ + if (!warn_switch_unreachable + /* This warning doesn't play well with Fortran when optimizations + are on. */ + || lang_GNU_Fortran () + || seq == NULL) + return; + + struct walk_stmt_info wi; + memset (&wi, 0, sizeof (wi)); + walk_gimple_seq (seq, warn_switch_unreachable_r, NULL, &wi); + gimple *stmt = (gimple *) wi.info; + + if (stmt && gimple_code (stmt) != GIMPLE_LABEL) + { + if (gimple_code (stmt) == GIMPLE_GOTO + && TREE_CODE (gimple_goto_dest (stmt)) == LABEL_DECL + && DECL_ARTIFICIAL (gimple_goto_dest (stmt))) + /* Don't warn for compiler-generated gotos. These occur + in Duff's devices, for example. */; + else + warning_at (gimple_location (stmt), OPT_Wswitch_unreachable, + "statement will never be executed"); + } +} + /* Gimplify a SWITCH_EXPR, and collect the vector of labels it can branch to. */ @@ -1596,39 +1663,8 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p) gimplify_stmt (&SWITCH_BODY (switch_expr), &switch_body_seq); - /* Possibly warn about unreachable statements between switch's - controlling expression and the first case. */ - if (warn_switch_unreachable - /* This warning doesn't play well with Fortran when optimizations - are on. */ - && !lang_GNU_Fortran () - && switch_body_seq != NULL) - { - gimple_seq seq = switch_body_seq; - /* Look into the innermost lexical scope. */ - while (gimple_code (seq) == GIMPLE_BIND) - seq = gimple_bind_body (as_a (seq)); - gimple *stmt = gimple_seq_first_stmt (seq); - if (gimple_code (stmt) == GIMPLE_TRY) - { - /* A compiler-generated cleanup or a user-written try block. - Try to get the first statement in its try-block, for better - location. */ - if ((seq = gimple_try_eval (stmt))) - stmt = gimple_seq_first_stmt (seq); - } - if (gimple_code (stmt) != GIMPLE_LABEL) - { - if (gimple_code (stmt) == GIMPLE_GOTO - && TREE_CODE (gimple_goto_dest (stmt)) == LABEL_DECL - && DECL_ARTIFICIAL (gimple_goto_dest (stmt))) - /* Don't warn for compiler-generated gotos. These occur - in Duff's devices, for example. */; - else - warning_at (gimple_location (stmt), OPT_Wswitch_unreachable, - "statement will never be executed"); - } - } + maybe_warn_switch_unreachable (switch_body_seq); + labels = gimplify_ctxp->case_labels; gimplify_ctxp->case_labels = saved_labels; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 803f9b023ff..98af7659e1b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-06-13 Marek Polacek + + PR middle-end/71476 + * c-c++-common/Wswitch-unreachable-4.c: New test. + * gcc.dg/Wswitch-unreachable-2.c: New test. + * g++.dg/tm/jump1.C: Move dg-warning. + 2016-06-13 Eric Botcazou * gnat.dg/renaming10.ad[sb]: New test. diff --git a/gcc/testsuite/c-c++-common/Wswitch-unreachable-4.c b/gcc/testsuite/c-c++-common/Wswitch-unreachable-4.c new file mode 100644 index 00000000000..e7378a7cf18 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wswitch-unreachable-4.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ + +void +foo (int a, int b) +{ + switch (a) + { + { int c; } + { int d; } + { int e; } + b++; /* { dg-warning "statement will never be executed" } */ + case 1: + break; + } + + switch (a) + { + { int c; } + { int d = 1; } /* { dg-warning "statement will never be executed" } */ + { int e; } + b++; + case 1: + break; + } +} diff --git a/gcc/testsuite/g++.dg/tm/jump1.C b/gcc/testsuite/g++.dg/tm/jump1.C index e28282dc624..a27c2011861 100644 --- a/gcc/testsuite/g++.dg/tm/jump1.C +++ b/gcc/testsuite/g++.dg/tm/jump1.C @@ -14,8 +14,8 @@ void f() switch (i) { - synchronized { // { dg-warning "statement will never be executed" } - ++i; + synchronized { + ++i; // { dg-warning "statement will never be executed" } case 42: // { dg-error "" } ++i; } diff --git a/gcc/testsuite/gcc.dg/Wswitch-unreachable-2.c b/gcc/testsuite/gcc.dg/Wswitch-unreachable-2.c new file mode 100644 index 00000000000..343baea1245 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wswitch-unreachable-2.c @@ -0,0 +1,12 @@ +/* PR middle-end/71476 */ +/* { dg-do compile } */ +/* { dg-options "-Wswitch-unreachable" } */ + +void +foo (int a) +{ + switch (a) + { + void f (void) { } + } +} -- cgit v1.2.3 From 09f7e7117d2c774f4270c3b826d43ad109df9d06 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 13 Jun 2016 09:44:51 +0000 Subject: 2016-06-13 Richard Biener PR tree-optimization/71505 * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Make assert match comment. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237368 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/tree-vect-data-refs.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae42dc98622..fbd985b01b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Richard Biener + + PR tree-optimization/71505 + * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Make + assert match comment. + 2016-06-13 Marek Polacek PR middle-end/71476 diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index e640bbda790..084469f2afe 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2752,7 +2752,7 @@ vect_analyze_data_ref_accesses (vec_info *vinfo) /* Sorting has ensured that DR_INIT (dra) <= DR_INIT (drb). */ HOST_WIDE_INT init_a = TREE_INT_CST_LOW (DR_INIT (dra)); HOST_WIDE_INT init_b = TREE_INT_CST_LOW (DR_INIT (drb)); - gcc_assert (init_a < init_b); + gcc_assert (init_a <= init_b); /* If init_b == init_a + the size of the type * k, we have an interleaving, and DRA is accessed before DRB. */ -- cgit v1.2.3 From 84fe4d46cc27380021984320b9d02115ee049b44 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 13 Jun 2016 10:00:17 +0000 Subject: Change enum value to not to clash with a MSP430 private enum * predict.c (enum predictor_reason): Prefix enum with REASON_. (combine_predictions_for_insn): Likewise. (prune_predictions_for_bb): Likewise. (combine_predictions_for_bb): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237370 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/predict.c | 28 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fbd985b01b3..88506a587eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-13 Martin Liska + + * predict.c (enum predictor_reason): Prefix enum with REASON_. + (combine_predictions_for_insn): Likewise. + (prune_predictions_for_bb): Likewise. + (combine_predictions_for_bb): Likewise. + 2016-06-13 Richard Biener PR tree-optimization/71505 diff --git a/gcc/predict.c b/gcc/predict.c index 7a3398427e4..7d55ff7c71c 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -59,10 +59,10 @@ along with GCC; see the file COPYING3. If not see enum predictor_reason { - NONE, - IGNORED, - SINGLE_EDGE_DUPLICATE, - EDGE_PAIR_DUPLICATE + REASON_NONE, + REASON_IGNORED, + REASON_SINGLE_EDGE_DUPLICATE, + REASON_EDGE_PAIR_DUPLICATE }; /* String messages for the aforementioned enum. */ @@ -739,7 +739,7 @@ invert_br_probabilities (rtx insn) static void dump_prediction (FILE *file, enum br_predictor predictor, int probability, - basic_block bb, enum predictor_reason reason = NONE, + basic_block bb, enum predictor_reason reason = REASON_NONE, edge ep_edge = NULL) { edge e = ep_edge; @@ -864,9 +864,9 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) else { dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, - bb, !first_match ? NONE : IGNORED); + bb, !first_match ? REASON_NONE : REASON_IGNORED); dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, - bb, first_match ? NONE: IGNORED); + bb, first_match ? REASON_NONE : REASON_IGNORED); } if (first_match) @@ -883,7 +883,7 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) dump_prediction (dump_file, predictor, probability, bb, (!first_match || best_predictor == predictor) - ? NONE : IGNORED); + ? REASON_NONE : REASON_IGNORED); *pnote = XEXP (*pnote, 1); } else @@ -996,7 +996,7 @@ prune_predictions_for_bb (basic_block bb) /* Remove a duplicate predictor. */ dump_prediction (dump_file, pred->ep_predictor, pred->ep_probability, bb, - SINGLE_EDGE_DUPLICATE, pred->ep_edge); + REASON_SINGLE_EDGE_DUPLICATE, pred->ep_edge); remove.add (pred); } @@ -1008,11 +1008,11 @@ prune_predictions_for_bb (basic_block bb) for both edges. */ dump_prediction (dump_file, existing->ep_predictor, pred->ep_probability, bb, - EDGE_PAIR_DUPLICATE, + REASON_EDGE_PAIR_DUPLICATE, existing->ep_edge); dump_prediction (dump_file, pred->ep_predictor, pred->ep_probability, bb, - EDGE_PAIR_DUPLICATE, + REASON_EDGE_PAIR_DUPLICATE, pred->ep_edge); remove.add (existing); @@ -1150,9 +1150,9 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) else { dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, bb, - !first_match ? NONE : IGNORED); + !first_match ? REASON_NONE : REASON_IGNORED); dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, bb, - first_match ? NONE : IGNORED); + first_match ? REASON_NONE : REASON_IGNORED); } if (first_match) @@ -1168,7 +1168,7 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) dump_prediction (dump_file, predictor, probability, bb, (!first_match || best_predictor == predictor) - ? NONE : IGNORED, pred->ep_edge); + ? REASON_NONE : REASON_IGNORED, pred->ep_edge); } } clear_bb_predictions (bb); -- cgit v1.2.3 From 8b6e3f9465a06f76dba4811400f2bfc980a3a67a Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Mon, 13 Jun 2016 11:07:35 +0000 Subject: 2016-06-13 Alan Hayward gcc/ PR tree-optimization/71416 * tree-vect-loop.c (vectorizable_live_operation): Let worklist have multiple entries git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237375 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/tree-vect-loop.c | 11 +++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 88506a587eb..e8ad4c85a2d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Alan Hayward + + PR tree-optimization/71416 + * tree-vect-loop.c (vectorizable_live_operation): Let worklist have + multiple entries + 2016-06-13 Martin Liska * predict.c (enum predictor_reason): Prefix enum with REASON_. diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 1231b95f6a7..91d0608e59c 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6351,7 +6351,7 @@ vectorizable_live_operation (gimple *stmt, FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs) if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) worklist.safe_push (use_stmt); - gcc_assert (worklist.length () == 1); + gcc_assert (worklist.length () >= 1); bitsize = TYPE_SIZE (TREE_TYPE (vectype)); vec_bitsize = TYPE_SIZE (vectype); @@ -6409,9 +6409,12 @@ vectorizable_live_operation (gimple *stmt, /* Replace all uses of the USE_STMT in the worklist with the newly inserted statement. */ - use_stmt = worklist.pop (); - replace_uses_by (gimple_phi_result (use_stmt), new_tree); - update_stmt (use_stmt); + while (!worklist.is_empty ()) + { + use_stmt = worklist.pop (); + replace_uses_by (gimple_phi_result (use_stmt), new_tree); + update_stmt (use_stmt); + } return true; } -- cgit v1.2.3 From 473870ba8ab8f050bb73925e039bce9e558caec5 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Mon, 13 Jun 2016 11:21:45 +0000 Subject: Move optimize_minmax_comparison to match.pd 2016-06-13 Marc Glisse * fold-const.c (optimize_minmax_comparison): Remove. (fold_comparison): Remove call to the above. * match.pd (MIN (X, Y) == X, MIN (X, 5) == 0, MIN (X, C1) < C2): New transformations. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237376 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 ++++ gcc/fold-const.c | 118 ------------------------------------------------------- gcc/match.pd | 32 +++++++++++++++ 3 files changed, 39 insertions(+), 118 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8ad4c85a2d..9c02bea3dd2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-13 Marc Glisse + + * fold-const.c (optimize_minmax_comparison): Remove. + (fold_comparison): Remove call to the above. + * match.pd (MIN (X, Y) == X, MIN (X, 5) == 0, MIN (X, C1) < C2): + New transformations. + 2016-06-13 Alan Hayward PR tree-optimization/71416 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1a464ec8366..26c1435ed0c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -128,8 +128,6 @@ static tree range_successor (tree); static tree fold_range_test (location_t, enum tree_code, tree, tree, tree); static tree fold_cond_expr_with_comparison (location_t, tree, tree, tree, tree); static tree unextend (tree, int, int, tree); -static tree optimize_minmax_comparison (location_t, enum tree_code, - tree, tree, tree); static tree extract_muldiv (tree, tree, enum tree_code, tree, bool *); static tree extract_muldiv_1 (tree, tree, enum tree_code, tree, bool *); static tree fold_binary_op_with_conditional_arg (location_t, @@ -5979,110 +5977,6 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type, const_binop (BIT_IOR_EXPR, l_const, r_const)); } -/* Optimize T, which is a comparison of a MIN_EXPR or MAX_EXPR with a - constant. */ - -static tree -optimize_minmax_comparison (location_t loc, enum tree_code code, tree type, - tree op0, tree op1) -{ - tree arg0 = op0; - enum tree_code op_code; - tree comp_const; - tree minmax_const; - int consts_equal, consts_lt; - tree inner; - - STRIP_SIGN_NOPS (arg0); - - op_code = TREE_CODE (arg0); - minmax_const = TREE_OPERAND (arg0, 1); - comp_const = fold_convert_loc (loc, TREE_TYPE (arg0), op1); - consts_equal = tree_int_cst_equal (minmax_const, comp_const); - consts_lt = tree_int_cst_lt (minmax_const, comp_const); - inner = TREE_OPERAND (arg0, 0); - - /* If something does not permit us to optimize, return the original tree. */ - if ((op_code != MIN_EXPR && op_code != MAX_EXPR) - || TREE_CODE (comp_const) != INTEGER_CST - || TREE_OVERFLOW (comp_const) - || TREE_CODE (minmax_const) != INTEGER_CST - || TREE_OVERFLOW (minmax_const)) - return NULL_TREE; - - /* Now handle all the various comparison codes. We only handle EQ_EXPR - and GT_EXPR, doing the rest with recursive calls using logical - simplifications. */ - switch (code) - { - case NE_EXPR: case LT_EXPR: case LE_EXPR: - { - tree tem - = optimize_minmax_comparison (loc, - invert_tree_comparison (code, false), - type, op0, op1); - if (tem) - return invert_truthvalue_loc (loc, tem); - return NULL_TREE; - } - - case GE_EXPR: - return - fold_build2_loc (loc, TRUTH_ORIF_EXPR, type, - optimize_minmax_comparison - (loc, EQ_EXPR, type, arg0, comp_const), - optimize_minmax_comparison - (loc, GT_EXPR, type, arg0, comp_const)); - - case EQ_EXPR: - if (op_code == MAX_EXPR && consts_equal) - /* MAX (X, 0) == 0 -> X <= 0 */ - return fold_build2_loc (loc, LE_EXPR, type, inner, comp_const); - - else if (op_code == MAX_EXPR && consts_lt) - /* MAX (X, 0) == 5 -> X == 5 */ - return fold_build2_loc (loc, EQ_EXPR, type, inner, comp_const); - - else if (op_code == MAX_EXPR) - /* MAX (X, 0) == -1 -> false */ - return omit_one_operand_loc (loc, type, integer_zero_node, inner); - - else if (consts_equal) - /* MIN (X, 0) == 0 -> X >= 0 */ - return fold_build2_loc (loc, GE_EXPR, type, inner, comp_const); - - else if (consts_lt) - /* MIN (X, 0) == 5 -> false */ - return omit_one_operand_loc (loc, type, integer_zero_node, inner); - - else - /* MIN (X, 0) == -1 -> X == -1 */ - return fold_build2_loc (loc, EQ_EXPR, type, inner, comp_const); - - case GT_EXPR: - if (op_code == MAX_EXPR && (consts_equal || consts_lt)) - /* MAX (X, 0) > 0 -> X > 0 - MAX (X, 0) > 5 -> X > 5 */ - return fold_build2_loc (loc, GT_EXPR, type, inner, comp_const); - - else if (op_code == MAX_EXPR) - /* MAX (X, 0) > -1 -> true */ - return omit_one_operand_loc (loc, type, integer_one_node, inner); - - else if (op_code == MIN_EXPR && (consts_equal || consts_lt)) - /* MIN (X, 0) > 0 -> false - MIN (X, 0) > 5 -> false */ - return omit_one_operand_loc (loc, type, integer_zero_node, inner); - - else - /* MIN (X, 0) > -1 -> X > -1 */ - return fold_build2_loc (loc, GT_EXPR, type, inner, comp_const); - - default: - return NULL_TREE; - } -} - /* T is an integer expression that is being multiplied, divided, or taken a modulus (CODE says which and what kind of divide or modulus) by a constant C. See if we can eliminate that operation by folding it with @@ -8721,18 +8615,6 @@ fold_comparison (location_t loc, enum tree_code code, tree type, if (tem) return tem; - /* If this is comparing a constant with a MIN_EXPR or a MAX_EXPR of a - constant, we can simplify it. */ - if (TREE_CODE (arg1) == INTEGER_CST - && (TREE_CODE (arg0) == MIN_EXPR - || TREE_CODE (arg0) == MAX_EXPR) - && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) - { - tem = optimize_minmax_comparison (loc, code, type, op0, op1); - if (tem) - return tem; - } - /* If we are comparing an expression that just has comparisons of two integer values, arithmetic expressions of those comparisons, and constants, we can simplify it. There are only three cases diff --git a/gcc/match.pd b/gcc/match.pd index 7d4beeaa4ed..980b73b9a19 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1312,6 +1312,38 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (minmax (bit_not:s@2 @0) (bit_not:s@3 @1)) (bit_not (maxmin @0 @1)))) +/* MIN (X, Y) == X -> X <= Y */ +(for minmax (min min max max) + cmp (eq ne eq ne ) + out (le gt ge lt ) + (simplify + (cmp:c (minmax:c @0 @1) @0) + (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))) + (out @0 @1)))) +/* MIN (X, 5) == 0 -> X == 0 + MIN (X, 5) == 7 -> false */ +(for cmp (eq ne) + (simplify + (cmp (min @0 INTEGER_CST@1) INTEGER_CST@2) + (if (wi::lt_p (@1, @2, TYPE_SIGN (TREE_TYPE (@0)))) + { constant_boolean_node (cmp == NE_EXPR, type); } + (if (wi::gt_p (@1, @2, TYPE_SIGN (TREE_TYPE (@0)))) + (cmp @0 @2))))) +(for cmp (eq ne) + (simplify + (cmp (max @0 INTEGER_CST@1) INTEGER_CST@2) + (if (wi::gt_p (@1, @2, TYPE_SIGN (TREE_TYPE (@0)))) + { constant_boolean_node (cmp == NE_EXPR, type); } + (if (wi::lt_p (@1, @2, TYPE_SIGN (TREE_TYPE (@0)))) + (cmp @0 @2))))) +/* MIN (X, C1) < C2 -> X < C2 || C1 < C2 */ +(for minmax (min min max max min min max max ) + cmp (lt le gt ge gt ge lt le ) + comb (bit_ior bit_ior bit_ior bit_ior bit_and bit_and bit_and bit_and) + (simplify + (cmp (minmax @0 INTEGER_CST@1) INTEGER_CST@2) + (comb (cmp @0 @2) (cmp @1 @2)))) + /* Simplifications of shift and rotates. */ (for rotate (lrotate rrotate) -- cgit v1.2.3 From 79350139341de3ddc20b5b670f74fe2dc5b37338 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 13 Jun 2016 12:04:57 +0000 Subject: S/390: Change builtin type naming scheme to match builtin-types.def. gcc/ChangeLog: 2016-06-13 Andreas Krebbel * config/s390/s390-builtin-types.def: Change builtin type naming scheme to match builtin-types.def. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237377 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 + gcc/config/s390/s390-builtin-types.def | 420 ++++++++++++++++----------------- 2 files changed, 215 insertions(+), 210 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c02bea3dd2..9ada2cfd5fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Andreas Krebbel + + * config/s390/s390-builtin-types.def: Change builtin type naming + scheme to match builtin-types.def. + 2016-06-13 Marc Glisse * fold-const.c (optimize_minmax_comparison): Remove. diff --git a/gcc/config/s390/s390-builtin-types.def b/gcc/config/s390/s390-builtin-types.def index 6179b040e27..3d90d41dee3 100644 --- a/gcc/config/s390/s390-builtin-types.def +++ b/gcc/config/s390/s390-builtin-types.def @@ -19,29 +19,29 @@ along with GCC; see the file COPYING3. If not see . */ -#define DEF_FN_TYPE_1(FN_TYPE, FLAGS, T1) \ +#define DEF_FN_TYPE_0(FN_TYPE, FLAGS, T1) \ DEF_FN_TYPE (FN_TYPE, \ FLAGS, \ s390_builtin_types[T1]) -#define DEF_FN_TYPE_2(FN_TYPE, FLAGS, T1, T2) \ +#define DEF_FN_TYPE_1(FN_TYPE, FLAGS, T1, T2) \ DEF_FN_TYPE (FN_TYPE, \ FLAGS, \ s390_builtin_types[T1], \ s390_builtin_types[T2]) -#define DEF_FN_TYPE_3(FN_TYPE, FLAGS, T1, T2, T3) \ +#define DEF_FN_TYPE_2(FN_TYPE, FLAGS, T1, T2, T3) \ DEF_FN_TYPE (FN_TYPE, \ FLAGS, \ s390_builtin_types[T1], \ s390_builtin_types[T2], \ s390_builtin_types[T3]) -#define DEF_FN_TYPE_4(FN_TYPE, FLAGS, T1, T2, T3, T4) \ +#define DEF_FN_TYPE_3(FN_TYPE, FLAGS, T1, T2, T3, T4) \ DEF_FN_TYPE (FN_TYPE, \ FLAGS, \ s390_builtin_types[T1], \ s390_builtin_types[T2], \ s390_builtin_types[T3], \ s390_builtin_types[T4]) -#define DEF_FN_TYPE_5(FN_TYPE, FLAGS, T1, T2, T3, T4, T5) \ +#define DEF_FN_TYPE_4(FN_TYPE, FLAGS, T1, T2, T3, T4, T5) \ DEF_FN_TYPE (FN_TYPE, \ FLAGS, \ s390_builtin_types[T1], \ @@ -49,7 +49,7 @@ s390_builtin_types[T3], \ s390_builtin_types[T4], \ s390_builtin_types[T5]) -#define DEF_FN_TYPE_6(FN_TYPE, FLAGS, T1, T2, T3, T4, T5, T6) \ +#define DEF_FN_TYPE_5(FN_TYPE, FLAGS, T1, T2, T3, T4, T5, T6) \ DEF_FN_TYPE (FN_TYPE, \ FLAGS, \ s390_builtin_types[T1], \ @@ -126,210 +126,210 @@ DEF_OPAQUE_VECTOR_TYPE (BT_OUV4SI, B_VX, BT_UINT, 4) DEF_OPAQUE_VECTOR_TYPE (BT_BV4SI, B_VX, BT_BINT, 4) DEF_OPAQUE_VECTOR_TYPE (BT_BV2DI, B_VX, BT_BLONGLONG, 2) DEF_OPAQUE_VECTOR_TYPE (BT_BV8HI, B_VX, BT_BSHORT, 8) -DEF_FN_TYPE_1 (BT_FN_INT, B_HTM, BT_INT) -DEF_FN_TYPE_1 (BT_FN_UINT, 0, BT_UINT) -DEF_FN_TYPE_2 (BT_FN_INT_INT, B_VX, BT_INT, BT_INT) -DEF_FN_TYPE_2 (BT_FN_INT_VOIDPTR, B_HTM, BT_INT, BT_VOIDPTR) -DEF_FN_TYPE_2 (BT_FN_OV4SI_INT, B_VX, BT_OV4SI, BT_INT) -DEF_FN_TYPE_2 (BT_FN_OV4SI_INTCONSTPTR, B_VX, BT_OV4SI, BT_INTCONSTPTR) -DEF_FN_TYPE_2 (BT_FN_OV4SI_OV4SI, B_VX, BT_OV4SI, BT_OV4SI) -DEF_FN_TYPE_2 (BT_FN_UV16QI_UCHAR, B_VX, BT_UV16QI, BT_UCHAR) -DEF_FN_TYPE_2 (BT_FN_UV16QI_UCHARCONSTPTR, B_VX, BT_UV16QI, BT_UCHARCONSTPTR) -DEF_FN_TYPE_2 (BT_FN_UV16QI_USHORT, B_VX, BT_UV16QI, BT_USHORT) -DEF_FN_TYPE_2 (BT_FN_UV16QI_UV16QI, B_VX, BT_UV16QI, BT_UV16QI) -DEF_FN_TYPE_2 (BT_FN_UV2DI_ULONGLONG, B_VX, BT_UV2DI, BT_ULONGLONG) -DEF_FN_TYPE_2 (BT_FN_UV2DI_ULONGLONGCONSTPTR, B_VX, BT_UV2DI, BT_ULONGLONGCONSTPTR) -DEF_FN_TYPE_2 (BT_FN_UV2DI_USHORT, B_VX, BT_UV2DI, BT_USHORT) -DEF_FN_TYPE_2 (BT_FN_UV2DI_UV2DI, B_VX, BT_UV2DI, BT_UV2DI) -DEF_FN_TYPE_2 (BT_FN_UV2DI_UV4SI, B_VX, BT_UV2DI, BT_UV4SI) -DEF_FN_TYPE_2 (BT_FN_UV4SI_UINT, B_VX, BT_UV4SI, BT_UINT) -DEF_FN_TYPE_2 (BT_FN_UV4SI_UINTCONSTPTR, B_VX, BT_UV4SI, BT_UINTCONSTPTR) -DEF_FN_TYPE_2 (BT_FN_UV4SI_USHORT, B_VX, BT_UV4SI, BT_USHORT) -DEF_FN_TYPE_2 (BT_FN_UV4SI_UV4SI, B_VX, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_2 (BT_FN_UV4SI_UV8HI, B_VX, BT_UV4SI, BT_UV8HI) -DEF_FN_TYPE_2 (BT_FN_UV8HI_USHORT, B_VX, BT_UV8HI, BT_USHORT) -DEF_FN_TYPE_2 (BT_FN_UV8HI_USHORTCONSTPTR, B_VX, BT_UV8HI, BT_USHORTCONSTPTR) -DEF_FN_TYPE_2 (BT_FN_UV8HI_UV16QI, B_VX, BT_UV8HI, BT_UV16QI) -DEF_FN_TYPE_2 (BT_FN_UV8HI_UV8HI, B_VX, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_2 (BT_FN_V16QI_SCHAR, B_VX, BT_V16QI, BT_SCHAR) -DEF_FN_TYPE_2 (BT_FN_V16QI_UCHAR, B_VX, BT_V16QI, BT_UCHAR) -DEF_FN_TYPE_2 (BT_FN_V16QI_V16QI, B_VX, BT_V16QI, BT_V16QI) -DEF_FN_TYPE_2 (BT_FN_V2DF_DBL, B_VX, BT_V2DF, BT_DBL) -DEF_FN_TYPE_2 (BT_FN_V2DF_FLTCONSTPTR, B_VX, BT_V2DF, BT_FLTCONSTPTR) -DEF_FN_TYPE_2 (BT_FN_V2DF_V2DF, B_VX, BT_V2DF, BT_V2DF) -DEF_FN_TYPE_2 (BT_FN_V2DI_SHORT, B_VX, BT_V2DI, BT_SHORT) -DEF_FN_TYPE_2 (BT_FN_V2DI_V16QI, B_VX, BT_V2DI, BT_V16QI) -DEF_FN_TYPE_2 (BT_FN_V2DI_V2DI, B_VX, BT_V2DI, BT_V2DI) -DEF_FN_TYPE_2 (BT_FN_V2DI_V4SI, B_VX, BT_V2DI, BT_V4SI) -DEF_FN_TYPE_2 (BT_FN_V2DI_V8HI, B_VX, BT_V2DI, BT_V8HI) -DEF_FN_TYPE_2 (BT_FN_V4SI_SHORT, B_VX, BT_V4SI, BT_SHORT) -DEF_FN_TYPE_2 (BT_FN_V4SI_V4SI, B_VX, BT_V4SI, BT_V4SI) -DEF_FN_TYPE_2 (BT_FN_V4SI_V8HI, B_VX, BT_V4SI, BT_V8HI) -DEF_FN_TYPE_2 (BT_FN_V8HI_SHORT, B_VX, BT_V8HI, BT_SHORT) -DEF_FN_TYPE_2 (BT_FN_V8HI_V16QI, B_VX, BT_V8HI, BT_V16QI) -DEF_FN_TYPE_2 (BT_FN_V8HI_V8HI, B_VX, BT_V8HI, BT_V8HI) -DEF_FN_TYPE_2 (BT_FN_VOID_INT, B_HTM, BT_VOID, BT_INT) -DEF_FN_TYPE_2 (BT_FN_VOID_UINT, 0, BT_VOID, BT_UINT) -DEF_FN_TYPE_3 (BT_FN_DBL_V2DF_INT, B_VX, BT_DBL, BT_V2DF, BT_INT) -DEF_FN_TYPE_3 (BT_FN_INT_OV4SI_INT, B_VX, BT_INT, BT_OV4SI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_INT_OV4SI_OV4SI, B_VX, BT_INT, BT_OV4SI, BT_OV4SI) -DEF_FN_TYPE_3 (BT_FN_INT_UV16QI_UV16QI, B_VX, BT_INT, BT_UV16QI, BT_UV16QI) -DEF_FN_TYPE_3 (BT_FN_INT_UV2DI_UV2DI, B_VX, BT_INT, BT_UV2DI, BT_UV2DI) -DEF_FN_TYPE_3 (BT_FN_INT_UV4SI_UV4SI, B_VX, BT_INT, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_3 (BT_FN_INT_UV8HI_UV8HI, B_VX, BT_INT, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_3 (BT_FN_INT_V16QI_V16QI, B_VX, BT_INT, BT_V16QI, BT_V16QI) -DEF_FN_TYPE_3 (BT_FN_INT_V2DF_V2DF, B_VX, BT_INT, BT_V2DF, BT_V2DF) -DEF_FN_TYPE_3 (BT_FN_INT_V2DI_V2DI, B_VX, BT_INT, BT_V2DI, BT_V2DI) -DEF_FN_TYPE_3 (BT_FN_INT_V4SI_V4SI, B_VX, BT_INT, BT_V4SI, BT_V4SI) -DEF_FN_TYPE_3 (BT_FN_INT_V8HI_V8HI, B_VX, BT_INT, BT_V8HI, BT_V8HI) -DEF_FN_TYPE_3 (BT_FN_INT_VOIDPTR_INT, B_HTM, BT_INT, BT_VOIDPTR, BT_INT) -DEF_FN_TYPE_3 (BT_FN_OV2DI_LONGLONG_LONGLONG, B_VX, BT_OV2DI, BT_LONGLONG, BT_LONGLONG) -DEF_FN_TYPE_3 (BT_FN_OV4SI_INTCONSTPTR_INT, B_VX, BT_OV4SI, BT_INTCONSTPTR, BT_INT) -DEF_FN_TYPE_3 (BT_FN_OV4SI_INTCONSTPTR_UINT, B_VX, BT_OV4SI, BT_INTCONSTPTR, BT_UINT) -DEF_FN_TYPE_3 (BT_FN_OV4SI_INT_INT, B_VX, BT_OV4SI, BT_INT, BT_INT) -DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_INTPTR, B_VX, BT_OV4SI, BT_OV4SI, BT_INTPTR) -DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_OV4SI, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI) -DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_UCHAR, B_VX, BT_OV4SI, BT_OV4SI, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_ULONG, B_VX, BT_OV4SI, BT_OV4SI, BT_ULONG) -DEF_FN_TYPE_3 (BT_FN_UCHAR_UV16QI_INT, B_VX, BT_UCHAR, BT_UV16QI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UINT_UV4SI_INT, B_VX, BT_UINT, BT_UV4SI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UINT_VOIDCONSTPTR_INT, B_VX, BT_UINT, BT_VOIDCONSTPTR, BT_INT) -DEF_FN_TYPE_3 (BT_FN_ULONGLONG_UV2DI_INT, B_VX, BT_ULONGLONG, BT_UV2DI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_USHORT_UV8HI_INT, B_VX, BT_USHORT, BT_UV8HI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UCHARCONSTPTR_USHORT, B_VX, BT_UV16QI, BT_UCHARCONSTPTR, BT_USHORT) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UCHAR_INT, B_VX, BT_UV16QI, BT_UCHAR, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UCHAR_UCHAR, B_VX, BT_UV16QI, BT_UCHAR, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_INTPTR) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_UCHAR, B_VX, BT_UV16QI, BT_UV16QI, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_UINT, B_VX, BT_UV16QI, BT_UV16QI, BT_UINT) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_UV16QI, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UV2DI_UV2DI, B_VX, BT_UV16QI, BT_UV2DI, BT_UV2DI) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UV4SI_UV4SI, B_VX, BT_UV16QI, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_3 (BT_FN_UV16QI_UV8HI_UV8HI, B_VX, BT_UV16QI, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_3 (BT_FN_UV2DI_UCHAR_UCHAR, B_VX, BT_UV2DI, BT_UCHAR, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV2DI_ULONGLONG_INT, B_VX, BT_UV2DI, BT_ULONGLONG, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UV2DI_UV2DI_UCHAR, B_VX, BT_UV2DI, BT_UV2DI, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV2DI_UV2DI_UINT, B_VX, BT_UV2DI, BT_UV2DI, BT_UINT) -DEF_FN_TYPE_3 (BT_FN_UV2DI_UV2DI_UV2DI, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI) -DEF_FN_TYPE_3 (BT_FN_UV2DI_UV4SI_UV4SI, B_VX, BT_UV2DI, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_3 (BT_FN_UV2DI_UV8HI_UV8HI, B_VX, BT_UV2DI, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_3 (BT_FN_UV2DI_V2DF_INT, B_VX, BT_UV2DI, BT_V2DF, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UCHAR_UCHAR, B_VX, BT_UV4SI, BT_UCHAR, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UINT_INT, B_VX, BT_UV4SI, BT_UINT, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UV16QI_UV16QI, B_VX, BT_UV4SI, BT_UV16QI, BT_UV16QI) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UV2DI_UV2DI, B_VX, BT_UV4SI, BT_UV2DI, BT_UV2DI) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_INTPTR) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_UCHAR, B_VX, BT_UV4SI, BT_UV4SI, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_UINT, B_VX, BT_UV4SI, BT_UV4SI, BT_UINT) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_UV4SI, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_3 (BT_FN_UV4SI_UV8HI_UV8HI, B_VX, BT_UV4SI, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_3 (BT_FN_UV8HI_UCHAR_UCHAR, B_VX, BT_UV8HI, BT_UCHAR, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV8HI_USHORT_INT, B_VX, BT_UV8HI, BT_USHORT, BT_INT) -DEF_FN_TYPE_3 (BT_FN_UV8HI_UV16QI_UV16QI, B_VX, BT_UV8HI, BT_UV16QI, BT_UV16QI) -DEF_FN_TYPE_3 (BT_FN_UV8HI_UV4SI_UV4SI, B_VX, BT_UV8HI, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_INTPTR) -DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_UCHAR, B_VX, BT_UV8HI, BT_UV8HI, BT_UCHAR) -DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_UINT, B_VX, BT_UV8HI, BT_UV8HI, BT_UINT) -DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_UV8HI, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_3 (BT_FN_V16QI_BV16QI_V16QI, B_VX, BT_V16QI, BT_BV16QI, BT_V16QI) -DEF_FN_TYPE_3 (BT_FN_V16QI_UINT_VOIDCONSTPTR, B_VX, BT_V16QI, BT_UINT, BT_VOIDCONSTPTR) -DEF_FN_TYPE_3 (BT_FN_V16QI_UV16QI_UV16QI, B_VX, BT_V16QI, BT_UV16QI, BT_UV16QI) -DEF_FN_TYPE_3 (BT_FN_V16QI_V16QI_V16QI, B_VX, BT_V16QI, BT_V16QI, BT_V16QI) -DEF_FN_TYPE_3 (BT_FN_V16QI_V8HI_V8HI, B_VX, BT_V16QI, BT_V8HI, BT_V8HI) -DEF_FN_TYPE_3 (BT_FN_V2DF_DBL_INT, B_VX, BT_V2DF, BT_DBL, BT_INT) -DEF_FN_TYPE_3 (BT_FN_V2DF_UV2DI_INT, B_VX, BT_V2DF, BT_UV2DI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_V2DF_UV4SI_INT, B_VX, BT_V2DF, BT_UV4SI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_V2DF_V2DF_V2DF, B_VX, BT_V2DF, BT_V2DF, BT_V2DF) -DEF_FN_TYPE_3 (BT_FN_V2DF_V2DI_INT, B_VX, BT_V2DF, BT_V2DI, BT_INT) -DEF_FN_TYPE_3 (BT_FN_V2DI_BV2DI_V2DI, B_VX, BT_V2DI, BT_BV2DI, BT_V2DI) -DEF_FN_TYPE_3 (BT_FN_V2DI_UV2DI_UV2DI, B_VX, BT_V2DI, BT_UV2DI, BT_UV2DI) -DEF_FN_TYPE_3 (BT_FN_V2DI_V2DF_INT, B_VX, BT_V2DI, BT_V2DF, BT_INT) -DEF_FN_TYPE_3 (BT_FN_V2DI_V2DF_V2DF, B_VX, BT_V2DI, BT_V2DF, BT_V2DF) -DEF_FN_TYPE_3 (BT_FN_V2DI_V2DI_V2DI, B_VX, BT_V2DI, BT_V2DI, BT_V2DI) -DEF_FN_TYPE_3 (BT_FN_V2DI_V4SI_V4SI, B_VX, BT_V2DI, BT_V4SI, BT_V4SI) -DEF_FN_TYPE_3 (BT_FN_V4SI_BV4SI_V4SI, B_VX, BT_V4SI, BT_BV4SI, BT_V4SI) -DEF_FN_TYPE_3 (BT_FN_V4SI_INT_VOIDPTR, B_VX, BT_V4SI, BT_INT, BT_VOIDPTR) -DEF_FN_TYPE_3 (BT_FN_V4SI_UV4SI_UV4SI, B_VX, BT_V4SI, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_3 (BT_FN_V4SI_V2DI_V2DI, B_VX, BT_V4SI, BT_V2DI, BT_V2DI) -DEF_FN_TYPE_3 (BT_FN_V4SI_V4SI_V4SI, B_VX, BT_V4SI, BT_V4SI, BT_V4SI) -DEF_FN_TYPE_3 (BT_FN_V4SI_V8HI_V8HI, B_VX, BT_V4SI, BT_V8HI, BT_V8HI) -DEF_FN_TYPE_3 (BT_FN_V8HI_BV8HI_V8HI, B_VX, BT_V8HI, BT_BV8HI, BT_V8HI) -DEF_FN_TYPE_3 (BT_FN_V8HI_UV8HI_UV8HI, B_VX, BT_V8HI, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_3 (BT_FN_V8HI_V16QI_V16QI, B_VX, BT_V8HI, BT_V16QI, BT_V16QI) -DEF_FN_TYPE_3 (BT_FN_V8HI_V4SI_V4SI, B_VX, BT_V8HI, BT_V4SI, BT_V4SI) -DEF_FN_TYPE_3 (BT_FN_V8HI_V8HI_V8HI, B_VX, BT_V8HI, BT_V8HI, BT_V8HI) -DEF_FN_TYPE_3 (BT_FN_VOID_UINT64PTR_UINT64, B_HTM, BT_VOID, BT_UINT64PTR, BT_UINT64) -DEF_FN_TYPE_3 (BT_FN_VOID_V2DF_FLTPTR, B_VX, BT_VOID, BT_V2DF, BT_FLTPTR) -DEF_FN_TYPE_4 (BT_FN_INT_OV4SI_OV4SI_INTPTR, B_VX, BT_INT, BT_OV4SI, BT_OV4SI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_OV4SI_INT_OV4SI_INT, B_VX, BT_OV4SI, BT_INT, BT_OV4SI, BT_INT) -DEF_FN_TYPE_4 (BT_FN_OV4SI_OV4SI_OV4SI_INT, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_INT) -DEF_FN_TYPE_4 (BT_FN_OV4SI_OV4SI_OV4SI_INTPTR, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_OV4SI_OV4SI_OV4SI_OV4SI, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_OV4SI) -DEF_FN_TYPE_4 (BT_FN_OV4SI_OV4SI_OV4SI_UCHAR, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_UCHAR) -DEF_FN_TYPE_4 (BT_FN_OV4SI_OV4SI_OV4SI_ULONGLONG, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_ULONGLONG) -DEF_FN_TYPE_4 (BT_FN_UV16QI_UV16QI_UCHAR_INT, B_VX, BT_UV16QI, BT_UV16QI, BT_UCHAR, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV16QI_UV16QI_UV16QI_INT, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV16QI_UV16QI_UV16QI_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_UV16QI_UV16QI_UV16QI_UV16QI, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_UV16QI) -DEF_FN_TYPE_4 (BT_FN_UV16QI_UV2DI_UV2DI_UV16QI, B_VX, BT_UV16QI, BT_UV2DI, BT_UV2DI, BT_UV16QI) -DEF_FN_TYPE_4 (BT_FN_UV16QI_UV8HI_UV8HI_INTPTR, B_VX, BT_UV16QI, BT_UV8HI, BT_UV8HI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_UV2DI_UV2DI_ULONGLONG_INT, B_VX, BT_UV2DI, BT_UV2DI, BT_ULONGLONG, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV2DI_UV2DI_UV2DI_INT, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV2DI_UV4SI_UV4SI_UV2DI, B_VX, BT_UV2DI, BT_UV4SI, BT_UV4SI, BT_UV2DI) -DEF_FN_TYPE_4 (BT_FN_UV4SI_UV2DI_UV2DI_INTPTR, B_VX, BT_UV4SI, BT_UV2DI, BT_UV2DI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_UV4SI_UV4SI_UINT_INT, B_VX, BT_UV4SI, BT_UV4SI, BT_UINT, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV4SI_UV4SI_UV4SI_INT, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV4SI_UV4SI_UV4SI_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_UV4SI_UV4SI_UV4SI_UV4SI, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UV4SI) -DEF_FN_TYPE_4 (BT_FN_UV4SI_UV8HI_UV8HI_UV4SI, B_VX, BT_UV4SI, BT_UV8HI, BT_UV8HI, BT_UV4SI) -DEF_FN_TYPE_4 (BT_FN_UV8HI_UV16QI_UV16QI_UV8HI, B_VX, BT_UV8HI, BT_UV16QI, BT_UV16QI, BT_UV8HI) -DEF_FN_TYPE_4 (BT_FN_UV8HI_UV4SI_UV4SI_INTPTR, B_VX, BT_UV8HI, BT_UV4SI, BT_UV4SI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_UV8HI_UV8HI_USHORT_INT, B_VX, BT_UV8HI, BT_UV8HI, BT_USHORT, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV8HI_UV8HI_UV8HI_INT, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT) -DEF_FN_TYPE_4 (BT_FN_UV8HI_UV8HI_UV8HI_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_UV8HI_UV8HI_UV8HI_UV8HI, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_UV8HI) -DEF_FN_TYPE_4 (BT_FN_V16QI_UV16QI_UV16QI_INTPTR, B_VX, BT_V16QI, BT_UV16QI, BT_UV16QI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V16QI_V16QI_V16QI_INTPTR, B_VX, BT_V16QI, BT_V16QI, BT_V16QI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V16QI_V16QI_V16QI_V16QI, B_VX, BT_V16QI, BT_V16QI, BT_V16QI, BT_V16QI) -DEF_FN_TYPE_4 (BT_FN_V16QI_V8HI_V8HI_INTPTR, B_VX, BT_V16QI, BT_V8HI, BT_V8HI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V2DF_V2DF_DBL_INT, B_VX, BT_V2DF, BT_V2DF, BT_DBL, BT_INT) -DEF_FN_TYPE_4 (BT_FN_V2DF_V2DF_UCHAR_UCHAR, B_VX, BT_V2DF, BT_V2DF, BT_UCHAR, BT_UCHAR) -DEF_FN_TYPE_4 (BT_FN_V2DF_V2DF_V2DF_V2DF, B_VX, BT_V2DF, BT_V2DF, BT_V2DF, BT_V2DF) -DEF_FN_TYPE_4 (BT_FN_V2DI_UV2DI_UV2DI_INTPTR, B_VX, BT_V2DI, BT_UV2DI, BT_UV2DI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V2DI_V2DF_INT_INTPTR, B_VX, BT_V2DI, BT_V2DF, BT_INT, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V2DI_V2DF_V2DF_INTPTR, B_VX, BT_V2DI, BT_V2DF, BT_V2DF, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V2DI_V2DI_V2DI_INTPTR, B_VX, BT_V2DI, BT_V2DI, BT_V2DI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V2DI_V4SI_V4SI_V2DI, B_VX, BT_V2DI, BT_V4SI, BT_V4SI, BT_V2DI) -DEF_FN_TYPE_4 (BT_FN_V4SI_UV4SI_UV4SI_INTPTR, B_VX, BT_V4SI, BT_UV4SI, BT_UV4SI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V4SI_V2DI_V2DI_INTPTR, B_VX, BT_V4SI, BT_V2DI, BT_V2DI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V4SI_V4SI_V4SI_INTPTR, B_VX, BT_V4SI, BT_V4SI, BT_V4SI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V4SI_V4SI_V4SI_V4SI, B_VX, BT_V4SI, BT_V4SI, BT_V4SI, BT_V4SI) -DEF_FN_TYPE_4 (BT_FN_V4SI_V8HI_V8HI_V4SI, B_VX, BT_V4SI, BT_V8HI, BT_V8HI, BT_V4SI) -DEF_FN_TYPE_4 (BT_FN_V8HI_UV8HI_UV8HI_INTPTR, B_VX, BT_V8HI, BT_UV8HI, BT_UV8HI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V8HI_V16QI_V16QI_V8HI, B_VX, BT_V8HI, BT_V16QI, BT_V16QI, BT_V8HI) -DEF_FN_TYPE_4 (BT_FN_V8HI_V4SI_V4SI_INTPTR, B_VX, BT_V8HI, BT_V4SI, BT_V4SI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V8HI_V8HI_V8HI_INTPTR, B_VX, BT_V8HI, BT_V8HI, BT_V8HI, BT_INTPTR) -DEF_FN_TYPE_4 (BT_FN_V8HI_V8HI_V8HI_V8HI, B_VX, BT_V8HI, BT_V8HI, BT_V8HI, BT_V8HI) -DEF_FN_TYPE_4 (BT_FN_VOID_OV4SI_INT_VOIDPTR, B_VX, BT_VOID, BT_OV4SI, BT_INT, BT_VOIDPTR) -DEF_FN_TYPE_4 (BT_FN_VOID_OV4SI_VOIDPTR_UINT, B_VX, BT_VOID, BT_OV4SI, BT_VOIDPTR, BT_UINT) -DEF_FN_TYPE_4 (BT_FN_VOID_V16QI_UINT_VOIDPTR, B_VX, BT_VOID, BT_V16QI, BT_UINT, BT_VOIDPTR) -DEF_FN_TYPE_5 (BT_FN_OV4SI_OV4SI_OUV4SI_INTCONSTPTR_UCHAR, B_VX, BT_OV4SI, BT_OV4SI, BT_OUV4SI, BT_INTCONSTPTR, BT_UCHAR) -DEF_FN_TYPE_5 (BT_FN_OV4SI_OV4SI_OV4SI_OV4SI_INTPTR, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_INTPTR) -DEF_FN_TYPE_5 (BT_FN_UV16QI_UV16QI_UV16QI_INT_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT, BT_INTPTR) -DEF_FN_TYPE_5 (BT_FN_UV16QI_UV16QI_UV16QI_UV16QI_INT, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT) -DEF_FN_TYPE_5 (BT_FN_UV2DI_UV2DI_UV2DI_ULONGLONGCONSTPTR_UCHAR, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_ULONGLONGCONSTPTR, BT_UCHAR) -DEF_FN_TYPE_5 (BT_FN_UV2DI_UV2DI_UV2DI_UV2DI_INT, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_INT) -DEF_FN_TYPE_5 (BT_FN_UV4SI_UV4SI_UV4SI_INT_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT, BT_INTPTR) -DEF_FN_TYPE_5 (BT_FN_UV4SI_UV4SI_UV4SI_UINTCONSTPTR_UCHAR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UINTCONSTPTR, BT_UCHAR) -DEF_FN_TYPE_5 (BT_FN_UV4SI_UV4SI_UV4SI_UV4SI_INT, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT) -DEF_FN_TYPE_5 (BT_FN_UV8HI_UV8HI_UV8HI_INT_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT, BT_INTPTR) -DEF_FN_TYPE_5 (BT_FN_UV8HI_UV8HI_UV8HI_UV8HI_INT, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT) -DEF_FN_TYPE_5 (BT_FN_VOID_UV2DI_UV2DI_ULONGLONGPTR_ULONGLONG, B_VX, BT_VOID, BT_UV2DI, BT_UV2DI, BT_ULONGLONGPTR, BT_ULONGLONG) -DEF_FN_TYPE_5 (BT_FN_VOID_UV4SI_UV4SI_UINTPTR_ULONGLONG, B_VX, BT_VOID, BT_UV4SI, BT_UV4SI, BT_UINTPTR, BT_ULONGLONG) -DEF_FN_TYPE_5 (BT_FN_VOID_V4SI_V4SI_INTPTR_ULONGLONG, B_VX, BT_VOID, BT_V4SI, BT_V4SI, BT_INTPTR, BT_ULONGLONG) -DEF_FN_TYPE_6 (BT_FN_UV16QI_UV16QI_UV16QI_UV16QI_INT_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT, BT_INTPTR) -DEF_FN_TYPE_6 (BT_FN_UV4SI_UV4SI_UV4SI_UV4SI_INT_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT, BT_INTPTR) -DEF_FN_TYPE_6 (BT_FN_UV8HI_UV8HI_UV8HI_UV8HI_INT_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT, BT_INTPTR) +DEF_FN_TYPE_0 (BT_FN_INT, B_HTM, BT_INT) +DEF_FN_TYPE_0 (BT_FN_UINT, 0, BT_UINT) +DEF_FN_TYPE_1 (BT_FN_INT_INT, B_VX, BT_INT, BT_INT) +DEF_FN_TYPE_1 (BT_FN_INT_VOIDPTR, B_HTM, BT_INT, BT_VOIDPTR) +DEF_FN_TYPE_1 (BT_FN_OV4SI_INT, B_VX, BT_OV4SI, BT_INT) +DEF_FN_TYPE_1 (BT_FN_OV4SI_INTCONSTPTR, B_VX, BT_OV4SI, BT_INTCONSTPTR) +DEF_FN_TYPE_1 (BT_FN_OV4SI_OV4SI, B_VX, BT_OV4SI, BT_OV4SI) +DEF_FN_TYPE_1 (BT_FN_UV16QI_UCHAR, B_VX, BT_UV16QI, BT_UCHAR) +DEF_FN_TYPE_1 (BT_FN_UV16QI_UCHARCONSTPTR, B_VX, BT_UV16QI, BT_UCHARCONSTPTR) +DEF_FN_TYPE_1 (BT_FN_UV16QI_USHORT, B_VX, BT_UV16QI, BT_USHORT) +DEF_FN_TYPE_1 (BT_FN_UV16QI_UV16QI, B_VX, BT_UV16QI, BT_UV16QI) +DEF_FN_TYPE_1 (BT_FN_UV2DI_ULONGLONG, B_VX, BT_UV2DI, BT_ULONGLONG) +DEF_FN_TYPE_1 (BT_FN_UV2DI_ULONGLONGCONSTPTR, B_VX, BT_UV2DI, BT_ULONGLONGCONSTPTR) +DEF_FN_TYPE_1 (BT_FN_UV2DI_USHORT, B_VX, BT_UV2DI, BT_USHORT) +DEF_FN_TYPE_1 (BT_FN_UV2DI_UV2DI, B_VX, BT_UV2DI, BT_UV2DI) +DEF_FN_TYPE_1 (BT_FN_UV2DI_UV4SI, B_VX, BT_UV2DI, BT_UV4SI) +DEF_FN_TYPE_1 (BT_FN_UV4SI_UINT, B_VX, BT_UV4SI, BT_UINT) +DEF_FN_TYPE_1 (BT_FN_UV4SI_UINTCONSTPTR, B_VX, BT_UV4SI, BT_UINTCONSTPTR) +DEF_FN_TYPE_1 (BT_FN_UV4SI_USHORT, B_VX, BT_UV4SI, BT_USHORT) +DEF_FN_TYPE_1 (BT_FN_UV4SI_UV4SI, B_VX, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_1 (BT_FN_UV4SI_UV8HI, B_VX, BT_UV4SI, BT_UV8HI) +DEF_FN_TYPE_1 (BT_FN_UV8HI_USHORT, B_VX, BT_UV8HI, BT_USHORT) +DEF_FN_TYPE_1 (BT_FN_UV8HI_USHORTCONSTPTR, B_VX, BT_UV8HI, BT_USHORTCONSTPTR) +DEF_FN_TYPE_1 (BT_FN_UV8HI_UV16QI, B_VX, BT_UV8HI, BT_UV16QI) +DEF_FN_TYPE_1 (BT_FN_UV8HI_UV8HI, B_VX, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_1 (BT_FN_V16QI_SCHAR, B_VX, BT_V16QI, BT_SCHAR) +DEF_FN_TYPE_1 (BT_FN_V16QI_UCHAR, B_VX, BT_V16QI, BT_UCHAR) +DEF_FN_TYPE_1 (BT_FN_V16QI_V16QI, B_VX, BT_V16QI, BT_V16QI) +DEF_FN_TYPE_1 (BT_FN_V2DF_DBL, B_VX, BT_V2DF, BT_DBL) +DEF_FN_TYPE_1 (BT_FN_V2DF_FLTCONSTPTR, B_VX, BT_V2DF, BT_FLTCONSTPTR) +DEF_FN_TYPE_1 (BT_FN_V2DF_V2DF, B_VX, BT_V2DF, BT_V2DF) +DEF_FN_TYPE_1 (BT_FN_V2DI_SHORT, B_VX, BT_V2DI, BT_SHORT) +DEF_FN_TYPE_1 (BT_FN_V2DI_V16QI, B_VX, BT_V2DI, BT_V16QI) +DEF_FN_TYPE_1 (BT_FN_V2DI_V2DI, B_VX, BT_V2DI, BT_V2DI) +DEF_FN_TYPE_1 (BT_FN_V2DI_V4SI, B_VX, BT_V2DI, BT_V4SI) +DEF_FN_TYPE_1 (BT_FN_V2DI_V8HI, B_VX, BT_V2DI, BT_V8HI) +DEF_FN_TYPE_1 (BT_FN_V4SI_SHORT, B_VX, BT_V4SI, BT_SHORT) +DEF_FN_TYPE_1 (BT_FN_V4SI_V4SI, B_VX, BT_V4SI, BT_V4SI) +DEF_FN_TYPE_1 (BT_FN_V4SI_V8HI, B_VX, BT_V4SI, BT_V8HI) +DEF_FN_TYPE_1 (BT_FN_V8HI_SHORT, B_VX, BT_V8HI, BT_SHORT) +DEF_FN_TYPE_1 (BT_FN_V8HI_V16QI, B_VX, BT_V8HI, BT_V16QI) +DEF_FN_TYPE_1 (BT_FN_V8HI_V8HI, B_VX, BT_V8HI, BT_V8HI) +DEF_FN_TYPE_1 (BT_FN_VOID_INT, B_HTM, BT_VOID, BT_INT) +DEF_FN_TYPE_1 (BT_FN_VOID_UINT, 0, BT_VOID, BT_UINT) +DEF_FN_TYPE_2 (BT_FN_DBL_V2DF_INT, B_VX, BT_DBL, BT_V2DF, BT_INT) +DEF_FN_TYPE_2 (BT_FN_INT_OV4SI_INT, B_VX, BT_INT, BT_OV4SI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_INT_OV4SI_OV4SI, B_VX, BT_INT, BT_OV4SI, BT_OV4SI) +DEF_FN_TYPE_2 (BT_FN_INT_UV16QI_UV16QI, B_VX, BT_INT, BT_UV16QI, BT_UV16QI) +DEF_FN_TYPE_2 (BT_FN_INT_UV2DI_UV2DI, B_VX, BT_INT, BT_UV2DI, BT_UV2DI) +DEF_FN_TYPE_2 (BT_FN_INT_UV4SI_UV4SI, B_VX, BT_INT, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_2 (BT_FN_INT_UV8HI_UV8HI, B_VX, BT_INT, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_2 (BT_FN_INT_V16QI_V16QI, B_VX, BT_INT, BT_V16QI, BT_V16QI) +DEF_FN_TYPE_2 (BT_FN_INT_V2DF_V2DF, B_VX, BT_INT, BT_V2DF, BT_V2DF) +DEF_FN_TYPE_2 (BT_FN_INT_V2DI_V2DI, B_VX, BT_INT, BT_V2DI, BT_V2DI) +DEF_FN_TYPE_2 (BT_FN_INT_V4SI_V4SI, B_VX, BT_INT, BT_V4SI, BT_V4SI) +DEF_FN_TYPE_2 (BT_FN_INT_V8HI_V8HI, B_VX, BT_INT, BT_V8HI, BT_V8HI) +DEF_FN_TYPE_2 (BT_FN_INT_VOIDPTR_INT, B_HTM, BT_INT, BT_VOIDPTR, BT_INT) +DEF_FN_TYPE_2 (BT_FN_OV2DI_LONGLONG_LONGLONG, B_VX, BT_OV2DI, BT_LONGLONG, BT_LONGLONG) +DEF_FN_TYPE_2 (BT_FN_OV4SI_INTCONSTPTR_INT, B_VX, BT_OV4SI, BT_INTCONSTPTR, BT_INT) +DEF_FN_TYPE_2 (BT_FN_OV4SI_INTCONSTPTR_UINT, B_VX, BT_OV4SI, BT_INTCONSTPTR, BT_UINT) +DEF_FN_TYPE_2 (BT_FN_OV4SI_INT_INT, B_VX, BT_OV4SI, BT_INT, BT_INT) +DEF_FN_TYPE_2 (BT_FN_OV4SI_OV4SI_INTPTR, B_VX, BT_OV4SI, BT_OV4SI, BT_INTPTR) +DEF_FN_TYPE_2 (BT_FN_OV4SI_OV4SI_OV4SI, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI) +DEF_FN_TYPE_2 (BT_FN_OV4SI_OV4SI_UCHAR, B_VX, BT_OV4SI, BT_OV4SI, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_OV4SI_OV4SI_ULONG, B_VX, BT_OV4SI, BT_OV4SI, BT_ULONG) +DEF_FN_TYPE_2 (BT_FN_UCHAR_UV16QI_INT, B_VX, BT_UCHAR, BT_UV16QI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UINT_UV4SI_INT, B_VX, BT_UINT, BT_UV4SI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UINT_VOIDCONSTPTR_INT, B_VX, BT_UINT, BT_VOIDCONSTPTR, BT_INT) +DEF_FN_TYPE_2 (BT_FN_ULONGLONG_UV2DI_INT, B_VX, BT_ULONGLONG, BT_UV2DI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_USHORT_UV8HI_INT, B_VX, BT_USHORT, BT_UV8HI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UCHARCONSTPTR_USHORT, B_VX, BT_UV16QI, BT_UCHARCONSTPTR, BT_USHORT) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UCHAR_INT, B_VX, BT_UV16QI, BT_UCHAR, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UCHAR_UCHAR, B_VX, BT_UV16QI, BT_UCHAR, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UV16QI_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_INTPTR) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UV16QI_UCHAR, B_VX, BT_UV16QI, BT_UV16QI, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UV16QI_UINT, B_VX, BT_UV16QI, BT_UV16QI, BT_UINT) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UV16QI_UV16QI, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UV2DI_UV2DI, B_VX, BT_UV16QI, BT_UV2DI, BT_UV2DI) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UV4SI_UV4SI, B_VX, BT_UV16QI, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_2 (BT_FN_UV16QI_UV8HI_UV8HI, B_VX, BT_UV16QI, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_2 (BT_FN_UV2DI_UCHAR_UCHAR, B_VX, BT_UV2DI, BT_UCHAR, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV2DI_ULONGLONG_INT, B_VX, BT_UV2DI, BT_ULONGLONG, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UV2DI_UV2DI_UCHAR, B_VX, BT_UV2DI, BT_UV2DI, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV2DI_UV2DI_UINT, B_VX, BT_UV2DI, BT_UV2DI, BT_UINT) +DEF_FN_TYPE_2 (BT_FN_UV2DI_UV2DI_UV2DI, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI) +DEF_FN_TYPE_2 (BT_FN_UV2DI_UV4SI_UV4SI, B_VX, BT_UV2DI, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_2 (BT_FN_UV2DI_UV8HI_UV8HI, B_VX, BT_UV2DI, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_2 (BT_FN_UV2DI_V2DF_INT, B_VX, BT_UV2DI, BT_V2DF, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UCHAR_UCHAR, B_VX, BT_UV4SI, BT_UCHAR, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UINT_INT, B_VX, BT_UV4SI, BT_UINT, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UV16QI_UV16QI, B_VX, BT_UV4SI, BT_UV16QI, BT_UV16QI) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UV2DI_UV2DI, B_VX, BT_UV4SI, BT_UV2DI, BT_UV2DI) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UV4SI_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_INTPTR) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UV4SI_UCHAR, B_VX, BT_UV4SI, BT_UV4SI, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UV4SI_UINT, B_VX, BT_UV4SI, BT_UV4SI, BT_UINT) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UV4SI_UV4SI, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_2 (BT_FN_UV4SI_UV8HI_UV8HI, B_VX, BT_UV4SI, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_2 (BT_FN_UV8HI_UCHAR_UCHAR, B_VX, BT_UV8HI, BT_UCHAR, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV8HI_USHORT_INT, B_VX, BT_UV8HI, BT_USHORT, BT_INT) +DEF_FN_TYPE_2 (BT_FN_UV8HI_UV16QI_UV16QI, B_VX, BT_UV8HI, BT_UV16QI, BT_UV16QI) +DEF_FN_TYPE_2 (BT_FN_UV8HI_UV4SI_UV4SI, B_VX, BT_UV8HI, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_2 (BT_FN_UV8HI_UV8HI_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_INTPTR) +DEF_FN_TYPE_2 (BT_FN_UV8HI_UV8HI_UCHAR, B_VX, BT_UV8HI, BT_UV8HI, BT_UCHAR) +DEF_FN_TYPE_2 (BT_FN_UV8HI_UV8HI_UINT, B_VX, BT_UV8HI, BT_UV8HI, BT_UINT) +DEF_FN_TYPE_2 (BT_FN_UV8HI_UV8HI_UV8HI, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_2 (BT_FN_V16QI_BV16QI_V16QI, B_VX, BT_V16QI, BT_BV16QI, BT_V16QI) +DEF_FN_TYPE_2 (BT_FN_V16QI_UINT_VOIDCONSTPTR, B_VX, BT_V16QI, BT_UINT, BT_VOIDCONSTPTR) +DEF_FN_TYPE_2 (BT_FN_V16QI_UV16QI_UV16QI, B_VX, BT_V16QI, BT_UV16QI, BT_UV16QI) +DEF_FN_TYPE_2 (BT_FN_V16QI_V16QI_V16QI, B_VX, BT_V16QI, BT_V16QI, BT_V16QI) +DEF_FN_TYPE_2 (BT_FN_V16QI_V8HI_V8HI, B_VX, BT_V16QI, BT_V8HI, BT_V8HI) +DEF_FN_TYPE_2 (BT_FN_V2DF_DBL_INT, B_VX, BT_V2DF, BT_DBL, BT_INT) +DEF_FN_TYPE_2 (BT_FN_V2DF_UV2DI_INT, B_VX, BT_V2DF, BT_UV2DI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_V2DF_UV4SI_INT, B_VX, BT_V2DF, BT_UV4SI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_V2DF_V2DF_V2DF, B_VX, BT_V2DF, BT_V2DF, BT_V2DF) +DEF_FN_TYPE_2 (BT_FN_V2DF_V2DI_INT, B_VX, BT_V2DF, BT_V2DI, BT_INT) +DEF_FN_TYPE_2 (BT_FN_V2DI_BV2DI_V2DI, B_VX, BT_V2DI, BT_BV2DI, BT_V2DI) +DEF_FN_TYPE_2 (BT_FN_V2DI_UV2DI_UV2DI, B_VX, BT_V2DI, BT_UV2DI, BT_UV2DI) +DEF_FN_TYPE_2 (BT_FN_V2DI_V2DF_INT, B_VX, BT_V2DI, BT_V2DF, BT_INT) +DEF_FN_TYPE_2 (BT_FN_V2DI_V2DF_V2DF, B_VX, BT_V2DI, BT_V2DF, BT_V2DF) +DEF_FN_TYPE_2 (BT_FN_V2DI_V2DI_V2DI, B_VX, BT_V2DI, BT_V2DI, BT_V2DI) +DEF_FN_TYPE_2 (BT_FN_V2DI_V4SI_V4SI, B_VX, BT_V2DI, BT_V4SI, BT_V4SI) +DEF_FN_TYPE_2 (BT_FN_V4SI_BV4SI_V4SI, B_VX, BT_V4SI, BT_BV4SI, BT_V4SI) +DEF_FN_TYPE_2 (BT_FN_V4SI_INT_VOIDPTR, B_VX, BT_V4SI, BT_INT, BT_VOIDPTR) +DEF_FN_TYPE_2 (BT_FN_V4SI_UV4SI_UV4SI, B_VX, BT_V4SI, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_2 (BT_FN_V4SI_V2DI_V2DI, B_VX, BT_V4SI, BT_V2DI, BT_V2DI) +DEF_FN_TYPE_2 (BT_FN_V4SI_V4SI_V4SI, B_VX, BT_V4SI, BT_V4SI, BT_V4SI) +DEF_FN_TYPE_2 (BT_FN_V4SI_V8HI_V8HI, B_VX, BT_V4SI, BT_V8HI, BT_V8HI) +DEF_FN_TYPE_2 (BT_FN_V8HI_BV8HI_V8HI, B_VX, BT_V8HI, BT_BV8HI, BT_V8HI) +DEF_FN_TYPE_2 (BT_FN_V8HI_UV8HI_UV8HI, B_VX, BT_V8HI, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_2 (BT_FN_V8HI_V16QI_V16QI, B_VX, BT_V8HI, BT_V16QI, BT_V16QI) +DEF_FN_TYPE_2 (BT_FN_V8HI_V4SI_V4SI, B_VX, BT_V8HI, BT_V4SI, BT_V4SI) +DEF_FN_TYPE_2 (BT_FN_V8HI_V8HI_V8HI, B_VX, BT_V8HI, BT_V8HI, BT_V8HI) +DEF_FN_TYPE_2 (BT_FN_VOID_UINT64PTR_UINT64, B_HTM, BT_VOID, BT_UINT64PTR, BT_UINT64) +DEF_FN_TYPE_2 (BT_FN_VOID_V2DF_FLTPTR, B_VX, BT_VOID, BT_V2DF, BT_FLTPTR) +DEF_FN_TYPE_3 (BT_FN_INT_OV4SI_OV4SI_INTPTR, B_VX, BT_INT, BT_OV4SI, BT_OV4SI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_OV4SI_INT_OV4SI_INT, B_VX, BT_OV4SI, BT_INT, BT_OV4SI, BT_INT) +DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_OV4SI_INT, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_INT) +DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_OV4SI_INTPTR, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_OV4SI_OV4SI, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_OV4SI) +DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_OV4SI_UCHAR, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_UCHAR) +DEF_FN_TYPE_3 (BT_FN_OV4SI_OV4SI_OV4SI_ULONGLONG, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_ULONGLONG) +DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_UCHAR_INT, B_VX, BT_UV16QI, BT_UV16QI, BT_UCHAR, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_UV16QI_INT, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_UV16QI_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_UV16QI_UV16QI_UV16QI_UV16QI, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_UV16QI) +DEF_FN_TYPE_3 (BT_FN_UV16QI_UV2DI_UV2DI_UV16QI, B_VX, BT_UV16QI, BT_UV2DI, BT_UV2DI, BT_UV16QI) +DEF_FN_TYPE_3 (BT_FN_UV16QI_UV8HI_UV8HI_INTPTR, B_VX, BT_UV16QI, BT_UV8HI, BT_UV8HI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_UV2DI_UV2DI_ULONGLONG_INT, B_VX, BT_UV2DI, BT_UV2DI, BT_ULONGLONG, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV2DI_UV2DI_UV2DI_INT, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV2DI_UV4SI_UV4SI_UV2DI, B_VX, BT_UV2DI, BT_UV4SI, BT_UV4SI, BT_UV2DI) +DEF_FN_TYPE_3 (BT_FN_UV4SI_UV2DI_UV2DI_INTPTR, B_VX, BT_UV4SI, BT_UV2DI, BT_UV2DI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_UINT_INT, B_VX, BT_UV4SI, BT_UV4SI, BT_UINT, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_UV4SI_INT, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_UV4SI_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_UV4SI_UV4SI_UV4SI_UV4SI, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UV4SI) +DEF_FN_TYPE_3 (BT_FN_UV4SI_UV8HI_UV8HI_UV4SI, B_VX, BT_UV4SI, BT_UV8HI, BT_UV8HI, BT_UV4SI) +DEF_FN_TYPE_3 (BT_FN_UV8HI_UV16QI_UV16QI_UV8HI, B_VX, BT_UV8HI, BT_UV16QI, BT_UV16QI, BT_UV8HI) +DEF_FN_TYPE_3 (BT_FN_UV8HI_UV4SI_UV4SI_INTPTR, B_VX, BT_UV8HI, BT_UV4SI, BT_UV4SI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_USHORT_INT, B_VX, BT_UV8HI, BT_UV8HI, BT_USHORT, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_UV8HI_INT, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT) +DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_UV8HI_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_UV8HI_UV8HI_UV8HI_UV8HI, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_3 (BT_FN_V16QI_UV16QI_UV16QI_INTPTR, B_VX, BT_V16QI, BT_UV16QI, BT_UV16QI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V16QI_V16QI_V16QI_INTPTR, B_VX, BT_V16QI, BT_V16QI, BT_V16QI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V16QI_V16QI_V16QI_V16QI, B_VX, BT_V16QI, BT_V16QI, BT_V16QI, BT_V16QI) +DEF_FN_TYPE_3 (BT_FN_V16QI_V8HI_V8HI_INTPTR, B_VX, BT_V16QI, BT_V8HI, BT_V8HI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V2DF_V2DF_DBL_INT, B_VX, BT_V2DF, BT_V2DF, BT_DBL, BT_INT) +DEF_FN_TYPE_3 (BT_FN_V2DF_V2DF_UCHAR_UCHAR, B_VX, BT_V2DF, BT_V2DF, BT_UCHAR, BT_UCHAR) +DEF_FN_TYPE_3 (BT_FN_V2DF_V2DF_V2DF_V2DF, B_VX, BT_V2DF, BT_V2DF, BT_V2DF, BT_V2DF) +DEF_FN_TYPE_3 (BT_FN_V2DI_UV2DI_UV2DI_INTPTR, B_VX, BT_V2DI, BT_UV2DI, BT_UV2DI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V2DI_V2DF_INT_INTPTR, B_VX, BT_V2DI, BT_V2DF, BT_INT, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V2DI_V2DF_V2DF_INTPTR, B_VX, BT_V2DI, BT_V2DF, BT_V2DF, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V2DI_V2DI_V2DI_INTPTR, B_VX, BT_V2DI, BT_V2DI, BT_V2DI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V2DI_V4SI_V4SI_V2DI, B_VX, BT_V2DI, BT_V4SI, BT_V4SI, BT_V2DI) +DEF_FN_TYPE_3 (BT_FN_V4SI_UV4SI_UV4SI_INTPTR, B_VX, BT_V4SI, BT_UV4SI, BT_UV4SI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V4SI_V2DI_V2DI_INTPTR, B_VX, BT_V4SI, BT_V2DI, BT_V2DI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V4SI_V4SI_V4SI_INTPTR, B_VX, BT_V4SI, BT_V4SI, BT_V4SI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V4SI_V4SI_V4SI_V4SI, B_VX, BT_V4SI, BT_V4SI, BT_V4SI, BT_V4SI) +DEF_FN_TYPE_3 (BT_FN_V4SI_V8HI_V8HI_V4SI, B_VX, BT_V4SI, BT_V8HI, BT_V8HI, BT_V4SI) +DEF_FN_TYPE_3 (BT_FN_V8HI_UV8HI_UV8HI_INTPTR, B_VX, BT_V8HI, BT_UV8HI, BT_UV8HI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V8HI_V16QI_V16QI_V8HI, B_VX, BT_V8HI, BT_V16QI, BT_V16QI, BT_V8HI) +DEF_FN_TYPE_3 (BT_FN_V8HI_V4SI_V4SI_INTPTR, B_VX, BT_V8HI, BT_V4SI, BT_V4SI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V8HI_V8HI_V8HI_INTPTR, B_VX, BT_V8HI, BT_V8HI, BT_V8HI, BT_INTPTR) +DEF_FN_TYPE_3 (BT_FN_V8HI_V8HI_V8HI_V8HI, B_VX, BT_V8HI, BT_V8HI, BT_V8HI, BT_V8HI) +DEF_FN_TYPE_3 (BT_FN_VOID_OV4SI_INT_VOIDPTR, B_VX, BT_VOID, BT_OV4SI, BT_INT, BT_VOIDPTR) +DEF_FN_TYPE_3 (BT_FN_VOID_OV4SI_VOIDPTR_UINT, B_VX, BT_VOID, BT_OV4SI, BT_VOIDPTR, BT_UINT) +DEF_FN_TYPE_3 (BT_FN_VOID_V16QI_UINT_VOIDPTR, B_VX, BT_VOID, BT_V16QI, BT_UINT, BT_VOIDPTR) +DEF_FN_TYPE_4 (BT_FN_OV4SI_OV4SI_OUV4SI_INTCONSTPTR_UCHAR, B_VX, BT_OV4SI, BT_OV4SI, BT_OUV4SI, BT_INTCONSTPTR, BT_UCHAR) +DEF_FN_TYPE_4 (BT_FN_OV4SI_OV4SI_OV4SI_OV4SI_INTPTR, B_VX, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_OV4SI, BT_INTPTR) +DEF_FN_TYPE_4 (BT_FN_UV16QI_UV16QI_UV16QI_INT_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT, BT_INTPTR) +DEF_FN_TYPE_4 (BT_FN_UV16QI_UV16QI_UV16QI_UV16QI_INT, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT) +DEF_FN_TYPE_4 (BT_FN_UV2DI_UV2DI_UV2DI_ULONGLONGCONSTPTR_UCHAR, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_ULONGLONGCONSTPTR, BT_UCHAR) +DEF_FN_TYPE_4 (BT_FN_UV2DI_UV2DI_UV2DI_UV2DI_INT, B_VX, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_UV2DI, BT_INT) +DEF_FN_TYPE_4 (BT_FN_UV4SI_UV4SI_UV4SI_INT_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT, BT_INTPTR) +DEF_FN_TYPE_4 (BT_FN_UV4SI_UV4SI_UV4SI_UINTCONSTPTR_UCHAR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UINTCONSTPTR, BT_UCHAR) +DEF_FN_TYPE_4 (BT_FN_UV4SI_UV4SI_UV4SI_UV4SI_INT, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT) +DEF_FN_TYPE_4 (BT_FN_UV8HI_UV8HI_UV8HI_INT_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT, BT_INTPTR) +DEF_FN_TYPE_4 (BT_FN_UV8HI_UV8HI_UV8HI_UV8HI_INT, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT) +DEF_FN_TYPE_4 (BT_FN_VOID_UV2DI_UV2DI_ULONGLONGPTR_ULONGLONG, B_VX, BT_VOID, BT_UV2DI, BT_UV2DI, BT_ULONGLONGPTR, BT_ULONGLONG) +DEF_FN_TYPE_4 (BT_FN_VOID_UV4SI_UV4SI_UINTPTR_ULONGLONG, B_VX, BT_VOID, BT_UV4SI, BT_UV4SI, BT_UINTPTR, BT_ULONGLONG) +DEF_FN_TYPE_4 (BT_FN_VOID_V4SI_V4SI_INTPTR_ULONGLONG, B_VX, BT_VOID, BT_V4SI, BT_V4SI, BT_INTPTR, BT_ULONGLONG) +DEF_FN_TYPE_5 (BT_FN_UV16QI_UV16QI_UV16QI_UV16QI_INT_INTPTR, B_VX, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_UV16QI, BT_INT, BT_INTPTR) +DEF_FN_TYPE_5 (BT_FN_UV4SI_UV4SI_UV4SI_UV4SI_INT_INTPTR, B_VX, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_UV4SI, BT_INT, BT_INTPTR) +DEF_FN_TYPE_5 (BT_FN_UV8HI_UV8HI_UV8HI_UV8HI_INT_INTPTR, B_VX, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_UV8HI, BT_INT, BT_INTPTR) DEF_OV_TYPE (BT_OV_BV16QI_BV16QI, BT_BV16QI, BT_BV16QI) DEF_OV_TYPE (BT_OV_BV16QI_BV16QI_BV16QI, BT_BV16QI, BT_BV16QI, BT_BV16QI) DEF_OV_TYPE (BT_OV_BV16QI_BV16QI_BV16QI_BV16QI, BT_BV16QI, BT_BV16QI, BT_BV16QI, BT_BV16QI) -- cgit v1.2.3 From d4fcedac94c80c98e48e60a633946fc7d1bc6c79 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 13 Jun 2016 12:05:43 +0000 Subject: S/390: vecintrin.h fix file description in comment gcc/ChangeLog: 2016-06-13 Andreas Krebbel * config/s390/vecintrin.h: Fix file description in comment. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237378 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/s390/vecintrin.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ada2cfd5fc..0e1baea5ca2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Andreas Krebbel + + * config/s390/vecintrin.h: Fix file description in comment. + 2016-06-13 Andreas Krebbel * config/s390/s390-builtin-types.def: Change builtin type naming diff --git a/gcc/config/s390/vecintrin.h b/gcc/config/s390/vecintrin.h index ab82e7aed06..2bd35d67064 100644 --- a/gcc/config/s390/vecintrin.h +++ b/gcc/config/s390/vecintrin.h @@ -1,4 +1,4 @@ -/* GNU compiler hardware transactional execution intrinsics +/* GNU compiler vector extension intrinsics Copyright (C) 2015-2016 Free Software Foundation, Inc. Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com) -- cgit v1.2.3 From f3f0f59d0d09739ca87eb6322d0bb15a0d5a2eac Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 13 Jun 2016 14:03:51 +0000 Subject: Make 'loop iv compare' heuristics scanning more precise * gcc.dg/predict-1.c: Distinguish between "loop iv compare" and "guess loop iv compared" heuristics. * gcc.dg/predict-2.c: Likewise. * gcc.dg/predict-3.c: Likewise. * gcc.dg/predict-4.c: Likewise. * gcc.dg/predict-5.c: Likewise. * gcc.dg/predict-6.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237380 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gcc.dg/predict-1.c | 2 +- gcc/testsuite/gcc.dg/predict-2.c | 2 +- gcc/testsuite/gcc.dg/predict-3.c | 2 +- gcc/testsuite/gcc.dg/predict-4.c | 2 +- gcc/testsuite/gcc.dg/predict-5.c | 2 +- gcc/testsuite/gcc.dg/predict-6.c | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 98af7659e1b..db8d555852c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2016-06-13 Martin Liska + + * gcc.dg/predict-1.c: Distinguish between "loop iv compare" + and "guess loop iv compared" heuristics. + * gcc.dg/predict-2.c: Likewise. + * gcc.dg/predict-3.c: Likewise. + * gcc.dg/predict-4.c: Likewise. + * gcc.dg/predict-5.c: Likewise. + * gcc.dg/predict-6.c: Likewise. + 2016-06-13 Marek Polacek PR middle-end/71476 diff --git a/gcc/testsuite/gcc.dg/predict-1.c b/gcc/testsuite/gcc.dg/predict-1.c index d0924f27bdf..10d62bac5d5 100644 --- a/gcc/testsuite/gcc.dg/predict-1.c +++ b/gcc/testsuite/gcc.dg/predict-1.c @@ -23,4 +23,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 2.0%" 5 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 2.0%" 5 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-2.c b/gcc/testsuite/gcc.dg/predict-2.c index 30116864d5d..aa915688c68 100644 --- a/gcc/testsuite/gcc.dg/predict-2.c +++ b/gcc/testsuite/gcc.dg/predict-2.c @@ -23,4 +23,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-not "loop iv compare heuristics of edge\[^:\]*:" "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-not "guess loop iv compare heuristics of edge\[^:\]*:" "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-3.c b/gcc/testsuite/gcc.dg/predict-3.c index 663f1411025..7274963b943 100644 --- a/gcc/testsuite/gcc.dg/predict-3.c +++ b/gcc/testsuite/gcc.dg/predict-3.c @@ -25,4 +25,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 98.0%" 3 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 98.0%" 3 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-4.c b/gcc/testsuite/gcc.dg/predict-4.c index 5779da36ee9..2ac2ec5721d 100644 --- a/gcc/testsuite/gcc.dg/predict-4.c +++ b/gcc/testsuite/gcc.dg/predict-4.c @@ -15,4 +15,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump "loop iv compare heuristics of edge\[^:\]*: 50.0%" "profile_estimate"} } */ +/* { dg-final { scan-tree-dump " loop iv compare heuristics of edge\[^:\]*: 50.0%" "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-5.c b/gcc/testsuite/gcc.dg/predict-5.c index 56ada306b97..135081de2a4 100644 --- a/gcc/testsuite/gcc.dg/predict-5.c +++ b/gcc/testsuite/gcc.dg/predict-5.c @@ -21,4 +21,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 98.0%" 4 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 98.0%" 4 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-6.c b/gcc/testsuite/gcc.dg/predict-6.c index 9ed41ed0d92..104683f7f43 100644 --- a/gcc/testsuite/gcc.dg/predict-6.c +++ b/gcc/testsuite/gcc.dg/predict-6.c @@ -21,4 +21,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 2.0%" 4 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 2.0%" 4 "profile_estimate"} } */ -- cgit v1.2.3 From af4c379a83f3bc9e87311fe56648756c2c980560 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 13 Jun 2016 14:27:01 +0000 Subject: * ggc-tests.c (test_finalization): Only test need_finalization_p for GCC_VERSION >= 4003. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237381 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/ggc-tests.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e1baea5ca2..2d8b42bb365 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Uros Bizjak + + * ggc-tests.c (test_finalization): Only test need_finalization_p + for GCC_VERSION >= 4003. + 2016-06-13 Andreas Krebbel * config/s390/vecintrin.h: Fix file description in comment. diff --git a/gcc/ggc-tests.c b/gcc/ggc-tests.c index 48eac03103b..7f972314981 100644 --- a/gcc/ggc-tests.c +++ b/gcc/ggc-tests.c @@ -190,8 +190,10 @@ int test_struct_with_dtor::dtor_call_count; static void test_finalization () { +#if GCC_VERSION >= 4003 ASSERT_FALSE (need_finalization_p ()); ASSERT_TRUE (need_finalization_p ()); +#endif /* Create some garbage. */ const int count = 10; -- cgit v1.2.3 From a1f62dfc3a71d91428a1872bd1b57e6a4acdffc9 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 13 Jun 2016 14:38:51 +0000 Subject: * config/i386/i386.md (paritydi2): Use ix86_expand_setcc. (paritysi2): Ditto. (isinfxf2): Ditto. (isinf2): Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237382 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.md | 30 ++++++++---------------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d8b42bb365..0a2af74432d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-13 Uros Bizjak + + * config/i386/i386.md (paritydi2): Use ix86_expand_setcc. + (paritysi2): Ditto. + (isinfxf2): Ditto. + (isinf2): Ditto. + 2016-06-13 Uros Bizjak * ggc-tests.c (test_finalization): Only test need_finalization_p diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 416cdcd9129..86837525628 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -13458,15 +13458,12 @@ "! TARGET_POPCNT" { rtx scratch = gen_reg_rtx (QImode); - rtx cond; emit_insn (gen_paritydi2_cmp (NULL_RTX, NULL_RTX, NULL_RTX, operands[1])); - cond = gen_rtx_fmt_ee (ORDERED, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (scratch, cond)); + ix86_expand_setcc (scratch, ORDERED, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); if (TARGET_64BIT) emit_insn (gen_zero_extendqidi2 (operands[0], scratch)); @@ -13486,14 +13483,11 @@ "! TARGET_POPCNT" { rtx scratch = gen_reg_rtx (QImode); - rtx cond; emit_insn (gen_paritysi2_cmp (NULL_RTX, NULL_RTX, operands[1])); - cond = gen_rtx_fmt_ee (ORDERED, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (scratch, cond)); + ix86_expand_setcc (scratch, ORDERED, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); emit_insn (gen_zero_extendqisi2 (operands[0], scratch)); DONE; @@ -16159,8 +16153,6 @@ rtx mask = GEN_INT (0x45); rtx val = GEN_INT (0x05); - rtx cond; - rtx scratch = gen_reg_rtx (HImode); rtx res = gen_reg_rtx (QImode); @@ -16168,10 +16160,8 @@ emit_insn (gen_andqi_ext_0 (scratch, scratch, mask)); emit_insn (gen_cmpqi_ext_3 (scratch, val)); - cond = gen_rtx_fmt_ee (EQ, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (res, cond)); + ix86_expand_setcc (res, EQ, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); emit_insn (gen_zero_extendqisi2 (operands[0], res)); DONE; }) @@ -16186,8 +16176,6 @@ rtx mask = GEN_INT (0x45); rtx val = GEN_INT (0x05); - rtx cond; - rtx scratch = gen_reg_rtx (HImode); rtx res = gen_reg_rtx (QImode); @@ -16204,10 +16192,8 @@ emit_insn (gen_andqi_ext_0 (scratch, scratch, mask)); emit_insn (gen_cmpqi_ext_3 (scratch, val)); - cond = gen_rtx_fmt_ee (EQ, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (res, cond)); + ix86_expand_setcc (res, EQ, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); emit_insn (gen_zero_extendqisi2 (operands[0], res)); DONE; }) -- cgit v1.2.3 From 2ce48b314c4619dd400c4b8c18bb9e92f18908f9 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Mon, 13 Jun 2016 15:45:54 +0000 Subject: 2016-06-13 Bernd Edlinger * input.c (test_builtins): Fix an assertion. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237383 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/input.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a2af74432d..c2f0f7ecf5e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Bernd Edlinger + + * input.c (test_builtins): Fix an assertion. + 2016-06-13 Uros Bizjak * config/i386/i386.md (paritydi2): Use ix86_expand_setcc. diff --git a/gcc/input.c b/gcc/input.c index 0b340a8ed9d..e872cf039f7 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -1210,7 +1210,7 @@ test_unknown_location () static void test_builtins () { - assert_loceq ("", 0, 0, BUILTINS_LOCATION); + assert_loceq (_(""), 0, 0, BUILTINS_LOCATION); ASSERT_PRED1 (is_location_from_builtin_token, BUILTINS_LOCATION); } -- cgit v1.2.3 From d96965a7bef41ff4af102240ef92a76d3eeb006e Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 13 Jun 2016 16:10:35 +0000 Subject: Fix CASE_CHAIN typos gcc/ * tree-cfg.c (edge_to_cases_cleanup): Fix CASE_CHAIN typo. * tree.def (CASE_LABEL_EXPR): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237384 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-cfg.c | 2 +- gcc/tree.def | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2f0f7ecf5e..733e5127ea3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Thomas Schwinge + + * tree-cfg.c (edge_to_cases_cleanup): Fix CASE_CHAIN typo. + * tree.def (CASE_LABEL_EXPR): Likewise. + 2016-06-13 Bernd Edlinger * input.c (test_builtins): Fix an assertion. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 40e524bba9c..0fac49c3860 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1126,7 +1126,7 @@ make_cond_expr_edges (basic_block bb) /* Called for each element in the hash table (P) as we delete the edge to cases hash table. - Clear all the TREE_CHAINs to prevent problems with copying of + Clear all the CASE_CHAINs to prevent problems with copying of SWITCH_EXPRs and structure sharing rules, then free the hash table element. */ diff --git a/gcc/tree.def b/gcc/tree.def index d16575aee62..2c355400609 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -949,7 +949,7 @@ DEFTREECODE (SWITCH_EXPR, "switch_expr", tcc_statement, 3) Operand 1 is CASE_HIGH. If it is NULL_TREE, the label is a simple (one-value) case label. If it is non-NULL_TREE, the case is a range. Operand 2 is CASE_LABEL, which is is the corresponding LABEL_DECL. - Operand 4 is CASE_CHAIN. This operand is only used in tree-cfg.c to + Operand 3 is CASE_CHAIN. This operand is only used in tree-cfg.c to speed up the lookup of case labels which use a particular edge in the control flow graph. */ DEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", tcc_statement, 4) -- cgit v1.2.3 From e8c433cd01ac9a2daeef8cfefd62c9c28c76458c Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Mon, 13 Jun 2016 16:22:05 +0000 Subject: added "PR bootstrap/71481" to r237383's ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237385 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 733e5127ea3..ff685b1ffc4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -5,6 +5,7 @@ 2016-06-13 Bernd Edlinger + PR bootstrap/71481 * input.c (test_builtins): Fix an assertion. 2016-06-13 Uros Bizjak -- cgit v1.2.3 From ec8fd943f0c6d17dfbadf8b2fa3ed99610d231b2 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 13 Jun 2016 16:37:29 +0000 Subject: [PR middle-end/71373] Document missing OMP_CLAUSE_* in gcc/tree-nested.c gcc/ PR middle-end/71373 * tree-nested.c (convert_nonlocal_omp_clauses) (convert_local_omp_clauses): Document missing OMP_CLAUSE_*. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237386 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/tree-nested.c | 60 ++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff685b1ffc4..89098e7db11 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2016-06-13 Thomas Schwinge + PR middle-end/71373 + * tree-nested.c (convert_nonlocal_omp_clauses) + (convert_local_omp_clauses): Document missing OMP_CLAUSE_*. + * tree-cfg.c (edge_to_cases_cleanup): Fix CASE_CHAIN typo. * tree.def (CASE_LABEL_EXPR): Likewise. diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 812f619c05f..62cb01fbba9 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1203,17 +1203,29 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_AUTO: break; + /* OpenACC tile clauses are discarded during gimplification. */ case OMP_CLAUSE_TILE: - /* OpenACC tile clauses are discarded during gimplification, so we - don't expect to see anything here. */ - gcc_unreachable (); - + /* The following clause belongs to the OpenACC cache directive, which + is discarded during gimplification. */ case OMP_CLAUSE__CACHE_: - /* These clauses belong to the OpenACC cache directive, which is - discarded during gimplification, so we don't expect to see - anything here. */ - gcc_unreachable (); - + /* The following clauses are only allowed in the OpenMP declare simd + directive, so not seen here. */ + case OMP_CLAUSE_UNIFORM: + case OMP_CLAUSE_INBRANCH: + case OMP_CLAUSE_NOTINBRANCH: + /* The following clauses are only allowed on OpenMP cancel and + cancellation point directives, which at this point have already + been lowered into a function call. */ + case OMP_CLAUSE_FOR: + case OMP_CLAUSE_PARALLEL: + case OMP_CLAUSE_SECTIONS: + case OMP_CLAUSE_TASKGROUP: + /* The following clauses are only added during OMP lowering; nested + function decomposition happens before that. */ + case OMP_CLAUSE__LOOPTEMP_: + case OMP_CLAUSE__SIMDUID_: + case OMP_CLAUSE__GRIDDIM_: + /* Anything else. */ default: gcc_unreachable (); } @@ -1899,17 +1911,29 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_AUTO: break; + /* OpenACC tile clauses are discarded during gimplification. */ case OMP_CLAUSE_TILE: - /* OpenACC tile clauses are discarded during gimplification, so we - don't expect to see anything here. */ - gcc_unreachable (); - + /* The following clause belongs to the OpenACC cache directive, which + is discarded during gimplification. */ case OMP_CLAUSE__CACHE_: - /* These clauses belong to the OpenACC cache directive, which is - discarded during gimplification, so we don't expect to see - anything here. */ - gcc_unreachable (); - + /* The following clauses are only allowed in the OpenMP declare simd + directive, so not seen here. */ + case OMP_CLAUSE_UNIFORM: + case OMP_CLAUSE_INBRANCH: + case OMP_CLAUSE_NOTINBRANCH: + /* The following clauses are only allowed on OpenMP cancel and + cancellation point directives, which at this point have already + been lowered into a function call. */ + case OMP_CLAUSE_FOR: + case OMP_CLAUSE_PARALLEL: + case OMP_CLAUSE_SECTIONS: + case OMP_CLAUSE_TASKGROUP: + /* The following clauses are only added during OMP lowering; nested + function decomposition happens before that. */ + case OMP_CLAUSE__LOOPTEMP_: + case OMP_CLAUSE__SIMDUID_: + case OMP_CLAUSE__GRIDDIM_: + /* Anything else. */ default: gcc_unreachable (); } -- cgit v1.2.3 From daa2cfb14c9b4671577848282f922b1c489021af Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 13 Jun 2016 17:14:42 +0000 Subject: C: fixits for named initializers gcc/c/ChangeLog: * c-parser.c (c_parser_initelt): Provide location of name for new location_t param of set_init_label. * c-tree.h (set_init_label): Add location_t param. * c-typeck.c (set_init_index): Add "fieldname_loc" location_t param and use it when issuing error messages about unrecognized field names. Attempt to provide a fixit hint if appropriate, otherwise update the error message to provide the type name. gcc/testsuite/ChangeLog: * gcc.dg/c99-init-2.c (c): Update expected error message. * gcc.dg/init-bad-8.c (foo): Likewise. * gcc.dg/spellcheck-fields-3.c: New test case. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237387 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 10 +++++ gcc/c/c-parser.c | 2 + gcc/c/c-tree.h | 2 +- gcc/c/c-typeck.c | 21 +++++++++- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/gcc.dg/c99-init-2.c | 2 +- gcc/testsuite/gcc.dg/init-bad-8.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-fields-3.c | 66 ++++++++++++++++++++++++++++++ 8 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/spellcheck-fields-3.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index cd9f230e106..08fc250f79a 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,13 @@ +2016-06-13 David Malcolm + + * c-parser.c (c_parser_initelt): Provide location of name for new + location_t param of set_init_label. + * c-tree.h (set_init_label): Add location_t param. + * c-typeck.c (set_init_index): Add "fieldname_loc" location_t + param and use it when issuing error messages about unrecognized + field names. Attempt to provide a fixit hint if appropriate, + otherwise update the error message to provide the type name. + 2016-06-10 Thomas Schwinge PR c/71381 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 94078a91f4c..ff32479685e 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -4397,6 +4397,7 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack) /* Old-style structure member designator. */ set_init_label (c_parser_peek_token (parser)->location, c_parser_peek_token (parser)->value, + c_parser_peek_token (parser)->location, braced_init_obstack); /* Use the colon as the error location. */ pedwarn (c_parser_peek_2nd_token (parser)->location, OPT_Wpedantic, @@ -4426,6 +4427,7 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack) if (c_parser_next_token_is (parser, CPP_NAME)) { set_init_label (des_loc, c_parser_peek_token (parser)->value, + c_parser_peek_token (parser)->location, braced_init_obstack); c_parser_consume_token (parser); } diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index b4374e3e4bf..8f10a13f763 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -639,7 +639,7 @@ extern void finish_implicit_inits (location_t, struct obstack *); extern void push_init_level (location_t, int, struct obstack *); extern struct c_expr pop_init_level (location_t, int, struct obstack *); extern void set_init_index (location_t, tree, tree, struct obstack *); -extern void set_init_label (location_t, tree, struct obstack *); +extern void set_init_label (location_t, tree, location_t, struct obstack *); extern void process_init_element (location_t, struct c_expr, bool, struct obstack *); extern tree build_compound_literal (location_t, tree, tree, bool); diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index a681d7696d0..ea04d5eed76 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -8211,7 +8211,7 @@ set_init_index (location_t loc, tree first, tree last, /* Within a struct initializer, specify the next field to be initialized. */ void -set_init_label (location_t loc, tree fieldname, +set_init_label (location_t loc, tree fieldname, location_t fieldname_loc, struct obstack *braced_init_obstack) { tree field; @@ -8230,7 +8230,24 @@ set_init_label (location_t loc, tree fieldname, field = lookup_field (constructor_type, fieldname); if (field == 0) - error_at (loc, "unknown field %qE specified in initializer", fieldname); + { + tree guessed_id = lookup_field_fuzzy (constructor_type, fieldname); + if (guessed_id) + { + rich_location rich_loc (line_table, fieldname_loc); + source_range component_range = + get_range_from_loc (line_table, fieldname_loc); + rich_loc.add_fixit_replace (component_range, + IDENTIFIER_POINTER (guessed_id)); + error_at_rich_loc + (&rich_loc, + "%qT has no member named %qE; did you mean %qE?", + constructor_type, fieldname, guessed_id); + } + else + error_at (fieldname_loc, "%qT has no member named %qE", + constructor_type, fieldname); + } else do { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index db8d555852c..878dfe02197 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 David Malcolm + + * gcc.dg/c99-init-2.c (c): Update expected error message. + * gcc.dg/init-bad-8.c (foo): Likewise. + * gcc.dg/spellcheck-fields-3.c: New test case. + 2016-06-13 Martin Liska * gcc.dg/predict-1.c: Distinguish between "loop iv compare" diff --git a/gcc/testsuite/gcc.dg/c99-init-2.c b/gcc/testsuite/gcc.dg/c99-init-2.c index d3a331ff355..c07005be249 100644 --- a/gcc/testsuite/gcc.dg/c99-init-2.c +++ b/gcc/testsuite/gcc.dg/c99-init-2.c @@ -9,7 +9,7 @@ typedef struct { } A; A a = { [2] = 1 }; /* { dg-error "(array index in non-array)|(near initialization)" } */ int b[] = { .B = 1 }; /* { dg-error "(field name not in record)|(near initialization)" } */ -A c[] = { [0].D = 1 }; /* { dg-error "unknown field" } */ +A c[] = { [0].D = 1 }; /* { dg-error "15: has no member named .D." } */ int d; int e = { d++ }; /* { dg-error "(is not constant)|(near initialization)" } */ A f[2] = { [0].C[0] = 1, [2] = { 2, { 1, 2 } } };/* { dg-error "(array index in initializer exceeds array bounds)|(near initialization)" } */ diff --git a/gcc/testsuite/gcc.dg/init-bad-8.c b/gcc/testsuite/gcc.dg/init-bad-8.c index b321323219c..f7b0f7f6886 100644 --- a/gcc/testsuite/gcc.dg/init-bad-8.c +++ b/gcc/testsuite/gcc.dg/init-bad-8.c @@ -6,5 +6,5 @@ struct S { int i, j, k; }; void foo (void) { - struct S s = { .i = 1, .j = 2, .l = 4}; /* { dg-error "34:unknown field .l. specified in initializer" } */ + struct S s = { .i = 1, .j = 2, .l = 4}; /* { dg-error "35: .struct S. has no member named .l." } */ } diff --git a/gcc/testsuite/gcc.dg/spellcheck-fields-3.c b/gcc/testsuite/gcc.dg/spellcheck-fields-3.c new file mode 100644 index 00000000000..003a0b5ea26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/spellcheck-fields-3.c @@ -0,0 +1,66 @@ +/* { dg-do compile } */ +/* { dg-options "-fdiagnostics-show-caret -std=c99" } */ + +/* Tests of incorrect name initializers. + Verify that we get underlines and, where appropriate, fixit hints. */ + +struct foo +{ + int foo; + int bar; +}; + +union u +{ + int color; + int shape; +}; + +/* Old-style named initializers. */ + +struct foo old_style_f = { + foa: 1, /* { dg-error ".struct foo. has no member named .foa.; did you mean .foo." } */ +/* { dg-begin-multiline-output "" } + foa: 1, + ^~~ + foo + { dg-end-multiline-output "" } */ + + this_does_not_match: 3 /* { dg-error ".struct foo. has no member named .this_does_not_match." } */ + +/* { dg-begin-multiline-output "" } + this_does_not_match: 3 + ^~~~~~~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ +}; + +union u old_style_u = { colour: 3 }; /* { dg-error ".union u. has no member named .colour.; did you mean .color.?" } */ +/* { dg-begin-multiline-output "" } + union u old_style_u = { colour: 3 }; + ^~~~~~ + color + { dg-end-multiline-output "" } */ + +/* C99-style named initializers. */ + +struct foo c99_style_f = { + .foa = 1, /* { dg-error ".struct foo. has no member named .foa.; did you mean .foo." } */ +/* { dg-begin-multiline-output "" } + .foa = 1, + ^~~ + foo + { dg-end-multiline-output "" } */ + + .this_does_not_match = 3 /* { dg-error ".struct foo. has no member named .this_does_not_match." } */ +/* { dg-begin-multiline-output "" } + .this_does_not_match = 3 + ^~~~~~~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ +}; + +union u c99_style_u = { .colour=3 }; /* { dg-error ".union u. has no member named .colour.; did you mean .color.?" } */ +/* { dg-begin-multiline-output "" } + union u c99_style_u = { .colour=3 }; + ^~~~~~ + color + { dg-end-multiline-output "" } */ -- cgit v1.2.3 From 0b7e9d28b68056340bf9c4e54ee27ab72e30d7d2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 13 Jun 2016 17:44:12 +0000 Subject: * tree-ssa-sccvn.c (vn_reference_lookup_3): Use a uniform test and update shared_lookup_references only once after changing operands. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237388 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-sccvn.c | 9 ++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 89098e7db11..b1026bdcf47 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Eric Botcazou + + * tree-ssa-sccvn.c (vn_reference_lookup_3): Use a uniform test and + update shared_lookup_references only once after changing operands. + 2016-06-13 Thomas Schwinge PR middle-end/71373 diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 730db04ff8b..0cbd2cd56f2 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2089,11 +2089,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, /* We need to pre-pend vr->operands[0..i] to rhs. */ vec old = vr->operands; if (i + 1 + rhs.length () > vr->operands.length ()) - { - vr->operands.safe_grow (i + 1 + rhs.length ()); - if (old == shared_lookup_references) - shared_lookup_references = vr->operands; - } + vr->operands.safe_grow (i + 1 + rhs.length ()); else vr->operands.truncate (i + 1 + rhs.length ()); FOR_EACH_VEC_ELT (rhs, j, vro) @@ -2244,8 +2240,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, { vec old = vr->operands; vr->operands.safe_grow_cleared (2); - if (old == shared_lookup_references - && vr->operands != old) + if (old == shared_lookup_references) shared_lookup_references = vr->operands; } else -- cgit v1.2.3 From fdef18a4614fb6a07ed6fd1f000c7165d6958bcf Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Mon, 13 Jun 2016 17:59:12 +0000 Subject: gcc/ChangeLog: 2016-06-13 Kelvin Nilsen * config/rs6000/altivec.h (vec_absd): New macro for vector absolute difference unsigned. (vec_absdb): New macro for vector absolute difference unsigned byte. (vec_absdh): New macro for vector absolute difference unsigned half-word. (vec_absdw): New macro for vector absolute difference unsigned word. * config/rs6000/altivec.md (UNSPEC_VADU): New value. (vadu3): New insn. (*p9_vadu3): New insn. * config/rs6000/rs6000-builtin.def (vadub): New built-in definition. (vaduh): New built-in definition. (vaduw): New built-in definition. (vadu): New overloaded built-in definition. (vadub): New overloaded built-in definition. (vaduh): New overloaded built-in definition. (vaduw): New overloaded built-in definition. * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add overloaded vector absolute difference unsigned functions. * doc/extend.texi (PowerPC AltiVec Built-in Functions): Document the ISA 3.0 vector absolute difference unsigned built-in functions. gcc/testsuite/ChangeLog: 2016-06-13 Kelvin Nilsen * gcc.target/powerpc/vadsdu-0.c: New test. * gcc.target/powerpc/vadsdu-1.c: New test. * gcc.target/powerpc/vadsdu-2.c: New test. * gcc.target/powerpc/vadsdu-3.c: New test. * gcc.target/powerpc/vadsdu-4.c: New test. * gcc.target/powerpc/vadsdu-5.c: New test. * gcc.target/powerpc/vadsdub-1.c: New test. * gcc.target/powerpc/vadsdub-2.c: New test. * gcc.target/powerpc/vadsduh-1.c: New test. * gcc.target/powerpc/vadsduh-2.c: New test. * gcc.target/powerpc/vadsduw-1.c: New test. * gcc.target/powerpc/vadsduw-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237390 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 25 +++++++++++++++++++++++++ gcc/config/rs6000/altivec.h | 5 +++++ gcc/config/rs6000/altivec.md | 19 +++++++++++++++++++ gcc/config/rs6000/rs6000-builtin.def | 11 +++++++++++ gcc/config/rs6000/rs6000-c.c | 22 ++++++++++++++++++++++ gcc/doc/extend.texi | 25 +++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 15 +++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdu-0.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdu-1.c | 22 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdu-2.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdu-3.c | 22 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdu-4.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdu-5.c | 22 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdub-1.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsdub-2.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsduh-1.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsduh-2.c | 22 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsduw-1.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/vadsduw-2.c | 22 ++++++++++++++++++++++ 19 files changed, 393 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdu-0.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdu-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdu-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdu-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdu-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdu-5.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdub-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsdub-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsduh-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsduh-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsduw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vadsduw-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b1026bdcf47..541c76ad076 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2016-06-13 Kelvin Nilsen + + * config/rs6000/altivec.h (vec_absd): New macro for vector absolute + difference unsigned. + (vec_absdb): New macro for vector absolute difference unsigned + byte. + (vec_absdh): New macro for vector absolute difference unsigned + half-word. + (vec_absdw): New macro for vector absolute difference unsigned word. + * config/rs6000/altivec.md (UNSPEC_VADU): New value. + (vadu3): New insn. + (*p9_vadu3): New insn. + * config/rs6000/rs6000-builtin.def (vadub): New built-in + definition. + (vaduh): New built-in definition. + (vaduw): New built-in definition. + (vadu): New overloaded built-in definition. + (vadub): New overloaded built-in definition. + (vaduh): New overloaded built-in definition. + (vaduw): New overloaded built-in definition. + * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add + overloaded vector absolute difference unsigned functions. + * doc/extend.texi (PowerPC AltiVec Built-in Functions): Document + the ISA 3.0 vector absolute difference unsigned built-in functions. + 2016-06-13 Eric Botcazou * tree-ssa-sccvn.c (vn_reference_lookup_3): Use a uniform test and diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h index 3ce74ab9144..9123d969be9 100644 --- a/gcc/config/rs6000/altivec.h +++ b/gcc/config/rs6000/altivec.h @@ -402,6 +402,11 @@ #define vec_vprtybq __builtin_vec_vprtybq #endif +#define vec_absd __builtin_vec_vadu +#define vec_absdb __builtin_vec_vadub +#define vec_absdh __builtin_vec_vaduh +#define vec_absdw __builtin_vec_vaduw + #define vec_slv __builtin_vec_vslv #define vec_srv __builtin_vec_vsrv #endif diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index d081bd1afbd..0cd67a4ec99 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -114,6 +114,7 @@ UNSPEC_STVLXL UNSPEC_STVRX UNSPEC_STVRXL + UNSPEC_VADU UNSPEC_VSLV UNSPEC_VSRV UNSPEC_VMULWHUB @@ -3464,6 +3465,24 @@ [(set_attr "length" "4") (set_attr "type" "vecsimple")]) +;; Vector absolute difference unsigned +(define_expand "vadu3" + [(set (match_operand:VI 0 "register_operand") + (unspec:VI [(match_operand:VI 1 "register_operand") + (match_operand:VI 2 "register_operand")] + UNSPEC_VADU))] + "TARGET_P9_VECTOR") + +;; Vector absolute difference unsigned +(define_insn "*p9_vadu3" + [(set (match_operand:VI 0 "register_operand" "=v") + (unspec:VI [(match_operand:VI 1 "register_operand" "v") + (match_operand:VI 2 "register_operand" "v")] + UNSPEC_VADU))] + "TARGET_P9_VECTOR" + "vabsdu %0,%1,%2" + [(set_attr "type" "vecsimple")]) + ;; Vector count trailing zeros (define_insn "*p9v_ctz2" [(set (match_operand:VI2 0 "register_operand" "=v") diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 606d7ae2840..80fe92a9d45 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -1757,6 +1757,17 @@ BU_P9V_AV_2 (VSRV, "vsrv", CONST, vsrv) BU_P9V_OVERLOAD_2 (VSLV, "vslv") BU_P9V_OVERLOAD_2 (VSRV, "vsrv") +/* 2 argument vector functions added in ISA 3.0 (power9). */ +BU_P9V_AV_2 (VADUB, "vadub", CONST, vaduv16qi3) +BU_P9V_AV_2 (VADUH, "vaduh", CONST, vaduv8hi3) +BU_P9V_AV_2 (VADUW, "vaduw", CONST, vaduv4si3) + +/* ISA 3.0 vector overloaded 2 argument functions. */ +BU_P9V_OVERLOAD_2 (VADU, "vadu") +BU_P9V_OVERLOAD_2 (VADUB, "vadub") +BU_P9V_OVERLOAD_2 (VADUH, "vaduh") +BU_P9V_OVERLOAD_2 (VADUW, "vaduw") + /* 2 argument extended divide functions added in ISA 2.06. */ BU_P7_MISC_2 (DIVWE, "divwe", CONST, dive_si) diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index d313e9b20fb..79a7e88a5ee 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -4240,6 +4240,28 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { { P9V_BUILTIN_VEC_VCTZD, P9V_BUILTIN_VCTZD, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 }, + { P9V_BUILTIN_VEC_VADU, P9V_BUILTIN_VADUB, + RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, + RS6000_BTI_unsigned_V16QI, 0 }, + { P9V_BUILTIN_VEC_VADU, P9V_BUILTIN_VADUH, + RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, + RS6000_BTI_unsigned_V8HI, 0 }, + { P9V_BUILTIN_VEC_VADU, P9V_BUILTIN_VADUW, + RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, + RS6000_BTI_unsigned_V4SI, 0 }, + + { P9V_BUILTIN_VEC_VADUB, P9V_BUILTIN_VADUB, + RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, + RS6000_BTI_unsigned_V16QI, 0 }, + + { P9V_BUILTIN_VEC_VADUH, P9V_BUILTIN_VADUH, + RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, + RS6000_BTI_unsigned_V8HI, 0 }, + + { P9V_BUILTIN_VEC_VADUW, P9V_BUILTIN_VADUW, + RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, + RS6000_BTI_unsigned_V4SI, 0 }, + { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 }, { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD, diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index a0633543602..06d52b8ce0d 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -17493,6 +17493,31 @@ result returned from the @code{vec_srv} function is a (0x07 & shift_distance[i]))}, with this resulting value coerced to the @code{unsigned char} type. +The following built-in functions are available for the PowerPC family +of processors, starting with ISA 3.0 or later (@option{-mcpu=power9}) +or with @option{-mpower9-vector}: +@smallexample +__vector unsigned char +vec_absd (__vector unsigned char arg1, __vector unsigned char arg2); +__vector unsigned short +vec_absd (__vector unsigned short arg1, __vector unsigned short arg2); +__vector unsigned int +vec_absd (__vector unsigned int arg1, __vector unsigned int arg2); + +__vector unsigned char +vec_absdb (__vector unsigned char arg1, __vector unsigned char arg2); +__vector unsigned short +vec_absdh (__vector unsigned short arg1, __vector unsigned short arg2); +__vector unsigned int +vec_absdw (__vector unsigned int arg1, __vector unsigned int arg2); +@end smallexample + +The @code{vec_absd}, @code{vec_absdb}, @code{vec_absdh}, and +@code{vec_absdw} built-in functions each computes the absolute +differences of the pairs of vector elements supplied in its two vector +arguments, placing the absolute differences into the corresponding +elements of the vector result. + If the cryptographic instructions are enabled (@option{-mcrypto} or @option{-mcpu=power8}), the following builtins are enabled. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 878dfe02197..cd8531b866a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2016-06-13 Kelvin Nilsen + + * gcc.target/powerpc/vadsdu-0.c: New test. + * gcc.target/powerpc/vadsdu-1.c: New test. + * gcc.target/powerpc/vadsdu-2.c: New test. + * gcc.target/powerpc/vadsdu-3.c: New test. + * gcc.target/powerpc/vadsdu-4.c: New test. + * gcc.target/powerpc/vadsdu-5.c: New test. + * gcc.target/powerpc/vadsdub-1.c: New test. + * gcc.target/powerpc/vadsdub-2.c: New test. + * gcc.target/powerpc/vadsduh-1.c: New test. + * gcc.target/powerpc/vadsduh-2.c: New test. + * gcc.target/powerpc/vadsduw-1.c: New test. + * gcc.target/powerpc/vadsduw-2.c: New test. + 2016-06-13 David Malcolm * gcc.dg/c99-init-2.c (c): Update expected error message. diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-0.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-0.c new file mode 100644 index 00000000000..aa1d61de741 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-0.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned int +doAbsoluteDifferenceUnsignedInt (__vector unsigned int *p, + __vector unsigned int *q) +{ + __vector unsigned int source_1, source_2; + __vector unsigned int result; + + source_1 = *p; + source_2 = *q; + + result = __builtin_vec_vadu (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsduw" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-1.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-1.c new file mode 100644 index 00000000000..cf10283b199 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-1.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned int +doAbsoluteDifferenceUnsignedIntMacro (__vector unsigned int *p, + __vector unsigned int *q) +{ + __vector unsigned int result, source_1, source_2; + + source_1 = *p; + source_2 = *q; + + result = vec_absd (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsduw" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-2.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-2.c new file mode 100644 index 00000000000..27ea2b32559 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-2.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned short +doAbsoluteDifferenceUnsignedShort (__vector unsigned short *p, + __vector unsigned short *q) +{ + __vector unsigned short source_1, source_2; + __vector unsigned short result; + + source_1 = *p; + source_2 = *q; + + result = __builtin_vec_vadu (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsduh" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-3.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-3.c new file mode 100644 index 00000000000..be0df32e220 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-3.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned short +doAbsoluteDifferenceUnsignedShortMacro (__vector unsigned short *p, + __vector unsigned short *q) +{ + __vector unsigned short result, source_1, source_2; + + source_1 = *p; + source_2 = *q; + + result = vec_absd (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsduh" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-4.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-4.c new file mode 100644 index 00000000000..ffbd570c711 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-4.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned char +doAbsoluteDifferenceUnsignedChar (__vector unsigned char *p, + __vector unsigned char *q) +{ + __vector unsigned char source_1, source_2; + __vector unsigned char result; + + source_1 = *p; + source_2 = *q; + + result = __builtin_vec_vadu (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsdub" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-5.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-5.c new file mode 100644 index 00000000000..20aa25efe21 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-5.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned char +doAbsoluteDifferenceUnsignedCharMacro (__vector unsigned char *p, + __vector unsigned char *q) +{ + __vector unsigned char result, source_1, source_2; + + source_1 = *p; + source_2 = *q; + + result = vec_absd (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsdub" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdub-1.c b/gcc/testsuite/gcc.target/powerpc/vadsdub-1.c new file mode 100644 index 00000000000..de1b9eef1cf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdub-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned char +doAbsoluteDifferenceUnsigned (__vector unsigned char *p, + __vector unsigned char *q) +{ + __vector unsigned char source_1, source_2; + __vector unsigned char uc_result; + + source_1 = *p; + source_2 = *q; + + uc_result = __builtin_vec_vadub (source_1, source_2); + return uc_result; +} + +/* { dg-final { scan-assembler "vabsdub" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdub-2.c b/gcc/testsuite/gcc.target/powerpc/vadsdub-2.c new file mode 100644 index 00000000000..de1b9eef1cf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsdub-2.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned char +doAbsoluteDifferenceUnsigned (__vector unsigned char *p, + __vector unsigned char *q) +{ + __vector unsigned char source_1, source_2; + __vector unsigned char uc_result; + + source_1 = *p; + source_2 = *q; + + uc_result = __builtin_vec_vadub (source_1, source_2); + return uc_result; +} + +/* { dg-final { scan-assembler "vabsdub" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduh-1.c b/gcc/testsuite/gcc.target/powerpc/vadsduh-1.c new file mode 100644 index 00000000000..c208790d811 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsduh-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned short +doAbsoluteDifferenceUnsigned (__vector unsigned short *p, + __vector unsigned short *q) +{ + __vector unsigned short source_1, source_2; + __vector unsigned short us_result; + + source_1 = *p; + source_2 = *q; + + us_result = __builtin_vec_vaduh (source_1, source_2); + return us_result; +} + +/* { dg-final { scan-assembler "vabsduh" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduh-2.c b/gcc/testsuite/gcc.target/powerpc/vadsduh-2.c new file mode 100644 index 00000000000..5fa2157e18e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsduh-2.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned short +doAbsoluteDifferenceUnsignedMacro (__vector unsigned short *p, + __vector unsigned short *q) +{ + __vector unsigned short result, source_1, source_2; + + source_1 = *p; + source_2 = *q; + + result = vec_absdh (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsduh" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduw-1.c b/gcc/testsuite/gcc.target/powerpc/vadsduw-1.c new file mode 100644 index 00000000000..6cb66ba4c9f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsduw-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned int +doAbsoluteDifferenceUnsigned (__vector unsigned int *p, + __vector unsigned int *q) +{ + __vector unsigned int source_1, source_2; + __vector unsigned int ui_result; + + source_1 = *p; + source_2 = *q; + + ui_result = __builtin_vec_vaduw (source_1, source_2); + return ui_result; +} + +/* { dg-final { scan-assembler "vabsduw" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduw-2.c b/gcc/testsuite/gcc.target/powerpc/vadsduw-2.c new file mode 100644 index 00000000000..a614cf6d4ae --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vadsduw-2.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on both 32- and 64-bit configurations. */ +#include + +__vector unsigned int +doAbsoluteDifferenceUnsignedMacro (__vector unsigned int *p, + __vector unsigned int *q) +{ + __vector unsigned int result, source_1, source_2; + + source_1 = *p; + source_2 = *q; + + result = vec_absdw (source_1, source_2); + return result; +} + +/* { dg-final { scan-assembler "vabsduw" } } */ -- cgit v1.2.3 From 554cf0dfcfbdd6a7106c28e7893c7b8a5147f5ba Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Mon, 13 Jun 2016 18:30:40 +0000 Subject: gcc/ChangeLog: 2016-06-13 Kelvin Nilsen * config/rs6000/rs6000.h (RS6000_BTM_COMMON): Add the RS6000_BTM_MODULO flag into the set of flags that are considered to be part of the common configuration. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237391 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/rs6000/rs6000.h | 1 + 2 files changed, 7 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 541c76ad076..822e36f7816 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Kelvin Nilsen + + * config/rs6000/rs6000.h (RS6000_BTM_COMMON): Add the + RS6000_BTM_MODULO flag into the set of flags that are considered + to be part of the common configuration. + 2016-06-13 Kelvin Nilsen * config/rs6000/altivec.h (vec_absd): New macro for vector absolute diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 5f5510a6146..e1f01732074 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2694,6 +2694,7 @@ extern int frame_pointer_needed; | RS6000_BTM_VSX \ | RS6000_BTM_P8_VECTOR \ | RS6000_BTM_P9_VECTOR \ + | RS6000_BTM_MODULO \ | RS6000_BTM_CRYPTO \ | RS6000_BTM_FRE \ | RS6000_BTM_FRES \ -- cgit v1.2.3 From c7a32e1a058ac615030cdedc9194ac4d3bda0604 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 13 Jun 2016 18:54:25 +0000 Subject: PR middle-end/71478 * gcc.dg/pr71478.c: Remove dg-require-effective-target vect_int. Add -Wno-psabi -w to dg-options. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237392 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/pr71478.c | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cd8531b866a..d0dc9b7bc1d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Jakub Jelinek + + PR middle-end/71478 + * gcc.dg/pr71478.c: Remove dg-require-effective-target vect_int. + Add -Wno-psabi -w to dg-options. + 2016-06-13 Kelvin Nilsen * gcc.target/powerpc/vadsdu-0.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr71478.c b/gcc/testsuite/gcc.dg/pr71478.c index 5a3480701e1..17ec7ec62a5 100644 --- a/gcc/testsuite/gcc.dg/pr71478.c +++ b/gcc/testsuite/gcc.dg/pr71478.c @@ -1,7 +1,6 @@ /* PR middle-end/71478 */ -/* { dg-require-effective-target vect_int } */ /* { dg-do compile } */ -/* { dg-options "-O3" } */ +/* { dg-options "-O3 -Wno-psabi -w" } */ typedef unsigned int __attribute__ ((vector_size (8))) uv2si; typedef int __attribute__ ((vector_size (8))) v2si; @@ -18,4 +17,3 @@ foo (void) uv2si j = k * __builtin_shuffle (z, z, (uv2si) {1, 3}); return k * j; } - -- cgit v1.2.3