https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90263

--- Comment #18 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #14)
> Created attachment 46262 [details]
> Patch candidate
> 
> Patch candidate that handles:
> 
> $ cat ~/Programming/testcases/mempcpy.c
> int *mempcopy2 (int *p, int *q, long n)
> {
>   return __builtin_mempcpy (p, q, n);
> }
> 
> $ ./xgcc -B. -O2 -S ~/Programming/testcases/mempcpy.c -o/dev/stdout
> ...
> mempcopy2:
> .LFB0:
>       .cfi_startproc
>       pushq   %rbx
>       .cfi_def_cfa_offset 16
>       .cfi_offset 3, -16
>       movq    %rdx, %rbx
>       call    memcpy
>       addq    %rbx, %rax
>       popq    %rbx
>       .cfi_def_cfa_offset 8
>       ret
> ...
> 
> There's a single failing test: gcc.dg/20050503-1.c

On AArch64 it calls mempcpy but memcpy on x86, which is the wrong way around...

-  if (retmode == RETURN_END && target != const0_rtx)
+  if (!TARGET_HAS_FAST_MEMPCPY_ROUTINE && retmode == RETURN_END && target !=
const0_rtx)

When I uncomment this, it uses memcpy. Also:

+                                    TARGET_HAS_FAST_MEMPCPY_ROUTINE
+                                    && retmode == RETURN_END_MINUS_ONE,
+                                    &is_move_done);

Should that be RETURN_END? And is_move_done isn't used, is that right?

Reply via email to