[LLVMbugs] [Bug 20411] New: Incorrect behavior of shufflevector instruction. Regression from 3.4 to trunk
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jul 23 06:21:46 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20411
Bug ID: 20411
Summary: Incorrect behavior of shufflevector instruction.
Regression from 3.4 to trunk
Product: tools
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: llc
Assignee: unassignedbugs at nondot.org
Reporter: anton.mitrokhin at phystech.edu
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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'
--
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/20140723/757cd6fa/attachment.html>
More information about the llvm-bugs
mailing list