]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorRoger Sayle <sayle@gcc.gnu.org>
Sat, 9 Oct 2004 19:27:55 +0000 (19:27 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sat, 9 Oct 2004 19:27:55 +0000 (19:27 +0000)
2004-10-09  Roger Sayle  <roger@eyesopen.com>

PR rtl-optimization/17853
* simplify-rtx.c (simplify_relational_operation): Correct comment.
Reorganize handling of comparison operations with floating point
results (always return 0.0 even without FLOAT_STORE_FLAG_VALUE).
Likewise, introduce support for comparison operations with vector
result types, introducing a new VECTOR_STORE_FLAG_VALUE target macro.

* doc/rtl.texi: Document new VECTOR_STORE_FLAG_VALUE target macro.
* doc/tm.texi: Likewise.

2004-10-09  Stuart Hastings  <stuart@apple.com>
    Roger Sayle  <roger@eyesopen.com>

PR rtl-optimization/17853
* gcc.dg/i386-mmx-5.c: New testcase.

From-SVN: r88826

gcc/ChangeLog
gcc/doc/rtl.texi
gcc/doc/tm.texi
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/i386-mmx-5.c [new file with mode: 0644]

index e13867424122b14ef3b332fa66ea392e25d6aab3..1107817bc82e8b8a9becb0c960359e50daccced0 100644 (file)
@@ -1,3 +1,15 @@
+2004-10-09  Roger Sayle  <roger@eyesopen.com>
+
+       PR rtl-optimization/17853
+       * simplify-rtx.c (simplify_relational_operation): Correct comment.
+       Reorganize handling of comparison operations with floating point
+       results (always return 0.0 even without FLOAT_STORE_FLAG_VALUE).
+       Likewise, introduce support for comparison operations with vector
+       result types, introducing a new VECTOR_STORE_FLAG_VALUE target macro.
+
+       * doc/rtl.texi: Document new VECTOR_STORE_FLAG_VALUE target macro.
+       * doc/tm.texi: Likewise.
+
 2004-10-09  Steven Bosscher  <stevenb@suse.de>
 
        * regs.h (struct reg_info_def): Remove the last_node_uid and
index 113dc147e79d03748fc988cfeaa7573243f46947..3a72c1673413dc100638a66d0e6e07ef9ded5953 100644 (file)
@@ -2028,10 +2028,13 @@ Comparison operators test a relation on two operands and are considered
 to represent a machine-dependent nonzero value described by, but not
 necessarily equal to, @code{STORE_FLAG_VALUE} (@pxref{Misc})
 if the relation holds, or zero if it does not, for comparison operators
-whose results have a `MODE_INT' mode, and
+whose results have a `MODE_INT' mode,
 @code{FLOAT_STORE_FLAG_VALUE} (@pxref{Misc}) if the relation holds, or
 zero if it does not, for comparison operators that return floating-point
-values.  The mode of the comparison operation is independent of the mode
+values, and a vector of either @code{VECTOR_STORE_FLAG_VALUE} (@pxref{Misc})
+if the relation holds, or of zeros if it does not, for comparison operators
+that return vector results.
+The mode of the comparison operation is independent of the mode
 of the data being compared.  If the comparison operation is being tested
 (e.g., the first operand of an @code{if_then_else}), the mode must be
 @code{VOIDmode}.
index 71c72c8460324278e877a8eb65c2940c787e54a1..69f60c14335e15b9c1bba50cd4b41ba2b132462e 100644 (file)
@@ -8920,11 +8920,23 @@ instructions, or if the value generated by these instructions is 1.
 @defmac FLOAT_STORE_FLAG_VALUE (@var{mode})
 A C expression that gives a nonzero @code{REAL_VALUE_TYPE} value that is
 returned when comparison operators with floating-point results are true.
-Define this macro on machine that have comparison operations that return
+Define this macro on machines that have comparison operations that return
 floating-point values.  If there are no such operations, do not define
 this macro.
 @end defmac
 
+@defmac VECTOR_STORE_FLAG_VALUE (@var{mode})
+A C expression that gives a rtx representing the non-zero true element
+for vector comparisons.  The returned rtx should be valid for the inner
+mode of @var{mode} which is guaranteed to be a vector mode.  Define
+this macro on machines that have vector comparison operations that
+return a vector result.  If there are no such operations, do not define
+this macro.  Typically, this macro is defined as @code{const1_rtx} or
+@code{constm1_rtx}.  This macro may return @code{NULL_RTX} to prevent
+the compiler optimizing such vector comparison operations for the
+given mode.
+@end defmac
+
 @defmac CLZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
 @defmacx CTZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
 A C expression that evaluates to true if the architecture defines a value
index eec2a5816a3b4783215583fa49d533c8479103b1..7236bbfc064645bbc23445cf82145bedd287c5ce 100644 (file)
@@ -2679,7 +2679,7 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
 
 /* Like simplify_binary_operation except used for relational operators.
    MODE is the mode of the result. If MODE is VOIDmode, both operands must
-   also be VOIDmode.
+   not also be VOIDmode.
 
    CMP_MODE specifies in which mode the comparison is done in, so it is
    the mode of the operands.  If CMP_MODE is VOIDmode, it is taken from
@@ -2699,19 +2699,45 @@ simplify_relational_operation (enum rtx_code code, enum machine_mode mode,
   tem = simplify_const_relational_operation (code, cmp_mode, op0, op1);
   if (tem)
     {
-#ifdef FLOAT_STORE_FLAG_VALUE
       if (GET_MODE_CLASS (mode) == MODE_FLOAT)
        {
           if (tem == const0_rtx)
             return CONST0_RTX (mode);
-          else if (GET_MODE_CLASS (mode) == MODE_FLOAT)
-           {
-             REAL_VALUE_TYPE val;
-             val = FLOAT_STORE_FLAG_VALUE (mode);
-             return CONST_DOUBLE_FROM_REAL_VALUE (val, mode);
-           }
+#ifdef FLOAT_STORE_FLAG_VALUE
+         {
+           REAL_VALUE_TYPE val;
+           val = FLOAT_STORE_FLAG_VALUE (mode);
+           return CONST_DOUBLE_FROM_REAL_VALUE (val, mode);
+         }
+#else
+         return NULL_RTX;
+#endif 
        }
+      if (VECTOR_MODE_P (mode))
+       {
+         if (tem == const0_rtx)
+           return CONST0_RTX (mode);
+#ifdef VECTOR_STORE_FLAG_VALUE
+         {
+           int i, units;
+           rtvec c;
+
+           rtx val = VECTOR_STORE_FLAG_VALUE (mode);
+           if (val == NULL_RTX)
+             return NULL_RTX;
+           if (val == const1_rtx)
+             return CONST1_RTX (mode);
+
+           units = GET_MODE_NUNITS (mode);
+           v = rtvec_alloc (units);
+           for (i = 0; i < units; i++)
+             RTVEC_ELT (v, i) = val;
+           return gen_rtx_raw_CONST_VECTOR (mode, v);
+         }
+#else
+         return NULL_RTX;
 #endif
+       }
 
       return tem;
     }
index 52522b8278c2f2914a4fbc9a07fd929e823fcc91..5fc35b8cc988c3cbd676624fa27e86dbd6836ba6 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-09  Stuart Hastings  <stuart@apple.com>
+           Roger Sayle  <roger@eyesopen.com>
+
+       PR rtl-optimization/17853
+       * gcc.dg/i386-mmx-5.c: New testcase.
+
 2004-10-09  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * g++.dg/opt/pr17902.C: Fix typo in dg-do.
diff --git a/gcc/testsuite/gcc.dg/i386-mmx-5.c b/gcc/testsuite/gcc.dg/i386-mmx-5.c
new file mode 100644 (file)
index 0000000..6021825
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/17853 */
+/* Contributed by Stuart Hastings <stuart@apple.com> */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -mmmx" } */
+#include <mmintrin.h>
+#include <stdlib.h>
+
+__m64 global_mask;
+
+int main()
+{
+    __m64 zero = _mm_setzero_si64();
+    __m64 mask = _mm_cmpeq_pi8( zero, zero );
+    mask = _mm_unpacklo_pi8( mask, zero );
+    global_mask = mask;
+    return 0;
+}
+