[Commit] cairo_u128 ChangeLog, 1.4, 1.5 Makefile, 1.5, 1.6 cairo_test.c, 1.5, 1.6 cairo_uint128.c, 1.5, 1.6 params, 1.1, 1.2

Keith Packard commit at keithp.com
Fri May 28 08:56:25 PDT 2004


Committed by: keithp

Update of /local/src/CVS/cairo_u128
In directory home.keithp.com:/tmp/cvs-serv29574

Modified Files:
	ChangeLog Makefile cairo_test.c cairo_uint128.c params 
Log Message:
2004-05-28  Keith Packard  <keithp at keithp.com>

        * Makefile:
        * cairo_test.c: (zero_dump_uint64), (dump_uint128):
        Support 'native' int128_t
        * cairo_uint128.c: (_cairo_int128_negate), (_cairo_int128_not),
        (_cairo_int128_divrem):
        Shuffle code to move _cairo_int128_divrem to always be built
        * params:
        Need more reps to get decent timing on itanium


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/cairo_u128/ChangeLog,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/ChangeLog	28 May 2004 06:50:55 -0000	1.4
+++ b/ChangeLog	28 May 2004 15:56:23 -0000	1.5
@@ -1,3 +1,14 @@
+2004-05-28  Keith Packard  <keithp at keithp.com>
+
+	* Makefile:
+	* cairo_test.c: (zero_dump_uint64), (dump_uint128):
+	Support 'native' int128_t
+	* cairo_uint128.c: (_cairo_int128_negate), (_cairo_int128_not),
+	(_cairo_int128_divrem):
+	Shuffle code to move _cairo_int128_divrem to always be built
+	* params:
+	Need more reps to get decent timing on itanium
+
 2004-05-27  Keith Packard  <keithp at keithp.com>
 
 	* params:

Index: Makefile
===================================================================
RCS file: /local/src/CVS/cairo_u128/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/Makefile	28 May 2004 05:47:16 -0000	1.5
+++ b/Makefile	28 May 2004 15:56:23 -0000	1.6
@@ -1,9 +1,15 @@
 include params
 HAVE_UINT64_T=1
 HAVE_UINT128_T=0
+#
+# ia64 gcc 3.3.3 has __int128_t/__uint128_t, but stdint.h doesn't know
+#
+INT128DEFS=-Dint128_t=__int128_t -Duint128_t=__uint128_t
+HAVEDEFS=-DHAVE_UINT64_T=$(HAVE_UINT64_T) -DHAVE_UINT128_T=$(HAVE_UINT128_T)
+DEFS=$(HAVEDEFS) $(INT128DEFS)
 CDEBUGFLAGS=-O4
 
-CFLAGS=$(CDEBUGFLAGS) -DHAVE_UINT64_T=$(HAVE_UINT64_T) -DHAVE_UINT128_T=$(HAVE_UINT128_T)
+CFLAGS=$(CDEBUGFLAGS) $(DEFS)
 OBJS = cairo_uint128.o cairo_test.o
 
 check: c nickle
@@ -13,10 +19,18 @@
 	./cairo_test $(SETS) < data > $@
 
 nickle: checkdata.5c data
-	./checkdata.5c < data > $@
+	if nickle -e 'exit (version >= "2.37" ? 0 : 1)'; then \
+		nickle ./checkdata.5c < data > $@; \
+	else \
+		touch $@; \
+	fi
 
 data: makedata.5c params
-	./makedata.5c $(SETS) > data
+	if nickle -e 'exit (version >= "2.37" ? 0 : 1)'; then \
+		nickle ./makedata.5c $(SETS) > $@; \
+	else \
+		touch $@; \
+	fi
 
 cairo_test: $(OBJS)
 	$(CC) $(CFLAGS) -o $@ $(OBJS)

Index: cairo_test.c
===================================================================
RCS file: /local/src/CVS/cairo_u128/cairo_test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/cairo_test.c	28 May 2004 05:47:16 -0000	1.5
+++ b/cairo_test.c	28 May 2004 15:56:23 -0000	1.6
@@ -27,11 +27,14 @@
 #include <stdlib.h>
 #include <ctype.h>
 
+#define INT64_ZFMT   (sizeof (int64_t) == sizeof (long) ? "%016lx" : "%016llx")
+#define INT64_FMT   (sizeof (int64_t) == sizeof (long) ? "%lx" : "%llx")
+ 
 void
 zero_dump_uint64 (cairo_uint64_t q, int zero)
 {
 #if HAVE_UINT64_T
-    printf (zero ? "%016llx" : "%llx", q);
+    printf (zero ? INT64_ZFMT : INT64_FMT, q);
 #else
     if (q.hi || zero)
 	printf (zero ? "%08x%08x" : "%x%08x", q.hi, q.lo);
@@ -57,17 +60,25 @@
     dump_uint64 (_cairo_int64_to_uint64 (d));
 }
 
+#if HAVE_UINT128_T
+#define cairo_uint128_lo(x) ((x) & ((uint64_t) ~0))
+#define cairo_uint128_hi(x) ((x) >> 64)
+#else
+#define cairo_uint128_lo(x) ((x).lo)
+#define cairo_uint128_hi(x) ((x).hi)
+#endif
+
 void
 dump_uint128 (cairo_uint128_t	q)
 {
     int	    zero = 0;
     
-    if (_cairo_uint64_ne(q.hi, _cairo_uint32_to_uint64(0)))
+    if (_cairo_uint64_ne(cairo_uint128_hi(q), _cairo_uint32_to_uint64(0)))
     {
-	zero_dump_uint64 (q.hi, 0);
+	zero_dump_uint64 (cairo_uint128_hi(q), 0);
 	zero = 1;
     }
-    zero_dump_uint64 (q.lo, zero);
+    zero_dump_uint64 (cairo_uint128_lo(q), zero);
 }
 
 void

Index: cairo_uint128.c
===================================================================
RCS file: /local/src/CVS/cairo_u128/cairo_uint128.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/cairo_uint128.c	28 May 2004 05:47:16 -0000	1.5
+++ b/cairo_uint128.c	28 May 2004 15:56:23 -0000	1.6
@@ -947,6 +947,24 @@
     return qr;
 }
 
+const cairo_int128_t
+_cairo_int128_negate (cairo_int128_t a)
+{
+    a.lo = _cairo_uint64_not (a.lo);
+    a.hi = _cairo_uint64_not (a.hi);
+    return _cairo_uint128_add (a, _cairo_uint32_to_uint128 (1));
+}
+
+const cairo_int128_t
+_cairo_int128_not (cairo_int128_t a)
+{
+    a.lo = _cairo_uint64_not (a.lo);
+    a.hi = _cairo_uint64_not (a.hi);
+    return a;
+}
+
+#endif /* !HAVE_UINT128_T */
+
 const cairo_quorem128_t
 _cairo_int128_divrem (cairo_int128_t num, cairo_int128_t den)
 {
@@ -970,21 +988,3 @@
 	qr.quo = uqr.quo;
     return qr;
 }
-    
-const cairo_int128_t
-_cairo_int128_negate (cairo_int128_t a)
-{
-    a.lo = _cairo_uint64_not (a.lo);
-    a.hi = _cairo_uint64_not (a.hi);
-    return _cairo_uint128_add (a, _cairo_uint32_to_uint128 (1));
-}
-
-const cairo_int128_t
-_cairo_int128_not (cairo_int128_t a)
-{
-    a.lo = _cairo_uint64_not (a.lo);
-    a.hi = _cairo_uint64_not (a.hi);
-    return a;
-}
-
-#endif /* !HAVE_UINT128_T */

Index: params
===================================================================
RCS file: /local/src/CVS/cairo_u128/params,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- a/params	28 May 2004 06:50:55 -0000	1.1
+++ b/params	28 May 2004 15:56:23 -0000	1.2
@@ -1,2 +1,2 @@
 SETS=1000
-REPS=100
+REPS=1000




More information about the Commit mailing list