1 ; RUN: llc -mtriple=x86_64-- -mcpu=core-avx2 < %s | FileCheck %s
3 ; Test multiple peephole-time folds in a single basic block.
4 ; <rdar://problem/16478629>
6 define <8 x float> @test_peephole_multi_fold(ptr %p1, ptr %p2) {
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>, ptr %p1, align 1
17 %m2 = load <8 x float>, ptr %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
25 %r = fadd <8 x float> %vsum1.next, %vsum2.next
29 declare <8 x float> @llvm.x86.fma.vfmadd.ps.256(<8 x float>, <8 x float>, <8 x float>)