authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-01-06 02:59:17-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-01-06 02:59:17-05:00
log38658a597bc22697c2038c21bdec9f04c9973eb8
tree4f52ec6d34bf1380750fcdb37c99e8b5d05c1762
parent2200c2de6f29845b2a41491fda663289fdc786d3
parentdde7cc52d2f4780587b37604889c4568b8d79c62

Merge branch 'master' into llvm6


2 files changed, 9 insertions(+), 5 deletions(-)

src/zig_llvm.cpp+2-1
......@@ -126,7 +126,8 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM
126126 PMBuilder->SLPVectorize = !is_debug;
127127 PMBuilder->LoopVectorize = !is_debug;
128128 PMBuilder->RerollLoops = !is_debug;
129 PMBuilder->NewGVN = !is_debug;
129 // Leaving NewGVN as default (off) because when on it caused issue #673
130 //PMBuilder->NewGVN = !is_debug;
130131 PMBuilder->DisableGVNLoadPRE = is_debug;
131132 PMBuilder->VerifyInput = assertions_on;
132133 PMBuilder->VerifyOutput = assertions_on;
std/math/expm1.zig+7-4
......@@ -4,6 +4,7 @@
44// - expm1(-inf) = -1
55// - expm1(nan) = nan
66
7const builtin = @import("builtin");
78const std = @import("../index.zig");
89const math = std.math;
910const assert = std.debug.assert;
......@@ -18,6 +19,7 @@ pub fn expm1(x: var) -> @typeOf(x) {
1819}
1920
2021fn expm1_32(x_: f32) -> f32 {
22 @setFloatMode(this, builtin.FloatMode.Strict);
2123 const o_threshold: f32 = 8.8721679688e+01;
2224 const ln2_hi: f32 = 6.9313812256e-01;
2325 const ln2_lo: f32 = 9.0580006145e-06;
......@@ -122,7 +124,7 @@ fn expm1_32(x_: f32) -> f32 {
122124 }
123125 }
124126
125 const twopk = @bitCast(f32, u32((0x7F + k) << 23));
127 const twopk = @bitCast(f32, u32((0x7F +% k) << 23));
126128
127129 if (k < 0 or k > 56) {
128130 var y = x - e + 1.0;
......@@ -135,7 +137,7 @@ fn expm1_32(x_: f32) -> f32 {
135137 return y - 1.0;
136138 }
137139
138 const uf = @bitCast(f32, u32(0x7F - k) << 23);
140 const uf = @bitCast(f32, u32(0x7F -% k) << 23);
139141 if (k < 23) {
140142 return (x - e + (1 - uf)) * twopk;
141143 } else {
......@@ -144,6 +146,7 @@ fn expm1_32(x_: f32) -> f32 {
144146}
145147
146148fn expm1_64(x_: f64) -> f64 {
149 @setFloatMode(this, builtin.FloatMode.Strict);
147150 const o_threshold: f64 = 7.09782712893383973096e+02;
148151 const ln2_hi: f64 = 6.93147180369123816490e-01;
149152 const ln2_lo: f64 = 1.90821492927058770002e-10;
......@@ -251,7 +254,7 @@ fn expm1_64(x_: f64) -> f64 {
251254 }
252255 }
253256
254 const twopk = @bitCast(f64, u64(0x3FF + k) << 52);
257 const twopk = @bitCast(f64, u64(0x3FF +% k) << 52);
255258
256259 if (k < 0 or k > 56) {
257260 var y = x - e + 1.0;
......@@ -264,7 +267,7 @@ fn expm1_64(x_: f64) -> f64 {
264267 return y - 1.0;
265268 }
266269
267 const uf = @bitCast(f64, u64(0x3FF - k) << 52);
270 const uf = @bitCast(f64, u64(0x3FF -% k) << 52);
268271 if (k < 20) {
269272 return (x - e + (1 - uf)) * twopk;
270273 } else {