Re: Calling conventions (particularly 32-bit ARM)

Liste des GroupesRevenir à c arch 
Sujet : Re: Calling conventions (particularly 32-bit ARM)
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.arch
Date : 14. Jan 2025, 16:50:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vm6142$2fgsg$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
On 14/01/2025 15:39, Scott Lurndal wrote:
David Brown <david.brown@hesbynett.no> writes:
On 13/01/2025 23:40, Scott Lurndal wrote:
mitchalsup@aol.com (MitchAlsup1) writes:
On Mon, 13 Jan 2025 21:53:55 +0000, Scott Lurndal wrote:
>
mitchalsup@aol.com (MitchAlsup1) writes:
On Mon, 13 Jan 2025 18:02:10 +0000, Thomas Koenig wrote:
>
MitchAlsup1 <mitchalsup@aol.com> schrieb:
>
errno is an atrocity all by itself; single handedly preventing
direct use of SIN(), COS(), TAN(), ATAN(), exp(), ln(), pow()
as instructions.
>
Fortunately, the C standard does not require errno to be set
for these functions.  Apple, for example, does not do so.
>
Nor will I.
>
POSIX does, however, require errno to be set conditionally
based on an application global variable 'math_errhandling'.
>
The functions mentioned have the property of taking x as
any IEEE 754 number (including NaNs, infinities, denorms)
and produce a IEEE 754 number {NaNs, infinities, norms,
denorms}.
>
But if POSIX wants to spend as many cycles setting errno
as performing the calculation, that is for POSIX to decide.
>
POSIX leaves it up to the programmer to decide.  If the
programmer desires EDOM or ERANGE, they set the
appropriate bit in math_errhandling before calling the
sin et alia functions.
>
>
You know POSIX better than I do, but AFAIK "math_errhandling" is a fixed
value set by the implementation, usually as a macro.  Certainly with a
quick check with gcc on Linux, I could not set the bits in math_errhandling.
>
 Yes, the programmer in this case would instruct the compiler what
the value of math_errhandling should be, e.g. with --ffast-math.
 https://gcc.gnu.org/wiki/FloatingPointMath
I would say the key flag here is "-fno-math-errno" (which is included in -ffast-math).  While I personally think most floating point code could be used just as well with "-ffast-math", and it is certainly appropriate for my own code, others have significantly different opinions or experiences.  (That's fair enough.)  That one flag simply disables setting errno in maths functions that can (reasonably) be implemented inline as instructions, without affecting the results of any other floating point operations.
But to my mind, this is /not/ a case of the POSIX programmer making the choice - it is an implementation-specific feature.  A C compiler might choose to always use errno, or never, or have some other control of the use of errno.  When you write "POSIX leaves it up to the programmer", I take that to mean POSIX specifies a function that lets you change the value of "math_errhandling".  That is quite different from saying "gcc has a flag that lets you choose".
(For my own use, I like the flag - I don't write POSIX code, I have never had any use for errno, and I want the compiler to generate as few instructions as it possibly can.)

Date Sujet#  Auteur
6 Jan 25 * Calling conventions (particularly 32-bit ARM)81David Brown
6 Jan 25 +* Re: Calling conventions (particularly 32-bit ARM)2Theo
7 Jan 25 i`- Re: Calling conventions (particularly 32-bit ARM)1David Brown
6 Jan 25 +* Re: Calling conventions (particularly 32-bit ARM)8Anton Ertl
6 Jan 25 i+* Re: Calling conventions (particularly 32-bit ARM)6MitchAlsup1
7 Jan 25 ii`* Re: Calling conventions (particularly 32-bit ARM)5David Brown
8 Jan 25 ii `* Re: Calling conventions (particularly 32-bit ARM)4MitchAlsup1
8 Jan 25 ii  +* Re: Calling conventions (particularly 32-bit ARM)2Chris M. Thomasson
8 Jan 25 ii  i`- Re: Calling conventions (particularly 32-bit ARM)1Chris M. Thomasson
8 Jan 25 ii  `- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
7 Jan 25 i`- Re: Calling conventions (particularly 32-bit ARM)1David Brown
6 Jan 25 `* Re: Calling conventions (particularly 32-bit ARM)70MitchAlsup1
7 Jan 25  +* Re: Calling conventions (particularly 32-bit ARM)18Waldek Hebisch
7 Jan 25  i+- Re: Calling conventions (particularly 32-bit ARM)1Lawrence D'Oliveiro
12 Jan 25  i`* Re: Calling conventions (particularly 32-bit ARM)16Stephen Fuld
12 Jan 25  i +- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
13 Jan 25  i +* Re: Calling conventions (particularly 32-bit ARM)11Waldek Hebisch
14 Jan 25  i i`* Re: Calling conventions (particularly 32-bit ARM)10Stephen Fuld
14 Jan 25  i i `* Re: Calling conventions (particularly 32-bit ARM)9Terje Mathisen
14 Jan 25  i i  `* Re: Calling conventions (particularly 32-bit ARM)8Michael S
15 Jan 25  i i   `* Re: Calling conventions (particularly 32-bit ARM)7MitchAlsup1
15 Jan 25  i i    +* Re: Calling conventions (particularly 32-bit ARM)3John Levine
15 Jan 25  i i    i`* Re: Calling conventions (particularly 32-bit ARM)2MitchAlsup1
15 Jan 25  i i    i `- Re: Calling conventions (particularly 32-bit ARM)1John Levine
16 Jan 25  i i    `* Re: Calling conventions (particularly 32-bit ARM)3Waldek Hebisch
16 Jan 25  i i     `* Re: Calling conventions (particularly 32-bit ARM)2MitchAlsup1
16 Jan 25  i i      `- Re: Calling conventions (particularly 32-bit ARM)1Waldek Hebisch
13 Jan 25  i `* Re: Calling conventions (particularly 32-bit ARM)3Thomas Koenig
14 Jan 25  i  `* Re: Calling conventions (particularly 32-bit ARM)2Thomas Koenig
14 Jan 25  i   `- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
7 Jan 25  +* Re: Calling conventions (particularly 32-bit ARM)6George Neuner
8 Jan 25  i+* Re: Calling conventions (particularly 32-bit ARM)3Stefan Monnier
9 Jan 25  ii`* Re: Calling conventions (particularly 32-bit ARM)2Anton Ertl
13 Jan 25  ii `- Re: Calling conventions (particularly 32-bit ARM)1Stefan Monnier
28 Jan 25  i`* Re: Calling conventions (particularly 32-bit ARM)2Tim Rentsch
29 Jan 25  i `- Re: Calling conventions (particularly 32-bit ARM)1George Neuner
8 Jan 25  `* Re: Calling conventions (particularly 32-bit ARM)45Stefan Monnier
8 Jan 25   +- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
8 Jan 25   `* Re: Calling conventions (particularly 32-bit ARM)43Anton Ertl
9 Jan 25    `* Re: Calling conventions (particularly 32-bit ARM)42Stefan Monnier
9 Jan 25     +- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
9 Jan 25     `* Re: Calling conventions (particularly 32-bit ARM)40Anton Ertl
9 Jan 25      +* Re: Calling conventions (particularly 32-bit ARM)2Thomas Koenig
10 Jan 25      i`- Re: Calling conventions (particularly 32-bit ARM)1Anton Ertl
9 Jan 25      +* Re: Calling conventions (particularly 32-bit ARM)4MitchAlsup1
9 Jan 25      i`* Re: Calling conventions (particularly 32-bit ARM)3Thomas Koenig
10 Jan 25      i `* Re: Calling conventions (particularly 32-bit ARM)2MitchAlsup1
10 Jan 25      i  `- Re: Calling conventions (particularly 32-bit ARM)1Thomas Koenig
10 Jan 25      +* Re: Calling conventions (particularly 32-bit ARM)29Waldek Hebisch
10 Jan 25      i`* Re: Calling conventions (particularly 32-bit ARM)28Anton Ertl
10 Jan 25      i +- Re: Calling conventions (particularly 32-bit ARM)1John Levine
13 Jan 25      i `* Re: Calling conventions (particularly 32-bit ARM)26MitchAlsup1
13 Jan 25      i  `* Re: Calling conventions (particularly 32-bit ARM)25Thomas Koenig
13 Jan 25      i   `* Re: Calling conventions (particularly 32-bit ARM)24MitchAlsup1
13 Jan 25      i    +* Re: Calling conventions (particularly 32-bit ARM)22MitchAlsup1
14 Jan 25      i    i+* Re: Calling conventions (particularly 32-bit ARM)17MitchAlsup1
14 Jan 25      i    ii+- Re: Calling conventions (particularly 32-bit ARM)1David Brown
14 Jan 25      i    ii+* Re: Calling conventions (particularly 32-bit ARM)2Michael S
14 Jan 25      i    iii`- Re: Calling conventions (particularly 32-bit ARM)1Anton Ertl
14 Jan 25      i    ii+- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
14 Jan 25      i    ii`* Re: Calling conventions (particularly 32-bit ARM)12Thomas Koenig
14 Jan 25      i    ii +* Re: Calling conventions (particularly 32-bit ARM)7Terje Mathisen
14 Jan 25      i    ii i+- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
14 Jan 25      i    ii i+* Re: Calling conventions (particularly 32-bit ARM)4Thomas Koenig
15 Jan 25      i    ii ii`* Re: Calling conventions (particularly 32-bit ARM)3Keith Thompson
15 Jan 25      i    ii ii +- Re: Calling conventions (particularly 32-bit ARM)1Keith Thompson
15 Jan 25      i    ii ii `- Re: Calling conventions (particularly 32-bit ARM)1Keith Thompson
14 Jan 25      i    ii i`- Re: Calling conventions (particularly 32-bit ARM)1Michael S
14 Jan 25      i    ii +- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
14 Jan 25      i    ii `* Re: Calling conventions (particularly 32-bit ARM)3Thomas Koenig
14 Jan 25      i    ii  `* Re: Calling conventions (particularly 32-bit ARM)2Michael S
15 Jan 25      i    ii   `- Re: Calling conventions (particularly 32-bit ARM)1MitchAlsup1
14 Jan 25      i    i+- Re: Calling conventions (particularly 32-bit ARM)1Thomas Koenig
14 Jan 25      i    i`* Re: Calling conventions (particularly 32-bit ARM)3David Brown
14 Jan 25      i    i `* Re: Calling conventions (particularly 32-bit ARM)2David Brown
15 Jan 25      i    i  `- Re: Calling conventions (particularly 32-bit ARM)1Keith Thompson
14 Jan 25      i    `- Re: Calling conventions (particularly 32-bit ARM)1Keith Thompson
10 Jan 25      `* Re: Calling conventions (particularly 32-bit ARM)4David Brown
10 Jan 25       +* Re: Calling conventions (particularly 32-bit ARM)2Thomas Koenig
12 Jan 25       i`- Re: Calling conventions (particularly 32-bit ARM)1David Brown
12 Jan 25       `- Re: Calling conventions (particularly 32-bit ARM)1David Brown

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal