Commit b8ed0cb374

Andrew Kelley <superjoe30@gmail.com>
2017-08-28 10:28:42
remove workaround for LLVM not respecting "nobuiltin"
now that we depend on LLVM 5.0.0 we can remove the workaround. closes #393
1 parent d7a5399
std/math/acos.zig
@@ -5,10 +5,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-pub const acos = acos_workaround;
-
-// TODO issue #393
-pub fn acos_workaround(x: var) -> @typeOf(x) {
+pub fn acos(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(acos32, x),
@@ -145,8 +142,8 @@ fn acos64(x: f64) -> f64 {
 }
 
 test "math.acos" {
-    assert(acos_workaround(f32(0.0)) == acos32(0.0));
-    assert(acos_workaround(f64(0.0)) == acos64(0.0));
+    assert(acos(f32(0.0)) == acos32(0.0));
+    assert(acos(f64(0.0)) == acos64(0.0));
 }
 
 test "math.acos32" {
std/math/acosh.zig
@@ -6,10 +6,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-pub const acosh = acosh_workaround;
-
-// TODO issue #393
-pub fn acosh_workaround(x: var) -> @typeOf(x) {
+pub fn acosh(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(acosh32, x),
@@ -56,8 +53,8 @@ fn acosh64(x: f64) -> f64 {
 }
 
 test "math.acosh" {
-    assert(acosh_workaround(f32(1.5)) == acosh32(1.5));
-    assert(acosh_workaround(f64(1.5)) == acosh64(1.5));
+    assert(acosh(f32(1.5)) == acosh32(1.5));
+    assert(acosh(f64(1.5)) == acosh64(1.5));
 }
 
 test "math.acosh32" {
std/math/asin.zig
@@ -6,10 +6,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-pub const asin = asin_workaround;
-
-// TODO issue #393
-pub fn asin_workaround(x: var) -> @typeOf(x) {
+pub fn asin(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(asin32, x),
@@ -138,8 +135,8 @@ fn asin64(x: f64) -> f64 {
 }
 
 test "math.asin" {
-    assert(asin_workaround(f32(0.0)) == asin32(0.0));
-    assert(asin_workaround(f64(0.0)) == asin64(0.0));
+    assert(asin(f32(0.0)) == asin32(0.0));
+    assert(asin(f64(0.0)) == asin64(0.0));
 }
 
 test "math.asin32" {
std/math/asinh.zig
@@ -7,10 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-pub const asinh = asinh_workaround;
-
-// TODO issue #393
-pub fn asinh_workaround(x: var) -> @typeOf(x) {
+pub fn asinh(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(asinh32, x),
@@ -84,8 +81,8 @@ fn asinh64(x: f64) -> f64 {
 }
 
 test "math.asinh" {
-    assert(asinh_workaround(f32(0.0)) == asinh32(0.0));
-    assert(asinh_workaround(f64(0.0)) == asinh64(0.0));
+    assert(asinh(f32(0.0)) == asinh32(0.0));
+    assert(asinh(f64(0.0)) == asinh64(0.0));
 }
 
 test "math.asinh32" {
std/math/atan.zig
@@ -6,10 +6,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const atan = atan_workaround;
-
-pub fn atan_workaround(x: var) -> @typeOf(x) {
+pub fn atan(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(atan32, x),
@@ -210,8 +207,8 @@ fn atan64(x_: f64) -> f64 {
 }
 
 test "math.atan" {
-    assert(atan_workaround(f32(0.2)) == atan32(0.2));
-    assert(atan_workaround(f64(0.2)) == atan64(0.2));
+    assert(atan(f32(0.2)) == atan32(0.2));
+    assert(atan(f64(0.2)) == atan64(0.2));
 }
 
 test "math.atan32" {
std/math/atan2.zig
@@ -21,10 +21,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-pub const atan2 = atan2_workaround;
-
-// TODO issue #393
-fn atan2_workaround(comptime T: type, x: T, y: T) -> T {
+fn atan2(comptime T: type, x: T, y: T) -> T {
     switch (T) {
         f32 => @inlineCall(atan2_32, x, y),
         f64 => @inlineCall(atan2_64, x, y),
@@ -208,8 +205,8 @@ fn atan2_64(y: f64, x: f64) -> f64 {
 }
 
 test "math.atan2" {
-    assert(atan2_workaround(f32, 0.2, 0.21) == atan2_32(0.2, 0.21));
-    assert(atan2_workaround(f64, 0.2, 0.21) == atan2_64(0.2, 0.21));
+    assert(atan2(f32, 0.2, 0.21) == atan2_32(0.2, 0.21));
+    assert(atan2(f64, 0.2, 0.21) == atan2_64(0.2, 0.21));
 }
 
 test "math.atan2_32" {
std/math/atanh.zig
@@ -7,10 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const atanh = atanh_workaround;
-
-pub fn atanh_workaround(x: var) -> @typeOf(x) {
+pub fn atanh(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(atanh_32, x),
std/math/cbrt.zig
@@ -7,10 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const cbrt = cbrt_workaround;
-
-pub fn cbrt_workaround(x: var) -> @typeOf(x) {
+pub fn cbrt(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(cbrt32, x),
std/math/ceil.zig
@@ -8,10 +8,7 @@ const builtin = @import("builtin");
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const ceil = ceil_workaround;
-
-pub fn ceil_workaround(x: var) -> @typeOf(x) {
+pub fn ceil(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(ceil32, x),
std/math/copysign.zig
@@ -1,10 +1,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const copysign = copysign_workaround;
-
-pub fn copysign_workaround(comptime T: type, x: T, y: T) -> T {
+pub fn copysign(comptime T: type, x: T, y: T) -> T {
     switch (T) {
         f32 => @inlineCall(copysign32, x, y),
         f64 => @inlineCall(copysign64, x, y),
std/math/cos.zig
@@ -6,10 +6,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const cos = cos_workaround;
-
-pub fn cos_workaround(x: var) -> @typeOf(x) {
+pub fn cos(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(cos32, x),
std/math/cosh.zig
@@ -8,10 +8,7 @@ const math = @import("index.zig");
 const expo2 = @import("expo2.zig").expo2;
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const cosh = cosh_workaround;
-
-pub fn cosh_workaround(x: var) -> @typeOf(x) {
+pub fn cosh(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(cosh32, x),
std/math/exp.zig
@@ -6,10 +6,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const exp = exp_workaround;
-
-pub fn exp_workaround(x: var) -> @typeOf(x) {
+pub fn exp(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(exp32, x),
std/math/exp2.zig
@@ -6,10 +6,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const exp2 = exp2_workaround;
-
-pub fn exp2_workaround(x: var) -> @typeOf(x) {
+pub fn exp2(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(exp2_32, x),
std/math/expm1.zig
@@ -7,10 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const expm1 = expm1_workaround;
-
-pub fn expm1_workaround(x: var) -> @typeOf(x) {
+pub fn expm1(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(expm1_32, x),
std/math/fabs.zig
@@ -6,10 +6,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const fabs = fabs_workaround;
-
-pub fn fabs_workaround(x: var) -> @typeOf(x) {
+pub fn fabs(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(fabs32, x),
std/math/floor.zig
@@ -8,10 +8,7 @@ const builtin = @import("builtin");
 const assert = @import("../debug.zig").assert;
 const math = @import("index.zig");
 
-// TODO issue #393
-pub const floor = floor_workaround;
-
-pub fn floor_workaround(x: var) -> @typeOf(x) {
+pub fn floor(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(floor32, x),
std/math/fma.zig
@@ -1,10 +1,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const fma = fma_workaround;
-
-pub fn fma_workaround(comptime T: type, x: T, y: T, z: T) -> T {
+pub fn fma(comptime T: type, x: T, y: T, z: T) -> T {
     switch (T) {
         f32 => @inlineCall(fma32, x, y, z),
         f64 => @inlineCall(fma64, x, y ,z),
std/math/frexp.zig
@@ -7,9 +7,6 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const frexp = frexp_workaround;
-
 fn frexp_result(comptime T: type) -> type {
     struct {
         significand: T,
@@ -19,7 +16,7 @@ fn frexp_result(comptime T: type) -> type {
 pub const frexp32_result = frexp_result(f32);
 pub const frexp64_result = frexp_result(f64);
 
-pub fn frexp_workaround(x: var) -> frexp_result(@typeOf(x)) {
+pub fn frexp(x: var) -> frexp_result(@typeOf(x)) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(frexp32, x),
std/math/hypot.zig
@@ -8,10 +8,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const hypot = hypot_workaround;
-
-pub fn hypot_workaround(comptime T: type, x: T, y: T) -> T {
+pub fn hypot(comptime T: type, x: T, y: T) -> T {
     switch (T) {
         f32 => @inlineCall(hypot32, x, y),
         f64 => @inlineCall(hypot64, x, y),
std/math/ilogb.zig
@@ -7,10 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const ilogb = ilogb_workaround;
-
-pub fn ilogb_workaround(x: var) -> i32 {
+pub fn ilogb(x: var) -> i32 {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(ilogb32, x),
std/math/ln.zig
@@ -10,9 +10,7 @@ const assert = @import("../debug.zig").assert;
 const builtin = @import("builtin");
 const TypeId = builtin.TypeId;
 
-pub const ln = ln_workaround;
-
-fn ln_workaround(x: var) -> @typeOf(x) {
+pub fn ln(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (@typeId(T)) {
         TypeId.FloatLiteral => {
std/math/log.zig
@@ -3,10 +3,7 @@ const builtin = @import("builtin");
 const TypeId = builtin.TypeId;
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const log = log_workaround;
-
-fn log_workaround(comptime T: type, base: T, x: T) -> T {
+pub fn log(comptime T: type, base: T, x: T) -> T {
     if (base == 2) {
         return math.log2(x);
     } else if (base == 10) {
std/math/log10.zig
@@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert;
 const builtin = @import("builtin");
 const TypeId = builtin.TypeId;
 
-// TODO issue #393
-pub const log10 = log10_workaround;
-
-fn log10_workaround(x: var) -> @typeOf(x) {
+pub fn log10(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (@typeId(T)) {
         TypeId.FloatLiteral => {
std/math/log1p.zig
@@ -9,10 +9,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const log1p = log1p_workaround;
-
-pub fn log1p_workaround(x: var) -> @typeOf(x) {
+pub fn log1p(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(log1p_32, x),
std/math/log2.zig
@@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert;
 const builtin = @import("builtin");
 const TypeId = builtin.TypeId;
 
-// TODO issue #393
-pub const log2 = log2_workaround;
-
-fn log2_workaround(x: var) -> @typeOf(x) {
+pub fn log2(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (@typeId(T)) {
         TypeId.FloatLiteral => {
std/math/modf.zig
@@ -6,9 +6,6 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const modf = modf_workaround;
-
 fn modf_result(comptime T: type) -> type {
     struct {
         fpart: T,
@@ -18,7 +15,7 @@ fn modf_result(comptime T: type) -> type {
 pub const modf32_result = modf_result(f32);
 pub const modf64_result = modf_result(f64);
 
-pub fn modf_workaround(x: var) -> modf_result(@typeOf(x)) {
+pub fn modf(x: var) -> modf_result(@typeOf(x)) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(modf32, x),
std/math/nan.zig
@@ -1,8 +1,6 @@
 const math = @import("index.zig");
 
-pub const nan = nan_workaround;
-
-pub fn nan_workaround(comptime T: type) -> T {
+pub fn nan(comptime T: type) -> T {
     switch (T) {
         f32 => @bitCast(f32, math.nan_u32),
         f64 => @bitCast(f64, math.nan_u64),
@@ -10,11 +8,9 @@ pub fn nan_workaround(comptime T: type) -> T {
     }
 }
 
-pub const snan = snan_workaround;
-
 // Note: A signalling nan is identical to a standard right now by may have a different bit
 // representation in the future when required.
-pub fn snan_workaround(comptime T: type) -> T {
+pub fn snan(comptime T: type) -> T {
     switch (T) {
         f32 => @bitCast(f32, math.nan_u32),
         f64 => @bitCast(f64, math.nan_u64),
std/math/pow.zig
@@ -24,11 +24,8 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const pow = pow_workaround;
-
 // This implementation is taken from the go stlib, musl is a bit more complex.
-pub fn pow_workaround(comptime T: type, x: T, y: T) -> T {
+pub fn pow(comptime T: type, x: T, y: T) -> T {
 
     @setFloatMode(this, @import("builtin").FloatMode.Strict);
 
std/math/round.zig
@@ -8,10 +8,7 @@ const builtin = @import("builtin");
 const assert = @import("../debug.zig").assert;
 const math = @import("index.zig");
 
-// TODO issue #393
-pub const round = round_workaround;
-
-pub fn round_workaround(x: var) -> @typeOf(x) {
+pub fn round(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(round32, x),
std/math/scalbn.zig
@@ -1,10 +1,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const scalbn = scalbn_workaround;
-
-pub fn scalbn_workaround(x: var, n: i32) -> @typeOf(x) {
+pub fn scalbn(x: var, n: i32) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(scalbn32, x, n),
std/math/signbit.zig
@@ -1,10 +1,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const signbit = signbit_workaround;
-
-pub fn signbit_workaround(x: var) -> bool {
+pub fn signbit(x: var) -> bool {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(signbit32, x),
std/math/sin.zig
@@ -7,10 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const sin = sin_workaround;
-
-pub fn sin_workaround(x: var) -> @typeOf(x) {
+pub fn sin(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(sin32, x),
std/math/sinh.zig
@@ -8,10 +8,7 @@ const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 const expo2 = @import("expo2.zig").expo2;
 
-// TODO issue #393
-pub const sinh = sinh_workaround;
-
-pub fn sinh_workaround(x: var) -> @typeOf(x) {
+pub fn sinh(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(sinh32, x),
std/math/sqrt.zig
@@ -8,10 +8,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-// TODO issue #393
-pub const sqrt = sqrt_workaround;
-
-pub fn sqrt_workaround(x: var) -> @typeOf(x) {
+pub fn sqrt(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(sqrt32, x),
std/math/tan.zig
@@ -7,9 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-pub const tan = tan_workaround;
-
-pub fn tan_workaround(x: var) -> @typeOf(x) {
+pub fn tan(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(tan32, x),
std/math/tanh.zig
@@ -8,10 +8,7 @@ const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 const expo2 = @import("expo2.zig").expo2;
 
-// TODO issue #393
-pub const tanh = tanh_workaround;
-
-pub fn tanh_workaround(x: var) -> @typeOf(x) {
+pub fn tanh(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(tanh32, x),
std/math/trunc.zig
@@ -7,9 +7,7 @@
 const math = @import("index.zig");
 const assert = @import("../debug.zig").assert;
 
-pub const trunc = trunc_workaround;
-
-pub fn trunc_workaround(x: var) -> @typeOf(x) {
+pub fn trunc(x: var) -> @typeOf(x) {
     const T = @typeOf(x);
     switch (T) {
         f32 => @inlineCall(trunc32, x),