diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-06-28 20:31:42 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-06-28 20:31:42 +0200 |
commit | 6a20b538f2a02e01b311af1dade9cea6a58d815e (patch) | |
tree | 1be87707017143ec34f68b003b3c04ca10dcc4b5 /gcc | |
parent | 0f0f4f914dc0c6667b1ee57ca9461fc26ec67bb3 (diff) | |
download | gcc-6a20b538f2a02e01b311af1dade9cea6a58d815e.zip gcc-6a20b538f2a02e01b311af1dade9cea6a58d815e.tar.gz gcc-6a20b538f2a02e01b311af1dade9cea6a58d815e.tar.bz2 |
re PR middle-end/71626 (ICE at -O1 and above on x86_64-linux-gnu (in output_constant_pool_2, at varasm.c:3837))
PR middle-end/71626
* config/i386/i386.c (ix86_expand_vector_move): For SUBREG of
a constant, force its SUBREG_REG into memory or register instead
of whole op1.
* gcc.c-torture/execute/pr71626-1.c: New test.
* gcc.c-torture/execute/pr71626-2.c: New test.
From-SVN: r237826
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 32 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr71626-1.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr71626-2.c | 4 |
5 files changed, 58 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ddbe6f1..eaca291 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71626 + * config/i386/i386.c (ix86_expand_vector_move): For SUBREG of + a constant, force its SUBREG_REG into memory or register instead + of whole op1. + 2016-06-28 Pitchumani Sivanupandi <pitchumani.s@atmel.com> PR target/58655 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 73e631e..70b13c8 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -19610,12 +19610,29 @@ ix86_expand_vector_move (machine_mode mode, rtx operands[]) of the register, once we have that information we may be able to handle some of them more efficiently. */ if (can_create_pseudo_p () - && register_operand (op0, mode) && (CONSTANT_P (op1) || (SUBREG_P (op1) && CONSTANT_P (SUBREG_REG (op1)))) - && !standard_sse_constant_p (op1, mode)) - op1 = validize_mem (force_const_mem (mode, op1)); + && ((register_operand (op0, mode) + && !standard_sse_constant_p (op1, mode)) + /* ix86_expand_vector_move_misalign() does not like constants. */ + || (SSE_REG_MODE_P (mode) + && MEM_P (op0) + && MEM_ALIGN (op0) < align))) + { + if (SUBREG_P (op1)) + { + machine_mode imode = GET_MODE (SUBREG_REG (op1)); + rtx r = force_const_mem (imode, SUBREG_REG (op1)); + if (r) + r = validize_mem (r); + else + r = force_reg (imode, SUBREG_REG (op1)); + op1 = simplify_gen_subreg (mode, r, imode, SUBREG_BYTE (op1)); + } + else + op1 = validize_mem (force_const_mem (mode, op1)); + } /* We need to check memory alignment for SSE mode since attribute can make operands unaligned. */ @@ -19626,13 +19643,8 @@ ix86_expand_vector_move (machine_mode mode, rtx operands[]) { rtx tmp[2]; - /* ix86_expand_vector_move_misalign() does not like constants ... */ - if (CONSTANT_P (op1) - || (SUBREG_P (op1) - && CONSTANT_P (SUBREG_REG (op1)))) - op1 = validize_mem (force_const_mem (mode, op1)); - - /* ... nor both arguments in memory. */ + /* ix86_expand_vector_move_misalign() does not like both + arguments in memory. */ if (!register_operand (op0, mode) && !register_operand (op1, mode)) op1 = force_reg (mode, op1); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9516e24..08c3181 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/71626 + * gcc.c-torture/execute/pr71626-1.c: New test. + * gcc.c-torture/execute/pr71626-2.c: New test. + 2016-06-28 Peter Bergner <bergner@vnet.ibm.com> PR target/71656 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71626-1.c b/gcc/testsuite/gcc.c-torture/execute/pr71626-1.c new file mode 100644 index 0000000..26cfa96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr71626-1.c @@ -0,0 +1,19 @@ +/* PR middle-end/71626 */ + +typedef __INTPTR_TYPE__ V __attribute__((__vector_size__(sizeof (__INTPTR_TYPE__)))); + +__attribute__((noinline, noclone)) V +foo () +{ + V v = { (__INTPTR_TYPE__) foo }; + return v; +} + +int +main () +{ + V v = foo (); + if (v[0] != (__INTPTR_TYPE__) foo) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71626-2.c b/gcc/testsuite/gcc.c-torture/execute/pr71626-2.c new file mode 100644 index 0000000..4a27c54 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr71626-2.c @@ -0,0 +1,4 @@ +/* PR middle-end/71626 */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +#include "pr71626-1.c" |