[llvm-bugs] [Bug 33958] New: Store widening makes this code unnecessarily complicated

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 26 17:17:50 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33958

            Bug ID: 33958
           Summary: Store widening makes this code unnecessarily
                    complicated
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at lists.llvm.org

$ cat /tmp/a.c
extern int a, b;

void f(int **p) {
  p[0] = &a;
  p[1] = &b;
}

$ gcc -Os -c /tmp/a.c && objdump -dr a.o

a.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <f>:
   0:   48 c7 07 00 00 00 00    movq   $0x0,(%rdi)
                        3: R_X86_64_32S a
   7:   48 c7 47 08 00 00 00    movq   $0x0,0x8(%rdi)
   e:   00 
                        b: R_X86_64_32S b
   f:   c3

$ bin/clang -Os -c /tmp/a.c && objdump -dr a.o

a.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <f>:
   0:   b8 00 00 00 00          mov    $0x0,%eax
                        1: R_X86_64_32  b
   5:   66 48 0f 6e c0          movq   %rax,%xmm0
   a:   b8 00 00 00 00          mov    $0x0,%eax
                        b: R_X86_64_32  a
   f:   66 48 0f 6e c8          movq   %rax,%xmm1
  14:   66 0f 6c c8             punpcklqdq %xmm0,%xmm1
  18:   f3 0f 7f 0f             movdqu %xmm1,(%rdi)
  1c:   c3                      retq


Doing a 128-bit write is cool, but it's probably not worth it here, especially
when trying to optimize for size :-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170727/00919441/attachment-0001.html>


More information about the llvm-bugs mailing list