7150 Commits

Author SHA1 Message Date
LemonBoy
75ec7e4e00 Fix generation of tail fields for packed struct 2019-09-21 11:39:43 +02:00
Andrew Kelley
3377044ebe
Merge pull request #3183 from LemonBoy/fix-3128
Don't forget to resolve the pointee type
2019-09-20 18:01:42 -04:00
Andrew Kelley
257fded70c
avoid setting tail for @panic
Currently, slices are passed via reference, even though it would be
better to pass the ptr and len as separate arguments (#561). This means
that any function call with a slice parameter cannot be a tail call,
because according to LLVM spec:

> Both [tail,musttail] markers imply that the callee does not access
> allocas from the caller

There was one other place we were setting `tail` and I made that
conditional on whether or not the argument referenced allocas in the
caller.

This was causing undefined behavior in the compiler when it hit asserts,
causing it to print garbage memory to the terminal. See #3262 for
example.
2019-09-20 17:48:24 -04:00
Andrew Kelley
f663bcd6b2
add more RISCV64 linux bits to std lib 2019-09-20 15:24:50 -04:00
Andrew Kelley
ea776c287b
Merge branch 'daurnimator-linux-5.3'
closes #3266
2019-09-20 15:10:25 -04:00
Andrew Kelley
aab1ec5c43
fix typo 2019-09-20 15:02:47 -04:00
daurnimator
2a8facafde
std: update for linux 5.3 2019-09-20 15:01:47 -04:00
daurnimator
edea0d431b
std: update riscv64 syscalls 2019-09-20 15:01:47 -04:00
Sahnvour
74d0b5bf7c reject types of automatic container layout in packed unions 2019-09-20 13:25:32 -04:00
Andrew Kelley
c9a5a6b83a
add test case for already fixed bug
closes #3046
2019-09-20 13:19:29 -04:00
Timon Kruiper
3b4a6679a6 Fix comptime bitcast inside an expression 2019-09-20 13:13:26 -04:00
Andrew Kelley
695695c852
update README
Also I verified that muldi3 has not changed since the previous ported
reference commit.
2019-09-20 12:58:00 -04:00
Andrew Kelley
ee200aaa8c
fix typo in docs
closes #3267
2019-09-20 11:48:35 -04:00
Michael Dusan
d60f9d0d4b stage1: fix gcc 9.1.0 compiler error on archlinux 2019-09-19 23:30:48 -04:00
Andrew Kelley
e81156b873
Merge pull request #3260 from ziglang/llvm9
LLVM 9
2019-09-19 21:12:57 -04:00
Andrew Kelley
b76d16c7c7
update remaining llvm 8.0.0 references to 9.0.0 2019-09-19 20:55:02 -04:00
Andrew Kelley
14d2e16b60
macos ci: RISCV is no longer experimental 2019-09-19 18:32:40 -04:00
Andrew Kelley
00cd988438
update CI scripts llvm 8 to 9 2019-09-19 17:04:27 -04:00
Andrew Kelley
8a30edcde8
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-19 17:02:32 -04:00
stratact
925ffbce7f Disable Channel, Future, and Lock tests for FreeBSD (#3253)
* Disable Channel, Future, and Lock tests for FreeBSD
2019-09-19 13:45:54 -04:00
Andrew Kelley
ef3f7ecc19
update std.zig.tokenizer 2019-09-19 13:07:30 -04:00
Andrew Kelley
cd3068b4eb
Merge pull request #3017 from fengb/tokenize-cleaner-errors
Update stage2 parser errors to match compiler friendliness
2019-09-19 12:36:07 -04:00
daurnimator
3b297f58f7 src: use zig_panic rather than having LLVM abort 2019-09-19 11:51:39 -04:00
Shawn Landden
ff9f3275de docs: clarify @clz and @ctz terminology to not be endian-specific.
This was brought up in IRC a few days ago.
2019-09-19 11:47:02 -04:00
Shawn Landden
c9937f4a2b Allow Zig programs to implement their own startup (_start) for ELF executables.
/home/shawn/git/zig-simd/build/lib/zig/std/special/start.zig:23:40: error: exported symbol collision: '_start'
        @export("_start", _start, .Strong);
        ^
/home/shawn/git/zig-simd/build/d.zig:1:1: note: other symbol is here
pub export fn _start() void {
^
/home/shawn/git/zig-simd/build/lib/zig/std/special/start.zig:124:35: error: root source file has no member called 'main'
    switch (@typeInfo(@typeOf(root.main).ReturnType)) {
2019-09-19 11:43:00 -04:00
ScorrMorr
7ebb7ca580 pass param as ref in ZigList::append 2019-09-19 11:41:18 -04:00
Andrew Kelley
1eb33966b1
Merge branch 'merge-shawnl-simd5'
This is the commit from Shawn's SIMD patchset regarding `@splat`,
plus my fixups.
2019-09-19 11:15:07 -04:00
Andrew Kelley
28c7fe60b6
add docs for @splat 2019-09-19 11:14:42 -04:00
Andrew Kelley
005a54a853
fixups for @splat
* Fix codegen for splat - instead of giving vectors of length N
   to shufflevector for both of the operands, it gives vectors of length
   1. The mask vector is the only one that needs N elements.
 * Separate Splat into SplatSrc and SplatGen; the `len` is not needed
   once it gets to codegen since it is redundant with the result type.
 * Refactor compile error for wrong vector element type so that the
   compile error message is not duplicated in zig source code
 * Improve implementation to correctly handle comptime values such as
   undefined and lazy values.
 * Improve compile error for bad vector element type to point to the
   correct place.
 * Delete dead code.
 * Modify behavior test to use an array cast instead of vector element
   indexing since I'm merging this splat commit out-of-order from
   Shawn's patch set.
2019-09-19 10:58:12 -04:00
Shawn Landden
01577a3af4
@splat 2019-09-19 10:11:06 -04:00
Andrew Kelley
0048bcbd71
Merge branch 'merge-shawnl-simd5'
This is the commit from Shawn's SIMD patchset regarding `@byteSwap`,
plus my fixups.
2019-09-19 01:05:12 -04:00
Andrew Kelley
380c8ec2c9
implement runtime @byteSwap and other fixups
* update docs for `@byteSwap`.
 * fix hash & eql functions for ZigLLVMFnIdBswap not updated to
   include vector len. this was causing incorrect bswap function
   being called in unrelated code
 * fix `@byteSwap` behavior tests only testing comptime and not
   runtime operations
 * implement runtime `@byteSwap`
 * fix incorrect logic in ir_render_vector_to_array and
   ir_render_array_to_vector with regards to whether or not to bitcast
 * `@byteSwap` accepts an array operand which it will cast to vector
 * simplify `@byteSwap` semantic analysis code and various fixes
2019-09-19 00:59:04 -04:00
Shawn Landden
76f5396077
@byteSwap on vectors 2019-09-18 16:49:14 -04:00
Andrew Kelley
86209e1a92
Merge branch 'merge-shawnl-simd5'
This is the first 3 commits of #2945, plus my fixups.
2019-09-18 16:35:57 -04:00
Andrew Kelley
ef0f3ba905
relax std.auto_hash requirements regarding vectors
Previously, auto hash tests required vectors of different types to not
hash to the same value. Now, this is allowed.
2019-09-18 16:34:36 -04:00
Andrew Kelley
2038f4d45a
rework the implementation
* update documentation
   - move `@shuffle` to be sorted alphabetically
   - remove mention of LLVM
   - minor clarifications & rewording
 * introduce ir_resolve_vector_elem_type to avoid duplicate compile
   error message and duplicate vector element checking logic
 * rework ir_analyze_shuffle_vector to solve various issues
 * improve `@shuffle` to allow implicit cast of arrays
 * the shuffle tests weren't being run
2019-09-18 16:15:19 -04:00
Shawn Landden
193604c837
stage1: add @shuffle() shufflevector support
I change the semantics of the mask operand, to make it a little more
flexible. There is no real danger in this because it is a compile-error
if you do it the LLVM way (and there is an appropiate error to tell you
this).

v2: avoid problems with double-free
2019-09-18 11:26:45 -04:00
Andrew Kelley
9e4065fa73
remove TODO regarding lazy values
The question was:

> // TODO do we need lazy values on vector comparisons?

Nope, in fact the existing code already was returning ErrorNotLazy
for that particular type, and would already goto
never_mind_just_calculate_it_normally. So the explicit check for
ZigTypeIdVector is not needed. I appreciate the caution though.
2019-09-18 10:54:45 -04:00
Shawn Landden
74ce5e9e13
stage1: proper return type on vector comparisons 2019-09-18 10:36:10 -04:00
Andrew Kelley
558b4ac1f0
adjust codegen of casting between arrays and vectors
* bitcasting is still better when the size_in_bits aligns with the ABI
   size of the element type. Logic is reworked to do bitcasting when
   possible
 * rather than using insertelement/extractelement to work with arrays,
   store/load elements directly. This matches codegen for arrays
   elsewhere.
2019-09-18 10:24:28 -04:00
Shawn Landden
0e3ca4c63e
Fix array->vector and vector->array for many types. Allow vector of bool.
Vectors do not have the same packing as arrays, and just bitcasting
is not the correct way to convert them.
2019-09-18 09:52:58 -04:00
Andrew Kelley
914ad1ec2e
fix peer result location with typed parent, ...
...runtime condition, comptime prongs.

closes #3244
2019-09-17 22:30:49 -04:00
Andrew Kelley
c6e77f248d
fix tripping llvm assert
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```

We've had this problem and solved it before; see #579.
2019-09-16 14:31:41 -04:00
Andrew Kelley
1cefe14424
update clone on arm32 to latest musl implementation
See musl commit 05870abeaac0588fb9115cfd11f96880a0af2108
by Rich Felker.

Commit message from musl reproduced here:

fix code path where child function returns in arm __clone built as thumb

mov lr,pc is not a valid way to save the return address in thumb mode
since it omits the thumb bit. use a chain of bl and bx to emulate blx.
this could be avoided by converting to a .S file with preprocessor
conditions to use blx if available, but the time cost here is
dominated by the syscall anyway.

while making this change, also remove the remnants of support for
pre-bx ISA levels. commit 9f290a49bf9ee247d540d3c83875288a7991699c
removed the hack from the parent code paths, but left the unnecessary
code in the child. keeping it would require rewriting two code paths
rather than one, and is useless for reasons described in that commit.
2019-09-16 14:23:43 -04:00
Andrew Kelley
5e34fb3597
fix tripping llvm assert
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```

We've had this problem and solved it before; see #579.
2019-09-16 14:02:00 -04:00
Jay Weisskopf
cddd6b46d8 Fix typos: "seperate" to "separate"
Fixes #3236
2019-09-15 23:39:36 -04:00
Tetralux
537b260349
Add FixedBufferAllocator.reset 2019-09-16 02:40:14 +00:00
Andrew Kelley
c4416b224d
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-15 20:59:53 -04:00
Andrew Kelley
8223aca09b
no-stack-arg-probe only for UEFI 2019-09-13 14:46:22 -04:00
Andrew Kelley
2b698888ce
fix regression from incorrect conflict resolution in prev commit
thanks for catching this LemonBoy
2019-09-13 14:42:30 -04:00