aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-04-01 17:08:34 +0100
committergingerBill <bill@gingerbill.org>2021-04-01 17:08:34 +0100
commit4a66cbb1f40ce084b2e1e73bbce559049771fb1a (patch)
tree9daca20ad5ed32ba3bd767c4a4b8c39eef22bd26 /src/llvm_backend.cpp
parentf0392d0c75977e06db6d5a7ccda59cd709cfd2a5 (diff)
Fix signed fixed arithmetic intrinsics
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 0f198993d..836e9450a 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -9215,16 +9215,17 @@ lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValue const &tv,
}
} else {
switch (id) {
- case BuiltinProc_fixed_point_mul: name = "llvm.imul.fix"; break;
- case BuiltinProc_fixed_point_div: name = "llvm.idiv.fix"; break;
- case BuiltinProc_fixed_point_mul_sat: name = "llvm.imul.fix.sat"; break;
- case BuiltinProc_fixed_point_div_sat: name = "llvm.idiv.fix.sat"; break;
+ case BuiltinProc_fixed_point_mul: name = "llvm.smul.fix"; break;
+ case BuiltinProc_fixed_point_div: name = "llvm.sdiv.fix"; break;
+ case BuiltinProc_fixed_point_mul_sat: name = "llvm.smul.fix.sat"; break;
+ case BuiltinProc_fixed_point_div_sat: name = "llvm.sdiv.fix.sat"; break;
}
}
GB_ASSERT(name != nullptr);
- unsigned id = LLVMLookupIntrinsicID(name, gb_strlen(name));
LLVMTypeRef types[1] = {lb_type(p->module, platform_type)};
+ unsigned id = LLVMLookupIntrinsicID(name, gb_strlen(name));
+ GB_ASSERT_MSG(id != 0, "Unable to find %s.%s", name, LLVMPrintTypeToString(types[0]));
LLVMValueRef ip = LLVMGetIntrinsicDeclaration(p->module->mod, id, types, gb_count_of(types));
lbValue res = {};