aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2004-02-18 21:55:29 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2004-02-18 20:55:29 +0000
commit79ae63b183c55dc44a5071ed804c4955adeb99af (patch)
tree87138275b980d3c2dbe72a00980ccd6f080eee2d /gcc/simplify-rtx.c
parent01ab55749f71283cfd8416d68c7e34f036b2d51d (diff)
downloadgcc-79ae63b183c55dc44a5071ed804c4955adeb99af.zip
gcc-79ae63b183c55dc44a5071ed804c4955adeb99af.tar.gz
gcc-79ae63b183c55dc44a5071ed804c4955adeb99af.tar.bz2
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats. (simplify_binary_operation): Deal with logicals on floats. * i386.md (SSE fabs splitters): Emit new patterns. (SSE cmov splitters): Likewise. (sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3 (sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use subregs. (sse_andsf3, sse_nandsf3, sse_xorsf3): Kill. (sse_anddf3, sse_nanddf3, sse_xordf3): Kill. From-SVN: r78045
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c69
1 files changed, 54 insertions, 15 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 7f6b549..dda7dd4 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -771,7 +771,16 @@ simplify_unary_operation (enum rtx_code code, enum machine_mode mode,
case FIX:
real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL);
break;
+ case NOT:
+ {
+ long tmp[4];
+ int i;
+ real_to_target (tmp, &d, GET_MODE (trueop));
+ for (i = 0; i < 4; i++)
+ tmp[i] = ~tmp[i];
+ real_from_target (&d, tmp, mode);
+ }
default:
abort ();
}
@@ -1210,26 +1219,56 @@ simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
&& GET_CODE (trueop1) == CONST_DOUBLE
&& mode == GET_MODE (op0) && mode == GET_MODE (op1))
{
- REAL_VALUE_TYPE f0, f1, value;
+ if (code == AND
+ || code == IOR
+ || code == XOR)
+ {
+ long tmp0[4];
+ long tmp1[4];
+ REAL_VALUE_TYPE r;
+ int i;
+
+ real_to_target (tmp0, CONST_DOUBLE_REAL_VALUE (op0),
+ GET_MODE (op0));
+ real_to_target (tmp1, CONST_DOUBLE_REAL_VALUE (op1),
+ GET_MODE (op1));
+ for (i = 0; i < 4; i++)
+ {
+ if (code == AND)
+ tmp0[i] &= tmp1[i];
+ else if (code == IOR)
+ tmp0[i] |= tmp1[i];
+ else if (code == XOR)
+ tmp0[i] ^= tmp1[i];
+ else
+ abort ();
+ }
+ real_from_target (&r, tmp0, mode);
+ return CONST_DOUBLE_FROM_REAL_VALUE (r, mode);
+ }
+ else
+ {
+ REAL_VALUE_TYPE f0, f1, value;
- REAL_VALUE_FROM_CONST_DOUBLE (f0, trueop0);
- REAL_VALUE_FROM_CONST_DOUBLE (f1, trueop1);
- f0 = real_value_truncate (mode, f0);
- f1 = real_value_truncate (mode, f1);
+ REAL_VALUE_FROM_CONST_DOUBLE (f0, trueop0);
+ REAL_VALUE_FROM_CONST_DOUBLE (f1, trueop1);
+ f0 = real_value_truncate (mode, f0);
+ f1 = real_value_truncate (mode, f1);
- if (HONOR_SNANS (mode)
- && (REAL_VALUE_ISNAN (f0) || REAL_VALUE_ISNAN (f1)))
- return 0;
+ if (HONOR_SNANS (mode)
+ && (REAL_VALUE_ISNAN (f0) || REAL_VALUE_ISNAN (f1)))
+ return 0;
- if (code == DIV
- && REAL_VALUES_EQUAL (f1, dconst0)
- && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
- return 0;
+ if (code == DIV
+ && REAL_VALUES_EQUAL (f1, dconst0)
+ && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
+ return 0;
- REAL_ARITHMETIC (value, rtx_to_tree_code (code), f0, f1);
+ REAL_ARITHMETIC (value, rtx_to_tree_code (code), f0, f1);
- value = real_value_truncate (mode, value);
- return CONST_DOUBLE_FROM_REAL_VALUE (value, mode);
+ value = real_value_truncate (mode, value);
+ return CONST_DOUBLE_FROM_REAL_VALUE (value, mode);
+ }
}
/* We can fold some multi-word operations. */