<div class="gmail_quote"><div>Hi,</div><div> </div><div>I am trying to generate FMA for X86 target ("bdver2") through -ffp-contract=fast. [Sanity checks: bdver2 supports fma]</div><div> </div><div>While I am able to generate FMA for "C" input, I could not when LLVM IR is input. Example illustrated below:</div>
<div> </div><div>#input - C file</div><div>float test(float a, float b, float c) {<br> return a*b+c;<br>}<br></div><div>The below arguments work fine -</div><div> </div><div>$clang -march=bdver2 -mfma -ffp-contract=fast -S test.c</div>
<div> </div><div>However, when I input the below llvm assembly(pasted at the end), clang (not llc) fails to generate FMA. Any idea why and how I will be able to do that through clang?</div><div> </div><div>$ clang -march=bdver2 -ffp-contract=fast -mfma -S test.ll -O3</div>
<div>$ more test.s</div><div> </div><div>test: # @test<br> .cfi_startproc<br># BB#0: # %entry<br> vmulss %xmm1, %xmm0, %xmm0<br> vaddss %xmm2, %xmm0, %xmm0<br>
ret<br>.Ltmp0:<br> .size test, .Ltmp0-test<br> .cfi_endproc<br></div><div> </div><div> </div><div> </div><div>; ModuleID = 'test.c'<br>target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
target triple = "x86_64-unknown-linux-gnu"</div><div>module asm "\09.ident\09\22GCC: (GNU) 4.7.2 LLVM: 3.2svn\22"</div><div>define float @test(float %a, float %b, float %c) nounwind uwtable readnone {<br>
entry:<br> %0 = fmul float %a, %b<br> %1 = fadd float %0, %c<br> ret float %1<br>}<span class="HOEnZb"><font color="#888888"><br></font></span></div><div><br>-- <br><i style="font-family:times new roman,serif"><b> Anitha</b></i><br>
<br>
</div></div>