ia64.c (ia64_expand_vecint_minmax): Use us_minus and plus for V4HImode UMAX.
authorRichard Henderson <rth@redhat.com>
Wed, 29 Jun 2005 22:22:13 +0000 (15:22 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 29 Jun 2005 22:22:13 +0000 (15:22 -0700)
        * config/ia64/ia64.c (ia64_expand_vecint_minmax): Use us_minus and
        plus for V4HImode UMAX.

From-SVN: r101441

gcc/ChangeLog
gcc/config/ia64/ia64.c

index 91e2631840e8bdee66c9db406d58fd8a12e501ce..ea8a5ae9d2ff9099f1248d38356661424f2253ba 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-29  Richard Henderson  <rth@redhat.com>
+
+       * config/ia64/ia64.c (ia64_expand_vecint_minmax): Use us_minus and
+       plus for V4HImode UMAX.
+
 2005-06-29  Joseph S. Myers  <joseph@codesourcery.com>
 
        * c-tree.h (default_function_array_conversion): Take and return
index 85d0bd22cd8cc6d7accc2bb56066478c1e074105..f8f3463582762ca7edacdc0538e231ffec151488 100644 (file)
@@ -1689,6 +1689,18 @@ ia64_expand_vecint_minmax (enum rtx_code code, enum machine_mode mode,
   if (mode == V4HImode && (code == SMIN || code == SMAX))
     return false;
 
+  /* This combination can be implemented with only saturating subtraction.  */
+  if (mode == V4HImode && code == UMAX)
+    {
+      rtx x, tmp = gen_reg_rtx (mode);
+
+      x = gen_rtx_US_MINUS (mode, operands[1], operands[2]);
+      emit_insn (gen_rtx_SET (VOIDmode, tmp, x));
+
+      emit_insn (gen_addv4hi3 (operands[0], tmp, operands[2]));
+      return true;
+    }
+
   /* Everything else implemented via vector comparisons.  */
   xops[0] = operands[0];
   xops[4] = xops[1] = operands[1];