[llvm-commits] [llvm-gcc-4.2] r56052 - in /llvm-gcc-4.2/trunk/gcc: common.opt llvm-backend.cpp
Bill Wendling
isanbard at gmail.com
Wed Sep 10 00:13:06 PDT 2008
Author: void
Date: Wed Sep 10 02:13:05 2008
New Revision: 56052
URL: http://llvm.org/viewvc/llvm-project?rev=56052&view=rev
Log:
Add the -flimited-precision to the front-end. We error out if a value other
than 6, 12, or 18 is supplied.
Modified:
llvm-gcc-4.2/trunk/gcc/common.opt
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/common.opt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/common.opt?rev=56052&r1=56051&r2=56052&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/common.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/common.opt Wed Sep 10 02:13:05 2008
@@ -225,6 +225,13 @@
Common Report Var(emit_llvm_bc)
Emit LLVM IR to the output file instead of native machine code.
+; Calculate log, log2, log10, exp, exp2, pow(10,x) to a limited precision for
+; single-precision floating-point numbers.
+flimited-precision=
+Common RejectNegative Joined UInteger Var(flag_limited_precision) Init(0)
+Calculate the approximate value of logf, log2f, log10f, expf, exp2f, and
+powf(10,x) to the given bit precision.
+
; Debug pass manager
fdebug-pass-structure
Common Report Var(flag_debug_pass_structure)
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=56052&r1=56051&r2=56052&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Sep 10 02:13:05 2008
@@ -159,6 +159,19 @@
// directly from the command line, do so now. This is mainly for debugging
// purposes, and shouldn't really be for general use.
std::vector<std::string> ArgStrings;
+
+ if (flag_limited_precision > 0) {
+ if (flag_limited_precision != 6 &&
+ flag_limited_precision != 12 &&
+ flag_limited_precision != 18) {
+ error ("only 6-, 12-, and 18-bit limited precision values supported.");
+ }
+
+ std::string Arg = "--limit-float-precision=";
+ Arg += utostr(flag_limited_precision);
+ ArgStrings.push_back(Arg);
+ }
+
if (llvm_optns) {
std::string Opts = llvm_optns;
for (std::string Opt = getToken(Opts); !Opt.empty(); Opt = getToken(Opts))
More information about the llvm-commits
mailing list