Skip to content

Commit

Permalink
Add llvm.minnum.f(32|64) and llvm.maxnum.f(32|64) intrinsics
Browse files Browse the repository at this point in the history
The corresponding change to Emscripten is this PR:
emscripten-core/emscripten#5978, and relates to this
issue: emscripten-core/emscripten#5976. I’m using
emscripten-core#143 as a model.
  • Loading branch information
varkor committed Dec 28, 2017
1 parent 9abeae2 commit 09e1f76
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/Target/JSBackend/CallHandlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -697,14 +697,6 @@ DEF_CALL_HANDLER(llvm_ctpop_i64, {
return CH___default__(CI, "_llvm_ctpop_i64");
})

DEF_CALL_HANDLER(llvm_maxnum_f32, {
return CH___default__(CI, "Math_max", 2);
})

DEF_CALL_HANDLER(llvm_maxnum_f64, {
return CH___default__(CI, "Math_max", 2);
})

DEF_CALL_HANDLER(llvm_copysign_f32, {
if (OnlyWebAssembly) {
return CH___default__(CI, "f32_copysign", 2);
Expand Down Expand Up @@ -975,6 +967,10 @@ DEF_MAYBE_BUILTIN_HANDLER(llvm_cos_f32, Math_cos);
DEF_MAYBE_BUILTIN_HANDLER(llvm_cos_f64, Math_cos);
DEF_MAYBE_BUILTIN_HANDLER(llvm_sin_f32, Math_sin);
DEF_MAYBE_BUILTIN_HANDLER(llvm_sin_f64, Math_sin);
DEF_MAYBE_BUILTIN_HANDLER(llvm_minnum_f32, Math_min);
DEF_MAYBE_BUILTIN_HANDLER(llvm_minnum_f64, Math_min);
DEF_MAYBE_BUILTIN_HANDLER(llvm_maxnum_f32, Math_max);
DEF_MAYBE_BUILTIN_HANDLER(llvm_maxnum_f64, Math_max);

DEF_CALL_HANDLER(llvm_powi_f32, {
return getAssign(CI) + getParenCast("Math_pow(" + getValueAsCastStr(CI->getOperand(0)) + ", " + getCast(getValueAsCastStr(CI->getOperand(1)), CI->getOperand(0)->getType()) + ")", CI->getType());
Expand Down Expand Up @@ -1692,8 +1688,6 @@ void setupCallHandlers() {
SETUP_CALL_HANDLER(llvm_cttz_i64);
SETUP_CALL_HANDLER(llvm_ctpop_i32);
SETUP_CALL_HANDLER(llvm_ctpop_i64);
SETUP_CALL_HANDLER(llvm_maxnum_f32);
SETUP_CALL_HANDLER(llvm_maxnum_f64);
SETUP_CALL_HANDLER(llvm_copysign_f32);
SETUP_CALL_HANDLER(llvm_copysign_f64);

Expand Down Expand Up @@ -2237,6 +2231,10 @@ void setupCallHandlers() {
SETUP_CALL_HANDLER(llvm_cos_f64);
SETUP_CALL_HANDLER(llvm_sin_f32);
SETUP_CALL_HANDLER(llvm_sin_f64);
SETUP_CALL_HANDLER(llvm_minnum_f32);
SETUP_CALL_HANDLER(llvm_minnum_f64);
SETUP_CALL_HANDLER(llvm_maxnum_f32);
SETUP_CALL_HANDLER(llvm_maxnum_f64);
}

std::string handleCall(const Instruction *CI) {
Expand Down

0 comments on commit 09e1f76

Please sign in to comment.