1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3 ; When the extractelement is converted to a load the store can be re-used.
4 ; This will, however, introduce a cycle into the selection DAG (the load
5 ; of the extractelement index is dependent on the store, and so after the
6 ; conversion it becomes dependent on the new load, which is dependent on
7 ; the index). Make sure we skip the store, and conservatively instead
8 ; use a store to the stack.
10 define float @foo(ptr %i, ptr %v) {
12 ; CHECK: movaps %xmm0, -[[OFFSET:[0-9]+]](%rsp)
13 ; CHECK: movss -[[OFFSET]](%rsp,{{.*}}), %xmm0 {{.*}}
15 %1 = load <4 x float>, ptr %v, align 16
16 %mul = fmul <4 x float> %1, %1
17 store <4 x float> %mul, ptr %v, align 16
18 %2 = load i32, ptr %i, align 4
19 %vecext = extractelement <4 x float> %mul, i32 %2