Commit e7c82a99 by Jakub Jelinek Committed by Jakub Jelinek

rtl.h (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE from 3 x MAX_MACHINE_MODE.

	* rtl.h (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE
	from 3 x MAX_MACHINE_MODE.
	(CONSTM1_RTX): Define.
	* emit-rtl.c (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE
        from 3 x MAX_MACHINE_MODE.
	(gen_rtx_CONST_VECTOR): Use CONSTM1_RTX if all inner constants are
	CONSTM1_RTX.
	(init_emit_once): Initialize CONSTM1_RTX for MODE_INT and
	MODE_VECTOR_INT modes.
	* simplify-rtx.c (simplify_binary_operation_1) <case IOR, XOR, AND>:
	Optimize if one operand is CONSTM1_RTX.
	* config/i386/i386.c (ix86_expand_sse_movcc): Optimize mask ? -1 : x
	into mask | x.

From-SVN: r179238
parent 16fa5e23
2011-09-27 Jakub Jelinek <jakub@redhat.com>
* rtl.h (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE
from 3 x MAX_MACHINE_MODE.
(CONSTM1_RTX): Define.
* emit-rtl.c (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE
from 3 x MAX_MACHINE_MODE.
(gen_rtx_CONST_VECTOR): Use CONSTM1_RTX if all inner constants are
CONSTM1_RTX.
(init_emit_once): Initialize CONSTM1_RTX for MODE_INT and
MODE_VECTOR_INT modes.
* simplify-rtx.c (simplify_binary_operation_1) <case IOR, XOR, AND>:
Optimize if one operand is CONSTM1_RTX.
* config/i386/i386.c (ix86_expand_sse_movcc): Optimize mask ? -1 : x
into mask | x.
2011-09-26 David S. Miller <davem@davemloft.net> 2011-09-26 David S. Miller <davem@davemloft.net>
* config/sparc/sparc.md (edge{8,16,32}{,l}): Return Pmode. * config/sparc/sparc.md (edge{8,16,32}{,l}): Return Pmode.
...@@ -18903,6 +18903,12 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false) ...@@ -18903,6 +18903,12 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false)
x = gen_rtx_AND (mode, x, op_false); x = gen_rtx_AND (mode, x, op_false);
emit_insn (gen_rtx_SET (VOIDmode, dest, x)); emit_insn (gen_rtx_SET (VOIDmode, dest, x));
} }
else if (INTEGRAL_MODE_P (mode) && op_true == CONSTM1_RTX (mode))
{
op_false = force_reg (mode, op_false);
x = gen_rtx_IOR (mode, cmp, op_false);
emit_insn (gen_rtx_SET (VOIDmode, dest, x));
}
else if (TARGET_XOP) else if (TARGET_XOP)
{ {
op_true = force_reg (mode, op_true); op_true = force_reg (mode, op_true);
...@@ -93,9 +93,10 @@ static GTY(()) int label_num = 1; ...@@ -93,9 +93,10 @@ static GTY(()) int label_num = 1;
/* We record floating-point CONST_DOUBLEs in each floating-point mode for /* We record floating-point CONST_DOUBLEs in each floating-point mode for
the values of 0, 1, and 2. For the integer entries and VOIDmode, we the values of 0, 1, and 2. For the integer entries and VOIDmode, we
record a copy of const[012]_rtx. */ record a copy of const[012]_rtx and constm1_rtx. CONSTM1_RTX
is set only for MODE_INT and MODE_VECTOR_INT modes. */
rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE]; rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
rtx const_true_rtx; rtx const_true_rtx;
...@@ -5514,6 +5515,8 @@ gen_rtx_CONST_VECTOR (enum machine_mode mode, rtvec v) ...@@ -5514,6 +5515,8 @@ gen_rtx_CONST_VECTOR (enum machine_mode mode, rtvec v)
return CONST0_RTX (mode); return CONST0_RTX (mode);
else if (x == CONST1_RTX (inner)) else if (x == CONST1_RTX (inner))
return CONST1_RTX (mode); return CONST1_RTX (mode);
else if (x == CONSTM1_RTX (inner))
return CONSTM1_RTX (mode);
} }
return gen_rtx_raw_CONST_VECTOR (mode, v); return gen_rtx_raw_CONST_VECTOR (mode, v);
...@@ -5674,7 +5677,7 @@ init_emit_once (void) ...@@ -5674,7 +5677,7 @@ init_emit_once (void)
dconsthalf = dconst1; dconsthalf = dconst1;
SET_REAL_EXP (&dconsthalf, REAL_EXP (&dconsthalf) - 1); SET_REAL_EXP (&dconsthalf, REAL_EXP (&dconsthalf) - 1);
for (i = 0; i < (int) ARRAY_SIZE (const_tiny_rtx); i++) for (i = 0; i < 3; i++)
{ {
const REAL_VALUE_TYPE *const r = const REAL_VALUE_TYPE *const r =
(i == 0 ? &dconst0 : i == 1 ? &dconst1 : &dconst2); (i == 0 ? &dconst0 : i == 1 ? &dconst1 : &dconst2);
...@@ -5704,6 +5707,13 @@ init_emit_once (void) ...@@ -5704,6 +5707,13 @@ init_emit_once (void)
const_tiny_rtx[i][(int) mode] = GEN_INT (i); const_tiny_rtx[i][(int) mode] = GEN_INT (i);
} }
const_tiny_rtx[3][(int) VOIDmode] = constm1_rtx;
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
const_tiny_rtx[3][(int) mode] = constm1_rtx;
for (mode = GET_CLASS_NARROWEST_MODE (MODE_COMPLEX_INT); for (mode = GET_CLASS_NARROWEST_MODE (MODE_COMPLEX_INT);
mode != VOIDmode; mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode)) mode = GET_MODE_WIDER_MODE (mode))
...@@ -5726,6 +5736,7 @@ init_emit_once (void) ...@@ -5726,6 +5736,7 @@ init_emit_once (void)
{ {
const_tiny_rtx[0][(int) mode] = gen_const_vector (mode, 0); const_tiny_rtx[0][(int) mode] = gen_const_vector (mode, 0);
const_tiny_rtx[1][(int) mode] = gen_const_vector (mode, 1); const_tiny_rtx[1][(int) mode] = gen_const_vector (mode, 1);
const_tiny_rtx[3][(int) mode] = gen_const_vector (mode, 3);
} }
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT); for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
......
...@@ -2074,17 +2074,18 @@ extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1]; ...@@ -2074,17 +2074,18 @@ extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
#define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1]) #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
extern GTY(()) rtx const_true_rtx; extern GTY(()) rtx const_true_rtx;
extern GTY(()) rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE]; extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
/* Returns a constant 0 rtx in mode MODE. Integer modes are treated the /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
same as VOIDmode. */ same as VOIDmode. */
#define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)]) #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
/* Likewise, for the constants 1 and 2. */ /* Likewise, for the constants 1 and 2 and -1. */
#define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)]) #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
#define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)]) #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
#define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
/* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
is used to represent the frame pointer. This is because the is used to represent the frame pointer. This is because the
......
...@@ -2431,9 +2431,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, ...@@ -2431,9 +2431,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
case IOR: case IOR:
if (trueop1 == CONST0_RTX (mode)) if (trueop1 == CONST0_RTX (mode))
return op0; return op0;
if (CONST_INT_P (trueop1) if (INTEGRAL_MODE_P (mode) && trueop1 == CONSTM1_RTX (mode))
&& ((UINTVAL (trueop1) & GET_MODE_MASK (mode))
== GET_MODE_MASK (mode)))
return op1; return op1;
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0)) if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
return op0; return op0;
...@@ -2573,9 +2571,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, ...@@ -2573,9 +2571,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
case XOR: case XOR:
if (trueop1 == CONST0_RTX (mode)) if (trueop1 == CONST0_RTX (mode))
return op0; return op0;
if (CONST_INT_P (trueop1) if (INTEGRAL_MODE_P (mode) && trueop1 == CONSTM1_RTX (mode))
&& ((UINTVAL (trueop1) & GET_MODE_MASK (mode))
== GET_MODE_MASK (mode)))
return simplify_gen_unary (NOT, mode, op0, mode); return simplify_gen_unary (NOT, mode, op0, mode);
if (rtx_equal_p (trueop0, trueop1) if (rtx_equal_p (trueop0, trueop1)
&& ! side_effects_p (op0) && ! side_effects_p (op0)
...@@ -2721,6 +2717,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, ...@@ -2721,6 +2717,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
case AND: case AND:
if (trueop1 == CONST0_RTX (mode) && ! side_effects_p (op0)) if (trueop1 == CONST0_RTX (mode) && ! side_effects_p (op0))
return trueop1; return trueop1;
if (INTEGRAL_MODE_P (mode) && trueop1 == CONSTM1_RTX (mode))
return op0;
if (HWI_COMPUTABLE_MODE_P (mode)) if (HWI_COMPUTABLE_MODE_P (mode))
{ {
HOST_WIDE_INT nzop0 = nonzero_bits (trueop0, mode); HOST_WIDE_INT nzop0 = nonzero_bits (trueop0, mode);
......
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