diff mbox

VRP wrapping MULT_EXPR

Message ID alpine.DEB.2.02.1208031425530.27241@stedding.saclay.inria.fr
State New
Headers show

Commit Message

Marc Glisse Aug. 3, 2012, 12:32 p.m. UTC
On Fri, 3 Aug 2012, Richard Guenther wrote:

>> +/* Some quadruple precision helpers.  */
>> +static int
>> +quad_int_cmp (double_int l0, double_int h0,
>> +             double_int l1, double_int h1, bool uns)
>> +{
>> +  int c = double_int_cmp (h0, h1, uns);
>> +  if (c != 0) return c;
>> +  return double_int_ucmp (l0, l1);
>> +}
>
> I suppose that's appropriate for double-int.h as static inline function.
>
> Ok with or without moving it (we can do that as followup anyway) if
> testing is ok.

Thanks, I applied it without moving, and am now doing a quick bootstrap of 
the following (to make sure I didn't forget a ';' during the copy-paste).

2012-08-03 Marc Glisse <marc.glisse@inria.fr>

 	* tree-vrp.c (quad_int_cmp): Move ...
 	* double-int.h (quad_int_cmp): ... here.

Comments

Marc Glisse Aug. 3, 2012, 12:54 p.m. UTC | #1
On Fri, 3 Aug 2012, Marc Glisse wrote:

> On Fri, 3 Aug 2012, Richard Guenther wrote:
>
>>> +/* Some quadruple precision helpers.  */
>>> +static int
>>> +quad_int_cmp (double_int l0, double_int h0,
>>> +             double_int l1, double_int h1, bool uns)
>>> +{
>>> +  int c = double_int_cmp (h0, h1, uns);
>>> +  if (c != 0) return c;
>>> +  return double_int_ucmp (l0, l1);
>>> +}
>> 
>> I suppose that's appropriate for double-int.h as static inline function.
>> 
>> Ok with or without moving it (we can do that as followup anyway) if
>> testing is ok.
>
> Thanks, I applied it without moving, and am now doing a quick bootstrap of 
> the following (to make sure I didn't forget a ';' during the copy-paste).
>
> 2012-08-03 Marc Glisse <marc.glisse@inria.fr>
>
> 	* tree-vrp.c (quad_int_cmp): Move ...
> 	* double-int.h (quad_int_cmp): ... here.

Hmm, that fails early. Apparently, the compilation of gengtype.o includes 
double-int.h and is done with -fkeep-inline-functions. The function 
quad_int_cmp, although it is static inline, then ends up in gengtype.o. 
But that function uses double_int_cmp, and gengtype doesn't link 
double-int.o, so I get an undefined reference failure. I guess I'll leave 
the function in tree-vrp.c for now.
diff mbox

Patch

Index: tree-vrp.c
===================================================================
--- tree-vrp.c	(revision 190125)
+++ tree-vrp.c	(working copy)
@@ -2181,30 +2181,21 @@  extract_range_from_multiplicative_op_1 (
     {
       /* If the new range has its limits swapped around (MIN > MAX),
 	 then the operation caused one of them to wrap around, mark
 	 the new range VARYING.  */
       set_value_range_to_varying (vr);
     }
   else
     set_value_range (vr, type, min, max, NULL);
 }
 
-/* Some quadruple precision helpers.  */
-static int
-quad_int_cmp (double_int l0, double_int h0,
-	      double_int l1, double_int h1, bool uns)
-{
-  int c = double_int_cmp (h0, h1, uns);
-  if (c != 0) return c;
-  return double_int_ucmp (l0, l1);
-}
-
+/* Quadruple precision helper.  */
 static void
 quad_int_pair_sort (double_int *l0, double_int *h0,
 		    double_int *l1, double_int *h1, bool uns)
 {
   if (quad_int_cmp (*l0, *h0, *l1, *h1, uns) > 0)
     {
       double_int tmp;
       tmp = *l0; *l0 = *l1; *l1 = tmp;
       tmp = *h0; *h0 = *h1; *h1 = tmp;
     }
Index: double-int.h
===================================================================
--- double-int.h	(revision 190125)
+++ double-int.h	(working copy)
@@ -219,20 +219,29 @@  double_int double_int_rrotate (double_in
 static inline bool
 double_int_negative_p (double_int cst)
 {
   return cst.high < 0;
 }
 
 int double_int_cmp (double_int, double_int, bool);
 int double_int_scmp (double_int, double_int);
 int double_int_ucmp (double_int, double_int);
 
+static inline int
+quad_int_cmp (double_int l0, double_int h0,
+	      double_int l1, double_int h1, bool uns)
+{
+  int c = double_int_cmp (h0, h1, uns);
+  if (c != 0) return c;
+  return double_int_ucmp (l0, l1);
+}
+
 double_int double_int_max (double_int, double_int, bool);
 double_int double_int_smax (double_int, double_int);
 double_int double_int_umax (double_int, double_int);
 
 double_int double_int_min (double_int, double_int, bool);
 double_int double_int_smin (double_int, double_int);
 double_int double_int_umin (double_int, double_int);
 
 void dump_double_int (FILE *, double_int, bool);