build: Compile with -ffloat-store on x86 (32 bit)

GCC's manpage says that this flag does the following:

  Do not store floating-point variables in registers, and inhibit other
  options that might change whether a floating-point value is taken from
  a register or memory.

  This option prevents undesirable excess precision on machines such as
  the 68000 where the floating registers (of the 68881) keep more
  precision than a "double" is supposed to have.  Similarly for the x86
  architecture.  For most programs, the excess precision does only good,
  but a few programs rely on the precise definition of IEEE floating
  point.

We rely on this behaviour in our fork of clutter. When performing
floating point computations on x86, we are getting the wrong results
because of this architecture's use of the CPU's extended (x87, non-IEEE
confirming) precision by default. If we enable `-ffloat-store` here,
then we'll get the same results everywhere by storing into variables
instead of registers. This does not remove the need to be correct when
handling floats, but it does mean we don't need to be more correct than
the IEEE spec requires.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/785
This commit is contained in:
Iain Lane 2019-09-09 10:17:22 +01:00 committed by Jonas Ådahl
parent 7a0340c57d
commit d7d2612218

View File

@ -286,6 +286,9 @@ foreach function : required_functions
endif endif
endforeach endforeach
if host_machine.cpu_family() == 'x86'
add_project_arguments('-ffloat-store', language: 'c')
endif
add_project_arguments('-D_GNU_SOURCE', language: 'c') add_project_arguments('-D_GNU_SOURCE', language: 'c')
buildtype = get_option('buildtype') buildtype = get_option('buildtype')