[PATCH] D147476: [WebAssembly] Add libcall signatures for roundeven

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 08:32:31 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG62bfb0b14ce9: [WebAssembly] Add libcall signatures for roundeven (authored by tlively).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147476/new/

https://reviews.llvm.org/D147476

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
@@ -18,10 +18,9 @@
 declare double @llvm.powi.f64.i32(double, i32)
 declare double @llvm.log.f64(double)
 declare double @llvm.exp.f64(double)
+declare double @llvm.roundeven.f64(double)
 declare i32 @llvm.lround(double)
 
-
-
 define fp128 @fp128libcalls(fp128 %x, fp128 %y, i32 %z) {
   ; compiler-rt call
 ; CHECK-LABEL: fp128libcalls:
@@ -236,18 +235,19 @@
 ; CHECK-LABEL: f64libcalls:
 ; CHECK:         .functype f64libcalls (f64, f64, i32) -> (i32)
 ; CHECK-NEXT:  # %bb.0:
-; CHECK-NEXT:    local.get $push8=, 0
-; CHECK-NEXT:    call $push0=, cos, $pop8
+; CHECK-NEXT:    local.get $push9=, 0
+; CHECK-NEXT:    call $push0=, cos, $pop9
 ; CHECK-NEXT:    call $push1=, log10, $pop0
-; CHECK-NEXT:    local.get $push9=, 1
-; CHECK-NEXT:    call $push2=, pow, $pop1, $pop9
-; CHECK-NEXT:    local.get $push10=, 2
-; CHECK-NEXT:    call $push3=, __powidf2, $pop2, $pop10
+; CHECK-NEXT:    local.get $push10=, 1
+; CHECK-NEXT:    call $push2=, pow, $pop1, $pop10
+; CHECK-NEXT:    local.get $push11=, 2
+; CHECK-NEXT:    call $push3=, __powidf2, $pop2, $pop11
 ; CHECK-NEXT:    call $push4=, log, $pop3
 ; CHECK-NEXT:    call $push5=, exp, $pop4
 ; CHECK-NEXT:    call $push6=, cbrt, $pop5
-; CHECK-NEXT:    call $push7=, lround, $pop6
-; CHECK-NEXT:    return $pop7
+; CHECK-NEXT:    call $push7=, roundeven, $pop6
+; CHECK-NEXT:    call $push8=, lround, $pop7
+; CHECK-NEXT:    return $pop8
  %a = call double @llvm.cos.f64(double %x)
  %b = call double @llvm.log10.f64(double %a)
  %c = call double @llvm.pow.f64(double %b, double %y)
@@ -255,8 +255,9 @@
  %e = call double @llvm.log.f64(double %d)
  %f = call double @llvm.exp.f64(double %e)
  %g = call fast double @llvm.pow.f64(double %f, double 0x3FD5555555555555)
- %h = call i32 @llvm.lround(double %g)
- ret i32 %h
+ %h = call double @llvm.roundeven.f64(double %g)
+ %i = call i32 @llvm.lround(double %h)
+ ret i32 %i
 }
 
 ; 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
@@ -218,6 +218,9 @@
     Table[RTLIB::ROUND_F32] = f32_func_f32;
     Table[RTLIB::ROUND_F64] = f64_func_f64;
     Table[RTLIB::ROUND_F128] = i64_i64_func_i64_i64;
+    Table[RTLIB::ROUNDEVEN_F32] = f32_func_f32;
+    Table[RTLIB::ROUNDEVEN_F64] = f64_func_f64;
+    Table[RTLIB::ROUNDEVEN_F128] = i64_i64_func_i64_i64;
     Table[RTLIB::LROUND_F32] = iPTR_func_f32;
     Table[RTLIB::LROUND_F64] = iPTR_func_f64;
     Table[RTLIB::LROUND_F128] = iPTR_func_i64_i64;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147476.510815.patch
Type: text/x-patch
Size: 2929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230404/a8a3dbc4/attachment.bin>


More information about the llvm-commits mailing list