`ir_resolve_str()` bug returns array expression even when when sliced
to a lesser length. Fix is to return array if slice.len == array.len,
otherwise return slice.
Bug report use-case is based on one builtin function. However, at least
the following builtins were exposed to the bug:
`@byteOffsetOf`
`@cDefine`
`@cImport`
`@cInclude`
`@cUndef`
`@compileError`
`@embedFile`
`@export`
`@fieldParentPtr`
`@hasDecl`
`@hasField`
`@import`
`@unionInit`
closes#3384
- decls brought in via `usingnamespace` were not always found
because lookup was performed directly against decl_table and
use_decls was never consulted
- fix to use find_container_decl() path instead
- closes#3367
* 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.
* 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
* 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
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
Sometimes the frontend and LLVM would disagree on the ABI alignment of a
packed union. Solve the problem by telling LLVM we're gonna manage the
struct layout by ourselves.
Closes#3184