Discussion:
Valgrind: r16298 - in /trunk/none/tests/mips64: cvm_atomic_thread.c cvm_atomic_thread.stdout.exp cvm_atomic_thread.stdout.exp-LE
(too old to reply)
s***@valgrind.org
2017-04-10 17:11:02 UTC
Permalink
Raw Message
Author: petarj
Date: Mon Apr 10 18:11:01 2017
New Revision: 16298

Log:
mips64: update cvm_atomic_thread test for BE

Update the test cvm_atomic_thread so it can be executed on BE boards too.
Reuse the stdout.exp file.

Based on patch from Tamara Vlahovic.

Added:
trunk/none/tests/mips64/cvm_atomic_thread.stdout.exp
- copied unchanged from r16295, trunk/none/tests/mips64/cvm_atomic_thread.stdout.exp-LE
Removed:
trunk/none/tests/mips64/cvm_atomic_thread.stdout.exp-LE
Modified:
trunk/none/tests/mips64/cvm_atomic_thread.c

Modified: trunk/none/tests/mips64/cvm_atomic_thread.c
==============================================================================
--- trunk/none/tests/mips64/cvm_atomic_thread.c (original)
+++ trunk/none/tests/mips64/cvm_atomic_thread.c Mon Apr 10 18:11:01 2017
@@ -14,7 +14,7 @@
#define NNN 3456987 // Number of repetition.

/* Expected values */
-long long int p1_expd[N] = { 2156643710, 2156643710, 3456986, 6913974,
+int p1_expd[N] = { 2156643710, 2156643710, 3456986, 6913974,
4288053322, 0, 4294967295,
6913974, 21777111,
3456986, 2153186724,
@@ -34,7 +34,7 @@

#define IS_8_ALIGNED(_ptr) (0 == (((unsigned long)(_ptr)) & 7))

-__attribute__((noinline)) void atomic_saa ( long long int* p, int n )
+__attribute__((noinline)) void atomic_saa ( int* p, int n )
{
#if (_MIPS_ARCH_OCTEON2)
unsigned long block[2] = { (unsigned long)p, (unsigned long)n };
@@ -66,7 +66,7 @@
#endif
}

-__attribute__((noinline)) void atomic_laa ( long long int* p, int n )
+__attribute__((noinline)) void atomic_laa ( int* p, int n )
{
#if (_MIPS_ARCH_OCTEON2)
unsigned long block[2] = { (unsigned long)p, (unsigned long)n };
@@ -98,7 +98,7 @@
#endif
}

-__attribute__((noinline)) void atomic_law ( long long int* p, int n )
+__attribute__((noinline)) void atomic_law ( int* p, int n )
{
#if (_MIPS_ARCH_OCTEON2)
unsigned long block[2] = { (unsigned long)p, (unsigned long)n };
@@ -130,7 +130,7 @@
#endif
}

-__attribute__((noinline)) void atomic_lai ( long long int* p )
+__attribute__((noinline)) void atomic_lai ( int* p )
{
#if (_MIPS_ARCH_OCTEON2)
unsigned long block[2] = { (unsigned long)p };
@@ -162,7 +162,7 @@
#endif
}

-__attribute__((noinline)) void atomic_lad ( long long int* p )
+__attribute__((noinline)) void atomic_lad ( int* p )
{
#if (_MIPS_ARCH_OCTEON2)
unsigned long block[2] = { (unsigned long)p };
@@ -194,7 +194,7 @@
#endif
}

-__attribute__((noinline)) void atomic_lac ( long long int* p )
+__attribute__((noinline)) void atomic_lac ( int* p )
{
#if (_MIPS_ARCH_OCTEON2)
unsigned long block[2] = { (unsigned long)p };
@@ -226,7 +226,7 @@
#endif
}

-__attribute__((noinline)) void atomic_las ( long long int* p )
+__attribute__((noinline)) void atomic_las ( int* p )
{
#if (_MIPS_ARCH_OCTEON2)
unsigned long block[2] = { (unsigned long)p };
@@ -307,7 +307,7 @@
#if (_MIPS_ARCH_OCTEON2)
int i, status;
char* page[N];
- long long int* p1[N];
+ int* p1[N];
long long int* p2[N];
pid_t child, pc2;

@@ -321,8 +321,8 @@
perror("mmap failed");
exit(1);
}
- p1[i] = (long long int*)(page[i]+0);
- p2[i] = (long long int*)(page[i]+256);
+ p1[i] = (int*)(page[i] + 0);
+ p2[i] = (long long int*)(page[i] + 256);

assert( IS_8_ALIGNED(p1[i]) );
assert( IS_8_ALIGNED(p2[i]) );
@@ -345,11 +345,11 @@
printf("child\n");
for (i = 0; i < NNN; i++) {
atomic_saa(p1[0], i);
- atomic_saad(p2[0], i+98765 ); /* ensure we hit the upper 32 bits */
+ atomic_saad(p2[0], i + 98765 ); /* ensure we hit the upper 32 bits */
atomic_laa(p1[1], i);
- atomic_laad(p2[1], i+98765 ); /* ensure we hit the upper 32 bits */
+ atomic_laad(p2[1], i + 98765 ); /* ensure we hit the upper 32 bits */
atomic_law(p1[2], i);
- atomic_lawd(p2[2], i+98765 ); /* ensure we hit the upper 32 bits */
+ atomic_lawd(p2[2], i + 98765 ); /* ensure we hit the upper 32 bits */
atomic_lai(p1[3]);
atomic_laid(p2[3]);
atomic_lad(p1[4]);
@@ -381,11 +381,11 @@

for (i = 0; i < NNN; i++) {
atomic_saa(p1[0], i);
- atomic_saad(p2[0], i+98765); /* ensure we hit the upper 32 bits */
+ atomic_saad(p2[0], i + 98765); /* ensure we hit the upper 32 bits */
atomic_laa(p1[1], i);
- atomic_laad(p2[1], i+98765); /* ensure we hit the upper 32 bits */
+ atomic_laad(p2[1], i + 98765); /* ensure we hit the upper 32 bits */
atomic_law(p1[2], i);
- atomic_lawd(p2[2], i+98765 ); /* ensure we hit the upper 32 bits */
+ atomic_lawd(p2[2], i + 98765 ); /* ensure we hit the upper 32 bits */
atomic_lai(p1[3]);
atomic_laid(p2[3]);
atomic_lad(p1[4]);
@@ -414,25 +414,25 @@
/* assert that child finished normally */
assert(WIFEXITED(status));

- printf("Store Atomic Add: 32 bit %lld, 64 bit %lld\n", *p1[0], *p2[0]);
- printf("Load Atomic Add: 32 bit %lld, 64 bit %lld\n", *p1[1], *p2[1]);
- printf("Load Atomic Swap: 32 bit %lld, 64 bit %lld\n", *p1[2], *p2[2]);
- printf("Load Atomic Increment: 32 bit %lld, 64 bit %lld\n", *p1[3], *p2[3]);
- printf("Load Atomic Decrement: 32 bit %lld, 64 bit %lld\n", *p1[4], *p2[4]);
- printf("Load Atomic Clear: 32 bit %lld, 64 bit %lld\n", *p1[5], *p2[5]);
- printf("Load Atomic Set: 32 bit %lld, 64 bit %lld\n", *p1[6], *p2[6]);
- printf("laa and saa: base1: %lld, base2: %lld\n", *p1[7], *p1[8]);
- printf("laad and saad: base1: %lld, base2: %lld\n", *p2[7], *p2[8]);
- printf("law and saa: base1: %lld, base2: %lld\n", *p1[9], *p1[10]);
- printf("lawd and saad: base1: %lld, base2: %lld\n", *p2[9], *p2[10]);
- printf("lai and saa: base1: %lld, base2: %lld\n", *p1[11], *p1[12]);
- printf("laid and saad: base1: %lld, base2: %lld\n", *p2[11], *p2[12]);
- printf("las and saa: base1: %lld, base2: %lld\n", *p1[13], *p1[14]);
- printf("lasd and saad: base1: %lld, base2: %lld\n", *p2[13], *p2[14]);
- printf("lad and saa: base1: %lld, base2: %lld\n", *p1[15], *p1[16]);
- printf("ladd and saad: base1: %lld, base2: %lld\n", *p2[15], *p2[16]);
- printf("lac and saa: base1: %lld, base2: %lld\n", *p1[17], *p1[18]);
- printf("lacd and saad: base1: %lld, base2: %lld\n", *p2[17], *p2[18]);
+ printf("Store Atomic Add: 32 bit %u, 64 bit %lld\n", *p1[0], *p2[0]);
+ printf("Load Atomic Add: 32 bit %u, 64 bit %lld\n", *p1[1], *p2[1]);
+ printf("Load Atomic Swap: 32 bit %u, 64 bit %lld\n", *p1[2], *p2[2]);
+ printf("Load Atomic Increment: 32 bit %u, 64 bit %lld\n", *p1[3], *p2[3]);
+ printf("Load Atomic Decrement: 32 bit %u, 64 bit %lld\n", *p1[4], *p2[4]);
+ printf("Load Atomic Clear: 32 bit %u, 64 bit %lld\n", *p1[5], *p2[5]);
+ printf("Load Atomic Set: 32 bit %u, 64 bit %lld\n", *p1[6], *p2[6]);
+ printf("laa and saa: base1: %u, base2: %u\n", *p1[7], *p1[8]);
+ printf("laad and saad: base1: %lld, base2: %lld\n", *p2[7], *p2[8]);
+ printf("law and saa: base1: %u, base2: %u\n", *p1[9], *p1[10]);
+ printf("lawd and saad: base1: %lld, base2: %lld\n", *p2[9], *p2[10]);
+ printf("lai and saa: base1: %u, base2: %u\n", *p1[11], *p1[12]);
+ printf("laid and saad: base1: %lld, base2: %lld\n", *p2[11], *p2[12]);
+ printf("las and saa: base1: %u, base2: %u\n", *p1[13], *p1[14]);
+ printf("lasd and saad: base1: %lld, base2: %lld\n", *p2[13], *p2[14]);
+ printf("lad and saa: base1: %u, base2: %u\n", *p1[15], *p1[16]);
+ printf("ladd and saad: base1: %lld, base2: %lld\n", *p2[15], *p2[16]);
+ printf("lac and saa: base1: %u, base2: %u\n", *p1[17], *p1[18]);
+ printf("lacd and saad: base1: %lld, base2: %lld\n", *p2[17], *p2[18]);

for (i = 0; i < N; i++) {
if (p1_expd[i] == *p1[i] && p2_expd[i] == *p2[i]) {

Removed: trunk/none/tests/mips64/cvm_atomic_thread.stdout.exp-LE
==============================================================================
--- trunk/none/tests/mips64/cvm_atomic_thread.stdout.exp-LE (original)
+++ trunk/none/tests/mips64/cvm_atomic_thread.stdout.exp-LE (removed)
@@ -1,43 +0,0 @@
-parent, pre-fork
-child
-parent, pre-fork
-parent
-Store Atomic Add: 32 bit 2156643710, 64 bit 12633614303292
-Load Atomic Add: 32 bit 2156643710, 64 bit 12633614303292
-Load Atomic Swap: 32 bit 3456986, 64 bit 3555751
-Load Atomic Increment: 32 bit 6913974, 64 bit 6913974
-Load Atomic Decrement: 32 bit 4288053322, 64 bit -6913974
-Load Atomic Clear: 32 bit 0, 64 bit 0
-Load Atomic Set: 32 bit 4294967295, 64 bit -1
-laa and saa: base1: 6913974, base2: 21777111
-laad and saad: base1: 6913974, base2: 23901514779351
-law and saa: base1: 3456986, base2: 2153186724
-lawd and saad: base1: 3456986, base2: 11950752204196
-lai and saa: base1: 6913974, base2: 21777111
-laid and saad: base1: 6913974, base2: 23901514779351
-las and saa: base1: 4294967295, base2: 4288053323
-lasd and saad: base1: -1, base2: -6913973
-lad and saa: base1: 4288053322, base2: 4273190185
-ladd and saad: base1: -6913974, base2: -23901514779351
-lac and saa: base1: 0, base2: 0
-lacd and saad: base1: 0, base2: 0
-PASS 1
-PASS 2
-PASS 3
-PASS 4
-PASS 5
-PASS 6
-PASS 7
-PASS 8
-PASS 9
-PASS 10
-PASS 11
-PASS 12
-PASS 13
-PASS 14
-PASS 15
-PASS 16
-PASS 17
-PASS 18
-PASS 19
-parent exits

Loading...