Merge branch 'master' into llvm6

master
Andrew Kelley 2018-01-06 02:59:17 -05:00
commit 38658a597b
2 changed files with 9 additions and 5 deletions

View File

@ -126,7 +126,8 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM
PMBuilder->SLPVectorize = !is_debug; PMBuilder->SLPVectorize = !is_debug;
PMBuilder->LoopVectorize = !is_debug; PMBuilder->LoopVectorize = !is_debug;
PMBuilder->RerollLoops = !is_debug; PMBuilder->RerollLoops = !is_debug;
PMBuilder->NewGVN = !is_debug; // Leaving NewGVN as default (off) because when on it caused issue #673
//PMBuilder->NewGVN = !is_debug;
PMBuilder->DisableGVNLoadPRE = is_debug; PMBuilder->DisableGVNLoadPRE = is_debug;
PMBuilder->VerifyInput = assertions_on; PMBuilder->VerifyInput = assertions_on;
PMBuilder->VerifyOutput = assertions_on; PMBuilder->VerifyOutput = assertions_on;

View File

@ -4,6 +4,7 @@
// - expm1(-inf) = -1 // - expm1(-inf) = -1
// - expm1(nan) = nan // - expm1(nan) = nan
const builtin = @import("builtin");
const std = @import("../index.zig"); const std = @import("../index.zig");
const math = std.math; const math = std.math;
const assert = std.debug.assert; const assert = std.debug.assert;
@ -18,6 +19,7 @@ pub fn expm1(x: var) -> @typeOf(x) {
} }
fn expm1_32(x_: f32) -> f32 { fn expm1_32(x_: f32) -> f32 {
@setFloatMode(this, builtin.FloatMode.Strict);
const o_threshold: f32 = 8.8721679688e+01; const o_threshold: f32 = 8.8721679688e+01;
const ln2_hi: f32 = 6.9313812256e-01; const ln2_hi: f32 = 6.9313812256e-01;
const ln2_lo: f32 = 9.0580006145e-06; const ln2_lo: f32 = 9.0580006145e-06;
@ -122,7 +124,7 @@ fn expm1_32(x_: f32) -> f32 {
} }
} }
const twopk = @bitCast(f32, u32((0x7F + k) << 23)); const twopk = @bitCast(f32, u32((0x7F +% k) << 23));
if (k < 0 or k > 56) { if (k < 0 or k > 56) {
var y = x - e + 1.0; var y = x - e + 1.0;
@ -135,7 +137,7 @@ fn expm1_32(x_: f32) -> f32 {
return y - 1.0; return y - 1.0;
} }
const uf = @bitCast(f32, u32(0x7F - k) << 23); const uf = @bitCast(f32, u32(0x7F -% k) << 23);
if (k < 23) { if (k < 23) {
return (x - e + (1 - uf)) * twopk; return (x - e + (1 - uf)) * twopk;
} else { } else {
@ -144,6 +146,7 @@ fn expm1_32(x_: f32) -> f32 {
} }
fn expm1_64(x_: f64) -> f64 { fn expm1_64(x_: f64) -> f64 {
@setFloatMode(this, builtin.FloatMode.Strict);
const o_threshold: f64 = 7.09782712893383973096e+02; const o_threshold: f64 = 7.09782712893383973096e+02;
const ln2_hi: f64 = 6.93147180369123816490e-01; const ln2_hi: f64 = 6.93147180369123816490e-01;
const ln2_lo: f64 = 1.90821492927058770002e-10; const ln2_lo: f64 = 1.90821492927058770002e-10;
@ -251,7 +254,7 @@ fn expm1_64(x_: f64) -> f64 {
} }
} }
const twopk = @bitCast(f64, u64(0x3FF + k) << 52); const twopk = @bitCast(f64, u64(0x3FF +% k) << 52);
if (k < 0 or k > 56) { if (k < 0 or k > 56) {
var y = x - e + 1.0; var y = x - e + 1.0;
@ -264,7 +267,7 @@ fn expm1_64(x_: f64) -> f64 {
return y - 1.0; return y - 1.0;
} }
const uf = @bitCast(f64, u64(0x3FF - k) << 52); const uf = @bitCast(f64, u64(0x3FF -% k) << 52);
if (k < 20) { if (k < 20) {
return (x - e + (1 - uf)) * twopk; return (x - e + (1 - uf)) * twopk;
} else { } else {