<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:14.399999618530273px">Hi Tim,</div><div style="font-family:arial,sans-serif;font-size:14.399999618530273px"><br></div><span style="font-family:arial,sans-serif;font-size:14.399999618530273px">int_arm_neon_vaddhn/int_arm_</span><span style="font-family:arial,sans-serif;font-size:14.399999618530273px">neon_vmulls and friends are all defined by ARM target. I agree with your comments, but does it imply ARM back-end has inappropriate implementation?</span><br style="font-family:arial,sans-serif;font-size:14.399999618530273px">
<div class="gmail_extra" style="font-family:arial,sans-serif;font-size:14.399999618530273px"><br></div><div class="gmail_extra" style="font-family:arial,sans-serif;font-size:14.399999618530273px">Thanks,</div><div class="gmail_extra" style="font-family:arial,sans-serif;font-size:14.399999618530273px">
-Jiangning</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/8/26 Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jiangning,<br>
<br>
I've just looked at the LLVM patch for now, since the comments may<br>
drastically change the Clang patch.<br>
<br>
+  def _8h8b<br>
[...]<br>
+    def _8H<br>
<br>
It would be nice to settle on a single naming convention for these<br>
instructions. Personally, I think I prefer the first, but I don't have<br>
a strong opinion either way.<br>
<br>
+defm SADDWvvv :  NeonI_3VDW_s<0b0, 0b0001, "saddw", add, 1>;<br>
+defm UADDWvvv :  NeonI_3VDW_u<0b1, 0b0001, "uaddw", add, 1>;<br>
+<br>
+defm SADDW2vvv :  NeonI_3VDW2_s<0b0, 0b0001, "saddw2", add, 1>;<br>
+defm UADDW2vvv :  NeonI_3VDW2_u<0b1, 0b0001, "uaddw2", add, 1>;<br>
<br>
I don't think any widening instructions are commutable. The addition<br>
part is, but the widening only happens to the RHS. You can't swap Rn<br>
and Rm on the instructions and get the same result.<br>
<br>
+defm ADDHNvvv  : NeonI_3VDN_2Op<0b0, 0b0100, "addhn", int_arm_neon_vaddhn, 1>;<br>
+defm RADDHNvvv : NeonI_3VDN_2Op<0b1, 0b0100, "raddhn",<br>
int_arm_neon_vraddhn, 1>;<br>
<br>
Don't these have reasonably simple LLVM IR representations? For example:<br>
<br>
define <2 x i32> @addhn(<2 x i64> %lhs, <2 x i64> %rhs) {<br>
  %sum = add <2 x i64> %lhs, %rhs<br>
  %shift = shl <2 x i64> %sum, <i64 32, i64 32><br>
  %trunc = trunc <2 x i64> %shift to <2 x i32><br>
  ret <2 x i32> %trunc<br>
}<br>
<br>
define <2 x i32> @raddhn(<2 x i64> %lhs, <2 x i64> %rhs) {<br>
  %sum = add <2 x i64> %lhs, %rhs<br>
  %rounded = add <2 x i64> %sum, <i64 0x80000000, i64 0x80000000><br>
  %shift = shl <2 x i64> %rounded, <i64 32, i64 32><br>
  %trunc = trunc <2 x i64> %shift to <2 x i32><br>
  ret <2 x i32> %trunc<br>
}<br>
<br>
+defm SMULLvvv :  NeonI_3VDL_2Op<0b0, 0b1100, "smull", int_arm_neon_vmulls, 1>;<br>
+defm UMULLvvv :  NeonI_3VDL_2Op<0b1, 0b1100, "umull", int_arm_neon_vmullu, 1>;<br>
<br>
Aren't these even simpler than addhn and friends? An extend followed<br>
by a multiply? They're also always commutable so it probably doesn't<br>
need to be a template parameter (same for sabdl and uabdl).<br>
<br>
+defm SQDMLALvvv : NeonI_3VDL_3Op_v2<0b0, 0b1001, "sqdmlal",<br>
+                                    int_arm_neon_vqdmlal>;<br>
<br>
The qdmlals are just qdmulls with an extra addition, I think.<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<div>-Jiangning</div>
</div>