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