This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

rs6000_emit_minmax: fix unsigned compares


emit_minmax is treating UMAX and UMIN as signed compares.  this poses
no problems now because rs6000_emit_minmax() is only called for FP
compares (fsel), but when integer conditional compares come about,
this is bound to break :).

ok?

2002-06-11  Aldy Hernandez  <aldyh@redhat.com>

	* rs6000.c (rs6000_emit_minmax): Treat unsigned max/mins as
	unsigned GE compares.


Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.327
diff -c -p -r1.327 rs6000.c
*** config/rs6000/rs6000.c	30 May 2002 12:07:10 -0000	1.327
--- config/rs6000/rs6000.c	11 Jun 2002 06:31:41 -0000
*************** rs6000_emit_minmax (dest, code, op0, op1
*** 7546,7557 ****
       rtx op1;
  {
    enum machine_mode mode = GET_MODE (op0);
    rtx target;
    if (code == SMAX || code == UMAX)
!     target = emit_conditional_move (dest, GE, op0, op1, mode, 
  				    op0, op1, mode, 0);
    else
!     target = emit_conditional_move (dest, GE, op0, op1, mode, 
  				    op1, op0, mode, 0);
    if (target == NULL_RTX)
      abort ();
--- 7546,7564 ----
       rtx op1;
  {
    enum machine_mode mode = GET_MODE (op0);
+   enum rtx_code c;
    rtx target;
+ 
+   if (code == SMAX || code == SMIN)
+     c = GE;
+   else
+     c = GEU;
+ 
    if (code == SMAX || code == UMAX)
!     target = emit_conditional_move (dest, c, op0, op1, mode, 
  				    op0, op1, mode, 0);
    else
!     target = emit_conditional_move (dest, c, op0, op1, mode, 
  				    op1, op0, mode, 0);
    if (target == NULL_RTX)
      abort ();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]