diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-25 16:30:40 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-02-25 16:30:40 -0500 |
| commit | f33bf48af7d9c99d532864f8a6c3f695ad5bbd21 (patch) | |
| tree | fa39bd6b654178e653d06e1c79f22ad1d29cd526 /lib/std/special | |
| parent | 64365bc5d7b1e2c507806ee8976acc3479ad7862 (diff) | |
| parent | 416a547cdb8dbbf3d2e7ce32132f0a25f2a8607e (diff) | |
| download | zig-f33bf48af7d9c99d532864f8a6c3f695ad5bbd21.tar.gz zig-f33bf48af7d9c99d532864f8a6c3f695ad5bbd21.zip | |
Merge remote-tracking branch 'origin/master' into llvm10
Diffstat (limited to 'lib/std/special')
| -rw-r--r-- | lib/std/special/build_runner.zig | 25 | ||||
| -rw-r--r-- | lib/std/special/c.zig | 2 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/addXf3.zig | 14 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/compareXf2.zig | 6 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/divdf3.zig | 8 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/divsf3.zig | 6 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/extendXfYf2.zig | 6 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/fixint.zig | 2 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/fixuint.zig | 2 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/floatsiXf.zig | 4 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/mulXf3.zig | 6 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/negXf2.zig | 2 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/truncXfYf2.zig | 4 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/udivmod.zig | 4 |
14 files changed, 47 insertions, 44 deletions
diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig index 45dea79469..baf21570ec 100644 --- a/lib/std/special/build_runner.zig +++ b/lib/std/special/build_runner.zig @@ -96,6 +96,8 @@ pub fn main() !void { builder.verbose_cimport = true; } else if (mem.eql(u8, arg, "--verbose-cc")) { builder.verbose_cc = true; + } else if (mem.eql(u8, arg, "--verbose-llvm-cpu-features")) { + builder.verbose_llvm_cpu_features = true; } else if (mem.eql(u8, arg, "--")) { builder.args = argsRest(args, arg_idx); break; @@ -126,7 +128,7 @@ pub fn main() !void { } fn runBuild(builder: *Builder) anyerror!void { - switch (@typeId(@TypeOf(root.build).ReturnType)) { + switch (@typeInfo(@TypeOf(root.build).ReturnType)) { .Void => root.build(builder), .ErrorUnion => try root.build(builder), else => @compileError("expected return type of build to be 'void' or '!void'"), @@ -185,16 +187,17 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void { try out_stream.write( \\ \\Advanced Options: - \\ --build-file [file] Override path to build.zig - \\ --cache-dir [path] Override path to zig cache directory - \\ --override-lib-dir [arg] Override path to Zig lib directory - \\ --verbose-tokenize Enable compiler debug output for tokenization - \\ --verbose-ast Enable compiler debug output for parsing into an AST - \\ --verbose-link Enable compiler debug output for linking - \\ --verbose-ir Enable compiler debug output for Zig IR - \\ --verbose-llvm-ir Enable compiler debug output for LLVM IR - \\ --verbose-cimport Enable compiler debug output for C imports - \\ --verbose-cc Enable compiler debug output for C compilation + \\ --build-file [file] Override path to build.zig + \\ --cache-dir [path] Override path to zig cache directory + \\ --override-lib-dir [arg] Override path to Zig lib directory + \\ --verbose-tokenize Enable compiler debug output for tokenization + \\ --verbose-ast Enable compiler debug output for parsing into an AST + \\ --verbose-link Enable compiler debug output for linking + \\ --verbose-ir Enable compiler debug output for Zig IR + \\ --verbose-llvm-ir Enable compiler debug output for LLVM IR + \\ --verbose-cimport Enable compiler debug output for C imports + \\ --verbose-cc Enable compiler debug output for C compilation + \\ --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features \\ ); } diff --git a/lib/std/special/c.zig b/lib/std/special/c.zig index 0a911ba52b..56ae3d0d8f 100644 --- a/lib/std/special/c.zig +++ b/lib/std/special/c.zig @@ -511,7 +511,7 @@ export fn roundf(a: f32) f32 { fn generic_fmod(comptime T: type, x: T, y: T) T { @setRuntimeSafety(false); - const uint = @IntType(false, T.bit_count); + const uint = std.meta.IntType(false, T.bit_count); const log2uint = math.Log2Int(uint); const digits = if (T == f32) 23 else 52; const exp_bits = if (T == f32) 9 else 12; diff --git a/lib/std/special/compiler_rt/addXf3.zig b/lib/std/special/compiler_rt/addXf3.zig index 4294752baa..8bb9751378 100644 --- a/lib/std/special/compiler_rt/addXf3.zig +++ b/lib/std/special/compiler_rt/addXf3.zig @@ -54,21 +54,21 @@ pub fn __aeabi_dsub(a: f64, b: f64) callconv(.AAPCS) f64 { } // TODO: restore inline keyword, see: https://github.com/ziglang/zig/issues/2154 -fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 { - const Z = @IntType(false, T.bit_count); - const S = @IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); +fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { + const Z = std.meta.IntType(false, T.bit_count); + const S = std.meta.IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); const significandBits = std.math.floatMantissaBits(T); const implicitBit = @as(Z, 1) << significandBits; - const shift = @clz(@IntType(false, T.bit_count), significand.*) - @clz(Z, implicitBit); + const shift = @clz(std.meta.IntType(false, T.bit_count), significand.*) - @clz(Z, implicitBit); significand.* <<= @intCast(S, shift); return 1 - shift; } // TODO: restore inline keyword, see: https://github.com/ziglang/zig/issues/2154 fn addXf3(comptime T: type, a: T, b: T) T { - const Z = @IntType(false, T.bit_count); - const S = @IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); + const Z = std.meta.IntType(false, T.bit_count); + const S = std.meta.IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); const typeWidth = T.bit_count; const significandBits = std.math.floatMantissaBits(T); @@ -182,7 +182,7 @@ fn addXf3(comptime T: type, a: T, b: T) T { // If partial cancellation occured, we need to left-shift the result // and adjust the exponent: if (aSignificand < implicitBit << 3) { - const shift = @intCast(i32, @clz(Z, aSignificand)) - @intCast(i32, @clz(@IntType(false, T.bit_count), implicitBit << 3)); + const shift = @intCast(i32, @clz(Z, aSignificand)) - @intCast(i32, @clz(std.meta.IntType(false, T.bit_count), implicitBit << 3)); aSignificand <<= @intCast(S, shift); aExponent -= shift; } diff --git a/lib/std/special/compiler_rt/compareXf2.zig b/lib/std/special/compiler_rt/compareXf2.zig index 15e49e3cc1..34871a5025 100644 --- a/lib/std/special/compiler_rt/compareXf2.zig +++ b/lib/std/special/compiler_rt/compareXf2.zig @@ -22,8 +22,8 @@ const GE = extern enum(i32) { pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT { @setRuntimeSafety(builtin.is_test); - const srep_t = @IntType(true, T.bit_count); - const rep_t = @IntType(false, T.bit_count); + const srep_t = std.meta.IntType(true, T.bit_count); + const rep_t = std.meta.IntType(false, T.bit_count); const significandBits = std.math.floatMantissaBits(T); const exponentBits = std.math.floatExponentBits(T); @@ -68,7 +68,7 @@ pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT { pub fn unordcmp(comptime T: type, a: T, b: T) i32 { @setRuntimeSafety(builtin.is_test); - const rep_t = @IntType(false, T.bit_count); + const rep_t = std.meta.IntType(false, T.bit_count); const significandBits = std.math.floatMantissaBits(T); const exponentBits = std.math.floatExponentBits(T); diff --git a/lib/std/special/compiler_rt/divdf3.zig b/lib/std/special/compiler_rt/divdf3.zig index f0c0d1247c..7e870feec9 100644 --- a/lib/std/special/compiler_rt/divdf3.zig +++ b/lib/std/special/compiler_rt/divdf3.zig @@ -7,8 +7,8 @@ const builtin = @import("builtin"); pub fn __divdf3(a: f64, b: f64) callconv(.C) f64 { @setRuntimeSafety(builtin.is_test); - const Z = @IntType(false, f64.bit_count); - const SignedZ = @IntType(true, f64.bit_count); + const Z = std.meta.IntType(false, f64.bit_count); + const SignedZ = std.meta.IntType(true, f64.bit_count); const typeWidth = f64.bit_count; const significandBits = std.math.floatMantissaBits(f64); @@ -312,9 +312,9 @@ fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void { } } -fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 { +fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { @setRuntimeSafety(builtin.is_test); - const Z = @IntType(false, T.bit_count); + const Z = std.meta.IntType(false, T.bit_count); const significandBits = std.math.floatMantissaBits(T); const implicitBit = @as(Z, 1) << significandBits; diff --git a/lib/std/special/compiler_rt/divsf3.zig b/lib/std/special/compiler_rt/divsf3.zig index e51f94e19d..0cb149a610 100644 --- a/lib/std/special/compiler_rt/divsf3.zig +++ b/lib/std/special/compiler_rt/divsf3.zig @@ -7,7 +7,7 @@ const builtin = @import("builtin"); pub fn __divsf3(a: f32, b: f32) callconv(.C) f32 { @setRuntimeSafety(builtin.is_test); - const Z = @IntType(false, f32.bit_count); + const Z = std.meta.IntType(false, f32.bit_count); const typeWidth = f32.bit_count; const significandBits = std.math.floatMantissaBits(f32); @@ -185,9 +185,9 @@ pub fn __divsf3(a: f32, b: f32) callconv(.C) f32 { } } -fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 { +fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { @setRuntimeSafety(builtin.is_test); - const Z = @IntType(false, T.bit_count); + const Z = std.meta.IntType(false, T.bit_count); const significandBits = std.math.floatMantissaBits(T); const implicitBit = @as(Z, 1) << significandBits; diff --git a/lib/std/special/compiler_rt/extendXfYf2.zig b/lib/std/special/compiler_rt/extendXfYf2.zig index 4e63d93ac5..58da88e586 100644 --- a/lib/std/special/compiler_rt/extendXfYf2.zig +++ b/lib/std/special/compiler_rt/extendXfYf2.zig @@ -30,11 +30,11 @@ pub fn __aeabi_f2d(arg: f32) callconv(.AAPCS) f64 { const CHAR_BIT = 8; -fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: @IntType(false, @typeInfo(src_t).Float.bits)) dst_t { +fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: std.meta.IntType(false, @typeInfo(src_t).Float.bits)) dst_t { @setRuntimeSafety(builtin.is_test); - const src_rep_t = @IntType(false, @typeInfo(src_t).Float.bits); - const dst_rep_t = @IntType(false, @typeInfo(dst_t).Float.bits); + const src_rep_t = std.meta.IntType(false, @typeInfo(src_t).Float.bits); + const dst_rep_t = std.meta.IntType(false, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t); const dstSigBits = std.math.floatMantissaBits(dst_t); const SrcShift = std.math.Log2Int(src_rep_t); diff --git a/lib/std/special/compiler_rt/fixint.zig b/lib/std/special/compiler_rt/fixint.zig index 426ee1d58a..3a401c1e6a 100644 --- a/lib/std/special/compiler_rt/fixint.zig +++ b/lib/std/special/compiler_rt/fixint.zig @@ -45,7 +45,7 @@ pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t { if (exponent < 0) return 0; // The unsigned result needs to be large enough to handle an fixint_t or rep_t - const fixuint_t = @IntType(false, fixint_t.bit_count); + const fixuint_t = std.meta.IntType(false, fixint_t.bit_count); const UintResultType = if (fixint_t.bit_count > rep_t.bit_count) fixuint_t else rep_t; var uint_result: UintResultType = undefined; diff --git a/lib/std/special/compiler_rt/fixuint.zig b/lib/std/special/compiler_rt/fixuint.zig index 977d3c16c9..d8e3e9a0e0 100644 --- a/lib/std/special/compiler_rt/fixuint.zig +++ b/lib/std/special/compiler_rt/fixuint.zig @@ -10,7 +10,7 @@ pub fn fixuint(comptime fp_t: type, comptime fixuint_t: type, a: fp_t) fixuint_t f128 => u128, else => unreachable, }; - const srep_t = @IntType(true, rep_t.bit_count); + const srep_t = @import("std").meta.IntType(true, rep_t.bit_count); const significandBits = switch (fp_t) { f32 => 23, f64 => 52, diff --git a/lib/std/special/compiler_rt/floatsiXf.zig b/lib/std/special/compiler_rt/floatsiXf.zig index ef3aba34d4..550a7ec246 100644 --- a/lib/std/special/compiler_rt/floatsiXf.zig +++ b/lib/std/special/compiler_rt/floatsiXf.zig @@ -5,8 +5,8 @@ const maxInt = std.math.maxInt; fn floatsiXf(comptime T: type, a: i32) T { @setRuntimeSafety(builtin.is_test); - const Z = @IntType(false, T.bit_count); - const S = @IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); + const Z = std.meta.IntType(false, T.bit_count); + const S = std.meta.IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); if (a == 0) { return @as(T, 0.0); diff --git a/lib/std/special/compiler_rt/mulXf3.zig b/lib/std/special/compiler_rt/mulXf3.zig index 103692f610..a40c0f1e70 100644 --- a/lib/std/special/compiler_rt/mulXf3.zig +++ b/lib/std/special/compiler_rt/mulXf3.zig @@ -28,7 +28,7 @@ pub fn __aeabi_dmul(a: f64, b: f64) callconv(.C) f64 { fn mulXf3(comptime T: type, a: T, b: T) T { @setRuntimeSafety(builtin.is_test); - const Z = @IntType(false, T.bit_count); + const Z = std.meta.IntType(false, T.bit_count); const typeWidth = T.bit_count; const significandBits = std.math.floatMantissaBits(T); @@ -264,9 +264,9 @@ fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void { } } -fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 { +fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { @setRuntimeSafety(builtin.is_test); - const Z = @IntType(false, T.bit_count); + const Z = std.meta.IntType(false, T.bit_count); const significandBits = std.math.floatMantissaBits(T); const implicitBit = @as(Z, 1) << significandBits; diff --git a/lib/std/special/compiler_rt/negXf2.zig b/lib/std/special/compiler_rt/negXf2.zig index c41b1b48d7..d1038d6456 100644 --- a/lib/std/special/compiler_rt/negXf2.zig +++ b/lib/std/special/compiler_rt/negXf2.zig @@ -19,7 +19,7 @@ pub fn __aeabi_dneg(arg: f64) callconv(.AAPCS) f64 { } fn negXf2(comptime T: type, a: T) T { - const Z = @IntType(false, T.bit_count); + const Z = std.meta.IntType(false, T.bit_count); const typeWidth = T.bit_count; const significandBits = std.math.floatMantissaBits(T); diff --git a/lib/std/special/compiler_rt/truncXfYf2.zig b/lib/std/special/compiler_rt/truncXfYf2.zig index 0a09dea84c..7c83c66ec0 100644 --- a/lib/std/special/compiler_rt/truncXfYf2.zig +++ b/lib/std/special/compiler_rt/truncXfYf2.zig @@ -36,8 +36,8 @@ pub fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 { } inline fn truncXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { - const src_rep_t = @IntType(false, @typeInfo(src_t).Float.bits); - const dst_rep_t = @IntType(false, @typeInfo(dst_t).Float.bits); + const src_rep_t = std.meta.IntType(false, @typeInfo(src_t).Float.bits); + const dst_rep_t = std.meta.IntType(false, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t); const dstSigBits = std.math.floatMantissaBits(dst_t); const SrcShift = std.math.Log2Int(src_rep_t); diff --git a/lib/std/special/compiler_rt/udivmod.zig b/lib/std/special/compiler_rt/udivmod.zig index 96fb7b3bdd..1cf2589b16 100644 --- a/lib/std/special/compiler_rt/udivmod.zig +++ b/lib/std/special/compiler_rt/udivmod.zig @@ -10,8 +10,8 @@ const high = 1 - low; pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem: ?*DoubleInt) DoubleInt { @setRuntimeSafety(is_test); - const SingleInt = @IntType(false, @divExact(DoubleInt.bit_count, 2)); - const SignedDoubleInt = @IntType(true, DoubleInt.bit_count); + const SingleInt = @import("std").meta.IntType(false, @divExact(DoubleInt.bit_count, 2)); + const SignedDoubleInt = @import("std").meta.IntType(true, DoubleInt.bit_count); const Log2SingleInt = @import("std").math.Log2Int(SingleInt); const n = @ptrCast(*const [2]SingleInt, &a).*; // TODO issue #421 |
