|
Message-ID: <alpine.LRH.2.02.2002231819190.25353@key0.esi.com.au> Date: Sun, 23 Feb 2020 19:35:03 +1100 (AEDT) From: Damian McGuckin <damianm@....com.au> To: musl@...ts.openwall.com Subject: Re: Considering x86-64 fenv.s to C On Sun, 23 Feb 2020, Rich Felker wrote: > On Sun, Feb 23, 2020 at 04:41:31PM +1100, Damian McGuckin wrote: >> On Sat, 22 Feb 2020, Rich Felker wrote: >> >>> First comment: I couldn't find (maybe I missed?) what you intend fore >>> the contents of fenv-generic.c and fenv-trivial.c to be, but I don't >>> see what you want them for. fenv.c should just use the macros/inlines >>> the fenv_arch.h defines, naturally collapsing to empty functions when >>> they do nothing (for softfloat archs). >> >> I agree. I was seduced by what I thought was a better way. >> >> I assume that I can also have a >> >> fenv_arch_soft_float.h > > I don't follow what this would be for. Presumably > arch/generic/fenv_arch.h would be empty and the internal header that > includes fenv_arch.h would define dummy fenv accessor helpers in the > absence of any defined by fenv_arch.h, or similar. In arch/generic/bits/fenv.h You have #define FE_ALL_EXCEPT 0 #define FE_TONEAREST 0 typedef unsigned long fexcept_t; typedef struct { unsigned long __cw; } fenv_t; #define FE_DFL_ENV ((const fenv_t *) -1) If you effectively #include this file into the generic code, it should do as you suggest. I think. See below. It does rely on FE_INVALID not being defined. If I fudge it on my X86_64, every routine just does xorl %eax, %eax i.e. return 0 except for fesetround: .LFB12: .cfi_startproc cmpl $1, %edi sbbl %eax, %eax notl %eax ret fegetexceptflag: .LFB18: .cfi_startproc movq $0, (%rdi) xorl %eax, %eax ret Also __flt_rounds() returns 1 which means round to nearest style which it should. Regards - Damian Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037 Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here Views & opinions here are mine and not those of any past or present employer
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.