Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the correct LLVM intrinsics for powi on *nix. #4481

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .release-notes/4481.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Use the correct LLVM intrinsics for `powi` on *nix.

We were using outdated LLVM intrinsics `llvm.powi.f32`j and `llvm.powi.f64`; updated to use `llvm.powi.f32.i32` and `llvm.powi.f64.i32`.
8 changes: 4 additions & 4 deletions packages/builtin/float.pony
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use @logbf[F32](x: F32)
use @logb[F64](x: F64)
use @"llvm.pow.f32"[F32](x: F32, y: F32)
use @"llvm.pow.f64"[F64](x: F64, y: F64)
use @"llvm.powi.f32"[F32](x: F32, y: I32) if not windows
use @"llvm.powi.f64"[F64](x: F64, y: I32) if not windows
use @"llvm.powi.f32.i32"[F32](x: F32, y: I32) if not windows
use @"llvm.powi.f64.i32"[F64](x: F64, y: I32) if not windows
use @"llvm.sqrt.f32"[F32](x: F32)
use @"llvm.sqrt.f64"[F64](x: F64)
use @cbrtf[F32](x: F32)
Expand Down Expand Up @@ -217,7 +217,7 @@ primitive F32 is FloatingPoint[F32]
ifdef windows then
pow(y.f32())
else
@"llvm.powi.f32"(this, y)
@"llvm.powi.f32.i32"(this, y)
end

fun sqrt(): F32 =>
Expand Down Expand Up @@ -434,7 +434,7 @@ primitive F64 is FloatingPoint[F64]
ifdef windows then
pow(y.f64())
else
@"llvm.powi.f64"(this, y)
@"llvm.powi.f64.i32"(this, y)
end

fun sqrt(): F64 =>
Expand Down
9 changes: 9 additions & 0 deletions test/full-program-tests/regression-4480/main.pony
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
actor Main
new create(env: Env) =>
let a: F64 = 3.14
let b: F64 = a.powi(-2)
env.out.print("B is now " + b.string())

let c: F32 = 3.14
let d: F32 = c.powi(-3)
env.out.print("D is now " + d.string())
Loading