aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/if.zig
AgeCommit message (Collapse)Author
2025-07-22aarch64: add new from scratch self-hosted backendJacob Young
2025-06-16rename spirv backend nameAli Cheraghi
`stage2_spirv64` -> `stage2_spirv`
2025-02-24test: skip failing tests with spirv-vulkanAli Cheraghi
2024-07-26riscv: make multi-threaded enabled compilation the defaultDavid Rubin
2024-07-26riscv: update tests and fix reuse bugDavid Rubin
2024-07-26riscv: implement more operatorsDavid Rubin
we can run `std.debug.print` now, with both run-time strings and integers!
2024-06-13riscv: rewrite "binOp"David Rubin
Reorganize how the binOp and genBinOp functions work. I've spent quite a while here reading exactly through the spec and so many tests are enabled because of several critical issues the old design had. There are some regressions that will take a long time to figure out individually so I will ignore them for now, and pray they get fixed by themselves. When we're closer to 100% passing is when I will start diving into them one-by-one.
2024-06-13riscv: implement optional logicDavid Rubin
2024-05-11riscv: finally fix bug + `airAggregateInit`David Rubin
i just hadn't realized that I placed the `riscv_start` branch in the non-simplified starts
2024-05-11riscv: add stage2_riscv to test matrix and bypass failing testsDavid Rubin
2024-01-06categorize `behavior/bugs/<issueno>.zig` testsVeikka Tuominen
2024-01-02Liveness: fix branch operands becoming aliasedarbrk1
2023-11-19test: update behavior to silence 'var is never mutated' errorsmlugg
2023-10-15spirv: update failing / passing testsRobin Voetter
Some tests are now failing due to debug info changes, some tests now pass due to improved compiler functionality.
2023-06-27behavior: if-@as-if chainr00ster91
Closes #8952
2023-06-13all: replace `comptime try` with `try comptime`Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-05-20spirv: more passing testsRobin Voetter
2023-05-11setup spirv backend in behavior testsAli Chraghi
2023-04-02Sema: defer stores to inferred allocsJacob Young
This lets us generate the store with knowledge of the type to be stored. Therefore, we can avoid generating garbage Air with stores through pointers to comptime-only types which backends cannot lower. Closes #13410 Closes #15122
2023-03-24x86_64: canonicalize each br of a blockJacob Young
2023-03-24x86_64: fix more value tracking bugsJacob Young
2023-03-24x86_64: fix value tracking bugsJacob Young
2023-03-21x86_64: (re)implement optional opsJacob Young
Note that this commit also changes the layout of optional for all other backends using `src/codegen.zig` without updating them!
2023-03-15behavior: enable passing behavior tests on stage2_x86_64Jacob Young
2022-12-29stage2 AArch64: implement errUnion{Err,Payload} for registersjoachimschmidt557
2022-12-27stage2 AArch64: unify callee-preserved regs on all targetsjoachimschmidt557
also enables many passing behavior tests
2022-12-10stage2: sparc64: Skip unimplemented testsKoakuma
2022-11-30Sema: make inferred allocs always mutableVeikka Tuominen
Const allocs don't make any sense, make_ptr_const handles making the pointers not mutable.
2022-11-02cbe: hack around invalid AirJacob Young
Can be changed to `!inst_ty.hisRuntimeBitsIgnoreComptime()` when the "result location with inferred type ends up being pointer to comptime_int" test stops producing Air containing a `bitcast(*comptime_int, ...)`. See #13410
2022-07-14Sema: fix coerceResultPtrAndrew Kelley
It did not handle properly when the dummy operand was a comptime_int; it was crashing in coerce because comptime_int is supposed to be comptime-known. So when calling coerceResultPtr, we pass the actual operand, not a dummy operand, which means it will have the proper comptime value when necessary.
2022-07-14Sema: fix coerce_result_ptr in case of inferred result typeAndrew Kelley
Previously, the logic for analyzing coerce_result_ptr would generate invalid bitcast instructions which did not include coercion logic, such as optional wrapping, resulting in miscompilations. Now, the logic of resolve_inferred_alloc goes back over all the placeholders inserted by coerce_result_ptr, and replaces them with logic doing the proper coercions. Closes #12045
2022-06-28Revert "AstGen: preserve inferred ptr result loc for breaks"Andrew Kelley
This reverts commit 8bf3e1f8d0902abd4133e2729b3625c25011c3ff, which introduced miscompilations for peer expressions any time they needed coercions to runtime types. I opened #11957 as a proposal to accomplish the goal of the reverted commit. Closes #11898
2022-06-25stage2 ARM: implement basic intCast and error union wrappingjoachimschmidt557
2022-03-05stage2 AArch64: add more slice supportjoachimschmidt557
* airSlice * airArrayToSlice * and initial support for airSlicePtr and co
2022-03-01LLVM: add extra padding to structs and tuples sometimesAndrew Kelley
* Sema: resolve type fully when emitting an alloc AIR instruction to avoid tripping assertion for checking struct field alignment. * LLVM backend: keep a reference to the LLVM target data alive during lowering so that we can ask LLVM what it thinks the ABI alignment and size of LLVM types are. We need this in order to lower tuples and structs so that we can put in extra padding bytes when Zig disagrees with LLVM about the size or alignment of something. * LLVM backend: make the LLVM struct type packed that contains the most aligned union field and the padding. This prevents the struct from being too big according to LLVM. In the future, we may want to consider instead emitting unions in a "flat" manner; putting the tag, most aligned union field, and padding all in the same struct field space. * LLVM backend: make structs with 2 or fewer fields return isByRef=false. This results in more efficient codegen. This required lowering of bitcast to sometimes store the struct into an alloca, ptrcast, and then load because LLVM does not allow bitcasting structs. * enable more passing behavior tests.
2022-02-28x64: pass more behavior testsJakub Konka
2022-02-27stage2 ARM: implement slice and array_to_slicejoachimschmidt557
2022-02-27stage2 ARM: enable more behavior testsjoachimschmidt557
2022-02-22Port more behavior testsJakub Konka
2022-01-26organize behavior testsAndrew Kelley
Every test that is moved in this commit has been checked to see if it is now passing.
2021-10-28C backend: fix crash when number of Decls passes a thresholdAndrew Kelley
The ensureUnusedCapacity did not reserve a big enough number. I changed it to no longer guess the capacity because I saw that the number of possible items was not determinable ahead of time and this can therefore avoid allocating more memory than necessary.
2021-10-28C backend: fix ptrtoint and wrap_errunion_errAndrew Kelley
2021-10-02AstGen: fix `while` and `for` with unreachable bodiesAndrew Kelley
Companion commit to 61a53a587558ff1fe1b0ec98bb424022885edccf. This commit also moves over a bunch of behavior test cases to the passing-for-stage2 section.
2021-10-02AstGen: fix if, orelse, catch, with unreachable bodiesAndrew Kelley
Before, the system to replace a result location pointer with a traditional break instruction did not notice the case when one of the bodies was unreachable. Now, the emitted ZIR code is improved and simplified in this case, resulting in a new passing behavior test.
2021-08-07stage2: pass some error union testsAndrew Kelley
* Value: rename `error_union` to `eu_payload` and clarify the intended usage in the doc comments. The way error unions is represented with Value is fixed to not have ambiguous values. * Fix codegen for error union constants in all the backends. * Implement the AIR instructions having to do with error unions in the LLVM backend.
2021-06-21fix code broken from previous commitJacob G-W
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-04-29move behavior tests from test/stage1/ to test/Andrew Kelley
And fix test cases to make them pass. This is in preparation for starting to pass behavior tests with self-hosted.