1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-unknown -mattr=-sse4.2,+sse4.1 < %s | FileCheck %s
3
4; Make sure we don't load from the location pointed to by %p
5; twice: it has non-obvious performance implications, and
6; the relevant transformation doesn't know how to update
7; the chains correctly.
8; PR10747
9
10define <4 x i32> @test(<4 x i32>* %p) {
11; CHECK-LABEL: test:
12; CHECK:       # %bb.0:
13; CHECK-NEXT:    movaps (%rdi), %xmm0
14; CHECK-NEXT:    extractps $2, %xmm0, %eax
15; CHECK-NEXT:    cmpl $3, %eax
16; CHECK-NEXT:    je .LBB0_2
17; CHECK-NEXT:  # %bb.1:
18; CHECK-NEXT:    xorps %xmm0, %xmm0
19; CHECK-NEXT:  .LBB0_2:
20; CHECK-NEXT:    retq
21  %v = load <4 x i32>, <4 x i32>* %p
22  %e = extractelement <4 x i32> %v, i32 2
23  %cmp = icmp eq i32 %e, 3
24  %sel = select i1 %cmp, <4 x i32> %v, <4 x i32> zeroinitializer
25  ret <4 x i32> %sel
26}
27