[PATCH] reorganize simplify_const_relational_operation

Eric Botcazou ebotcazou@libertysurf.fr
Wed Sep 19 13:44:00 GMT 2007


> Ah, right, if we are comparing -128 (0xFFFFFF80) with 127 (0x0000007F)
> we would already have high0 != high1.  I wonder if it is a bug in
> double_int_scmp, which uses HOST_WIDE_INT for the low part in signed
> comparisons.

No, it is correct there too:

typedef struct
{
  unsigned HOST_WIDE_INT low;
  HOST_WIDE_INT high;
} double_int;

> API orthogonality.  It's meant to be used elsewhere, it just happens
> that it's not; since we have simplify_const_{un,bin}ary_operation, it is
> reasonable to expect a similar function for relational operations not to
> be static.

Not really convinced (having a function static is quite convenient when you're 
modifying its prototype) but OK.


Btw, I presume that your second patch eliminates this interesting 'else':

	  get_mode_bounds (mode, sign, mode, &mmin, &mmax);

	  tem = NULL_RTX;
	  switch (code)
	    {
	    case GEU:
	    case GE:
	      /* x >= min is always true.  */
	      if (rtx_equal_p (trueop1, mmin))
		tem = const_true_rtx;
	      else 
	      break;

	    case LEU:
	    case LE:
	      /* x <= max is always true.  */
	      if (rtx_equal_p (trueop1, mmax))
		tem = const_true_rtx;
	      break;

-- 
Eric Botcazou



More information about the Gcc-patches mailing list