[llvm-commits] [test-suite] r74425 - in /test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs: gscolor.c gsimage.c iscan.c std.h zarray.c zpacked.c
Dan Gohman
gohman at apple.com
Mon Jun 29 09:23:10 PDT 2009
Author: djg
Date: Mon Jun 29 11:23:09 2009
New Revision: 74425
URL: http://llvm.org/viewvc/llvm-project?rev=74425&view=rev
Log:
Fix several bugs in MultiSource/Benchmarks/MallocBench/gs. This is enough
to get this test to execute as successfully on x86-64 as it does on x86-32.
Modified:
test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c
test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c
test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c
test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h
test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c
test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c
Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c?rev=74425&r1=74424&r2=74425&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c Mon Jun 29 11:23:09 2009
@@ -173,7 +173,7 @@
/* Convert the frequency to cell width and height */
{ float cell_size = 72.0 / freq;
gs_point pcwh;
- gs_matrix imat;
+ gs_matrix imat = {};
int dev_w, dev_h;
gs_deviceparams(gs_currentdevice(pgs), &imat, &dev_w, &dev_h);
if ( (code = gs_distance_transform(cell_size, cell_size,
Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c?rev=74425&r1=74424&r2=74425&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c Mon Jun 29 11:23:09 2009
@@ -32,6 +32,7 @@
#include "gzcolor.h" /* requires gxdevice.h */
#include "gzpath.h"
#include "gximage.h"
+#include <stdint.h>
/* Exported size of enumerator */
int gs_image_enum_sizeof = sizeof(gs_image_enum);
@@ -108,19 +109,19 @@
/* Common setup for image and imagemask. */
/* Note that the mask tables depend on the end-orientation of the CPU. */
/* We can't simply define them as byte arrays, because */
-/* they might not wind up properly long- or short-aligned. */
+/* they might not wind up properly 32-bit or 16-bit-aligned. */
#define map4tox(a,b,c,d)\
0, a, b, a+b, c, a+c, b+c, a+b+c,\
d, a+d, b+d, a+b+d, c+d, a+c+d, b+c+d, a+b+c+d
#if big_endian
-private unsigned long map_4_to_32[16] =
+private uint32_t map_4_to_32[16] =
{ map4tox(0xffL, 0xff00L, 0xff0000L, 0xff000000L) };
-private unsigned short map_4_to_16[16] =
+private uint16_t map_4_to_16[16] =
{ map4tox(0x55, 0xaa, 0x5500, 0xaa00) };
#else /* !big_endian */
-private unsigned long map_4_to_32[16] =
+private uint32_t map_4_to_32[16] =
{ map4tox(0xff000000L, 0xff0000L, 0xff00L, 0xffL) };
-private unsigned short map_4_to_16[16] =
+private uint16_t map_4_to_16[16] =
{ map4tox(0x5500, 0xaa00, 0x55, 0xaa) };
#endif
private int
@@ -321,7 +322,7 @@
private void
image_unpack_0(gs_image_enum *penum, byte *bptr,
register byte *data, uint dsize)
-{ register unsigned long *bufp = (unsigned long *)bptr;
+{ register uint32_t *bufp = (uint32_t *)bptr;
int left = dsize;
while ( left-- )
{ register unsigned b = *data++;
@@ -351,7 +352,7 @@
private void
image_unpack_1(gs_image_enum *penum, byte *bptr,
register byte *data, uint dsize)
-{ register unsigned short *bufp = (unsigned short *)bptr;
+{ register uint16_t *bufp = (uint16_t *)bptr;
int left = dsize;
while ( left-- )
{ register unsigned b = *data++;
Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c?rev=74425&r1=74424&r2=74425&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c Mon Jun 29 11:23:09 2009
@@ -30,6 +30,7 @@
#include "store.h"
#include "stream.h"
#include "scanchar.h"
+#include <stdint.h>
/* Array packing flag */
int array_packing;
@@ -78,10 +79,10 @@
private int
dynamic_grow(register dynamic_area *pda)
{ uint num = pda->num_elts;
- uint size = num * pda->elt_size;
- uint new_num;
+ uintptr_t size = num * pda->elt_size;
+ uintptr_t new_num;
uint pos = pda->next - pda->base;
- size = (size < 10 ? 20 : size >= (max_uint >> 1) ? max_uint : size << 1);
+ size = (size < 10 ? 20 : size >= (max_uint >> 1) ? UINTPTR_MAX : size << 1);
new_num = size / pda->elt_size;
if ( pda->is_dynamic )
{ pda->base = alloc_grow(pda->base, num, new_num, pda->elt_size, "scanner");
Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h?rev=74425&r1=74424&r2=74425&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h Mon Jun 29 11:23:09 2009
@@ -73,11 +73,11 @@
typedef unsigned long ulong;
/* Maximum values for the unsigned types. */
-/* The "+0" is to get around apparent bugs in the UTek compiler. */
-#define max_uchar ((uchar)0xff + (uchar)0)
-#define max_ushort ((ushort)0xffff + (ushort)0)
-#define max_uint ((uint)0xffffffff + (uint)0)
-#define max_ulong ((ulong)0xffffffffL + (ulong)0)
+#include <limits.h>
+#define max_uchar UCHAR_MAX
+#define max_ushort USHRT_MAX
+#define max_uint UINT_MAX
+#define max_ulong ULONG_MAX
/* Define a reliable arithmetic right shift. */
#if (-2 >> 1) == -1
Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c?rev=74425&r1=74424&r2=74425&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c Mon Jun 29 11:23:09 2009
@@ -26,6 +26,7 @@
#include "oper.h"
#include "store.h"
#include "sstorei.h"
+#include <stdint.h>
/* The generic operators (copy, get, put, getinterval, putinterval, */
/* length, and forall) are implemented in zgeneric.c. */
@@ -63,7 +64,7 @@
/* astore */
int
zastore(register ref *op)
-{ uint size;
+{ uintptr_t size;
check_type(*op, t_array);
check_write(*op);
size = op->size;
Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c?rev=74425&r1=74424&r2=74425&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c Mon Jun 29 11:23:09 2009
@@ -23,6 +23,7 @@
#include "errors.h"
#include "oper.h"
#include "store.h"
+#include <stdint.h>
/* Import the array packing flag */
extern int array_packing;
@@ -70,7 +71,7 @@
{ int code = make_array(op, t_packedarray, a_read+a_execute, "packedarray");
if ( code < 0 ) return code;
{ /* Fill the array from the stack. */
- uint size = op->size;
+ uintptr_t size = op->size;
if ( size > op - osbot ) return e_stackunderflow;
refcpy(op->value.refs, op - size, size);
op[-size] = *op;
More information about the llvm-commits
mailing list