aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/x86_64/math.zig
AgeCommit message (Collapse)Author
2025-11-22all: replace all `@Type` usagesAli Cheraghi
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-06-19x86_64: increase passing test coverage on windowsJacob Young
Now that codegen has no references to linker state this is much easier. Closes #24153
2025-06-05std.Target: Introduce Cpu convenience functions for feature tests.Alex Rønne Petersen
Before: * std.Target.arm.featureSetHas(target.cpu.features, .has_v7) * std.Target.x86.featureSetHasAny(target.cpu.features, .{ .sse, .avx, .cmov }) * std.Target.wasm.featureSetHasAll(target.cpu.features, .{ .atomics, .bulk_memory }) After: * target.cpu.has(.arm, .has_v7) * target.cpu.hasAny(.x86, &.{ .sse, .avx, .cmov }) * target.cpu.hasAll(.wasm, &.{ .atomics, .bulk_memory })
2025-05-31Legalize: implement scalarization of binary operationsJacob Young
2025-05-28x86_64: implement optimized float `@reduce(.Mul)`Jacob Young
2025-04-09x86_64: rewrite scalar `@addWithOverflow`Jacob Young
2025-03-21x86_64: rewrite scalar shiftsJacob Young
2025-03-21behavior: split up x86_64 math testsJacob Young
2025-03-21x86_64: rewrite wrapping multiplicationJacob Young
2025-03-16Sema: rewrite comptime arithmeticmlugg
This commit reworks how Sema handles arithmetic on comptime-known values, fixing many bugs in the process. The general pattern is that arithmetic on comptime-known values is now handled by the new namespace `Sema.arith`. Functions handling comptime arithmetic no longer live on `Value`; this is because some of them can emit compile errors, so some *can't* go on `Value`. Only semantic analysis should really be doing arithmetic on `Value`s anyway, so it makes sense for it to integrate more tightly with `Sema`. This commit also implements more coherent rules surrounding how `undefined` interacts with comptime and mixed-comptime-runtime arithmetic. The rules are as follows. * If an operation cannot trigger Illegal Behavior, and any operand is `undefined`, the result is `undefined`. This includes operations like `0 *| undef`, where the LHS logically *could* be used to determine a defined result. This is partly to simplify the language, but mostly to permit codegen backends to represent `undefined` values as completely invalid states. * If an operation *can* trigger Illegal Behvaior, and any operand is `undefined`, then Illegal Behavior results. This occurs even if the operand in question isn't the one that "decides" illegal behavior; for instance, `undef / 1` is undefined. This is for the same reasons as described above. * An operation which would trigger Illegal Behavior, when evaluated at comptime, instead triggers a compile error. Additionally, if one operand is comptime-known undef, such that the other (runtime-known) operand isn't needed to determine that Illegal Behavior would occur, the compile error is triggered. * The only situation in which an operation with one comptime-known operand has a comptime-known result is if that operand is undefined, in which case the result is either undefined or a compile error per the above rules. This could potentially be loosened in future (for instance, `0 * rt` could be comptime-known 0 with a runtime assertion that `rt` is not undefined), but at least for now, defining it more conservatively simplifies the language and allows us to easily change this in future if desired. This commit fixes many bugs regarding the handling of `undefined`, particularly in vectors. Along with a collection of smaller tests, two very large test cases are added to check arithmetic on `undefined`. The operations which have been rewritten in this PR are: * `+`, `+%`, `+|`, `@addWithOverflow` * `-`, `-%`, `-|`, `@subWithOverflow` * `*`, `*%`, `*|`, `@mulWithOverflow` * `/`, `@divFloor`, `@divTrunc`, `@divExact` * `%`, `@rem`, `@mod` Other arithmetic operations are currently unchanged. Resolves: #22743 Resolves: #22745 Resolves: #22748 Resolves: #22749 Resolves: #22914
2025-03-01x86_64: rewrite wrapping add/subJacob Young
2025-02-22x86_64: rewrite scalar `@bitReverse`Jacob Young
2025-02-18x86_64: rewrite scalar `@popCount`Jacob Young
2025-02-18x86_64: rewrite scalar `@ctz`Jacob Young
2025-02-17x86_64: rewrite scalar `@byteSwap`Jacob Young
2025-02-17x86_64: rewrite unsafe int vector multiplicationJacob Young
2025-02-15x86_64: rewrite unsafe scalar int multiplicationJacob Young
2025-02-15x86_64: rewrite scalar and vector int `@rem`Jacob Young
2025-02-15x86_64: rewrite scalar and vector int `@divTrunc`Jacob Young
2025-02-15x86_64: implement unsafe scalar and vector integer add/subJacob Young
2025-02-12x86_64: implement conversions between float and int vectorsJacob Young
2025-02-09x86_64: implement conversions between scalar floats and intsJacob Young
Closes #22797
2025-02-06x86_64: rewrite float `@mod`Jacob Young
2025-02-06x86_64: avoid comparing different transcendental function implsJacob Young
2025-02-06x86_64: rewrite most of the remaining float opsJacob Young
2025-02-06x86_64: rewrite vector `@truncate`Jacob Young
2025-02-06x86_64: rewrite scalar `@truncate`Jacob Young
2025-01-31x86_64: rewrite vector `@intCast`Jacob Young
2025-01-31x86_64: rewrite scalar `@intCast`Jacob Young
2025-01-31x86_64: rewrite float vector conversionsJacob Young
2025-01-31x86_64: rewrite scalar float conversionsJacob Young
2025-01-29x86_64: rewrite comparisonsJacob Young
2025-01-26x86_64: rewrite `@min`/`@max` for float vectorsJacob Young
2025-01-26x86_64: rewrite `@min`/`@max` for scalar floatsJacob Young
2025-01-24x86_64: rewrite scalar and vector int `@min` and `@max`Jacob Young
2025-01-24x86_64: rewrite float vector `@abs` and equality comparisonsJacob Young
2025-01-24x86_64: rewrite scalar float equality comparisonsJacob Young
2025-01-21x86_64: rewrite `@abs` for scalar floatsJacob Young
2025-01-20x86_64: rewrite `@abs`Jacob Young
2025-01-16x86_64: fix crashes compiling the compiler and testsJacob Young
2025-01-16x86_64: implement clz and notJacob Young
2025-01-16x86_64: demolish the oldJacob Young
2025-01-16x86_64: 2 means betterJacob Young
2025-01-16x86_64: implement fallback for pcmpeqqJacob Young
2025-01-16x86_64: testingJacob Young