[PATCH v4] arm: Implement Armv8.1-M low overhead loops

Andrea Corallo andrea.corallo@arm.com
Wed Jun 24 10:04:19 GMT 2020


Andrea Corallo <andrea.corallo@arm.com> writes:

> Hi all,
>
> here the latest version of the patch to enable Armv8.1-M Mainline
> LOB (low overhead branch) extension low overhead loops (LOL) feature
> using the 'loop-doloop' pass.
>
> I posted a previous version of it during stage 4.
>
> Given the following function:
>
> void
> loop (int *a)
> {
>   for (int i = 0; i < 1000; i++)
>     a[i] = i;
> }
>
> 'doloop_begin' and 'doloop_end' patterns translates into 'dls' and 'le'
> giving:
>
>  loop:
>          movw    r2, #10000
>          movs    r3, #0
>          subs    r0, r0, #4
>          push    {lr}
>          dls     lr, r2
>  .L2:
>          str     r3, [r0, #4]!
>          adds    r3, r3, #1
>          le      lr, .L2
>          ldr     pc, [sp], #4
>
> bootstrapped arm-none-linux-gnueabihf, does not introduce testsuite regressions.
>
> Andrea

Hi,

double checking I spotted another test impacted by the patch that I
missed as first.

Here the updated patch waving the check.

  Andrea

gcc/ChangeLog

2020-06-18  Andrea Corallo  <andrea.corallo@arm.com>
            Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
            Iain Apreotesei  <iain.apreotesei@arm.com>

	* config/arm/arm-protos.h (arm_target_insn_ok_for_lob): New
	prototype.
        * config/arm/arm.c (TARGET_INVALID_WITHIN_DOLOOP): Define.
        (arm_invalid_within_doloop): Implement invalid_within_doloop hook.
	(arm_target_insn_ok_for_lob): New function.
        * config/arm/arm.h (TARGET_HAVE_LOB): Define macro.
        * config/arm/thumb2.md (*doloop_end_internal, doloop_begin)
	(dls_insn): Add new patterns.
	(doloop_end): Modify to select LR when LOB is available.
        * config/arm/unspecs.md: Add new unspec.
        * doc/sourcebuild.texi (arm_v8_1_lob_ok)
	(arm_thumb2_ok_no_arm_v8_1_lob): Document new target supports
	options.

gcc/testsuite/ChangeLog

2020-06-18  Andrea Corallo  <andrea.corallo@arm.com>
            Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
            Iain Apreotesei  <iain.apreotesei@arm.com>

        * gcc.target/arm/lob.h: New header.
        * gcc.target/arm/lob1.c: New testcase.
        * gcc.target/arm/lob2.c: Likewise.
        * gcc.target/arm/lob3.c: Likewise.
        * gcc.target/arm/lob4.c: Likewise.
        * gcc.target/arm/lob5.c: Likewise.
        * gcc.target/arm/lob6.c: Likewise.
	* gcc.target/arm/unsigned-extend-2.c: Do not run when generating
	low loop overhead.
	* gcc.target/arm/ivopts.c: Fix check for low loop overhead.
        * lib/target-supports.exp (check_effective_target_arm_v8_1_lob)
	(check_effective_target_arm_thumb2_ok_no_arm_v8_1_lob): New procs.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-arm-Implement-Armv8.1-M-low-overhead-loops.patch
Type: text/x-diff
Size: 20694 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200624/cd4d468b/attachment-0001.bin>


More information about the Gcc-patches mailing list