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

Andrea Corallo andrea.corallo@arm.com
Mon Jun 22 08:21:12 GMT 2020


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

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.

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.
        * 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: 19856 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200622/51ca0c0f/attachment-0001.bin>


More information about the Gcc-patches mailing list