<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang automatically adds alignment hints to neon code"
   href="https://llvm.org/bugs/show_bug.cgi?id=24421">24421</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang automatically adds alignment hints to neon code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>johannkoenig@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14717" name="attach_14717" title="Force unaligned access">attachment 14717</a> <a href="attachment.cgi?id=14717&action=edit" title="Force unaligned access">[details]</a></span>
Force unaligned access

In libvpx we have disabled vp8_bilinear_predict4x4_neon (and the sixtap 4x4)
because of issues with clang. At first it was only the Apple version but it is
now in the versions being tested by Chromium.

When presented with
src0 = vld1_lane_u32((const uint32_t *)src_ptr, src0, 0);

clang will automatically add a 32 bit alignment:
vld1.32    {d18[0]}, [r0:32]

whether or not it is safe to do so. In this particular case it is much easier
(and substantially faster) to cast and load 4 bytes instead of 4 individual 1
byte loads.

<a href="https://code.google.com/p/webm/issues/detail?id=817">https://code.google.com/p/webm/issues/detail?id=817</a>
<a href="https://chromium.googlesource.com/webm/libvpx/+/master/vp8/common/arm/neon/sixtappredict_neon.c">https://chromium.googlesource.com/webm/libvpx/+/master/vp8/common/arm/neon/sixtappredict_neon.c</a>

<a href="https://code.google.com/p/webm/issues/detail?id=892">https://code.google.com/p/webm/issues/detail?id=892</a>
<a href="https://chromium.googlesource.com/webm/libvpx/+/master/vp8/common/arm/neon/bilinearpredict_neon.c">https://chromium.googlesource.com/webm/libvpx/+/master/vp8/common/arm/neon/bilinearpredict_neon.c</a>

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
-arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
-DNDEBUG -O3 -fno-strict-aliasing -c -o bug.c.o bug.c

Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix

$ otool -tv bug.c.o                                                             
bug.c.o:
(__TEXT,__text) section
_main:
00000000        2000    movs    r0, #0x0
00000002        4770    bx    lr
_bug:
00000004    f1000212    add.w    r2, r0, #0x12
00000008    f9e0283f    vld1.32    {d18[0]}, [r0:32]
0000000c    f9e2083f    vld1.32    {d16[0]}, [r2:32]
00000010    f100021b    add.w    r2, r0, #0x1b
00000014        3009    adds    r0, #0x9
00000016    f9e208bf    vld1.32    {d16[1]}, [r2:32]
0000001a    f9e028bf    vld1.32    {d18[1]}, [r0:32]
0000001e    f1010009    add.w    r0, r1, #0x9
00000022    ff4208a0    vsub.i8    d16, d18, d16
00000026    f9c1083f    vst1.32    {d16[0]}, [r1:32]
0000002a    f9c008bf    vst1.32    {d16[1]}, [r0:32]
0000002e    ef200110    vorr    d0, d0, d0
00000032        4770    bx    lr</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>