Discussion:
Valgrind: r16393 - in /trunk/none/tests/amd64: Makefile.am fb_test_amd64.c fb_test_amd64.vgtest
(too old to reply)
s***@valgrind.org
2017-05-17 11:06:54 UTC
Permalink
Raw Message
Author: iraisr
Date: Wed May 17 12:06:53 2017
New Revision: 16393

Log:
Fix test fb_test_amd64.
Follow up to r16372.

The test is now built if the compiler understands AVX
instructions. The test is executed if the host speaks AVX
is well. Finally bogus printf format flags were fixed as
they caused the output to be inconsistent on Linux and Solaris.

Modified:
trunk/none/tests/amd64/Makefile.am
trunk/none/tests/amd64/fb_test_amd64.c
trunk/none/tests/amd64/fb_test_amd64.vgtest

Modified: trunk/none/tests/amd64/Makefile.am
==============================================================================
--- trunk/none/tests/amd64/Makefile.am (original)
+++ trunk/none/tests/amd64/Makefile.am Wed May 17 12:06:53 2017
@@ -98,7 +98,6 @@
bug127521-64 bug132813-amd64 bug132918 bug137714-amd64 \
clc \
cmpxchg \
- fb_test_amd64 \
getseg \
$(INSN_TESTS) \
nan80and64 \
@@ -113,6 +112,7 @@
check_PROGRAMS += asorep
endif
if BUILD_AVX_TESTS
+ check_PROGRAMS += fb_test_amd64
if BUILD_VPCLMULQDQ_TESTS
check_PROGRAMS += avx-1
endif

Modified: trunk/none/tests/amd64/fb_test_amd64.c
==============================================================================
--- trunk/none/tests/amd64/fb_test_amd64.c (original)
+++ trunk/none/tests/amd64/fb_test_amd64.c Wed May 17 12:06:53 2017
@@ -362,6 +362,7 @@
printf("\n");
}

+__attribute__((format(__printf__, 1, 2)))
void xxprintf (const char *format, ...)
{
char buf[128];
@@ -947,9 +948,9 @@
la = a;
xxprintf("(float)%f = %f\n", a, fa);
xxprintf("(long double)%f = %Lf\n", a, la);
- xxprintf("a=%016Lx\n", *(long long *)&a);
- xxprintf("la=%016Lx %04x\n", *(long long *)&la,
- *(unsigned short *)((char *)(&la) + 8));
+ xxprintf("a=%016llx\n", *(unsigned long long int *) &a);
+ xxprintf("la=%016llx %04x\n", *(unsigned long long int *) &la,
+ *(unsigned short *) ((char *)(&la) + 8));

/* test all roundings */
asm volatile ("fstcw %0" : "=m" (fpuc));
@@ -963,7 +964,7 @@
asm volatile ("fldcw %0" : : "m" (fpuc));
xxprintf("(short)a = %d\n", wa);
xxprintf("(int)a = %d\n", ia);
- xxprintf("(int64_t)a = %Ld\n", lla);
+ xxprintf("(int64_t)a = %lld\n", lla);
xxprintf("rint(a) = %f\n", ra);
}
}

Modified: trunk/none/tests/amd64/fb_test_amd64.vgtest
==============================================================================
--- trunk/none/tests/amd64/fb_test_amd64.vgtest (original)
+++ trunk/none/tests/amd64/fb_test_amd64.vgtest Wed May 17 12:06:53 2017
@@ -1 +1,2 @@
prog: fb_test_amd64
+prereq: test -x fb_test_amd64 && ../../../tests/x86_amd64_features amd64-avx
Philippe Waroquiers
2017-05-17 21:03:33 UTC
Permalink
Raw Message
Post by s***@valgrind.org
Author: iraisr
Date: Wed May 17 12:06:53 2017
New Revision: 16393
Fix test fb_test_amd64.
Follow up to r16372.
The test is now built if the compiler understands AVX
instructions.
On gcc20 compile farm machine, the test still fails to compile
with the error:
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../../include -I../../../coregrind -I../../../include -I../../../VEX/pub -I../../../VEX/pub -DVGA_amd64=1 -DVGO_linux=1 -DVGP_amd64_linux=1 -DVGPV_amd64_linux_vanilla=1 -DVGA_SEC_x86=1 -DVGP_SEC_amd64_linux=1 -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -m64 -O -fno-strict-aliasing -MT fb_test_amd64-fb_test_amd64.o -MD -MP -MF .deps/fb_test_amd64-fb_test_amd64.Tpo -c -o fb_test_amd64-fb_test_amd64.o `test -f 'fb_test_amd64.c' || echo './'`fb_test_amd64.c
fb_test_amd64.h: Assembler messages:
fb_test_amd64.h:71: Error: no such instruction: `adcxq %r14,%r8'
fb_test_amd64.h:81: Error: no such instruction: `adcxl %r14d,%r8d'
fb_test_amd64.h:71: Error: no such instruction: `adcxq %r14,%r8'
fb_test_amd64.h:81: Error: no such instruction: `adcxl %r14d,%r8d'
fb_test_amd64.h:71: Error: no such instruction: `adoxq %r14,%r8'
fb_test_amd64.h:81: Error: no such instruction: `adoxl %r14d,%r8d'
fb_test_amd64.h:71: Error: no such instruction: `adoxq %r14,%r8'
fb_test_amd64.h:81: Error: no such instruction: `adoxl %r14d,%r8d'
make[5]: *** [fb_test_amd64-fb_test_amd64.o] Error 1

The gcc and as versions are:
gcc (Debian 4.7.2-5) 4.7.2
GNU assembler (GNU Binutils for Debian) 2.22

The config.log effectively sets BUILD_AVX_TESTS to yes, based
on the configure test.

Not too clear to me what are these adcx* instructions, and if they
are supposed to be supported according to the configure test, which
checks vmovupd and vaddpd instructions.

Philippe
Philippe Waroquiers
2017-05-17 21:09:40 UTC
Permalink
Raw Message
Post by Philippe Waroquiers
Not too clear to me what are these adcx* instructions, and if they
are supposed to be supported according to the configure test, which
checks vmovupd and vaddpd instructions.
As I understand, adcx instruction is available if adx extension
is supported.

On my desktop (where the test compile) adx is in /proc/cpuinfo.

But on gcc20, there is no such adx flag.

I imagine we need a specific configure test for BUILD_ADX_TESTS ?

What do you think ?

Thanks

Philippe
Ivo Raisr
2017-05-17 22:40:02 UTC
Permalink
Raw Message
Post by Philippe Waroquiers
Post by Philippe Waroquiers
Not too clear to me what are these adcx* instructions, and if they
are supposed to be supported according to the configure test, which
checks vmovupd and vaddpd instructions.
As I understand, adcx instruction is available if adx extension
is supported.
On my desktop (where the test compile) adx is in /proc/cpuinfo.
But on gcc20, there is no such adx flag.
I imagine we need a specific configure test for BUILD_ADX_TESTS?
What do you think?
Yes, that would be probably the most sane way how to check binutils capabilities
in this case. I will try to make this happen on Thursday; if not then
I am offline whole weekend
with my family.
I.
Philippe Waroquiers
2017-05-20 15:03:16 UTC
Permalink
Raw Message
Post by Ivo Raisr
Post by Philippe Waroquiers
Post by Philippe Waroquiers
Not too clear to me what are these adcx* instructions, and if they
are supposed to be supported according to the configure test, which
checks vmovupd and vaddpd instructions.
As I understand, adcx instruction is available if adx extension
is supported.
On my desktop (where the test compile) adx is in /proc/cpuinfo.
But on gcc20, there is no such adx flag.
I imagine we need a specific configure test for BUILD_ADX_TESTS?
What do you think?
Yes, that would be probably the most sane way how to check binutils capabilities
in this case.
In revision 16401, I committed a change that unbreaks the build on
gcc20 kind of systems (using a BUILD_ADX_TESTS).

Note however that adx capable systems are however reported by V as
being non adx capable.
I guess a cleaner/full fix/full support for adx implies to change
the synthetic cpu hwcaps provided by V (as cpuid reports a non adx
capable system)

Philippe

Loading...