authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-19 17:22:10-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-20 17:26:50-07:00
logae4e835a662a3b8c512511b87f4a44065e26dbb7
tree2a75f550d6dd41a9d863daab5871d7346ddc16a4
parent6c25d2bd58e4b5a002a7d1cd2882dd4e7ef23b6f

std.lang: rename OptimizeMode to Optimize

and remove "release" from the enum tag names. no functional change, however, despite the addition of backwards-compatibile declarations in this patch, it is breaking because expressions that use `==` or `!=` operators will not able to use the deprecated names. I predict these names to survive until the 1.0 tag without any more breakage.

86 files changed, 470 insertions(+), 423 deletions(-)

build.zig+8-8
...@@ -207,7 +207,7 @@ pub fn build(b: *std.Build) !void {...@@ -207,7 +207,7 @@ pub fn build(b: *std.Build) !void {
207207
208 const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: {208 const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: {
209 if (strip == true) break :blk @as(u32, 0);209 if (strip == true) break :blk @as(u32, 0);
210 if (optimize != .Debug) break :blk 0;210 if (optimize != .debug) break :blk 0;
211 break :blk 4;211 break :blk 4;
212 };212 };
213213
...@@ -256,7 +256,7 @@ pub fn build(b: *std.Build) !void {...@@ -256,7 +256,7 @@ pub fn build(b: *std.Build) !void {
256 exe.root_module.link_libc = true;256 exe.root_module.link_libc = true;
257 }257 }
258258
259 const is_debug = optimize == .Debug;259 const is_debug = optimize == .debug;
260 const enable_debug_extensions = b.option(bool, "debug-extensions", "Enable commands and options useful for debugging the compiler") orelse is_debug;260 const enable_debug_extensions = b.option(bool, "debug-extensions", "Enable commands and options useful for debugging the compiler") orelse is_debug;
261 const enable_logging = b.option(bool, "log", "Enable debug logging with --debug-log") orelse is_debug;261 const enable_logging = b.option(bool, "log", "Enable debug logging with --debug-log") orelse is_debug;
262262
...@@ -403,8 +403,8 @@ pub fn build(b: *std.Build) !void {...@@ -403,8 +403,8 @@ pub fn build(b: *std.Build) !void {
403 if (tracy) |tracy_dir| {403 if (tracy) |tracy_dir| {
404 const tracy_mod = b.createModule(.{404 const tracy_mod = b.createModule(.{
405 .target = target,405 .target = target,
406 // Always build Tracy in ReleaseFast so that it doesn't make Debug compiler builds unusable.406 // Always build Tracy in ReleaseFast so that it doesn't make -Odebug compiler builds unusable.
407 .optimize = .ReleaseFast,407 .optimize = .fast,
408 .root_source_file = null,408 .root_source_file = null,
409 .link_libc = true,409 .link_libc = true,
410 .link_libcpp = true,410 .link_libcpp = true,
...@@ -434,19 +434,19 @@ pub fn build(b: *std.Build) !void {...@@ -434,19 +434,19 @@ pub fn build(b: *std.Build) !void {
434 var chosen_opt_modes_buf: [4]std.lang.OptimizeMode = undefined;434 var chosen_opt_modes_buf: [4]std.lang.OptimizeMode = undefined;
435 var chosen_mode_index: usize = 0;435 var chosen_mode_index: usize = 0;
436 if (!skip_debug) {436 if (!skip_debug) {
437 chosen_opt_modes_buf[chosen_mode_index] = .Debug;437 chosen_opt_modes_buf[chosen_mode_index] = .debug;
438 chosen_mode_index += 1;438 chosen_mode_index += 1;
439 }439 }
440 if (!skip_release_safe) {440 if (!skip_release_safe) {
441 chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSafe;441 chosen_opt_modes_buf[chosen_mode_index] = .safe;
442 chosen_mode_index += 1;442 chosen_mode_index += 1;
443 }443 }
444 if (!skip_release_fast) {444 if (!skip_release_fast) {
445 chosen_opt_modes_buf[chosen_mode_index] = .ReleaseFast;445 chosen_opt_modes_buf[chosen_mode_index] = .fast;
446 chosen_mode_index += 1;446 chosen_mode_index += 1;
447 }447 }
448 if (!skip_release_small) {448 if (!skip_release_small) {
449 chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSmall;449 chosen_opt_modes_buf[chosen_mode_index] = .small;
450 chosen_mode_index += 1;450 chosen_mode_index += 1;
451 }451 }
452 const optimize_modes = chosen_opt_modes_buf[0..chosen_mode_index];452 const optimize_modes = chosen_opt_modes_buf[0..chosen_mode_index];
lib/c/malloc.zig+2-2
...@@ -59,8 +59,8 @@ const Header = packed struct(u64) {...@@ -59,8 +59,8 @@ const Header = packed struct(u64) {
59 }59 }
6060
61 const safety = switch (builtin.mode) {61 const safety = switch (builtin.mode) {
62 .Debug, .ReleaseSafe => true,62 .debug, .safe => true,
63 .ReleaseFast, .ReleaseSmall => false,63 .fast, .small => false,
64 };64 };
65 const max_addr_bits = switch (safety) {65 const max_addr_bits = switch (safety) {
66 true => 48, // Ensures space for Canary bits.66 true => 48, // Ensures space for Canary bits.
lib/compiler/Maker.zig+3-3
...@@ -69,10 +69,10 @@ var debug_maker_leaks: bool = false;...@@ -69,10 +69,10 @@ var debug_maker_leaks: bool = false;
6969
70const AvoidableWebServer = if (builtin.single_threaded) void else WebServer;70const AvoidableWebServer = if (builtin.single_threaded) void else WebServer;
7171
72const is_debug_mode = builtin.mode == .Debug;72const is_debug_mode = builtin.mode == .debug;
73const use_safe_allocator = switch (builtin.mode) {73const use_safe_allocator = switch (builtin.mode) {
74 .Debug, .ReleaseSafe => true,74 .debug, .safe => true,
75 .ReleaseFast, .ReleaseSmall => false,75 .fast, .small => false,
76};76};
7777
78const InstallPaths = struct {78const InstallPaths = struct {
lib/compiler/Maker/Step/TranslateC.zig+3-3
...@@ -49,9 +49,9 @@ pub fn make(...@@ -49,9 +49,9 @@ pub fn make(
4949
50 const opt: ?OptimizeMode = switch (conf_tc.flags.optimize) {50 const opt: ?OptimizeMode = switch (conf_tc.flags.optimize) {
51 .debug, .default => null, // Skip since it's the default51 .debug, .default => null, // Skip since it's the default
52 .safe => .ReleaseSafe,52 .safe => .safe,
53 .fast => .ReleaseFast,53 .fast => .fast,
54 .small => .ReleaseSmall,54 .small => .small,
55 };55 };
56 if (opt) |o| argv.appendAssumeCapacity(try arena.print("-O{t}", .{o}));56 if (opt) |o| argv.appendAssumeCapacity(try arena.print("-O{t}", .{o}));
5757
lib/compiler/Maker/WebServer.zig+1-1
...@@ -501,7 +501,7 @@ fn serveRequest(ws: *WebServer, req: *http.Server.Request) !void {...@@ -501,7 +501,7 @@ fn serveRequest(ws: *WebServer, req: *http.Server.Request) !void {
501 if (mem.eql(u8, target, "/main.js")) return serveLibFile(ws, req, "build-web/main.js", "application/javascript");501 if (mem.eql(u8, target, "/main.js")) return serveLibFile(ws, req, "build-web/main.js", "application/javascript");
502 if (mem.eql(u8, target, "/style.css")) return serveLibFile(ws, req, "build-web/style.css", "text/css");502 if (mem.eql(u8, target, "/style.css")) return serveLibFile(ws, req, "build-web/style.css", "text/css");
503 if (mem.eql(u8, target, "/time_report.css")) return serveLibFile(ws, req, "build-web/time_report.css", "text/css");503 if (mem.eql(u8, target, "/time_report.css")) return serveLibFile(ws, req, "build-web/time_report.css", "text/css");
504 if (mem.eql(u8, target, "/main.wasm")) return serveClientWasm(ws, req, if (debug) .Debug else .ReleaseFast);504 if (mem.eql(u8, target, "/main.wasm")) return serveClientWasm(ws, req, if (debug) .debug else .fast);
505505
506 if (ws.fuzz) |*fuzz| {506 if (ws.fuzz) |*fuzz| {
507 if (mem.eql(u8, target, "/sources.tar")) return fuzz.serveSourcesTar(req);507 if (mem.eql(u8, target, "/sources.tar")) return fuzz.serveSourcesTar(req);
lib/compiler/aro/aro/Diagnostics.zig+1-1
...@@ -510,7 +510,7 @@ pub fn formatArgs(w: *std.Io.Writer, fmt: []const u8, args: anytype) std.Io.Writ...@@ -510,7 +510,7 @@ pub fn formatArgs(w: *std.Io.Writer, fmt: []const u8, args: anytype) std.Io.Writ
510510
511pub fn templateIndex(w: *std.Io.Writer, fmt: []const u8, template: []const u8) std.Io.Writer.Error!usize {511pub fn templateIndex(w: *std.Io.Writer, fmt: []const u8, template: []const u8) std.Io.Writer.Error!usize {
512 const i = std.mem.indexOf(u8, fmt, template) orelse {512 const i = std.mem.indexOf(u8, fmt, template) orelse {
513 if (@import("builtin").mode == .Debug) {513 if (@import("builtin").mode == .debug) {
514 std.debug.panic("template `{s}` not found in format string `{s}`", .{ template, fmt });514 std.debug.panic("template `{s}` not found in format string `{s}`", .{ template, fmt });
515 }515 }
516 try w.print("template `{s}` not found in format string `{s}` (this is a bug in arocc)", .{ template, fmt });516 try w.print("template `{s}` not found in format string `{s}` (this is a bug in arocc)", .{ template, fmt });
lib/compiler/aro/main.zig+1-1
...@@ -40,7 +40,7 @@ pub fn main(init: process.Init.Minimal) u8 {...@@ -40,7 +40,7 @@ pub fn main(init: process.Init.Minimal) u8 {
40 defer threaded.deinit();40 defer threaded.deinit();
41 const io = threaded.io();41 const io = threaded.io();
4242
43 const fast_exit = @import("builtin").mode != .Debug;43 const fast_exit = @import("builtin").mode != .debug;
4444
45 const args = init.args.toSlice(arena) catch {45 const args = init.args.toSlice(arena) catch {
46 std.debug.print("out of memory\n", .{});46 std.debug.print("out of memory\n", .{});
lib/compiler/std-docs.zig+2-2
...@@ -142,9 +142,9 @@ fn serveRequest(request: *std.http.Server.Request, context: *Context) !void {...@@ -142,9 +142,9 @@ fn serveRequest(request: *std.http.Server.Request, context: *Context) !void {
142 {142 {
143 try serveDocsFile(request, context, "docs/main.js", "application/javascript");143 try serveDocsFile(request, context, "docs/main.js", "application/javascript");
144 } else if (std.mem.eql(u8, request.head.target, "/main.wasm")) {144 } else if (std.mem.eql(u8, request.head.target, "/main.wasm")) {
145 try serveWasm(request, context, .ReleaseFast);145 try serveWasm(request, context, .fast);
146 } else if (std.mem.eql(u8, request.head.target, "/debug/main.wasm")) {146 } else if (std.mem.eql(u8, request.head.target, "/debug/main.wasm")) {
147 try serveWasm(request, context, .Debug);147 try serveWasm(request, context, .debug);
148 } else if (std.mem.eql(u8, request.head.target, "/sources.tar") or148 } else if (std.mem.eql(u8, request.head.target, "/sources.tar") or
149 std.mem.eql(u8, request.head.target, "/debug/sources.tar"))149 std.mem.eql(u8, request.head.target, "/debug/sources.tar"))
150 {150 {
lib/compiler/translate-c/main.zig+1-1
...@@ -9,7 +9,7 @@ const compiler_util = @import("../util.zig");...@@ -9,7 +9,7 @@ const compiler_util = @import("../util.zig");
99
10const Translator = @import("Translator.zig");10const Translator = @import("Translator.zig");
1111
12const fast_exit = @import("builtin").mode != .Debug;12const fast_exit = @import("builtin").mode != .debug;
1313
14pub fn main(init: process.Init) u8 {14pub fn main(init: process.Init) u8 {
15 const gpa = init.gpa;15 const gpa = init.gpa;
lib/compiler_rt/memcpy.zig+1-1
...@@ -11,7 +11,7 @@ comptime {...@@ -11,7 +11,7 @@ comptime {
11 .visibility = compiler_rt.visibility,11 .visibility = compiler_rt.visibility,
12 };12 };
1313
14 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)14 if (builtin.mode == .small or builtin.zig_backend == .stage2_aarch64)
15 @export(&memcpySmall, export_options)15 @export(&memcpySmall, export_options)
16 else16 else
17 @export(&memcpyFast, export_options);17 @export(&memcpyFast, export_options);
lib/compiler_rt/memmove.zig+1-1
...@@ -14,7 +14,7 @@ comptime {...@@ -14,7 +14,7 @@ comptime {
14 .visibility = compiler_rt.visibility,14 .visibility = compiler_rt.visibility,
15 };15 };
1616
17 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)17 if (builtin.mode == .small or builtin.zig_backend == .stage2_aarch64)
18 @export(&memmoveSmall, export_options)18 @export(&memmoveSmall, export_options)
19 else19 else
20 @export(&memmoveFast, export_options);20 @export(&memmoveFast, export_options);
lib/docs/wasm/markdown/Document.zig+1-1
...@@ -108,7 +108,7 @@ pub const Node = struct {...@@ -108,7 +108,7 @@ pub const Node = struct {
108 // In Debug and ReleaseSafe builds, there may be hidden extra fields108 // In Debug and ReleaseSafe builds, there may be hidden extra fields
109 // included for safety checks. Without such safety checks enabled,109 // included for safety checks. Without such safety checks enabled,
110 // we always want this union to be 8 bytes.110 // we always want this union to be 8 bytes.
111 if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {111 if (builtin.mode != .debug and builtin.mode != .safe) {
112 assert(@sizeOf(Data) == 8);112 assert(@sizeOf(Data) == 8);
113 }113 }
114 }114 }
lib/fuzzer.zig+3-3
...@@ -41,8 +41,8 @@ fn logOverride(...@@ -41,8 +41,8 @@ fn logOverride(
4141
42var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});42var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});
43const gpa = switch (builtin.mode) {43const gpa = switch (builtin.mode) {
44 .Debug, .ReleaseSafe => safe_allocator.allocator(),44 .debug, .safe => safe_allocator.allocator(),
45 .ReleaseFast, .ReleaseSmall => std.heap.smp_allocator,45 .fast, .small => std.heap.smp_allocator,
46};46};
4747
48// Seperate from `exec` to allow initialization before `exec` is.48// Seperate from `exec` to allow initialization before `exec` is.
...@@ -1209,7 +1209,7 @@ const Fuzzer = struct {...@@ -1209,7 +1209,7 @@ const Fuzzer = struct {
1209 f.req_bytes = @intCast(f.input_builder.bytes_table.items.len);1209 f.req_bytes = @intCast(f.input_builder.bytes_table.items.len);
1210 const quality: Input.Best.Quality = .{1210 const quality: Input.Best.Quality = .{
1211 .n_pcs = n_pcs: {1211 .n_pcs = n_pcs: {
1212 @setRuntimeSafety(builtin.mode == .Debug); // Necessary for vectorization1212 @setRuntimeSafety(builtin.mode == .debug); // Necessary for vectorization
1213 var n: u32 = 0;1213 var n: u32 = 0;
1214 for (exec.pc_counters) |c| {1214 for (exec.pc_counters) |c| {
1215 n += @intFromBool(c != 0);1215 n += @intFromBool(c != 0);
lib/std/Build.zig+38-22
...@@ -1210,13 +1210,16 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw...@@ -1210,13 +1210,16 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
1210 return null;1210 return null;
1211 },1211 },
1212 .scalar => |s| {1212 .scalar => |s| {
1213 if (std.meta.stringToEnum(T, s)) |enum_lit| {1213 if (T == std.lang.Optimize) {
1214 return enum_lit;1214 if (std.lang.Optimize.fromString(s)) |tag| {
1215 } else {1215 return tag;
1216 log.err("expected -D{s} to be of type {s}", .{ name, @typeName(T) });1216 }
1217 b.markInvalidUserInput();1217 } else if (std.meta.stringToEnum(T, s)) |tag| {
1218 return null;1218 return tag;
1219 }1219 }
1220 log.err("expected -D{s} to be of type {q}", .{ name, @typeName(T) });
1221 b.markInvalidUserInput();
1222 return null;
1220 },1223 },
1221 },1224 },
1222 .string => switch (option_ptr.value) {1225 .string => switch (option_ptr.value) {
...@@ -1262,23 +1265,36 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw...@@ -1262,23 +1265,36 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
1262 },1265 },
1263 .scalar => |s| {1266 .scalar => |s| {
1264 const Child = @typeInfo(T).pointer.child;1267 const Child = @typeInfo(T).pointer.child;
1265 const value = std.meta.stringToEnum(Child, s) orelse {1268 if (Child == std.lang.Optimize) {
1266 log.err("expected -D{s} to be of type {s}", .{ name, @typeName(Child) });1269 if (std.lang.Optimize.fromString(s)) |tag| {
1267 b.markInvalidUserInput();1270 return arena.dupe(Child, &.{tag}) catch @panic("OOM");
1268 return null;1271 }
1269 };1272 } else {
1270 return arena.dupe(Child, &[_]Child{value}) catch @panic("OOM");1273 if (std.meta.stringToEnum(Child, s)) |tag| {
1274 return arena.dupe(Child, &.{tag}) catch @panic("OOM");
1275 }
1276 }
1277 log.err("expected -D{s} to be of type {q}", .{ name, @typeName(Child) });
1278 b.markInvalidUserInput();
1279 return null;
1271 },1280 },
1272 .list => |lst| {1281 .list => |lst| {
1273 const Child = @typeInfo(T).pointer.child;1282 const Child = @typeInfo(T).pointer.child;
1274 const new_list = graph.alloc(Child, lst.items.len);1283 const new_list = graph.alloc(Child, lst.items.len);
1275 for (new_list, lst.items) |*new_item, str| {1284 for (new_list, lst.items) |*new_item, str| {
1276 new_item.* = std.meta.stringToEnum(Child, str) orelse {1285 if (Child == std.lang.Optimize) {
1277 log.err("expected -D{s} to be of type {s}", .{ name, @typeName(Child) });1286 if (std.lang.Optimize.fromString(str)) |tag| {
1278 b.markInvalidUserInput();1287 new_item.* = tag;
1279 arena.free(new_list);1288 continue;
1280 return null;1289 }
1281 };1290 }
1291 if (std.meta.stringToEnum(Child, str)) |tag| {
1292 new_item.* = tag;
1293 continue;
1294 }
1295 log.err("expected -D{s} to be of type {q}", .{ name, @typeName(Child) });
1296 b.markInvalidUserInput();
1297 return null;
1282 }1298 }
1283 return new_list;1299 return new_list;
1284 },1300 },
...@@ -1359,14 +1375,14 @@ pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions)...@@ -1359,14 +1375,14 @@ pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions)
1359 }1375 }
13601376
1361 return switch (graph.release_mode) {1377 return switch (graph.release_mode) {
1362 .off => .Debug,1378 .off => .debug,
1363 .any => {1379 .any => {
1364 std.debug.print("the project does not declare a preferred optimization mode. choose: --release=fast, --release=safe, or --release=small\n", .{});1380 std.debug.print("the project does not declare a preferred optimization mode. choose: --release=fast, --release=safe, or --release=small\n", .{});
1365 process.exit(1);1381 process.exit(1);
1366 },1382 },
1367 .fast => .ReleaseFast,1383 .fast => .fast,
1368 .safe => .ReleaseSafe,1384 .safe => .safe,
1369 .small => .ReleaseSmall,1385 .small => .small,
1370 };1386 };
1371}1387}
13721388
lib/std/Build/Configuration.zig+4-4
...@@ -1655,10 +1655,10 @@ pub const Module = struct {...@@ -1655,10 +1655,10 @@ pub const Module = struct {
16551655
1656 pub fn init(o: ?std.builtin.OptimizeMode) Optimize {1656 pub fn init(o: ?std.builtin.OptimizeMode) Optimize {
1657 return switch (o orelse return .default) {1657 return switch (o orelse return .default) {
1658 .Debug => .debug,1658 .debug => .debug,
1659 .ReleaseSafe => .safe,1659 .safe => .safe,
1660 .ReleaseFast => .fast,1660 .fast => .fast,
1661 .ReleaseSmall => .small,1661 .small => .small,
1662 };1662 };
1663 }1663 }
1664 };1664 };
lib/std/Build/Step/Compile.zig+2-2
...@@ -390,7 +390,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {...@@ -390,7 +390,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
390 @tagName(options.kind)390 @tagName(options.kind)
391 else391 else
392 owner.fmt("{t} {s}", .{ options.kind, name }),392 owner.fmt("{t} {s}", .{ options.kind, name }),
393 @tagName(options.root_module.optimize orelse .Debug),393 @tagName(options.root_module.optimize orelse .debug),
394 resolved_target.query.zigTriple(arena) catch @panic("OOM"),394 resolved_target.query.zigTriple(arena) catch @panic("OOM"),
395 });395 });
396396
...@@ -645,7 +645,7 @@ pub fn producesPdbFile(compile: *Compile) bool {...@@ -645,7 +645,7 @@ pub fn producesPdbFile(compile: *Compile) bool {
645 if (target.ofmt == .c) return false;645 if (target.ofmt == .c) return false;
646 if (compile.use_llvm == false) return false;646 if (compile.use_llvm == false) return false;
647 if (compile.root_module.strip == true or647 if (compile.root_module.strip == true or
648 (compile.root_module.strip == null and compile.root_module.optimize == .ReleaseSmall))648 (compile.root_module.strip == null and compile.root_module.optimize == .small))
649 {649 {
650 return false;650 return false;
651 }651 }
lib/std/Io/Dispatch.zig+1-1
...@@ -3897,7 +3897,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {...@@ -3897,7 +3897,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {
3897 if (memory.len == 0) return;3897 if (memory.len == 0) return;
3898 switch (c.errno(c.munmap(memory.ptr, memory.len))) {3898 switch (c.errno(c.munmap(memory.ptr, memory.len))) {
3899 .SUCCESS => {},3899 .SUCCESS => {},
3900 else => |err| if (builtin.mode == .Debug)3900 else => |err| if (builtin.mode == .debug)
3901 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }),3901 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }),
3902 }3902 }
3903 mm.* = undefined;3903 mm.* = undefined;
lib/std/Io/Threaded.zig+6-6
...@@ -4,7 +4,7 @@ const builtin = @import("builtin");...@@ -4,7 +4,7 @@ const builtin = @import("builtin");
4const native_os = builtin.os.tag;4const native_os = builtin.os.tag;
5const is_windows = native_os == .windows;5const is_windows = native_os == .windows;
6const is_darwin = native_os.isDarwin();6const is_darwin = native_os.isDarwin();
7const is_debug = builtin.mode == .Debug;7const is_debug = builtin.mode == .debug;
88
9const std = @import("../std.zig");9const std = @import("../std.zig");
10const Io = std.Io;10const Io = std.Io;
...@@ -440,12 +440,12 @@ pub const UseFchmodat2 = if (have_fchmodat2 and !have_fchmodat_flags) enum {...@@ -440,12 +440,12 @@ pub const UseFchmodat2 = if (have_fchmodat2 and !have_fchmodat_flags) enum {
440pub const apc_align = @max(default_fn_align, 2);440pub const apc_align = @max(default_fn_align, 2);
441441
442const default_fn_align = switch (builtin.mode) {442const default_fn_align = switch (builtin.mode) {
443 .Debug, .ReleaseSafe, .ReleaseFast => switch (builtin.cpu.arch) {443 .debug, .safe, .fast => switch (builtin.cpu.arch) {
444 else => |arch| @compileError("Unsupported architecture: " ++ @tagName(arch)),444 else => |arch| @compileError("Unsupported architecture: " ++ @tagName(arch)),
445 .arm, .thumb => 4,445 .arm, .thumb => 4,
446 .aarch64, .x86, .x86_64 => 16,446 .aarch64, .x86, .x86_64 => 16,
447 },447 },
448 .ReleaseSmall => 1,448 .small => 1,
449};449};
450450
451const Runnable = struct {451const Runnable = struct {
...@@ -18172,7 +18172,7 @@ fn fileMemoryMapCreate(...@@ -18172,7 +18172,7 @@ fn fileMemoryMapCreate(
18172 error.Unseekable, error.Canceled, error.AccessDenied => |e| return e,18172 error.Unseekable, error.Canceled, error.AccessDenied => |e| return e,
18173 error.OperationUnsupported => {},18173 error.OperationUnsupported => {},
18174 else => {18174 else => {
18175 if (builtin.mode == .Debug)18175 if (builtin.mode == .debug)
18176 std.log.warn("memory mapping failed with {t}, falling back to file operations", .{err});18176 std.log.warn("memory mapping failed with {t}, falling back to file operations", .{err});
18177 },18177 },
18178 }18178 }
...@@ -18279,7 +18279,7 @@ fn createFileMap(...@@ -18279,7 +18279,7 @@ fn createFileMap(
18279 .INVALID_VIEW_SIZE => |status| return windows.statusBug(status),18279 .INVALID_VIEW_SIZE => |status| return windows.statusBug(status),
18280 else => |status| return windows.unexpectedStatus(status),18280 else => |status| return windows.unexpectedStatus(status),
18281 }18281 }
18282 if (builtin.mode == .Debug) {18282 if (builtin.mode == .debug) {
18283 const page_size = std.heap.pageSize();18283 const page_size = std.heap.pageSize();
18284 const alignment: Alignment = .fromByteUnits(page_size);18284 const alignment: Alignment = .fromByteUnits(page_size);
18285 assert(contents_len == alignment.forward(len));18285 assert(contents_len == alignment.forward(len));
...@@ -18370,7 +18370,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {...@@ -18370,7 +18370,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {
18370 switch (posix.errno(posix.system.munmap(memory.ptr, memory.len))) {18370 switch (posix.errno(posix.system.munmap(memory.ptr, memory.len))) {
18371 .SUCCESS => {},18371 .SUCCESS => {},
18372 else => |e| {18372 else => |e| {
18373 if (builtin.mode == .Debug)18373 if (builtin.mode == .debug)
18374 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, e });18374 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, e });
18375 },18375 },
18376 }18376 }
lib/std/Io/Uring.zig+1-1
...@@ -4050,7 +4050,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {...@@ -4050,7 +4050,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {
4050 if (memory.len == 0) return;4050 if (memory.len == 0) return;
4051 switch (linux.errno(linux.munmap(memory.ptr, memory.len))) {4051 switch (linux.errno(linux.munmap(memory.ptr, memory.len))) {
4052 .SUCCESS => {},4052 .SUCCESS => {},
4053 else => |err| if (builtin.mode == .Debug)4053 else => |err| if (builtin.mode == .debug)
4054 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }),4054 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }),
4055 }4055 }
4056 mm.* = undefined;4056 mm.* = undefined;
lib/std/Random/benchmark.zig+1-1
...@@ -122,7 +122,7 @@ fn usage() void {...@@ -122,7 +122,7 @@ fn usage() void {
122}122}
123123
124fn mode(comptime x: comptime_int) comptime_int {124fn mode(comptime x: comptime_int) comptime_int {
125 return if (builtin.mode == .Debug) x / 64 else x;125 return if (builtin.mode == .debug) x / 64 else x;
126}126}
127127
128pub fn main(init: std.process.Init) !void {128pub fn main(init: std.process.Init) !void {
lib/std/c/darwin/dispatch.zig+2-2
...@@ -44,8 +44,8 @@ pub const once_t = enum(isize) {...@@ -44,8 +44,8 @@ pub const once_t = enum(isize) {
44 once_f(predicate, context, function);44 once_f(predicate, context, function);
45 } else asm volatile ("" ::: .{ .memory = true });45 } else asm volatile ("" ::: .{ .memory = true });
46 switch (builtin.mode) {46 switch (builtin.mode) {
47 .Debug, .ReleaseSafe => {},47 .debug, .safe => {},
48 .ReleaseFast, .ReleaseSmall => if (predicate.* != .done) unreachable,48 .fast, .small => if (predicate.* != .done) unreachable,
49 }49 }
50 }50 }
51};51};
lib/std/compress/flate/Compress.zig+1-1
...@@ -738,7 +738,7 @@ fn matchAndAddHash(c: *Compress, i: usize, h: Hash, gt: u16, max_chain: u16, goo...@@ -738,7 +738,7 @@ fn matchAndAddHash(c: *Compress, i: usize, h: Hash, gt: u16, max_chain: u16, goo
738738
739fn clenHlen(freqs: [19]u16) u4 {739fn clenHlen(freqs: [19]u16) u4 {
740 // Note that the first four codes (16, 17, 18, and 0) are always present.740 // Note that the first four codes (16, 17, 18, and 0) are always present.
741 if (builtin.mode != .ReleaseSmall and (std.simd.suggestVectorLength(u16) orelse 1) >= 8) {741 if (builtin.mode != .small and (std.simd.suggestVectorLength(u16) orelse 1) >= 8) {
742 const V = @Vector(16, u16);742 const V = @Vector(16, u16);
743 const hlen_mul: V = comptime m: {743 const hlen_mul: V = comptime m: {
744 var hlen_mul: [16]u16 = undefined;744 var hlen_mul: [16]u16 = undefined;
lib/std/compress/flate/token.zig+3-3
...@@ -57,9 +57,9 @@ const fixed_dist = blk: {...@@ -57,9 +57,9 @@ const fixed_dist = blk: {
57};57};
5858
59// All paramters of codes can be derived matchematically, however some are faster to59// All paramters of codes can be derived matchematically, however some are faster to
60// do via lookup table. For ReleaseSmall, we do all mathematically to save space.60// do via lookup table. For -Osmall, we do all mathematically to save space.
61pub const LenCode = if (builtin.mode != .ReleaseSmall) LookupLenCode else ShortLenCode;61pub const LenCode = if (builtin.mode != .small) LookupLenCode else ShortLenCode;
62pub const DistCode = if (builtin.mode != .ReleaseSmall) LookupDistCode else ShortDistCode;62pub const DistCode = if (builtin.mode != .small) LookupDistCode else ShortDistCode;
63const ShortLenCode = ShortCode(u8, u2, u3, true);63const ShortLenCode = ShortCode(u8, u2, u3, true);
64const ShortDistCode = ShortCode(u15, u1, u4, false);64const ShortDistCode = ShortCode(u15, u1, u4, false);
65/// For length and distance codes, they having this format.65/// For length and distance codes, they having this format.
lib/std/crypto/25519/field.zig+2-2
...@@ -7,8 +7,8 @@ const NotSquareError = crypto.errors.NotSquareError;...@@ -7,8 +7,8 @@ const NotSquareError = crypto.errors.NotSquareError;
77
8// Inline conditionally, when it can result in large code generation.8// Inline conditionally, when it can result in large code generation.
9const bloaty_inline: std.builtin.CallingConvention = switch (builtin.mode) {9const bloaty_inline: std.builtin.CallingConvention = switch (builtin.mode) {
10 .ReleaseSafe, .ReleaseFast => .@"inline",10 .safe, .fast => .@"inline",
11 .Debug, .ReleaseSmall => .auto,11 .debug, .small => .auto,
12};12};
1313
14pub const Fe = struct {14pub const Fe = struct {
lib/std/crypto/benchmark.zig+1-1
...@@ -493,7 +493,7 @@ fn usage() void {...@@ -493,7 +493,7 @@ fn usage() void {
493}493}
494494
495fn mode(comptime x: comptime_int) comptime_int {495fn mode(comptime x: comptime_int) comptime_int {
496 return if (builtin.mode == .Debug) x / 64 else x;496 return if (builtin.mode == .debug) x / 64 else x;
497}497}
498498
499pub fn main(init: std.process.Init) !void {499pub fn main(init: std.process.Init) !void {
lib/std/crypto/ghash_polyval.zig+5-5
...@@ -30,7 +30,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {...@@ -30,7 +30,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
30 pub const mac_length = 16;30 pub const mac_length = 16;
31 pub const key_length = 16;31 pub const key_length = 16;
3232
33 const pc_count = if (builtin.mode != .ReleaseSmall) 16 else 2;33 const pc_count = if (builtin.mode != .small) 16 else 2;
34 const agg_4_threshold = 22;34 const agg_4_threshold = 22;
35 const agg_8_threshold = 84;35 const agg_8_threshold = 84;
36 const agg_16_threshold = 328;36 const agg_16_threshold = 328;
...@@ -61,7 +61,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {...@@ -61,7 +61,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
61 hx[0] = h;61 hx[0] = h;
62 hx[1] = reduce(clsq128(hx[0])); // h^262 hx[1] = reduce(clsq128(hx[0])); // h^2
6363
64 if (builtin.mode != .ReleaseSmall) {64 if (builtin.mode != .small) {
65 hx[2] = reduce(clmul128(hx[1], h)); // h^365 hx[2] = reduce(clmul128(hx[1], h)); // h^3
66 hx[3] = reduce(clsq128(hx[1])); // h^4 = h^2^266 hx[3] = reduce(clsq128(hx[1])); // h^4 = h^2^2
67 if (block_count >= agg_8_threshold) {67 if (block_count >= agg_8_threshold) {
...@@ -303,7 +303,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {...@@ -303,7 +303,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
303303
304 var i: usize = 0;304 var i: usize = 0;
305305
306 if (builtin.mode != .ReleaseSmall and msg.len >= agg_16_threshold * block_length) {306 if (builtin.mode != .small and msg.len >= agg_16_threshold * block_length) {
307 // 16-blocks aggregated reduction307 // 16-blocks aggregated reduction
308 while (i + 256 <= msg.len) : (i += 256) {308 while (i + 256 <= msg.len) : (i += 256) {
309 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[15 - 0]);309 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[15 - 0]);
...@@ -313,7 +313,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {...@@ -313,7 +313,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
313 }313 }
314 acc = reduce(u);314 acc = reduce(u);
315 }315 }
316 } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_8_threshold * block_length) {316 } else if (builtin.mode != .small and msg.len >= agg_8_threshold * block_length) {
317 // 8-blocks aggregated reduction317 // 8-blocks aggregated reduction
318 while (i + 128 <= msg.len) : (i += 128) {318 while (i + 128 <= msg.len) : (i += 128) {
319 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[7 - 0]);319 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[7 - 0]);
...@@ -323,7 +323,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {...@@ -323,7 +323,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
323 }323 }
324 acc = reduce(u);324 acc = reduce(u);
325 }325 }
326 } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_4_threshold * block_length) {326 } else if (builtin.mode != .small and msg.len >= agg_4_threshold * block_length) {
327 // 4-blocks aggregated reduction327 // 4-blocks aggregated reduction
328 while (i + 64 <= msg.len) : (i += 64) {328 while (i + 64 <= msg.len) : (i += 64) {
329 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[3 - 0]);329 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[3 - 0]);
lib/std/crypto/kangarootwelve.zig+1-1
...@@ -1398,7 +1398,7 @@ test "KT128 sequential and parallel produce same output for many random lengths"...@@ -1398,7 +1398,7 @@ test "KT128 sequential and parallel produce same output for many random lengths"
1398 var prng = std.Random.DefaultPrng.init(std.testing.random_seed);1398 var prng = std.Random.DefaultPrng.init(std.testing.random_seed);
1399 const random = prng.random();1399 const random = prng.random();
14001400
1401 const num_tests = if (builtin.mode == .Debug) 10 else 1000;1401 const num_tests = if (builtin.mode == .debug) 10 else 1000;
1402 const max_length = 250000;1402 const max_length = 250000;
14031403
1404 for (0..num_tests) |_| {1404 for (0..num_tests) |_| {
lib/std/crypto/keccak_p.zig+2-2
...@@ -202,7 +202,7 @@ pub fn State(comptime f: u11, comptime capacity: u11, comptime rounds: u5) type...@@ -202,7 +202,7 @@ pub fn State(comptime f: u11, comptime capacity: u11, comptime rounds: u5) type
202202
203 // In debug mode, track transitions to prevent insecure ones.203 // In debug mode, track transitions to prevent insecure ones.
204 const Op = enum { uninitialized, initialized, updated, absorb, squeeze };204 const Op = enum { uninitialized, initialized, updated, absorb, squeeze };
205 const TransitionTracker = if (mode == .Debug) struct {205 const TransitionTracker = if (mode == .debug) struct {
206 op: Op = .uninitialized,206 op: Op = .uninitialized,
207207
208 fn to(tracker: *@This(), next_op: Op) void {208 fn to(tracker: *@This(), next_op: Op) void {
...@@ -294,7 +294,7 @@ pub fn State(comptime f: u11, comptime capacity: u11, comptime rounds: u5) type...@@ -294,7 +294,7 @@ pub fn State(comptime f: u11, comptime capacity: u11, comptime rounds: u5) type
294294
295 /// Permute the state295 /// Permute the state
296 pub fn permute(self: *Self) void {296 pub fn permute(self: *Self) void {
297 if (mode == .Debug) {297 if (mode == .debug) {
298 if (self.transition.op == .absorb and self.offset > 0) {298 if (self.transition.op == .absorb and self.offset > 0) {
299 @panic("cannot permute with pending input - call fillBlock() or pad() instead");299 @panic("cannot permute with pending input - call fillBlock() or pad() instead");
300 }300 }
lib/std/crypto/pcurves/p256/p256_64.zig+17-17
...@@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {...@@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
110/// out1: [0x0 ~> 0xffffffffffffffff]110/// out1: [0x0 ~> 0xffffffffffffffff]
111/// out2: [0x0 ~> 0xffffffffffffffff]111/// out2: [0x0 ~> 0xffffffffffffffff]
112fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {112fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
113 @setRuntimeSafety(mode == .Debug);113 @setRuntimeSafety(mode == .debug);
114114
115 const x = @as(u128, arg1) * @as(u128, arg2);115 const x = @as(u128, arg1) * @as(u128, arg2);
116 out1.* = @as(u64, @truncate(x));116 out1.* = @as(u64, @truncate(x));
...@@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {...@@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
129/// Output Bounds:129/// Output Bounds:
130/// out1: [0x0 ~> 0xffffffffffffffff]130/// out1: [0x0 ~> 0xffffffffffffffff]
131fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {131fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
132 @setRuntimeSafety(mode == .Debug);132 @setRuntimeSafety(mode == .debug);
133133
134 const mask = 0 -% @as(u64, arg1);134 const mask = 0 -% @as(u64, arg1);
135 out1.* = (mask & arg3) | ((~mask) & arg2);135 out1.* = (mask & arg3) | ((~mask) & arg2);
...@@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {...@@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
145/// 0 ≤ eval out1 < m145/// 0 ≤ eval out1 < m
146///146///
147pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {147pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
148 @setRuntimeSafety(mode == .Debug);148 @setRuntimeSafety(mode == .debug);
149149
150 const x1 = (arg1[1]);150 const x1 = (arg1[1]);
151 const x2 = (arg1[2]);151 const x2 = (arg1[2]);
...@@ -437,7 +437,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -437,7 +437,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
437/// 0 ≤ eval out1 < m437/// 0 ≤ eval out1 < m
438///438///
439pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {439pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
440 @setRuntimeSafety(mode == .Debug);440 @setRuntimeSafety(mode == .debug);
441441
442 const x1 = (arg1[1]);442 const x1 = (arg1[1]);
443 const x2 = (arg1[2]);443 const x2 = (arg1[2]);
...@@ -730,7 +730,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl...@@ -730,7 +730,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
730/// 0 ≤ eval out1 < m730/// 0 ≤ eval out1 < m
731///731///
732pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {732pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
733 @setRuntimeSafety(mode == .Debug);733 @setRuntimeSafety(mode == .debug);
734734
735 var x1: u64 = undefined;735 var x1: u64 = undefined;
736 var x2: u1 = undefined;736 var x2: u1 = undefined;
...@@ -783,7 +783,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -783,7 +783,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
783/// 0 ≤ eval out1 < m783/// 0 ≤ eval out1 < m
784///784///
785pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {785pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
786 @setRuntimeSafety(mode == .Debug);786 @setRuntimeSafety(mode == .debug);
787787
788 var x1: u64 = undefined;788 var x1: u64 = undefined;
789 var x2: u1 = undefined;789 var x2: u1 = undefined;
...@@ -826,7 +826,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -826,7 +826,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
826/// 0 ≤ eval out1 < m826/// 0 ≤ eval out1 < m
827///827///
828pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {828pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
829 @setRuntimeSafety(mode == .Debug);829 @setRuntimeSafety(mode == .debug);
830830
831 var x1: u64 = undefined;831 var x1: u64 = undefined;
832 var x2: u1 = undefined;832 var x2: u1 = undefined;
...@@ -869,7 +869,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -869,7 +869,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
869/// 0 ≤ eval out1 < m869/// 0 ≤ eval out1 < m
870///870///
871pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {871pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
872 @setRuntimeSafety(mode == .Debug);872 @setRuntimeSafety(mode == .debug);
873873
874 const x1 = (arg1[0]);874 const x1 = (arg1[0]);
875 var x2: u64 = undefined;875 var x2: u64 = undefined;
...@@ -1022,7 +1022,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo...@@ -1022,7 +1022,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
1022/// 0 ≤ eval out1 < m1022/// 0 ≤ eval out1 < m
1023///1023///
1024pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {1024pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1025 @setRuntimeSafety(mode == .Debug);1025 @setRuntimeSafety(mode == .debug);
10261026
1027 const x1 = (arg1[1]);1027 const x1 = (arg1[1]);
1028 const x2 = (arg1[2]);1028 const x2 = (arg1[2]);
...@@ -1297,7 +1297,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma...@@ -1297,7 +1297,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
1297/// Output Bounds:1297/// Output Bounds:
1298/// out1: [0x0 ~> 0xffffffffffffffff]1298/// out1: [0x0 ~> 0xffffffffffffffff]
1299pub fn nonzero(out1: *u64, arg1: [4]u64) void {1299pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1300 @setRuntimeSafety(mode == .Debug);1300 @setRuntimeSafety(mode == .debug);
13011301
1302 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));1302 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
1303 out1.* = x1;1303 out1.* = x1;
...@@ -1315,7 +1315,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {...@@ -1315,7 +1315,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1315/// Output Bounds:1315/// Output Bounds:
1316/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1316/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1317pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {1317pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1318 @setRuntimeSafety(mode == .Debug);1318 @setRuntimeSafety(mode == .debug);
13191319
1320 var x1: u64 = undefined;1320 var x1: u64 = undefined;
1321 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));1321 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));
...@@ -1343,7 +1343,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {...@@ -1343,7 +1343,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1343/// Output Bounds:1343/// Output Bounds:
1344/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]1344/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
1345pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {1345pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1346 @setRuntimeSafety(mode == .Debug);1346 @setRuntimeSafety(mode == .debug);
13471347
1348 const x1 = (arg1[3]);1348 const x1 = (arg1[3]);
1349 const x2 = (arg1[2]);1349 const x2 = (arg1[2]);
...@@ -1452,7 +1452,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {...@@ -1452,7 +1452,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1452/// Output Bounds:1452/// Output Bounds:
1453/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1453/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1454pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {1454pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1455 @setRuntimeSafety(mode == .Debug);1455 @setRuntimeSafety(mode == .debug);
14561456
1457 const x1 = (@as(u64, (arg1[31])) << 56);1457 const x1 = (@as(u64, (arg1[31])) << 56);
1458 const x2 = (@as(u64, (arg1[30])) << 48);1458 const x2 = (@as(u64, (arg1[30])) << 48);
...@@ -1527,7 +1527,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {...@@ -1527,7 +1527,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1527/// 0 ≤ eval out1 < m1527/// 0 ≤ eval out1 < m
1528///1528///
1529pub fn setOne(out1: *MontgomeryDomainFieldElement) void {1529pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1530 @setRuntimeSafety(mode == .Debug);1530 @setRuntimeSafety(mode == .debug);
15311531
1532 out1[0] = @as(u64, 0x1);1532 out1[0] = @as(u64, 0x1);
1533 out1[1] = 0xffffffff00000000;1533 out1[1] = 0xffffffff00000000;
...@@ -1544,7 +1544,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {...@@ -1544,7 +1544,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1544/// Output Bounds:1544/// Output Bounds:
1545/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1545/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1546pub fn msat(out1: *[5]u64) void {1546pub fn msat(out1: *[5]u64) void {
1547 @setRuntimeSafety(mode == .Debug);1547 @setRuntimeSafety(mode == .debug);
15481548
1549 out1[0] = 0xffffffffffffffff;1549 out1[0] = 0xffffffffffffffff;
1550 out1[1] = 0xffffffff;1550 out1[1] = 0xffffffff;
...@@ -1582,7 +1582,7 @@ pub fn msat(out1: *[5]u64) void {...@@ -1582,7 +1582,7 @@ pub fn msat(out1: *[5]u64) void {
1582/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1582/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1583/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1583/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1584pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {1584pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {
1585 @setRuntimeSafety(mode == .Debug);1585 @setRuntimeSafety(mode == .debug);
15861586
1587 var x1: u64 = undefined;1587 var x1: u64 = undefined;
1588 var x2: u1 = undefined;1588 var x2: u1 = undefined;
...@@ -1816,7 +1816,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[...@@ -1816,7 +1816,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
1816/// Output Bounds:1816/// Output Bounds:
1817/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1817/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1818pub fn divstepPrecomp(out1: *[4]u64) void {1818pub fn divstepPrecomp(out1: *[4]u64) void {
1819 @setRuntimeSafety(mode == .Debug);1819 @setRuntimeSafety(mode == .debug);
18201820
1821 out1[0] = 0x67ffffffb8000000;1821 out1[0] = 0x67ffffffb8000000;
1822 out1[1] = 0xc000000038000000;1822 out1[1] = 0xc000000038000000;
lib/std/crypto/pcurves/p256/p256_scalar_64.zig+17-17
...@@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {...@@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
110/// out1: [0x0 ~> 0xffffffffffffffff]110/// out1: [0x0 ~> 0xffffffffffffffff]
111/// out2: [0x0 ~> 0xffffffffffffffff]111/// out2: [0x0 ~> 0xffffffffffffffff]
112fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {112fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
113 @setRuntimeSafety(mode == .Debug);113 @setRuntimeSafety(mode == .debug);
114114
115 const x = @as(u128, arg1) * @as(u128, arg2);115 const x = @as(u128, arg1) * @as(u128, arg2);
116 out1.* = @as(u64, @truncate(x));116 out1.* = @as(u64, @truncate(x));
...@@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {...@@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
129/// Output Bounds:129/// Output Bounds:
130/// out1: [0x0 ~> 0xffffffffffffffff]130/// out1: [0x0 ~> 0xffffffffffffffff]
131fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {131fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
132 @setRuntimeSafety(mode == .Debug);132 @setRuntimeSafety(mode == .debug);
133133
134 const mask = 0 -% @as(u64, arg1);134 const mask = 0 -% @as(u64, arg1);
135 out1.* = (mask & arg3) | ((~mask) & arg2);135 out1.* = (mask & arg3) | ((~mask) & arg2);
...@@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {...@@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
145/// 0 ≤ eval out1 < m145/// 0 ≤ eval out1 < m
146///146///
147pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {147pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
148 @setRuntimeSafety(mode == .Debug);148 @setRuntimeSafety(mode == .debug);
149149
150 const x1 = (arg1[1]);150 const x1 = (arg1[1]);
151 const x2 = (arg1[2]);151 const x2 = (arg1[2]);
...@@ -485,7 +485,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -485,7 +485,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
485/// 0 ≤ eval out1 < m485/// 0 ≤ eval out1 < m
486///486///
487pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {487pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
488 @setRuntimeSafety(mode == .Debug);488 @setRuntimeSafety(mode == .debug);
489489
490 const x1 = (arg1[1]);490 const x1 = (arg1[1]);
491 const x2 = (arg1[2]);491 const x2 = (arg1[2]);
...@@ -826,7 +826,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl...@@ -826,7 +826,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
826/// 0 ≤ eval out1 < m826/// 0 ≤ eval out1 < m
827///827///
828pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {828pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
829 @setRuntimeSafety(mode == .Debug);829 @setRuntimeSafety(mode == .debug);
830830
831 var x1: u64 = undefined;831 var x1: u64 = undefined;
832 var x2: u1 = undefined;832 var x2: u1 = undefined;
...@@ -879,7 +879,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -879,7 +879,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
879/// 0 ≤ eval out1 < m879/// 0 ≤ eval out1 < m
880///880///
881pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {881pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
882 @setRuntimeSafety(mode == .Debug);882 @setRuntimeSafety(mode == .debug);
883883
884 var x1: u64 = undefined;884 var x1: u64 = undefined;
885 var x2: u1 = undefined;885 var x2: u1 = undefined;
...@@ -922,7 +922,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -922,7 +922,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
922/// 0 ≤ eval out1 < m922/// 0 ≤ eval out1 < m
923///923///
924pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {924pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
925 @setRuntimeSafety(mode == .Debug);925 @setRuntimeSafety(mode == .debug);
926926
927 var x1: u64 = undefined;927 var x1: u64 = undefined;
928 var x2: u1 = undefined;928 var x2: u1 = undefined;
...@@ -965,7 +965,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -965,7 +965,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
965/// 0 ≤ eval out1 < m965/// 0 ≤ eval out1 < m
966///966///
967pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {967pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
968 @setRuntimeSafety(mode == .Debug);968 @setRuntimeSafety(mode == .debug);
969969
970 const x1 = (arg1[0]);970 const x1 = (arg1[0]);
971 var x2: u64 = undefined;971 var x2: u64 = undefined;
...@@ -1178,7 +1178,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo...@@ -1178,7 +1178,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
1178/// 0 ≤ eval out1 < m1178/// 0 ≤ eval out1 < m
1179///1179///
1180pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {1180pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1181 @setRuntimeSafety(mode == .Debug);1181 @setRuntimeSafety(mode == .debug);
11821182
1183 const x1 = (arg1[1]);1183 const x1 = (arg1[1]);
1184 const x2 = (arg1[2]);1184 const x2 = (arg1[2]);
...@@ -1501,7 +1501,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma...@@ -1501,7 +1501,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
1501/// Output Bounds:1501/// Output Bounds:
1502/// out1: [0x0 ~> 0xffffffffffffffff]1502/// out1: [0x0 ~> 0xffffffffffffffff]
1503pub fn nonzero(out1: *u64, arg1: [4]u64) void {1503pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1504 @setRuntimeSafety(mode == .Debug);1504 @setRuntimeSafety(mode == .debug);
15051505
1506 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));1506 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
1507 out1.* = x1;1507 out1.* = x1;
...@@ -1519,7 +1519,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {...@@ -1519,7 +1519,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1519/// Output Bounds:1519/// Output Bounds:
1520/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1520/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1521pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {1521pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1522 @setRuntimeSafety(mode == .Debug);1522 @setRuntimeSafety(mode == .debug);
15231523
1524 var x1: u64 = undefined;1524 var x1: u64 = undefined;
1525 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));1525 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));
...@@ -1547,7 +1547,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {...@@ -1547,7 +1547,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1547/// Output Bounds:1547/// Output Bounds:
1548/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]1548/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
1549pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {1549pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1550 @setRuntimeSafety(mode == .Debug);1550 @setRuntimeSafety(mode == .debug);
15511551
1552 const x1 = (arg1[3]);1552 const x1 = (arg1[3]);
1553 const x2 = (arg1[2]);1553 const x2 = (arg1[2]);
...@@ -1656,7 +1656,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {...@@ -1656,7 +1656,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1656/// Output Bounds:1656/// Output Bounds:
1657/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1657/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1658pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {1658pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1659 @setRuntimeSafety(mode == .Debug);1659 @setRuntimeSafety(mode == .debug);
16601660
1661 const x1 = (@as(u64, (arg1[31])) << 56);1661 const x1 = (@as(u64, (arg1[31])) << 56);
1662 const x2 = (@as(u64, (arg1[30])) << 48);1662 const x2 = (@as(u64, (arg1[30])) << 48);
...@@ -1731,7 +1731,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {...@@ -1731,7 +1731,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1731/// 0 ≤ eval out1 < m1731/// 0 ≤ eval out1 < m
1732///1732///
1733pub fn setOne(out1: *MontgomeryDomainFieldElement) void {1733pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1734 @setRuntimeSafety(mode == .Debug);1734 @setRuntimeSafety(mode == .debug);
17351735
1736 out1[0] = 0xc46353d039cdaaf;1736 out1[0] = 0xc46353d039cdaaf;
1737 out1[1] = 0x4319055258e8617b;1737 out1[1] = 0x4319055258e8617b;
...@@ -1748,7 +1748,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {...@@ -1748,7 +1748,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1748/// Output Bounds:1748/// Output Bounds:
1749/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1749/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1750pub fn msat(out1: *[5]u64) void {1750pub fn msat(out1: *[5]u64) void {
1751 @setRuntimeSafety(mode == .Debug);1751 @setRuntimeSafety(mode == .debug);
17521752
1753 out1[0] = 0xf3b9cac2fc632551;1753 out1[0] = 0xf3b9cac2fc632551;
1754 out1[1] = 0xbce6faada7179e84;1754 out1[1] = 0xbce6faada7179e84;
...@@ -1786,7 +1786,7 @@ pub fn msat(out1: *[5]u64) void {...@@ -1786,7 +1786,7 @@ pub fn msat(out1: *[5]u64) void {
1786/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1786/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1787/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1787/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1788pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {1788pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {
1789 @setRuntimeSafety(mode == .Debug);1789 @setRuntimeSafety(mode == .debug);
17901790
1791 var x1: u64 = undefined;1791 var x1: u64 = undefined;
1792 var x2: u1 = undefined;1792 var x2: u1 = undefined;
...@@ -2020,7 +2020,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[...@@ -2020,7 +2020,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
2020/// Output Bounds:2020/// Output Bounds:
2021/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]2021/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
2022pub fn divstepPrecomp(out1: *[4]u64) void {2022pub fn divstepPrecomp(out1: *[4]u64) void {
2023 @setRuntimeSafety(mode == .Debug);2023 @setRuntimeSafety(mode == .debug);
20242024
2025 out1[0] = 0xd739262fb7fcfbb5;2025 out1[0] = 0xd739262fb7fcfbb5;
2026 out1[1] = 0x8ac6f75d20074414;2026 out1[1] = 0x8ac6f75d20074414;
lib/std/crypto/pcurves/p384/p384_64.zig+17-17
...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
79/// out1: [0x0 ~> 0xffffffffffffffff]79/// out1: [0x0 ~> 0xffffffffffffffff]
80/// out2: [0x0 ~> 0xffffffffffffffff]80/// out2: [0x0 ~> 0xffffffffffffffff]
81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);82 @setRuntimeSafety(mode == .debug);
8383
84 const x = @as(u128, arg1) * @as(u128, arg2);84 const x = @as(u128, arg1) * @as(u128, arg2);
85 out1.* = @as(u64, @truncate(x));85 out1.* = @as(u64, @truncate(x));
...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
98/// Output Bounds:98/// Output Bounds:
99/// out1: [0x0 ~> 0xffffffffffffffff]99/// out1: [0x0 ~> 0xffffffffffffffff]
100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);101 @setRuntimeSafety(mode == .debug);
102102
103 const mask = 0 -% @as(u64, arg1);103 const mask = 0 -% @as(u64, arg1);
104 out1.* = (mask & arg3) | ((~mask) & arg2);104 out1.* = (mask & arg3) | ((~mask) & arg2);
...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114/// 0 ≤ eval out1 < m114/// 0 ≤ eval out1 < m
115///115///
116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);117 @setRuntimeSafety(mode == .debug);
118118
119 const x1 = (arg1[1]);119 const x1 = (arg1[1]);
120 const x2 = (arg1[2]);120 const x2 = (arg1[2]);
...@@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
834/// 0 ≤ eval out1 < m834/// 0 ≤ eval out1 < m
835///835///
836pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {836pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
837 @setRuntimeSafety(mode == .Debug);837 @setRuntimeSafety(mode == .debug);
838838
839 const x1 = (arg1[1]);839 const x1 = (arg1[1]);
840 const x2 = (arg1[2]);840 const x2 = (arg1[2]);
...@@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl...@@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
1555/// 0 ≤ eval out1 < m1555/// 0 ≤ eval out1 < m
1556///1556///
1557pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {1557pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1558 @setRuntimeSafety(mode == .Debug);1558 @setRuntimeSafety(mode == .debug);
15591559
1560 var x1: u64 = undefined;1560 var x1: u64 = undefined;
1561 var x2: u1 = undefined;1561 var x2: u1 = undefined;
...@@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
1626/// 0 ≤ eval out1 < m1626/// 0 ≤ eval out1 < m
1627///1627///
1628pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {1628pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1629 @setRuntimeSafety(mode == .Debug);1629 @setRuntimeSafety(mode == .debug);
16301630
1631 var x1: u64 = undefined;1631 var x1: u64 = undefined;
1632 var x2: u1 = undefined;1632 var x2: u1 = undefined;
...@@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
1683/// 0 ≤ eval out1 < m1683/// 0 ≤ eval out1 < m
1684///1684///
1685pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {1685pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1686 @setRuntimeSafety(mode == .Debug);1686 @setRuntimeSafety(mode == .debug);
16871687
1688 var x1: u64 = undefined;1688 var x1: u64 = undefined;
1689 var x2: u1 = undefined;1689 var x2: u1 = undefined;
...@@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
1740/// 0 ≤ eval out1 < m1740/// 0 ≤ eval out1 < m
1741///1741///
1742pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {1742pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1743 @setRuntimeSafety(mode == .Debug);1743 @setRuntimeSafety(mode == .debug);
17441744
1745 const x1 = (arg1[0]);1745 const x1 = (arg1[0]);
1746 var x2: u64 = undefined;1746 var x2: u64 = undefined;
...@@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo...@@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
2225/// 0 ≤ eval out1 < m2225/// 0 ≤ eval out1 < m
2226///2226///
2227pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {2227pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
2228 @setRuntimeSafety(mode == .Debug);2228 @setRuntimeSafety(mode == .debug);
22292229
2230 const x1 = (arg1[1]);2230 const x1 = (arg1[1]);
2231 const x2 = (arg1[2]);2231 const x2 = (arg1[2]);
...@@ -2862,7 +2862,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma...@@ -2862,7 +2862,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
2862/// Output Bounds:2862/// Output Bounds:
2863/// out1: [0x0 ~> 0xffffffffffffffff]2863/// out1: [0x0 ~> 0xffffffffffffffff]
2864pub fn nonzero(out1: *u64, arg1: [6]u64) void {2864pub fn nonzero(out1: *u64, arg1: [6]u64) void {
2865 @setRuntimeSafety(mode == .Debug);2865 @setRuntimeSafety(mode == .debug);
28662866
2867 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5]))))));2867 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5]))))));
2868 out1.* = x1;2868 out1.* = x1;
...@@ -2880,7 +2880,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void {...@@ -2880,7 +2880,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void {
2880/// Output Bounds:2880/// Output Bounds:
2881/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]2881/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
2882pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {2882pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {
2883 @setRuntimeSafety(mode == .Debug);2883 @setRuntimeSafety(mode == .debug);
28842884
2885 var x1: u64 = undefined;2885 var x1: u64 = undefined;
2886 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));2886 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));
...@@ -2914,7 +2914,7 @@ pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {...@@ -2914,7 +2914,7 @@ pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {
2914/// Output Bounds:2914/// Output Bounds:
2915/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]2915/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
2916pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {2916pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
2917 @setRuntimeSafety(mode == .Debug);2917 @setRuntimeSafety(mode == .debug);
29182918
2919 const x1 = (arg1[5]);2919 const x1 = (arg1[5]);
2920 const x2 = (arg1[4]);2920 const x2 = (arg1[4]);
...@@ -3069,7 +3069,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {...@@ -3069,7 +3069,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
3069/// Output Bounds:3069/// Output Bounds:
3070/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3070/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3071pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {3071pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
3072 @setRuntimeSafety(mode == .Debug);3072 @setRuntimeSafety(mode == .debug);
30733073
3074 const x1 = (@as(u64, (arg1[47])) << 56);3074 const x1 = (@as(u64, (arg1[47])) << 56);
3075 const x2 = (@as(u64, (arg1[46])) << 48);3075 const x2 = (@as(u64, (arg1[46])) << 48);
...@@ -3176,7 +3176,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {...@@ -3176,7 +3176,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
3176/// 0 ≤ eval out1 < m3176/// 0 ≤ eval out1 < m
3177///3177///
3178pub fn setOne(out1: *MontgomeryDomainFieldElement) void {3178pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
3179 @setRuntimeSafety(mode == .Debug);3179 @setRuntimeSafety(mode == .debug);
31803180
3181 out1[0] = 0xffffffff00000001;3181 out1[0] = 0xffffffff00000001;
3182 out1[1] = 0xffffffff;3182 out1[1] = 0xffffffff;
...@@ -3195,7 +3195,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {...@@ -3195,7 +3195,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
3195/// Output Bounds:3195/// Output Bounds:
3196/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3196/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3197pub fn msat(out1: *[7]u64) void {3197pub fn msat(out1: *[7]u64) void {
3198 @setRuntimeSafety(mode == .Debug);3198 @setRuntimeSafety(mode == .debug);
31993199
3200 out1[0] = 0xffffffff;3200 out1[0] = 0xffffffff;
3201 out1[1] = 0xffffffff00000000;3201 out1[1] = 0xffffffff00000000;
...@@ -3235,7 +3235,7 @@ pub fn msat(out1: *[7]u64) void {...@@ -3235,7 +3235,7 @@ pub fn msat(out1: *[7]u64) void {
3235/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3235/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3236/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3236/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3237pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[6]u64, arg1: u64, arg2: [7]u64, arg3: [7]u64, arg4: [6]u64, arg5: [6]u64) void {3237pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[6]u64, arg1: u64, arg2: [7]u64, arg3: [7]u64, arg4: [6]u64, arg5: [6]u64) void {
3238 @setRuntimeSafety(mode == .Debug);3238 @setRuntimeSafety(mode == .debug);
32393239
3240 var x1: u64 = undefined;3240 var x1: u64 = undefined;
3241 var x2: u1 = undefined;3241 var x2: u1 = undefined;
...@@ -3561,7 +3561,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[...@@ -3561,7 +3561,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[
3561/// Output Bounds:3561/// Output Bounds:
3562/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3562/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3563pub fn divstepPrecomp(out1: *[6]u64) void {3563pub fn divstepPrecomp(out1: *[6]u64) void {
3564 @setRuntimeSafety(mode == .Debug);3564 @setRuntimeSafety(mode == .debug);
35653565
3566 out1[0] = 0xfff69400fff18fff;3566 out1[0] = 0xfff69400fff18fff;
3567 out1[1] = 0x2b7feffffd3ff;3567 out1[1] = 0x2b7feffffd3ff;
lib/std/crypto/pcurves/p384/p384_scalar_64.zig+17-17
...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
79/// out1: [0x0 ~> 0xffffffffffffffff]79/// out1: [0x0 ~> 0xffffffffffffffff]
80/// out2: [0x0 ~> 0xffffffffffffffff]80/// out2: [0x0 ~> 0xffffffffffffffff]
81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);82 @setRuntimeSafety(mode == .debug);
8383
84 const x = @as(u128, arg1) * @as(u128, arg2);84 const x = @as(u128, arg1) * @as(u128, arg2);
85 out1.* = @as(u64, @truncate(x));85 out1.* = @as(u64, @truncate(x));
...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
98/// Output Bounds:98/// Output Bounds:
99/// out1: [0x0 ~> 0xffffffffffffffff]99/// out1: [0x0 ~> 0xffffffffffffffff]
100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);101 @setRuntimeSafety(mode == .debug);
102102
103 const mask = 0 -% @as(u64, arg1);103 const mask = 0 -% @as(u64, arg1);
104 out1.* = (mask & arg3) | ((~mask) & arg2);104 out1.* = (mask & arg3) | ((~mask) & arg2);
...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114/// 0 ≤ eval out1 < m114/// 0 ≤ eval out1 < m
115///115///
116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);117 @setRuntimeSafety(mode == .debug);
118118
119 const x1 = (arg1[1]);119 const x1 = (arg1[1]);
120 const x2 = (arg1[2]);120 const x2 = (arg1[2]);
...@@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
834/// 0 ≤ eval out1 < m834/// 0 ≤ eval out1 < m
835///835///
836pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {836pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
837 @setRuntimeSafety(mode == .Debug);837 @setRuntimeSafety(mode == .debug);
838838
839 const x1 = (arg1[1]);839 const x1 = (arg1[1]);
840 const x2 = (arg1[2]);840 const x2 = (arg1[2]);
...@@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl...@@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
1555/// 0 ≤ eval out1 < m1555/// 0 ≤ eval out1 < m
1556///1556///
1557pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {1557pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1558 @setRuntimeSafety(mode == .Debug);1558 @setRuntimeSafety(mode == .debug);
15591559
1560 var x1: u64 = undefined;1560 var x1: u64 = undefined;
1561 var x2: u1 = undefined;1561 var x2: u1 = undefined;
...@@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
1626/// 0 ≤ eval out1 < m1626/// 0 ≤ eval out1 < m
1627///1627///
1628pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {1628pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1629 @setRuntimeSafety(mode == .Debug);1629 @setRuntimeSafety(mode == .debug);
16301630
1631 var x1: u64 = undefined;1631 var x1: u64 = undefined;
1632 var x2: u1 = undefined;1632 var x2: u1 = undefined;
...@@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
1683/// 0 ≤ eval out1 < m1683/// 0 ≤ eval out1 < m
1684///1684///
1685pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {1685pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1686 @setRuntimeSafety(mode == .Debug);1686 @setRuntimeSafety(mode == .debug);
16871687
1688 var x1: u64 = undefined;1688 var x1: u64 = undefined;
1689 var x2: u1 = undefined;1689 var x2: u1 = undefined;
...@@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
1740/// 0 ≤ eval out1 < m1740/// 0 ≤ eval out1 < m
1741///1741///
1742pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {1742pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1743 @setRuntimeSafety(mode == .Debug);1743 @setRuntimeSafety(mode == .debug);
17441744
1745 const x1 = (arg1[0]);1745 const x1 = (arg1[0]);
1746 var x2: u64 = undefined;1746 var x2: u64 = undefined;
...@@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo...@@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
2225/// 0 ≤ eval out1 < m2225/// 0 ≤ eval out1 < m
2226///2226///
2227pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {2227pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
2228 @setRuntimeSafety(mode == .Debug);2228 @setRuntimeSafety(mode == .debug);
22292229
2230 const x1 = (arg1[1]);2230 const x1 = (arg1[1]);
2231 const x2 = (arg1[2]);2231 const x2 = (arg1[2]);
...@@ -2916,7 +2916,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma...@@ -2916,7 +2916,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
2916/// Output Bounds:2916/// Output Bounds:
2917/// out1: [0x0 ~> 0xffffffffffffffff]2917/// out1: [0x0 ~> 0xffffffffffffffff]
2918pub fn nonzero(out1: *u64, arg1: [6]u64) void {2918pub fn nonzero(out1: *u64, arg1: [6]u64) void {
2919 @setRuntimeSafety(mode == .Debug);2919 @setRuntimeSafety(mode == .debug);
29202920
2921 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5]))))));2921 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5]))))));
2922 out1.* = x1;2922 out1.* = x1;
...@@ -2934,7 +2934,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void {...@@ -2934,7 +2934,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void {
2934/// Output Bounds:2934/// Output Bounds:
2935/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]2935/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
2936pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {2936pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {
2937 @setRuntimeSafety(mode == .Debug);2937 @setRuntimeSafety(mode == .debug);
29382938
2939 var x1: u64 = undefined;2939 var x1: u64 = undefined;
2940 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));2940 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));
...@@ -2968,7 +2968,7 @@ pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {...@@ -2968,7 +2968,7 @@ pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {
2968/// Output Bounds:2968/// Output Bounds:
2969/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]2969/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
2970pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {2970pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
2971 @setRuntimeSafety(mode == .Debug);2971 @setRuntimeSafety(mode == .debug);
29722972
2973 const x1 = (arg1[5]);2973 const x1 = (arg1[5]);
2974 const x2 = (arg1[4]);2974 const x2 = (arg1[4]);
...@@ -3123,7 +3123,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {...@@ -3123,7 +3123,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
3123/// Output Bounds:3123/// Output Bounds:
3124/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3124/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3125pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {3125pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
3126 @setRuntimeSafety(mode == .Debug);3126 @setRuntimeSafety(mode == .debug);
31273127
3128 const x1 = (@as(u64, (arg1[47])) << 56);3128 const x1 = (@as(u64, (arg1[47])) << 56);
3129 const x2 = (@as(u64, (arg1[46])) << 48);3129 const x2 = (@as(u64, (arg1[46])) << 48);
...@@ -3230,7 +3230,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {...@@ -3230,7 +3230,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
3230/// 0 ≤ eval out1 < m3230/// 0 ≤ eval out1 < m
3231///3231///
3232pub fn setOne(out1: *MontgomeryDomainFieldElement) void {3232pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
3233 @setRuntimeSafety(mode == .Debug);3233 @setRuntimeSafety(mode == .debug);
32343234
3235 out1[0] = 0x1313e695333ad68d;3235 out1[0] = 0x1313e695333ad68d;
3236 out1[1] = 0xa7e5f24db74f5885;3236 out1[1] = 0xa7e5f24db74f5885;
...@@ -3249,7 +3249,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {...@@ -3249,7 +3249,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
3249/// Output Bounds:3249/// Output Bounds:
3250/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3250/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3251pub fn msat(out1: *[7]u64) void {3251pub fn msat(out1: *[7]u64) void {
3252 @setRuntimeSafety(mode == .Debug);3252 @setRuntimeSafety(mode == .debug);
32533253
3254 out1[0] = 0xecec196accc52973;3254 out1[0] = 0xecec196accc52973;
3255 out1[1] = 0x581a0db248b0a77a;3255 out1[1] = 0x581a0db248b0a77a;
...@@ -3289,7 +3289,7 @@ pub fn msat(out1: *[7]u64) void {...@@ -3289,7 +3289,7 @@ pub fn msat(out1: *[7]u64) void {
3289/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3289/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3290/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3290/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3291pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[6]u64, arg1: u64, arg2: [7]u64, arg3: [7]u64, arg4: [6]u64, arg5: [6]u64) void {3291pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[6]u64, arg1: u64, arg2: [7]u64, arg3: [7]u64, arg4: [6]u64, arg5: [6]u64) void {
3292 @setRuntimeSafety(mode == .Debug);3292 @setRuntimeSafety(mode == .debug);
32933293
3294 var x1: u64 = undefined;3294 var x1: u64 = undefined;
3295 var x2: u1 = undefined;3295 var x2: u1 = undefined;
...@@ -3615,7 +3615,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[...@@ -3615,7 +3615,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[
3615/// Output Bounds:3615/// Output Bounds:
3616/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]3616/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
3617pub fn divstepPrecomp(out1: *[6]u64) void {3617pub fn divstepPrecomp(out1: *[6]u64) void {
3618 @setRuntimeSafety(mode == .Debug);3618 @setRuntimeSafety(mode == .debug);
36193619
3620 out1[0] = 0x49589ae0e6045b6a;3620 out1[0] = 0x49589ae0e6045b6a;
3621 out1[1] = 0x3c9a5352870040ed;3621 out1[1] = 0x3c9a5352870040ed;
lib/std/crypto/pcurves/secp256k1/secp256k1_64.zig+17-17
...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
79/// out1: [0x0 ~> 0xffffffffffffffff]79/// out1: [0x0 ~> 0xffffffffffffffff]
80/// out2: [0x0 ~> 0xffffffffffffffff]80/// out2: [0x0 ~> 0xffffffffffffffff]
81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);82 @setRuntimeSafety(mode == .debug);
8383
84 const x = @as(u128, arg1) * @as(u128, arg2);84 const x = @as(u128, arg1) * @as(u128, arg2);
85 out1.* = @as(u64, @truncate(x));85 out1.* = @as(u64, @truncate(x));
...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
98/// Output Bounds:98/// Output Bounds:
99/// out1: [0x0 ~> 0xffffffffffffffff]99/// out1: [0x0 ~> 0xffffffffffffffff]
100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);101 @setRuntimeSafety(mode == .debug);
102102
103 const mask = 0 -% @as(u64, arg1);103 const mask = 0 -% @as(u64, arg1);
104 out1.* = (mask & arg3) | ((~mask) & arg2);104 out1.* = (mask & arg3) | ((~mask) & arg2);
...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114/// 0 ≤ eval out1 < m114/// 0 ≤ eval out1 < m
115///115///
116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);117 @setRuntimeSafety(mode == .debug);
118118
119 const x1 = (arg1[1]);119 const x1 = (arg1[1]);
120 const x2 = (arg1[2]);120 const x2 = (arg1[2]);
...@@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
454/// 0 ≤ eval out1 < m454/// 0 ≤ eval out1 < m
455///455///
456pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {456pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
457 @setRuntimeSafety(mode == .Debug);457 @setRuntimeSafety(mode == .debug);
458458
459 const x1 = (arg1[1]);459 const x1 = (arg1[1]);
460 const x2 = (arg1[2]);460 const x2 = (arg1[2]);
...@@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl...@@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
795/// 0 ≤ eval out1 < m795/// 0 ≤ eval out1 < m
796///796///
797pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {797pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
798 @setRuntimeSafety(mode == .Debug);798 @setRuntimeSafety(mode == .debug);
799799
800 var x1: u64 = undefined;800 var x1: u64 = undefined;
801 var x2: u1 = undefined;801 var x2: u1 = undefined;
...@@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
848/// 0 ≤ eval out1 < m848/// 0 ≤ eval out1 < m
849///849///
850pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {850pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
851 @setRuntimeSafety(mode == .Debug);851 @setRuntimeSafety(mode == .debug);
852852
853 var x1: u64 = undefined;853 var x1: u64 = undefined;
854 var x2: u1 = undefined;854 var x2: u1 = undefined;
...@@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
891/// 0 ≤ eval out1 < m891/// 0 ≤ eval out1 < m
892///892///
893pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {893pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
894 @setRuntimeSafety(mode == .Debug);894 @setRuntimeSafety(mode == .debug);
895895
896 var x1: u64 = undefined;896 var x1: u64 = undefined;
897 var x2: u1 = undefined;897 var x2: u1 = undefined;
...@@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
934/// 0 ≤ eval out1 < m934/// 0 ≤ eval out1 < m
935///935///
936pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {936pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
937 @setRuntimeSafety(mode == .Debug);937 @setRuntimeSafety(mode == .debug);
938938
939 const x1 = (arg1[0]);939 const x1 = (arg1[0]);
940 var x2: u64 = undefined;940 var x2: u64 = undefined;
...@@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo...@@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
1167/// 0 ≤ eval out1 < m1167/// 0 ≤ eval out1 < m
1168///1168///
1169pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {1169pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1170 @setRuntimeSafety(mode == .Debug);1170 @setRuntimeSafety(mode == .debug);
11711171
1172 const x1 = (arg1[1]);1172 const x1 = (arg1[1]);
1173 const x2 = (arg1[2]);1173 const x2 = (arg1[2]);
...@@ -1430,7 +1430,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma...@@ -1430,7 +1430,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
1430/// Output Bounds:1430/// Output Bounds:
1431/// out1: [0x0 ~> 0xffffffffffffffff]1431/// out1: [0x0 ~> 0xffffffffffffffff]
1432pub fn nonzero(out1: *u64, arg1: [4]u64) void {1432pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1433 @setRuntimeSafety(mode == .Debug);1433 @setRuntimeSafety(mode == .debug);
14341434
1435 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));1435 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
1436 out1.* = x1;1436 out1.* = x1;
...@@ -1448,7 +1448,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {...@@ -1448,7 +1448,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1448/// Output Bounds:1448/// Output Bounds:
1449/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1449/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1450pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {1450pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1451 @setRuntimeSafety(mode == .Debug);1451 @setRuntimeSafety(mode == .debug);
14521452
1453 var x1: u64 = undefined;1453 var x1: u64 = undefined;
1454 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));1454 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));
...@@ -1476,7 +1476,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {...@@ -1476,7 +1476,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1476/// Output Bounds:1476/// Output Bounds:
1477/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]1477/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
1478pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {1478pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1479 @setRuntimeSafety(mode == .Debug);1479 @setRuntimeSafety(mode == .debug);
14801480
1481 const x1 = (arg1[3]);1481 const x1 = (arg1[3]);
1482 const x2 = (arg1[2]);1482 const x2 = (arg1[2]);
...@@ -1585,7 +1585,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {...@@ -1585,7 +1585,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1585/// Output Bounds:1585/// Output Bounds:
1586/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1586/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1587pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {1587pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1588 @setRuntimeSafety(mode == .Debug);1588 @setRuntimeSafety(mode == .debug);
15891589
1590 const x1 = (@as(u64, (arg1[31])) << 56);1590 const x1 = (@as(u64, (arg1[31])) << 56);
1591 const x2 = (@as(u64, (arg1[30])) << 48);1591 const x2 = (@as(u64, (arg1[30])) << 48);
...@@ -1660,7 +1660,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {...@@ -1660,7 +1660,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1660/// 0 ≤ eval out1 < m1660/// 0 ≤ eval out1 < m
1661///1661///
1662pub fn setOne(out1: *MontgomeryDomainFieldElement) void {1662pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1663 @setRuntimeSafety(mode == .Debug);1663 @setRuntimeSafety(mode == .debug);
16641664
1665 out1[0] = 0x1000003d1;1665 out1[0] = 0x1000003d1;
1666 out1[1] = 0x0;1666 out1[1] = 0x0;
...@@ -1677,7 +1677,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {...@@ -1677,7 +1677,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1677/// Output Bounds:1677/// Output Bounds:
1678/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1678/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1679pub fn msat(out1: *[5]u64) void {1679pub fn msat(out1: *[5]u64) void {
1680 @setRuntimeSafety(mode == .Debug);1680 @setRuntimeSafety(mode == .debug);
16811681
1682 out1[0] = 0xfffffffefffffc2f;1682 out1[0] = 0xfffffffefffffc2f;
1683 out1[1] = 0xffffffffffffffff;1683 out1[1] = 0xffffffffffffffff;
...@@ -1715,7 +1715,7 @@ pub fn msat(out1: *[5]u64) void {...@@ -1715,7 +1715,7 @@ pub fn msat(out1: *[5]u64) void {
1715/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1715/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1716/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1716/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1717pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {1717pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {
1718 @setRuntimeSafety(mode == .Debug);1718 @setRuntimeSafety(mode == .debug);
17191719
1720 var x1: u64 = undefined;1720 var x1: u64 = undefined;
1721 var x2: u1 = undefined;1721 var x2: u1 = undefined;
...@@ -1949,7 +1949,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[...@@ -1949,7 +1949,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
1949/// Output Bounds:1949/// Output Bounds:
1950/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1950/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1951pub fn divstepPrecomp(out1: *[4]u64) void {1951pub fn divstepPrecomp(out1: *[4]u64) void {
1952 @setRuntimeSafety(mode == .Debug);1952 @setRuntimeSafety(mode == .debug);
19531953
1954 out1[0] = 0xf201a41831525e0a;1954 out1[0] = 0xf201a41831525e0a;
1955 out1[1] = 0x9953f9ddcd648d85;1955 out1[1] = 0x9953f9ddcd648d85;
lib/std/crypto/pcurves/secp256k1/secp256k1_scalar_64.zig+17-17
...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {...@@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
79/// out1: [0x0 ~> 0xffffffffffffffff]79/// out1: [0x0 ~> 0xffffffffffffffff]
80/// out2: [0x0 ~> 0xffffffffffffffff]80/// out2: [0x0 ~> 0xffffffffffffffff]
81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {81fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);82 @setRuntimeSafety(mode == .debug);
8383
84 const x = @as(u128, arg1) * @as(u128, arg2);84 const x = @as(u128, arg1) * @as(u128, arg2);
85 out1.* = @as(u64, @truncate(x));85 out1.* = @as(u64, @truncate(x));
...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {...@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
98/// Output Bounds:98/// Output Bounds:
99/// out1: [0x0 ~> 0xffffffffffffffff]99/// out1: [0x0 ~> 0xffffffffffffffff]
100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);101 @setRuntimeSafety(mode == .debug);
102102
103 const mask = 0 -% @as(u64, arg1);103 const mask = 0 -% @as(u64, arg1);
104 out1.* = (mask & arg3) | ((~mask) & arg2);104 out1.* = (mask & arg3) | ((~mask) & arg2);
...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {...@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114/// 0 ≤ eval out1 < m114/// 0 ≤ eval out1 < m
115///115///
116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);117 @setRuntimeSafety(mode == .debug);
118118
119 const x1 = (arg1[1]);119 const x1 = (arg1[1]);
120 const x2 = (arg1[2]);120 const x2 = (arg1[2]);
...@@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
454/// 0 ≤ eval out1 < m454/// 0 ≤ eval out1 < m
455///455///
456pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {456pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
457 @setRuntimeSafety(mode == .Debug);457 @setRuntimeSafety(mode == .debug);
458458
459 const x1 = (arg1[1]);459 const x1 = (arg1[1]);
460 const x2 = (arg1[2]);460 const x2 = (arg1[2]);
...@@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl...@@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
795/// 0 ≤ eval out1 < m795/// 0 ≤ eval out1 < m
796///796///
797pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {797pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
798 @setRuntimeSafety(mode == .Debug);798 @setRuntimeSafety(mode == .debug);
799799
800 var x1: u64 = undefined;800 var x1: u64 = undefined;
801 var x2: u1 = undefined;801 var x2: u1 = undefined;
...@@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
848/// 0 ≤ eval out1 < m848/// 0 ≤ eval out1 < m
849///849///
850pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {850pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
851 @setRuntimeSafety(mode == .Debug);851 @setRuntimeSafety(mode == .debug);
852852
853 var x1: u64 = undefined;853 var x1: u64 = undefined;
854 var x2: u1 = undefined;854 var x2: u1 = undefined;
...@@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
891/// 0 ≤ eval out1 < m891/// 0 ≤ eval out1 < m
892///892///
893pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {893pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
894 @setRuntimeSafety(mode == .Debug);894 @setRuntimeSafety(mode == .debug);
895895
896 var x1: u64 = undefined;896 var x1: u64 = undefined;
897 var x2: u1 = undefined;897 var x2: u1 = undefined;
...@@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme...@@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
934/// 0 ≤ eval out1 < m934/// 0 ≤ eval out1 < m
935///935///
936pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {936pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
937 @setRuntimeSafety(mode == .Debug);937 @setRuntimeSafety(mode == .debug);
938938
939 const x1 = (arg1[0]);939 const x1 = (arg1[0]);
940 var x2: u64 = undefined;940 var x2: u64 = undefined;
...@@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo...@@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
1167/// 0 ≤ eval out1 < m1167/// 0 ≤ eval out1 < m
1168///1168///
1169pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {1169pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1170 @setRuntimeSafety(mode == .Debug);1170 @setRuntimeSafety(mode == .debug);
11711171
1172 const x1 = (arg1[1]);1172 const x1 = (arg1[1]);
1173 const x2 = (arg1[2]);1173 const x2 = (arg1[2]);
...@@ -1490,7 +1490,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma...@@ -1490,7 +1490,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
1490/// Output Bounds:1490/// Output Bounds:
1491/// out1: [0x0 ~> 0xffffffffffffffff]1491/// out1: [0x0 ~> 0xffffffffffffffff]
1492pub fn nonzero(out1: *u64, arg1: [4]u64) void {1492pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1493 @setRuntimeSafety(mode == .Debug);1493 @setRuntimeSafety(mode == .debug);
14941494
1495 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));1495 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
1496 out1.* = x1;1496 out1.* = x1;
...@@ -1508,7 +1508,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {...@@ -1508,7 +1508,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1508/// Output Bounds:1508/// Output Bounds:
1509/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1509/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1510pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {1510pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1511 @setRuntimeSafety(mode == .Debug);1511 @setRuntimeSafety(mode == .debug);
15121512
1513 var x1: u64 = undefined;1513 var x1: u64 = undefined;
1514 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));1514 cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]));
...@@ -1536,7 +1536,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {...@@ -1536,7 +1536,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1536/// Output Bounds:1536/// Output Bounds:
1537/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]1537/// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
1538pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {1538pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1539 @setRuntimeSafety(mode == .Debug);1539 @setRuntimeSafety(mode == .debug);
15401540
1541 const x1 = (arg1[3]);1541 const x1 = (arg1[3]);
1542 const x2 = (arg1[2]);1542 const x2 = (arg1[2]);
...@@ -1645,7 +1645,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {...@@ -1645,7 +1645,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1645/// Output Bounds:1645/// Output Bounds:
1646/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1646/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1647pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {1647pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1648 @setRuntimeSafety(mode == .Debug);1648 @setRuntimeSafety(mode == .debug);
16491649
1650 const x1 = (@as(u64, (arg1[31])) << 56);1650 const x1 = (@as(u64, (arg1[31])) << 56);
1651 const x2 = (@as(u64, (arg1[30])) << 48);1651 const x2 = (@as(u64, (arg1[30])) << 48);
...@@ -1720,7 +1720,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {...@@ -1720,7 +1720,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1720/// 0 ≤ eval out1 < m1720/// 0 ≤ eval out1 < m
1721///1721///
1722pub fn setOne(out1: *MontgomeryDomainFieldElement) void {1722pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1723 @setRuntimeSafety(mode == .Debug);1723 @setRuntimeSafety(mode == .debug);
17241724
1725 out1[0] = 0x402da1732fc9bebf;1725 out1[0] = 0x402da1732fc9bebf;
1726 out1[1] = 0x4551231950b75fc4;1726 out1[1] = 0x4551231950b75fc4;
...@@ -1737,7 +1737,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {...@@ -1737,7 +1737,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1737/// Output Bounds:1737/// Output Bounds:
1738/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1738/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1739pub fn msat(out1: *[5]u64) void {1739pub fn msat(out1: *[5]u64) void {
1740 @setRuntimeSafety(mode == .Debug);1740 @setRuntimeSafety(mode == .debug);
17411741
1742 out1[0] = 0xbfd25e8cd0364141;1742 out1[0] = 0xbfd25e8cd0364141;
1743 out1[1] = 0xbaaedce6af48a03b;1743 out1[1] = 0xbaaedce6af48a03b;
...@@ -1775,7 +1775,7 @@ pub fn msat(out1: *[5]u64) void {...@@ -1775,7 +1775,7 @@ pub fn msat(out1: *[5]u64) void {
1775/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1775/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1776/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]1776/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
1777pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {1777pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void {
1778 @setRuntimeSafety(mode == .Debug);1778 @setRuntimeSafety(mode == .debug);
17791779
1780 var x1: u64 = undefined;1780 var x1: u64 = undefined;
1781 var x2: u1 = undefined;1781 var x2: u1 = undefined;
...@@ -2009,7 +2009,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[...@@ -2009,7 +2009,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
2009/// Output Bounds:2009/// Output Bounds:
2010/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]2010/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
2011pub fn divstepPrecomp(out1: *[4]u64) void {2011pub fn divstepPrecomp(out1: *[4]u64) void {
2012 @setRuntimeSafety(mode == .Debug);2012 @setRuntimeSafety(mode == .debug);
20132013
2014 out1[0] = 0xd7431a4d2b9cb4e9;2014 out1[0] = 0xd7431a4d2b9cb4e9;
2015 out1[1] = 0xab67d35a32d9c503;2015 out1[1] = 0xab67d35a32d9c503;
lib/std/debug.zig+7-7
...@@ -241,8 +241,8 @@ pub const Symbol = struct {...@@ -241,8 +241,8 @@ pub const Symbol = struct {
241/// library, when the caller probably wants to use the optimization mode of241/// library, when the caller probably wants to use the optimization mode of
242/// their own module.242/// their own module.
243pub const runtime_safety = switch (builtin.mode) {243pub const runtime_safety = switch (builtin.mode) {
244 .Debug, .ReleaseSafe => true,244 .debug, .safe => true,
245 .ReleaseFast, .ReleaseSmall => false,245 .fast, .small => false,
246};246};
247247
248/// Whether we can unwind the stack on this target, allowing capturing and/or printing the current248/// Whether we can unwind the stack on this target, allowing capturing and/or printing the current
...@@ -257,7 +257,7 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {...@@ -257,7 +257,7 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
257 // because Emscripten's implementation is very slow.257 // because Emscripten's implementation is very slow.
258 .wasm32,258 .wasm32,
259 .wasm64,259 .wasm64,
260 => native_os == .emscripten and builtin.mode == .Debug,260 => native_os == .emscripten and builtin.mode == .debug,
261261
262 // `@returnAddress()` is unsupported in LLVM 21.262 // `@returnAddress()` is unsupported in LLVM 21.
263 .bpfel,263 .bpfel,
...@@ -419,16 +419,16 @@ pub const CpuContextPtr = if (cpu_context.Native == noreturn) noreturn else *con...@@ -419,16 +419,16 @@ pub const CpuContextPtr = if (cpu_context.Native == noreturn) noreturn else *con
419419
420/// Invokes detectable illegal behavior when `ok` is `false`.420/// Invokes detectable illegal behavior when `ok` is `false`.
421///421///
422/// In Debug and ReleaseSafe modes, calls to this function are always422/// In debug and safe modes, calls to this function are always
423/// generated, and the `unreachable` statement triggers a panic.423/// generated, and the `unreachable` statement triggers a panic.
424///424///
425/// In ReleaseFast and ReleaseSmall modes, calls to this function are optimized425/// In fast and small modes, calls to this function are optimized
426/// away, and in fact the optimizer is able to use the assertion in its426/// away, and in fact the optimizer is able to use the assertion in its
427/// heuristics.427/// heuristics.
428///428///
429/// Inside a test block, it is best to use the `testing` module rather than429/// Inside a test block, it is best to use the `testing` module rather than
430/// this function, because this function may not detect a test failure in430/// this function, because this function may not detect a test failure in
431/// ReleaseFast and ReleaseSmall mode. Outside of a test block, this assert431/// fast and small mode. Outside of a test block, this assert
432/// function is the correct function to use.432/// function is the correct function to use.
433pub fn assert(ok: bool) void {433pub fn assert(ok: bool) void {
434 @disableInstrumentation();434 @disableInstrumentation();
...@@ -1760,7 +1760,7 @@ test "manage resources correctly" {...@@ -1760,7 +1760,7 @@ test "manage resources correctly" {
1760/// In release mode, it is size 0 and all methods are no-ops.1760/// In release mode, it is size 0 and all methods are no-ops.
1761/// This is a pre-made type with default settings.1761/// This is a pre-made type with default settings.
1762/// For more advanced usage, see `ConfigurableTrace`.1762/// For more advanced usage, see `ConfigurableTrace`.
1763pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .Debug);1763pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .debug);
17641764
1765pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type {1765pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type {
1766 return struct {1766 return struct {
lib/std/fmt.zig+2-2
...@@ -261,7 +261,7 @@ test printInt {...@@ -261,7 +261,7 @@ test printInt {
261261
262/// Converts values in the range [0, 100) to a base 10 string.262/// Converts values in the range [0, 100) to a base 10 string.
263pub fn digits2(value: u8) [2]u8 {263pub fn digits2(value: u8) [2]u8 {
264 if (builtin.mode == .ReleaseSmall) {264 if (builtin.mode == .small) {
265 return .{ @intCast('0' + value / 10), @intCast('0' + value % 10) };265 return .{ @intCast('0' + value / 10), @intCast('0' + value % 10) };
266 } else {266 } else {
267 return "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"[value * 2 ..][0..2].*;267 return "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"[value * 2 ..][0..2].*;
...@@ -924,7 +924,7 @@ test "enum" {...@@ -924,7 +924,7 @@ test "enum" {
924924
925 // test very large enum to verify ct branch quota is large enough925 // test very large enum to verify ct branch quota is large enough
926 // TODO: https://github.com/ziglang/zig/issues/15609926 // TODO: https://github.com/ziglang/zig/issues/15609
927 if (!((builtin.cpu.arch == .wasm32) and builtin.mode == .Debug)) {927 if (!((builtin.cpu.arch == .wasm32) and builtin.mode == .debug)) {
928 try expectFmt("enum: .INVALID_FUNCTION\n", "enum: {}\n", .{std.os.windows.Win32Error.INVALID_FUNCTION});928 try expectFmt("enum: .INVALID_FUNCTION\n", "enum: {}\n", .{std.os.windows.Win32Error.INVALID_FUNCTION});
929 }929 }
930930
lib/std/fmt/float.zig+1-1
...@@ -65,7 +65,7 @@ pub fn render(buf: []u8, value: anytype, options: Options) Error![]const u8 {...@@ -65,7 +65,7 @@ pub fn render(buf: []u8, value: anytype, options: Options) Error![]const u8 {
6565
66 const DT = if (@bitSizeOf(T) <= 64) u64 else u128;66 const DT = if (@bitSizeOf(T) <= 64) u64 else u128;
67 const tables = switch (DT) {67 const tables = switch (DT) {
68 u64 => if (@import("builtin").mode == .ReleaseSmall) &Backend64_TablesSmall else &Backend64_TablesFull,68 u64 => if (@import("builtin").mode == .small) &Backend64_TablesSmall else &Backend64_TablesFull,
69 u128 => &Backend128_Tables,69 u128 => &Backend128_Tables,
70 else => unreachable,70 else => unreachable,
71 };71 };
lib/std/hash/benchmark.zig+1-1
...@@ -355,7 +355,7 @@ fn usage() void {...@@ -355,7 +355,7 @@ fn usage() void {
355}355}
356356
357fn mode(comptime x: comptime_int) comptime_int {357fn mode(comptime x: comptime_int) comptime_int {
358 return if (builtin.mode == .Debug) x / 64 else x;358 return if (builtin.mode == .debug) x / 64 else x;
359}359}
360360
361pub fn main(init: std.process.Init) !void {361pub fn main(init: std.process.Init) !void {
lib/std/heap/SafeAllocator.zig+1-1
...@@ -39,7 +39,7 @@ const SafeAllocator = @This();...@@ -39,7 +39,7 @@ const SafeAllocator = @This();
39const scoped_log = std.log.scoped(.SafeAllocator);39const scoped_log = std.log.scoped(.SafeAllocator);
4040
41pub const Options = struct {41pub const Options = struct {
42 const is_debug = @import("builtin").mode == .Debug;42 const is_debug = @import("builtin").mode == .debug;
43 const page_size_log2 = @max(math.log2_int(usize, std.heap.page_size_max), 8);43 const page_size_log2 = @max(math.log2_int(usize, std.heap.page_size_max), 8);
4444
45 stack_trace_frames: usize = if (is_debug and std.debug.sys_can_stack_trace) 7 else 0,45 stack_trace_frames: usize = if (is_debug and std.debug.sys_can_stack_trace) 7 else 0,
lib/std/http/test.zig+9-9
...@@ -34,7 +34,7 @@ test "content length reader state update" {...@@ -34,7 +34,7 @@ test "content length reader state update" {
34}34}
3535
36test "trailers" {36test "trailers" {
37 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/19425737 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
38 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/3080638 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
3939
40 const io = std.testing.io;40 const io = std.testing.io;
...@@ -121,7 +121,7 @@ test "trailers" {...@@ -121,7 +121,7 @@ test "trailers" {
121}121}
122122
123test "HTTP server handles a chunked transfer coding request" {123test "HTTP server handles a chunked transfer coding request" {
124 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257124 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
125 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806125 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
126126
127 const io = std.testing.io;127 const io = std.testing.io;
...@@ -190,7 +190,7 @@ test "HTTP server handles a chunked transfer coding request" {...@@ -190,7 +190,7 @@ test "HTTP server handles a chunked transfer coding request" {
190}190}
191191
192test "echo content server" {192test "echo content server" {
193 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257193 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
194 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806194 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
195195
196 const io = std.testing.io;196 const io = std.testing.io;
...@@ -281,7 +281,7 @@ test "echo content server" {...@@ -281,7 +281,7 @@ test "echo content server" {
281}281}
282282
283test "Server.Request.respondStreaming non-chunked, unknown content-length" {283test "Server.Request.respondStreaming non-chunked, unknown content-length" {
284 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257284 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
285 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806285 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
286286
287 const io = std.testing.io;287 const io = std.testing.io;
...@@ -360,7 +360,7 @@ test "Server.Request.respondStreaming non-chunked, unknown content-length" {...@@ -360,7 +360,7 @@ test "Server.Request.respondStreaming non-chunked, unknown content-length" {
360}360}
361361
362test "receiving arbitrary http headers from the client" {362test "receiving arbitrary http headers from the client" {
363 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257363 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
364 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806364 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
365365
366 const io = std.testing.io;366 const io = std.testing.io;
...@@ -426,7 +426,7 @@ test "receiving arbitrary http headers from the client" {...@@ -426,7 +426,7 @@ test "receiving arbitrary http headers from the client" {
426}426}
427427
428test "general client/server API coverage" {428test "general client/server API coverage" {
429 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257429 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
430 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806430 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
431431
432 const io = std.testing.io;432 const io = std.testing.io;
...@@ -922,7 +922,7 @@ test "general client/server API coverage" {...@@ -922,7 +922,7 @@ test "general client/server API coverage" {
922}922}
923923
924test "Server streams both reading and writing" {924test "Server streams both reading and writing" {
925 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257925 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
926 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806926 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
927927
928 const io = std.testing.io;928 const io = std.testing.io;
...@@ -1192,7 +1192,7 @@ fn createTestServer(io: Io, S: type) !*TestServer {...@@ -1192,7 +1192,7 @@ fn createTestServer(io: Io, S: type) !*TestServer {
1192}1192}
11931193
1194test "redirect to different connection" {1194test "redirect to different connection" {
1195 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/1942571195 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
1196 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/308061196 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
11971197
1198 const io = std.testing.io;1198 const io = std.testing.io;
...@@ -1280,7 +1280,7 @@ test "redirect to different connection" {...@@ -1280,7 +1280,7 @@ test "redirect to different connection" {
1280}1280}
12811281
1282test "boot failed connections from the pool" {1282test "boot failed connections from the pool" {
1283 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/1942571283 if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257
1284 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/308061284 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
12851285
1286 const io = std.testing.io;1286 const io = std.testing.io;
lib/std/json/Stringify.zig+3-3
...@@ -54,8 +54,8 @@ else...@@ -54,8 +54,8 @@ else
54 void = if (build_mode_has_safety) .none else {},54 void = if (build_mode_has_safety) .none else {},
5555
56const build_mode_has_safety = switch (@import("builtin").mode) {56const build_mode_has_safety = switch (@import("builtin").mode) {
57 .Debug, .ReleaseSafe => true,57 .debug, .safe => true,
58 .ReleaseFast, .ReleaseSmall => false,58 .fast, .small => false,
59};59};
6060
61/// The `safety_checks_hint` parameter determines how much memory is used to enable assertions that the above grammar is being followed,61/// The `safety_checks_hint` parameter determines how much memory is used to enable assertions that the above grammar is being followed,
...@@ -66,7 +66,7 @@ const build_mode_has_safety = switch (@import("builtin").mode) {...@@ -66,7 +66,7 @@ const build_mode_has_safety = switch (@import("builtin").mode) {
66/// If `.checked_to_fixed_depth` is used, there is additionally an assertion that the nesting depth never exceeds the given limit.66/// If `.checked_to_fixed_depth` is used, there is additionally an assertion that the nesting depth never exceeds the given limit.
67/// `.checked_to_fixed_depth` embeds the storage required in the `Stringify` struct.67/// `.checked_to_fixed_depth` embeds the storage required in the `Stringify` struct.
68/// `.assumed_correct` requires no space and performs none of these assertions.68/// `.assumed_correct` requires no space and performs none of these assertions.
69/// In `ReleaseFast` and `ReleaseSmall` mode, the given `safety_checks_hint` is ignored and is always treated as `.assumed_correct`.69/// In fast and small optimization modes, the given `safety_checks_hint` is ignored and is always treated as `.assumed_correct`.
70const safety_checks_hint: union(enum) {70const safety_checks_hint: union(enum) {
71 /// Rounded up to the nearest multiple of 8.71 /// Rounded up to the nearest multiple of 8.
72 checked_to_fixed_depth: usize,72 checked_to_fixed_depth: usize,
lib/std/lang.zig+35-5
...@@ -107,13 +107,43 @@ pub const CodeModel = enum(u4) {...@@ -107,13 +107,43 @@ pub const CodeModel = enum(u4) {
107 tiny,107 tiny,
108};108};
109109
110/// Deprecated, to be removed after 0.18.0
111pub const OptimizeMode = Optimize;
112
110/// This data structure is used by the Zig language code generation and113/// This data structure is used by the Zig language code generation and
111/// therefore must be kept in sync with the compiler implementation.114/// therefore must be kept in sync with the compiler implementation.
112pub const OptimizeMode = enum {115pub const Optimize = enum {
113 Debug,116 /// Safety checks enabled. Optimize for bug detection, accurate debug info,
114 ReleaseSafe,117 /// and compilation speed (in that order).
115 ReleaseFast,118 debug,
116 ReleaseSmall,119 /// Safety checks enabled. Optimize for runtime performance.
120 safe,
121 /// Safety checks disabled. Optimize for runtime performance.
122 fast,
123 /// Safety checks disabled. Optimize for machine code size, then runtime performance.
124 small,
125
126 /// Deprecated, to be removed after 0.18.0
127 pub const Debug: @This() = .debug;
128 /// Deprecated, to be removed after 0.18.0
129 pub const ReleaseSafe: @This() = .safe;
130 /// Deprecated, to be removed after 0.18.0
131 pub const ReleaseFast: @This() = .fast;
132 /// Deprecated, to be removed after 0.18.0
133 pub const ReleaseSmall: @This() = .small;
134 /// Deprecated, to be removed after 0.18.0
135 pub fn fromString(s: []const u8) ?@This() {
136 return std.StaticStringMap(@This()).initComptime(&.{
137 .{ "Debug", .debug },
138 .{ "ReleaseSafe", .safe },
139 .{ "ReleaseFast", .fast },
140 .{ "ReleaseSmall", .small },
141 .{ "debug", .debug },
142 .{ "safe", .safe },
143 .{ "fast", .fast },
144 .{ "small", .small },
145 }).get(s);
146 }
117};147};
118148
119/// The calling convention of a function defines how arguments and return values are passed, as well149/// The calling convention of a function defines how arguments and return values are passed, as well
lib/std/log.zig+1-1
...@@ -53,7 +53,7 @@ pub const Level = enum {...@@ -53,7 +53,7 @@ pub const Level = enum {
53/// The default log level is based on build mode.53/// The default log level is based on build mode.
54pub const default_level: Level = switch (builtin.mode) {54pub const default_level: Level = switch (builtin.mode) {
55 .Debug => .debug,55 .Debug => .debug,
56 .ReleaseSafe, .ReleaseFast, .ReleaseSmall => .info,56 .safe, .fast, .small => .info,
57};57};
5858
59pub const ScopeLevel = struct {59pub const ScopeLevel = struct {
lib/std/math/hypot.zig+4-4
...@@ -93,13 +93,13 @@ const hypot_test_cases = .{...@@ -93,13 +93,13 @@ const hypot_test_cases = .{
93};93};
9494
95test hypot {95test hypot {
96 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/17186996 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869
97 try expect(hypot(0.3, 0.4) == 0.5);97 try expect(hypot(0.3, 0.4) == 0.5);
98}98}
9999
100test "hypot.correct" {100test "hypot.correct" {
101 if (builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag == .macos) return error.SkipZigTest;101 if (builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag == .macos) return error.SkipZigTest;
102 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869102 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869
103103
104 inline for (.{ f16, f32, f64, f128 }) |T| {104 inline for (.{ f16, f32, f64, f128 }) |T| {
105 inline for (hypot_test_cases) |v| {105 inline for (hypot_test_cases) |v| {
...@@ -111,7 +111,7 @@ test "hypot.correct" {...@@ -111,7 +111,7 @@ test "hypot.correct" {
111111
112test "hypot.precise" {112test "hypot.precise" {
113 if (builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag == .macos) return error.SkipZigTest;113 if (builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag == .macos) return error.SkipZigTest;
114 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869114 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869
115115
116 inline for (.{ f16, f32, f64 }) |T| { // f128 seems to be 5 ulp116 inline for (.{ f16, f32, f64 }) |T| { // f128 seems to be 5 ulp
117 inline for (hypot_test_cases) |v| {117 inline for (hypot_test_cases) |v| {
...@@ -122,7 +122,7 @@ test "hypot.precise" {...@@ -122,7 +122,7 @@ test "hypot.precise" {
122}122}
123123
124test "hypot.special" {124test "hypot.special" {
125 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869125 if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869
126 @setEvalBranchQuota(2000);126 @setEvalBranchQuota(2000);
127 inline for (.{ f16, f32, f64, f128 }) |T| {127 inline for (.{ f16, f32, f64, f128 }) |T| {
128 try expect(math.isNan(hypot(nan(T), 0.0)));128 try expect(math.isNan(hypot(nan(T), 0.0)));
lib/std/process.zig+2-2
...@@ -644,7 +644,7 @@ pub fn totalSystemMemory() TotalSystemMemoryError!u64 {...@@ -644,7 +644,7 @@ pub fn totalSystemMemory() TotalSystemMemoryError!u64 {
644/// leaks can be accurate. In release builds, this calls `exit` with code zero,644/// leaks can be accurate. In release builds, this calls `exit` with code zero,
645/// and does not return.645/// and does not return.
646pub fn cleanExit(io: Io) void {646pub fn cleanExit(io: Io) void {
647 if (builtin.mode == .Debug) return;647 if (builtin.mode == .debug) return;
648 _ = io.lockStderr(&.{}, .no_color) catch {};648 _ = io.lockStderr(&.{}, .no_color) catch {};
649 exit(0);649 exit(0);
650}650}
...@@ -809,7 +809,7 @@ pub fn abort() noreturn {...@@ -809,7 +809,7 @@ pub fn abort() noreturn {
809 // even when linking libc on Windows we use our own abort implementation.809 // even when linking libc on Windows we use our own abort implementation.
810 // See https://github.com/ziglang/zig/issues/2071 for more details.810 // See https://github.com/ziglang/zig/issues/2071 for more details.
811 if (native_os == .windows) {811 if (native_os == .windows) {
812 if (builtin.mode == .Debug and windows.peb().BeingDebugged.toBool()) {812 if (builtin.mode == .debug and windows.peb().BeingDebugged.toBool()) {
813 @breakpoint();813 @breakpoint();
814 }814 }
815 windows.ntdll.RtlExitUserProcess(3);815 windows.ntdll.RtlExitUserProcess(3);
lib/std/sort/block.zig+1-1
...@@ -103,7 +103,7 @@ pub fn block(...@@ -103,7 +103,7 @@ pub fn block(
103 context: anytype,103 context: anytype,
104 comptime lessThanFn: fn (@TypeOf(context), lhs: T, rhs: T) bool,104 comptime lessThanFn: fn (@TypeOf(context), lhs: T, rhs: T) bool,
105) void {105) void {
106 const lessThan = if (builtin.mode == .Debug) struct {106 const lessThan = if (builtin.mode == .debug) struct {
107 fn lessThan(ctx: @TypeOf(context), lhs: T, rhs: T) bool {107 fn lessThan(ctx: @TypeOf(context), lhs: T, rhs: T) bool {
108 const lt = lessThanFn(ctx, lhs, rhs);108 const lt = lessThanFn(ctx, lhs, rhs);
109 const gt = lessThanFn(ctx, rhs, lhs);109 const gt = lessThanFn(ctx, rhs, lhs);
lib/std/start.zig+2-2
...@@ -742,8 +742,8 @@ fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.c) c_int {...@@ -742,8 +742,8 @@ fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.c) c_int {
742const bad_main_ret = "expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'";742const bad_main_ret = "expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'";
743743
744const use_safe_allocator = !is_wasm and switch (builtin.mode) {744const use_safe_allocator = !is_wasm and switch (builtin.mode) {
745 .Debug, .ReleaseSafe => true,745 .debug, .safe => true,
746 .ReleaseFast, .ReleaseSmall => !builtin.link_libc and builtin.single_threaded, // Also not ideal.746 .fast, .small => !builtin.link_libc and builtin.single_threaded, // Also not ideal.
747};747};
748var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});748var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});
749749
lib/std/std.zig+2-2
...@@ -162,7 +162,7 @@ pub const Options = struct {...@@ -162,7 +162,7 @@ pub const Options = struct {
162 /// This enables `std.http.Client` to log ssl secrets to the file specified by the SSLKEYLOGFILE162 /// This enables `std.http.Client` to log ssl secrets to the file specified by the SSLKEYLOGFILE
163 /// env var. Creating such a log file allows other programs with access to that file to decrypt163 /// env var. Creating such a log file allows other programs with access to that file to decrypt
164 /// all `std.http.Client` traffic made by this program.164 /// all `std.http.Client` traffic made by this program.
165 http_enable_ssl_key_log_file: bool = @import("builtin").mode == .Debug,165 http_enable_ssl_key_log_file: bool = @import("builtin").mode == .debug,
166166
167 side_channels_mitigations: crypto.SideChannelsMitigations = crypto.default_side_channels_mitigations,167 side_channels_mitigations: crypto.SideChannelsMitigations = crypto.default_side_channels_mitigations,
168168
...@@ -192,7 +192,7 @@ pub const Options = struct {...@@ -192,7 +192,7 @@ pub const Options = struct {
192 /// If this happens the fix is to add the error code to the corresponding192 /// If this happens the fix is to add the error code to the corresponding
193 /// switch expression, possibly introduce a new error in the error set, and193 /// switch expression, possibly introduce a new error in the error set, and
194 /// send a patch to Zig.194 /// send a patch to Zig.
195 unexpected_error_tracing: bool = @import("builtin").mode == .Debug and switch (@import("builtin").zig_backend) {195 unexpected_error_tracing: bool = @import("builtin").mode == .debug and switch (@import("builtin").zig_backend) {
196 .stage2_llvm, .stage2_x86_64 => true,196 .stage2_llvm, .stage2_x86_64 => true,
197 else => false,197 else => false,
198 },198 },
lib/std/zig/Zir.zig+1-1
...@@ -2522,7 +2522,7 @@ pub const Inst = struct {...@@ -2522,7 +2522,7 @@ pub const Inst = struct {
2522 // bigger than expected. Note that in Debug builds, Zig is allowed2522 // bigger than expected. Note that in Debug builds, Zig is allowed
2523 // to insert a secret field for safety checks.2523 // to insert a secret field for safety checks.
2524 comptime {2524 comptime {
2525 if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {2525 if (builtin.mode != .debug and builtin.mode != .safe) {
2526 assert(@sizeOf(Data) == 8);2526 assert(@sizeOf(Data) == 8);
2527 }2527 }
2528 }2528 }
src/Builtin.zig+4-2
...@@ -7,7 +7,7 @@ is_test: bool,...@@ -7,7 +7,7 @@ is_test: bool,
7single_threaded: bool,7single_threaded: bool,
8link_libc: bool,8link_libc: bool,
9link_libcpp: bool,9link_libcpp: bool,
10optimize_mode: std.lang.OptimizeMode,10optimize_mode: std.lang.Optimize,
11error_tracing: bool,11error_tracing: bool,
12valgrind: bool,12valgrind: bool,
13sanitize_thread: bool,13sanitize_thread: bool,
...@@ -239,7 +239,9 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro...@@ -239,7 +239,9 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro
239239
240 try buffer.print(240 try buffer.print(
241 \\pub const object_format: std.Target.ObjectFormat = .{f};241 \\pub const object_format: std.Target.ObjectFormat = .{f};
242 \\pub const mode: std.lang.OptimizeMode = .{f};242 \\/// Deprecated, to be removed after 0.18.0
243 \\pub const mode = optimize;
244 \\pub const optimize: std.lang.Optimize = .{f};
243 \\pub const link_libc = {};245 \\pub const link_libc = {};
244 \\pub const link_libcpp = {};246 \\pub const link_libcpp = {};
245 \\pub const have_error_return_tracing = {};247 \\pub const have_error_return_tracing = {};
src/Compilation.zig+20-20
...@@ -172,7 +172,7 @@ verbose_link: bool,...@@ -172,7 +172,7 @@ verbose_link: bool,
172link_depfile: ?[]const u8,172link_depfile: ?[]const u8,
173disable_c_depfile: bool,173disable_c_depfile: bool,
174stack_report: bool,174stack_report: bool,
175debug_compiler_runtime_libs: ?std.lang.OptimizeMode,175debug_compiler_runtime_libs: ?std.lang.Optimize,
176debug_compile_errors: bool,176debug_compile_errors: bool,
177/// Do not check this field directly. Instead, use the `debugIncremental` wrapper function.177/// Do not check this field directly. Instead, use the `debugIncremental` wrapper function.
178debug_incremental: bool,178debug_incremental: bool,
...@@ -1506,7 +1506,7 @@ pub const CreateOptions = struct {...@@ -1506,7 +1506,7 @@ pub const CreateOptions = struct {
1506 verbose_llvm_bc: ?[]const u8 = null,1506 verbose_llvm_bc: ?[]const u8 = null,
1507 link_depfile: ?[]const u8 = null,1507 link_depfile: ?[]const u8 = null,
1508 verbose_llvm_cpu_features: bool = false,1508 verbose_llvm_cpu_features: bool = false,
1509 debug_compiler_runtime_libs: ?std.lang.OptimizeMode = null,1509 debug_compiler_runtime_libs: ?std.lang.Optimize = null,
1510 debug_compile_errors: bool = false,1510 debug_compile_errors: bool = false,
1511 debug_incremental: bool = false,1511 debug_incremental: bool = false,
1512 /// Normally when you create a `Compilation`, Zig will automatically build1512 /// Normally when you create a `Compilation`, Zig will automatically build
...@@ -2160,7 +2160,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,...@@ -2160,7 +2160,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
2160 .framework_dirs = options.framework_dirs,2160 .framework_dirs = options.framework_dirs,
2161 .rpath_list = options.rpath_list,2161 .rpath_list = options.rpath_list,
2162 .symbol_wrap_set = options.symbol_wrap_set,2162 .symbol_wrap_set = options.symbol_wrap_set,
2163 .repro = options.linker_repro orelse (options.root_mod.optimize_mode != .Debug),2163 .repro = options.linker_repro orelse (options.root_mod.optimize_mode != .debug),
2164 .allow_shlib_undefined = options.linker_allow_shlib_undefined,2164 .allow_shlib_undefined = options.linker_allow_shlib_undefined,
2165 .bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false,2165 .bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false,
2166 .compress_debug_sections = options.linker_compress_debug_sections orelse .none,2166 .compress_debug_sections = options.linker_compress_debug_sections orelse .none,
...@@ -3189,8 +3189,8 @@ fn flush(comp: *Compilation, arena: Allocator) (Io.Cancelable || Allocator.Error...@@ -3189,8 +3189,8 @@ fn flush(comp: *Compilation, arena: Allocator) (Io.Cancelable || Allocator.Error
3189 break :p try p.toStringZ(arena);3189 break :p try p.toStringZ(arena);
3190 },3190 },
31913191
3192 .is_debug = comp.root_mod.optimize_mode == .Debug,3192 .is_debug = comp.root_mod.optimize_mode == .debug,
3193 .is_small = comp.root_mod.optimize_mode == .ReleaseSmall,3193 .is_small = comp.root_mod.optimize_mode == .small,
3194 .time_report = if (comp.time_report) |*p| p else null,3194 .time_report = if (comp.time_report) |*p| p else null,
3195 .sanitize_thread = comp.config.any_sanitize_thread,3195 .sanitize_thread = comp.config.any_sanitize_thread,
3196 .fuzz = comp.config.any_fuzz,3196 .fuzz = comp.config.any_fuzz,
...@@ -4744,7 +4744,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU...@@ -4744,7 +4744,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
4744 defer arena_allocator.deinit();4744 defer arena_allocator.deinit();
4745 const arena = arena_allocator.allocator();4745 const arena = arena_allocator.allocator();
47464746
4747 const optimize_mode = std.lang.OptimizeMode.ReleaseSmall;4747 const optimize_mode: std.lang.Optimize = .small;
4748 const output_mode = std.lang.OutputMode.Exe;4748 const output_mode = std.lang.OutputMode.Exe;
4749 const resolved_target: Module.ResolvedTarget = .{4749 const resolved_target: Module.ResolvedTarget = .{
4750 .result = std.zig.system.resolveTargetQuery(io, .{4750 .result = std.zig.system.resolveTargetQuery(io, .{
...@@ -5910,8 +5910,8 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32...@@ -5910,8 +5910,8 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
5910 // them being defined matches the behavior of how MSVC calls rc.exe which is the more5910 // them being defined matches the behavior of how MSVC calls rc.exe which is the more
5911 // relevant behavior in this case.5911 // relevant behavior in this case.
5912 switch (rc_src.owner.optimize_mode) {5912 switch (rc_src.owner.optimize_mode) {
5913 .Debug, .ReleaseSafe => {},5913 .debug, .safe => {},
5914 .ReleaseFast, .ReleaseSmall => try argv.append("-DNDEBUG"),5914 .fast, .small => try argv.append("-DNDEBUG"),
5915 }5915 }
5916 try argv.appendSlice(rc_src.extra_flags);5916 try argv.appendSlice(rc_src.extra_flags);
5917 try argv.appendSlice(&.{ "--", rc_src.src_path, out_res_path });5917 try argv.appendSlice(&.{ "--", rc_src.src_path, out_res_path });
...@@ -6178,11 +6178,11 @@ fn addCommonCCArgs(...@@ -6178,11 +6178,11 @@ fn addCommonCCArgs(
6178 // LLVM IR files don't support these flags.6178 // LLVM IR files don't support these flags.
6179 if (ext != .ll and ext != .bc) {6179 if (ext != .ll and ext != .bc) {
6180 switch (mod.optimize_mode) {6180 switch (mod.optimize_mode) {
6181 .Debug => {},6181 .debug => {},
6182 .ReleaseSafe => {6182 .safe => {
6183 try argv.append("-D_FORTIFY_SOURCE=2");6183 try argv.append("-D_FORTIFY_SOURCE=2");
6184 },6184 },
6185 .ReleaseFast, .ReleaseSmall => {6185 .fast, .small => {
6186 try argv.append("-DNDEBUG");6186 try argv.append("-DNDEBUG");
6187 },6187 },
6188 }6188 }
...@@ -6333,7 +6333,7 @@ fn addCommonCCArgs(...@@ -6333,7 +6333,7 @@ fn addCommonCCArgs(
6333 }6333 }
6334 }6334 }
63356335
6336 if (mod.optimize_mode != .Debug) {6336 if (mod.optimize_mode != .debug) {
6337 try argv.append("-Werror=date-time");6337 try argv.append("-Werror=date-time");
6338 }6338 }
6339 },6339 },
...@@ -6412,18 +6412,18 @@ fn addCommonCCArgs(...@@ -6412,18 +6412,18 @@ fn addCommonCCArgs(
6412 }6412 }
64136413
6414 switch (mod.optimize_mode) {6414 switch (mod.optimize_mode) {
6415 .Debug => {6415 .debug => {
6416 // Clang has -Og for compatibility with GCC, but currently it is just equivalent6416 // Clang has -Og for compatibility with GCC, but currently it is just equivalent
6417 // to -O1. Besides potentially impairing debugging, -O1/-Og significantly6417 // to -O1. Besides potentially impairing debugging, -O1/-Og significantly
6418 // increases compile times.6418 // increases compile times.
6419 try argv.append("-O0");6419 try argv.append("-O0");
6420 },6420 },
6421 .ReleaseSafe => {6421 .safe => {
6422 // See the comment in the BuildModeFastRelease case for why we pass -O2 rather6422 // See the comment in the BuildModeFastRelease case for why we pass -O2 rather
6423 // than -O3 here.6423 // than -O3 here.
6424 try argv.append("-O2");6424 try argv.append("-O2");
6425 },6425 },
6426 .ReleaseFast => {6426 .fast => {
6427 // Here we pass -O2 rather than -O3 because, although we do the equivalent of6427 // Here we pass -O2 rather than -O3 because, although we do the equivalent of
6428 // -O3 in Zig code, the justification for the difference here is that Zig6428 // -O3 in Zig code, the justification for the difference here is that Zig
6429 // has better detection and prevention of undefined behavior, so -O3 is safer for6429 // has better detection and prevention of undefined behavior, so -O3 is safer for
...@@ -6431,7 +6431,7 @@ fn addCommonCCArgs(...@@ -6431,7 +6431,7 @@ fn addCommonCCArgs(
6431 // running in -O2 and thus the -O3 path has been tested less.6431 // running in -O2 and thus the -O3 path has been tested less.
6432 try argv.append("-O2");6432 try argv.append("-O2");
6433 },6433 },
6434 .ReleaseSmall => {6434 .small => {
6435 try argv.append("-Os");6435 try argv.append("-Os");
6436 },6436 },
6437 }6437 }
...@@ -7557,15 +7557,15 @@ pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void {...@@ -7557,15 +7557,15 @@ pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void {
75577557
7558/// This decides the optimization mode for all zig-provided libraries, including7558/// This decides the optimization mode for all zig-provided libraries, including
7559/// compiler-rt, libcxx, libc, libunwind, etc.7559/// compiler-rt, libcxx, libc, libunwind, etc.
7560pub fn compilerRtOptMode(comp: Compilation) std.lang.OptimizeMode {7560pub fn compilerRtOptMode(comp: Compilation) std.lang.Optimize {
7561 if (comp.debug_compiler_runtime_libs) |mode| {7561 if (comp.debug_compiler_runtime_libs) |mode| {
7562 return mode;7562 return mode;
7563 }7563 }
7564 const target = &comp.root_mod.resolved_target.result;7564 const target = &comp.root_mod.resolved_target.result;
7565 switch (comp.root_mod.optimize_mode) {7565 switch (comp.root_mod.optimize_mode) {
7566 .Debug, .ReleaseSafe => return target_util.defaultCompilerRtOptimizeMode(target),7566 .debug, .safe => return target_util.defaultCompilerRtOptimizeMode(target),
7567 .ReleaseFast => return .ReleaseFast,7567 .fast => return .fast,
7568 .ReleaseSmall => return .ReleaseSmall,7568 .small => return .small,
7569 }7569 }
7570}7570}
75717571
src/Compilation/Config.zig+7-7
...@@ -59,7 +59,7 @@ export_memory: bool,...@@ -59,7 +59,7 @@ export_memory: bool,
59shared_memory: bool,59shared_memory: bool,
60is_test: bool,60is_test: bool,
61debug_format: DebugFormat,61debug_format: DebugFormat,
62root_optimize_mode: std.lang.OptimizeMode,62root_optimize_mode: std.lang.Optimize,
63root_strip: bool,63root_strip: bool,
64root_error_tracing: bool,64root_error_tracing: bool,
65dll_export_fns: bool,65dll_export_fns: bool,
...@@ -80,7 +80,7 @@ pub const Options = struct {...@@ -80,7 +80,7 @@ pub const Options = struct {
80 is_test: bool,80 is_test: bool,
81 have_zcu: bool,81 have_zcu: bool,
82 emit_bin: bool,82 emit_bin: bool,
83 root_optimize_mode: ?std.lang.OptimizeMode = null,83 root_optimize_mode: ?std.lang.Optimize = null,
84 root_strip: ?bool = null,84 root_strip: ?bool = null,
85 root_error_tracing: ?bool = null,85 root_error_tracing: ?bool = null,
86 link_mode: ?std.lang.LinkMode = null,86 link_mode: ?std.lang.LinkMode = null,
...@@ -196,7 +196,7 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -196,7 +196,7 @@ pub fn resolve(options: Options) ResolveError!Config {
196 break :b options.use_lib_llvm orelse true;196 break :b options.use_lib_llvm orelse true;
197 };197 };
198198
199 const root_optimize_mode = options.root_optimize_mode orelse .Debug;199 const root_optimize_mode = options.root_optimize_mode orelse .debug;
200200
201 // Make a decision on whether to use Clang or Aro for translate-c and compiling C files.201 // Make a decision on whether to use Clang or Aro for translate-c and compiling C files.
202 const c_frontend: CFrontend = b: {202 const c_frontend: CFrontend = b: {
...@@ -357,7 +357,7 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -357,7 +357,7 @@ pub fn resolve(options: Options) ResolveError!Config {
357 if (!use_lib_llvm and options.emit_bin) break :b false;357 if (!use_lib_llvm and options.emit_bin) break :b false;
358358
359 // Prefer LLVM for release builds.359 // Prefer LLVM for release builds.
360 if (root_optimize_mode != .Debug) break :b true;360 if (root_optimize_mode != .debug) break :b true;
361361
362 // load_dynamic_library standalone test not passing on this combination362 // load_dynamic_library standalone test not passing on this combination
363 // https://github.com/ziglang/zig/issues/24080363 // https://github.com/ziglang/zig/issues/24080
...@@ -486,7 +486,7 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -486,7 +486,7 @@ pub fn resolve(options: Options) ResolveError!Config {
486486
487 const root_strip = b: {487 const root_strip = b: {
488 if (options.root_strip) |x| break :b x;488 if (options.root_strip) |x| break :b x;
489 if (root_optimize_mode == .ReleaseSmall) break :b true;489 if (root_optimize_mode == .small) break :b true;
490 if (!target_util.hasDebugInfo(target)) break :b true;490 if (!target_util.hasDebugInfo(target)) break :b true;
491 break :b false;491 break :b false;
492 };492 };
...@@ -512,8 +512,8 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -512,8 +512,8 @@ pub fn resolve(options: Options) ResolveError!Config {
512 if (root_strip) break :b false;512 if (root_strip) break :b false;
513 if (!backend_supports_error_tracing) break :b false;513 if (!backend_supports_error_tracing) break :b false;
514 break :b switch (root_optimize_mode) {514 break :b switch (root_optimize_mode) {
515 .Debug => true,515 .debug => true,
516 .ReleaseSafe, .ReleaseFast, .ReleaseSmall => false,516 .safe, .fast, .small => false,
517 };517 };
518 };518 };
519519
src/Module.zig+9-9
...@@ -26,7 +26,7 @@ fully_qualified_name: []const u8,...@@ -26,7 +26,7 @@ fully_qualified_name: []const u8,
26deps: Deps = .{},26deps: Deps = .{},
2727
28resolved_target: ResolvedTarget,28resolved_target: ResolvedTarget,
29optimize_mode: std.lang.OptimizeMode,29optimize_mode: std.lang.Optimize,
30code_model: std.lang.CodeModel,30code_model: std.lang.CodeModel,
31single_threaded: bool,31single_threaded: bool,
32error_tracing: bool,32error_tracing: bool,
...@@ -67,7 +67,7 @@ pub const CreateOptions = struct {...@@ -67,7 +67,7 @@ pub const CreateOptions = struct {
67 pub const Inherited = struct {67 pub const Inherited = struct {
68 /// If this is null then `parent` must be non-null.68 /// If this is null then `parent` must be non-null.
69 resolved_target: ?ResolvedTarget = null,69 resolved_target: ?ResolvedTarget = null,
70 optimize_mode: ?std.lang.OptimizeMode = null,70 optimize_mode: ?std.lang.Optimize = null,
71 code_model: ?std.lang.CodeModel = null,71 code_model: ?std.lang.CodeModel = null,
72 single_threaded: ?bool = null,72 single_threaded: ?bool = null,
73 error_tracing: ?bool = null,73 error_tracing: ?bool = null,
...@@ -144,7 +144,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {...@@ -144,7 +144,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {
144 if (options.inherited.valgrind) |x| break :b x;144 if (options.inherited.valgrind) |x| break :b x;
145 if (options.parent) |p| break :b p.valgrind;145 if (options.parent) |p| break :b p.valgrind;
146 if (strip) break :b false;146 if (strip) break :b false;
147 break :b optimize_mode == .Debug;147 break :b optimize_mode == .debug;
148 };148 };
149149
150 const single_threaded = b: {150 const single_threaded = b: {
...@@ -212,7 +212,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {...@@ -212,7 +212,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {
212 const omit_frame_pointer = b: {212 const omit_frame_pointer = b: {
213 if (options.inherited.omit_frame_pointer) |x| break :b x;213 if (options.inherited.omit_frame_pointer) |x| break :b x;
214 if (options.parent) |p| break :b p.omit_frame_pointer;214 if (options.parent) |p| break :b p.omit_frame_pointer;
215 if (optimize_mode == .ReleaseSmall) {215 if (optimize_mode == .small) {
216 // On x86, in most cases, keeping the frame pointer usually results in smaller binary size.216 // On x86, in most cases, keeping the frame pointer usually results in smaller binary size.
217 // This has to do with how instructions for memory access via the stack base pointer register (when keeping the frame pointer)217 // This has to do with how instructions for memory access via the stack base pointer register (when keeping the frame pointer)
218 // are smaller than instructions for memory access via the stack pointer register (when omitting the frame pointer).218 // are smaller than instructions for memory access via the stack pointer register (when omitting the frame pointer).
...@@ -251,21 +251,21 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {...@@ -251,21 +251,21 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {
251 };251 };
252252
253 const is_safe_mode = switch (optimize_mode) {253 const is_safe_mode = switch (optimize_mode) {
254 .Debug, .ReleaseSafe => true,254 .debug, .safe => true,
255 .ReleaseFast, .ReleaseSmall => false,255 .fast, .small => false,
256 };256 };
257257
258 const sanitize_c: std.zig.SanitizeC = b: {258 const sanitize_c: std.zig.SanitizeC = b: {
259 if (options.inherited.sanitize_c) |x| break :b x;259 if (options.inherited.sanitize_c) |x| break :b x;
260 if (options.parent) |p| break :b p.sanitize_c;260 if (options.parent) |p| break :b p.sanitize_c;
261 break :b switch (optimize_mode) {261 break :b switch (optimize_mode) {
262 .Debug => .full,262 .debug => .full,
263 // It's recommended to use the minimal runtime in production263 // It's recommended to use the minimal runtime in production
264 // environments due to the security implications of the full runtime.264 // environments due to the security implications of the full runtime.
265 // The minimal runtime doesn't provide much benefit over simply265 // The minimal runtime doesn't provide much benefit over simply
266 // trapping, however, so we do that instead.266 // trapping, however, so we do that instead.
267 .ReleaseSafe => .trap,267 .safe => .trap,
268 .ReleaseFast, .ReleaseSmall => .off,268 .fast, .small => .off,
269 };269 };
270 };270 };
271271
src/Sema.zig+9-9
...@@ -532,20 +532,20 @@ pub const Block = struct {...@@ -532,20 +532,20 @@ pub const Block = struct {
532532
533 fn wantSafeTypes(block: *const Block) bool {533 fn wantSafeTypes(block: *const Block) bool {
534 return block.want_safety orelse switch (block.ownerModule().optimize_mode) {534 return block.want_safety orelse switch (block.ownerModule().optimize_mode) {
535 .Debug => true,535 .debug => true,
536 .ReleaseSafe => true,536 .safe => true,
537 .ReleaseFast => false,537 .fast => false,
538 .ReleaseSmall => false,538 .small => false,
539 };539 };
540 }540 }
541541
542 fn wantSafety(block: *const Block) bool {542 fn wantSafety(block: *const Block) bool {
543 if (block.isComptime()) return false; // runtime safety checks are pointless in comptime blocks543 if (block.isComptime()) return false; // runtime safety checks are pointless in comptime blocks
544 return block.want_safety orelse switch (block.ownerModule().optimize_mode) {544 return block.want_safety orelse switch (block.ownerModule().optimize_mode) {
545 .Debug => true,545 .debug => true,
546 .ReleaseSafe => true,546 .safe => true,
547 .ReleaseFast => false,547 .fast => false,
548 .ReleaseSmall => false,548 .small => false,
549 };549 };
550 }550 }
551551
...@@ -2247,7 +2247,7 @@ fn resolveValue(sema: *Sema, inst: Air.Inst.Ref) ?Value {...@@ -2247,7 +2247,7 @@ fn resolveValue(sema: *Sema, inst: Air.Inst.Ref) ?Value {
2247 .inferred_alloc_comptime => unreachable, // assertion failure2247 .inferred_alloc_comptime => unreachable, // assertion failure
2248 else => {},2248 else => {},
2249 }2249 }
2250 // LLVM fails to eliminate this `classify` call in ReleaseFast, which hurts performance, so2250 // LLVM fails to eliminate this `classify` call in -Ofast, which hurts performance, so
2251 // we must explicitly check for `std.debug.runtime_safety`.2251 // we must explicitly check for `std.debug.runtime_safety`.
2252 if (std.debug.runtime_safety) switch (sema.typeOf(inst).classify(zcu)) {2252 if (std.debug.runtime_safety) switch (sema.typeOf(inst).classify(zcu)) {
2253 .no_possible_value => unreachable, // values of this type do not exist2253 .no_possible_value => unreachable, // values of this type do not exist
src/codegen/aarch64/Mir.zig+2-2
...@@ -70,8 +70,8 @@ pub fn emit(...@@ -70,8 +70,8 @@ pub fn emit(
7070
71 const func_align = switch (nav.resolved.?.@"align") {71 const func_align = switch (nav.resolved.?.@"align") {
72 .none => switch (mod.optimize_mode) {72 .none => switch (mod.optimize_mode) {
73 .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target),73 .debug, .safe, .fast => target_util.defaultFunctionAlignment(target),
74 .ReleaseSmall => target_util.minFunctionAlignment(target),74 .small => target_util.minFunctionAlignment(target),
75 },75 },
76 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),76 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
77 };77 };
src/codegen/c.zig+4-4
...@@ -453,8 +453,8 @@ pub const Function = struct {...@@ -453,8 +453,8 @@ pub const Function = struct {
453453
454 fn wantSafety(f: *Function) bool {454 fn wantSafety(f: *Function) bool {
455 return switch (f.dg.mod.optimize_mode) {455 return switch (f.dg.mod.optimize_mode) {
456 .Debug, .ReleaseSafe => true,456 .debug, .safe => true,
457 .ReleaseFast, .ReleaseSmall => false,457 .fast, .small => false,
458 };458 };
459 }459 }
460460
...@@ -1306,8 +1306,8 @@ pub const DeclGen = struct {...@@ -1306,8 +1306,8 @@ pub const DeclGen = struct {
1306 };1306 };
13071307
1308 const safety_on = switch (dg.mod.optimize_mode) {1308 const safety_on = switch (dg.mod.optimize_mode) {
1309 .Debug, .ReleaseSafe => true,1309 .debug, .safe => true,
1310 .ReleaseFast, .ReleaseSmall => false,1310 .fast, .small => false,
1311 };1311 };
13121312
1313 switch (ty.toIntern()) {1313 switch (ty.toIntern()) {
src/codegen/llvm.zig+4-4
...@@ -653,7 +653,7 @@ pub const Object = struct {...@@ -653,7 +653,7 @@ pub const Object = struct {
653 }),653 }),
654 debug_enums_fwd_ref,654 debug_enums_fwd_ref,
655 debug_globals_fwd_ref,655 debug_globals_fwd_ref,
656 .{ .optimized = comp.root_mod.optimize_mode != .Debug },656 .{ .optimized = comp.root_mod.optimize_mode != .debug },
657 );657 );
658658
659 try builder.addNamedMetadata(try builder.string("llvm.dbg.cu"), &.{debug_compile_unit});659 try builder.addNamedMetadata(try builder.string("llvm.dbg.cu"), &.{debug_compile_unit});
...@@ -1028,7 +1028,7 @@ pub const Object = struct {...@@ -1028,7 +1028,7 @@ pub const Object = struct {
10281028
1029 const optimize_mode = comp.root_mod.optimize_mode;1029 const optimize_mode = comp.root_mod.optimize_mode;
10301030
1031 const opt_level: bindings.CodeGenOptLevel = if (optimize_mode == .Debug)1031 const opt_level: bindings.CodeGenOptLevel = if (optimize_mode == .debug)
1032 .None1032 .None
1033 else1033 else
1034 .Aggressive;1034 .Aggressive;
...@@ -1299,7 +1299,7 @@ pub const Object = struct {...@@ -1299,7 +1299,7 @@ pub const Object = struct {
1299 .NoReturn = fn_info.return_type == .noreturn_type,1299 .NoReturn = fn_info.return_type == .noreturn_type,
1300 },1300 },
1301 .sp_flags = .{1301 .sp_flags = .{
1302 .Optimized = owner_mod.optimize_mode != .Debug,1302 .Optimized = owner_mod.optimize_mode != .debug,
1303 .Definition = true,1303 .Definition = true,
1304 .LocalToUnit = is_internal_linkage,1304 .LocalToUnit = is_internal_linkage,
1305 },1305 },
...@@ -2798,7 +2798,7 @@ pub const Object = struct {...@@ -2798,7 +2798,7 @@ pub const Object = struct {
2798 &o.builder,2798 &o.builder,
2799 );2799 );
2800 }2800 }
2801 if (owner_mod.optimize_mode == .ReleaseSmall) {2801 if (owner_mod.optimize_mode == .small) {
2802 try attributes.addFnAttr(.minsize, &o.builder);2802 try attributes.addFnAttr(.minsize, &o.builder);
2803 try attributes.addFnAttr(.optsize, &o.builder);2803 try attributes.addFnAttr(.optsize, &o.builder);
2804 }2804 }
src/codegen/llvm/FuncGen.zig+4-4
...@@ -696,7 +696,7 @@ fn genBodyDebugScope(...@@ -696,7 +696,7 @@ fn genBodyDebugScope(
696 .{696 .{
697 .di_flags = .{ .StaticMember = true },697 .di_flags = .{ .StaticMember = true },
698 .sp_flags = .{698 .sp_flags = .{
699 .Optimized = mod.optimize_mode != .Debug,699 .Optimized = mod.optimize_mode != .debug,
700 .Definition = true,700 .Definition = true,
701 .LocalToUnit = true, // inline functions cannot be exported701 .LocalToUnit = true, // inline functions cannot be exported
702 },702 },
...@@ -2516,7 +2516,7 @@ fn airDbgVarVal(self: *FuncGen, inst: Air.Inst.Index, is_arg: bool) Allocator.Er...@@ -2516,7 +2516,7 @@ fn airDbgVarVal(self: *FuncGen, inst: Air.Inst.Index, is_arg: bool) Allocator.Er
2516 },2516 },
2517 "",2517 "",
2518 );2518 );
2519 } else if (owner_mod.optimize_mode == .Debug and !self.is_naked) {2519 } else if (owner_mod.optimize_mode == .debug and !self.is_naked) {
2520 // We avoid taking this path for naked functions because there's no guarantee that such2520 // We avoid taking this path for naked functions because there's no guarantee that such
2521 // functions even have a valid stack pointer, making the `alloca` + `store` unsafe.2521 // functions even have a valid stack pointer, making the `alloca` + `store` unsafe.
25222522
...@@ -4689,7 +4689,7 @@ fn airArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {...@@ -4689,7 +4689,7 @@ fn airArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {
4689 },4689 },
4690 "",4690 "",
4691 );4691 );
4692 } else if (mod.optimize_mode == .Debug) {4692 } else if (mod.optimize_mode == .debug) {
4693 const alloca = try self.buildZigAlloca(inst_ty, .none);4693 const alloca = try self.buildZigAlloca(inst_ty, .none);
4694 try self.store(alloca, .none, arg_val, inst_ty, .normal);4694 try self.store(alloca, .none, arg_val, inst_ty, .normal);
4695 _ = try self.wip.callIntrinsic(4695 _ = try self.wip.callIntrinsic(
...@@ -4820,7 +4820,7 @@ fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Bu...@@ -4820,7 +4820,7 @@ fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Bu
4820 // unexpected call in the user's code. This is problematic if the code in question is4820 // unexpected call in the user's code. This is problematic if the code in question is
4821 // not ready to correctly make calls yet, such as in our early PIE startup code, or in4821 // not ready to correctly make calls yet, such as in our early PIE startup code, or in
4822 // the early stages of a dynamic linker, etc.4822 // the early stages of a dynamic linker, etc.
4823 if (!safety and owner_mod.optimize_mode == .Debug) {4823 if (!safety and owner_mod.optimize_mode == .debug) {
4824 return .none;4824 return .none;
4825 }4825 }
48264826
src/codegen/riscv64/CodeGen.zig+3-3
...@@ -8339,9 +8339,9 @@ fn resolveCallingConventionValues(...@@ -8339,9 +8339,9 @@ fn resolveCallingConventionValues(
8339fn wantSafety(func: *Func) bool {8339fn wantSafety(func: *Func) bool {
8340 return switch (func.mod.optimize_mode) {8340 return switch (func.mod.optimize_mode) {
8341 .Debug => true,8341 .Debug => true,
8342 .ReleaseSafe => true,8342 .safe => true,
8343 .ReleaseFast => false,8343 .fast => false,
8344 .ReleaseSmall => false,8344 .small => false,
8345 };8345 };
8346}8346}
83478347
src/codegen/sparc64/CodeGen.zig+3-3
...@@ -4764,9 +4764,9 @@ fn truncRegister(...@@ -4764,9 +4764,9 @@ fn truncRegister(
4764fn wantSafety(self: *Self) bool {4764fn wantSafety(self: *Self) bool {
4765 return switch (self.bin_file.comp.root_mod.optimize_mode) {4765 return switch (self.bin_file.comp.root_mod.optimize_mode) {
4766 .Debug => true,4766 .Debug => true,
4767 .ReleaseSafe => true,4767 .safe => true,
4768 .ReleaseFast => false,4768 .fast => false,
4769 .ReleaseSmall => false,4769 .small => false,
4770 };4770 };
4771}4771}
47724772
src/codegen/wasm/Mir.zig+2-2
...@@ -661,8 +661,8 @@ pub const Inst = struct {...@@ -661,8 +661,8 @@ pub const Inst = struct {
661661
662 comptime {662 comptime {
663 switch (builtin.mode) {663 switch (builtin.mode) {
664 .Debug, .ReleaseSafe => {},664 .debug, .safe => {},
665 .ReleaseFast, .ReleaseSmall => assert(@sizeOf(Data) == 4),665 .fast, .small => assert(@sizeOf(Data) == 4),
666 }666 }
667 }667 }
668 };668 };
src/codegen/x86_64/CodeGen.zig+4-4
...@@ -182502,8 +182502,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool {...@@ -182502,8 +182502,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool {
182502 .slow_unaligned_mem_16,182502 .slow_unaligned_mem_16,
182503 .slow_unaligned_mem_32,182503 .slow_unaligned_mem_32,
182504 => switch (cg.mod.optimize_mode) {182504 => switch (cg.mod.optimize_mode) {
182505 .Debug, .ReleaseSafe, .ReleaseFast => null,182505 .debug, .safe, .fast => null,
182506 .ReleaseSmall => false,182506 .small => false,
182507 },182507 },
182508 .fast_11bytenop,182508 .fast_11bytenop,
182509 .fast_15bytenop,182509 .fast_15bytenop,
...@@ -182523,8 +182523,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool {...@@ -182523,8 +182523,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool {
182523 .fast_vector_fsqrt,182523 .fast_vector_fsqrt,
182524 .fast_vector_shift_masks,182524 .fast_vector_shift_masks,
182525 => switch (cg.mod.optimize_mode) {182525 => switch (cg.mod.optimize_mode) {
182526 .Debug, .ReleaseSafe, .ReleaseFast => null,182526 .debug, .safe, .fast => null,
182527 .ReleaseSmall => true,182527 .small => true,
182528 },182528 },
182529 .mmx => false,182529 .mmx => false,
182530 .sahf => switch (cg.target.cpu.arch) {182530 .sahf => switch (cg.target.cpu.arch) {
src/libs/libcxx.zig+3-3
...@@ -539,15 +539,15 @@ pub fn addCxxArgs(...@@ -539,15 +539,15 @@ pub fn addCxxArgs(
539 // is simple and works everywhere.539 // is simple and works everywhere.
540 try cflags.append("-D_LIBCPP_PSTL_BACKEND_SERIAL");540 try cflags.append("-D_LIBCPP_PSTL_BACKEND_SERIAL");
541 switch (optimize_mode) {541 switch (optimize_mode) {
542 .Debug => {542 .debug => {
543 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG");543 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG");
544 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");544 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");
545 },545 },
546 .ReleaseFast, .ReleaseSmall => {546 .fast, .small => {
547 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE");547 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE");
548 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_IGNORE");548 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_IGNORE");
549 },549 },
550 .ReleaseSafe => {550 .safe => {
551 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST");551 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST");
552 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");552 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");
553 },553 },
src/libs/libunwind.zig+1-1
...@@ -118,7 +118,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr...@@ -118,7 +118,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
118 // defines will be correct.118 // defines will be correct.
119 try cflags.append("-D_LIBUNWIND_IS_NATIVE_ONLY");119 try cflags.append("-D_LIBUNWIND_IS_NATIVE_ONLY");
120120
121 if (comp.root_mod.optimize_mode == .Debug) {121 if (comp.root_mod.optimize_mode == .debug) {
122 try cflags.append("-D_DEBUG");122 try cflags.append("-D_DEBUG");
123 }123 }
124 if (!comp.config.any_non_single_threaded) {124 if (!comp.config.any_non_single_threaded) {
src/libs/mingw.zig+2-2
...@@ -135,8 +135,8 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre...@@ -135,8 +135,8 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
135 });135 });
136136
137 switch (comp.compilerRtOptMode()) {137 switch (comp.compilerRtOptMode()) {
138 .Debug, .ReleaseSafe => try winpthreads_args.append("-DWINPTHREAD_DBG"),138 .debug, .safe => try winpthreads_args.append("-DWINPTHREAD_DBG"),
139 .ReleaseFast, .ReleaseSmall => {},139 .fast, .small => {},
140 }140 }
141141
142 for (mingw32_winpthreads_src) |dep| {142 for (mingw32_winpthreads_src) |dep| {
src/link/C.zig+1-1
...@@ -429,7 +429,7 @@ pub fn createEmpty(...@@ -429,7 +429,7 @@ pub fn createEmpty(
429 .tag = .c,429 .tag = .c,
430 .comp = comp,430 .comp = comp,
431 .emit = emit,431 .emit = emit,
432 .gc_sections = options.gc_sections orelse (optimize_mode != .Debug and output_mode != .Obj),432 .gc_sections = options.gc_sections orelse (optimize_mode != .debug and output_mode != .Obj),
433 .print_gc_sections = options.print_gc_sections,433 .print_gc_sections = options.print_gc_sections,
434 .stack_size = options.stack_size orelse 16777216,434 .stack_size = options.stack_size orelse 16777216,
435 .allow_shlib_undefined = options.allow_shlib_undefined orelse false,435 .allow_shlib_undefined = options.allow_shlib_undefined orelse false,
src/link/Coff.zig+8-8
...@@ -5598,11 +5598,11 @@ fn updateFuncInner(...@@ -5598,11 +5598,11 @@ fn updateFuncInner(
5598 const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{5598 const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{
5599 .alignment = switch (nav.resolved.?.@"align") {5599 .alignment = switch (nav.resolved.?.@"align") {
5600 .none => switch (mod.optimize_mode) {5600 .none => switch (mod.optimize_mode) {
5601 .Debug,5601 .debug,
5602 .ReleaseSafe,5602 .safe,
5603 .ReleaseFast,5603 .fast,
5604 => target_util.defaultFunctionAlignment(target),5604 => target_util.defaultFunctionAlignment(target),
5605 .ReleaseSmall => target_util.minFunctionAlignment(target),5605 .small => target_util.minFunctionAlignment(target),
5606 },5606 },
5607 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),5607 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
5608 }.toStdMem(),5608 }.toStdMem(),
...@@ -6649,11 +6649,11 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool {...@@ -6649,11 +6649,11 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool {
66496649
6650 const target = &comp.root_mod.resolved_target.result;6650 const target = &comp.root_mod.resolved_target.result;
6651 const alignment = switch (comp.root_mod.optimize_mode) {6651 const alignment = switch (comp.root_mod.optimize_mode) {
6652 .Debug,6652 .debug,
6653 .ReleaseSafe,6653 .safe,
6654 .ReleaseFast,6654 .fast,
6655 => target_util.defaultFunctionAlignment(target),6655 => target_util.defaultFunctionAlignment(target),
6656 .ReleaseSmall => target_util.minFunctionAlignment(target),6656 .small => target_util.minFunctionAlignment(target),
6657 }.toStdMem();6657 }.toStdMem();
6658 const parent_si = (try coff.pseudoSectionMapIndex(6658 const parent_si = (try coff.pseudoSectionMapIndex(
6659 .@".thunks",6659 .@".thunks",
src/link/Elf.zig+1-1
...@@ -260,7 +260,7 @@ pub fn createEmpty(...@@ -260,7 +260,7 @@ pub fn createEmpty(
260 .tag = .elf,260 .tag = .elf,
261 .comp = comp,261 .comp = comp,
262 .emit = emit,262 .emit = emit,
263 .gc_sections = options.gc_sections orelse (optimize_mode != .Debug and output_mode != .Obj),263 .gc_sections = options.gc_sections orelse (optimize_mode != .debug and output_mode != .Obj),
264 .print_gc_sections = options.print_gc_sections,264 .print_gc_sections = options.print_gc_sections,
265 .stack_size = options.stack_size orelse 16777216,265 .stack_size = options.stack_size orelse 16777216,
266 .allow_shlib_undefined = options.allow_shlib_undefined orelse !is_native_os,266 .allow_shlib_undefined = options.allow_shlib_undefined orelse !is_native_os,
src/link/Elf/ZigObject.zig+4-4
...@@ -1299,7 +1299,7 @@ fn getNavShdrIndex(...@@ -1299,7 +1299,7 @@ fn getNavShdrIndex(
1299 }1299 }
1300 if (nav_val.isUndef(zcu))1300 if (nav_val.isUndef(zcu))
1301 return switch (zcu.navFileScope(nav_index).mod.?.optimize_mode) {1301 return switch (zcu.navFileScope(nav_index).mod.?.optimize_mode) {
1302 .Debug, .ReleaseSafe => {1302 .debug, .safe => {
1303 if (self.data_index) |symbol_index|1303 if (self.data_index) |symbol_index|
1304 return self.symbol(symbol_index).outputShndx(elf_file).?;1304 return self.symbol(symbol_index).outputShndx(elf_file).?;
1305 const osec = try elf_file.addSection(.{1305 const osec = try elf_file.addSection(.{
...@@ -1311,7 +1311,7 @@ fn getNavShdrIndex(...@@ -1311,7 +1311,7 @@ fn getNavShdrIndex(
1311 self.data_index = try self.addSectionSymbol(gpa, try self.addString(gpa, ".data"), osec);1311 self.data_index = try self.addSectionSymbol(gpa, try self.addString(gpa, ".data"), osec);
1312 return osec;1312 return osec;
1313 },1313 },
1314 .ReleaseFast, .ReleaseSmall => {1314 .fast, .small => {
1315 if (self.bss_index) |symbol_index|1315 if (self.bss_index) |symbol_index|
1316 return self.symbol(symbol_index).outputShndx(elf_file).?;1316 return self.symbol(symbol_index).outputShndx(elf_file).?;
1317 const osec = try elf_file.addSection(.{1317 const osec = try elf_file.addSection(.{
...@@ -1374,8 +1374,8 @@ fn updateNavCode(...@@ -1374,8 +1374,8 @@ fn updateNavCode(
1374 const target = &mod.resolved_target.result;1374 const target = &mod.resolved_target.result;
1375 const required_alignment = switch (nav.resolved.?.@"align") {1375 const required_alignment = switch (nav.resolved.?.@"align") {
1376 .none => switch (mod.optimize_mode) {1376 .none => switch (mod.optimize_mode) {
1377 .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target),1377 .debug, .safe, .fast => target_util.defaultFunctionAlignment(target),
1378 .ReleaseSmall => target_util.minFunctionAlignment(target),1378 .small => target_util.minFunctionAlignment(target),
1379 }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)),1379 }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)),
1380 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),1380 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
1381 };1381 };
src/link/Elf2.zig+4-4
...@@ -4782,11 +4782,11 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) Error!Node...@@ -4782,11 +4782,11 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) Error!Node
4782 break :a switch (nav.resolved.?.@"align") {4782 break :a switch (nav.resolved.?.@"align") {
4783 else => |a| a.maxStrict(min),4783 else => |a| a.maxStrict(min),
4784 .none => switch (mod.optimize_mode) {4784 .none => switch (mod.optimize_mode) {
4785 .Debug,4785 .debug,
4786 .ReleaseSafe,4786 .safe,
4787 .ReleaseFast,4787 .fast,
4788 => target_util.defaultFunctionAlignment(target),4788 => target_util.defaultFunctionAlignment(target),
4789 .ReleaseSmall => min,4789 .small => min,
4790 }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)),4790 }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)),
4791 };4791 };
4792 },4792 },
src/link/Lld.zig+14-14
...@@ -208,8 +208,8 @@ pub fn createEmpty(...@@ -208,8 +208,8 @@ pub fn createEmpty(
208 const optimize_mode = comp.root_mod.optimize_mode;208 const optimize_mode = comp.root_mod.optimize_mode;
209209
210 const gc_sections: bool = options.gc_sections orelse switch (target.ofmt) {210 const gc_sections: bool = options.gc_sections orelse switch (target.ofmt) {
211 .coff => optimize_mode != .Debug,211 .coff => optimize_mode != .debug,
212 .elf => optimize_mode != .Debug and output_mode != .Obj,212 .elf => optimize_mode != .debug and output_mode != .Obj,
213 .wasm => output_mode != .Obj,213 .wasm => output_mode != .Obj,
214 else => unreachable,214 else => unreachable,
215 };215 };
...@@ -456,9 +456,9 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {...@@ -456,9 +456,9 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {
456456
457 if (comp.config.lto != .none) {457 if (comp.config.lto != .none) {
458 switch (optimize_mode) {458 switch (optimize_mode) {
459 .Debug => {},459 .debug => {},
460 .ReleaseSmall => try argv.append("-OPT:lldlto=2"),460 .small => try argv.append("-OPT:lldlto=2"),
461 .ReleaseFast, .ReleaseSafe => try argv.append("-OPT:lldlto=3"),461 .fast, .safe => try argv.append("-OPT:lldlto=3"),
462 }462 }
463 }463 }
464 if (comp.config.output_mode == .Exe) {464 if (comp.config.output_mode == .Exe) {
...@@ -865,15 +865,15 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {...@@ -865,15 +865,15 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
865865
866 if (comp.config.lto != .none) {866 if (comp.config.lto != .none) {
867 switch (comp.root_mod.optimize_mode) {867 switch (comp.root_mod.optimize_mode) {
868 .Debug => {},868 .debug => {},
869 .ReleaseSmall => try argv.append("--lto-O2"),869 .small => try argv.append("--lto-O2"),
870 .ReleaseFast, .ReleaseSafe => try argv.append("--lto-O3"),870 .fast, .safe => try argv.append("--lto-O3"),
871 }871 }
872 }872 }
873 switch (comp.root_mod.optimize_mode) {873 switch (comp.root_mod.optimize_mode) {
874 .Debug => {},874 .debug => {},
875 .ReleaseSmall => try argv.append("-O2"),875 .small => try argv.append("-O2"),
876 .ReleaseFast, .ReleaseSafe => try argv.append("-O3"),876 .fast, .safe => try argv.append("-O3"),
877 }877 }
878878
879 if (elf.entry_name) |name| {879 if (elf.entry_name) |name| {
...@@ -1416,9 +1416,9 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void {...@@ -1416,9 +1416,9 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void {
14161416
1417 if (comp.config.lto != .none) {1417 if (comp.config.lto != .none) {
1418 switch (comp.root_mod.optimize_mode) {1418 switch (comp.root_mod.optimize_mode) {
1419 .Debug => {},1419 .debug => {},
1420 .ReleaseSmall => try argv.append("-O2"),1420 .small => try argv.append("-O2"),
1421 .ReleaseFast, .ReleaseSafe => try argv.append("-O3"),1421 .fast, .safe => try argv.append("-O3"),
1422 }1422 }
1423 }1423 }
14241424
src/link/MachO.zig+1-1
...@@ -181,7 +181,7 @@ pub fn createEmpty(...@@ -181,7 +181,7 @@ pub fn createEmpty(
181 .tag = .macho,181 .tag = .macho,
182 .comp = comp,182 .comp = comp,
183 .emit = emit,183 .emit = emit,
184 .gc_sections = options.gc_sections orelse (optimize_mode != .Debug),184 .gc_sections = options.gc_sections orelse (optimize_mode != .debug),
185 .print_gc_sections = options.print_gc_sections,185 .print_gc_sections = options.print_gc_sections,
186 .stack_size = options.stack_size orelse 16777216,186 .stack_size = options.stack_size orelse 16777216,
187 .allow_shlib_undefined = allow_shlib_undefined,187 .allow_shlib_undefined = allow_shlib_undefined,
src/link/MachO/ZigObject.zig+4-4
...@@ -946,8 +946,8 @@ fn updateNavCode(...@@ -946,8 +946,8 @@ fn updateNavCode(
946 const target = &mod.resolved_target.result;946 const target = &mod.resolved_target.result;
947 const required_alignment = switch (nav.resolved.?.@"align") {947 const required_alignment = switch (nav.resolved.?.@"align") {
948 .none => switch (mod.optimize_mode) {948 .none => switch (mod.optimize_mode) {
949 .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target),949 .debug, .safe, .fast => target_util.defaultFunctionAlignment(target),
950 .ReleaseSmall => target_util.minFunctionAlignment(target),950 .small => target_util.minFunctionAlignment(target),
951 },951 },
952 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),952 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
953 };953 };
...@@ -1172,8 +1172,8 @@ fn getNavOutputSection(...@@ -1172,8 +1172,8 @@ fn getNavOutputSection(
1172 if (nav.resolved.?.@"const") return macho_file.zig_const_sect_index.?;1172 if (nav.resolved.?.@"const") return macho_file.zig_const_sect_index.?;
1173 if (nav_val.isUndef(zcu))1173 if (nav_val.isUndef(zcu))
1174 return switch (zcu.navFileScope(nav_index).mod.?.optimize_mode) {1174 return switch (zcu.navFileScope(nav_index).mod.?.optimize_mode) {
1175 .Debug, .ReleaseSafe => macho_file.zig_data_sect_index.?,1175 .debug, .safe => macho_file.zig_data_sect_index.?,
1176 .ReleaseFast, .ReleaseSmall => macho_file.zig_bss_sect_index.?,1176 .fast, .small => macho_file.zig_bss_sect_index.?,
1177 };1177 };
1178 for (code) |byte| {1178 for (code) |byte| {
1179 if (byte != 0) break;1179 if (byte != 0) break;
src/main.zig+25-26
...@@ -44,9 +44,9 @@ pub const std_options: std.Options = .{...@@ -44,9 +44,9 @@ pub const std_options: std.Options = .{
44 .logFn = log,44 .logFn = log,
4545
46 .log_level = switch (builtin.mode) {46 .log_level = switch (builtin.mode) {
47 .Debug => .debug,47 .debug => .debug,
48 .ReleaseSafe, .ReleaseFast => .info,48 .safe, .fast => .info,
49 .ReleaseSmall => .err,49 .small => .err,
50 },50 },
51};51};
52pub const std_options_cwd = if (native_os == .wasi) wasi_cwd else null;52pub const std_options_cwd = if (native_os == .wasi) wasi_cwd else null;
...@@ -158,8 +158,8 @@ pub fn log(...@@ -158,8 +158,8 @@ pub fn log(
158158
159const use_safe_allocator = build_options.debug_gpa or159const use_safe_allocator = build_options.debug_gpa or
160 (native_os != .wasi and !builtin.link_libc and switch (builtin.mode) {160 (native_os != .wasi and !builtin.link_libc and switch (builtin.mode) {
161 .Debug, .ReleaseSafe => true,161 .debug, .safe => true,
162 .ReleaseFast, .ReleaseSmall => false,162 .fast, .small => false,
163 });163 });
164164
165var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{165var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{
...@@ -360,7 +360,7 @@ fn mainArgs(...@@ -360,7 +360,7 @@ fn mainArgs(
360 .prepend_zig_exe_path = true,360 .prepend_zig_exe_path = true,
361 .prepend_seed = true,361 .prepend_seed = true,
362 .debug_env_var = .ZIG_DEBUG_MAKER,362 .debug_env_var = .ZIG_DEBUG_MAKER,
363 .release_mode = .ReleaseSafe,363 .release_mode = .safe,
364 });364 });
365 },365 },
366 .clang, .@"-cc1", .@"-cc1as" => {366 .clang, .@"-cc1", .@"-cc1as" => {
...@@ -568,10 +568,10 @@ const usage_build_generic =...@@ -568,10 +568,10 @@ const usage_build_generic =
568 \\Per-Module Compile Options:568 \\Per-Module Compile Options:
569 \\ -target [name] <arch><sub>-<os>-<abi> see the targets command569 \\ -target [name] <arch><sub>-<os>-<abi> see the targets command
570 \\ -O [mode] Choose what to optimize for570 \\ -O [mode] Choose what to optimize for
571 \\ Debug (default) Optimizations off, safety on571 \\ debug (default) Prioritize bug detection, accurate debug info, compilation speed
572 \\ ReleaseFast Optimize for performance, safety off572 \\ fast Prioritize runtime performance. Safety checks off.
573 \\ ReleaseSafe Optimize for performance, safety on573 \\ safe Enable both safety checks and machine code optimizations
574 \\ ReleaseSmall Optimize for small binary, safety off574 \\ small Prioritize small binary size. Safety checks off.
575 \\ -ofmt=[fmt] Override target object format575 \\ -ofmt=[fmt] Override target object format
576 \\ elf Executable and Linking Format576 \\ elf Executable and Linking Format
577 \\ c C source code577 \\ c C source code
...@@ -994,7 +994,7 @@ fn buildOutputType(...@@ -994,7 +994,7 @@ fn buildOutputType(
994 var minor_subsystem_version: ?u16 = null;994 var minor_subsystem_version: ?u16 = null;
995 var mingw_unicode_entry_point: bool = false;995 var mingw_unicode_entry_point: bool = false;
996 var enable_link_snapshots: bool = false;996 var enable_link_snapshots: bool = false;
997 var debug_compiler_runtime_libs: ?std.lang.OptimizeMode = null;997 var debug_compiler_runtime_libs: ?std.lang.Optimize = null;
998 var install_name: ?[]const u8 = null;998 var install_name: ?[]const u8 = null;
999 var hash_style: link.File.Lld.Elf.HashStyle = .both;999 var hash_style: link.File.Lld.Elf.HashStyle = .both;
1000 var entitlements: ?[]const u8 = null;1000 var entitlements: ?[]const u8 = null;
...@@ -1433,7 +1433,7 @@ fn buildOutputType(...@@ -1433,7 +1433,7 @@ fn buildOutputType(
1433 enable_link_snapshots = true;1433 enable_link_snapshots = true;
1434 }1434 }
1435 } else if (mem.eql(u8, arg, "--debug-rt")) {1435 } else if (mem.eql(u8, arg, "--debug-rt")) {
1436 debug_compiler_runtime_libs = .Debug;1436 debug_compiler_runtime_libs = .debug;
1437 } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| {1437 } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| {
1438 debug_compiler_runtime_libs = parseOptimizeMode(rest);1438 debug_compiler_runtime_libs = parseOptimizeMode(rest);
1439 } else if (mem.eql(u8, arg, "--debug-incremental")) {1439 } else if (mem.eql(u8, arg, "--debug-incremental")) {
...@@ -2271,18 +2271,18 @@ fn buildOutputType(...@@ -2271,18 +2271,18 @@ fn buildOutputType(
2271 if (mem.eql(u8, level, "s") or2271 if (mem.eql(u8, level, "s") or
2272 mem.eql(u8, level, "z"))2272 mem.eql(u8, level, "z"))
2273 {2273 {
2274 mod_opts.optimize_mode = .ReleaseSmall;2274 mod_opts.optimize_mode = .small;
2275 } else if (mem.eql(u8, level, "1") or2275 } else if (mem.eql(u8, level, "1") or
2276 mem.eql(u8, level, "2") or2276 mem.eql(u8, level, "2") or
2277 mem.eql(u8, level, "3") or2277 mem.eql(u8, level, "3") or
2278 mem.eql(u8, level, "4") or2278 mem.eql(u8, level, "4") or
2279 mem.eql(u8, level, "fast"))2279 mem.eql(u8, level, "fast"))
2280 {2280 {
2281 mod_opts.optimize_mode = .ReleaseFast;2281 mod_opts.optimize_mode = .fast;
2282 } else if (mem.eql(u8, level, "g") or2282 } else if (mem.eql(u8, level, "g") or
2283 mem.eql(u8, level, "0"))2283 mem.eql(u8, level, "0"))
2284 {2284 {
2285 mod_opts.optimize_mode = .Debug;2285 mod_opts.optimize_mode = .debug;
2286 } else {2286 } else {
2287 try cc_argv.appendSlice(arena, it.other_args);2287 try cc_argv.appendSlice(arena, it.other_args);
2288 }2288 }
...@@ -2356,9 +2356,9 @@ fn buildOutputType(...@@ -2356,9 +2356,9 @@ fn buildOutputType(
2356 // `sanitize_c` will resolve to! So we either have to pick `off` or `full`.2356 // `sanitize_c` will resolve to! So we either have to pick `off` or `full`.
2357 //2357 //
2358 // `full` has the potential to be problematic if `optimize_mode` turns out to2358 // `full` has the potential to be problematic if `optimize_mode` turns out to
2359 // be `ReleaseFast`/`ReleaseSmall` because the user will get a slower and larger2359 // be `fast`/`small` because the user will get a slower and larger
2360 // binary than expected. On the other hand, if `optimize_mode` turns out to be2360 // binary than expected. On the other hand, if `optimize_mode` turns out to be
2361 // `Debug`/`ReleaseSafe`, `off` would mean UBSan would unexpectedly be disabled.2361 // `debug`/`safe`, `off` would mean UBSan would unexpectedly be disabled.
2362 //2362 //
2363 // `off` seems very slightly less bad, so let's go with that.2363 // `off` seems very slightly less bad, so let's go with that.
2364 mod_opts.sanitize_c = .off;2364 mod_opts.sanitize_c = .off;
...@@ -2972,8 +2972,8 @@ fn buildOutputType(...@@ -2972,8 +2972,8 @@ fn buildOutputType(
2972 }2972 }
29732973
2974 if (mod_opts.sanitize_c) |wsc| {2974 if (mod_opts.sanitize_c) |wsc| {
2975 if (wsc != .off and mod_opts.optimize_mode == .ReleaseFast) {2975 if (wsc != .off and mod_opts.optimize_mode == .fast) {
2976 mod_opts.optimize_mode = .ReleaseSafe;2976 mod_opts.optimize_mode = .safe;
2977 }2977 }
2978 }2978 }
29792979
...@@ -4875,7 +4875,7 @@ const JitCmdOptions = struct {...@@ -4875,7 +4875,7 @@ const JitCmdOptions = struct {
4875 /// Send error bundles via std.zig.Server over stdout4875 /// Send error bundles via std.zig.Server over stdout
4876 server: bool = false,4876 server: bool = false,
4877 debug_env_var: EnvVar = .ZIG_DEBUG_CMD,4877 debug_env_var: EnvVar = .ZIG_DEBUG_CMD,
4878 release_mode: std.lang.OptimizeMode = .ReleaseFast,4878 release_mode: std.lang.Optimize = .fast,
4879};4879};
48804880
4881fn jitCmd(4881fn jitCmd(
...@@ -4926,11 +4926,11 @@ fn jitCmdInner(...@@ -4926,11 +4926,11 @@ fn jitCmdInner(
4926 const self_exe_path = process.executablePathAlloc(io, arena) catch |err|4926 const self_exe_path = process.executablePathAlloc(io, arena) catch |err|
4927 fatal("unable to find self exe path: {t}", .{err});4927 fatal("unable to find self exe path: {t}", .{err});
49284928
4929 const optimize_mode: std.lang.OptimizeMode = if (options.debug_env_var.isSet(environ_map))4929 const optimize_mode: std.lang.Optimize = if (options.debug_env_var.isSet(environ_map))
4930 .Debug4930 .debug
4931 else4931 else
4932 options.release_mode;4932 options.release_mode;
4933 const strip = optimize_mode != .Debug;4933 const strip = optimize_mode != .debug;
4934 var override_lib_dir: ?[]const u8 = EnvVar.ZIG_LIB_DIR.get(environ_map);4934 var override_lib_dir: ?[]const u8 = EnvVar.ZIG_LIB_DIR.get(environ_map);
4935 const override_global_cache_dir: ?[]const u8 = EnvVar.ZIG_GLOBAL_CACHE_DIR.get(environ_map);4935 const override_global_cache_dir: ?[]const u8 = EnvVar.ZIG_GLOBAL_CACHE_DIR.get(environ_map);
49364936
...@@ -6008,9 +6008,8 @@ fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes {...@@ -6008,9 +6008,8 @@ fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes {
6008 fatal("unsupported rc includes type: {q}", .{arg});6008 fatal("unsupported rc includes type: {q}", .{arg});
6009}6009}
60106010
6011fn parseOptimizeMode(s: []const u8) std.lang.OptimizeMode {6011fn parseOptimizeMode(s: []const u8) std.lang.Optimize {
6012 return stringToEnum(std.lang.OptimizeMode, s) orelse6012 return std.lang.Optimize.fromString(s) orelse fatal("unrecognized optimization mode: {q}", .{s});
6013 fatal("unrecognized optimization mode: {q}", .{s});
6014}6013}
60156014
6016fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel {6015fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel {
src/target.zig+5-5
...@@ -357,12 +357,12 @@ pub fn libcProvidesStackProtector(target: *const std.Target) bool {...@@ -357,12 +357,12 @@ pub fn libcProvidesStackProtector(target: *const std.Target) bool {
357357
358/// Returns true if `@returnAddress()` is supported by the target and has a358/// Returns true if `@returnAddress()` is supported by the target and has a
359/// reasonably performant implementation for the requested optimization mode.359/// reasonably performant implementation for the requested optimization mode.
360pub fn supportsReturnAddress(target: *const std.Target, optimize: std.lang.OptimizeMode) bool {360pub fn supportsReturnAddress(target: *const std.Target, optimize: std.lang.Optimize) bool {
361 return switch (target.cpu.arch) {361 return switch (target.cpu.arch) {
362 // Emscripten currently implements `emscripten_return_address()` by calling362 // Emscripten currently implements `emscripten_return_address()` by calling
363 // out into JavaScript and parsing a stack trace, which introduces significant363 // out into JavaScript and parsing a stack trace, which introduces significant
364 // overhead that we would prefer to avoid in release builds.364 // overhead that we would prefer to avoid in release builds.
365 .wasm32, .wasm64 => target.os.tag == .emscripten and optimize == .Debug,365 .wasm32, .wasm64 => target.os.tag == .emscripten and optimize == .debug,
366 .bpfel, .bpfeb => false,366 .bpfel, .bpfeb => false,
367 .spirv32, .spirv64 => false,367 .spirv32, .spirv64 => false,
368 else => true,368 else => true,
...@@ -417,11 +417,11 @@ pub fn hasDebugInfo(target: *const std.Target) bool {...@@ -417,11 +417,11 @@ pub fn hasDebugInfo(target: *const std.Target) bool {
417 };417 };
418}418}
419419
420pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.lang.OptimizeMode {420pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.lang.Optimize {
421 if (target.cpu.arch.isWasm() and target.os.tag == .freestanding) {421 if (target.cpu.arch.isWasm() and target.os.tag == .freestanding) {
422 return .ReleaseSmall;422 return .small;
423 } else {423 } else {
424 return .ReleaseFast;424 return .fast;
425 }425 }
426}426}
427427
test/behavior/cast.zig+1-1
...@@ -498,7 +498,7 @@ test "array coercion to undefined at runtime" {...@@ -498,7 +498,7 @@ test "array coercion to undefined at runtime" {
498498
499 @setRuntimeSafety(true);499 @setRuntimeSafety(true);
500500
501 if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {501 if (builtin.mode != .debug and builtin.mode != .safe) {
502 return error.SkipZigTest;502 return error.SkipZigTest;
503 }503 }
504504
test/behavior/floatop.zig+1-1
...@@ -1678,7 +1678,7 @@ test "runtime isNan(inf * 0)" {...@@ -1678,7 +1678,7 @@ test "runtime isNan(inf * 0)" {
16781678
1679test "optimized float mode" {1679test "optimized float mode" {
1680 if (builtin.zig_backend != .stage2_llvm) return error.SkipZigTest;1680 if (builtin.zig_backend != .stage2_llvm) return error.SkipZigTest;
1681 if (builtin.mode == .Debug) return error.SkipZigTest;1681 if (builtin.mode == .debug) return error.SkipZigTest;
16821682
1683 const big = 0x1p40;1683 const big = 0x1p40;
1684 const small = 0.001;1684 const small = 0.001;
test/behavior/int128.zig+1-1
...@@ -31,7 +31,7 @@ test "undefined 128 bit int" {...@@ -31,7 +31,7 @@ test "undefined 128 bit int" {
31 @setRuntimeSafety(true);31 @setRuntimeSafety(true);
3232
33 // TODO implement @setRuntimeSafety33 // TODO implement @setRuntimeSafety
34 if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {34 if (builtin.mode != .debug and builtin.mode != .safe) {
35 return error.SkipZigTest;35 return error.SkipZigTest;
36 }36 }
3737
test/c_abi/main.zig+3-3
...@@ -16754,7 +16754,7 @@ test "CFF: Zig returns to C" {...@@ -16754,7 +16754,7 @@ test "CFF: Zig returns to C" {
16754}16754}
16755test "CFF: C passes to Zig" {16755test "CFF: C passes to Zig" {
16756 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;16756 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
16757 if (builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;16757 if (builtin.cpu.arch.isRISCV() and builtin.mode != .debug) return error.SkipZigTest;
16758 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;16758 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
16759 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;16759 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
16760 if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest;16760 if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest;
...@@ -16764,7 +16764,7 @@ test "CFF: C passes to Zig" {...@@ -16764,7 +16764,7 @@ test "CFF: C passes to Zig" {
16764 try expectOk(c_send_CFF());16764 try expectOk(c_send_CFF());
16765}16765}
16766test "CFF: C returns to Zig" {16766test "CFF: C returns to Zig" {
16767 if (builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;16767 if (builtin.cpu.arch.isRISCV() and builtin.mode != .debug) return error.SkipZigTest;
16768 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;16768 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
16769 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;16769 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
16770 if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest;16770 if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest;
...@@ -16920,7 +16920,7 @@ extern fn c_f16_struct(f16_struct) f16_struct;...@@ -16920,7 +16920,7 @@ extern fn c_f16_struct(f16_struct) f16_struct;
16920test "f16 struct" {16920test "f16 struct" {
16921 if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest;16921 if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest;
16922 if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest;16922 if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest;
16923 if (builtin.cpu.arch.isArm() and builtin.mode != .Debug) return error.SkipZigTest;16923 if (builtin.cpu.arch.isArm() and builtin.mode != .debug) return error.SkipZigTest;
16924 if (builtin.cpu.arch == .s390x) return error.SkipZigTest;16924 if (builtin.cpu.arch == .s390x) return error.SkipZigTest;
16925 if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest;16925 if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest;
1692616926
test/cases/compile_errors/invalid_member_of_builtin_enum.zig+1-1
...@@ -6,5 +6,5 @@ export fn entry() void {...@@ -6,5 +6,5 @@ export fn entry() void {
66
7// error7// error
8//8//
9// :3:35: error: enum 'lang.OptimizeMode' has no member named 'x86'9// :3:35: error: enum 'lang.Optimize' has no member named 'x86'
10// : note: enum declared here10// : note: enum declared here
test/src/ErrorTrace.zig+2-2
...@@ -60,9 +60,9 @@ fn addCaseConfig(...@@ -60,9 +60,9 @@ fn addCaseConfig(
60 const b = self.b;60 const b = self.b;
6161
62 const error_tracing: bool = tracing: {62 const error_tracing: bool = tracing: {
63 if (optimize == .Debug) break :tracing true;63 if (optimize == .debug) break :tracing true;
64 if (backend != .llvm) break :tracing true;64 if (backend != .llvm) break :tracing true;
65 if (optimize == .ReleaseSmall) break :tracing false;65 if (optimize == .small) break :tracing false;
66 for (case.disable_trace_optimized) |disable| {66 for (case.disable_trace_optimized) |disable| {
67 const d_arch, const d_os = disable;67 const d_arch, const d_os = disable;
68 if (target.result.cpu.arch == d_arch and target.result.os.tag == d_os) {68 if (target.result.cpu.arch == d_arch and target.result.os.tag == d_os) {
test/standalone/dependency_options/build.zig+9-9
...@@ -11,11 +11,11 @@ pub fn build(b: *std.Build) !void {...@@ -11,11 +11,11 @@ pub fn build(b: *std.Build) !void {
11 const none_specified_mod = none_specified.module("dummy");11 const none_specified_mod = none_specified.module("dummy");
12 if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed;12 if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed;
13 const expected_optimize: std.builtin.OptimizeMode = switch (b.graph.release_mode) {13 const expected_optimize: std.builtin.OptimizeMode = switch (b.graph.release_mode) {
14 .off => .Debug,14 .off => .debug,
15 .any => unreachable,15 .any => unreachable,
16 .fast => .ReleaseFast,16 .fast => .fast,
17 .safe => .ReleaseSafe,17 .safe => .safe,
18 .small => .ReleaseSmall,18 .small => .small,
19 };19 };
20 if (none_specified_mod.optimize.? != expected_optimize) return error.TestFailed;20 if (none_specified_mod.optimize.? != expected_optimize) return error.TestFailed;
2121
...@@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void {...@@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void {
4444
45 const all_specified = b.dependency("other", .{45 const all_specified = b.dependency("other", .{
46 .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),46 .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),
47 .optimize = @as(std.builtin.OptimizeMode, .ReleaseSafe),47 .optimize = @as(std.builtin.OptimizeMode, .safe),
48 .bool = @as(bool, true),48 .bool = @as(bool, true),
49 .int = @as(i64, 123),49 .int = @as(i64, 123),
50 .float = @as(f64, 0.5),50 .float = @as(f64, 0.5),
...@@ -66,11 +66,11 @@ pub fn build(b: *std.Build) !void {...@@ -66,11 +66,11 @@ pub fn build(b: *std.Build) !void {
66 if (all_specified_mod.resolved_target.?.result.cpu.arch != .x86_64) return error.TestFailed;66 if (all_specified_mod.resolved_target.?.result.cpu.arch != .x86_64) return error.TestFailed;
67 if (all_specified_mod.resolved_target.?.result.os.tag != .windows) return error.TestFailed;67 if (all_specified_mod.resolved_target.?.result.os.tag != .windows) return error.TestFailed;
68 if (all_specified_mod.resolved_target.?.result.abi != .gnu) return error.TestFailed;68 if (all_specified_mod.resolved_target.?.result.abi != .gnu) return error.TestFailed;
69 if (all_specified_mod.optimize.? != .ReleaseSafe) return error.TestFailed;69 if (all_specified_mod.optimize.? != .safe) return error.TestFailed;
7070
71 const all_specified_optional = b.dependency("other", .{71 const all_specified_optional = b.dependency("other", .{
72 .target = @as(?std.Build.ResolvedTarget, b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu })),72 .target = @as(?std.Build.ResolvedTarget, b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu })),
73 .optimize = @as(?std.builtin.OptimizeMode, .ReleaseSafe),73 .optimize = @as(?std.builtin.OptimizeMode, .safe),
74 .bool = @as(?bool, true),74 .bool = @as(?bool, true),
75 .int = @as(?i64, 123),75 .int = @as(?i64, 123),
76 .float = @as(?f64, 0.5),76 .float = @as(?f64, 0.5),
...@@ -92,7 +92,7 @@ pub fn build(b: *std.Build) !void {...@@ -92,7 +92,7 @@ pub fn build(b: *std.Build) !void {
9292
93 const all_specified_literal = b.dependency("other", .{93 const all_specified_literal = b.dependency("other", .{
94 .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),94 .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),
95 .optimize = .ReleaseSafe,95 .optimize = .safe,
96 .bool = true,96 .bool = true,
97 .int = 123,97 .int = 123,
98 .float = 0.5,98 .float = 0.5,
...@@ -130,7 +130,7 @@ pub fn build(b: *std.Build) !void {...@@ -130,7 +130,7 @@ pub fn build(b: *std.Build) !void {
130 // to the same cached dependency instance.130 // to the same cached dependency instance.
131 const all_specified_alt = b.dependency("other", .{131 const all_specified_alt = b.dependency("other", .{
132 .target = @as(std.Target.Query, .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),132 .target = @as(std.Target.Query, .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),
133 .optimize = "ReleaseSafe",133 .optimize = "safe",
134 .bool = .true,134 .bool = .true,
135 .int = "123",135 .int = "123",
136 .float = @as(f16, 0.5),136 .float = @as(f16, 0.5),
test/standalone/simple/build.zig+5-5
...@@ -13,26 +13,26 @@ pub fn build(b: *std.Build) void {...@@ -13,26 +13,26 @@ pub fn build(b: *std.Build) void {
13 var optimize_modes_buf: [4]std.builtin.OptimizeMode = undefined;13 var optimize_modes_buf: [4]std.builtin.OptimizeMode = undefined;
14 var optimize_modes_len: usize = 0;14 var optimize_modes_len: usize = 0;
15 if (!skip_debug) {15 if (!skip_debug) {
16 optimize_modes_buf[optimize_modes_len] = .Debug;16 optimize_modes_buf[optimize_modes_len] = .debug;
17 optimize_modes_len += 1;17 optimize_modes_len += 1;
18 }18 }
19 if (!skip_release_safe) {19 if (!skip_release_safe) {
20 optimize_modes_buf[optimize_modes_len] = .ReleaseSafe;20 optimize_modes_buf[optimize_modes_len] = .safe;
21 optimize_modes_len += 1;21 optimize_modes_len += 1;
22 }22 }
23 if (!skip_release_fast) {23 if (!skip_release_fast) {
24 optimize_modes_buf[optimize_modes_len] = .ReleaseFast;24 optimize_modes_buf[optimize_modes_len] = .fast;
25 optimize_modes_len += 1;25 optimize_modes_len += 1;
26 }26 }
27 if (!skip_release_small) {27 if (!skip_release_small) {
28 optimize_modes_buf[optimize_modes_len] = .ReleaseSmall;28 optimize_modes_buf[optimize_modes_len] = .small;
29 optimize_modes_len += 1;29 optimize_modes_len += 1;
30 }30 }
31 const optimize_modes = optimize_modes_buf[0..optimize_modes_len];31 const optimize_modes = optimize_modes_buf[0..optimize_modes_len];
3232
33 for (cases) |case| {33 for (cases) |case| {
34 for (optimize_modes) |optimize| {34 for (optimize_modes) |optimize| {
35 if (!case.all_modes and optimize != .Debug) continue;35 if (!case.all_modes and optimize != .debug) continue;
36 if (case.os_filter) |os_tag| {36 if (case.os_filter) |os_tag| {
37 if (os_tag != builtin.os.tag) continue;37 if (os_tag != builtin.os.tag) continue;
38 }38 }
test/tests.zig+22-22
...@@ -23,7 +23,7 @@ pub const LinkContext = @import("src/Link.zig");...@@ -23,7 +23,7 @@ pub const LinkContext = @import("src/Link.zig");
23const ModuleTestTarget = struct {23const ModuleTestTarget = struct {
24 linkage: ?std.builtin.LinkMode = null,24 linkage: ?std.builtin.LinkMode = null,
25 target: std.Target.Query = .{},25 target: std.Target.Query = .{},
26 optimize_mode: std.builtin.OptimizeMode = .Debug,26 optimize_mode: std.builtin.OptimizeMode = .debug,
27 link_libc: ?bool = null,27 link_libc: ?bool = null,
28 single_threaded: ?bool = null,28 single_threaded: ?bool = null,
29 use_llvm: ?bool = null,29 use_llvm: ?bool = null,
...@@ -57,38 +57,38 @@ const module_test_targets = blk: {...@@ -57,38 +57,38 @@ const module_test_targets = blk: {
57 },57 },
5858
59 .{59 .{
60 .optimize_mode = .ReleaseFast,60 .optimize_mode = .fast,
61 },61 },
62 .{62 .{
63 .link_libc = true,63 .link_libc = true,
64 .optimize_mode = .ReleaseFast,64 .optimize_mode = .fast,
65 },65 },
66 .{66 .{
67 .optimize_mode = .ReleaseFast,67 .optimize_mode = .fast,
68 .single_threaded = true,68 .single_threaded = true,
69 },69 },
7070
71 .{71 .{
72 .optimize_mode = .ReleaseSafe,72 .optimize_mode = .safe,
73 },73 },
74 .{74 .{
75 .link_libc = true,75 .link_libc = true,
76 .optimize_mode = .ReleaseSafe,76 .optimize_mode = .safe,
77 },77 },
78 .{78 .{
79 .optimize_mode = .ReleaseSafe,79 .optimize_mode = .safe,
80 .single_threaded = true,80 .single_threaded = true,
81 },81 },
8282
83 .{83 .{
84 .optimize_mode = .ReleaseSmall,84 .optimize_mode = .small,
85 },85 },
86 .{86 .{
87 .link_libc = true,87 .link_libc = true,
88 .optimize_mode = .ReleaseSmall,88 .optimize_mode = .small,
89 },89 },
90 .{90 .{
91 .optimize_mode = .ReleaseSmall,91 .optimize_mode = .small,
92 .single_threaded = true,92 .single_threaded = true,
93 },93 },
9494
...@@ -200,7 +200,7 @@ const module_test_targets = blk: {...@@ -200,7 +200,7 @@ const module_test_targets = blk: {
200 // },200 // },
201 // .use_llvm = false,201 // .use_llvm = false,
202 // .use_lld = false,202 // .use_lld = false,
203 // .optimize_mode = .ReleaseFast,203 // .optimize_mode = .fast,
204 // .strip = true,204 // .strip = true,
205 // .skip_modules = &.{"std"}, // TODO get these passing205 // .skip_modules = &.{"std"}, // TODO get these passing
206 //},206 //},
...@@ -213,7 +213,7 @@ const module_test_targets = blk: {...@@ -213,7 +213,7 @@ const module_test_targets = blk: {
213 // },213 // },
214 // .use_llvm = false,214 // .use_llvm = false,
215 // .use_lld = false,215 // .use_lld = false,
216 // .optimize_mode = .ReleaseFast,216 // .optimize_mode = .fast,
217 // .strip = true,217 // .strip = true,
218 // .skip_modules = &.{"std"}, // TODO get these passing218 // .skip_modules = &.{"std"}, // TODO get these passing
219 //},219 //},
...@@ -1257,7 +1257,7 @@ const module_test_targets = blk: {...@@ -1257,7 +1257,7 @@ const module_test_targets = blk: {
1257 // },1257 // },
1258 // .use_llvm = false,1258 // .use_llvm = false,
1259 // .use_lld = false,1259 // .use_lld = false,
1260 // .optimize_mode = .ReleaseFast,1260 // .optimize_mode = .fast,
1261 // .strip = true,1261 // .strip = true,
1262 //},1262 //},
12631263
...@@ -2063,7 +2063,7 @@ const c_abi_targets = blk: {...@@ -2063,7 +2063,7 @@ const c_abi_targets = blk: {
20632063
2064const LinkTarget = struct {2064const LinkTarget = struct {
2065 target: std.Target.Query = .{},2065 target: std.Target.Query = .{},
2066 optimize_mode: std.builtin.OptimizeMode = .Debug,2066 optimize_mode: std.builtin.OptimizeMode = .debug,
2067 link_libc: bool = false,2067 link_libc: bool = false,
2068 use_llvm: bool = false,2068 use_llvm: bool = false,
2069 use_lld: bool = false,2069 use_lld: bool = false,
...@@ -2368,7 +2368,7 @@ pub fn addStackTraceTests(...@@ -2368,7 +2368,7 @@ pub fn addStackTraceTests(
2368 .root_module = b.createModule(.{2368 .root_module = b.createModule(.{
2369 .root_source_file = b.path("test/src/convert-stack-trace.zig"),2369 .root_source_file = b.path("test/src/convert-stack-trace.zig"),
2370 .target = b.graph.host,2370 .target = b.graph.host,
2371 .optimize = .Debug,2371 .optimize = .debug,
2372 }),2372 }),
2373 });2373 });
23742374
...@@ -2422,7 +2422,7 @@ pub fn addErrorTraceTests(...@@ -2422,7 +2422,7 @@ pub fn addErrorTraceTests(
2422 .root_module = b.createModule(.{2422 .root_module = b.createModule(.{
2423 .root_source_file = b.path("test/src/convert-stack-trace.zig"),2423 .root_source_file = b.path("test/src/convert-stack-trace.zig"),
2424 .target = b.graph.host,2424 .target = b.graph.host,
2425 .optimize = .Debug,2425 .optimize = .debug,
2426 }),2426 }),
2427 });2427 });
24282428
...@@ -2486,10 +2486,10 @@ pub fn addStandaloneTests(...@@ -2486,10 +2486,10 @@ pub fn addStandaloneTests(
2486 .enable_ios_sdk = enable_ios_sdk,2486 .enable_ios_sdk = enable_ios_sdk,
2487 .enable_macos_sdk = enable_macos_sdk,2487 .enable_macos_sdk = enable_macos_sdk,
2488 .enable_symlinks_windows = enable_symlinks_windows,2488 .enable_symlinks_windows = enable_symlinks_windows,
2489 .simple_skip_debug = mem.indexOfScalar(OptimizeMode, optimize_modes, .Debug) == null,2489 .simple_skip_debug = mem.indexOfScalar(OptimizeMode, optimize_modes, .debug) == null,
2490 .simple_skip_release_safe = mem.indexOfScalar(OptimizeMode, optimize_modes, .ReleaseSafe) == null,2490 .simple_skip_release_safe = mem.indexOfScalar(OptimizeMode, optimize_modes, .safe) == null,
2491 .simple_skip_release_fast = mem.indexOfScalar(OptimizeMode, optimize_modes, .ReleaseFast) == null,2491 .simple_skip_release_fast = mem.indexOfScalar(OptimizeMode, optimize_modes, .fast) == null,
2492 .simple_skip_release_small = mem.indexOfScalar(OptimizeMode, optimize_modes, .ReleaseSmall) == null,2492 .simple_skip_release_small = mem.indexOfScalar(OptimizeMode, optimize_modes, .small) == null,
2493 });2493 });
2494 const test_cases_dep_step = test_cases_dep.builder.default_step;2494 const test_cases_dep_step = test_cases_dep.builder.default_step;
2495 test_cases_dep_step.name = b.dupe(test_cases_dep_name);2495 test_cases_dep_step.name = b.dupe(test_cases_dep_name);
...@@ -3057,7 +3057,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt...@@ -3057,7 +3057,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt
3057 if (use_llvm) |x| return x;3057 if (use_llvm) |x| return x;
3058 if (query.ofmt == .c) return false;3058 if (query.ofmt == .c) return false;
3059 switch (optimize_mode) {3059 switch (optimize_mode) {
3060 .Debug => {},3060 .debug => {},
3061 else => return true,3061 else => return true,
3062 }3062 }
3063 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;3063 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;
...@@ -3314,7 +3314,7 @@ pub fn addIncrementalTests(b: *std.Build, test_step: *Step, test_filters: []cons...@@ -3314,7 +3314,7 @@ pub fn addIncrementalTests(b: *std.Build, test_step: *Step, test_filters: []cons
3314 .root_module = b.createModule(.{3314 .root_module = b.createModule(.{
3315 .root_source_file = b.path("tools/incr-check.zig"),3315 .root_source_file = b.path("tools/incr-check.zig"),
3316 .target = b.graph.host,3316 .target = b.graph.host,
3317 .optimize = .Debug,3317 .optimize = .debug,
3318 }),3318 }),
3319 });3319 });
33203320
tools/doctest.zig+3-3
...@@ -915,11 +915,11 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {...@@ -915,11 +915,11 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
915 while (it.next()) |prefixed_line| {915 while (it.next()) |prefixed_line| {
916 const line = skipPrefix(prefixed_line);916 const line = skipPrefix(prefixed_line);
917 if (mem.startsWith(u8, line, "optimize=")) {917 if (mem.startsWith(u8, line, "optimize=")) {
918 mode = std.meta.stringToEnum(std.builtin.OptimizeMode, line["optimize=".len..]) orelse918 mode = std.builtin.Optimize.fromString(line["optimize=".len..]) orelse
919 fatal("bad optimization mode line: '{s}'", .{line});919 fatal("bad optimization mode line: {q}", .{line});
920 } else if (mem.startsWith(u8, line, "link_mode=")) {920 } else if (mem.startsWith(u8, line, "link_mode=")) {
921 link_mode = std.meta.stringToEnum(std.builtin.LinkMode, line["link_mode=".len..]) orelse921 link_mode = std.meta.stringToEnum(std.builtin.LinkMode, line["link_mode=".len..]) orelse
922 fatal("bad link mode line: '{s}'", .{line});922 fatal("bad link mode line: {q}", .{line});
923 } else if (mem.startsWith(u8, line, "link_object=")) {923 } else if (mem.startsWith(u8, line, "link_object=")) {
924 try link_objects.append(arena, line["link_object=".len..]);924 try link_objects.append(arena, line["link_object=".len..]);
925 } else if (mem.startsWith(u8, line, "additional_option=")) {925 } else if (mem.startsWith(u8, line, "additional_option=")) {
tools/migrate_langref.zig+2-2
...@@ -319,7 +319,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp...@@ -319,7 +319,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
319 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});319 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});
320 }320 }
321321
322 var mode: std.builtin.OptimizeMode = .Debug;322 var mode: std.builtin.OptimizeMode = .debug;
323 var link_objects = std.array_list.Managed([]const u8).init(arena);323 var link_objects = std.array_list.Managed([]const u8).init(arena);
324 var target_str: ?[]const u8 = null;324 var target_str: ?[]const u8 = null;
325 var link_libc = false;325 var link_libc = false;
...@@ -403,7 +403,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp...@@ -403,7 +403,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
403 },403 },
404 }404 }
405405
406 if (mode != .Debug)406 if (mode != .debug)
407 try code.print("// optimize={s}\n", .{@tagName(mode)});407 try code.print("// optimize={s}\n", .{@tagName(mode)});
408408
409 for (link_objects.items) |link_object| {409 for (link_objects.items) |link_object| {