]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Test for the x87 'tst' instruction. In the wrong place unfortunately.
authorJulian Seward <jseward@acm.org>
Sat, 19 Mar 2005 14:25:49 +0000 (14:25 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 19 Mar 2005 14:25:49 +0000 (14:25 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@1055

VEX/x87tst.c [new file with mode: 0644]

diff --git a/VEX/x87tst.c b/VEX/x87tst.c
new file mode 100644 (file)
index 0000000..d079477
--- /dev/null
@@ -0,0 +1,27 @@
+
+#include <stdio.h>
+#include <math.h>
+
+double d;
+int i;
+
+extern void do_tst ( void );
+
+asm(
+"\n"
+"do_tst:\n"
+"\txorl %eax,%eax\n"
+"\tfld d\n"
+"\tftst\n"
+"\tfnstsw %ax\n"
+"\tmovl %eax, i\n"
+"\tret\n"
+);
+
+int main ( void )
+{
+   d = -1.23; do_tst(); printf("%f -> 0x%x\n", d, i );
+   d = 0.0;   do_tst(); printf("%f -> 0x%x\n", d, i );
+   d = 9.87;  do_tst(); printf("%f -> 0x%x\n", d, i );
+   return 0;
+}