Re: [pcre-dev] JIT fails with NEON instructions

Top Page
Delete this message
Author: Petr Pisar
Date:  
To: pcre-dev
Old-Topics: Re: [pcre-dev] Testing Release 10.34-RC1
Subject: Re: [pcre-dev] JIT fails with NEON instructions
On Wed, Oct 30, 2019 at 03:38:45PM +0100, Petr Pisar via Pcre-dev wrote:
> On Thu, Oct 17, 2019 at 05:54:08PM +0100, ph10@??? wrote:
> > I have just made available a Release Candidate for PCRE2 10.34 here:
> >
> > https://ftp.pcre.org/pub/pcre/Testing/pcre2-10.34-RC1.tar.gz
> > https://ftp.pcre.org/pub/pcre/Testing/pcre2-10.34-RC1.tar.bz2
> > https://ftp.pcre.org/pub/pcre/Testing/pcre2-10.34-RC1.tar.zip
> >
> > NOTE: this is a different FTP site than was used for previous releases.
> >
> I experience two test failures on 64-bit ARM with Fedora 32 distribution:
>

Both failures are triggered by this PCRE2 commit:

commit a6b4b9c7f9e3d20966de682487ee575cba053a20
Author: zherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue Sep 17 06:59:45 2019 +0000

    Support NEON based fast forward character search in ARM64. Patch by Sebastian Pop.


    git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1172 6239d852-aaf2-0410-a92c-79f79f948
069


I verified it on this machine:

# lscpu 
Architecture:                    aarch64
CPU op-mode(s):                  64-bit
Byte Order:                      Little Endian
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              1
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       Cavium
Model:                           1
Model name:                      ThunderX2 99xx
Stepping:                        0x1
BogoMIPS:                        400.00
NUMA node0 CPU(s):               0-3
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Mitigation; __user pointer sanitization
Vulnerability Spectre v2:        Vulnerable
Flags:                           fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid 
                                 asimdrdm


using Fedora 31 (gcc-9.2.1, binutils-2.32).

The compiler defines __ARM_NEON macro on that machine. getauxval(AT_HWCAP) sets
HWCAP_ASIMD bit. So I believe the machine supports NEON.

When I disable the

#if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64 && (defined __ARM_NEON || defined
__ARM_NEON__))

branch in src/pcre2_jit_compile.c not to emit NEON instructions, all tests
pass on that machine.

This I conclude something is wrong in the NEON support in sljit.

-- Petr