mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
Add regtest for #132918 (amd64 fprem).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6046
This commit is contained in:
parent
72fd1887c4
commit
12affe3595
@ -8,6 +8,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
|
||||
bug127521-64.vgtest bug127521-64.stdout.exp bug127521-64.stderr.exp \
|
||||
bug132813-amd64.vgtest bug132813-amd64.stdout.exp \
|
||||
bug132813-amd64.stderr.exp \
|
||||
bug132918.vgtest bug132918.stderr.exp bug132918.stdout.exp \
|
||||
clc.vgtest clc.stdout.exp clc.stderr.exp \
|
||||
faultstatus.disabled faultstatus.stderr.exp \
|
||||
fcmovnu.vgtest fcmovnu.stderr.exp fcmovnu.stdout.exp \
|
||||
@ -24,7 +25,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
|
||||
|
||||
|
||||
check_PROGRAMS = \
|
||||
bug127521-64 bug132813-amd64 \
|
||||
bug127521-64 bug132813-amd64 bug132918 \
|
||||
clc \
|
||||
faultstatus fcmovnu fxtract $(INSN_TESTS) looper jrcxz smc1 shrld \
|
||||
nibz_bennee_mmap
|
||||
@ -34,6 +35,7 @@ AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include
|
||||
AM_CXXFLAGS = $(AM_CFLAGS)
|
||||
|
||||
# generic C ones
|
||||
bug132918_LDADD = -lm
|
||||
insn_basic_SOURCES = insn_basic.def
|
||||
insn_basic_LDADD = -lm
|
||||
insn_mmx_SOURCES = insn_mmx.def
|
||||
|
||||
55
none/tests/amd64/bug132918.c
Normal file
55
none/tests/amd64/bug132918.c
Normal file
@ -0,0 +1,55 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef unsigned long long int ULong;
|
||||
|
||||
typedef
|
||||
struct { double d; int i; } Res;
|
||||
|
||||
static void do_fprem ( Res* res, double x, double y )
|
||||
{
|
||||
ULong c3210;
|
||||
double f64;
|
||||
double xx = x;
|
||||
double yy = y;
|
||||
__asm__ __volatile__(
|
||||
"finit\n\t"
|
||||
"fldl %2\n\t"
|
||||
"fldl %3\n\t"
|
||||
"fprem\n\t"
|
||||
"fstpl %1\n\t"
|
||||
"movq %%rax,%%r15\n\t"
|
||||
"xorq %%rax,%%rax\n\t"
|
||||
"fnstsw %%ax\n\t"
|
||||
"movq %%rax,%0\n\t"
|
||||
"movq %%r15,%%rax"
|
||||
: /*out*/ "=r" (c3210)
|
||||
: /*in*/ "m" (f64), "m" (xx), "m" (yy)
|
||||
: /*trash*/ "r15", "rax", "%st", "%st(1)", "cc"
|
||||
);
|
||||
res->d = f64;
|
||||
res->i = (int)(c3210 & 0x4700); /* mask for C3,2,1,0 */
|
||||
}
|
||||
|
||||
static void show ( char* s, Res* res )
|
||||
{
|
||||
printf("%s -> 0x%04x %f\n", s, (int)res->i, (double)res->d);
|
||||
}
|
||||
|
||||
int main ( void )
|
||||
{
|
||||
Res r;
|
||||
int i;
|
||||
double theta;
|
||||
|
||||
do_fprem(&r, 10.1, 200.2); show("xx1", &r);
|
||||
do_fprem(&r, 20.3, 1.44); show("xx2", &r);
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
theta = (2.0 * 3.14159) / 10.0 * (double)i;
|
||||
do_fprem(&r, 12.3*sin(theta), cos(theta)); show("xx", &r);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
2
none/tests/amd64/bug132918.stderr.exp
Normal file
2
none/tests/amd64/bug132918.stderr.exp
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
22
none/tests/amd64/bug132918.stdout.exp
Normal file
22
none/tests/amd64/bug132918.stdout.exp
Normal file
@ -0,0 +1,22 @@
|
||||
xx1 -> 0x4200 8.300000
|
||||
xx2 -> 0x0000 1.440000
|
||||
xx -> 0x0000 nan
|
||||
xx -> 0x0000 0.809017
|
||||
xx -> 0x0000 0.309018
|
||||
xx -> 0x0000 -0.309015
|
||||
xx -> 0x0000 -0.809016
|
||||
xx -> 0x4100 -0.000002
|
||||
xx -> 0x0000 -0.809019
|
||||
xx -> 0x0000 -0.309021
|
||||
xx -> 0x0000 0.309013
|
||||
xx -> 0x0000 0.809014
|
||||
xx -> 0x4300 0.000002
|
||||
xx -> 0x0000 0.809020
|
||||
xx -> 0x0000 0.309023
|
||||
xx -> 0x0000 -0.309010
|
||||
xx -> 0x0000 -0.809013
|
||||
xx -> 0x0100 -0.000067
|
||||
xx -> 0x0000 -0.809022
|
||||
xx -> 0x0000 -0.309026
|
||||
xx -> 0x0000 0.309008
|
||||
xx -> 0x0000 0.809011
|
||||
1
none/tests/amd64/bug132918.vgtest
Normal file
1
none/tests/amd64/bug132918.vgtest
Normal file
@ -0,0 +1 @@
|
||||
prog: bug132918
|
||||
Loading…
x
Reference in New Issue
Block a user