Hi Martin,

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

However I guess some existing tests checking for mempcpy may fail on
other targets, so might need to be changed.

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

A simplified version gcc/testsuite/gcc.dg/fold-bcopy.c should be good enough
if existing tests don't provide enough cover. Literally just compiling the 
example
I gave and checking it calls memcpy using a target exclude will do, eg.

int *f (int *p, int *q, long n)
{
  return __builtin_mempcpy (p, q, n);
}

/* { dg-final { scan-assembler "mempcpy" { target { i?86-*-* x86_64-*-* } } } } 
*/
/* { dg-final { scan-assembler "memcpy" { target { ! { i?86-*-* x86_64-*-* } } 
} } } */

Wilco

Reply via email to