<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Incorrect behavior of shufflevector instruction. Regression from 3.4 to trunk"
href="http://llvm.org/bugs/show_bug.cgi?id=20411">20411</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect behavior of shufflevector instruction. Regression from 3.4 to trunk
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>llc
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>anton.mitrokhin@phystech.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Reproducer:
coal.ll:
target datalayout =
"e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
define void @f_f(i32* noalias nocapture %RET) #1 {
%gather_load = shufflevector <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4,
i32 5, i32 6, i32 7>, <8 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3,
i32 4, i32 5, i32 6, i32 7>
%shuffle109 = shufflevector <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>
undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> ; 4 5 6 7
%shuffle116 = shufflevector <8 x i32> %gather_load, <8 x i32> undef, <4 x
i32> <i32 3, i32 undef, i32 undef, i32 undef> ; 3 x x x
%shuffle117 = shufflevector <4 x i32> %shuffle109, <4 x i32> %shuffle116, <4
x i32> <i32 4, i32 3, i32 undef, i32 undef> ; 3 7 x x
%ptrcast = bitcast i32* %RET to <4 x i32>*
store <4 x i32> %shuffle117, <4 x i32>* %ptrcast, align 4
ret void
}
coal.cpp:
#include <stdio.h>
extern "C" {
extern void f_f(int *result);
}
int main(int argc, char *argv[]) {
int returned_result[4];
f_f(returned_result);
printf("\n");
printf("res[0] = %d\n", returned_result[0]);
printf("res[1] = %d\n", returned_result[1]);
printf("res[2] = %d\n", returned_result[2]);
printf("res[3] = %d\n", returned_result[3]);
return 0;
}
if we execute:
bin-3.4/bin/llc coal.ll -o coal.s
clang++ coal.cpp coal.s
./a.out
we will have:
res[0] = 3
res[1] = 7
res[2] = 7
res[3] = 7
however:
bin-trunk/bin/llc coal.ll -o coal.s --mattr='+sse4.1'
clang++ coal.cpp coal.s
./a.out
we will have:
res[0] = 3
res[1] = 5
res[2] = 6
res[3] = 7
While res[2] and res[3] are set to 'undef', res[1] should be '7' and it is '5'</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>