diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 14:46:31 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 14:51:08 -0700 |
| commit | f3ebfcae3882c03da84821abed40167ea07a8c78 (patch) | |
| tree | f1b759c94cba5b020a9ffb141fc62cb686fc5f04 /src/stage1/ir.cpp | |
| parent | 111a2dcf3ad53c0c8ad2c9e7c9bd042b81e90c82 (diff) | |
| parent | 0395b35cee8d4082cc40b0dcd0298f797f42309d (diff) | |
| download | zig-f3ebfcae3882c03da84821abed40167ea07a8c78.tar.gz zig-f3ebfcae3882c03da84821abed40167ea07a8c78.zip | |
Merge remote-tracking branch 'origin/master' into llvm13
Conflicts:
* cmake/Findclang.cmake
* cmake/Findlld.cmake
* cmake/Findllvm.cmake
In master branch, more search paths were added to these files with "12"
in the path. In this commit I updated them to "13".
* src/stage1/codegen.cpp
* src/zig_llvm.cpp
* src/zig_llvm.h
In master branch, ZigLLVMBuildCmpXchg is improved to add
`is_single_threaded`. However, the LLVM 13 C API has this already, and
in the llvm13 branch, ZigLLVMBuildCmpXchg is deleted in favor of the C
API. In this commit I updated stage2 to use the LLVM 13 C API rather
than depending on an improved ZigLLVMBuildCmpXchg.
Additionally, src/target.zig largestAtomicBits needed to be updated to
include the new m68k ISA.
Diffstat (limited to 'src/stage1/ir.cpp')
| -rw-r--r-- | src/stage1/ir.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 830ce76708..0604c05c46 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -9820,6 +9820,34 @@ static ErrorMsg *ir_eval_math_op_scalar(IrAnalyze *ira, Scope *scope, AstNode *s float_min(out_val, op1_val, op2_val); } break; + case IrBinOpSatAdd: + if (is_int) { + bigint_add_sat(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint, type_entry->data.integral.bit_count, type_entry->data.integral.is_signed); + } else { + zig_unreachable(); + } + break; + case IrBinOpSatSub: + if (is_int) { + bigint_sub_sat(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint, type_entry->data.integral.bit_count, type_entry->data.integral.is_signed); + } else { + zig_unreachable(); + } + break; + case IrBinOpSatMul: + if (is_int) { + bigint_mul_sat(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint, type_entry->data.integral.bit_count, type_entry->data.integral.is_signed); + } else { + zig_unreachable(); + } + break; + case IrBinOpSatShl: + if (is_int) { + bigint_shl_sat(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint, type_entry->data.integral.bit_count, type_entry->data.integral.is_signed); + } else { + zig_unreachable(); + } + break; } if (type_entry->id == ZigTypeIdInt) { @@ -10041,6 +10069,10 @@ static bool ok_float_op(IrBinOp op) { case IrBinOpBitShiftRightExact: case IrBinOpAddWrap: case IrBinOpSubWrap: + case IrBinOpSatAdd: + case IrBinOpSatSub: + case IrBinOpSatMul: + case IrBinOpSatShl: case IrBinOpMultWrap: case IrBinOpArrayCat: case IrBinOpArrayMult: @@ -11014,6 +11046,10 @@ static Stage1AirInst *ir_analyze_instruction_bin_op(IrAnalyze *ira, Stage1ZirIns case IrBinOpRemMod: case IrBinOpMaximum: case IrBinOpMinimum: + case IrBinOpSatAdd: + case IrBinOpSatSub: + case IrBinOpSatMul: + case IrBinOpSatShl: return ir_analyze_bin_op_math(ira, bin_op_instruction); case IrBinOpArrayCat: return ir_analyze_array_cat(ira, bin_op_instruction); |
