Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
      2 
      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.
      9 
     10 define float @foo(i32* %i, <4 x float>* %v) {
     11 ; CHECK-LABEL: foo:
     12 ; CHECK:    movaps %xmm0, -[[OFFSET:[0-9]+]](%rsp)
     13 ; CHECK:    movss -[[OFFSET]](%rsp,{{.*}}), %xmm0 {{.*}}
     14 ; CHECK-NEXT:    retq
     15   %1 = load <4 x float>, <4 x float>* %v, align 16
     16   %mul = fmul <4 x float> %1, %1
     17   store <4 x float> %mul, <4 x float>* %v, align 16
     18   %2 = load i32, i32* %i, align 4
     19   %vecext = extractelement <4 x float> %mul, i32 %2
     20   ret float %vecext
     21 }
     22