Commit 4dbf26d5 by Uros Bizjak Committed by Uros Bizjak

re PR target/40957 (standard_sse_constant_opcode crash on x86 64)

	PR target/40957
	* config/i386/i386.c (standard_sse_mode_p): Remove.
	(standard_sse_constant_p): Return 2 for integer mode
	vector_all_ones_operand when SSE2 is enabled.
	(standard_sse_constant_opcode)<case 2>: Always return [v]pcmpeqd.
	(ix86_expand_vector_move): Do not check for negative values from
	standard_sse_constant_p.

testsuite/ChangeLog:

	PR target/40957
	* gcc.target/i386/pr40957: New test.


Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>

From-SVN: r150520
parent e52201b6
2009-08-06 Uros Bizjak <ubizjak@gmail.com>
H.J. Lu <hongjiu.lu@intel.com>
PR target/40957
* config/i386/i386.c (standard_sse_mode_p): Remove.
(standard_sse_constant_p): Return 2 for integer mode
vector_all_ones_operand when SSE2 is enabled.
(standard_sse_constant_opcode)<case 2>: Always return [v]pcmpeqd.
(ix86_expand_vector_move): Do not check for negative values from
standard_sse_constant_p.
2009-08-06 Richard Guenther <rguenther@suse.de> 2009-08-06 Richard Guenther <rguenther@suse.de>
* tree-ssa.c (useless_type_conversion_p_1): Make function and * tree-ssa.c (useless_type_conversion_p_1): Make function and
......
...@@ -7357,28 +7357,8 @@ standard_80387_constant_rtx (int idx) ...@@ -7357,28 +7357,8 @@ standard_80387_constant_rtx (int idx)
XFmode); XFmode);
} }
/* Return 1 if mode is a valid mode for sse. */ /* Return 1 if X is all 0s and 2 if x is all 1s
static int in supported SSE vector mode. */
standard_sse_mode_p (enum machine_mode mode)
{
switch (mode)
{
case V16QImode:
case V8HImode:
case V4SImode:
case V2DImode:
case V4SFmode:
case V2DFmode:
return 1;
default:
return 0;
}
}
/* Return 1 if X is all 0s. For all 1s, return 2 if X is in 128bit
SSE modes and SSE2 is enabled, return 3 if X is in 256bit AVX
modes and AVX is enabled. */
int int
standard_sse_constant_p (rtx x) standard_sse_constant_p (rtx x)
...@@ -7388,12 +7368,17 @@ standard_sse_constant_p (rtx x) ...@@ -7388,12 +7368,17 @@ standard_sse_constant_p (rtx x)
if (x == const0_rtx || x == CONST0_RTX (GET_MODE (x))) if (x == const0_rtx || x == CONST0_RTX (GET_MODE (x)))
return 1; return 1;
if (vector_all_ones_operand (x, mode)) if (vector_all_ones_operand (x, mode))
{ switch (mode)
if (standard_sse_mode_p (mode)) {
return TARGET_SSE2 ? 2 : -2; case V16QImode:
else if (VALID_AVX256_REG_MODE (mode)) case V8HImode:
return TARGET_AVX ? 3 : -3; case V4SImode:
} case V2DImode:
if (TARGET_SSE2)
return 2;
default:
break;
}
return 0; return 0;
} }
...@@ -7422,22 +7407,12 @@ standard_sse_constant_opcode (rtx insn, rtx x) ...@@ -7422,22 +7407,12 @@ standard_sse_constant_opcode (rtx insn, rtx x)
case MODE_OI: case MODE_OI:
return "vpxor\t%x0, %x0, %x0"; return "vpxor\t%x0, %x0, %x0";
default: default:
gcc_unreachable (); break;
} }
case 2: case 2:
if (TARGET_AVX) return TARGET_AVX ? "vpcmpeqd\t%0, %0, %0" : "pcmpeqd\t%0, %0";
switch (get_attr_mode (insn)) default:
{ break;
case MODE_V4SF:
case MODE_V2DF:
case MODE_TI:
return "vpcmpeqd\t%0, %0, %0";
break;
default:
gcc_unreachable ();
}
else
return "pcmpeqd\t%0, %0";
} }
gcc_unreachable (); gcc_unreachable ();
} }
...@@ -12908,7 +12883,7 @@ ix86_expand_vector_move (enum machine_mode mode, rtx operands[]) ...@@ -12908,7 +12883,7 @@ ix86_expand_vector_move (enum machine_mode mode, rtx operands[])
&& (CONSTANT_P (op1) && (CONSTANT_P (op1)
|| (GET_CODE (op1) == SUBREG || (GET_CODE (op1) == SUBREG
&& CONSTANT_P (SUBREG_REG (op1)))) && CONSTANT_P (SUBREG_REG (op1))))
&& standard_sse_constant_p (op1) <= 0) && !standard_sse_constant_p (op1))
op1 = validize_mem (force_const_mem (mode, op1)); op1 = validize_mem (force_const_mem (mode, op1));
/* We need to check memory alignment for SSE mode since attribute /* We need to check memory alignment for SSE mode since attribute
......
2009-08-06 Uros Bizjak <ubizjak@gmail.com>
H.J. Lu <hongjiu.lu@intel.com>
PR target/40957
* gcc.target/i386/pr40957: New test.
2009-08-06 Richard Guenther <rguenther@suse.de> 2009-08-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40964 PR tree-optimization/40964
......
/* { dg-do compile } */
/* { dg-require-effective-target avx } */
/* { dg-options "-O2 -mavx" } */
typedef int __v8si __attribute__((__vector_size__(32)));
typedef long long __m256i __attribute__((__vector_size__(32), __may_alias__));
static __m256i
_mm256_set1_epi32 (int __A)
{
return __extension__ (__m256i)(__v8si){ __A, __A, __A, __A,
__A, __A, __A, __A };
}
__m256i
foo ()
{
return _mm256_set1_epi32 (-1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment