Re: [PATCH] D20457: Update -ffast-math documentation to match reality.

2016-05-20 Thread Justin Lebar via cfe-commits
jlebar marked 2 inline comments as done.
jlebar added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D20457



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20457: Update -ffast-math documentation to match reality.

2016-05-20 Thread Justin Lebar via cfe-commits
jlebar added a comment.

Thank you for the review!


http://reviews.llvm.org/D20457



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20457: Update -ffast-math documentation to match reality.

2016-05-20 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270279: Update -ffast-math documentation to match reality. 
(authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D20457?vs=57958=57995#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20457

Files:
  cfe/trunk/docs/UsersManual.rst
  cfe/trunk/include/clang/Basic/LangOptions.def
  cfe/trunk/include/clang/Driver/Options.td

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -592,9 +592,7 @@
 def : Flag<["-"], "fno-extended-identifiers">, Group, 
Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
-  HelpText<"Enable the *frontend*'s 'fast-math' mode. This has no effect on "
-   "optimizations, but provides a preprocessor macro __FAST_MATH__ the 
"
-   "same as GCC's -ffast-math flag">;
+  HelpText<"Allow aggressive, lossy floating-point optimizations">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
 def fmath_errno : Flag<["-"], "fmath-errno">, Group, 
Flags<[CC1Option]>,
   HelpText<"Require math functions to indicate errors by setting errno">;
Index: cfe/trunk/include/clang/Basic/LangOptions.def
===
--- cfe/trunk/include/clang/Basic/LangOptions.def
+++ cfe/trunk/include/clang/Basic/LangOptions.def
@@ -162,7 +162,7 @@
 COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
 COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined macro")
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined macro")
+COMPATIBLE_LANGOPT(FastMath  , 1, 0, "fast FP math optimizations, and 
__FAST_MATH__ predefined macro")
 COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__ predefined 
macro")
 COMPATIBLE_LANGOPT(UnsafeFPMath  , 1, 0, "Unsafe Floating Point Math")
 
Index: cfe/trunk/docs/UsersManual.rst
===
--- cfe/trunk/docs/UsersManual.rst
+++ cfe/trunk/docs/UsersManual.rst
@@ -1055,6 +1055,19 @@
the behavior of sanitizers in the ``cfi`` group to allow checking
of cross-DSO virtual and indirect calls.
 
+.. option:: -ffast-math
+
+   Enable fast-math mode. This defines the ``__FAST_MATH__`` preprocessor
+   macro, and lets the compiler make aggressive, potentially-lossy assumptions
+   about floating-point math.  These include:
+
+   * Floating-point math obeys regular algebraic rules for real numbers (e.g.
+ ``+`` and ``*`` are associative, ``x/y == x * (1/y)``, and
+ ``(a + b) * c == a * c + b * c``),
+   * operands to floating-point operations are not equal to ``NaN`` and
+ ``Inf``, and
+   * ``+0`` and ``-0`` are interchangeable.
+
 .. option:: -fwhole-program-vtables
 
Enable whole-program vtable optimizations, such as single-implementation


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -592,9 +592,7 @@
 def : Flag<["-"], "fno-extended-identifiers">, Group, Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
-  HelpText<"Enable the *frontend*'s 'fast-math' mode. This has no effect on "
-   "optimizations, but provides a preprocessor macro __FAST_MATH__ the "
-   "same as GCC's -ffast-math flag">;
+  HelpText<"Allow aggressive, lossy floating-point optimizations">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
 def fmath_errno : Flag<["-"], "fmath-errno">, Group, Flags<[CC1Option]>,
   HelpText<"Require math functions to indicate errors by setting errno">;
Index: cfe/trunk/include/clang/Basic/LangOptions.def
===
--- cfe/trunk/include/clang/Basic/LangOptions.def
+++ cfe/trunk/include/clang/Basic/LangOptions.def
@@ -162,7 +162,7 @@
 COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
 COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined macro")
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined macro")
+COMPATIBLE_LANGOPT(FastMath  , 1, 0, "fast FP math optimizations, and __FAST_MATH__ predefined macro")
 COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
 COMPATIBLE_LANGOPT(UnsafeFPMath  , 1, 0, "Unsafe Floating Point Math")
 
Index: cfe/trunk/docs/UsersManual.rst

Re: [PATCH] D20457: Update -ffast-math documentation to match reality.

2016-05-20 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
This revision is now accepted and ready to land.


Comment at: docs/UsersManual.rst:1067
@@ +1066,3 @@
+ ``(a + b) * c == a * c + b * c``),
+   * operands to fp operations are not equal to ``NaN`` and ``Inf``, and
+   * ``+0`` and ``-0`` are interchangeable.

fp -> floating-point


Comment at: include/clang/Basic/LangOptions.def:165
@@ -164,3 +164,3 @@
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined macro")
+COMPATIBLE_LANGOPT(FastMath  , 1, 0, "fast fp math optimizations, and 
__FAST_MATH__ predefined macro")
 COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__ predefined 
macro")

fp -> FP


http://reviews.llvm.org/D20457



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20457: Update -ffast-math documentation to match reality.

2016-05-20 Thread Justin Lebar via cfe-commits
jlebar updated this revision to Diff 57958.
jlebar added a comment.

Update per Richard's review.


http://reviews.llvm.org/D20457

Files:
  docs/UsersManual.rst
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td

Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -592,9 +592,7 @@
 def : Flag<["-"], "fno-extended-identifiers">, Group, 
Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
-  HelpText<"Enable the *frontend*'s 'fast-math' mode. This has no effect on "
-   "optimizations, but provides a preprocessor macro __FAST_MATH__ the 
"
-   "same as GCC's -ffast-math flag">;
+  HelpText<"Allow aggressive, lossy floating-point optimizations">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
 def fmath_errno : Flag<["-"], "fmath-errno">, Group, 
Flags<[CC1Option]>,
   HelpText<"Require math functions to indicate errors by setting errno">;
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -162,7 +162,7 @@
 COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
 COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined macro")
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined macro")
+COMPATIBLE_LANGOPT(FastMath  , 1, 0, "fast fp math optimizations, and 
__FAST_MATH__ predefined macro")
 COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__ predefined 
macro")
 COMPATIBLE_LANGOPT(UnsafeFPMath  , 1, 0, "Unsafe Floating Point Math")
 
Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -1055,6 +1055,18 @@
the behavior of sanitizers in the ``cfi`` group to allow checking
of cross-DSO virtual and indirect calls.
 
+.. option:: -ffast-math
+
+   Enable fast-math mode. This defines the ``__FAST_MATH__`` preprocessor
+   macro, and lets the compiler make aggressive, potentially-lossy assumptions
+   about floating-point math.  These include:
+
+   * Floating-point math obeys regular algebraic rules for real numbers (e.g.
+ ``+`` and ``*`` are associative, ``x/y == x * (1/y)``, and
+ ``(a + b) * c == a * c + b * c``),
+   * operands to fp operations are not equal to ``NaN`` and ``Inf``, and
+   * ``+0`` and ``-0`` are interchangeable.
+
 .. option:: -fwhole-program-vtables
 
Enable whole-program vtable optimizations, such as single-implementation


Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -592,9 +592,7 @@
 def : Flag<["-"], "fno-extended-identifiers">, Group, Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
-  HelpText<"Enable the *frontend*'s 'fast-math' mode. This has no effect on "
-   "optimizations, but provides a preprocessor macro __FAST_MATH__ the "
-   "same as GCC's -ffast-math flag">;
+  HelpText<"Allow aggressive, lossy floating-point optimizations">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
 def fmath_errno : Flag<["-"], "fmath-errno">, Group, Flags<[CC1Option]>,
   HelpText<"Require math functions to indicate errors by setting errno">;
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -162,7 +162,7 @@
 COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
 COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined macro")
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined macro")
+COMPATIBLE_LANGOPT(FastMath  , 1, 0, "fast fp math optimizations, and __FAST_MATH__ predefined macro")
 COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
 COMPATIBLE_LANGOPT(UnsafeFPMath  , 1, 0, "Unsafe Floating Point Math")
 
Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -1055,6 +1055,18 @@
the behavior of sanitizers in the ``cfi`` group to allow checking
of cross-DSO virtual and indirect calls.
 
+.. option:: -ffast-math
+
+   Enable fast-math mode. This defines the ``__FAST_MATH__`` preprocessor
+   macro, and lets the compiler make aggressive, potentially-lossy assumptions

Re: [PATCH] D20457: Update -ffast-math documentation to match reality.

2016-05-19 Thread Richard Smith via cfe-commits
On Thu, May 19, 2016 at 6:11 PM, Justin Lebar via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> jlebar created this revision.
> jlebar added a reviewer: rsmith.
> jlebar added a subscriber: cfe-commits.
>
> http://reviews.llvm.org/D20457
>
> Files:
>   include/clang/Basic/LangOptions.def
>   include/clang/Driver/Options.td
>
> Index: include/clang/Driver/Options.td
> ===
> --- include/clang/Driver/Options.td
> +++ include/clang/Driver/Options.td
> @@ -592,9 +592,13 @@
>  def : Flag<["-"], "fno-extended-identifiers">, Group,
> Flags<[Unsupported]>;
>  def fhosted : Flag<["-"], "fhosted">, Group;
>  def ffast_math : Flag<["-"], "ffast-math">, Group,
> Flags<[CC1Option]>,
> -  HelpText<"Enable the *frontend*'s 'fast-math' mode. This has no effect
> on "
> -   "optimizations, but provides a preprocessor macro
> __FAST_MATH__ the "
> -   "same as GCC's -ffast-math flag">;
> +  HelpText<"Enable fast-math mode. This defines the __FAST_MATH__
> preprocessor "
> +   "macro, and lets the compiler make aggressive, potentially
> unsafe "
> +   "assumptions about floating-point math.  These include: "
> +   "Floating-point math obeys regular algebraic rules for real "
> +   "numbers (e.g. + and * are associative, and x/y == x * (1/y)),
> "
> +   "operands to fp operations are not equal to NaN and Inf, and
> +0 "
> +   "and -0 are interchangeable.">;
>

This is significantly too long for HelpText. The current help text for this
flag is already too long:

$ clang --help
[...]
  -fembed-bitcode Embed LLVM IR bitcode as data
  -femit-all-declsEmit all declarations, even if unused
  -femulated-tls  Use emutls functions to access thread_local
variables
  -fexceptionsEnable support for exception handling
  -ffast-math Enable the *frontend*'s 'fast-math' mode. This
has no effect on optimizations, but provides a preprocessor macro
__FAST_MATH__ the same as GCC's -ffast-math flag
  -ffixed-r9  Reserve the r9 register (ARM only)
  -ffixed-x18 Reserve the x18 register (AArch64 only)
[...]

Can you move this to UsersManual.rst instead, and put something short here
instead, like "Allow aggressive, lossy floating-point optimizations"?

 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
>  def fmath_errno : Flag<["-"], "fmath-errno">, Group,
> Flags<[CC1Option]>,
>HelpText<"Require math functions to indicate errors by setting errno">;
> Index: include/clang/Basic/LangOptions.def
> ===
> --- include/clang/Basic/LangOptions.def
> +++ include/clang/Basic/LangOptions.def
> @@ -162,7 +162,7 @@
>  COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
>  COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined
> macro")
>  COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined
> macro")
> -COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined
> macro")
> +COMPATIBLE_LANGOPT(FastMath  , 1, 0, "Fast fp math optimizations,
> and __FAST_MATH__ predefined macro")
>

Something like "fast FP math [...]" would fit better into the diagnostics
where this appears.


>  COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__
> predefined macro")
>  COMPATIBLE_LANGOPT(UnsafeFPMath  , 1, 0, "Unsafe Floating Point Math")
>
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20457: Update -ffast-math documentation to match reality.

2016-05-19 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: rsmith.
jlebar added a subscriber: cfe-commits.

http://reviews.llvm.org/D20457

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td

Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -592,9 +592,13 @@
 def : Flag<["-"], "fno-extended-identifiers">, Group, 
Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
-  HelpText<"Enable the *frontend*'s 'fast-math' mode. This has no effect on "
-   "optimizations, but provides a preprocessor macro __FAST_MATH__ the 
"
-   "same as GCC's -ffast-math flag">;
+  HelpText<"Enable fast-math mode. This defines the __FAST_MATH__ preprocessor 
"
+   "macro, and lets the compiler make aggressive, potentially unsafe "
+   "assumptions about floating-point math.  These include: "
+   "Floating-point math obeys regular algebraic rules for real "
+   "numbers (e.g. + and * are associative, and x/y == x * (1/y)), "
+   "operands to fp operations are not equal to NaN and Inf, and +0 "
+   "and -0 are interchangeable.">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
 def fmath_errno : Flag<["-"], "fmath-errno">, Group, 
Flags<[CC1Option]>,
   HelpText<"Require math functions to indicate errors by setting errno">;
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -162,7 +162,7 @@
 COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
 COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined macro")
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined macro")
+COMPATIBLE_LANGOPT(FastMath  , 1, 0, "Fast fp math optimizations, and 
__FAST_MATH__ predefined macro")
 COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__ predefined 
macro")
 COMPATIBLE_LANGOPT(UnsafeFPMath  , 1, 0, "Unsafe Floating Point Math")
 


Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -592,9 +592,13 @@
 def : Flag<["-"], "fno-extended-identifiers">, Group, Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
-  HelpText<"Enable the *frontend*'s 'fast-math' mode. This has no effect on "
-   "optimizations, but provides a preprocessor macro __FAST_MATH__ the "
-   "same as GCC's -ffast-math flag">;
+  HelpText<"Enable fast-math mode. This defines the __FAST_MATH__ preprocessor "
+   "macro, and lets the compiler make aggressive, potentially unsafe "
+   "assumptions about floating-point math.  These include: "
+   "Floating-point math obeys regular algebraic rules for real "
+   "numbers (e.g. + and * are associative, and x/y == x * (1/y)), "
+   "operands to fp operations are not equal to NaN and Inf, and +0 "
+   "and -0 are interchangeable.">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
 def fmath_errno : Flag<["-"], "fmath-errno">, Group, Flags<[CC1Option]>,
   HelpText<"Require math functions to indicate errors by setting errno">;
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -162,7 +162,7 @@
 COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
 COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined macro")
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath  , 1, 0, "__FAST_MATH__ predefined macro")
+COMPATIBLE_LANGOPT(FastMath  , 1, 0, "Fast fp math optimizations, and __FAST_MATH__ predefined macro")
 COMPATIBLE_LANGOPT(FiniteMathOnly, 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
 COMPATIBLE_LANGOPT(UnsafeFPMath  , 1, 0, "Unsafe Floating Point Math")
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits