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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user