fast-float code option (defaults to on). kills almost 3000 statements from

prozac
This commit is contained in:
Bill Currie 2004-04-27 20:24:37 +00:00
parent f88310ddd0
commit 14900bb82e
4 changed files with 11 additions and 2 deletions

View file

@ -159,6 +159,10 @@ code for \fBB\fP will not be executed. Similar for \fBA || B\fP, but if \fBA\fP
true, the expression is known to be true and the code for \fBB\fP will not be
executed. Defaults to off for traditional and on for advanced.
.TP
.B fast\-float
Use float values directly in if statements. Defaults to on, always on for
version 6 progs.
.TP
.B v6only
Restrict the compiler to only version 6 progs (original Quake/QuakeWorld)
features. This means that the compiled data file should be able to run on

View file

@ -38,6 +38,7 @@ typedef struct {
qboolean cow; // Turn constants into variables if written to
qboolean debug; // Generate debug info for the engine
qboolean short_circuit; // short circuit logic for && and ||
qboolean fast_float; // use floats directly in ifs
unsigned int progsversion; // Progs version to generate code for
} code_options_t;

View file

@ -1076,7 +1076,8 @@ test_expr (expr_t *e, int test)
case ev_short:
return e;
case ev_float:
if (options.code.progsversion == PROG_ID_VERSION)
if (options.code.fast_float
|| options.code.progsversion == PROG_ID_VERSION)
return e;
new = new_float_expr (0);
break;
@ -1182,7 +1183,7 @@ convert_bool (expr_t *e, int block)
if (e->type == ex_uexpr && e->e.expr.op == '!') {
e = convert_bool (e->e.expr.e1, 0);
if (e->type == ex_error)
return e;
return e;
e = unary_expr ('!', e);
}
if (e->type != ex_bool) {

View file

@ -174,6 +174,7 @@ DecodeArgs (int argc, char **argv)
options.code.progsversion = PROG_VERSION;
options.code.short_circuit = -1;
options.code.fast_float = true;
options.warnings.uninited_variable = true;
options.warnings.unused = true;
options.warnings.executable = true;
@ -276,6 +277,8 @@ DecodeArgs (int argc, char **argv)
options.code.debug = flag;
} else if (!(strcasecmp (temp, "short-circuit"))) {
options.code.short_circuit = flag;
} else if (!(strcasecmp (temp, "fast-float"))) {
options.code.fast_float = flag;
} else if (!(strcasecmp (temp, "v6only"))) {
if (flag)
options.code.progsversion = PROG_ID_VERSION;