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

[NEON] Wrong return type of NEON intrinsic vqrshrunh_n_s16 in arm_neon.h #71751

Closed
yyctw opened this issue Nov 9, 2023 · 3 comments · Fixed by #80819
Closed

[NEON] Wrong return type of NEON intrinsic vqrshrunh_n_s16 in arm_neon.h #71751

yyctw opened this issue Nov 9, 2023 · 3 comments · Fixed by #80819
Labels
backend:AArch64 backend:ARM clang:headers Headers provided by Clang, e.g. for intrinsics

Comments

@yyctw
Copy link

yyctw commented Nov 9, 2023

The NEON intrinsics vqrshrunh_n_s16, vqrshruns_n_s32, and vqrshrund_n_s64 have the wrong return type in arm_neon.h in CLANG++-15. According to the ARM documentation https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrunh_n_s16, these functions should return uint8, uint16, and uint32, respectively. However, in the header file llvm-15/lib/clang/15.0.7/include/arm_neon.h, the return value of these functions is of int type.

Reproduce problem: https://godbolt.org/z/5ebrG1MW1
CLANG version:

Debian clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Thank you for your reading.

@EugeneZelenko EugeneZelenko added backend:AArch64 clang:headers Headers provided by Clang, e.g. for intrinsics and removed new issue labels Nov 9, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 9, 2023

@llvm/issue-subscribers-backend-aarch64

Author: Yi-Yen Chung (yyctw)

The NEON intrinsics `vqrshrunh_n_s16`, `vqrshruns_n_s32`, and `vqrshrund_n_s64` have the wrong return type in `arm_neon.h` in CLANG++-15. According to the ARM documentation https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrunh_n_s16, these functions should return `uint8`, `uint16`, and `uint32`, respectively. However, in the header file `llvm-15/lib/clang/15.0.7/include/arm_neon.h`, the return value of these functions is of int type.

Reproduce problem: https://godbolt.org/z/5ebrG1MW1
CLANG version:

Debian clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Thank you for your reading.

@EugeneZelenko
Copy link
Contributor

Looks like main has same problem: https://godbolt.org/z/WKPrj3acn

hlivin01 added a commit to hlivin01/llvm-project that referenced this issue Feb 6, 2024
 vqrshrunh_n_s16, vqrshruns_n_s32, and vqrshrund_n_s64 in arm_neon.h

* fixes llvm#71751
* changed return types in the table gen file responsible for generation
  of the problematic intrinsics
* this is to ensure that the return type for the functions is the same
  as specified in the Arm Developer Documentation and avoid casting
bugs
(https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrunh_n_s16)
* updated lit tests to reflect the change in return type, worth noting
  that LLVM does not seems to differentiate signed and unsigned ints in
the IR, hence the change in type cannot be checked in IR as far as I am
aware
hlivin01 added a commit to hlivin01/llvm-project that referenced this issue Feb 6, 2024
 vqrshrunh_n_s16, vqrshruns_n_s32, and vqrshrund_n_s64 in arm_neon.h

* fixes llvm#71751
* changed return types in the table gen file responsible for generation
  of the problematic intrinsics
* this is to ensure that the return type for the functions is the same
  as specified in the Arm Developer Documentation and avoid casting
bugs
(https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrunh_n_s16)
* updated lit tests to reflect the change in return type, worth noting
  that LLVM does not seems to differentiate signed and unsigned ints in
the IR, hence the change in type cannot be checked in IR as far as I am
aware
jthackray pushed a commit that referenced this issue Feb 6, 2024
…_s16, vqrshruns_n_s32, and vqrshrund_n_s64 in arm_neon.h (#80819)

* fixes #71751
* changed return types in the table gen file responsible for generation
  of the problematic intrinsics
* this is to ensure that the return type for the functions is the same
  as specified in the Arm Developer Documentation and avoid casting
bugs

(https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrunh_n_s16)
* updated lit tests to reflect the change in return type, worth noting
  that LLVM does not seems to differentiate signed and unsigned ints in
the IR, hence the change in type cannot be checked in IR as far as I am
aware
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 6, 2024

@llvm/issue-subscribers-backend-arm

Author: Yi-Yen Chung (yyctw)

The NEON intrinsics `vqrshrunh_n_s16`, `vqrshruns_n_s32`, and `vqrshrund_n_s64` have the wrong return type in `arm_neon.h` in CLANG++-15. According to the ARM documentation https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrunh_n_s16, these functions should return `uint8`, `uint16`, and `uint32`, respectively. However, in the header file `llvm-15/lib/clang/15.0.7/include/arm_neon.h`, the return value of these functions is of int type.

Reproduce problem: https://godbolt.org/z/5ebrG1MW1
CLANG version:

Debian clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Thank you for your reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 backend:ARM clang:headers Headers provided by Clang, e.g. for intrinsics
Projects
None yet
3 participants