<br><br><div class="gmail_quote">On 22 August 2012 12:14, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">


<p> ; CHECK: test_f32<br> ; CHECK-FMA-INST: vfmadd213ss<br> ; CHECK-FMA-CALL: _fmaf<br>+; CHECK-FMA-CALL-BDVER2: fmaf<br> <br> define float @test_f32(float %a, float %b, float %c) nounwind readnone ssp {<br> entry:<br>@@ -16,6 +19,7 @@<br>



 ; CHECK: test_f64<br> ; CHECK-FMA-INST: vfmadd213sd<br> ; CHECK-FMA-CALL: _fma<br>+; CHECK-FMA-CALL-BDVER2: fma<br><br>What makes bdver require a different CHECK here?</p><p> </p></blockquote><div> </div><div>bdver2 generates calls to fma() and fmaf() while -mtriple for darwin10 prefixes the calls with '_'. Test fails because of mismatch. Initially I considered modifying CHECK-FMA-CALL patterns to remove '_' but  preferred introducing another check.</div>


<div> </div><div> </div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote"><br>--- test/CodeGen/X86/fma3-intrinsics.ll    (revision 162188)<br>



+++ test/CodeGen/X86/fma3-intrinsics.ll    (working copy)<br>@@ -1,7 +1,9 @@<br> ; RUN: llc < %s -mtriple=x86_64-pc-win32 -mcpu=core-avx2 -mattr=avx2,+fma | FileCheck %s<br>+; RUN: llc < %s -mcpu=bdver2 -mattr=-fma4 | FileCheck --check-prefix=CHECK-BDVER2 %s<br>



<br>Why the separate CHECK for bdver2. They all seem identical to the existing CHECK</blockquote><div> </div><div>Not really. The check-bdver2 differs for cases:@test_x86_fmadd_ps_y() and @test_x86_fnmadd_ps_y().  Register form of FMA gets generated. Hence different checks.</div>


<div> </div><div>- Anitha</div><div> </div><div> </div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">


 </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote"><div><div><br><div class="gmail_quote">
On Mon, Aug 20, 2012 at 11:52 AM, Anitha Boyapati <span dir="ltr"><<a href="mailto:anitha.boyapati@gmail.com" target="_blank">anitha.boyapati@gmail.com</a>></span> wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote"><br><br><div class="gmail_quote"><div><div>On 20 August 2012 02:44, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br>



<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">


--- test/CodeGen/X86/fma.ll    (revision 162188)<br>+++ test/CodeGen/X86/fma.ll    (working copy)<br>@@ -2,6 +2,10 @@<br> ; RUN: llc < %s -mtriple=i386-apple-darwin10               | FileCheck %s --check-prefix=CHECK-FMA-CALL<br>







 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=+fma | FileCheck %s --check-prefix=CHECK-FMA-INST<br> ; RUN: llc < %s -mtriple=x86_64-apple-darwin10             | FileCheck %s --check-prefix=CHECK-FMA-CALL<br>







+; RUN: llc < %s -mcpu=bdver2 -mattr=+fma  | FileCheck %s --check-prefix=CHECK-FMA-INST<br>+; RUN: llc < %s -mcpu=bdver2 | FileCheck %s --check-prefix=CHECK-FMA-CALL<br>+; RUN: llc < %s -mcpu=bdver2 -mattr=+fma | FileCheck %s --check-prefix=CHECK-FMA-INST<br>







+; RUN: llc < %s -mcpu=bdver2 | FileCheck %s --check-prefix=CHECK-FMA-CALL<br><br>The last 2 lines are the same as the previous 2 lines. Did you intend to make one 64-bit and one 32-bit as was done for the original cases?<br>







Also you don't need +fma for the cases where you want fma instructions. cpu=bdver2 takes care of that and that's what you're trying to test. You should add "-fma4" for CHECK-FMA-INST. For the CHECK-FMA-CALL versions you need to disable fma and fma4.<br>







<br>While you're in this test can you fix up the original versions to have -mattr=-fma,-fma4 on the FMA-CALL versions and -mattr=+fma,-fma4 on the FMA-INST versions. As they are right now they'll break if the machine that runs the test is a Haswell or Bulldozer since there is no explicit cpu selected.<br>







<br>--- test/CodeGen/X86/fma_patterns.ll    (revision 162188)<br>+++ test/CodeGen/X86/fma_patterns.ll    (working copy)<br>@@ -1,4 +1,5 @@<br> ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core-avx2 -mattr=avx2,+fma -fp-contract=fast | FileCheck %s<br>







+; RUN: llc < %s -mcpu=bdver2 -mattr=fma -fp-contract=fast | FileCheck %s<br><br>Again you don't want -mattr=fma, you're trying to test that bdver2 implies fma. But explicitly disable fma4.<br><br>--- test/CodeGen/X86/fma4-intrinsics-x86_64.ll    (revision 162188)<br>







+++ test/CodeGen/X86/fma4-intrinsics-x86_64.ll    (working copy)<br>@@ -1,4 +1,5 @@<br> ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -march=x86-64 -mattr=+avx,+fma4 | FileCheck %s<br>+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=bdver2 -mattr=+avx,+fma4,-fma | FileCheck %s<br>







<br>Just use -mattr=-fma for the bdver2.</blockquote></div></div><div><br>Thanks Craig. Attached patch addresses all the comments. In addition I made changes to 
fma3-intrinsics to test FMA3 intrinsics for bdver2 target. All 4 Tests 
pass. For the previous patch, I think I was looking more towards making testcases work with llvm-lit. <br><span><font color="#888888"><br><br clear="all"></font></span></div></div><span><font color="#888888">-- <br>
<i style="font-family:times new roman,serif"><b> Anitha</b></i><br><br>
</font></span></blockquote></div><br><br clear="all"><br></div></div><span><font color="#888888">-- <br>~Craig<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><i style="font-family:times new roman,serif"><b> Anitha</b></i><br><br>