+2015-05-04 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c: Change GET_CODE (...) == CONST_DOUBLE check
+ to CONST_DOUBLE_P predicate.
+ (standard_sse_constant_p): Return 0 for !TARGET_SSE.
+ (ix86_legitimate_constant_p) <case CONST_WIDE_INT>: For 32bit targets,
+ allow only operands that satisfy standard_sse_constant_p predicate.
+ * config/i386/i386.md: Change GET_CODE (...) == CONST_DOUBLE check
+ to CONST_DOUBLE_P predicate.
+
2015-05-04 Jeff Law <law@redhat.com>
* match.pd (bit_and (plus/minus (convert @0) (convert @1) mask): New
REAL_VALUE_TYPE r;
- if (!(X87_FLOAT_MODE_P (mode) && (GET_CODE (x) == CONST_DOUBLE)))
+ if (!(CONST_DOUBLE_P (x) && X87_FLOAT_MODE_P (mode)))
return -1;
if (x == CONST0_RTX (mode))
int
standard_sse_constant_p (rtx x)
{
- machine_mode mode = GET_MODE (x);
+ machine_mode mode;
- if (x == const0_rtx || x == CONST0_RTX (GET_MODE (x)))
+ if (!TARGET_SSE)
+ return 0;
+
+ mode = GET_MODE (x);
+
+ if (x == const0_rtx || x == CONST0_RTX (mode))
return 1;
if (vector_all_ones_operand (x, mode))
switch (mode)
break;
case CONST_WIDE_INT:
- if (GET_MODE (x) == TImode
- && x != CONST0_RTX (TImode)
- && !TARGET_64BIT)
+ if (!TARGET_64BIT && !standard_sse_constant_p (x))
return false;
break;
output_address (x);
}
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode)
+ else if (CONST_DOUBLE_P (x) && GET_MODE (x) == SFmode)
{
REAL_VALUE_TYPE r;
long l;
fprintf (file, "0x%08x", (unsigned int) l);
}
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode)
+ else if (CONST_DOUBLE_P (x) && GET_MODE (x) == DFmode)
{
REAL_VALUE_TYPE r;
long l[2];
}
/* These float cases don't actually occur as immediate operands. */
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == XFmode)
+ else if (CONST_DOUBLE_P (x) && GET_MODE (x) == XFmode)
{
char dstr[30];
op1 = copy_to_mode_reg (mode, op1);
if (can_create_pseudo_p ()
- && FLOAT_MODE_P (mode)
- && GET_CODE (op1) == CONST_DOUBLE)
+ && CONST_DOUBLE_P (op1))
{
/* If we are loading a floating point constant to a register,
force the value to memory now, since we'll get better code
else
vmode = mode;
- if (GET_CODE (op0) == CONST_DOUBLE)
+ if (CONST_DOUBLE_P (op0))
{
rtx (*copysign_insn)(rtx, rtx, rtx, rtx);
for (i = 1; i < size; i++)
parts[i] = adjust_address (operand, SImode, 4 * i);
}
- else if (GET_CODE (operand) == CONST_DOUBLE)
+ else if (CONST_DOUBLE_P (operand))
{
REAL_VALUE_TYPE r;
long l[4];
parts[0] = operand;
parts[1] = adjust_address (operand, upper_mode, 8);
}
- else if (GET_CODE (operand) == CONST_DOUBLE)
+ else if (CONST_DOUBLE_P (operand))
{
REAL_VALUE_TYPE r;
long l[4];
return SSE_CLASS_P (regclass) ? regclass : NO_REGS;
/* Floating-point constants need more complex checks. */
- if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != VOIDmode)
+ if (CONST_DOUBLE_P (x))
{
/* General regs can load everything. */
if (reg_class_subset_p (regclass, GENERAL_REGS))
for (i = 0; i < n_elts; ++i)
{
x = XVECEXP (vals, 0, i);
- if (!(CONST_INT_P (x)
- || GET_CODE (x) == CONST_DOUBLE
- || GET_CODE (x) == CONST_FIXED))
+ if (!(CONST_SCALAR_INT_P (x)
+ || CONST_DOUBLE_P (x)
+ || CONST_FIXED_P (x)))
n_var++, one_var = i;
else if (x != CONST0_RTX (inner_mode))
all_const_zero = false;
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))
&& (!can_create_pseudo_p ()
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
- || GET_CODE (operands[1]) != CONST_DOUBLE
+ || !CONST_DOUBLE_P (operands[1])
|| (optimize_function_for_size_p (cfun)
&& standard_sse_constant_p (operands[1])
&& !memory_operand (operands[0], TFmode))
"!(MEM_P (operands[0]) && MEM_P (operands[1]))
&& (!can_create_pseudo_p ()
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
- || GET_CODE (operands[1]) != CONST_DOUBLE
+ || !CONST_DOUBLE_P (operands[1])
|| (optimize_function_for_size_p (cfun)
&& standard_80387_constant_p (operands[1]) > 0
&& !memory_operand (operands[0], XFmode))
"!(MEM_P (operands[0]) && MEM_P (operands[1]))
&& (!can_create_pseudo_p ()
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
- || GET_CODE (operands[1]) != CONST_DOUBLE
+ || !CONST_DOUBLE_P (operands[1])
|| (optimize_function_for_size_p (cfun)
&& ((!(TARGET_SSE2 && TARGET_SSE_MATH)
&& standard_80387_constant_p (operands[1]) > 0)
"!(MEM_P (operands[0]) && MEM_P (operands[1]))
&& (!can_create_pseudo_p ()
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
- || GET_CODE (operands[1]) != CONST_DOUBLE
+ || !CONST_DOUBLE_P (operands[1])
|| (optimize_function_for_size_p (cfun)
&& ((!TARGET_SSE_MATH
&& standard_80387_constant_p (operands[1]) > 0)
{
/* ??? Needed for compress_float_constant since all fp constants
are TARGET_LEGITIMATE_CONSTANT_P. */
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
+ if (CONST_DOUBLE_P (operands[1]))
{
if ((!TARGET_SSE2 || TARGET_MIX_SSE_I387)
&& standard_80387_constant_p (operands[1]) > 0)
{
/* ??? Needed for compress_float_constant since all fp constants
are TARGET_LEGITIMATE_CONSTANT_P. */
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
+ if (CONST_DOUBLE_P (operands[1]))
{
if (standard_80387_constant_p (operands[1]) > 0)
{