diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-06-06 20:32:55 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-06-06 20:32:55 +0200 |
| commit | 489afcfb41e841424ad9bd930702b3ec5b235573 (patch) | |
| tree | 4fffc807a5fd36cd650af700e38ef41841b30152 /tests | |
| parent | 5519ddad0b8042f6cc6a466ef8e76301093c9a9d (diff) | |
| download | box64-489afcfb41e841424ad9bd930702b3ec5b235573.tar.gz box64-489afcfb41e841424ad9bd930702b3ec5b235573.zip | |
Added a test for ucomiss opcode
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref16.txt | 11 | ||||
| -rwxr-xr-x | tests/test16 | bin | 0 -> 16648 bytes | |||
| -rw-r--r-- | tests/test16.c | 55 |
3 files changed, 66 insertions, 0 deletions
diff --git a/tests/ref16.txt b/tests/ref16.txt new file mode 100644 index 00000000..4f5916e0 --- /dev/null +++ b/tests/ref16.txt @@ -0,0 +1,11 @@ +ucomiss 1.000000, 2.000000 => 0x202 +ucomiss 2.000000, 1.000000 => 0x203 +ucomiss 1.000000, inf => 0x202 +ucomiss inf, 1.000000 => 0x203 +ucomiss 1.000000, -inf => 0x203 +ucomiss -inf, 1.000000 => 0x202 +ucomiss 1.000000, nan => 0x247 +ucomiss nan, 1.000000 => 0x247 +ucomiss 1.000000, 1.000000 => 0x242 +ucomiss inf, inf => 0x242 +ucomiss nan, nan => 0x247 diff --git a/tests/test16 b/tests/test16 new file mode 100755 index 00000000..af645769 --- /dev/null +++ b/tests/test16 Binary files differdiff --git a/tests/test16.c b/tests/test16.c new file mode 100644 index 00000000..2b312834 --- /dev/null +++ b/tests/test16.c @@ -0,0 +1,55 @@ +#include <string.h> +#include <stdio.h> +#include <stddef.h> +#include <stdlib.h> +#include <stdint.h> +#include <math.h> + +uint64_t _ucomiss_(float a, float b) +{ + uint64_t ret; + asm volatile ( + "ucomiss %%xmm0, %%xmm1\n" + "pushf\n" + "pop %%rax" + :"=a" (ret)::"xmm0","xmm1","cc"); + + return ret; +} + +int main(int argc, const char** argv) +{ + float a, b; + uint64_t flags; + a = 1.0f; b = 2.0f; + flags = _ucomiss_(a, b); + printf("ucomiss %f, %f => 0x%lx\n", a, b, flags); + flags = _ucomiss_(b, a); + printf("ucomiss %f, %f => 0x%lx\n", b, a, flags); + b = INFINITY; + flags = _ucomiss_(a, b); + printf("ucomiss %f, %f => 0x%lx\n", a, b, flags); + flags = _ucomiss_(b, a); + printf("ucomiss %f, %f => 0x%lx\n", b, a, flags); + b = -INFINITY; + flags = _ucomiss_(a, b); + printf("ucomiss %f, %f => 0x%lx\n", a, b, flags); + flags = _ucomiss_(b, a); + printf("ucomiss %f, %f => 0x%lx\n", b, a, flags); + b = NAN; + flags = _ucomiss_(a, b); + printf("ucomiss %f, %f => 0x%lx\n", a, b, flags); + flags = _ucomiss_(b, a); + printf("ucomiss %f, %f => 0x%lx\n", b, a, flags); + b = a; + flags = _ucomiss_(a, b); + printf("ucomiss %f, %f => 0x%lx\n", a, b, flags); + a = b = INFINITY; + flags = _ucomiss_(a, b); + printf("ucomiss %f, %f => 0x%lx\n", a, b, flags); + a = b = NAN; + flags = _ucomiss_(a, b); + printf("ucomiss %f, %f => 0x%lx\n", a, b, flags); + + return 0; +} |