Home | History | Annotate | Download | only in X86
      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"
      6 
      7 ; CHECK-LABEL: test1:
      8 ; %arg lives in xmm0 and it shouldn't be redefined until it is used in the FMA.
      9 ; CHECK-NOT: {{.*}}, %xmm0
     10 ; %addr lives in rdi.
     11 ; %addr2 lives in rsi.
     12 ; CHECK: vmovss (%rsi), [[ADDR2:%xmm[0-9]+]]
     13 ; The assembly syntax is in the reverse order.
     14 ; CHECK: vfmadd231ss (%rdi), [[ADDR2]], %xmm0
     15 define void @test1(float* %addr, float* %addr2, float %arg) {
     16 entry:
     17   br label %loop
     18 
     19 loop:
     20   %sum0 = phi float [ %fma, %loop ], [ %arg, %entry ]
     21   %addrVal = load float, float* %addr, align 4
     22   %addr2Val = load float, float* %addr2, align 4
     23   %fmul = fmul float %addrVal, %addr2Val
     24   %fma = fadd float %sum0, %fmul
     25   br i1 true, label %exit, label %loop
     26 
     27 exit:
     28   store float %fma, float* %addr, align 4
     29   ret void
     30 }
     31