[llvm-bugs] [Bug 24421] New: Clang automatically adds alignment hints to neon code

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 10 12:48:03 PDT 2015


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

            Bug ID: 24421
           Summary: Clang automatically adds alignment hints to neon code
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: johannkoenig at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 14717
  --> https://llvm.org/bugs/attachment.cgi?id=14717&action=edit
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.

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

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

/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

-- 
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/20150810/1efed09a/attachment.html>


More information about the llvm-bugs mailing list