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

When targeting AArch64, unable to widen cast f16 to f128 #3282

Closed
andrewrk opened this issue Sep 21, 2019 · 3 comments
Closed

When targeting AArch64, unable to widen cast f16 to f128 #3282

andrewrk opened this issue Sep 21, 2019 · 3 comments
Labels
arch-aarch64 64-bit ARM bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. upstream An issue with a third party project that Zig uses.
Milestone

Comments

@andrewrk
Copy link
Member

export fn entry() bool {
    var x: f16 = 12.34;
    var y: f128 = x;
}
LLVM ERROR: Unsupported library call operation!

Note that it works if you do:

export fn entry() void {
    var x: f16 = 12.34;
    var y: f32 = x;
    var z: f128 = y;
}

This issue is to:

  • Work with upstream LLVM to get this working
  • In the mean time, work around the issue by generating f16 -> f128 casts by taking a brief detour through f32.
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior upstream An issue with a third party project that Zig uses. arch-aarch64 64-bit ARM labels Sep 21, 2019
@andrewrk andrewrk added this to the 0.6.0 milestone Sep 21, 2019
andrewrk added a commit that referenced this issue Sep 21, 2019
@andrewrk andrewrk added the contributor friendly This issue is limited in scope and/or knowledge of Zig internals. label Sep 22, 2019
@shawnl
Copy link
Contributor

shawnl commented Sep 30, 2019

I don't get it. This is not a difficult function. The widening float conversion you just move the bits and zero the rest.

@LemonBoy
Copy link
Contributor

There's a patch for this that's stuck in the limbo.

@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Oct 23, 2019
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 30, 2020
@mikdusan
Copy link
Member

mikdusan commented Jun 1, 2021

test is now passing for both aarch64 and powerpc64le

$ /opt/llvm-linux-x86_64-12.0.0.1-release-assert/bin/llvm-config --assertion-mode
ON
$ zig test test/behavior.zig -lc -Itest -target aarch64-linux -mcpu=baseline+v8_5a --test-cmd /opt/qemu-linux-x86_64-5.2.0/bin/qemu-aarch64 --test-cmd-bin --test-filter "float widening f16 to f128"
All 1 tests passed.
$ zig test test/behavior.zig -lc -Itest -target powerpc64le-linux --test-cmd /opt/qemu-linux-x86_64-5.2.0/bin/qemu-ppc64le --test-cmd-bin --test-filter "float widening f16 to f128"
All 1 tests passed.

however, this related test in doc is failing:

zig/doc/langref.html.in

Lines 5199 to 5209 in f693247

test "float widening" {
// Note: there is an open issue preventing this from working on aarch64:
// https://github.com/ziglang/zig/issues/3282
if (std.Target.current.cpu.arch == .aarch64) return error.SkipZigTest;
var a: f16 = 12.34;
var b: f32 = a;
var c: f64 = b;
var d: f128 = c;
try expect(d == a);
}

@andrewrk andrewrk modified the milestones: 0.8.0, 0.8.1 Jun 4, 2021
@andrewrk andrewrk modified the milestones: 0.8.1, 0.9.1 Sep 1, 2021
@andrewrk andrewrk modified the milestones: 0.9.1, 0.9.0, 0.10.0 Nov 20, 2021
@andrewrk andrewrk modified the milestones: 0.10.0, 0.10.1 Aug 24, 2022
wooster0 added a commit to wooster0/zig that referenced this issue Dec 7, 2022
wooster0 added a commit to wooster0/zig that referenced this issue Dec 7, 2022
wooster0 added a commit to wooster0/zig that referenced this issue Dec 7, 2022
wooster0 added a commit to wooster0/zig that referenced this issue Dec 7, 2022
wooster0 added a commit to wooster0/zig that referenced this issue Dec 8, 2022
wooster0 added a commit to wooster0/zig that referenced this issue Dec 8, 2022
wooster0 added a commit to wooster0/zig that referenced this issue Dec 9, 2022
kcbanner pushed a commit to kcbanner/zig that referenced this issue Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-aarch64 64-bit ARM bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. upstream An issue with a third party project that Zig uses.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants