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

[AArch64] incorrect results from vcvt* functions with negative inputs when optimization is enabled #46188

Open
llvmbot opened this issue Jul 25, 2020 · 3 comments
Labels
backend:ARM bugzilla Issues migrated from bugzilla

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 25, 2020

Bugzilla Link 46844
Version 10.0
OS Linux
Reporter LLVM Bugzilla Contributor
CC @efriedma-quic,@smithp35

Extended Description

Several vcvt* functions return garbage instead of 0 when the input are < 0. Specifically:

  • vcvts_u32_f32
  • vcvtd_u64_f64
  • vcvt_u32_f32
  • vcvt_u64_f64
  • vcvtq_u32_f32
  • vcvtq_u64_f64

Here is a simple test case, compile without optimizations and the result is 0 (which is correct), but with -O1 or higher it is incorrect.

#include <arm_neon.h>
#include <stdio.h>
#include <inttypes.h>

uint32_t foo(float a) {
return vgetq_lane_u32(vcvtq_u32_f32(vdupq_n_f32(a)), 0);
}

int main(void) {
printf("%" PRIu32 "\n", foo(-3.14));

return 0;

}

@efriedma-quic
Copy link
Collaborator

Looking

@efriedma-quic
Copy link
Collaborator

Posted https://reviews.llvm.org/D84703

@efriedma-quic
Copy link
Collaborator

8dfb5d7 fixes 64-bit.

I'm not planning to write the fix for the equivalent issue for 32-bit.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:ARM bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

2 participants