Hi all,

Please disregard patch v2, some necessary changes have become apparent after 
submission.
I will make these changes and submit as patch v3.

Apologies,
Richard Ball

-----Original Message-----
From: Richard Ball <richard.b...@arm.com> 
Sent: Friday, October 27, 2023 6:18 PM
To: gcc-patches@gcc.gnu.org; Richard Earnshaw <richard.earns...@arm.com>; 
Richard Sandiford <richard.sandif...@arm.com>; Kyrylo Tkachov 
<kyrylo.tkac...@arm.com>; Marcus Shawcroft <marcus.shawcr...@arm.com>
Subject: [PATCH v2] aarch64: SVE/NEON Bridging intrinsics

ACLE has added intrinsics to bridge between SVE and Neon.

The NEON_SVE Bridge adds intrinsics that allow conversions between NEON and SVE 
vectors.

This patch adds support to GCC for the following 3 intrinsics:
svset_neonq, svget_neonq and svdup_neonq

gcc/ChangeLog:

        * config.gcc: Adds new header to config.
        * config/aarch64/aarch64-builtins.cc (enum aarch64_type_qualifiers):
        Moved to header file.
        (ENTRY): Likewise.
        (enum aarch64_simd_type): Likewise.
        (struct aarch64_simd_type_info): Make extern.
        (GTY): Likewise.
        * config/aarch64/aarch64-c.cc (aarch64_pragma_aarch64):
        Defines pragma for arm_neon_sve_bridge.h.
        * config/aarch64/aarch64-protos.h: New function.
        * config/aarch64/aarch64-sve-builtins-base.h: New intrinsics.
        * config/aarch64/aarch64-sve-builtins-base.cc
        (class svget_neonq_impl): New intrinsic implementation.
        (class svset_neonq_impl): Likewise.
        (class svdup_neonq_impl): Likewise.
        (NEON_SVE_BRIDGE_FUNCTION): New intrinsics.
        * config/aarch64/aarch64-sve-builtins-functions.h
        (NEON_SVE_BRIDGE_FUNCTION): Defines macro for NEON_SVE_BRIDGE
        functions.
        * config/aarch64/aarch64-sve-builtins-shapes.h: New shapes.
        * config/aarch64/aarch64-sve-builtins-shapes.cc
        (parse_element_type): Add NEON element types.
        (parse_type): Likewise.
        (struct get_neonq_def): Defines function shape for get_neonq.
        (struct set_neonq_def): Defines function shape for set_neonq.
        (struct dup_neonq_def): Defines function shape for dup_neonq.
        * config/aarch64/aarch64-sve-builtins.cc (DEF_SVE_TYPE_SUFFIX):
        (DEF_SVE_NEON_TYPE_SUFFIX): Defines 
        macro for NEON_SVE_BRIDGE type suffixes.
        (DEF_NEON_SVE_FUNCTION): Defines 
        macro for NEON_SVE_BRIDGE functions.
        (function_resolver::infer_neon128_vector_type): Infers type suffix
        for overloaded functions.
        (init_neon_sve_builtins): Initialise neon_sve_bridge_builtins for LTO.
        (handle_arm_neon_sve_bridge_h): Handles #pragma arm_neon_sve_bridge.h.
        * config/aarch64/aarch64-sve-builtins.def
        (DEF_SVE_NEON_TYPE_SUFFIX): Macro for handling neon_sve type suffixes.
        (bf16): Replace entry with neon-sve entry.
        (f16): Likewise.
        (f32): Likewise.
        (f64): Likewise.
        (s8): Likewise.
        (s16): Likewise.
        (s32): Likewise.
        (s64): Likewise.
        (u8): Likewise.
        (u16): Likewise.
        (u32): Likewise.
        (u64): Likewise.
        * config/aarch64/aarch64-sve-builtins.h
        (GCC_AARCH64_SVE_BUILTINS_H): Include aarch64-builtins.h.
        (ENTRY): Add aarch64_simd_type definiton.
        (enum aarch64_simd_type): Add neon information to type_suffix_info.
        (struct type_suffix_info): New function.
        * config/aarch64/aarch64-sve.md
        (@aarch64_sve_get_neonq_<mode>): New intrinsic insn for big endian.
        (@aarch64_sve_set_neonq_<mode>): Likewise.
        (@aarch64_sve_dup_neonq_<mode>): Likewise.
        * config/aarch64/aarch64.cc (aarch64_init_builtins):
        Add call to init_neon_sve_builtins.
        * config/aarch64/iterators.md: Add UNSPEC_SET_NEONQ.
        * config/aarch64/aarch64-builtins.h: New file.
        * config/aarch64/aarch64-neon-sve-bridge-builtins.def: New file.
        * config/aarch64/arm_neon_sve_bridge.h: New file.

gcc/testsuite/ChangeLog:

        * gcc.target/aarch64/sve/acle/asm/test_sve_acle.h: Add include 
        arm_neon_sve_bridge header file
        * gcc.dg/torture/neon-sve-bridge.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_bf16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_f16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_f32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_f64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_s16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_s32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_s64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_s8.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_u16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_u32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_u64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/dup_neonq_u8.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_bf16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_f16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_f32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_f64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_s16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_s32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_s64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_s8.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_u16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_u32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_u64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/get_neonq_u8.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_bf16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_f16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_f32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_f64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_s16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_s32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_s64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_s8.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_u16.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_u32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_u64.c: New test.
        * gcc.target/aarch64/sve/acle/asm/set_neonq_u8.c: New test.
        * gcc.target/aarch64/sve/acle/general-c/dup_neonq_1.c: New test.
        * gcc.target/aarch64/sve/acle/general-c/get_neonq_1.c: New test.
        * gcc.target/aarch64/sve/acle/general-c/set_neonq_1.c: New test.

Reply via email to