Just for giggles I am doing some testing on a bare bones old pentium box
which has dual pentium II processors in it[1]. Still running. Felt that
I would try to use emulated floating point on it with the new __float128
data type options ( or __Float128 etc ) and see what would happen.
Page https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/x86-Options.html says
I can switch off nearly every processor option extension and I was told:
gcc: error: unrecognized command line option '-mno-clfushopt'; did
you mean '-mno-clflushopt'?
yep .. I did.
Just a spelling error there for "-mclfushopt".
Those options seem to be accepted too :
deb_i586$ gcc --version
gcc (Debian 7.3.0-3) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
deb_i586$ /usr/bin/gcc -m32 -g -march=i386 -mno-fancy-math-387
-mno-80387 -mno-fp-ret-in-387 -mno-align-double -m128bit-long-double
-mlong-double-128 -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3
-mno-sse4 -mno-sse4a -mno-sse4.1 -mno-sse4.2 -mno-avx -mno-avx2
-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl
-mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi -mno-sha
-mno-aes -mno-pclmul -mno-clflushopt -mno-fsgsbase -mno-rdrnd -mno-f16c
-mno-fma -mno-fma4 -mno-prefetchwt1 -mno-xop -mno-lwp -mno-3dnow
-mno-3dnowa -mno-popcnt -mno-abm -mno-bmi -mno-bmi2 -mno-lzcnt -mno-fxsr
-mno-xsave -mno-xsaveopt -mno-xsavec -mno-xsaves -mno-rtm -mno-tbm
-mno-mpx -mno-mwaitx -mno-clzero -mno-pku -std=iso9899:1999
-Wfatal-errors -pedantic-errors -Wl,-rpath=/usr/local/lib -o sinl sinl.c
-lm
deb_i586$
However the actual math results are a mess if I try :
long double theta, neg_pi, pi, pi2, approx_pi, ld_error;
/* 128-bit floating point has at most 38 digits
* of reasonable precision. We should be able to
* load in a constant value for pi using :
*
* 3.1415926535 8979323846 2643383279
* 5028841971 6939937510
*
* The result should be a 16-byte big endian machines
* representation in memory thus :
*
* 40 00 92 1f b5 44 42 d1 8469 89 8c c5 17 01 b8
*
* We can try to load in some constants and hope we get
* a fully reasonable in memory value.
*/
printf ( "Our pi constant was \n" );
printf ( " 3.1415926535897932384626433832795028841971693993751L" );
printf ( "\n\n" );
printf ( "---------+---------+---------+---------+---------+\n" );
pi = 3.1415926535897932384626433832795028841971693993751L;
neg_pi = -3.1415926535897932384626433832795028841971693993751L;
pi2 = 6.2831853071795864769252867665590057683943387987502L;
printf ( "sizeof(long double) = %2i\n", sizeof(long double) );
printf ( " pi may be %+40.38Lf\n", pi );
printf ( "sinl(pi) may be %+40.38Lf\n", sinl(pi) );
approx_pi = (long double) 4.0 * atanl( (long double) 1.0 );
printf ( " approx_pi = %+40.38Lf\n", approx_pi );
ld_error = 3.1415926535897932384626433832795028841971693993751L
- approx_pi;
printf ( " ld_error = %+40.38Lf\n\n", ld_error );
results in :
deb_i586$ ./sinl
Our pi constant was
3.1415926535897932384626433832795028841971693993751L
---------+---------+---------+---------+---------+
sizeof(long double) = 16
pi may be +0.00000000000000000000000000000000000000
sinl(pi) may be +nan
approx_pi = +nan
ld_error = -0.00000000000000000000000000000000000000
.
.
.
.. as well as a truely awesome mess of digits and just really borked
up results if I try anything else "fancy" like sinl(). Not surprised.
Dennis
[1] deb_i586$ cat /proc/version
Linux version 4.15.9-genunix (dclarke@phobos) (gcc version 7.3.0 (Debian
7.3.0-3)) #2 SMP Mon Mar 12 03:12:50 GMT 2018
deb_i586$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 5
model name : Pentium II (Deschutes)
stepping : 2
microcode : 0x2a
cpu MHz : 399.012
cache size : 512 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pse36 mmx fxsr cpuid
bugs : cpu_meltdown spectre_v1 spectre_v2
bogomips : 798.02
clflush size : 32
cache_alignment : 32
address sizes : 36 bits physical, 32 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 5
model name : Pentium II (Deschutes)
stepping : 2
microcode : 0x2a
cpu MHz : 399.012
cache size : 512 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pse36 mmx fxsr cpuid
bugs : cpu_meltdown spectre_v1 spectre_v2
bogomips : 797.87
clflush size : 32
cache_alignment : 32
address sizes : 36 bits physical, 32 bits virtual
power management: