157 Commits

Author SHA1 Message Date
Jacob Young
8f6da78fb1 CBE: implement vector element pointers 2023-03-05 02:59:02 -05:00
Jacob Young
c478c7609e CBE: implement vector operations
Also, bigint add and sub which is all I was actually trying to do.
2023-03-05 02:59:02 -05:00
Jacob Young
a8f4ac2b94 CBE: implement big integer and vector comparisons 2023-03-05 02:59:01 -05:00
Jacob Young
1453a595aa CBE: reuse locals with the same CType instead of Type
Many `Type`s can correspond to the same `CType`, so this reduces the
number of used locals by 27760 when compiling only-c.

Also, disabled some tests that were only passing by accident and
shouldn't really be considered working.
2023-02-24 23:41:54 -05:00
Jacob Young
434c6f42ca behavior: enable passing CBE tests 2023-02-21 09:43:23 -05:00
Andrew Kelley
f0530385b5 update existing behavior tests and std lib to new for loop semantics 2023-02-18 19:17:21 -07:00
Veikka Tuominen
5f5ab49168 Value: implement compareAllWithZero for bytes and str_lit
Closes #10692
2023-01-22 00:12:37 +02:00
Andrew Kelley
5ca1753ff1 Revert "aarch64: reenable tests that are no longer regressed"
This reverts commit 3370d58956ecc744a004dff47b0437473f0ef7da.

This commit was done with an LLVM build that did not have assertions
enabled. There are LLVM assertions being triggered due to this commit.

Reopens #10627
Reopens #12013
Reopens #12027
2022-12-27 20:54:27 -07:00
Veikka Tuominen
a777373bb8 enable test on more targets
This was fixed by 8a0a6b7387fcd0017db85de14793abfd6ec7f6e5 for targets
without avx512
2022-12-27 15:34:19 +02:00
Veikka Tuominen
622311fb9a update uses of overflow arithmetic builtins 2022-12-27 15:13:14 +02:00
Veikka Tuominen
81443fcde8 Sema: add error for recursive inline call
Closes #12973
2022-12-26 16:36:30 +02:00
Veikka Tuominen
3535c4b3b6 Sema: fix elem ptr type of vector in slice
Closes #14071
2022-12-26 15:26:27 +02:00
Veikka Tuominen
8a0a6b7387 port packed vector elem ptr logic from stage1
Closes #12812
Closes #13925
2022-12-15 21:06:35 -05:00
Luuk de Gram
37561a920b
wasm: enable passing vector tests 2022-12-12 17:42:09 +01:00
Andrew Kelley
cffbb32d31
Merge pull request #13872 from koachan/sparc64-codegen
stage2: sparc64: Some Air lowerings + skip unbuildable tests
2022-12-10 15:10:21 -05:00
Koakuma
f9e9ba784f stage2: sparc64: Skip unimplemented tests 2022-12-10 21:51:46 +07:00
r00ster91
3370d58956 aarch64: reenable tests that are no longer regressed
Closes #12013
Closes #10627
Closes #12027
2022-12-10 12:34:34 +01:00
Andrew Kelley
c8aba15c22 remove references to stage1 in behavior tests
Good riddance.
2022-12-06 19:06:48 -07:00
Andrew Kelley
518392d6fe disable CBE behavior tests that are not passing in release modes 2022-12-04 15:57:40 -07:00
Jacob Young
fdedd62365 cbe: use memcpy for underaligned loads and stores 2022-12-02 22:21:24 -05:00
Veikka Tuominen
72fa8d4880 Sema: fix overflow arithmetic with runtime vectors
It should return a a vector of bools for compatibility with scalar
operands and stage1 until #10248 can be implemented.

Closes #13201
2022-11-26 18:05:27 +02:00
Andrew Kelley
4ec27a4e25 C backend: implement vector reduce and overflow intrinsics 2022-11-22 23:33:58 -07:00
Veikka Tuominen
40a2dfc12a Sema: coerce array operands to shuffle
Closes #13494
2022-11-11 18:00:05 +02:00
Cody Tapscott
fbda15632d stage2 sema: Make vector constants when operating on vectors
Resolves https://github.com/ziglang/zig/issues/13058
2022-11-10 12:22:40 -07:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Jacob Young
48a2783969 cbe: implement optional slice representation change 2022-10-29 05:58:41 -04:00
Veikka Tuominen
d03c47bf85 Sema: use runtime_value instead of creating allocs 2022-10-27 21:08:25 -04:00
Jacob Young
6a4266d62a cbe: fix infinite recursion on recursive types 2022-10-25 05:11:28 -04:00
Cody Tapscott
f035437b5d Re-enable Vector f16 tests on Windows
Closes #4952
2022-10-13 12:53:20 -07:00
Andrew Kelley
01e89fec71 disable LLVM 15 regressed behavior test: "vector @splat"
See #12827
2022-09-12 16:02:31 -07:00
Andrew Kelley
9043e665a5 add behavior test for copying array of vectors
closes #12026
2022-08-22 18:37:42 -07:00
Andrew Kelley
4d7f5a1917 stage2: fix crash with comptime vector reduce 2022-08-10 16:45:29 -07:00
Cody Tapscott
d182e2ebda stage1: Lower libcalls on Windows x86-64 correctly
This change is the Zig counterpart to https://reviews.llvm.org/D110413

Since we lower some libcalls directly (just like clang does), we need to
make sure that the ABI we call with matches the ABI of the compiler-rt
we are providing (and also the ABI expected by LLVM).

While I was at it, I noticed some flawed vector handling in the binary
soft float ops in stage 1, so I shored up the logic a bit and expanded
an existing test to cover the missing functionality.
2022-07-10 20:52:28 -07:00
Andrew Kelley
558ad19095 disable regressed behavior tests from llvm 14
See #12012
See #12013
2022-07-05 18:50:03 -07:00
Andrew Kelley
b698168664 stage2: update vector alignment logic
This follows LLVM14's lead on vector alignment, which computes byte
count based on the length premultiplied by bits.

This commit also disables behavior tests regressed by LLVM 14, only for
stage1. stage2 fortunately does not trip the regression.
2022-07-03 13:33:09 -07:00
Andrew Kelley
095e24e537 stage2: implement alignment calculation of vectors
closes #11856
2022-06-30 19:39:41 -07:00
Xavier Bouchoux
b66247c97a stage2: coerce tuple to vector 2022-06-17 19:06:17 +03:00
William Sengir
bb3532e775 stage2: add more vector overflow tests 2022-05-16 13:55:26 -07:00
William Sengir
21be3d9166 stage2: add vectorized overflow arithmetic behavior tests 2022-05-16 13:55:26 -07:00
Koakuma
fb0692334e target: Rename sparcv9 -> sparc64
Rename all references of sparcv9 to sparc64, to make Zig align more with
other projects. Also, added new function to convert glibc arch name to Zig
arch name, since it refers to the architecture as sparcv9.

This is based on the suggestion by @kubkon in PR 11847.
(https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-05-13 16:43:59 -04:00
viri
e46c612503
use math/float.zig everywhere 2022-04-07 05:04:38 -06:00
Andrew Kelley
b6ccde47ad Sema: allow mixing array and vector operands
* Added peer type resolution for arrays and vectors: the vector type is
   selected.
 * Fixed passing the lhs type or rhs type instead of the peer resolved
   type when calling Value methods during analyzeArithmetic handling of
   comptime expressions.
 * `checkVectorizableBinaryOperands` now allows mixing vectors and
   arrays, as long as one of the operands is a vector.

This matches stage1's handling of `^=` but apparently stage1 is
inconsistent and does not handle e.g. `*=`. stage2 now will always allow
mixing vector and array operands for all operations.
2022-03-28 14:17:05 -07:00
Andrew Kelley
7eddef423d behavior tests: alter test coverage for vectors
* Use `@Vector` syntax instead of `std.meta.Vector`.
 * Use `var` instead of `const` for tests so that we get runtime
   coverage instead of only comptime coverage. Comptime coverage is done
   with `comptime doTheTest()` calls.
2022-03-21 17:03:24 -07:00
William Sengir
c9598c4cd3 behavior tests: enable all vector tests for the stage2 LLVM backend 2022-03-21 16:54:19 -07:00
William Sengir
cda8f65489 behavior tests: use expect instead of expectEqual in vector.zig 2022-03-21 16:54:19 -07:00
Andrew Kelley
7233a3324a stage2: implement @reduce
Notably, Value.eql and Value.hash are improved to treat NaN as equal to
itself, so that Type/Value can be hash map keys. Likewise float hashing
normalizes the float value before computing the hash.
2022-03-17 17:24:35 -07:00
Andrew Kelley
87779cfd93 stage2: prevent UB in the LLVM backend
* Sema: fix `zirTypeInfo` allocating with the wrong arenas for some
   stuff.
 * LLVM: split `airDbgInline` into two functions, one for each AIR tag.
   - remove the redundant copy to type_map_arena. This is the first
     thing that lowerDebugType does so this hack was probably just
     accidentally avoiding UB (which is still present prior to this
     commit).
   - don't store an inline fn inst into the di_map for the generic
     decl.
   - use a dummy function type for the debug info to avoid whatever UB
     is happening.
   - we are now ignoring the function type passed in with the
     dbg_inline_begin and dbg_inline_end.
 * behavior tests: prepare the vector tests to be enabled one at a time.

Mitigates #11199.
2022-03-17 00:00:41 -07:00
Andrew Kelley
6115cf2240 migrate from std.Target.current to @import("builtin").target
closes #9388
closes #9321
2021-10-04 23:48:55 -07:00
Andrew Kelley
ac2333ee63 stage2: fix Type max/min int calculation
This was an attempt to move saturating_arithmetic.zig to the "passing
for stage2" section, which did not pan out due to the discovery of 2
prerequisite items that need to be done, but I did make a bug fix along
the way of the calculation of max/min integers.

This commit also simplifies the saturating arithmetic behavior tests to
depend on less of the zig language that is not related to saturating
arithmetic.
2021-10-04 12:23:49 -07:00
Josh Soref
664941bf14
Spelling corrections (#9833)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-09-24 13:39:20 -04:00