Re: Somewhat OT: gcc, x86, -ffast-math, and Linux

From: Jamie Lokier (jamie_at_shareable.org)
Date: 03/27/04

  • Next message: Roman Zippel: "Re: 2.6.4: Oops when mounting HFS on ppc32"
    Date:	Sat, 27 Mar 2004 14:24:59 +0000
    To: Daniel Forrest <forrest@lmcg.wisc.edu>
    
    

    Daniel Forrest wrote:
    > What is the -ffast-math option doing?

    It enables some optimisations and mathematical transformations which
    do not satisfy the properties of IEEE floating point arithmetic.

    (Not that GCC's output satisfies those properties without -ffast-math
    on x86, but this flag enables much looser semantics).

    > How are the excess bits of precision dealt with during context
    > switches?

    They are preserved - they are part of the floating point context.
    If there is any failure to preserve all of that context, it's a kernel bug.

    > Shouldn't the same binary with the same inputs produce the same
    > output on identical hardware?

    Is the hardware *identical*, or are they different x86 CPUs?

    Different CPUs give different results for the trigonometric functions.
    GCC's manual claims that fsin, fcos and fsqrt instructions are only
    used if the -funsafe-math-optimizations flag is also used, if the GCC
    version is >= 2.6.1. However you may find that Glibc's <math.h> ends
    up using those instructions when -ffast-math is used alone.

    -- Jamie
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Roman Zippel: "Re: 2.6.4: Oops when mounting HFS on ppc32"

    Relevant Pages

    • Re: making kmalloc BUG() might not be a good idea
      ... > Making it WARN might be a good compromise. ... I could live with a solution that enables it based on a config. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • 2.4.26-rc1, Dell Poweredge 750, IDE DMA and patch for piix
      ... Here is a diff against 2.4.26-rc1 which enables piix to recognise the ... ICH5: IDE controller at PCI slot 00:1f.2 ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • RE: Visor USB hang
      ... >> button on my cradle. ... mistaken in assuming that my approach actually enables debugging. ... hotplug does not override the manually loaded module parameters. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] 2.6.1 tg3 DMA engine test failure
      ... then the bye enables don't get used or clobber padding. ... If the packet data length is an odd number of bytes, ... and the newer tigon3 chips are going to use a ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [1/7] Xen VMM #3: add ptep_establish_new to make va available
      ... >> having the virtual address available enables a very important ... I'd appreciate a pointer to the patch. ... Ian ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)