<div dir="ltr">> <span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:11pt;line-height:19.7999992370605px">With larger data type do you mean promoting the given data type to larger type ex: MVT:i32 to MVT:i64</span><p class="MsoNormal" style="font-size:13.1999998092651px;line-height:19.7999992370605px"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">> And then doing the expansion?</span></p><p class="MsoNormal" style="font-size:13.1999998092651px;line-height:19.7999992370605px">Yes, that was my suggestion.</p></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 3 Aug 2015 at 13:23 Shahid, Asghar-ahmad <<a href="mailto:Asghar-ahmad.Shahid@amd.com">Asghar-ahmad.Shahid@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi James,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">That is right, for Uint_max the current comparison will not be proper.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">With larger data type do you mean promoting the given data type to larger type ex: MVT:i32 to MVT:i64<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">And then doing the expansion?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Shahid<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> James Molloy [mailto:<a href="mailto:james@jamesmolloy.co.uk" target="_blank">james@jamesmolloy.co.uk</a>]
<br>
<b>Sent:</b> Monday, August 03, 2015 1:02 AM<br>
<b>To:</b> <a href="mailto:reviews%2BD11678%2Bpublic%2Be92bec0f352bb617@reviews.llvm.org" target="_blank">reviews+D11678+public+e92bec0f352bb617@reviews.llvm.org</a>; Shahid, Asghar-ahmad; <a href="mailto:james.molloy@arm.com" target="_blank">james.molloy@arm.com</a>; <a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>; <a href="mailto:mzolotukhin@apple.com" target="_blank">mzolotukhin@apple.com</a><br>
<b>Cc:</b> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [PATCH] D11678: [CodeGen] Fixes *absdiff* intrinsic: LangRef doc/test case improvement and corresponding code change<u></u><u></u></span></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I think uabsdiff needs to be expanded using a larger data type. If we have uabsdiff(uint_max, uint_max) , a signed comparison won't return the right result unless the bitwidth is expanded, right?<br>
<br>
James<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Sun, 2 Aug 2015 at 08:20, Shahid <<a href="mailto:Asghar-ahmad.Shahid@amd.com" target="_blank">Asghar-ahmad.Shahid@amd.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">ashahid added inline comments.<br>
<br>
================<br>
Comment at: docs/LangRef.rst:10387-10390<br>
@@ -10386,6 +10386,6 @@<br>
<br>
     %sub = sub nsw <4 x i32> %a, %b<br>
-    %ispos = icmp sgt <4 x i32> %sub, <i32 -1, i32 -1, i32 -1, i32 -1><br>
+    %ispos = icmp sge <4 x i32> %sub, zeroinitializer<br>
     %neg = sub nsw <4 x i32> zeroinitializer, %sub<br>
     %1 = select <4 x i1> %ispos, <4 x i32> %sub, <4 x i32> %neg<br>
<br>
----------------<br>
mzolotukhin wrote:<br>
> What's the difference between `llvm.uabsdiff` and `llvm.sabsdiff` then?<br>
The difference is the presence of NSW flag in case of llvm.sabsdiff.<br>
<br>
================<br>
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:737<br>
@@ -736,5 +736,3 @@<br>
       TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT), Tmp2,<br>
-      DAG.getConstant(0, dl, VT),<br>
-      DAG.getCondCode(Op->getOpcode() == ISD::SABSDIFF ? ISD::SETLT<br>
-                                                       : ISD::SETULT));<br>
+      DAG.getConstant(0, dl, VT), DAG.getCondCode(ISD::SETGE));<br>
   Tmp1 = DAG.getNode(ISD::VSELECT, dl, VT, Tmp4, Tmp1, Tmp2);<br>
----------------<br>
mzolotukhin wrote:<br>
> AFAIU, this should be `ISD::SETLE`.<br>
My bad... intention was to use Tmp1 instead of Tmp2. I will use the proper variable names to reflect the operations.<br>
<br>
================<br>
Comment at: test/CodeGen/X86/absdiff_128.ll:150-152<br>
@@ +149,5 @@<br>
+; CHECK-DAG:  psubd  %xmm1, [[SRC:%xmm[0-9]+]]<br>
+; CHECK:      pxor<br>
+; CHECK-DAG:  pxor    %xmm3, [[DST:%xmm[0-9]+]]<br>
+; CHECK-NEXT: psubd  [[SRC]], [[DST]]<br>
+; CHECK-DAG:  pcmpgtd  %xmm3, [[SRC:%xmm[0-9]+]]<br>
----------------<br>
mzolotukhin wrote:<br>
> This `CHECK-DAG` doesn't make much sense, since it's limited by `CHECK` and `CHECK-NEXT` from both sides.<br>
><br>
> Moreover, I think the right way to make the tests less bristle is to not check for everything, but just look for key instructions.<br>
> For example, we definitely expect to see `psubd`, then, maybe after several other instructions, we want to see `pcmpgt`, then we want to see `pand`, `pandn`, and `por`. Thus, I'd write this test something like this:<br>
> ```<br>
> CHECK: psubd<br>
> CHECK: pcmpgt<br>
> CHECK-DAG: pand // BTW, why do you have two `pandn` here?<br>
> CHECK-DAG: pandn<br>
> CHECK: por<br>
> CHECK: ret<br>
> ```<br>
Thanks, this is a very important input.<br>
<br>
For ISD::SETGE, X86 swaps the operand, consequently, in context of VSELECT it uses two "pandn".<br>
<br>
<br>
<br>
================<br>
Comment at: test/CodeGen/X86/absdiff_128.ll:206<br>
@@ +205,3 @@<br>
+; CHECK-NEXT:   pcmpgtd<br>
+; CHECK-NEXT:   pshufd  {{.*}}    # xmm5 = xmm4[0,0,2,2]<br>
+; CHECK-NEXT:   pcmpeqd<br>
----------------<br>
mzolotukhin wrote:<br>
> If we don't want to match any specific register here, we need to get rid of comments `# xmm5 = xmm4...` too.<br>
Ok<br>
<br>
================<br>
Comment at: test/CodeGen/X86/absdiff_256.ll:33<br>
@@ +32,3 @@<br>
+; CHECK-DAG:         psubd   %xmm6, [[SRC:%xmm[0-9]+]]<br>
+; CHECK-DAG:         pxor    %xmm5, [[DST:%xmm[0-9]+]]<br>
+; CHECK-NEXT:        psubd   [[SRC]], [[DST]]<br>
----------------<br>
mzolotukhin wrote:<br>
> This is still fragile.<br>
> Imagine that register allocator for some strange reason begins to use `xmm5` instead of `xmm6` and vice versa - this test will immediately fail.<br>
><br>
> Also, if you want to match `pxor %xmmN, %xmmN`, the correct way to write the regexp for it would be:<br>
> ```<br>
> pxor [[SOMENAME:%xmm[0-9]+]], [[SOMENAME]]<br>
> ```<br>
> This will ensure that `pxor` operates on the same register.<br>
Ok<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11678&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=A_lnvaY7yJGHluJpEeGarvgGrIKmTfvFVWzgB8pUb7s&s=R5F0g61E7dOcfbGxtPGZ30FEhfmtv5Sr14LPpxNd4fw&e=" target="_blank">http://reviews.llvm.org/D11678</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</blockquote>
</div>
</div></div></div></blockquote></div>