diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-09-19 00:59:04 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-09-19 00:59:04 -0400 |
| commit | 380c8ec2c95fa8d732c141c705d9940629eb2012 (patch) | |
| tree | 6f4139367553fea653662d1fb65bd23421bad77a /src/analyze.cpp | |
| parent | 76f53960778e84ab49730edb77b85490b07fbea2 (diff) | |
| download | zig-380c8ec2c95fa8d732c141c705d9940629eb2012.tar.gz zig-380c8ec2c95fa8d732c141c705d9940629eb2012.zip | |
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
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index ac70d5646f..66b72b935d 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -6896,7 +6896,8 @@ uint32_t zig_llvm_fn_key_hash(ZigLLVMFnKey x) { return (uint32_t)(x.data.floating.bit_count) * ((uint32_t)x.id + 1025) + (uint32_t)(x.data.floating.vector_len) * (((uint32_t)x.id << 5) + 1025); case ZigLLVMFnIdBswap: - return (uint32_t)(x.data.bswap.bit_count) * (uint32_t)3661994335; + return (uint32_t)(x.data.bswap.bit_count) * ((uint32_t)3661994335) + + (uint32_t)(x.data.bswap.vector_len) * (((uint32_t)x.id << 5) + 1025); case ZigLLVMFnIdBitReverse: return (uint32_t)(x.data.bit_reverse.bit_count) * (uint32_t)2621398431; case ZigLLVMFnIdOverflowArithmetic: @@ -6919,7 +6920,8 @@ bool zig_llvm_fn_key_eql(ZigLLVMFnKey a, ZigLLVMFnKey b) { case ZigLLVMFnIdPopCount: return a.data.pop_count.bit_count == b.data.pop_count.bit_count; case ZigLLVMFnIdBswap: - return a.data.bswap.bit_count == b.data.bswap.bit_count; + return a.data.bswap.bit_count == b.data.bswap.bit_count && + a.data.bswap.vector_len == b.data.bswap.vector_len; case ZigLLVMFnIdBitReverse: return a.data.bit_reverse.bit_count == b.data.bit_reverse.bit_count; case ZigLLVMFnIdFloatOp: |
