x86_64: rewrite @abs

This commit is contained in:
Jacob Young 2025-01-19 20:40:29 -05:00 committed by Andrew Kelley
parent d5db02728c
commit b9198b708f
5 changed files with 2469 additions and 1179 deletions

File diff suppressed because it is too large Load Diff

View File

@ -55,9 +55,9 @@ pub const Inst = struct {
_pkru,
/// ___ Performance-Monitoring Counters
_pmc,
/// ___ Rondam Number
/// ___ Random Number
_rand,
/// ___ Rondam Seed
/// ___ Random Seed
_seed,
/// ___ Shadow Stack Pointer Doubleword
_sspd,

View File

@ -210,7 +210,7 @@ fn testAbsFloats(comptime T: type) !void {
test "@abs int vectors" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
@ -268,8 +268,8 @@ fn testAbsIntVectors(comptime len: comptime_int) !void {
try expect(std.mem.eql(u64, &@as([len]u64, y), &@as([len]u64, @abs(x))));
}
{
var x = std.simd.repeat(len, @Vector(4, i32){ -2, 5, std.math.minInt(i32), -7 });
var y = std.simd.repeat(len, @Vector(4, u32){ 2, 5, -std.math.minInt(i32), 7 });
var x = comptime std.simd.repeat(len, @Vector(4, i32){ -2, 5, std.math.minInt(i32), -7 });
var y = comptime std.simd.repeat(len, @Vector(4, u32){ 2, 5, -std.math.minInt(i32), 7 });
_ = .{ &x, &y };
try expect(std.mem.eql(u32, &@as([len]u32, y), &@as([len]u32, @abs(x))));
}
@ -277,7 +277,6 @@ fn testAbsIntVectors(comptime len: comptime_int) !void {
test "@abs unsigned int vectors" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
@ -327,8 +326,8 @@ fn testAbsUnsignedIntVectors(comptime len: comptime_int) !void {
try expect(std.mem.eql(u64, &@as([len]u64, y), &@as([len]u64, @abs(x))));
}
{
var x = std.simd.repeat(len, @Vector(3, u32){ 2, 5, 7 });
var y = std.simd.repeat(len, @Vector(3, u32){ 2, 5, 7 });
var x = comptime std.simd.repeat(len, @Vector(3, u32){ 2, 5, 7 });
var y = comptime std.simd.repeat(len, @Vector(3, u32){ 2, 5, 7 });
_ = .{ &x, &y };
try expect(std.mem.eql(u32, &@as([len]u32, y), &@as([len]u32, @abs(x))));
}

View File

@ -1,5 +1,11 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const test_filters = b.option(
[]const []const u8,
"test-filter",
"Skip tests that do not match any filter",
) orelse &[0][]const u8{};
const compiler_rt_lib = b.addStaticLibrary(.{
.name = "compiler_rt",
.use_llvm = false,
@ -96,6 +102,7 @@ pub fn build(b: *std.Build) void {
});
const test_exe = b.addTest(.{
.name = std.fs.path.stem(path),
.filters = test_filters,
.use_llvm = false,
.use_lld = false,
.root_module = test_mod,

File diff suppressed because it is too large Load Diff