]> git.ipfire.org Git - thirdparty/gcc.git/commit
arm: Add support for MVE Tail-Predicated Low Overhead Loops
authorAndre Vieira <andre.simoesdiasvieira@arm.com>
Wed, 19 Jun 2024 16:05:55 +0000 (17:05 +0100)
committerAndre Vieira <andre.simoesdiasvieira@arm.com>
Wed, 19 Jun 2024 16:11:17 +0000 (17:11 +0100)
commit3dfc28dbbd21b1d708aa40064380ef4c42c994d7
tree340ee5cc055032837da2506ebaa808675f63eaad
parent5d0c1b4e0d33c2d1077264636d0a65ce206d0d96
arm: Add support for MVE Tail-Predicated Low Overhead Loops

This patch adds support for MVE Tail-Predicated Low Overhead Loops by using the
doloop funcitonality added to support predicated vectorized hardware loops.

gcc/ChangeLog:

* config/arm/arm-protos.h (arm_target_bb_ok_for_lob): Change
declaration to pass basic_block.
(arm_attempt_dlstp_transform): New declaration.
* config/arm/arm.cc (TARGET_LOOP_UNROLL_ADJUST): Define targethook.
(TARGET_PREDICT_DOLOOP_P): Likewise.
(arm_target_bb_ok_for_lob): Adapt condition.
(arm_mve_get_vctp_lanes): New function.
(arm_dl_usage_type): New internal enum.
(arm_get_required_vpr_reg): New function.
(arm_get_required_vpr_reg_param): New function.
(arm_get_required_vpr_reg_ret_val): New function.
(arm_mve_get_loop_vctp): New function.
(arm_mve_insn_predicated_by): New function.
(arm_mve_across_lane_insn_p): New function.
(arm_mve_load_store_insn_p): New function.
(arm_mve_impl_pred_on_outputs_p): New function.
(arm_mve_impl_pred_on_inputs_p): New function.
(arm_last_vect_def_insn): New function.
(arm_mve_impl_predicated_p): New function.
(arm_mve_check_reg_origin_is_num_elems): New function.
(arm_mve_dlstp_check_inc_counter): New function.
(arm_mve_dlstp_check_dec_counter): New function.
(arm_mve_loop_valid_for_dlstp): New function.
(arm_predict_doloop_p): New function.
(arm_loop_unroll_adjust): New function.
(arm_emit_mve_unpredicated_insn_to_seq): New function.
(arm_attempt_dlstp_transform): New function.
* config/arm/arm.opt (mdlstp): New option.
* config/arm/iterators.md (dlstp_elemsize, letp_num_lanes,
letp_num_lanes_neg, letp_num_lanes_minus_1): New attributes.
(DLSTP, LETP): New iterators.
* config/arm/mve.md (predicated_doloop_end_internal<letp_num_lanes>,
dlstp<dlstp_elemsize>_insn): New insn patterns.
* config/arm/thumb2.md (doloop_end): Adapt to support tail-predicated
loops.
(doloop_begin): Likewise.
* config/arm/types.md (mve_misc): New mve type to represent
predicated_loop_end insn sequences.
* config/arm/unspecs.md:
(DLSTP8, DLSTP16, DLSTP32, DSLTP64,
LETP8, LETP16, LETP32, LETP64): New unspecs for DLSTP and LETP.

gcc/testsuite/ChangeLog:

* gcc.target/arm/lob.h: Add new helpers.
* gcc.target/arm/lob1.c: Use new helpers.
* gcc.target/arm/lob6.c: Likewise.
* gcc.target/arm/mve/dlstp-compile-asm-1.c: New test.
* gcc.target/arm/mve/dlstp-compile-asm-2.c: New test.
* gcc.target/arm/mve/dlstp-compile-asm-3.c: New test.
* gcc.target/arm/mve/dlstp-int8x16.c: New test.
* gcc.target/arm/mve/dlstp-int8x16-run.c: New test.
* gcc.target/arm/mve/dlstp-int16x8.c: New test.
* gcc.target/arm/mve/dlstp-int16x8-run.c: New test.
* gcc.target/arm/mve/dlstp-int32x4.c: New test.
* gcc.target/arm/mve/dlstp-int32x4-run.c: New test.
* gcc.target/arm/mve/dlstp-int64x2.c: New test.
* gcc.target/arm/mve/dlstp-int64x2-run.c: New test.
* gcc.target/arm/mve/dlstp-invalid-asm.c: New test.

Co-authored-by: Stam Markianos-Wright <stam.markianos-wright@arm.com>
23 files changed:
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.cc
gcc/config/arm/arm.opt
gcc/config/arm/iterators.md
gcc/config/arm/mve.md
gcc/config/arm/thumb2.md
gcc/config/arm/types.md
gcc/config/arm/unspecs.md
gcc/testsuite/gcc.target/arm/lob.h
gcc/testsuite/gcc.target/arm/lob1.c
gcc/testsuite/gcc.target/arm/lob6.c
gcc/testsuite/gcc.target/arm/mve/dlstp-compile-asm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-compile-asm-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-compile-asm-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int16x8-run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int16x8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int32x4-run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int32x4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int64x2-run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int64x2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int8x16-run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-int8x16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/dlstp-invalid-asm.c [new file with mode: 0644]