llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.34k stars 11.7k forks source link

Second argument to signed Neon vtbl functions should be unsigned #23698

Open llvmbot opened 9 years ago

llvmbot commented 9 years ago
Bugzilla Link 23324
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @DavidSpickett

Extended Description

The ARM C Language Extensions document (ACLE) specifies that the second (index) parameter to the vtbl and vtbx family of functions should be unsigned, even when the other parameters are signed:

Aarch32: T vtblN_ST(TxN a, UT b); T vtbxN_ST(T a, TxN b, UT c);

Aarch64: T vqtblNQ_ST (T2xN t, UT idx); T vqtbxNQ_ST (T a, T2xN t, UT idx);

E.g., int8x8_t vqtbl1_s8 (int8x16_t a, uint8x8_t b)

Clang declares them to be signed, instead.

GCC has had these correct for Aarch64 since GCC 4.9, though for ARM (Aarch32) it still has the second value signed.

DavidSpickett commented 4 years ago

This has been fixed, though by what I couldn't find.

The attached test.cpp file using function pointers with types the ACLE expects compiles without error with trunk clang.

(types from here) https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=vcls

$ ./clang -target aarch64-arm-none-eabi -march=armv8-a+simd -c -o /dev/null /tmp/test.cpp

DavidSpickett commented 4 years ago

test file