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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com
             Status|NEW                         |ASSIGNED

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 56030
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56030&action=edit
Propsed patch

Proposed patch declares libcall algorithm unavailable to non-default address
spaces and falls back to a loop if everything else fails. The following
testcase:

--cut here--
struct a { long arr[30]; };

__thread struct a t;
void foo (struct a *dst) { *dst = t; }

__seg_gs struct a s;
void bar (struct a *dst) { *dst = s; }
--cut here--

now compiles (-O2 -mno-sse) to:

foo:
        movq    %fs:0, %rdx
        movl    $30, %ecx
        leaq    t@tpoff(%rdx), %rsi
        rep movsq
        ret

bar:
        xorl    %eax, %eax
.L4:
        movl    %eax, %edx
        addl    $8, %eax
        movq    %gs:s(%rdx), %rcx
        movq    %rcx, (%rdi,%rdx)
        cmpl    $240, %eax
        jb      .L4
        ret

(rep movsq copies only from the default ds: address space)

Reply via email to