aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-08-23 08:26:09 -0400
committerGitHub <noreply@github.com>2018-08-23 08:26:09 -0400
commit327482c3a41a30d5ea63eedd3bfb13553c8c2d00 (patch)
treeef668f8342632858ee20e6d9a05d9c93d8e5b704 /src
parent68dcdf1c867a918aa0bb7b5c4cb42df185e1c8f9 (diff)
parent353419f82d3575dc45631750a8cf08aa4826ec4c (diff)
downloadzig-327482c3a41a30d5ea63eedd3bfb13553c8c2d00.tar.gz
zig-327482c3a41a30d5ea63eedd3bfb13553c8c2d00.zip
Merge pull request #1402 from ziglang/default-fp-ieee-strict
Default to strict IEEE floating point
Diffstat (limited to 'src')
-rw-r--r--src/all_types.hpp4
-rw-r--r--src/codegen.cpp6
-rw-r--r--src/ir.cpp10
3 files changed, 10 insertions, 10 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp
index b1e8a3746d..a8dd9dde83 100644
--- a/src/all_types.hpp
+++ b/src/all_types.hpp
@@ -1852,7 +1852,7 @@ struct ScopeDecls {
HashMap<Buf *, Tld *, buf_hash, buf_eql_buf> decl_table;
bool safety_off;
AstNode *safety_set_node;
- bool fast_math_off;
+ bool fast_math_on;
AstNode *fast_math_set_node;
ImportTableEntry *import;
// If this is a scope from a container, this is the type entry, otherwise null
@@ -1872,7 +1872,7 @@ struct ScopeBlock {
bool safety_off;
AstNode *safety_set_node;
- bool fast_math_off;
+ bool fast_math_on;
AstNode *fast_math_set_node;
};
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 16595be9dd..e926d14a7e 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -829,15 +829,15 @@ static bool ir_want_fast_math(CodeGen *g, IrInstruction *instruction) {
if (scope->id == ScopeIdBlock) {
ScopeBlock *block_scope = (ScopeBlock *)scope;
if (block_scope->fast_math_set_node)
- return !block_scope->fast_math_off;
+ return block_scope->fast_math_on;
} else if (scope->id == ScopeIdDecls) {
ScopeDecls *decls_scope = (ScopeDecls *)scope;
if (decls_scope->fast_math_set_node)
- return !decls_scope->fast_math_off;
+ return decls_scope->fast_math_on;
}
scope = scope->parent;
}
- return true;
+ return false;
}
static bool ir_want_runtime_safety(CodeGen *g, IrInstruction *instruction) {
diff --git a/src/ir.cpp b/src/ir.cpp
index 6ee44b507d..32650204a6 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -15200,17 +15200,17 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
return ira->codegen->builtin_types.entry_void;
}
- bool *fast_math_off_ptr;
+ bool *fast_math_on_ptr;
AstNode **fast_math_set_node_ptr;
if (target_type->id == TypeTableEntryIdBlock) {
ScopeBlock *block_scope = (ScopeBlock *)target_val->data.x_block;
- fast_math_off_ptr = &block_scope->fast_math_off;
+ fast_math_on_ptr = &block_scope->fast_math_on;
fast_math_set_node_ptr = &block_scope->fast_math_set_node;
} else if (target_type->id == TypeTableEntryIdFn) {
assert(target_val->data.x_ptr.special == ConstPtrSpecialFunction);
FnTableEntry *target_fn = target_val->data.x_ptr.data.fn.fn_entry;
assert(target_fn->def_scope);
- fast_math_off_ptr = &target_fn->def_scope->fast_math_off;
+ fast_math_on_ptr = &target_fn->def_scope->fast_math_on;
fast_math_set_node_ptr = &target_fn->def_scope->fast_math_set_node;
} else if (target_type->id == TypeTableEntryIdMetaType) {
ScopeDecls *decls_scope;
@@ -15226,7 +15226,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
buf_sprintf("expected scope reference, found type '%s'", buf_ptr(&type_arg->name)));
return ira->codegen->builtin_types.entry_invalid;
}
- fast_math_off_ptr = &decls_scope->fast_math_off;
+ fast_math_on_ptr = &decls_scope->fast_math_on;
fast_math_set_node_ptr = &decls_scope->fast_math_set_node;
} else {
ir_add_error_node(ira, target_instruction->source_node,
@@ -15248,7 +15248,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
return ira->codegen->builtin_types.entry_invalid;
}
*fast_math_set_node_ptr = source_node;
- *fast_math_off_ptr = (float_mode_scalar == FloatModeStrict);
+ *fast_math_on_ptr = (float_mode_scalar == FloatModeOptimized);
ir_build_const_from(ira, &instruction->base);
return ira->codegen->builtin_types.entry_void;