sat-arithmetic: add operator support
- adds initial support for the operators +|, -|, *|, <<|, +|=, -|=, *|=, <<|= - uses operators in addition to builtins in behavior test - adds binOpExt() and assignBinOpExt() to AstGen.zig. these need to be audited
This commit is contained in:
committed by
Andrew Kelley
parent
79bc5891c1
commit
29f41896ed
@@ -3333,7 +3333,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable,
|
||||
} else {
|
||||
zig_unreachable();
|
||||
}
|
||||
case IrBinOpSatAdd:
|
||||
case IrBinOpAddSat:
|
||||
if (scalar_type->id == ZigTypeIdInt) {
|
||||
if (scalar_type->data.integral.is_signed) {
|
||||
return ZigLLVMBuildSAddSat(g->builder, op1_value, op2_value, "");
|
||||
@@ -3343,7 +3343,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable,
|
||||
} else {
|
||||
zig_unreachable();
|
||||
}
|
||||
case IrBinOpSatSub:
|
||||
case IrBinOpSubSat:
|
||||
if (scalar_type->id == ZigTypeIdInt) {
|
||||
if (scalar_type->data.integral.is_signed) {
|
||||
return ZigLLVMBuildSSubSat(g->builder, op1_value, op2_value, "");
|
||||
@@ -3353,7 +3353,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable,
|
||||
} else {
|
||||
zig_unreachable();
|
||||
}
|
||||
case IrBinOpSatMul:
|
||||
case IrBinOpMultSat:
|
||||
if (scalar_type->id == ZigTypeIdInt) {
|
||||
if (scalar_type->data.integral.is_signed) {
|
||||
return ZigLLVMBuildSMulFixSat(g->builder, op1_value, op2_value, "");
|
||||
@@ -3363,7 +3363,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable,
|
||||
} else {
|
||||
zig_unreachable();
|
||||
}
|
||||
case IrBinOpSatShl:
|
||||
case IrBinOpShlSat:
|
||||
if (scalar_type->id == ZigTypeIdInt) {
|
||||
if (scalar_type->data.integral.is_signed) {
|
||||
return ZigLLVMBuildSShlSat(g->builder, op1_value, op2_value, "");
|
||||
|
||||
Reference in New Issue
Block a user