xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/2011-12-26-extractelement-duplicate-load.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=x86-64 -mattr=-sse4.2,+sse4.1 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; Make sure we don't load from the location pointed to by %p
3*9880d681SAndroid Build Coastguard Worker; twice: it has non-obvious performance implications, and
4*9880d681SAndroid Build Coastguard Worker; the relevant transformation doesn't know how to update
5*9880d681SAndroid Build Coastguard Worker; the chains correctly.
6*9880d681SAndroid Build Coastguard Worker; PR10747
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test:
9*9880d681SAndroid Build Coastguard Worker; CHECK: pextrd $2, %xmm
10*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @test(<4 x i32>* %p) {
11*9880d681SAndroid Build Coastguard Worker  %v = load <4 x i32>, <4 x i32>* %p
12*9880d681SAndroid Build Coastguard Worker  %e = extractelement <4 x i32> %v, i32 2
13*9880d681SAndroid Build Coastguard Worker  %cmp = icmp eq i32 %e, 3
14*9880d681SAndroid Build Coastguard Worker  %sel = select i1 %cmp, <4 x i32> %v, <4 x i32> zeroinitializer
15*9880d681SAndroid Build Coastguard Worker  ret <4 x i32> %sel
16*9880d681SAndroid Build Coastguard Worker}
17