aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bitcast.zig
AgeCommit message (Collapse)Author
2023-05-20spirv: more passing testsRobin Voetter
2023-05-18x86_64: rewrite castsJacob Young
2023-05-11setup spirv backend in behavior testsAli Chraghi
2023-04-02x86_64: implement large cmpJacob Young
2023-03-25x86_64: implement struct_field_val for packed containersJacob Young
2023-03-05CBE: implement big integer and vector comparisonsJacob Young
2023-03-05CBE: implement big integer literalsJacob Young
2023-01-20added test for bitcast signaled nan floatHardy
This was fixed by MR #14201 closes #10449
2023-01-05avoid triggering LLVM bug on MIPSAndrew Kelley
See #13782
2022-12-27stage2 AArch64: unify callee-preserved regs on all targetsjoachimschmidt557
also enables many passing behavior tests
2022-12-24behavior: disable tests that trigger an llvm 15 bug and assertionJacob Young
``` LLVM Emit Object... zig: llvm/include/llvm/ADT/APInt.h:840: void llvm::APInt::lshrInPlace(unsigned int): Assertion `ShiftAmt <= BitWidth && "Invalid shift amount"' failed. Aborted ``` Tracked by #13782
2022-12-19llvm: handle vectors in packed structsVeikka Tuominen
Closes #13201
2022-12-17std.builtin: rename Type.UnionField and Type.StructField's field_type to typer00ster91
2022-12-10stage2: sparc64: Skip unimplemented testsKoakuma
2022-12-06remove references to stage1 in behavior testsAndrew Kelley
Good riddance.
2022-11-30wasm: enable behavior tests for packed structsLuuk de Gram
2022-11-18run zig fmt on everything checked by CIStevie Hryciw
2022-10-29cbe: implement optional slice representation changeJacob Young
2022-10-28Enable bitcast test now that #13214 is resolved.Cody Tapscott
2022-10-28stage2: Use mem.readPackedInt etc. for packed bitcastsCody Tapscott
Packed memory has a well-defined layout that doesn't require conversion from an integer to read from. Let's use it :-) This change means that for bitcasting to/from a packed value that is N layers deep, we no longer have to create N temporary big-ints and perform N copies. Other miscellaneous improvements: - Adds support for casting to packed enums and vectors - Fixes bitcasting to/from vectors outside of a packed struct - Adds a fast path for bitcasting <= u/i64 - Fixes bug when bitcasting f80 which would clear following fields This also changes the bitcast memory layout of exotic integers on big-endian systems to match what's empirically observed on our targets. Technically, this layout is not guaranteed by LLVM so we should probably ban bitcasts that reveal these padding bits, but for now this is an improvement.
2022-10-25cbe: implement packed structsJacob Young
Sometimes you have to break a test to make progress :)
2022-10-25behavior: enable stage2_c tests that are currently passingJacob Young
Also fix C warnings triggered by these tests.
2022-10-18stage2: implement packedStuctToInt for more typesGethDW
2022-09-09stage2 ARM: implement struct_field_val for registersjoachimschmidt557
2022-08-01Sema: validate bitcast operand typeVeikka Tuominen
2022-06-17stage2: comptime @bitCast packed struct bug fixOmar Alhammadi
2022-05-27stage2 AArch64: complete genTypedValuejoachimschmidt557
2022-05-25mark some more behavior tests as passingAndrew Kelley
2022-05-04stage2: fix `@sizeOf` for structs with comptime fieldsAndrew Kelley
2022-05-04stage2: improve `@sizeOf` and `@alignOf` integersAndrew Kelley
Prior to this commit, the logic for ABI size and ABI alignment for integers was naive and incorrect. This results in wasted hardware as well as undefined behavior in the LLVM backend when we memset an incorrect number of bytes to 0xaa due to disagreeing with LLVM about the ABI size of integers. This commit introduces a "max int align" value which is different per Target. This value is used to derive the ABI size and alignment of all integers. This commit makes an interesting change from stage1, which treats 128-bit integers as 16-bytes aligned for x86_64-linux. stage1 is incorrect. The maximum integer alignment on this system is only 8 bytes. This change breaks the behavior test called "128-bit cmpxchg" because on that target, 128-bit cmpxchg does require a 16-bytes aligned pointer to a 128 bit integer. However, this alignment property does not belong on *all* 128 bit integers - only on the pointer type in the `@cmpxchg` builtin function prototype. The user can then use an alignment override annotation on a 128-bit integer variable or struct field to obtain such a pointer.
2022-03-26wasm: Enable passing testsLuuk de Gram
2022-03-16stage2 ARM: genSetStack for stack_argument_offsetjoachimschmidt557
2022-03-13stage2 AArch64: enable mul for ints with <= 64 bitsjoachimschmidt557
2022-03-05stage2 AArch64: add more slice supportjoachimschmidt557
* airSlice * airArrayToSlice * and initial support for airSlicePtr and co
2022-02-28x64: pass more behavior testsJakub Konka
2022-02-27stage2 ARM: enable more behavior testsjoachimschmidt557
2022-02-23stage2: integer-backed packed structsAndrew Kelley
This implements #10113 for the self-hosted compiler only. It removes the ability to override alignment of packed struct fields, and removes the ability to put pointers and arrays inside packed structs. After this commit, nearly all the behavior tests pass for the stage2 llvm backend that involve packed structs. I didn't implement the compile errors or compile error tests yet. I'm waiting until we have stage2 building itself and then I want to rework the compile error test harness with inspiration from Vexu's arocc test harness. At that point it should be a much nicer dev experience to work on compile errors.
2022-02-22Port bitcast.zig testsJakub Konka
2022-02-13Skip 8/16-bit `@bitCast` test for wasmCody Tapscott
2022-02-13Add additional tests for `@bitCast`Cody Tapscott
2022-02-11Fix up sign handling and add arbitrary-length integer support to @bitCast()Cody Tapscott
2022-02-06stage2 ARM: enable a handful of passing behavior testsjoachimschmidt557
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-26stage2 LLVM backend: fix bitcastAndrew Kelley
Properly handle when the operand type, the result type, or both, are by-ref values.
2021-10-22stage2: change `@bitCast` to always be by-valueAndrew Kelley
After a discussion about language specs, this seems like the best way to go, because it's simpler to reason about both for humans and compilers. The `bitcast_result_ptr` ZIR instruction is no longer needed. This commit also implements writing enums, arrays, and vectors to virtual memory at compile-time. This unlocked some more of compiler-rt being able to build, which in turn unlocks saturating arithmetic behavior tests. There was also a memory leak in the comptime closure system which is now fixed.
2021-10-04stage2: fix comptime `@bitCast`Andrew Kelley
Before, Sema for comptime `@bitCast` would return the same Value but change the Type. This gave invalid results because, for example, an integer Value when the Type is a float would be interpreted numerically, but `@bitCast` needs it to reinterpret how they would be stored in memory. This requires a mechanism to serialize a Value to a byte buffer and deserialize a Value from a byte buffer. Not done yet, but needs to happen: comptime dereferencing a pointer to a Decl needs to perform a comptime bitcast on the loaded value. Currently the value is silently wrong in the same way that `@bitCast` was silently wrong before this commit. The logic in Value for handling readFromMemory for large integers is only correct for small integers. It needs to be fleshed out for proper big integers. As part of this change: * std.math.big.Int: initial implementations of readTwosComplement and writeTwosComplement. They only support bit_count <= 128 so far and panic otherwise. * compiler-rt: move the compareXf2 exports over to the stage2 section. Even with the improvements in this commit, I'm still seeing test failures in the widening behavior tests; more investigation is needed.
2021-06-14add ast-check flag to zig fmt, fix found bugsVeikka Tuominen
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.