<div dir="ltr">Hi Jim,<br><br>Yes, llvm-mc is a tool rather than a compiler, but asm code is a kind of interface between compiler output and the assembler tool, correct? <br><br>Without using assembler to test the asm output from compiler, how do we know the assembly code is correct? llvm-mc test is just to check the correctness of the assembly code generated from compiler.<br>
<br>The example is, without this test we would have the bug which can be fixed by patch <a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=195941">http://llvm.org/viewvc/llvm-project?view=revision&revision=195941</a>. Otherwise, we would have llvm-mc time failure.<br>
<br>--- llvm/trunk/test/CodeGen/AArch64/neon-scalar-shift-imm.ll 2013/11/29 01:38:49 195940<br>+++ llvm/trunk/test/CodeGen/AArch64/neon-scalar-shift-imm.ll 2013/11/29 02:11:22 195941<br>@@ -316,10 +316,10 @@<br> <br> define i8 @test_vqshrnh_n_s16(i16 %a) {<br>
 ; CHECK: test_vqshrnh_n_s16<br>-; CHECK: sqshrn {{b[0-9]+}}, {{h[0-9]+}}, #15<br>+; CHECK: sqshrn {{b[0-9]+}}, {{h[0-9]+}}, #8<br> entry:<br>   %vsqshrn = insertelement <1 x i16> undef, i16 %a, i32 0<br>-  %vsqshrn1 = call <1 x i8> @llvm.aarch64.neon.vsqshrn.v1i8(<1 x i16> %vsqshrn, i32 15)<br>
+  %vsqshrn1 = call <1 x i8> @llvm.aarch64.neon.vsqshrn.v1i8(<1 x i16> %vsqshrn, i32 8)<br>   %0 = extractelement <1 x i8> %vsqshrn1, i32 0<br>   ret i8 %0<br> }<br><br>Looking at this code change, <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;display:inline">
"</div>sqshrn b0, h1, #15" is invalid, <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;display:inline">this shift amount should be <=8 and >=1, </div>so without llvm-mc test we wouldn't know this is incorrect.<div>
<br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I know adding MCLayer test can capture this kind of bug as well, but it's hard to capture every corner of negative tests in MCLayer, I think.</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><span style="font-family:arial">Thanks,</span><br>
</div>-Jiangning<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/3 Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It is a very, very strange way to write tests. llvm-mc is a tool to check the assembler and disassembler, not the compiler. What are you actually trying to do? I don’t understand the motivation. Perhaps an example?<br>

<div class="HOEnZb"><div class="h5"><br>
<br>
On Nov 28, 2013, at 3:33 AM, Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>> wrote:<br>
<br>
> Hi Jiangning,<br>
><br>
> I think this might be a layering violation (I've CCed Jim Grosbach,<br>
> who's pretty much the authority). I know that object file tests are<br>
> discouraged from CodeGen, and this seems very similar.<br>
><br>
> I think the preferred option would be to make sure any test you<br>
> believe it's usefully doing is part of the test/MC hierarchy.<br>
><br>
> Cheers.<br>
><br>
> Tim.<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font face="courier new, monospace">Thanks,</font><div><font face="courier new, monospace">-Jiangning</font></div></div>
</div>