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
This commit is contained in:
Alexandre Oliva 2019-08-09 03:48:53 +00:00 committed by Alexandre Oliva
parent 4e9d3fdb5c
commit 5dd6b2daae
6 changed files with 17 additions and 29 deletions

View File

@ -1,3 +1,11 @@
2019-08-09 Alexandre Oliva <oliva@adacore.com>
* 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 <paolo.carlini@oracle.com>
* g++.dg/cpp0x/enum20.C: Test location(s) too.

View File

@ -14,11 +14,6 @@
#include <stdlib.h>
/* 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];

View File

@ -8,11 +8,6 @@
#include <string.h>
#include <stdlib.h>
/* 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++)

View File

@ -16,11 +16,6 @@
#include <string.h>
#include <stdlib.h>
/* 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++)

View File

@ -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];

View File

@ -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);
}