re PR rtl-optimization/71984 (wrong code with -O -mavx512cd)

2016-07-26  Richard Biener  <rguenther@suse.de>

	PR rtl-optimization/71984
	* simplify-rtx.c (simplify_subreg): Use GET_MODE_SIZE and prepare
	for VOIDmode.

	* gcc.dg/torture/pr71984.c: New testcase.

From-SVN: r238757
This commit is contained in:
Richard Biener 2016-07-26 14:11:21 +00:00 committed by Richard Biener
parent ab2b55c109
commit 0b64ca40f3
4 changed files with 37 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2016-07-26 Richard Biener <rguenther@suse.de>
PR rtl-optimization/71984
* simplify-rtx.c (simplify_subreg): Use GET_MODE_SIZE and prepare
for VOIDmode.
2016-07-26 Richard Biener <rguenther@suse.de>
PR middle-end/72517

View File

@ -6116,7 +6116,10 @@ simplify_subreg (machine_mode outermode, rtx op,
unsigned int part_size, final_offset;
rtx part, res;
part_size = GET_MODE_UNIT_SIZE (GET_MODE (XEXP (op, 0)));
enum machine_mode part_mode = GET_MODE (XEXP (op, 0));
if (part_mode == VOIDmode)
part_mode = GET_MODE_INNER (GET_MODE (op));
part_size = GET_MODE_SIZE (part_mode);
if (byte < part_size)
{
part = XEXP (op, 0);
@ -6131,7 +6134,7 @@ simplify_subreg (machine_mode outermode, rtx op,
if (final_offset + GET_MODE_SIZE (outermode) > part_size)
return NULL_RTX;
enum machine_mode part_mode = GET_MODE (part);
part_mode = GET_MODE (part);
if (part_mode == VOIDmode)
part_mode = GET_MODE_INNER (GET_MODE (op));
res = simplify_subreg (outermode, part, part_mode, final_offset);

View File

@ -1,3 +1,8 @@
2016-07-26 Richard Biener <rguenther@suse.de>
PR rtl-optimization/71984
* gcc.dg/torture/pr71984.c: New testcase.
2016-07-26 Robert Suchanek <robert.suchanek@imgtec.com>
* g++.dg/vect/vect.exp: Add and set new global EFFECTIVE_TARGETS. Call

View File

@ -0,0 +1,21 @@
/* { dg-do run { target lp64 } } */
/* { dg-additional-options "-w -Wno-psabi" } */
typedef unsigned char v64u8 __attribute__((vector_size(64)));
typedef unsigned long v64u64 __attribute__((vector_size(64)));
typedef unsigned char u8;
static u8 __attribute__ ((noinline, noclone))
foo (v64u64 v64u64_0)
{
return ((v64u8)(v64u64){0, v64u64_0[0]})[13];
}
int
main ()
{
u8 x = foo((v64u64){0x0706050403020100UL});
if (x != 5)
__builtin_abort ();
return 0;
}