box64/tests/test12.c
KreitinnSoftware 549e042e67
[CI] Add Android Tests (#1263)
* [CI] Add Android Tests

* Remove a Build of Box64 that I placed and forgot to remove before

* Fix some tests checking

* Disable Test07 and Test17 for now

* Comment set_tests_proprieties (I have forgotten)

* Add mmx test and benchfloat for Android

* Fix build for Clang-17 on non-Termux

* Update NDK to 26b and add Termux Build/Testing

* Revert to NDK 25b, something is wrong

* Add -DTERMUX=1 to Termux Build

* Add LD_LIBRARY_PATH for Termux Testing

* Set LD_LIBRARY_PATH on QEMU_SET_ENV

* Move data folder to current dir before testing on Termux

* Copy Termux Data Libs for /data

* Try to set QEMU_SET_ENV on GITHUB_ENV

---------

Co-authored-by: Pablo Carlos <pablo@localhost.localdomain>
2024-02-14 09:14:01 +01:00

50 lines
959 B
C

#include <stdio.h>
#include <stdint.h>
#include <math.h>
typedef uint32_t uint32;
typedef uint32 angle_t;
int main(int argc, char **argv)
{
int64_t i64 = 1000000000000;
double d = i64;
printf("%lli => %f\n", i64, d);
i64 = -i64;
d = i64;
printf("%lli => %f\n", i64, d);
d = M_PI/4.0;
d = d*(1<<30)/M_PI;
angle_t u32 = (angle_t)d;
printf("(angle_t)%f = %u == 0x%08X\n", d, u32, u32);
int16_t a=0, b=0;
#ifdef __ANDROID__
asm volatile (
"fldpi \n"
"fisttpl %0 \n"
: "=m" (a));
asm volatile (
"fldpi \n"
"fchs \n"
"fistpl %0 \n"
: "=m" (b));
#else
asm volatile (
"fldpi \n"
"fisttp %0 \n"
: "=m" (a));
asm volatile (
"fldpi \n"
"fchs \n"
"fistp %0 \n"
: "=m" (b));
#endif
printf("go PI trucated=%d, -PI rounded=%d\n", a, b);
return 0;
}