[PATCH] D31396: [X86][LLVM][Canonical Compare Intrinsics] Creating a canonical representation for X86 CMP intrinsics

michael zuckerman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 12:30:29 PDT 2017


m_zuckerman added a comment.

In https://reviews.llvm.org/D31396#711463, @craig.topper wrote:

> Why are we doing this in InstCombine instead of DAG combine? This won't enable any additional InstCombine optimizations.


First, We are doing that because we are working in intrinsics and I don't do any special changing. I only reorder the operands.

Secondly, we can do it in the lowering but we prefer that this canonical representation will be in earlier step.



================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2392
+  case Intrinsic::x86_avx512_mask_cmp_ps_256:
+  case Intrinsic::x86_avx512_mask_cmp_ps_512:
+    if(X86CreateCanonicalCMP(II))
----------------
craig.topper wrote:
> What about sse_cmp_ps, sse2_cmp_pd and their avx2 equivalents?
As I wrote in the comments. We are only working on AVX intrinsics. 


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2505
   // X86 scalar intrinsics simplified with SimplifyDemandedVectorElts.
+  case Intrinsic::x86_sse2_cmp_sd:
+  case Intrinsic::x86_sse_cmp_ss:
----------------
craig.topper wrote:
> These don't use an i32 for the comparison type immediate, but the X86CreateCanonicalCMP assumes they do when it creates the new Constant.
In the main function, we only accept AVX and above intrinsics. This ensures us that we only work with i32 operands. 
 


https://reviews.llvm.org/D31396





More information about the llvm-commits mailing list