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...@@ -126,7 +126,8 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM
126 PMBuilder->SLPVectorize = !is_debug;126 PMBuilder->SLPVectorize = !is_debug;
127 PMBuilder->LoopVectorize = !is_debug;127 PMBuilder->LoopVectorize = !is_debug;
128 PMBuilder->RerollLoops = !is_debug;128 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;
130 PMBuilder->DisableGVNLoadPRE = is_debug;131 PMBuilder->DisableGVNLoadPRE = is_debug;
131 PMBuilder->VerifyInput = assertions_on;132 PMBuilder->VerifyInput = assertions_on;
132 PMBuilder->VerifyOutput = assertions_on;133 PMBuilder->VerifyOutput = assertions_on;
std/math/expm1.zig+7-4
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// - expm1(-inf) = -14// - expm1(-inf) = -1
5// - expm1(nan) = nan5// - expm1(nan) = nan
66
7const builtin = @import("builtin");
7const std = @import("../index.zig");8const std = @import("../index.zig");
8const math = std.math;9const math = std.math;
9const assert = std.debug.assert;10const assert = std.debug.assert;
...@@ -18,6 +19,7 @@ pub fn expm1(x: var) -> @typeOf(x) {...@@ -18,6 +19,7 @@ pub fn expm1(x: var) -> @typeOf(x) {
18}19}
1920
20fn expm1_32(x_: f32) -> f32 {21fn expm1_32(x_: f32) -> f32 {
22 @setFloatMode(this, builtin.FloatMode.Strict);
21 const o_threshold: f32 = 8.8721679688e+01;23 const o_threshold: f32 = 8.8721679688e+01;
22 const ln2_hi: f32 = 6.9313812256e-01;24 const ln2_hi: f32 = 6.9313812256e-01;
23 const ln2_lo: f32 = 9.0580006145e-06;25 const ln2_lo: f32 = 9.0580006145e-06;
...@@ -122,7 +124,7 @@ fn expm1_32(x_: f32) -> f32 {...@@ -122,7 +124,7 @@ fn expm1_32(x_: f32) -> f32 {
122 }124 }
123 }125 }
124126
125 const twopk = @bitCast(f32, u32((0x7F + k) << 23));127 const twopk = @bitCast(f32, u32((0x7F +% k) << 23));
126128
127 if (k < 0 or k > 56) {129 if (k < 0 or k > 56) {
128 var y = x - e + 1.0;130 var y = x - e + 1.0;
...@@ -135,7 +137,7 @@ fn expm1_32(x_: f32) -> f32 {...@@ -135,7 +137,7 @@ fn expm1_32(x_: f32) -> f32 {
135 return y - 1.0;137 return y - 1.0;
136 }138 }
137139
138 const uf = @bitCast(f32, u32(0x7F - k) << 23);140 const uf = @bitCast(f32, u32(0x7F -% k) << 23);
139 if (k < 23) {141 if (k < 23) {
140 return (x - e + (1 - uf)) * twopk;142 return (x - e + (1 - uf)) * twopk;
141 } else {143 } else {
...@@ -144,6 +146,7 @@ fn expm1_32(x_: f32) -> f32 {...@@ -144,6 +146,7 @@ fn expm1_32(x_: f32) -> f32 {
144}146}
145147
146fn expm1_64(x_: f64) -> f64 {148fn expm1_64(x_: f64) -> f64 {
149 @setFloatMode(this, builtin.FloatMode.Strict);
147 const o_threshold: f64 = 7.09782712893383973096e+02;150 const o_threshold: f64 = 7.09782712893383973096e+02;
148 const ln2_hi: f64 = 6.93147180369123816490e-01;151 const ln2_hi: f64 = 6.93147180369123816490e-01;
149 const ln2_lo: f64 = 1.90821492927058770002e-10;152 const ln2_lo: f64 = 1.90821492927058770002e-10;
...@@ -251,7 +254,7 @@ fn expm1_64(x_: f64) -> f64 {...@@ -251,7 +254,7 @@ fn expm1_64(x_: f64) -> f64 {
251 }254 }
252 }255 }
253256
254 const twopk = @bitCast(f64, u64(0x3FF + k) << 52);257 const twopk = @bitCast(f64, u64(0x3FF +% k) << 52);
255258
256 if (k < 0 or k > 56) {259 if (k < 0 or k > 56) {
257 var y = x - e + 1.0;260 var y = x - e + 1.0;
...@@ -264,7 +267,7 @@ fn expm1_64(x_: f64) -> f64 {...@@ -264,7 +267,7 @@ fn expm1_64(x_: f64) -> f64 {
264 return y - 1.0;267 return y - 1.0;
265 }268 }
266269
267 const uf = @bitCast(f64, u64(0x3FF - k) << 52);270 const uf = @bitCast(f64, u64(0x3FF -% k) << 52);
268 if (k < 20) {271 if (k < 20) {
269 return (x - e + (1 - uf)) * twopk;272 return (x - e + (1 - uf)) * twopk;
270 } else {273 } else {