[Bug middle-end/45274] __restrict__ type qualifier does not work on pointers to bitfields

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 29 14:06:00 GMT 2016


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The alias-set issue doesn't occur since quite some time (it's using alias-set 1
for me).  Also restrict is working.

GCC 6 optimizes this on x86_64 to

foo:
.LFB0:
        .cfi_startproc
        movzbl  (%rdi), %edx
        movzbl  (%rsi), %eax
        movl    %edx, %r8d
        movl    %edx, %ecx
        andl    $-4, %eax
        andl    $1, %r8d
        andl    $2, %ecx
        orl     %r8d, %eax
        orl     %ecx, %eax
        movl    %edx, %ecx
        andl    $8, %edx
        andl    $4, %ecx
        andl    $-13, %eax
        orl     %ecx, %eax
        orl     %edx, %eax
        movb    %al, (%rsi)
        movl    (%rdi), %eax
        andl    $-16, %eax
        movl    %eax, %edx
        movl    (%rsi), %eax
        andl    $15, %eax
        orl     %edx, %eax
        movl    %eax, (%rsi)
        ret

thus it is doing a good job in piecewise copying of the struct.  It doesn't
detect that it can simply use a 32bit load/store.  But there are duplicates
in bugzilla for that issue.

Interestingly with some bitfield lowering work plus some match.pd hackery
I get that:

foo:
.LFB0:
        .cfi_startproc
        movl    (%rdi), %eax
        movl    %eax, (%rsi)
        ret

whee.


More information about the Gcc-bugs mailing list