[llvm-bugs] [Bug 35681] New: [x86] large constant offsets used for memory accesses in loop
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Dec 17 08:03:35 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35681
Bug ID: 35681
Summary: [x86] large constant offsets used for memory accesses
in loop
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
Forking this off from bug 28343:
$ cat badmax.c
void maxArray(double* __restrict x, double* __restrict y) {
for (int i = 0; i < 65536; i++) x[i] = ((y[i] > x[i]) ? y[i] : x[i]);
}
Or as IR compiled as:
$ ./clang badmax.c -S -o - -O2 -fno-unroll-loops -emit-llvm
define void @maxArray(double* noalias nocapture %x, double* noalias nocapture
readonly %y) {
entry:
br label %vector.body
vector.body:
%index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
%0 = getelementptr inbounds double, double* %y, i64 %index
%1 = bitcast double* %0 to <2 x double>*
%wide.load = load <2 x double>, <2 x double>* %1, align 8
%2 = getelementptr inbounds double, double* %x, i64 %index
%3 = bitcast double* %2 to <2 x double>*
%wide.load21 = load <2 x double>, <2 x double>* %3, align 8
%4 = fcmp ogt <2 x double> %wide.load, %wide.load21
%5 = select <2 x i1> %4, <2 x double> %wide.load, <2 x double> %wide.load21
%6 = bitcast double* %2 to <2 x double>*
store <2 x double> %5, <2 x double>* %6, align 8
%index.next = add i64 %index, 2
%7 = icmp eq i64 %index.next, 65536
br i1 %7, label %for.cond.cleanup, label %vector.body
for.cond.cleanup:
ret void
}
-----------------------------------------------------------------------------
$ ./llc -o - badmax.ll -mtriple=x86_64
movq $-524288, %rax # imm = 0xFFF80000
.p2align 4, 0x90
.LBB0_1:
movupd 524288(%rsi,%rax), %xmm0
movupd 524288(%rdi,%rax), %xmm1
maxpd %xmm1, %xmm0
movupd %xmm0, 524288(%rdi,%rax)
addq $16, %rax
jne .LBB0_1
retq
--
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/20171217/9c970976/attachment.html>
More information about the llvm-bugs
mailing list