1 ; RUN: llc -fp-contract=fast -mattr=+fma -disable-cgp < %s -o - | FileCheck %s
2 ; Check that the 2nd and 3rd arguments of fmaXXX231 reg1, reg2, mem3 are not commuted.
3 ; <rdar://problem/16800495>
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-apple-macosx"
8 ; %arg lives in xmm0 and it shouldn't be redefined until it is used in the FMA.
9 ; CHECK-NOT: {{.*}}, %xmm0
11 ; %addr2 lives in rsi.
12 ; CHECK: vmovss (%rdi), [[ADDR:%xmm[0-9]+]]
13 ; The assembly syntax is in the reverse order.
14 ; CHECK: vfmadd231ss (%rsi), [[ADDR]], %xmm0
15 define void @test1(ptr %addr, ptr %addr2, float %arg) {
20 %sum0 = phi float [ %fma, %loop ], [ %arg, %entry ]
21 %addrVal = load float, ptr %addr, align 4
22 %addr2Val = load float, ptr %addr2, align 4
23 %fmul = fmul float %addrVal, %addr2Val
24 %fma = fadd float %sum0, %fmul
25 br i1 true, label %exit, label %loop
28 store float %fma, ptr %addr, align 4