aboutsummaryrefslogtreecommitdiff
path: root/src/stage1/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-09-28 22:21:15 -0400
committerGitHub <noreply@github.com>2021-09-28 22:21:15 -0400
commitcf90cb7218d1baa56586477bab50e88fdb6be0bb (patch)
treea3495ecdbbca9a963f514938f20003f1aeb69b64 /src/stage1/codegen.cpp
parent79bc5891c1c4cde0592fe1b10b6c9a85914155cf (diff)
parent54675824449d16029fdf6a1873e78cb8f2147f60 (diff)
downloadzig-cf90cb7218d1baa56586477bab50e88fdb6be0bb.tar.gz
zig-cf90cb7218d1baa56586477bab50e88fdb6be0bb.zip
Merge pull request #9679 from travisstaloch/sat-arith-operators
sat-arithmetic: add operator support
Diffstat (limited to 'src/stage1/codegen.cpp')
-rw-r--r--src/stage1/codegen.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/stage1/codegen.cpp b/src/stage1/codegen.cpp
index f84847a9fe..a0f130b79e 100644
--- a/src/stage1/codegen.cpp
+++ b/src/stage1/codegen.cpp
@@ -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, "");
@@ -9134,10 +9134,6 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdReduce, "reduce", 2);
create_builtin_fn(g, BuiltinFnIdMaximum, "maximum", 2);
create_builtin_fn(g, BuiltinFnIdMinimum, "minimum", 2);
- create_builtin_fn(g, BuiltinFnIdSatAdd, "addWithSaturation", 2);
- create_builtin_fn(g, BuiltinFnIdSatSub, "subWithSaturation", 2);
- create_builtin_fn(g, BuiltinFnIdSatMul, "mulWithSaturation", 2);
- create_builtin_fn(g, BuiltinFnIdSatShl, "shlWithSaturation", 2);
}
static const char *bool_to_str(bool b) {