xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/extractelement-shuffle.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s
2*9880d681SAndroid Build Coastguard Worker; REQUIRES: default_triple
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Examples that exhibits a bug in DAGCombine.  The case is triggered by the
5*9880d681SAndroid Build Coastguard Worker; following program.  The bug is DAGCombine assumes that the bit convert
6*9880d681SAndroid Build Coastguard Worker; preserves the number of elements so the optimization code tries to read
7*9880d681SAndroid Build Coastguard Worker; through the 3rd mask element, which doesn't exist.
8*9880d681SAndroid Build Coastguard Workerdefine i32 @update(<2 x i64> %val1, <2 x i64> %val2) nounwind readnone {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker	%shuf = shufflevector <2 x i64> %val1, <2 x i64> %val2, <2 x i32> <i32 0, i32 3>
11*9880d681SAndroid Build Coastguard Worker	%bit  = bitcast <2 x i64> %shuf to <4 x i32>
12*9880d681SAndroid Build Coastguard Worker	%res =  extractelement <4 x i32> %bit, i32 3
13*9880d681SAndroid Build Coastguard Worker	ret i32 %res
14*9880d681SAndroid Build Coastguard Worker}
15