Hi Kyrill,
On 8/8/2024 4:23 PM, Kyrylo Tkachov wrote:
Hi Saurabh,
On 7 Aug 2024, at 17:11, saurabh....@arm.com wrote:
External email: Use caution opening links or attachments
The AArch64 FEAT_FAMINMAX extension is optional from Armv9.2-a and
mandatory from Armv9.5-a. It introduces instructions for computing the
floating point absolute maximum and minimum of the two vectors element-wise.
This patch does two things:
1. Introduces AdvSIMD faminmax intrinsics.
2. Move report_missing_extension and reported_missing_extension_p to
make it more usable.
The intrinsics of this extension are implemented as the following
builtin functions:
* vamax_f16
* vamaxq_f16
* vamax_f32
* vamaxq_f32
* vamaxq_f64
* vamin_f16
* vaminq_f16
* vamin_f32
* vaminq_f32
* vaminq_f64
We moved the definition of `report_missing_extension` from
gcc/config/aarch64/aarch64-sve-builtins.cc to
gcc/config/aarch64/aarch64-builtins.cc and its declaration to
gcc/config/aarch64/aarch64-builtins.h. We also moved the declaration
of `reported_missing_extension_p` from
gcc/config/aarch64/aarch64-sve-builtins.cc
to gcc/config/aarch64/aarch64-builtins.cc, closer to the definition of
`report_missing_extension`. In the exsiting code structure, this leads
to `report_missing_extension` being usable from both normal builtins
and sve builtins.
gcc/ChangeLog:
* config/aarch64/aarch64-builtins.cc
(enum aarch64_builtins): New enum values for faminmax builtins.
(aarch64_init_faminmax_builtins): New function to declare new
builtins.
(handle_arm_neon_h): Modify to call
aarch64_init_faminmax_builtins.
(aarch64_general_check_builtin_call): Modify to check whether
+faminmax flag is being used and printing error message if not being
used.
(aarch64_expand_builtin_faminmax): New function to emit
instructions of this extension.
(aarch64_general_expand_builtin): Modify to call
aarch64_expand_builtin_faminmax.
(report_missing_extension): Move from
config/aarch64/aarch64-sve-builtins.cc.
* config/aarch64/aarch64-builtins.h
(report_missing_extension): Declaration for this function so
that it can be used wherever this header is included.
(reported_missing_extension_p): Move from
config/aarch64/aarch64-sve-builtins.cc
* config/aarch64/aarch64-option-extensions.def
(AARCH64_OPT_EXTENSION): Introduce new flag for this
extension.
* config/aarch64/aarch64-simd.md
(aarch64_<faminmax_uns_op><mode>): Instruction pattern for
faminmax intrinsics.
* config/aarch64/aarch64-sve-builtins.cc
(reported_missing_extension_p): Move to
config/aarch64/aarch64-builtins.c
(report_missing_extension): Move to
config/aarch64/aarch64-builtins.cc
* config/aarch64/aarch64.h
(TARGET_FAMINMAX): Introduce new flag for this extension.
* config/aarch64/iterators.md: Introduce new iterators for
faminmax intrinsics.
* config/arm/types.md: Introduce neon_fp_aminmax<q> attributes.
* doc/invoke.texi: Document extension in AArch64 Options.
Thank you for the updates.
It seems now that the report_missing_extensions refactoring is also done by
Andrew’s patch at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-August/659875.html
Looks like you’ll need to coordinate on how to land this change.
I think Andrew’s changes should go in first and this patch to be rebased on top
of that.
Otherwise ok.
Thanks,
Kyrill
Sounds good. I can wait for that series to go in. I'll then rebase with
the latest master and send a new version of my patch series.
Thank you,
Saurabh
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/simd/faminmax-builtins-no-flag.c: New test.
* gcc.target/aarch64/simd/faminmax-builtins.c: New test.
---
gcc/config/aarch64/aarch64-builtins.cc | 173 +++++++++++++++++-
gcc/config/aarch64/aarch64-builtins.h | 5 +-
.../aarch64/aarch64-option-extensions.def | 2 +
gcc/config/aarch64/aarch64-simd.md | 11 ++
gcc/config/aarch64/aarch64-sve-builtins.cc | 22 ---
gcc/config/aarch64/aarch64.h | 4 +
gcc/config/aarch64/iterators.md | 9 +
gcc/config/arm/types.md | 6 +
gcc/doc/invoke.texi | 2 +
.../aarch64/simd/faminmax-builtins-no-flag.c | 10 +
.../aarch64/simd/faminmax-builtins.c | 115 ++++++++++++
11 files changed, 327 insertions(+), 32 deletions(-)
create mode 100644
gcc/testsuite/gcc.target/aarch64/simd/faminmax-builtins-no-flag.c
create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/faminmax-builtins.c