[PATCH] D20931: [X86] Reduce the width of multiplification when its operands are extended from i8 or i16

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 12:02:50 PDT 2016


wmi added inline comments.

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:26675
@@ -26467,3 +26674,3 @@
     MulAmt1 = 3;
     MulAmt2 = MulAmt / 3;
   }
----------------
eli.friedman wrote:
> Ah, I see what you mean.  That's how we end up in an awful mess with the following:
> 
> ```
> typedef short a __attribute((ext_vector_type(4)));
> void g(a x);
> a f(a x, a y, int c) { a z = x*y; if (c) g(z+x); return z; }
> ```
> 
> ----
> 
> That doesn't explain why you need to explicitly legalize the inputs in the case where you split the nodes, though.
I choosed to explicitly legalize because I used X86ISD::UNPCKL and X86ISD::UNPCKH instead of vector_shuffle so no mask setting was needed. Seems legalization only works for generic ISD instead of X86ISD.  

Actually it doesn't need to legalize. I change unpck to vectorshuffle and remove the splitting. The code looks simpler even with the additional mask setting code. 

Thanks for the suggestion.


Repository:
  rL LLVM

http://reviews.llvm.org/D20931





More information about the llvm-commits mailing list