Skip to content

Commit

Permalink
Long double test
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Oct 25, 2023
1 parent 217e85e commit c696b0f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BINUTILS_BRANCH=${BINUTILS_BRANCH:-woarm64}
BINUTILS_VERSION=binutils-master

GCC_REPO=https://github.com/ZacWalk/gcc-woarm64.git
GCC_BRANCH=${GCC_BRANCH:-woarm64}
GCC_BRANCH=${GCC_BRANCH:-long-double}
# GCC_VERSION=gcc-12.2.0
GCC_VERSION=gcc-master

Expand All @@ -32,7 +32,7 @@ MSYS2_CONFIG=1
TARGET=$TARGET_ARCH-w64-mingw32
# TARGET=$TARGET_ARCH-pc-cygwin
BUILD_DIR=build-$TARGET
PARALLEL_MAKE=-j6
PARALLEL_MAKE=-j$(nproc)
MPFR_VERSION=mpfr-4.1.0
GMP_VERSION=gmp-6.2.1
MPC_VERSION=mpc-1.2.1
Expand Down
19 changes: 9 additions & 10 deletions tests/build-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ rm *.s *.dump *.gkd *.exe *.dll *.log

~/cross/bin/aarch64-w64-mingw32-g++ -S test-bigdata.cpp -o test-bigdata.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-g++ -S test-throw.cpp -o test-throw.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-g++ -S test-iostream.cpp -o test-iostream.cpp.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-g++ -S test-iostream.cpp -o test-iostream.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-gcc -S test-math.c -o test-math.c.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-gcc -S test-pdata.c -o test-pdata.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-gcc -S test-struct.c -o test-struct.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-gcc -S test-pdata.c -o test-pdata.c.s -fdump-final-insns
~/cross/bin/aarch64-w64-mingw32-gcc -S test-struct.c -o test-struct.c.s -fdump-final-insns

~/cross/bin/aarch64-w64-mingw32-g++ -g test-bigdata.cpp -o test-bigdata.exe >> test-bigdata.log
~/cross/bin/aarch64-w64-mingw32-g++ -g test-throw.cpp -o test-throw.exe >> test-throw.log
~/cross/bin/aarch64-w64-mingw32-g++ -g test-iostream.cpp -o test-iostream.exe >> test-iostream.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-math.c -o test-math.c.exe >> test-math.c.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-pdata.c -ldbghelp -o test-pdata.exe >> test-pdata.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-struct.c -o test-struct.exe >> test-struct.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-math.c -o test-math.exe >> test-math.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-varargs.c -o test-varargs.exe >> test-varargs.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-sjlj.c -o test-sjlj.exe >> test-sjlj.log
~/cross/bin/aarch64-w64-mingw32-gcc -g -fopenmp test-omp.c -o test-omp.exe >> test-omp.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-pdata.c -ldbghelp -o test-pdata.c.exe >> test-pdata.c.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-struct.c -o test-struct.c.exe >> test-struct.c.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-varargs.c -o test-varargs.c.exe >> test-varargs.c.log
~/cross/bin/aarch64-w64-mingw32-gcc -g test-sjlj.c -o test-sjlj.c.exe >> test-sjlj.c.log
~/cross/bin/aarch64-w64-mingw32-gcc -g -fopenmp test-omp.c -o test-omp.c.exe >> test-omp.c.log

#
# DLL examples
Expand All @@ -38,6 +37,6 @@ rm *.s *.dump *.gkd *.exe *.dll *.log
~/cross/bin/aarch64-w64-mingw32-objdump -dr test-throw.exe >> test-throw.dump
~/cross/bin/aarch64-w64-mingw32-objdump -dr test-dll-auto.exe >> test-dll-auto.dump
~/cross/bin/aarch64-w64-mingw32-objdump -dr test-dll-export.exe >> test-dll-export.dump
~/cross/bin/aarch64-w64-mingw32-objdump -dr test-struct.exe >> test-struct.dump
~/cross/bin/aarch64-w64-mingw32-objdump -dr test-struct.c.exe >> test-struct.c.dump


29 changes: 26 additions & 3 deletions tests/test-math.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ _Float128 baz (_Float128 x)
}


// Source: https://cpufun.substack.com/p/portable-support-for-128b-floats
#define M_EF128 2.718281828459045235360287471352662498F128
#define M_EQ 2.718281828459045235360287471352662498Q

int main()
{
foo (1.2Q);
Expand All @@ -33,6 +37,25 @@ int main()
bar (1.2Q);
baz (1.2Q);

printf("ok\n");
return 0;
}
//int strfromf128(char * restrict s, size_t n,
// const char * restrict format, _Float128 fp);

//_Float128 strtof128(const char * restrict nptr,
// char ** restrict endptr);

_Float128 f = M_EF128;
long double ld = M_EQ;
printf ("_Float128 %%qg => %qg\n", f);
printf ("_Float128 %%Qg => %Qg\n", f);
printf ("_Float128 %%Lg => %Lg\n", f);
printf ("long double %%qg => %qg\n", ld);
printf ("long double %%Qg => %Qg\n", ld);
printf ("long double %%Lg => %Lg\n", ld);

assert (sizeof(_Float128) == 16);
assert (sizeof(long double) == 8);
assert (sizeof(double) == 8);

printf ("ok\n");
return 0;
}

0 comments on commit c696b0f

Please sign in to comment.