diff options
| author | Vexu <git@vexu.eu> | 2020-03-11 13:29:17 +0200 |
|---|---|---|
| committer | Vexu <git@vexu.eu> | 2020-03-11 13:55:52 +0200 |
| commit | ec906a97712b329694e8f2e1a35b50b75d052642 (patch) | |
| tree | e0b5234faa2cbc58bd7a54d8d77f797fa47c5bc1 /src/codegen.cpp | |
| parent | 1f66435a6b0c5ccf6e4e96df0ed96732480ab4db (diff) | |
| download | zig-ec906a97712b329694e8f2e1a35b50b75d052642.tar.gz zig-ec906a97712b329694e8f2e1a35b50b75d052642.zip | |
fix codegen, update docs
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index cfb3de292a..66cf919d88 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5229,8 +5229,8 @@ static LLVMValueRef ir_render_cmpxchg(CodeGen *g, IrExecutableGen *executable, I // operand needs widening and truncating ptr_val = LLVMBuildBitCast(g->builder, ptr_val, LLVMPointerType(get_llvm_type(g, instruction->actual_type), 0), ""); - cmp_val = LLVMConstZExt(cmp_val, get_llvm_type(g, instruction->actual_type)); - new_val = LLVMConstZExt(new_val, get_llvm_type(g, instruction->actual_type)); + cmp_val = LLVMBuildZExt(g->builder, cmp_val, get_llvm_type(g, instruction->actual_type), ""); + new_val = LLVMBuildZExt(g->builder, new_val, get_llvm_type(g, instruction->actual_type), ""); } LLVMAtomicOrdering success_order = to_LLVMAtomicOrdering(instruction->success_order); @@ -5846,7 +5846,7 @@ static LLVMValueRef ir_render_atomic_rmw(CodeGen *g, IrExecutableGen *executable // operand needs widening and truncating LLVMValueRef casted_ptr = LLVMBuildBitCast(g->builder, ptr, LLVMPointerType(get_llvm_type(g, instruction->actual_type), 0), ""); - LLVMValueRef casted_operand = LLVMBuildPtrToInt(g->builder, operand, get_llvm_type(g, instruction->actual_type), ""); + LLVMValueRef casted_operand = LLVMBuildZExt(g->builder, operand, get_llvm_type(g, instruction->actual_type), ""); LLVMValueRef uncasted_result = ZigLLVMBuildAtomicRMW(g->builder, op, casted_ptr, casted_operand, ordering, g->is_single_threaded); return LLVMBuildTrunc(g->builder, uncasted_result, get_llvm_type(g, operand_type), ""); @@ -5893,10 +5893,10 @@ static LLVMValueRef ir_render_atomic_store(CodeGen *g, IrExecutableGen *executab LLVMValueRef value = ir_llvm_value(g, instruction->value); if (instruction->actual_type != nullptr) { - // operand needs widening and truncating + // operand needs widening ptr = LLVMBuildBitCast(g->builder, ptr, LLVMPointerType(get_llvm_type(g, instruction->actual_type), 0), ""); - value = LLVMConstZExt(value, get_llvm_type(g, instruction->actual_type)); + value = LLVMBuildZExt(g->builder, value, get_llvm_type(g, instruction->actual_type), ""); } LLVMValueRef store_inst = gen_store(g, value, ptr, instruction->ptr->value->type); LLVMSetOrdering(store_inst, ordering); |
