• Re: Saving and restoring FP state

    From Andy Valencia@vandys@vsta.org to comp.arch on Mon Sep 22 07:33:53 2025
    From Newsgroup: comp.arch

    BGB <cr88192@gmail.com> writes:
    Why on earth would you use floating point instructions
    in an interrupt handler?
    I didn't go and track down which code was using FPU instructions, but seemingly something was,

    I believe I noted once before that I had to guide a driver developer for
    HP/UX away from using floating point for his driver's event counters. His reason for their use? They can count to bigger numbers.

    Andy Valencia
    Home page: https://www.vsta.org/andy/
    To contact me: https://www.vsta.org/contact/andy.html
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Terje Mathisen@terje.mathisen@tmsw.no to comp.arch on Mon Sep 22 17:05:45 2025
    From Newsgroup: comp.arch

    Andy Valencia wrote:
    BGB <cr88192@gmail.com> writes:
    Why on earth would you use floating point instructions
    in an interrupt handler?
    I didn't go and track down which code was using FPU instructions, but
    seemingly something was,

    I believe I noted once before that I had to guide a driver developer for HP/UX away from using floating point for his driver's event counters. His reason for their use? They can count to bigger numbers.

    Did you ask him what happened after the counter passed 2^53 and he added
    1.0 to the counter? With RNE that's a NOP...

    Using 64-bit counters are far better, even on a 32-bit CPU, even if you
    then need thread-safe/atomic code sequences.

    Terje
    --
    - <Terje.Mathisen at tmsw.no>
    "almost all programming can be viewed as an exercise in caching"
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Michael S@already5chosen@yahoo.com to comp.arch on Mon Sep 22 18:17:05 2025
    From Newsgroup: comp.arch

    On Mon, 22 Sep 2025 17:05:45 +0200
    Terje Mathisen <terje.mathisen@tmsw.no> wrote:

    Andy Valencia wrote:
    BGB <cr88192@gmail.com> writes:
    Why on earth would you use floating point instructions
    in an interrupt handler?
    I didn't go and track down which code was using FPU instructions,
    but seemingly something was,

    I believe I noted once before that I had to guide a driver
    developer for HP/UX away from using floating point for his driver's
    event counters. His reason for their use? They can count to
    bigger numbers.

    Did you ask him what happened after the counter passed 2^53 and he
    added 1.0 to the counter? With RNE that's a NOP...

    Using 64-bit counters are far better, even on a 32-bit CPU, even if
    you then need thread-safe/atomic code sequences.

    Terje



    Since the counter is in memory, using FP does not help thread safety.
    As to 2**53, that's enough for most things. At least for counting
    events that do not happen more often than few millions times per
    second.


    --- Synchronet 3.21a-Linux NewsLink 1.2