Commit Graph

57 Commits

Author SHA1 Message Date
Techatrix ab970094ab wasm: enable successful behavior tests 2023-09-10 15:59:02 +02:00
mlugg 283afb50b5 AstGen: disallow '-0' integer literal
The intent here is ambiguous: this resolves to the comptime_int '0', but
it's likely the user meant to use a floating-point literal.

Resolves: #16890
2023-08-21 11:47:31 +03:00
Lewis Gaul 387b0ac4f1 Make NaNs quiet by default and other NaN tidy-up (#16826)
* Generalise NaN handling and make std.math.nan() give quiet NaNs

* Address uses of std.math.qnan_* and std.math.nan_* consts

* Comment out failing test due to issues with signalling NaN

* Fix issue in c_builtins.zig where we need qnan_u32
2023-08-18 02:07:49 -04:00
Jacob Young 228c956377 std: finish cleanup up asm
This also required implementing the necessary syntax in the x86_64 backend.
2023-07-31 03:49:21 -04:00
antlilja a0ec2266fe Update tests to new splat syntax 2023-07-12 15:35:57 -07:00
r00ster91 2583a39fb6 behavior: test @bitCast of packed struct of bools
This seems to have resolved itself now.
Tested on x86_64 using debug optimize mode.

Closes #9851
2023-07-03 10:59:13 -07:00
mlugg f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Eric Joldasov d884d7050e all: replace comptime try with try comptime
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:46:58 +06:00
Robin Voetter 37aa343079 spirv: more passing tests 2023-05-20 17:30:22 +02:00
Jacob Young 729daed591 x86_64: rewrite casts 2023-05-18 20:42:38 -04:00
Ali Chraghi ccc490ef68 setup spirv backend in behavior tests 2023-05-11 20:31:52 +02:00
Jacob Young 83a208c355 x86_64: implement large cmp 2023-04-02 04:49:53 -04:00
Jacob Young 8f385e77ca x86_64: implement struct_field_val for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young a8f4ac2b94 CBE: implement big integer and vector comparisons 2023-03-05 02:59:01 -05:00
Jacob Young 874ae81f1b CBE: implement big integer literals 2023-03-05 02:59:01 -05:00
Hardy 37fe41792c added test for bitcast signaled nan float
This was fixed by MR #14201

closes #10449
2023-01-20 16:42:24 +02:00
Andrew Kelley ba1e53f116 avoid triggering LLVM bug on MIPS
See #13782
2023-01-05 00:03:59 -07:00
joachimschmidt557 d6e6162081 stage2 AArch64: unify callee-preserved regs on all targets
also enables many passing behavior tests
2022-12-27 21:17:52 +08:00
Jacob Young fc0789f8e7 behavior: disable tests that trigger an llvm 15 bug and assertion
```
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-24 02:23:05 -05:00
Veikka Tuominen 2926d95e6a llvm: handle vectors in packed structs
Closes #13201
2022-12-19 12:19:52 +02:00
r00ster91 aac2d6b56f std.builtin: rename Type.UnionField and Type.StructField's field_type to type 2022-12-17 14:11:33 +01:00
Koakuma f9e9ba784f stage2: sparc64: Skip unimplemented tests 2022-12-10 21:51:46 +07:00
Andrew Kelley c8aba15c22 remove references to stage1 in behavior tests
Good riddance.
2022-12-06 19:06:48 -07:00
Luuk de Gram 090deae41d wasm: enable behavior tests for packed structs 2022-11-30 21:01:09 +01:00
Stevie Hryciw 04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00:00
Jacob Young 48a2783969 cbe: implement optional slice representation change 2022-10-29 05:58:41 -04:00
Cody Tapscott 40b7792a4c Enable bitcast test now that #13214 is resolved. 2022-10-28 12:41:15 -07:00
Cody Tapscott 3295fee911 stage2: Use mem.readPackedInt etc. for packed bitcasts
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-28 08:41:04 -07:00
Jacob Young ab468d57e3 cbe: implement packed structs
Sometimes you have to break a test to make progress :)
2022-10-25 05:11:29 -04:00
Jacob Young 525dcaecba behavior: enable stage2_c tests that are currently passing
Also fix C warnings triggered by these tests.
2022-10-25 05:11:28 -04:00
GethDW edc842ff18 stage2: implement packedStuctToInt for more types 2022-10-18 14:05:48 +03:00
joachimschmidt557 3794f2c493 stage2 ARM: implement struct_field_val for registers 2022-09-09 19:17:18 +02:00
Veikka Tuominen 57f9405a8f Sema: validate bitcast operand type 2022-08-01 23:37:01 +03:00
Omar Alhammadi 69e2cac0d3 stage2: comptime @bitCast packed struct bug fix 2022-06-17 19:04:51 +03:00
joachimschmidt557 ddd5b57045 stage2 AArch64: complete genTypedValue 2022-05-27 16:43:11 -04:00
Andrew Kelley 71e2a56e3e mark some more behavior tests as passing 2022-05-25 00:12:56 -07:00
Andrew Kelley af7e945a7d stage2: fix @sizeOf for structs with comptime fields 2022-05-04 18:45:59 -07:00
Andrew Kelley 259f784241 stage2: improve @sizeOf and @alignOf integers
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-05-04 17:34:16 -07:00
Luuk de Gram 16e88b75ba wasm: Enable passing tests 2022-03-26 21:20:29 +01:00
joachimschmidt557 ca1ffb0951 stage2 ARM: genSetStack for stack_argument_offset 2022-03-16 20:19:58 +01:00
joachimschmidt557 b74cd902c6 stage2 AArch64: enable mul for ints with <= 64 bits 2022-03-13 11:32:08 +01:00
joachimschmidt557 a06e9eca45 stage2 AArch64: add more slice support
* airSlice
* airArrayToSlice
* and initial support for airSlicePtr and co
2022-03-05 11:31:51 +01:00
Jakub Konka cfbc3537ef x64: pass more behavior tests 2022-02-28 23:20:05 +01:00
joachimschmidt557 91fbcf7093 stage2 ARM: enable more behavior tests 2022-02-27 21:38:56 +01:00
Andrew Kelley 6249a24e81 stage2: integer-backed packed structs
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-23 23:59:25 -07:00
Jakub Konka 1bbb886694 Port bitcast.zig tests 2022-02-22 21:56:34 +01:00
Cody Tapscott 45aed7171c Skip 8/16-bit @bitCast test for wasm 2022-02-13 13:28:08 -07:00
Cody Tapscott c586e3ba1b Add additional tests for @bitCast 2022-02-13 13:28:08 -07:00
Cody Tapscott 70d7f87be0 Fix up sign handling and add arbitrary-length integer support to @bitCast() 2022-02-11 08:49:19 -07:00
joachimschmidt557 4468abfc42 stage2 ARM: enable a handful of passing behavior tests 2022-02-06 02:23:31 -05:00