Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -march=x86-64 -mcpu=core-avx2 < %s | FileCheck %s
      2 ;
      3 ; Test multiple peephole-time folds in a single basic block.
      4 ; <rdar://problem/16478629>
      5 
      6 define <8 x float> @test_peephole_multi_fold(<8 x float>* %p1, <8 x float>* %p2) {
      7 entry:
      8   br label %loopbody
      9 
     10 loopbody:
     11 ; CHECK: test_peephole_multi_fold:
     12 ; CHECK: vfmadd231ps ({{%rdi|%rcx}}),
     13 ; CHECK: vfmadd231ps ({{%rsi|%rdx}}),
     14   %vsum1 = phi <8 x float> [ %vsum1.next, %loopbody ], [ zeroinitializer, %entry ]
     15   %vsum2 = phi <8 x float> [ %vsum2.next, %loopbody ], [ zeroinitializer, %entry ]
     16   %m1 = load <8 x float>, <8 x float>* %p1, align 1
     17   %m2 = load <8 x float>, <8 x float>* %p2, align 1
     18   %vsum1.next = tail call <8 x float> @llvm.x86.fma.vfmadd.ps.256(<8 x float> %m1, <8 x float> zeroinitializer, <8 x float> %vsum1)
     19   %vsum2.next = tail call <8 x float> @llvm.x86.fma.vfmadd.ps.256(<8 x float> %m2, <8 x float> zeroinitializer, <8 x float> %vsum2)
     20   %vsum1.next.1 = extractelement <8 x float> %vsum1.next, i32 0
     21   %c = fcmp oeq float %vsum1.next.1, 0.0
     22   br i1 %c, label %loopbody, label %loopexit
     23 
     24 loopexit:
     25   %r = fadd <8 x float> %vsum1.next, %vsum2.next
     26   ret <8 x float> %r
     27 }
     28 
     29 declare <8 x float> @llvm.x86.fma.vfmadd.ps.256(<8 x float>, <8 x float>, <8 x float>)
     30