Hi Everyone,
I'm working on a early LeMaker HiKey with GCC 4.9.2. I believe everything is fully patched.
I'm using the builtin's because the intrinsics are missing. I lifted it from https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01976.html.
Any ideas on this issue?
hikey$ g++ -march=armv8-a test.cxx -c test.cxx: In function ‘poly128_t VMULL_P64(poly64_t, poly64_t)’: test.cxx:10:1: error: unrecognizable insn: } ^ (insn 9 8 12 2 (set (reg:TI 73 [ D.17869 ]) (unspec:TI [ (reg:DI 75) (reg:DI 76) ] UNSPEC_PMULL)) test.cxx:9 -1 (nil)) test.cxx:10:1: internal compiler error: in extract_insn, at recog.c:2202 Please submit a full bug report,
Thanks in advance.
Jeff
**********
hikey:cryptopp-fork$ cat test.cxx #include <arm_neon.h> #include <arm_acle.h>
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if (GCC_VERSION >= 40800) && (GCC_VERSION < 50000) inline poly128_t VMULL_P64(poly64_t a, poly64_t b) { return __builtin_aarch64_crypto_pmulldi_ppp (a, b); }
inline poly128_t VMULL_HIGH_P64(poly64x2_t a, poly64x2_t b) { return __builtin_aarch64_crypto_pmullv2di_ppp (a, b); } #else # define VMULL_P64(a, b) vmull_p64(a, b) # define VMULL_HIGH_P64(a, b) vmull_high_p64(a, b) #endif
int main(int argc, char* argv[]) { const poly64_t a1={0x9090909090909090}, b1={0xb0b0b0b0b0b0b0b0}; const poly8x16_t a2={0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0},
b2={0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0};
const poly128_t r1 = VMULL_P64(a1, b1); const poly128_t r2 = VMULL_HIGH_P64((poly64x2_t)(a2), (poly64x2_t)(b2));
return 0; }
**********
$ cat /proc/cpuinfo Processor : AArch64 Processor rev 3 (aarch64) processor : 0 processor : 1 processor : 2 processor : 3 processor : 4 processor : 5 processor : 6 processor : 7 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 CPU implementer : 0x41 CPU architecture: AArch64 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 3
Hardware : HiKey Development Board
**********
$ gcc --version gcc (Debian/Linaro 4.9.2-10) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc.
$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.9 (jessie) Release: 8.9 Codename: jessie
On Sun, Jul 30, 2017 at 1:32 PM, Jeffrey Walton noloader@gmail.com wrote:
hikey$ g++ -march=armv8-a test.cxx -c test.cxx: In function ‘poly128_t VMULL_P64(poly64_t, poly64_t)’: test.cxx:10:1: error: unrecognizable insn:
pmull is part of the crypto extension, which is not enabled by default. You need to use -march=armv8-a+crypto. Or else specify a -mcpu= option for a cpu that has the crypto support. However, not all cortex-a53 processors support the crypto extension, so -mcpu=cortex-a53 is not safe, though this will work accidentally in some older gcc versions, possibly including your compiler, depending on which patches have been backported to it. -mcpu=cortex-a53 will definitely not work in current compiler versions.
If you use a compiler version that supports the crypto intrinsics, then you will get slightly less confusing error message complaining about a target specific option mismatch, as the intrinsics are defined to require crypto support.
There may also be other issues here, but this seems to be the immediate one.
Jim
On Sun, Jul 30, 2017 at 7:30 PM, Jim Wilson jim.wilson@linaro.org wrote:
On Sun, Jul 30, 2017 at 1:32 PM, Jeffrey Walton noloader@gmail.com wrote:
hikey$ g++ -march=armv8-a test.cxx -c test.cxx: In function ‘poly128_t VMULL_P64(poly64_t, poly64_t)’: test.cxx:10:1: error: unrecognizable insn:
pmull is part of the crypto extension, which is not enabled by default. You need to use -march=armv8-a+crypto. Or else specify a
Thanks Jim.
The odd thing is, ARM's ACLE [1], Section 6.5.4 (p.24), states Crypto applies to AES{E, D} and SHA1{C, P, M}. It does not mention PMULL. Later it goes on to state PMULL gear is available on Aarch32 and Aarch64.
Jeff
[1] http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/IHI0053C_acle_2_0....
On Sun, Jul 30, 2017 at 4:47 PM, Jeffrey Walton noloader@gmail.com wrote:
The odd thing is, ARM's ACLE [1], Section 6.5.4 (p.24), states Crypto applies to AES{E, D} and SHA1{C, P, M}. It does not mention PMULL. Later it goes on to state PMULL gear is available on Aarch32 and Aarch64.
If you look at the ARMv8 Architecture Reference Manual, section A1.6 Cryptographic Extension, it says "Large polynomial multiplies are included as part of the Cryptographic Extension, see PMULL, PMULL2 on page C6-1096."
If you look at section C6.3.190 PMULL, PMULL2, it says "The '1Q' arrangement is only allocated in an implementation that includes the Crypto extensions, and is otherwise RESERVED."
So pmull.8b is always valid, but pmull.1q is only valid on targets that support the Crypto extensions.
Looking at the ACLE docs, section 6.5.7 says AES, SHA1, etc. The etc would include things like pmull and sha256.
I see in section 12.3.14 Crypto Intrinsics, it mentions vmull_p64 and vmull_high_p64, but this being part of the crypto intrinsics section, it seems clear that they are part of the crypto extension. It does also mention that they are available for AArch32 and AArch64; this part is odd. All of the crypto instructions appear to be available for both AArch32 and AArch64, so it isn't clear why this is explicitly mentioned for pmull. This statement appears unnecessary, and potentially confusing.
Jim
linaro-toolchain@lists.linaro.org