[PATCH] D74259: [WebAssembly] Add cbrt function signatures
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 7 15:11:08 PST 2020
tlively created this revision.
tlively added a reviewer: aheejin.
Herald added subscribers: llvm-commits, sunfish, hiraditya, jgravelle-google, sbc100, dschuff.
Herald added a project: LLVM.
Fixes a crash in the backend where optimizations produce calls to the
cbrt runtime functions. Fixes PR 44227.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74259
Files:
llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
llvm/test/CodeGen/WebAssembly/libcalls.ll
Index: llvm/test/CodeGen/WebAssembly/libcalls.ll
===================================================================
--- llvm/test/CodeGen/WebAssembly/libcalls.ll
+++ llvm/test/CodeGen/WebAssembly/libcalls.ll
@@ -67,9 +67,11 @@
%d = call double @llvm.log.f64(double %c)
; CHECK: f64.call $push{{[0-9]}}=, exp
%e = call double @llvm.exp.f64(double %d)
+ ; CHECK: f64.call $push{{[0-9]}}=, cbrt
+ %f = call fast double @llvm.pow.f64(double %e, double 0x3FD5555555555555)
; CHECK: i32.call $push{{[0-9]}}=, lround
- %f = call i32 @llvm.lround(double %e)
- ret i32 %f
+ %g = call i32 @llvm.lround(double %f)
+ ret i32 %g
}
; fcmp ord and unord (RTLIB::O_F32 / RTLIB::UO_F32 etc) are a special case (see
Index: llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
@@ -177,6 +177,9 @@
Table[RTLIB::SQRT_F32] = f32_func_f32;
Table[RTLIB::SQRT_F64] = f64_func_f64;
Table[RTLIB::SQRT_F128] = func_iPTR_i64_i64;
+ Table[RTLIB::CBRT_F32] = f32_func_f32;
+ Table[RTLIB::CBRT_F64] = f64_func_f64;
+ Table[RTLIB::CBRT_F128] = func_iPTR_i64_i64;
Table[RTLIB::LOG_F32] = f32_func_f32;
Table[RTLIB::LOG_F64] = f64_func_f64;
Table[RTLIB::LOG_F128] = func_iPTR_i64_i64;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74259.243294.patch
Type: text/x-patch
Size: 1429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200207/c2f10061/attachment.bin>
More information about the llvm-commits
mailing list