Skip to content

Commit b8ed0cb

Browse files
committed
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 commit b8ed0cb

38 files changed

+51
-163
lines changed

std/math/acos.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
const math = @import("index.zig");
66
const assert = @import("../debug.zig").assert;
77

8-
pub const acos = acos_workaround;
9-
10-
// TODO issue #393
11-
pub fn acos_workaround(x: var) -> @typeOf(x) {
8+
pub fn acos(x: var) -> @typeOf(x) {
129
const T = @typeOf(x);
1310
switch (T) {
1411
f32 => @inlineCall(acos32, x),
@@ -145,8 +142,8 @@ fn acos64(x: f64) -> f64 {
145142
}
146143

147144
test "math.acos" {
148-
assert(acos_workaround(f32(0.0)) == acos32(0.0));
149-
assert(acos_workaround(f64(0.0)) == acos64(0.0));
145+
assert(acos(f32(0.0)) == acos32(0.0));
146+
assert(acos(f64(0.0)) == acos64(0.0));
150147
}
151148

152149
test "math.acos32" {

std/math/acosh.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
const math = @import("index.zig");
77
const assert = @import("../debug.zig").assert;
88

9-
pub const acosh = acosh_workaround;
10-
11-
// TODO issue #393
12-
pub fn acosh_workaround(x: var) -> @typeOf(x) {
9+
pub fn acosh(x: var) -> @typeOf(x) {
1310
const T = @typeOf(x);
1411
switch (T) {
1512
f32 => @inlineCall(acosh32, x),
@@ -56,8 +53,8 @@ fn acosh64(x: f64) -> f64 {
5653
}
5754

5855
test "math.acosh" {
59-
assert(acosh_workaround(f32(1.5)) == acosh32(1.5));
60-
assert(acosh_workaround(f64(1.5)) == acosh64(1.5));
56+
assert(acosh(f32(1.5)) == acosh32(1.5));
57+
assert(acosh(f64(1.5)) == acosh64(1.5));
6158
}
6259

6360
test "math.acosh32" {

std/math/asin.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
const math = @import("index.zig");
77
const assert = @import("../debug.zig").assert;
88

9-
pub const asin = asin_workaround;
10-
11-
// TODO issue #393
12-
pub fn asin_workaround(x: var) -> @typeOf(x) {
9+
pub fn asin(x: var) -> @typeOf(x) {
1310
const T = @typeOf(x);
1411
switch (T) {
1512
f32 => @inlineCall(asin32, x),
@@ -138,8 +135,8 @@ fn asin64(x: f64) -> f64 {
138135
}
139136

140137
test "math.asin" {
141-
assert(asin_workaround(f32(0.0)) == asin32(0.0));
142-
assert(asin_workaround(f64(0.0)) == asin64(0.0));
138+
assert(asin(f32(0.0)) == asin32(0.0));
139+
assert(asin(f64(0.0)) == asin64(0.0));
143140
}
144141

145142
test "math.asin32" {

std/math/asinh.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
const math = @import("index.zig");
88
const assert = @import("../debug.zig").assert;
99

10-
pub const asinh = asinh_workaround;
11-
12-
// TODO issue #393
13-
pub fn asinh_workaround(x: var) -> @typeOf(x) {
10+
pub fn asinh(x: var) -> @typeOf(x) {
1411
const T = @typeOf(x);
1512
switch (T) {
1613
f32 => @inlineCall(asinh32, x),
@@ -84,8 +81,8 @@ fn asinh64(x: f64) -> f64 {
8481
}
8582

8683
test "math.asinh" {
87-
assert(asinh_workaround(f32(0.0)) == asinh32(0.0));
88-
assert(asinh_workaround(f64(0.0)) == asinh64(0.0));
84+
assert(asinh(f32(0.0)) == asinh32(0.0));
85+
assert(asinh(f64(0.0)) == asinh64(0.0));
8986
}
9087

9188
test "math.asinh32" {

std/math/atan.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
const math = @import("index.zig");
77
const assert = @import("../debug.zig").assert;
88

9-
// TODO issue #393
10-
pub const atan = atan_workaround;
11-
12-
pub fn atan_workaround(x: var) -> @typeOf(x) {
9+
pub fn atan(x: var) -> @typeOf(x) {
1310
const T = @typeOf(x);
1411
switch (T) {
1512
f32 => @inlineCall(atan32, x),
@@ -210,8 +207,8 @@ fn atan64(x_: f64) -> f64 {
210207
}
211208

212209
test "math.atan" {
213-
assert(atan_workaround(f32(0.2)) == atan32(0.2));
214-
assert(atan_workaround(f64(0.2)) == atan64(0.2));
210+
assert(atan(f32(0.2)) == atan32(0.2));
211+
assert(atan(f64(0.2)) == atan64(0.2));
215212
}
216213

217214
test "math.atan32" {

std/math/atan2.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
const math = @import("index.zig");
2222
const assert = @import("../debug.zig").assert;
2323

24-
pub const atan2 = atan2_workaround;
25-
26-
// TODO issue #393
27-
fn atan2_workaround(comptime T: type, x: T, y: T) -> T {
24+
fn atan2(comptime T: type, x: T, y: T) -> T {
2825
switch (T) {
2926
f32 => @inlineCall(atan2_32, x, y),
3027
f64 => @inlineCall(atan2_64, x, y),
@@ -208,8 +205,8 @@ fn atan2_64(y: f64, x: f64) -> f64 {
208205
}
209206

210207
test "math.atan2" {
211-
assert(atan2_workaround(f32, 0.2, 0.21) == atan2_32(0.2, 0.21));
212-
assert(atan2_workaround(f64, 0.2, 0.21) == atan2_64(0.2, 0.21));
208+
assert(atan2(f32, 0.2, 0.21) == atan2_32(0.2, 0.21));
209+
assert(atan2(f64, 0.2, 0.21) == atan2_64(0.2, 0.21));
213210
}
214211

215212
test "math.atan2_32" {

std/math/atanh.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
const math = @import("index.zig");
88
const assert = @import("../debug.zig").assert;
99

10-
// TODO issue #393
11-
pub const atanh = atanh_workaround;
12-
13-
pub fn atanh_workaround(x: var) -> @typeOf(x) {
10+
pub fn atanh(x: var) -> @typeOf(x) {
1411
const T = @typeOf(x);
1512
switch (T) {
1613
f32 => @inlineCall(atanh_32, x),

std/math/cbrt.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
const math = @import("index.zig");
88
const assert = @import("../debug.zig").assert;
99

10-
// TODO issue #393
11-
pub const cbrt = cbrt_workaround;
12-
13-
pub fn cbrt_workaround(x: var) -> @typeOf(x) {
10+
pub fn cbrt(x: var) -> @typeOf(x) {
1411
const T = @typeOf(x);
1512
switch (T) {
1613
f32 => @inlineCall(cbrt32, x),

std/math/ceil.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ const builtin = @import("builtin");
88
const math = @import("index.zig");
99
const assert = @import("../debug.zig").assert;
1010

11-
// TODO issue #393
12-
pub const ceil = ceil_workaround;
13-
14-
pub fn ceil_workaround(x: var) -> @typeOf(x) {
11+
pub fn ceil(x: var) -> @typeOf(x) {
1512
const T = @typeOf(x);
1613
switch (T) {
1714
f32 => @inlineCall(ceil32, x),

std/math/copysign.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
const math = @import("index.zig");
22
const assert = @import("../debug.zig").assert;
33

4-
// TODO issue #393
5-
pub const copysign = copysign_workaround;
6-
7-
pub fn copysign_workaround(comptime T: type, x: T, y: T) -> T {
4+
pub fn copysign(comptime T: type, x: T, y: T) -> T {
85
switch (T) {
96
f32 => @inlineCall(copysign32, x, y),
107
f64 => @inlineCall(copysign64, x, y),

std/math/cos.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
const math = @import("index.zig");
77
const assert = @import("../debug.zig").assert;
88

9-
// TODO issue #393
10-
pub const cos = cos_workaround;
11-
12-
pub fn cos_workaround(x: var) -> @typeOf(x) {
9+
pub fn cos(x: var) -> @typeOf(x) {
1310
const T = @typeOf(x);
1411
switch (T) {
1512
f32 => @inlineCall(cos32, x),

std/math/cosh.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ const math = @import("index.zig");
88
const expo2 = @import("expo2.zig").expo2;
99
const assert = @import("../debug.zig").assert;
1010

11-
// TODO issue #393
12-
pub const cosh = cosh_workaround;
13-
14-
pub fn cosh_workaround(x: var) -> @typeOf(x) {
11+
pub fn cosh(x: var) -> @typeOf(x) {
1512
const T = @typeOf(x);
1613
switch (T) {
1714
f32 => @inlineCall(cosh32, x),

std/math/exp.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
const math = @import("index.zig");
77
const assert = @import("../debug.zig").assert;
88

9-
// TODO issue #393
10-
pub const exp = exp_workaround;
11-
12-
pub fn exp_workaround(x: var) -> @typeOf(x) {
9+
pub fn exp(x: var) -> @typeOf(x) {
1310
const T = @typeOf(x);
1411
switch (T) {
1512
f32 => @inlineCall(exp32, x),

std/math/exp2.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
const math = @import("index.zig");
77
const assert = @import("../debug.zig").assert;
88

9-
// TODO issue #393
10-
pub const exp2 = exp2_workaround;
11-
12-
pub fn exp2_workaround(x: var) -> @typeOf(x) {
9+
pub fn exp2(x: var) -> @typeOf(x) {
1310
const T = @typeOf(x);
1411
switch (T) {
1512
f32 => @inlineCall(exp2_32, x),

std/math/expm1.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
const math = @import("index.zig");
88
const assert = @import("../debug.zig").assert;
99

10-
// TODO issue #393
11-
pub const expm1 = expm1_workaround;
12-
13-
pub fn expm1_workaround(x: var) -> @typeOf(x) {
10+
pub fn expm1(x: var) -> @typeOf(x) {
1411
const T = @typeOf(x);
1512
switch (T) {
1613
f32 => @inlineCall(expm1_32, x),

std/math/fabs.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
const math = @import("index.zig");
77
const assert = @import("../debug.zig").assert;
88

9-
// TODO issue #393
10-
pub const fabs = fabs_workaround;
11-
12-
pub fn fabs_workaround(x: var) -> @typeOf(x) {
9+
pub fn fabs(x: var) -> @typeOf(x) {
1310
const T = @typeOf(x);
1411
switch (T) {
1512
f32 => @inlineCall(fabs32, x),

std/math/floor.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ const builtin = @import("builtin");
88
const assert = @import("../debug.zig").assert;
99
const math = @import("index.zig");
1010

11-
// TODO issue #393
12-
pub const floor = floor_workaround;
13-
14-
pub fn floor_workaround(x: var) -> @typeOf(x) {
11+
pub fn floor(x: var) -> @typeOf(x) {
1512
const T = @typeOf(x);
1613
switch (T) {
1714
f32 => @inlineCall(floor32, x),

std/math/fma.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
const math = @import("index.zig");
22
const assert = @import("../debug.zig").assert;
33

4-
// TODO issue #393
5-
pub const fma = fma_workaround;
6-
7-
pub fn fma_workaround(comptime T: type, x: T, y: T, z: T) -> T {
4+
pub fn fma(comptime T: type, x: T, y: T, z: T) -> T {
85
switch (T) {
96
f32 => @inlineCall(fma32, x, y, z),
107
f64 => @inlineCall(fma64, x, y ,z),

std/math/frexp.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
const math = @import("index.zig");
88
const assert = @import("../debug.zig").assert;
99

10-
// TODO issue #393
11-
pub const frexp = frexp_workaround;
12-
1310
fn frexp_result(comptime T: type) -> type {
1411
struct {
1512
significand: T,
@@ -19,7 +16,7 @@ fn frexp_result(comptime T: type) -> type {
1916
pub const frexp32_result = frexp_result(f32);
2017
pub const frexp64_result = frexp_result(f64);
2118

22-
pub fn frexp_workaround(x: var) -> frexp_result(@typeOf(x)) {
19+
pub fn frexp(x: var) -> frexp_result(@typeOf(x)) {
2320
const T = @typeOf(x);
2421
switch (T) {
2522
f32 => @inlineCall(frexp32, x),

std/math/hypot.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
const math = @import("index.zig");
99
const assert = @import("../debug.zig").assert;
1010

11-
// TODO issue #393
12-
pub const hypot = hypot_workaround;
13-
14-
pub fn hypot_workaround(comptime T: type, x: T, y: T) -> T {
11+
pub fn hypot(comptime T: type, x: T, y: T) -> T {
1512
switch (T) {
1613
f32 => @inlineCall(hypot32, x, y),
1714
f64 => @inlineCall(hypot64, x, y),

std/math/ilogb.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
const math = @import("index.zig");
88
const assert = @import("../debug.zig").assert;
99

10-
// TODO issue #393
11-
pub const ilogb = ilogb_workaround;
12-
13-
pub fn ilogb_workaround(x: var) -> i32 {
10+
pub fn ilogb(x: var) -> i32 {
1411
const T = @typeOf(x);
1512
switch (T) {
1613
f32 => @inlineCall(ilogb32, x),

std/math/ln.zig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ const assert = @import("../debug.zig").assert;
1010
const builtin = @import("builtin");
1111
const TypeId = builtin.TypeId;
1212

13-
pub const ln = ln_workaround;
14-
15-
fn ln_workaround(x: var) -> @typeOf(x) {
13+
pub fn ln(x: var) -> @typeOf(x) {
1614
const T = @typeOf(x);
1715
switch (@typeId(T)) {
1816
TypeId.FloatLiteral => {

std/math/log.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ const builtin = @import("builtin");
33
const TypeId = builtin.TypeId;
44
const assert = @import("../debug.zig").assert;
55

6-
// TODO issue #393
7-
pub const log = log_workaround;
8-
9-
fn log_workaround(comptime T: type, base: T, x: T) -> T {
6+
pub fn log(comptime T: type, base: T, x: T) -> T {
107
if (base == 2) {
118
return math.log2(x);
129
} else if (base == 10) {

std/math/log10.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert;
1010
const builtin = @import("builtin");
1111
const TypeId = builtin.TypeId;
1212

13-
// TODO issue #393
14-
pub const log10 = log10_workaround;
15-
16-
fn log10_workaround(x: var) -> @typeOf(x) {
13+
pub fn log10(x: var) -> @typeOf(x) {
1714
const T = @typeOf(x);
1815
switch (@typeId(T)) {
1916
TypeId.FloatLiteral => {

std/math/log1p.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
const math = @import("index.zig");
1010
const assert = @import("../debug.zig").assert;
1111

12-
// TODO issue #393
13-
pub const log1p = log1p_workaround;
14-
15-
pub fn log1p_workaround(x: var) -> @typeOf(x) {
12+
pub fn log1p(x: var) -> @typeOf(x) {
1613
const T = @typeOf(x);
1714
switch (T) {
1815
f32 => @inlineCall(log1p_32, x),

std/math/log2.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert;
1010
const builtin = @import("builtin");
1111
const TypeId = builtin.TypeId;
1212

13-
// TODO issue #393
14-
pub const log2 = log2_workaround;
15-
16-
fn log2_workaround(x: var) -> @typeOf(x) {
13+
pub fn log2(x: var) -> @typeOf(x) {
1714
const T = @typeOf(x);
1815
switch (@typeId(T)) {
1916
TypeId.FloatLiteral => {

0 commit comments

Comments
 (0)