<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - wrong code at -O1 and above on x86_64-linux-gnu in 32-bit mode (for code with the "pack" pragma and bitfields)"
href="http://llvm.org/bugs/show_bug.cgi?id=18862">bug 18862</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>michael.v.zolotukhin@gmail.com, spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>FIXED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - wrong code at -O1 and above on x86_64-linux-gnu in 32-bit mode (for code with the "pack" pragma and bitfields)"
href="http://llvm.org/bugs/show_bug.cgi?id=18862#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - wrong code at -O1 and above on x86_64-linux-gnu in 32-bit mode (for code with the "pack" pragma and bitfields)"
href="http://llvm.org/bugs/show_bug.cgi?id=18862">bug 18862</a>
from <span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span></b>
<pre>This was a bug with hoisting a shift constant value.
Solved with:
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=207692">http://llvm.org/viewvc/llvm-project?view=revision&revision=207692</a>
Reduced test case:
$ cat 18862.ll
target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
target triple = "i386-apple-macosx10.9.0"
@b = global { i32, i32, i32, i32, i8, [2 x i8] } { i32 0, i32 0, i32 0, i32 0,
i8 7, [2 x i8] undef }, align 8
define i32 @main() {
%ashr = ashr i152 0, 128
br label %for.body
for.body:
%load1 = load i152* bitcast ({ i32, i32, i32, i32, i8, [2 x i8] }* @b to
i152*), align 8
%shl2 = shl i152 %load1, 21
%ashr3 = ashr i152 %shl2, 128
%cast4 = trunc i152 %ashr3 to i32
ret i32 %cast4
}
$ ./llc -O0 18862.ll -o - | clang -Wl,-no_pie -m32 -x assembler - ; ./a.out ;
echo $?
0
$ ./llc -O2 18862.ll -o - | clang -Wl,-no_pie -m32 -x assembler - ; ./a.out ;
echo $?
255</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>