| author | |
| committer | |
| log | 9bcfe55b5c892ed584a8cc4cb60a4df3a1b8bffc |
| tree | 66364b7534873cb4d147716ff6711f982506a1e8 |
| parent | a792e13fc08982e79cb1b08d14322be76b8cf77a |
| parent | d10fd78d4615f329141f5c19f893039d56aff425 |
| signature |
CI: add aarch64-windows coverage11 files changed, 439 insertions(+), 264 deletions(-)
.github/workflows/ci.yaml+11-2| ... | ... | @@ -39,7 +39,7 @@ jobs: |
| 39 | 39 | run: sh ci/aarch64-linux-release.sh |
| 40 | 40 | x86_64-macos: |
| 41 | 41 | runs-on: "macos-11" |
| 42 | env: | |
| 42 | env: | |
| 43 | 43 | ARCH: "x86_64" |
| 44 | 44 | steps: |
| 45 | 45 | - name: Checkout |
| ... | ... | @@ -48,7 +48,7 @@ jobs: |
| 48 | 48 | run: ci/x86_64-macos.sh |
| 49 | 49 | aarch64-macos: |
| 50 | 50 | runs-on: [self-hosted, macOS, aarch64] |
| 51 | env: | |
| 51 | env: | |
| 52 | 52 | ARCH: "aarch64" |
| 53 | 53 | steps: |
| 54 | 54 | - name: Checkout |
| ... | ... | @@ -64,3 +64,12 @@ jobs: |
| 64 | 64 | uses: actions/checkout@v3 |
| 65 | 65 | - name: Build and Test |
| 66 | 66 | run: ci/x86_64-windows.ps1 |
| 67 | aarch64-windows: | |
| 68 | runs-on: [self-hosted, Windows, aarch64] | |
| 69 | env: | |
| 70 | ARCH: "aarch64" | |
| 71 | steps: | |
| 72 | - name: Checkout | |
| 73 | uses: actions/checkout@v3 | |
| 74 | - name: Build and Test | |
| 75 | run: ci/aarch64-windows.ps1 |
CMakeLists.txt+8| ... | ... | @@ -120,6 +120,7 @@ string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_INCLUDE_DIR_ESCAPED "${ZIG_LIBC_ |
| 120 | 120 | set(ZIG_TARGET_TRIPLE "native" CACHE STRING "arch-os-abi to output binaries for") |
| 121 | 121 | set(ZIG_TARGET_MCPU "native" CACHE STRING "-mcpu parameter to output binaries for") |
| 122 | 122 | set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread") |
| 123 | set(ZIG_AR_WORKAROUND off CACHE BOOL "append 'ar' subcommand to CMAKE_AR") | |
| 123 | 124 | |
| 124 | 125 | if("${ZIG_TARGET_TRIPLE}" STREQUAL "native") |
| 125 | 126 | set(ZIG_USE_LLVM_CONFIG ON CACHE BOOL "use llvm-config to find LLVM libraries") |
| ... | ... | @@ -127,6 +128,11 @@ else() |
| 127 | 128 | set(ZIG_USE_LLVM_CONFIG OFF CACHE BOOL "use llvm-config to find LLVM libraries") |
| 128 | 129 | endif() |
| 129 | 130 | |
| 131 | if(ZIG_AR_WORKAROUND) | |
| 132 | string(REPLACE "<CMAKE_AR>" "<CMAKE_AR> ar" CMAKE_C_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE}) | |
| 133 | string(REPLACE "<CMAKE_AR>" "<CMAKE_AR> ar" CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_CXX_ARCHIVE_CREATE}) | |
| 134 | endif() | |
| 135 | ||
| 130 | 136 | find_package(llvm 15) |
| 131 | 137 | find_package(clang 15) |
| 132 | 138 | find_package(lld 15) |
| ... | ... | @@ -702,6 +708,8 @@ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") |
| 702 | 708 | set(HOST_TARGET_ARCH "x86_64") |
| 703 | 709 | elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") |
| 704 | 710 | set(HOST_TARGET_ARCH "aarch64") |
| 711 | elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "ARM64") | |
| 712 | set(HOST_TARGET_ARCH "aarch64") | |
| 705 | 713 | else() |
| 706 | 714 | string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" HOST_TARGET_ARCH) |
| 707 | 715 | endif() |
ci/aarch64-windows.ps1 created+73| ... | ... | @@ -0,0 +1,73 @@ |
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | |
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.670+f7fea080b" | |
| 3 | $MCPU = "baseline" | |
| 4 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 5 | $PREFIX_PATH = "$(Get-Location)\..\$ZIG_LLVM_CLANG_LLD_NAME" | |
| 6 | $ZIG = "$PREFIX_PATH\bin\zig.exe" | |
| 7 | $ZIG_LIB_DIR = "$(Get-Location)\lib" | |
| 8 | ||
| 9 | if (!(Test-Path "..\$ZIG_LLVM_CLANG_LLD_NAME.zip")) { | |
| 10 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | |
| 11 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "..\$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 12 | ||
| 13 | Write-Output "Extracting..." | |
| 14 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | |
| 15 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD\..\$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD\..") | |
| 16 | } | |
| 17 | ||
| 18 | function CheckLastExitCode { | |
| 19 | if (!$?) { | |
| 20 | exit 1 | |
| 21 | } | |
| 22 | return 0 | |
| 23 | } | |
| 24 | ||
| 25 | # Make the `zig version` number consistent. | |
| 26 | # This will affect the `zig build` command below which uses `git describe`. | |
| 27 | git config core.abbrev 9 | |
| 28 | git fetch --tags | |
| 29 | ||
| 30 | if ((git rev-parse --is-shallow-repository) -eq "true") { | |
| 31 | git fetch --unshallow # `git describe` won't work on a shallow repo | |
| 32 | } | |
| 33 | ||
| 34 | Write-Output "Building from source..." | |
| 35 | Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore | |
| 36 | New-Item -Path 'build-release' -ItemType Directory | |
| 37 | Set-Location -Path 'build-release' | |
| 38 | ||
| 39 | # CMake gives a syntax error when file paths with backward slashes are used. | |
| 40 | # Here, we use forward slashes only to work around this. | |
| 41 | & cmake .. ` | |
| 42 | -GNinja ` | |
| 43 | -DCMAKE_INSTALL_PREFIX="stage3-release" ` | |
| 44 | -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" ` | |
| 45 | -DCMAKE_BUILD_TYPE=Release ` | |
| 46 | -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" ` | |
| 47 | -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" ` | |
| 48 | -DCMAKE_AR="$ZIG" ` | |
| 49 | -DZIG_AR_WORKAROUND=ON ` | |
| 50 | -DZIG_TARGET_TRIPLE="$TARGET" ` | |
| 51 | -DZIG_TARGET_MCPU="$MCPU" ` | |
| 52 | -DZIG_STATIC=ON | |
| 53 | CheckLastExitCode | |
| 54 | ||
| 55 | ninja install | |
| 56 | CheckLastExitCode | |
| 57 | ||
| 58 | Write-Output "Main test suite..." | |
| 59 | & "stage3-release\bin\zig.exe" build test docs ` | |
| 60 | --zig-lib-dir "$ZIG_LIB_DIR" ` | |
| 61 | --search-prefix "$PREFIX_PATH" ` | |
| 62 | -Dstatic-llvm ` | |
| 63 | -Dskip-non-native ` | |
| 64 | -Denable-symlinks-windows | |
| 65 | CheckLastExitCode | |
| 66 | ||
| 67 | Write-Output "Testing Autodocs..." | |
| 68 | & "stage3-release\bin\zig.exe" test "..\lib\std\std.zig" ` | |
| 69 | --zig-lib-dir "$ZIG_LIB_DIR" ` | |
| 70 | -femit-docs ` | |
| 71 | -fno-emit-bin | |
| 72 | CheckLastExitCode | |
| 73 |
stage1/zig1.wasm| Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ |
test/behavior/align.zig+13-3| ... | ... | @@ -275,10 +275,20 @@ test "page aligned array on stack" { |
| 275 | 275 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 276 | 276 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 277 | 277 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 278 | // https://github.com/ziglang/zig/issues/13679 | |
| 278 | ||
| 279 | 279 | if (builtin.zig_backend == .stage2_llvm and |
| 280 | builtin.cpu.arch == .aarch64 and | |
| 281 | builtin.os.tag == .windows) return error.SkipZigTest; | |
| 280 | builtin.cpu.arch == .aarch64 and builtin.os.tag == .windows) | |
| 281 | { | |
| 282 | // https://github.com/ziglang/zig/issues/13679 | |
| 283 | return error.SkipZigTest; | |
| 284 | } | |
| 285 | ||
| 286 | if (builtin.zig_backend == .stage2_c and | |
| 287 | builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) | |
| 288 | { | |
| 289 | // https://github.com/ziglang/zig/issues/13876 | |
| 290 | return error.SkipZigTest; | |
| 291 | } | |
| 282 | 292 | |
| 283 | 293 | // Large alignment value to make it hard to accidentally pass. |
| 284 | 294 | var array align(0x1000) = [_]u8{ 1, 2, 3, 4, 5, 6, 7, 8 }; |
test/behavior/cast.zig+7| ... | ... | @@ -1351,6 +1351,13 @@ test "cast f128 to narrower types" { |
| 1351 | 1351 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1352 | 1352 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1353 | 1353 | |
| 1354 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 1355 | builtin.zig_backend == .stage2_c) | |
| 1356 | { | |
| 1357 | // https://github.com/ziglang/zig/issues/13876 | |
| 1358 | return error.SkipZigTest; | |
| 1359 | } | |
| 1360 | ||
| 1354 | 1361 | const S = struct { |
| 1355 | 1362 | fn doTheTest() !void { |
| 1356 | 1363 | var x: f128 = 1234.0; |
test/behavior/floatop.zig+276| ... | ... | @@ -185,6 +185,32 @@ test "more @sqrt f16 tests" { |
| 185 | 185 | try expect(math.isNan(@sqrt(@as(f16, math.nan(f16))))); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | test "another, possibly redundant @sqrt test" { | |
| 189 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 190 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 191 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 192 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 193 | ||
| 194 | try testSqrtLegacy(f64, 12.0); | |
| 195 | comptime try testSqrtLegacy(f64, 12.0); | |
| 196 | try testSqrtLegacy(f32, 13.0); | |
| 197 | comptime try testSqrtLegacy(f32, 13.0); | |
| 198 | try testSqrtLegacy(f16, 13.0); | |
| 199 | comptime try testSqrtLegacy(f16, 13.0); | |
| 200 | ||
| 201 | // TODO: make this pass | |
| 202 | if (false) { | |
| 203 | const x = 14.0; | |
| 204 | const y = x * x; | |
| 205 | const z = @sqrt(y); | |
| 206 | comptime try expect(z == x); | |
| 207 | } | |
| 208 | } | |
| 209 | ||
| 210 | fn testSqrtLegacy(comptime T: type, x: T) !void { | |
| 211 | try expect(@sqrt(x * x) == x); | |
| 212 | } | |
| 213 | ||
| 188 | 214 | test "@sin" { |
| 189 | 215 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 190 | 216 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -529,6 +555,85 @@ fn testFabsWithVectors() !void { |
| 529 | 555 | try expect(math.approxEqAbs(f32, @fabs(@as(f32, -0.4)), result[3], epsilon)); |
| 530 | 556 | } |
| 531 | 557 | |
| 558 | test "another, possibly redundant, @fabs test" { | |
| 559 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 560 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 561 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 562 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 563 | ||
| 564 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 565 | builtin.zig_backend == .stage2_c) | |
| 566 | { | |
| 567 | // https://github.com/ziglang/zig/issues/13876 | |
| 568 | return error.SkipZigTest; | |
| 569 | } | |
| 570 | ||
| 571 | try testFabsLegacy(f128, 12.0); | |
| 572 | comptime try testFabsLegacy(f128, 12.0); | |
| 573 | try testFabsLegacy(f64, 12.0); | |
| 574 | comptime try testFabsLegacy(f64, 12.0); | |
| 575 | try testFabsLegacy(f32, 12.0); | |
| 576 | comptime try testFabsLegacy(f32, 12.0); | |
| 577 | try testFabsLegacy(f16, 12.0); | |
| 578 | comptime try testFabsLegacy(f16, 12.0); | |
| 579 | ||
| 580 | const x = 14.0; | |
| 581 | const y = -x; | |
| 582 | const z = @fabs(y); | |
| 583 | comptime try std.testing.expectEqual(x, z); | |
| 584 | } | |
| 585 | ||
| 586 | test "@fabs f80" { | |
| 587 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 588 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 589 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 590 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 591 | ||
| 592 | try testFabsLegacy(f80, 12.0); | |
| 593 | comptime try testFabsLegacy(f80, 12.0); | |
| 594 | } | |
| 595 | ||
| 596 | fn testFabsLegacy(comptime T: type, x: T) !void { | |
| 597 | const y = -x; | |
| 598 | const z = @fabs(y); | |
| 599 | try expect(x == z); | |
| 600 | } | |
| 601 | ||
| 602 | test "a third @fabs test, surely there should not be three fabs tests" { | |
| 603 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 604 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 605 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 606 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 607 | ||
| 608 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 609 | builtin.zig_backend == .stage2_c) | |
| 610 | { | |
| 611 | // https://github.com/ziglang/zig/issues/13876 | |
| 612 | return error.SkipZigTest; | |
| 613 | } | |
| 614 | ||
| 615 | inline for ([_]type{ f16, f32, f64, f80, f128, c_longdouble }) |T| { | |
| 616 | // normals | |
| 617 | try expect(@fabs(@as(T, 1.0)) == 1.0); | |
| 618 | try expect(@fabs(@as(T, -1.0)) == 1.0); | |
| 619 | try expect(@fabs(math.floatMin(T)) == math.floatMin(T)); | |
| 620 | try expect(@fabs(-math.floatMin(T)) == math.floatMin(T)); | |
| 621 | try expect(@fabs(math.floatMax(T)) == math.floatMax(T)); | |
| 622 | try expect(@fabs(-math.floatMax(T)) == math.floatMax(T)); | |
| 623 | ||
| 624 | // subnormals | |
| 625 | try expect(@fabs(@as(T, 0.0)) == 0.0); | |
| 626 | try expect(@fabs(@as(T, -0.0)) == 0.0); | |
| 627 | try expect(@fabs(math.floatTrueMin(T)) == math.floatTrueMin(T)); | |
| 628 | try expect(@fabs(-math.floatTrueMin(T)) == math.floatTrueMin(T)); | |
| 629 | ||
| 630 | // non-finite numbers | |
| 631 | try expect(math.isPositiveInf(@fabs(math.inf(T)))); | |
| 632 | try expect(math.isPositiveInf(@fabs(-math.inf(T)))); | |
| 633 | try expect(math.isNan(@fabs(math.nan(T)))); | |
| 634 | } | |
| 635 | } | |
| 636 | ||
| 532 | 637 | test "@floor" { |
| 533 | 638 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 534 | 639 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -573,6 +678,56 @@ fn testFloorWithVectors() !void { |
| 573 | 678 | try expect(math.approxEqAbs(f32, @floor(@as(f32, -0.4)), result[3], epsilon)); |
| 574 | 679 | } |
| 575 | 680 | |
| 681 | test "another, possibly redundant, @floor test" { | |
| 682 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 683 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 684 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 685 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 686 | ||
| 687 | try testFloorLegacy(f64, 12.0); | |
| 688 | comptime try testFloorLegacy(f64, 12.0); | |
| 689 | try testFloorLegacy(f32, 12.0); | |
| 690 | comptime try testFloorLegacy(f32, 12.0); | |
| 691 | try testFloorLegacy(f16, 12.0); | |
| 692 | comptime try testFloorLegacy(f16, 12.0); | |
| 693 | ||
| 694 | const x = 14.0; | |
| 695 | const y = x + 0.7; | |
| 696 | const z = @floor(y); | |
| 697 | comptime try expect(x == z); | |
| 698 | } | |
| 699 | ||
| 700 | test "@floor f80" { | |
| 701 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 702 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 703 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 704 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 705 | ||
| 706 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { | |
| 707 | // https://github.com/ziglang/zig/issues/12602 | |
| 708 | return error.SkipZigTest; | |
| 709 | } | |
| 710 | ||
| 711 | try testFloorLegacy(f80, 12.0); | |
| 712 | comptime try testFloorLegacy(f80, 12.0); | |
| 713 | } | |
| 714 | ||
| 715 | test "@floor f128" { | |
| 716 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 717 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 718 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 719 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 720 | ||
| 721 | try testFloorLegacy(f128, 12.0); | |
| 722 | comptime try testFloorLegacy(f128, 12.0); | |
| 723 | } | |
| 724 | ||
| 725 | fn testFloorLegacy(comptime T: type, x: T) !void { | |
| 726 | const y = x + 0.6; | |
| 727 | const z = @floor(y); | |
| 728 | try expect(x == z); | |
| 729 | } | |
| 730 | ||
| 576 | 731 | test "@ceil" { |
| 577 | 732 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 578 | 733 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -617,6 +772,56 @@ fn testCeilWithVectors() !void { |
| 617 | 772 | try expect(math.approxEqAbs(f32, @ceil(@as(f32, -0.4)), result[3], epsilon)); |
| 618 | 773 | } |
| 619 | 774 | |
| 775 | test "another, possibly redundant, @ceil test" { | |
| 776 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 777 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 778 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 779 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 780 | ||
| 781 | try testCeilLegacy(f64, 12.0); | |
| 782 | comptime try testCeilLegacy(f64, 12.0); | |
| 783 | try testCeilLegacy(f32, 12.0); | |
| 784 | comptime try testCeilLegacy(f32, 12.0); | |
| 785 | try testCeilLegacy(f16, 12.0); | |
| 786 | comptime try testCeilLegacy(f16, 12.0); | |
| 787 | ||
| 788 | const x = 14.0; | |
| 789 | const y = x - 0.7; | |
| 790 | const z = @ceil(y); | |
| 791 | comptime try expect(x == z); | |
| 792 | } | |
| 793 | ||
| 794 | test "@ceil f80" { | |
| 795 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 796 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 797 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 798 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 799 | ||
| 800 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { | |
| 801 | // https://github.com/ziglang/zig/issues/12602 | |
| 802 | return error.SkipZigTest; | |
| 803 | } | |
| 804 | ||
| 805 | try testCeilLegacy(f80, 12.0); | |
| 806 | comptime try testCeilLegacy(f80, 12.0); | |
| 807 | } | |
| 808 | ||
| 809 | test "@ceil f128" { | |
| 810 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 811 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 812 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 813 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 814 | ||
| 815 | try testCeilLegacy(f128, 12.0); | |
| 816 | comptime try testCeilLegacy(f128, 12.0); | |
| 817 | } | |
| 818 | ||
| 819 | fn testCeilLegacy(comptime T: type, x: T) !void { | |
| 820 | const y = x - 0.8; | |
| 821 | const z = @ceil(y); | |
| 822 | try expect(x == z); | |
| 823 | } | |
| 824 | ||
| 620 | 825 | test "@trunc" { |
| 621 | 826 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 622 | 827 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -661,6 +866,70 @@ fn testTruncWithVectors() !void { |
| 661 | 866 | try expect(math.approxEqAbs(f32, @trunc(@as(f32, -0.4)), result[3], epsilon)); |
| 662 | 867 | } |
| 663 | 868 | |
| 869 | test "another, possibly redundant, @trunc test" { | |
| 870 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 871 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 872 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 873 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 874 | ||
| 875 | try testTruncLegacy(f64, 12.0); | |
| 876 | comptime try testTruncLegacy(f64, 12.0); | |
| 877 | try testTruncLegacy(f32, 12.0); | |
| 878 | comptime try testTruncLegacy(f32, 12.0); | |
| 879 | try testTruncLegacy(f16, 12.0); | |
| 880 | comptime try testTruncLegacy(f16, 12.0); | |
| 881 | ||
| 882 | const x = 14.0; | |
| 883 | const y = x + 0.7; | |
| 884 | const z = @trunc(y); | |
| 885 | comptime try expect(x == z); | |
| 886 | } | |
| 887 | ||
| 888 | test "@trunc f80" { | |
| 889 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 890 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 891 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 892 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 893 | ||
| 894 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { | |
| 895 | // https://github.com/ziglang/zig/issues/12602 | |
| 896 | return error.SkipZigTest; | |
| 897 | } | |
| 898 | ||
| 899 | try testTruncLegacy(f80, 12.0); | |
| 900 | comptime try testTruncLegacy(f80, 12.0); | |
| 901 | comptime { | |
| 902 | const x: f80 = 12.0; | |
| 903 | const y = x + 0.8; | |
| 904 | const z = @trunc(y); | |
| 905 | try expect(x == z); | |
| 906 | } | |
| 907 | } | |
| 908 | ||
| 909 | test "@trunc f128" { | |
| 910 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 911 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 912 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 913 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 914 | ||
| 915 | try testTruncLegacy(f128, 12.0); | |
| 916 | comptime try testTruncLegacy(f128, 12.0); | |
| 917 | } | |
| 918 | ||
| 919 | fn testTruncLegacy(comptime T: type, x: T) !void { | |
| 920 | { | |
| 921 | const y = x + 0.8; | |
| 922 | const z = @trunc(y); | |
| 923 | try expect(x == z); | |
| 924 | } | |
| 925 | ||
| 926 | { | |
| 927 | const y = -x - 0.8; | |
| 928 | const z = @trunc(y); | |
| 929 | try expect(-x == z); | |
| 930 | } | |
| 931 | } | |
| 932 | ||
| 664 | 933 | test "negation f16" { |
| 665 | 934 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 666 | 935 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -757,6 +1026,13 @@ test "negation f128" { |
| 757 | 1026 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 758 | 1027 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 759 | 1028 | |
| 1029 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 1030 | builtin.zig_backend == .stage2_c) | |
| 1031 | { | |
| 1032 | // https://github.com/ziglang/zig/issues/13876 | |
| 1033 | return error.SkipZigTest; | |
| 1034 | } | |
| 1035 | ||
| 760 | 1036 | const S = struct { |
| 761 | 1037 | fn doTheTest() !void { |
| 762 | 1038 | var a: f128 = 1; |
test/behavior/math.zig+26-257| ... | ... | @@ -578,6 +578,13 @@ test "f128" { |
| 578 | 578 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 579 | 579 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 580 | 580 | |
| 581 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 582 | builtin.zig_backend == .stage2_c) | |
| 583 | { | |
| 584 | // https://github.com/ziglang/zig/issues/13876 | |
| 585 | return error.SkipZigTest; | |
| 586 | } | |
| 587 | ||
| 581 | 588 | try test_f128(); |
| 582 | 589 | comptime try test_f128(); |
| 583 | 590 | } |
| ... | ... | @@ -1150,7 +1157,18 @@ test "remainder division" { |
| 1150 | 1157 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1151 | 1158 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1152 | 1159 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1153 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/12602 | |
| 1160 | ||
| 1161 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { | |
| 1162 | // https://github.com/ziglang/zig/issues/12602 | |
| 1163 | return error.SkipZigTest; | |
| 1164 | } | |
| 1165 | ||
| 1166 | if (builtin.zig_backend == .stage2_c and builtin.os.tag == .windows and | |
| 1167 | builtin.cpu.arch == .aarch64) | |
| 1168 | { | |
| 1169 | // https://github.com/ziglang/zig/issues/13876 | |
| 1170 | return error.SkipZigTest; | |
| 1171 | } | |
| 1154 | 1172 | |
| 1155 | 1173 | comptime try remdiv(f16); |
| 1156 | 1174 | comptime try remdiv(f32); |
| ... | ... | @@ -1262,233 +1280,6 @@ fn fmodOne(comptime T: type, a: T, b: T, c: T, epsilon: T) !void { |
| 1262 | 1280 | try expect(@fabs(@mod(@as(T, a), @as(T, b)) - @as(T, c)) < epsilon); |
| 1263 | 1281 | } |
| 1264 | 1282 | |
| 1265 | test "@sqrt" { | |
| 1266 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1267 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1268 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1269 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1270 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1271 | ||
| 1272 | try testSqrt(f64, 12.0); | |
| 1273 | comptime try testSqrt(f64, 12.0); | |
| 1274 | try testSqrt(f32, 13.0); | |
| 1275 | comptime try testSqrt(f32, 13.0); | |
| 1276 | try testSqrt(f16, 13.0); | |
| 1277 | comptime try testSqrt(f16, 13.0); | |
| 1278 | ||
| 1279 | // TODO: make this pass | |
| 1280 | if (false) { | |
| 1281 | const x = 14.0; | |
| 1282 | const y = x * x; | |
| 1283 | const z = @sqrt(y); | |
| 1284 | comptime try expect(z == x); | |
| 1285 | } | |
| 1286 | } | |
| 1287 | ||
| 1288 | fn testSqrt(comptime T: type, x: T) !void { | |
| 1289 | try expect(@sqrt(x * x) == x); | |
| 1290 | } | |
| 1291 | ||
| 1292 | test "@fabs" { | |
| 1293 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1294 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1295 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1296 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1297 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1298 | ||
| 1299 | try testFabs(f128, 12.0); | |
| 1300 | comptime try testFabs(f128, 12.0); | |
| 1301 | try testFabs(f64, 12.0); | |
| 1302 | comptime try testFabs(f64, 12.0); | |
| 1303 | try testFabs(f32, 12.0); | |
| 1304 | comptime try testFabs(f32, 12.0); | |
| 1305 | try testFabs(f16, 12.0); | |
| 1306 | comptime try testFabs(f16, 12.0); | |
| 1307 | ||
| 1308 | const x = 14.0; | |
| 1309 | const y = -x; | |
| 1310 | const z = @fabs(y); | |
| 1311 | comptime try expectEqual(x, z); | |
| 1312 | } | |
| 1313 | ||
| 1314 | test "@fabs f80" { | |
| 1315 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1316 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1317 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1318 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1319 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1320 | ||
| 1321 | try testFabs(f80, 12.0); | |
| 1322 | comptime try testFabs(f80, 12.0); | |
| 1323 | } | |
| 1324 | ||
| 1325 | fn testFabs(comptime T: type, x: T) !void { | |
| 1326 | const y = -x; | |
| 1327 | const z = @fabs(y); | |
| 1328 | try expect(x == z); | |
| 1329 | } | |
| 1330 | ||
| 1331 | test "@floor" { | |
| 1332 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1333 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1334 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1335 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1336 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1337 | ||
| 1338 | try testFloor(f64, 12.0); | |
| 1339 | comptime try testFloor(f64, 12.0); | |
| 1340 | try testFloor(f32, 12.0); | |
| 1341 | comptime try testFloor(f32, 12.0); | |
| 1342 | try testFloor(f16, 12.0); | |
| 1343 | comptime try testFloor(f16, 12.0); | |
| 1344 | ||
| 1345 | const x = 14.0; | |
| 1346 | const y = x + 0.7; | |
| 1347 | const z = @floor(y); | |
| 1348 | comptime try expect(x == z); | |
| 1349 | } | |
| 1350 | ||
| 1351 | test "@floor f80" { | |
| 1352 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1353 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1354 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1355 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1356 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1357 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/12602 | |
| 1358 | ||
| 1359 | try testFloor(f80, 12.0); | |
| 1360 | comptime try testFloor(f80, 12.0); | |
| 1361 | } | |
| 1362 | ||
| 1363 | test "@floor f128" { | |
| 1364 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1365 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1366 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1367 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1368 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1369 | ||
| 1370 | try testFloor(f128, 12.0); | |
| 1371 | comptime try testFloor(f128, 12.0); | |
| 1372 | } | |
| 1373 | ||
| 1374 | fn testFloor(comptime T: type, x: T) !void { | |
| 1375 | const y = x + 0.6; | |
| 1376 | const z = @floor(y); | |
| 1377 | try expect(x == z); | |
| 1378 | } | |
| 1379 | ||
| 1380 | test "@ceil" { | |
| 1381 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1382 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1383 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1384 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1385 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1386 | ||
| 1387 | try testCeil(f64, 12.0); | |
| 1388 | comptime try testCeil(f64, 12.0); | |
| 1389 | try testCeil(f32, 12.0); | |
| 1390 | comptime try testCeil(f32, 12.0); | |
| 1391 | try testCeil(f16, 12.0); | |
| 1392 | comptime try testCeil(f16, 12.0); | |
| 1393 | ||
| 1394 | const x = 14.0; | |
| 1395 | const y = x - 0.7; | |
| 1396 | const z = @ceil(y); | |
| 1397 | comptime try expect(x == z); | |
| 1398 | } | |
| 1399 | ||
| 1400 | test "@ceil f80" { | |
| 1401 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1402 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1403 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1404 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1405 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1406 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/12602 | |
| 1407 | ||
| 1408 | try testCeil(f80, 12.0); | |
| 1409 | comptime try testCeil(f80, 12.0); | |
| 1410 | } | |
| 1411 | ||
| 1412 | test "@ceil f128" { | |
| 1413 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1414 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1415 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1416 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1417 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1418 | ||
| 1419 | try testCeil(f128, 12.0); | |
| 1420 | comptime try testCeil(f128, 12.0); | |
| 1421 | } | |
| 1422 | ||
| 1423 | fn testCeil(comptime T: type, x: T) !void { | |
| 1424 | const y = x - 0.8; | |
| 1425 | const z = @ceil(y); | |
| 1426 | try expect(x == z); | |
| 1427 | } | |
| 1428 | ||
| 1429 | test "@trunc" { | |
| 1430 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1431 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1432 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1433 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1434 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1435 | ||
| 1436 | try testTrunc(f64, 12.0); | |
| 1437 | comptime try testTrunc(f64, 12.0); | |
| 1438 | try testTrunc(f32, 12.0); | |
| 1439 | comptime try testTrunc(f32, 12.0); | |
| 1440 | try testTrunc(f16, 12.0); | |
| 1441 | comptime try testTrunc(f16, 12.0); | |
| 1442 | ||
| 1443 | const x = 14.0; | |
| 1444 | const y = x + 0.7; | |
| 1445 | const z = @trunc(y); | |
| 1446 | comptime try expect(x == z); | |
| 1447 | } | |
| 1448 | ||
| 1449 | test "@trunc f80" { | |
| 1450 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1451 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1452 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1453 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1454 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1455 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/12602 | |
| 1456 | ||
| 1457 | try testTrunc(f80, 12.0); | |
| 1458 | comptime try testTrunc(f80, 12.0); | |
| 1459 | comptime { | |
| 1460 | const x: f80 = 12.0; | |
| 1461 | const y = x + 0.8; | |
| 1462 | const z = @trunc(y); | |
| 1463 | try expect(x == z); | |
| 1464 | } | |
| 1465 | } | |
| 1466 | ||
| 1467 | test "@trunc f128" { | |
| 1468 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1469 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1470 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1471 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1472 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1473 | ||
| 1474 | try testTrunc(f128, 12.0); | |
| 1475 | comptime try testTrunc(f128, 12.0); | |
| 1476 | } | |
| 1477 | ||
| 1478 | fn testTrunc(comptime T: type, x: T) !void { | |
| 1479 | { | |
| 1480 | const y = x + 0.8; | |
| 1481 | const z = @trunc(y); | |
| 1482 | try expect(x == z); | |
| 1483 | } | |
| 1484 | ||
| 1485 | { | |
| 1486 | const y = -x - 0.8; | |
| 1487 | const z = @trunc(y); | |
| 1488 | try expect(-x == z); | |
| 1489 | } | |
| 1490 | } | |
| 1491 | ||
| 1492 | 1283 | test "@round" { |
| 1493 | 1284 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1494 | 1285 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| ... | ... | @@ -1567,6 +1358,13 @@ test "NaN comparison" { |
| 1567 | 1358 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1568 | 1359 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1569 | 1360 | |
| 1361 | if (builtin.zig_backend == .stage2_c and builtin.os.tag == .windows and | |
| 1362 | builtin.cpu.arch == .aarch64) | |
| 1363 | { | |
| 1364 | // https://github.com/ziglang/zig/issues/13876 | |
| 1365 | return error.SkipZigTest; | |
| 1366 | } | |
| 1367 | ||
| 1570 | 1368 | try testNanEqNan(f16); |
| 1571 | 1369 | try testNanEqNan(f32); |
| 1572 | 1370 | try testNanEqNan(f64); |
| ... | ... | @@ -1667,35 +1465,6 @@ test "comptime sin and ln" { |
| 1667 | 1465 | try expect(v == @sin(@as(f32, 1)) + @log(@as(f32, 5))); |
| 1668 | 1466 | } |
| 1669 | 1467 | |
| 1670 | test "fabs" { | |
| 1671 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1672 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 1673 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | |
| 1674 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1675 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | |
| 1676 | ||
| 1677 | inline for ([_]type{ f16, f32, f64, f80, f128, c_longdouble }) |T| { | |
| 1678 | // normals | |
| 1679 | try expect(@fabs(@as(T, 1.0)) == 1.0); | |
| 1680 | try expect(@fabs(@as(T, -1.0)) == 1.0); | |
| 1681 | try expect(@fabs(math.floatMin(T)) == math.floatMin(T)); | |
| 1682 | try expect(@fabs(-math.floatMin(T)) == math.floatMin(T)); | |
| 1683 | try expect(@fabs(math.floatMax(T)) == math.floatMax(T)); | |
| 1684 | try expect(@fabs(-math.floatMax(T)) == math.floatMax(T)); | |
| 1685 | ||
| 1686 | // subnormals | |
| 1687 | try expect(@fabs(@as(T, 0.0)) == 0.0); | |
| 1688 | try expect(@fabs(@as(T, -0.0)) == 0.0); | |
| 1689 | try expect(@fabs(math.floatTrueMin(T)) == math.floatTrueMin(T)); | |
| 1690 | try expect(@fabs(-math.floatTrueMin(T)) == math.floatTrueMin(T)); | |
| 1691 | ||
| 1692 | // non-finite numbers | |
| 1693 | try expect(math.isPositiveInf(@fabs(math.inf(T)))); | |
| 1694 | try expect(math.isPositiveInf(@fabs(-math.inf(T)))); | |
| 1695 | try expect(math.isNan(@fabs(math.nan(T)))); | |
| 1696 | } | |
| 1697 | } | |
| 1698 | ||
| 1699 | 1468 | test "absFloat" { |
| 1700 | 1469 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1701 | 1470 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
test/behavior/muladd.zig+7| ... | ... | @@ -70,6 +70,13 @@ test "@mulAdd f128" { |
| 70 | 70 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 71 | 71 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 72 | 72 | |
| 73 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 74 | builtin.zig_backend == .stage2_c) | |
| 75 | { | |
| 76 | // https://github.com/ziglang/zig/issues/13876 | |
| 77 | return error.SkipZigTest; | |
| 78 | } | |
| 79 | ||
| 73 | 80 | comptime try testMulAdd128(); |
| 74 | 81 | try testMulAdd128(); |
| 75 | 82 | } |
test/behavior/widening.zig+14| ... | ... | @@ -44,6 +44,13 @@ test "float widening" { |
| 44 | 44 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 45 | 45 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 46 | 46 | |
| 47 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 48 | builtin.zig_backend == .stage2_c) | |
| 49 | { | |
| 50 | // https://github.com/ziglang/zig/issues/13876 | |
| 51 | return error.SkipZigTest; | |
| 52 | } | |
| 53 | ||
| 47 | 54 | var a: f16 = 12.34; |
| 48 | 55 | var b: f32 = a; |
| 49 | 56 | var c: f64 = b; |
| ... | ... | @@ -64,6 +71,13 @@ test "float widening f16 to f128" { |
| 64 | 71 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 65 | 72 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 66 | 73 | |
| 74 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and | |
| 75 | builtin.zig_backend == .stage2_c) | |
| 76 | { | |
| 77 | // https://github.com/ziglang/zig/issues/13876 | |
| 78 | return error.SkipZigTest; | |
| 79 | } | |
| 80 | ||
| 67 | 81 | var x: f16 = 12.34; |
| 68 | 82 | var y: f128 = x; |
| 69 | 83 | try expect(x == y); |
test/standalone.zig+4-2| ... | ... | @@ -31,7 +31,8 @@ pub fn addCases(cases: *tests.StandaloneContext) void { |
| 31 | 31 | cases.addBuildFile("test/standalone/shared_library/build.zig", .{}); |
| 32 | 32 | cases.addBuildFile("test/standalone/mix_o_files/build.zig", .{}); |
| 33 | 33 | cases.addBuildFile("test/standalone/mix_c_files/build.zig", .{ |
| 34 | .build_modes = true, | |
| 34 | // https://github.com/ziglang/zig/issues/13738 | |
| 35 | .build_modes = !(builtin.os.tag == .windows and builtin.cpu.arch == .aarch64), | |
| 35 | 36 | .cross_targets = true, |
| 36 | 37 | }); |
| 37 | 38 | cases.addBuildFile("test/standalone/global_linkage/build.zig", .{}); |
| ... | ... | @@ -64,7 +65,8 @@ pub fn addCases(cases: *tests.StandaloneContext) void { |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | cases.addBuildFile("test/standalone/c_compiler/build.zig", .{ |
| 67 | .build_modes = true, | |
| 68 | // https://github.com/ziglang/zig/issues/13738 | |
| 69 | .build_modes = !(builtin.os.tag == .windows and builtin.cpu.arch == .aarch64), | |
| 68 | 70 | .cross_targets = true, |
| 69 | 71 | }); |
| 70 | 72 |