[PATCH][RFC] Come up with TARGET_HAS_FAST_MEMPCPY_ROUTINE (PR middle-end/90263).

Martin Liška mliska@suse.cz
Fri May 10 09:04:00 GMT 2019


Hi.

This is updated version of the patch I've sent here:
https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00149.html

The patch is about introduction of a new target macro that will
drive how we expand mempcpy. Having a target with TARGET_HAS_FAST_MEMPCPY_ROUTINE == 1,
we do not expand using memcpy, but mempcy.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

@Wilco: Can you please come up with a test-case for aarch64?

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-05-09  Martin Liska  <mliska@suse.cz>

	PR middle-end/90263
	* builtins.c (expand_builtin_memory_copy_args): When having a
	target with fast mempcpy implementation do now use memcpy.
	* config/i386/i386.h (TARGET_HAS_FAST_MEMPCPY_ROUTINE): New.
	* defaults.h (TARGET_HAS_FAST_MEMPCPY_ROUTINE): By default
	target does not have fast mempcpy routine.
	* doc/tm.texi: Document the new hook.
	* doc/tm.texi.in: Likewise.
	* expr.h (emit_block_move_hints): Add 2 new arguments.
	* expr.c (emit_block_move_hints): Bail out when libcall
	to memcpy would be used.

gcc/testsuite/ChangeLog:

2019-05-09  Martin Liska  <mliska@suse.cz>

	* gcc.c-torture/execute/builtins/mempcpy.c: Use mempcpy
	without LHS.
---
 gcc/builtins.c                                 | 18 ++++++++++++++++--
 gcc/config/i386/i386.h                         |  3 +++
 gcc/defaults.h                                 |  7 +++++++
 gcc/doc/tm.texi                                |  5 +++++
 gcc/doc/tm.texi.in                             |  5 +++++
 gcc/expr.c                                     | 13 ++++++++++++-
 gcc/expr.h                                     |  4 +++-
 .../gcc.c-torture/execute/builtins/mempcpy.c   |  5 ++---
 8 files changed, 53 insertions(+), 7 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Come-up-with-TARGET_HAS_FAST_MEMPCPY_ROUTINE-PR-midd.patch
Type: text/x-patch
Size: 6260 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190510/f9d4807c/attachment.bin>


More information about the Gcc-patches mailing list