From 5dd6b2daae47fc9b6d8802391cde4c4819c82564 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Fri, 9 Aug 2019 03:48:53 +0000 Subject: [PATCH] use rand instead of random rand is in ISO C, whereas random is only in POSIX, so it makes sense to use the more portable function everywhere instead of falling back from one to the other on systems that miss the less portable one. for gcc/testsuite/ChangeLog * gcc.target/i386/sse2-mul-1.c: Use rand. Drop fallback. * gcc.target/i386/sse4_1-blendps-2.c: Likewise. * gcc.target/i386/sse4_1-blendps.c: Likewise. * gcc.target/i386/xop-vshift-1.c: Likewise. * gcc.target/powerpc/direct-move.h: Likewise. From-SVN: r274225 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/sse2-mul-1.c | 13 ++++--------- gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c | 7 +------ gcc/testsuite/gcc.target/i386/sse4_1-blendps.c | 7 +------ gcc/testsuite/gcc.target/i386/xop-vshift-1.c | 9 ++------- gcc/testsuite/gcc.target/powerpc/direct-move.h | 2 +- 6 files changed, 17 insertions(+), 29 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6d49b6d61cb..639e426d10f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-09 Alexandre Oliva + + * gcc.target/i386/sse2-mul-1.c: Use rand. Drop fallback. + * gcc.target/i386/sse4_1-blendps-2.c: Likewise. + * gcc.target/i386/sse4_1-blendps.c: Likewise. + * gcc.target/i386/xop-vshift-1.c: Likewise. + * gcc.target/powerpc/direct-move.h: Likewise. + 2019-08-08 Paolo Carlini * g++.dg/cpp0x/enum20.C: Test location(s) too. diff --git a/gcc/testsuite/gcc.target/i386/sse2-mul-1.c b/gcc/testsuite/gcc.target/i386/sse2-mul-1.c index 9cdc12763b0..af63d245d79 100644 --- a/gcc/testsuite/gcc.target/i386/sse2-mul-1.c +++ b/gcc/testsuite/gcc.target/i386/sse2-mul-1.c @@ -14,11 +14,6 @@ #include -/* mingw runtime don't provide random(). */ -#ifdef __MINGW32__ -#define random rand -#endif - #define N 512 static short a1[N], a2[N], a3[N]; static unsigned short b1[N], b2[N], b3[N]; @@ -160,12 +155,12 @@ TEST (void) asm volatile ("" : : "r" (&s2) : "memory"); asm volatile ("" : : "r" (&s3) : "memory"); asm volatile ("" : : "r" (&s4) : "memory"); - b2[i] = (int) random (); - b3[i] = (int) random (); + b2[i] = (int) rand (); + b3[i] = (int) rand (); a2[i] = b2[i]; a3[i] = b3[i]; - d2[i] = (((int) random ()) << 16) | b2[i]; - d3[i] = (((int) random ()) << 16) | b3[i]; + d2[i] = (((int) rand ()) << 16) | b2[i]; + d3[i] = (((int) rand ()) << 16) | b3[i]; c2[i] = d2[i]; c3[i] = d3[i]; s1 += a2[i] * a3[i]; diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c index 8fe71b71c57..512394ea37a 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c @@ -8,11 +8,6 @@ #include #include -/* mingw runtime don't provide random(). */ -#ifdef __MINGW32__ -#define random rand -#endif - #define NUM 20 #undef MASK @@ -64,7 +59,7 @@ sse4_1_test (void) init_blendps (src1.f, src2.f); for (i = 0; i < 4; i++) - src3.f[i] = (int) random (); + src3.f[i] = (int) rand (); /* Check blendps imm8, m128, xmm */ for (i = 0; i < NUM; i++) diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-blendps.c b/gcc/testsuite/gcc.target/i386/sse4_1-blendps.c index 3f4b335aca6..556094bf953 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-blendps.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-blendps.c @@ -16,11 +16,6 @@ #include #include -/* mingw runtime don't provide random(). */ -#ifdef __MINGW32__ -#define random rand -#endif - #define NUM 20 #ifndef MASK @@ -73,7 +68,7 @@ TEST (void) init_blendps (src1.f, src2.f); for (i = 0; i < 4; i++) - src3.f[i] = (int) random (); + src3.f[i] = (int) rand (); /* Check blendps imm8, m128, xmm */ for (i = 0; i < NUM; i++) diff --git a/gcc/testsuite/gcc.target/i386/xop-vshift-1.c b/gcc/testsuite/gcc.target/i386/xop-vshift-1.c index ee3d2990390..f3713e8ffc6 100644 --- a/gcc/testsuite/gcc.target/i386/xop-vshift-1.c +++ b/gcc/testsuite/gcc.target/i386/xop-vshift-1.c @@ -19,11 +19,6 @@ #define TYPE2 long long #endif -/* mingw runtime don't provide random(). */ -#ifdef __MINGW32__ -#define random rand -#endif - signed TYPE1 a[N], b[N], g[N]; unsigned TYPE1 c[N], h[N]; signed TYPE2 d[N], e[N], j[N]; @@ -108,10 +103,10 @@ TEST () for (i = 0; i < N; i++) { asm (""); - c[i] = (random () << 1) | (random () & 1); + c[i] = (rand () << 1) | (rand () & 1); b[i] = (i * 85) & (sizeof (TYPE1) * __CHAR_BIT__ - 1); a[i] = c[i]; - d[i] = (random () << 1) | (random () & 1); + d[i] = (rand () << 1) | (rand () & 1); d[i] |= (unsigned long long) c[i] << 32; e[i] = (i * 85) & (sizeof (TYPE2) * __CHAR_BIT__ - 1); f[i] = d[i]; diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move.h b/gcc/testsuite/gcc.target/powerpc/direct-move.h index e29f10f5cd5..80874adcea1 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move.h +++ b/gcc/testsuite/gcc.target/powerpc/direct-move.h @@ -179,7 +179,7 @@ main (void) for (j = 0; j < 10; j++) { for (i = 0; i < sizeof (TYPE); i++) - u.bytes[i] = (unsigned char) (random () >> 4); + u.bytes[i] = (unsigned char) (rand () >> 4); test_value (u.value); } -- 2.30.2