[LLVMbugs] [Bug 17770] New: clang: Alignment causing wrong results
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Nov 1 10:46:03 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=17770
Bug ID: 17770
Summary: clang: Alignment causing wrong results
Product: clang
Version: 3.3
Hardware: Other
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: ted at krovetz.net
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The following code, compiled as "clang -O0 -mfpu=neon tst.c", causes 0 to be
output when run on a Cortex-A9 with current Arch Linux. Under gcc it outputs 11
(which is correct). When I add "__attribute__ ((aligned(16)))" in front of any
of the arrays declared in main(), clang code also returns 11.
Since all pointers are element aligned, I didn't expect this behavior.
#include <arm_neon.h>
#include <stdio.h>
void nh(unsigned long long *hp, unsigned *kp, unsigned *mp) {
uint32x4_t k = *(uint32x4_t *)kp;
uint32x4_t m = *(uint32x4_t *)mp;
uint64x2_t a = vmovq_n_u64(0);
a = vmlal_u32(a, vget_high_u32(k + m), vget_low_u32(k + m));
hp[0] = (unsigned long long)(vget_high_u64(a) + vget_low_u64(a));
}
int main() {
unsigned k[4] = {0,0,0,0};
unsigned m[4] = {1,2,3,4};
unsigned long long h[2] = {0};
nh(h,k,m);
printf("%llu\n",h[0]);
return 0;
}
--
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/20131101/74e1b17b/attachment.html>
More information about the llvm-bugs
mailing list