[PATCH] Warn on use of vector initializers in ARM BE mode

James Molloy james.molloy at arm.com
Thu Jun 19 00:58:11 PDT 2014


Hi,

 

The ability to use vector initializer lists is a GNU vector extension and is
unrelated to the NEON intrinsics in arm_neon.h. On little endian machines it
works fine, however on big endian machines it exhibits surprising behaviour:

    

        uint32x2_t x = {42, 64};

        return vget_lane_u32(x, 0); // Will return 64.

    

Because of this, explicitly call out that it is unsupported on big endian
machines.

    

This patch will emit the following warning in big-endian mode:

    

    test.c:3:15: warning: Vector initializers are part of the GNU vector
extensions and are not compatible with NEON intrinsics on big endian ARM
targets [-Wgnu]

   int32x4_t x = {0, 1, 2, 3};

                      ^

    test.c:3:15: note: Consider using vld1q_s32() to initialize a vector
from memory, or vcombine_s32(vcreate_s32(), vcreate_s32()) to initialize
from integer constants

    1 warning generated.

 

It's fairly simple, is it OK to commit?

 

Cheers,

 

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140619/97e041db/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-The-ability-to-use-vector-initializer-lists-is-a-GNU.patch
Type: application/octet-stream
Size: 6462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140619/97e041db/attachment.obj>


More information about the cfe-commits mailing list