Add require to 128-bit and f16 casts

This commit is contained in:
gingerBill
2024-02-05 13:49:10 +00:00
parent e88db2818b
commit 27feb5998c
2 changed files with 30 additions and 29 deletions

View File

@@ -3118,19 +3118,20 @@ gb_internal void check_cast(CheckerContext *c, Operand *x, Type *type) {
Type *src = core_type(x->type);
Type *dst = core_type(type);
if (src != dst) {
bool const REQUIRE = true;
if (is_type_integer_128bit(src) && is_type_float(dst)) {
add_package_dependency(c, "runtime", "floattidf_unsigned");
add_package_dependency(c, "runtime", "floattidf");
add_package_dependency(c, "runtime", "floattidf_unsigned", REQUIRE);
add_package_dependency(c, "runtime", "floattidf", REQUIRE);
} else if (is_type_integer_128bit(dst) && is_type_float(src)) {
add_package_dependency(c, "runtime", "fixunsdfti");
add_package_dependency(c, "runtime", "fixunsdfdi");
add_package_dependency(c, "runtime", "fixunsdfti", REQUIRE);
add_package_dependency(c, "runtime", "fixunsdfdi", REQUIRE);
} else if (src == t_f16 && is_type_float(dst)) {
add_package_dependency(c, "runtime", "gnu_h2f_ieee");
add_package_dependency(c, "runtime", "extendhfsf2");
add_package_dependency(c, "runtime", "gnu_h2f_ieee", REQUIRE);
add_package_dependency(c, "runtime", "extendhfsf2", REQUIRE);
} else if (is_type_float(dst) && dst == t_f16) {
add_package_dependency(c, "runtime", "truncsfhf2");
add_package_dependency(c, "runtime", "truncdfhf2");
add_package_dependency(c, "runtime", "gnu_f2h_ieee");
add_package_dependency(c, "runtime", "truncsfhf2", REQUIRE);
add_package_dependency(c, "runtime", "truncdfhf2", REQUIRE);
add_package_dependency(c, "runtime", "gnu_f2h_ieee", REQUIRE);
}
}
}

View File

@@ -2570,27 +2570,27 @@ gb_internal void generate_minimum_dependency_set(Checker *c, Entity *start) {
str_lit("memmove"),
);
FORCE_ADD_RUNTIME_ENTITIES(is_arch_wasm() && !build_context.tilde_backend,
// Extended data type internal procedures
str_lit("umodti3"),
str_lit("udivti3"),
str_lit("modti3"),
str_lit("divti3"),
str_lit("fixdfti"),
str_lit("fixunsdfti"),
str_lit("fixunsdfdi"),
str_lit("floattidf"),
str_lit("floattidf_unsigned"),
str_lit("truncsfhf2"),
str_lit("truncdfhf2"),
str_lit("gnu_h2f_ieee"),
str_lit("gnu_f2h_ieee"),
str_lit("extendhfsf2"),
// FORCE_ADD_RUNTIME_ENTITIES(is_arch_wasm() && !build_context.tilde_backend,
// // Extended data type internal procedures
// str_lit("umodti3"),
// str_lit("udivti3"),
// str_lit("modti3"),
// str_lit("divti3"),
// str_lit("fixdfti"),
// str_lit("fixunsdfti"),
// str_lit("fixunsdfdi"),
// str_lit("floattidf"),
// str_lit("floattidf_unsigned"),
// str_lit("truncsfhf2"),
// str_lit("truncdfhf2"),
// str_lit("gnu_h2f_ieee"),
// str_lit("gnu_f2h_ieee"),
// str_lit("extendhfsf2"),
// WASM Specific
str_lit("__ashlti3"),
str_lit("__multi3"),
);
// // WASM Specific
// str_lit("__ashlti3"),
// str_lit("__multi3"),
// );
FORCE_ADD_RUNTIME_ENTITIES(!build_context.no_rtti,
// Odin types