zig icon indicating copy to clipboard operation
zig copied to clipboard

aarch64 failing `@mulAdd` behavior test for f128

Open andrewrk opened this issue 2 years ago • 3 comments

test {
        var a: f16 = 5.5;
        var b: f128 = 2.5;
        var c: f128 = 6.25;
        try expect(@mulAdd(f128, a, b, c) == 20);
}

andrewrk avatar Oct 05 '21 23:10 andrewrk

This is still broken on my aarch64 M1 MBA on 0.9.0-dev.1759+c9352ef9d (latest master at the time of writing).

kubkon avatar Nov 25 '21 17:11 kubkon

More details please, do the tests modified in the linked PR pass? Can you print the values received by __extendhftf2 and friends to check if the parameter passing is (somehow) wrong on M1 CPUs?

LemonBoy avatar Nov 26 '21 08:11 LemonBoy

I am on MacBook M1

zig version
0.9.1
test {
    var a: f16 = 5.5;
    var b: f128 = 2.5;
    var c: f128 = 6.25;
    try std.testing.expectEqual(@mulAdd(f128, a, b, c), 20);
}

➜ hello-world zig test src/main.zig
Test [1/2] test ""... expected 0.0e+00, found 2.0e+01
Test [2/2] test ""... FAIL (TestExpectedEqual)
/opt/homebrew/Cellar/zig/0.9.1/lib/zig/std/testing.zig:79:17: 0x1040a6aef in std.testing.expectEqual (test)
                return error.TestExpectedEqual;
                ^
/Users/rubiagatra/experimental/hello-world/src/main.zig:15:5: 0x1040a5b1b in test "" (test)
    try std.testing.expectEqual(@mulAdd(f128, a, b, c), 20);
    ^
1 passed; 0 skipped; 1 failed.
error: the following test command failed with exit code 1:
src/zig-cache/o/63e2b84dfd98a2e306ac5890fc1a517b/test /opt/homebrew/Cellar/zig/0.9.1/bin/zig

rubiagatra avatar Mar 02 '22 23:03 rubiagatra