Skip to content

[AArch64] LLVM 20 regression when generating NEON instructions for ARMv9-A with SVE disabled #127237

@ptosi

Description

@ptosi

Hi,

we have noticed a regression between Clang v19.0.1 and Clang v20.0.0 when compiling code targeting NEON for ARMv9-A with SVE disabled.

The following:

#include <arm_neon.h>

uint16x8_t vec_fma(uint16x8_t a, uint16x8_t b, uint16_t c)
{
        return vmlaq_n_u16(a, b, c);
}

compiles with

clang -target aarch64-linux-gnu -march=armv9.2-a -O2 -Xclang -target-feature -Xclang -sve -c "neon.c"

to

0000000000000000 <vec_fma>:
   0:   4e020c02        dup     v2.8h, w0
   4:   4e619440        mla     v0.8h, v2.8h, v1.8h
   8:   d65f03c0        ret

with (Android build)

Android (12833971, +pgo, +bolt, +lto, +mlgo, based on r536225) clang version 19.0.1 (https://android.googlesource.com/toolchain/llvm-project b3a530ec6537146650e42be89f1089e9a3588460)

However, the same invocation fails:

neon.c:4:9: error: always_inline function 'vmlaq_n_u16' requires target feature 'sve', but would be inlined into function 'vec_fma' that is compiled without support for 'sve'
    4 |         return vmlaq_n_u16(a, b, c);
      |                ^

with

Android (13016439, +pgo, +bolt, +lto, +mlgo, based on r547379) clang version 20.0.0 (https://android.googlesource.com/toolchain/llvm-project b718bcaf8c198c82f3021447d943401e3ab5bd54)

instead of generating the NEON instructions, as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions