aarch64: Move vreinterpret definitions into the compiler
authorAndrew Carlotti <Andrew.Carlotti@arm.com>
Thu, 21 Jul 2022 16:22:14 +0000 (17:22 +0100)
committerAndrew Carlotti <andrew.carlotti@arm.com>
Tue, 26 Jul 2022 09:31:00 +0000 (10:31 +0100)
commitc906efc700dafe7d30e8b35895f43862ddf7dc8e
tree6e6fee4eeddcecf78e5e41d99cba9345d54fa817
parentf023cc54e86c6c6dd04298487a9c9000eab9133a
aarch64: Move vreinterpret definitions into the compiler

This removes a significant number of intrinsic definitions from the arm_neon.h
header file, and reduces the amount of code duplication.  The new macros and
data structures are intended to also facilitate moving other intrinsic
definitions out of the header file in future.

There is a a slight change in the behaviour of the bf16 vreinterpret intrinsics
when compiling without bf16 support.  Expressions like:

b = vreinterpretq_s32_bf16(vreinterpretq_bf16_s64(a))

are now compiled successfully, instead of causing a 'target specific option
mismatch' during inlining.

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc
(MODE_d_bf16, MODE_d_f16, MODE_d_f32, MODE_d_f64, MODE_d_s8)
(MODE_d_s16, MODE_d_s32, MODE_d_s64, MODE_d_u8, MODE_d_u16)
(MODE_d_u32, MODE_d_u64, MODE_d_p8, MODE_d_p16, MODE_d_p64)
(MODE_q_bf16, MODE_q_f16, MODE_q_f32, MODE_q_f64, MODE_q_s8)
(MODE_q_s16, MODE_q_s32, MODE_q_s64, MODE_q_u8, MODE_q_u16)
(MODE_q_u32, MODE_q_u64, MODE_q_p8, MODE_q_p16, MODE_q_p64)
(MODE_q_p128): Define macro to map to corresponding mode name.
(QUAL_bf16, QUAL_f16, QUAL_f32, QUAL_f64, QUAL_s8, QUAL_s16)
(QUAL_s32, QUAL_s64, QUAL_u8, QUAL_u16, QUAL_u32, QUAL_u64)
(QUAL_p8, QUAL_p16, QUAL_p64, QUAL_p128): Define macro to map to
corresponding qualifier name.
(LENGTH_d, LENGTH_q): Define macro to map to "" or "q" suffix.
(SIMD_INTR_MODE, SIMD_INTR_QUAL, SIMD_INTR_LENGTH_CHAR): Macro
functions for the above mappings
(VREINTERPRET_BUILTIN2, VREINTERPRET_BUILTINS1, VREINTERPRET_BUILTINS)
(VREINTERPRETQ_BUILTIN2, VREINTERPRETQ_BUILTINS1)
(VREINTERPRETQ_BUILTINS, VREINTERPRET_BUILTIN)
(AARCH64_SIMD_VREINTERPRET_BUILTINS): New macros to create definitions
for all vreinterpret intrinsics
(enum aarch64_builtins): Add vreinterpret function codes
(aarch64_init_simd_intrinsics): New
(handle_arm_neon_h): Improved comment.
(aarch64_general_fold_builtin): Fold vreinterpret calls
* config/aarch64/arm_neon.h
(vreinterpret_p8_f16, vreinterpret_p8_f64, vreinterpret_p8_s8)
(vreinterpret_p8_s16, vreinterpret_p8_s32, vreinterpret_p8_s64)
(vreinterpret_p8_f32, vreinterpret_p8_u8, vreinterpret_p8_u16)
(vreinterpret_p8_u32, vreinterpret_p8_u64, vreinterpret_p8_p16)
(vreinterpret_p8_p64, vreinterpretq_p8_f64, vreinterpretq_p8_s8)
(vreinterpretq_p8_s16, vreinterpretq_p8_s32, vreinterpretq_p8_s64)
(vreinterpretq_p8_f16, vreinterpretq_p8_f32, vreinterpretq_p8_u8)
(vreinterpretq_p8_u16, vreinterpretq_p8_u32, vreinterpretq_p8_u64)
(vreinterpretq_p8_p16, vreinterpretq_p8_p64, vreinterpretq_p8_p128)
(vreinterpret_p16_f16, vreinterpret_p16_f64, vreinterpret_p16_s8)
(vreinterpret_p16_s16, vreinterpret_p16_s32, vreinterpret_p16_s64)
(vreinterpret_p16_f32, vreinterpret_p16_u8, vreinterpret_p16_u16)
(vreinterpret_p16_u32, vreinterpret_p16_u64, vreinterpret_p16_p8)
(vreinterpret_p16_p64, vreinterpretq_p16_f64, vreinterpretq_p16_s8)
(vreinterpretq_p16_s16, vreinterpretq_p16_s32, vreinterpretq_p16_s64)
(vreinterpretq_p16_f16, vreinterpretq_p16_f32, vreinterpretq_p16_u8)
(vreinterpretq_p16_u16, vreinterpretq_p16_u32, vreinterpretq_p16_u64)
(vreinterpretq_p16_p8, vreinterpretq_p16_p64, vreinterpretq_p16_p128)
(vreinterpret_p64_f16, vreinterpret_p64_f64, vreinterpret_p64_s8)
(vreinterpret_p64_s16, vreinterpret_p64_s32, vreinterpret_p64_s64)
(vreinterpret_p64_f32, vreinterpret_p64_u8, vreinterpret_p64_u16)
(vreinterpret_p64_u32, vreinterpret_p64_u64, vreinterpret_p64_p8)
(vreinterpret_p64_p16, vreinterpretq_p64_f64, vreinterpretq_p64_s8)
(vreinterpretq_p64_s16, vreinterpretq_p64_s32, vreinterpretq_p64_s64)
(vreinterpretq_p64_f16, vreinterpretq_p64_f32, vreinterpretq_p64_p128)
(vreinterpretq_p64_u8, vreinterpretq_p64_u16, vreinterpretq_p64_p16)
(vreinterpretq_p64_u32, vreinterpretq_p64_u64, vreinterpretq_p64_p8)
(vreinterpretq_p128_p8, vreinterpretq_p128_p16, vreinterpretq_p128_f16)
(vreinterpretq_p128_f32, vreinterpretq_p128_p64, vreinterpretq_p128_s64)
(vreinterpretq_p128_u64, vreinterpretq_p128_s8, vreinterpretq_p128_s16)
(vreinterpretq_p128_s32, vreinterpretq_p128_u8, vreinterpretq_p128_u16)
(vreinterpretq_p128_u32, vreinterpret_f16_f64, vreinterpret_f16_s8)
(vreinterpret_f16_s16, vreinterpret_f16_s32, vreinterpret_f16_s64)
(vreinterpret_f16_f32, vreinterpret_f16_u8, vreinterpret_f16_u16)
(vreinterpret_f16_u32, vreinterpret_f16_u64, vreinterpret_f16_p8)
(vreinterpret_f16_p16, vreinterpret_f16_p64, vreinterpretq_f16_f64)
(vreinterpretq_f16_s8, vreinterpretq_f16_s16, vreinterpretq_f16_s32)
(vreinterpretq_f16_s64, vreinterpretq_f16_f32, vreinterpretq_f16_u8)
(vreinterpretq_f16_u16, vreinterpretq_f16_u32, vreinterpretq_f16_u64)
(vreinterpretq_f16_p8, vreinterpretq_f16_p128, vreinterpretq_f16_p16)
(vreinterpretq_f16_p64, vreinterpret_f32_f16, vreinterpret_f32_f64)
(vreinterpret_f32_s8, vreinterpret_f32_s16, vreinterpret_f32_s32)
(vreinterpret_f32_s64, vreinterpret_f32_u8, vreinterpret_f32_u16)
(vreinterpret_f32_u32, vreinterpret_f32_u64, vreinterpret_f32_p8)
(vreinterpret_f32_p16, vreinterpret_f32_p64, vreinterpretq_f32_f16)
(vreinterpretq_f32_f64, vreinterpretq_f32_s8, vreinterpretq_f32_s16)
(vreinterpretq_f32_s32, vreinterpretq_f32_s64, vreinterpretq_f32_u8)
(vreinterpretq_f32_u16, vreinterpretq_f32_u32, vreinterpretq_f32_u64)
(vreinterpretq_f32_p8, vreinterpretq_f32_p16, vreinterpretq_f32_p64)
(vreinterpretq_f32_p128, vreinterpret_f64_f16, vreinterpret_f64_f32)
(vreinterpret_f64_p8, vreinterpret_f64_p16, vreinterpret_f64_p64)
(vreinterpret_f64_s8, vreinterpret_f64_s16, vreinterpret_f64_s32)
(vreinterpret_f64_s64, vreinterpret_f64_u8, vreinterpret_f64_u16)
(vreinterpret_f64_u32, vreinterpret_f64_u64, vreinterpretq_f64_f16)
(vreinterpretq_f64_f32, vreinterpretq_f64_p8, vreinterpretq_f64_p16)
(vreinterpretq_f64_p64, vreinterpretq_f64_s8, vreinterpretq_f64_s16)
(vreinterpretq_f64_s32, vreinterpretq_f64_s64, vreinterpretq_f64_u8)
(vreinterpretq_f64_u16, vreinterpretq_f64_u32, vreinterpretq_f64_u64)
(vreinterpret_s64_f16, vreinterpret_s64_f64, vreinterpret_s64_s8)
(vreinterpret_s64_s16, vreinterpret_s64_s32, vreinterpret_s64_f32)
(vreinterpret_s64_u8, vreinterpret_s64_u16, vreinterpret_s64_u32)
(vreinterpret_s64_u64, vreinterpret_s64_p8, vreinterpret_s64_p16)
(vreinterpret_s64_p64, vreinterpretq_s64_f64, vreinterpretq_s64_s8)
(vreinterpretq_s64_s16, vreinterpretq_s64_s32, vreinterpretq_s64_f16)
(vreinterpretq_s64_f32, vreinterpretq_s64_u8, vreinterpretq_s64_u16)
(vreinterpretq_s64_u32, vreinterpretq_s64_u64, vreinterpretq_s64_p8)
(vreinterpretq_s64_p16, vreinterpretq_s64_p64, vreinterpretq_s64_p128)
(vreinterpret_u64_f16, vreinterpret_u64_f64, vreinterpret_u64_s8)
(vreinterpret_u64_s16, vreinterpret_u64_s32, vreinterpret_u64_s64)
(vreinterpret_u64_f32, vreinterpret_u64_u8, vreinterpret_u64_u16)
(vreinterpret_u64_u32, vreinterpret_u64_p8, vreinterpret_u64_p16)
(vreinterpret_u64_p64, vreinterpretq_u64_f64, vreinterpretq_u64_s8)
(vreinterpretq_u64_s16, vreinterpretq_u64_s32, vreinterpretq_u64_s64)
(vreinterpretq_u64_f16, vreinterpretq_u64_f32, vreinterpretq_u64_u8)
(vreinterpretq_u64_u16, vreinterpretq_u64_u32, vreinterpretq_u64_p8)
(vreinterpretq_u64_p16, vreinterpretq_u64_p64, vreinterpretq_u64_p128)
(vreinterpret_s8_f16, vreinterpret_s8_f64, vreinterpret_s8_s16)
(vreinterpret_s8_s32, vreinterpret_s8_s64, vreinterpret_s8_f32)
(vreinterpret_s8_u8, vreinterpret_s8_u16, vreinterpret_s8_u32)
(vreinterpret_s8_u64, vreinterpret_s8_p8, vreinterpret_s8_p16)
(vreinterpret_s8_p64, vreinterpretq_s8_f64, vreinterpretq_s8_s16)
(vreinterpretq_s8_s32, vreinterpretq_s8_s64, vreinterpretq_s8_f16)
(vreinterpretq_s8_f32, vreinterpretq_s8_u8, vreinterpretq_s8_u16)
(vreinterpretq_s8_u32, vreinterpretq_s8_u64, vreinterpretq_s8_p8)
(vreinterpretq_s8_p16, vreinterpretq_s8_p64, vreinterpretq_s8_p128)
(vreinterpret_s16_f16, vreinterpret_s16_f64, vreinterpret_s16_s8)
(vreinterpret_s16_s32, vreinterpret_s16_s64, vreinterpret_s16_f32)
(vreinterpret_s16_u8, vreinterpret_s16_u16, vreinterpret_s16_u32)
(vreinterpret_s16_u64, vreinterpret_s16_p8, vreinterpret_s16_p16)
(vreinterpret_s16_p64, vreinterpretq_s16_f64, vreinterpretq_s16_s8)
(vreinterpretq_s16_s32, vreinterpretq_s16_s64, vreinterpretq_s16_f16)
(vreinterpretq_s16_f32, vreinterpretq_s16_u8, vreinterpretq_s16_u16)
(vreinterpretq_s16_u32, vreinterpretq_s16_u64, vreinterpretq_s16_p8)
(vreinterpretq_s16_p16, vreinterpretq_s16_p64, vreinterpretq_s16_p128)
(vreinterpret_s32_f16, vreinterpret_s32_f64, vreinterpret_s32_s8)
(vreinterpret_s32_s16, vreinterpret_s32_s64, vreinterpret_s32_f32)
(vreinterpret_s32_u8, vreinterpret_s32_u16, vreinterpret_s32_u32)
(vreinterpret_s32_u64, vreinterpret_s32_p8, vreinterpret_s32_p16)
(vreinterpret_s32_p64, vreinterpretq_s32_f64, vreinterpretq_s32_s8)
(vreinterpretq_s32_s16, vreinterpretq_s32_s64, vreinterpretq_s32_f16)
(vreinterpretq_s32_f32, vreinterpretq_s32_u8, vreinterpretq_s32_u16)
(vreinterpretq_s32_u32, vreinterpretq_s32_u64, vreinterpretq_s32_p8)
(vreinterpretq_s32_p16, vreinterpretq_s32_p64, vreinterpretq_s32_p128)
(vreinterpret_u8_f16, vreinterpret_u8_f64, vreinterpret_u8_s8)
(vreinterpret_u8_s16, vreinterpret_u8_s32, vreinterpret_u8_s64)
(vreinterpret_u8_f32, vreinterpret_u8_u16, vreinterpret_u8_u32)
(vreinterpret_u8_u64, vreinterpret_u8_p8, vreinterpret_u8_p16)
(vreinterpret_u8_p64, vreinterpretq_u8_f64, vreinterpretq_u8_s8)
(vreinterpretq_u8_s16, vreinterpretq_u8_s32, vreinterpretq_u8_s64)
(vreinterpretq_u8_f16, vreinterpretq_u8_f32, vreinterpretq_u8_u16)
(vreinterpretq_u8_u32, vreinterpretq_u8_u64, vreinterpretq_u8_p8)
(vreinterpretq_u8_p16, vreinterpretq_u8_p64, vreinterpretq_u8_p128)
(vreinterpret_u16_f16, vreinterpret_u16_f64, vreinterpret_u16_s8)
(vreinterpret_u16_s16, vreinterpret_u16_s32, vreinterpret_u16_s64)
(vreinterpret_u16_f32, vreinterpret_u16_u8, vreinterpret_u16_u32)
(vreinterpret_u16_u64, vreinterpret_u16_p8, vreinterpret_u16_p16)
(vreinterpret_u16_p64, vreinterpretq_u16_f64, vreinterpretq_u16_s8)
(vreinterpretq_u16_s16, vreinterpretq_u16_s32, vreinterpretq_u16_s64)
(vreinterpretq_u16_f16, vreinterpretq_u16_f32, vreinterpretq_u16_u8)
(vreinterpretq_u16_u32, vreinterpretq_u16_u64, vreinterpretq_u16_p8)
(vreinterpretq_u16_p16, vreinterpretq_u16_p64, vreinterpretq_u16_p128)
(vreinterpret_u32_f16, vreinterpret_u32_f64, vreinterpret_u32_s8)
(vreinterpret_u32_s16, vreinterpret_u32_s32, vreinterpret_u32_s64)
(vreinterpret_u32_f32, vreinterpret_u32_u8, vreinterpret_u32_u16)
(vreinterpret_u32_u64, vreinterpret_u32_p8, vreinterpret_u32_p16)
(vreinterpret_u32_p64, vreinterpretq_u32_f64, vreinterpretq_u32_s8)
(vreinterpretq_u32_s16, vreinterpretq_u32_s32, vreinterpretq_u32_s64)
(vreinterpretq_u32_f16, vreinterpretq_u32_f32, vreinterpretq_u32_u8)
(vreinterpretq_u32_u16, vreinterpretq_u32_u64, vreinterpretq_u32_p8)
(vreinterpretq_u32_p16, vreinterpretq_u32_p64, vreinterpretq_u32_p128)
(vreinterpretq_f64_p128, vreinterpretq_p128_f64, vreinterpret_bf16_u8)
(vreinterpret_bf16_u16, vreinterpret_bf16_u32, vreinterpret_bf16_u64)
(vreinterpret_bf16_s8, vreinterpret_bf16_s16, vreinterpret_bf16_s32)
(vreinterpret_bf16_s64, vreinterpret_bf16_p8, vreinterpret_bf16_p16)
(vreinterpret_bf16_p64, vreinterpret_bf16_f16, vreinterpret_bf16_f32)
(vreinterpret_bf16_f64, vreinterpretq_bf16_u8, vreinterpretq_bf16_u16)
(vreinterpretq_bf16_u32, vreinterpretq_bf16_u64, vreinterpretq_bf16_s8)
(vreinterpretq_bf16_s16, vreinterpretq_bf16_s32, vreinterpretq_bf16_s64)
(vreinterpretq_bf16_p8, vreinterpretq_bf16_p16, vreinterpretq_bf16_p64)
(vreinterpretq_bf16_p128, vreinterpretq_bf16_f16)
(vreinterpretq_bf16_f32, vreinterpretq_bf16_f64, vreinterpret_s8_bf16)
(vreinterpret_s16_bf16, vreinterpret_s32_bf16, vreinterpret_s64_bf16)
(vreinterpret_u8_bf16, vreinterpret_u16_bf16, vreinterpret_u32_bf16)
(vreinterpret_u64_bf16, vreinterpret_f16_bf16, vreinterpret_f32_bf16)
(vreinterpret_f64_bf16, vreinterpret_p8_bf16, vreinterpret_p16_bf16)
(vreinterpret_p64_bf16, vreinterpretq_s8_bf16, vreinterpretq_s16_bf16)
(vreinterpretq_s32_bf16, vreinterpretq_s64_bf16, vreinterpretq_u8_bf16)
(vreinterpretq_u16_bf16, vreinterpretq_u32_bf16, vreinterpretq_u64_bf16)
(vreinterpretq_f16_bf16, vreinterpretq_f32_bf16, vreinterpretq_f64_bf16)
(vreinterpretq_p8_bf16, vreinterpretq_p16_bf16, vreinterpretq_p64_bf16)
(vreinterpretq_p128_bf16): Delete
gcc/config/aarch64/aarch64-builtins.cc
gcc/config/aarch64/arm_neon.h