Skip to content

Commit

Permalink
[xtensa] added support for sqrt_f16 (#8247)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aelphy committed May 30, 2024
1 parent 8a316d1 commit 3ea4747
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/CodeGen_C_prologue.template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ inline double atanh_f64(double x) {
return atanh(x);
}
#endif
inline float sqrt_f16(float x) {
return sqrtf(x);
}
inline float sqrt_f32(float x) {
return sqrtf(x);
}
Expand Down
2 changes: 1 addition & 1 deletion src/CodeGen_Xtensa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ void CodeGen_Xtensa::visit(const Call *op) {
}
} else if (op->is_intrinsic(Call::prefetch)) {
user_error << "Prefetch is not supported by Xtensa backend." << Expr(op) << "\n";
} else if (op->name == "sqrt" || op->name == "sqrt_f32") {
} else if (op->name == "sqrt" || op->name == "sqrt_f16" || op->name == "sqrt_f32") {
string a0 = print_expr(op->args[0]);
if (is_native_xtensa_vector<float>(op->type)) {
rhs << "IVP_SQRTN_2XF32(" << a0 << ")";
Expand Down

0 comments on commit 3ea4747

Please sign in to comment.