[PATCH] D12731: [InstCombine] CVTPH2PS Vector Demanded Elements + Constant Folding

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 13:18:21 PDT 2015


RKSimon added a comment.

Thanks Ahmed, I'll look into doing something similar for CVTPS2PH in a future patch, although I'm a little concerned about matching all the (compile-time) rounding modes.


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:846-857
@@ -799,13 +845,14 @@
+
   case Intrinsic::x86_sse_storeu_ps:
   case Intrinsic::x86_sse2_storeu_pd:
   case Intrinsic::x86_sse2_storeu_dq:
     // Turn X86 storeu -> store if the pointer is known aligned.
     if (getOrEnforceKnownAlignment(II->getArgOperand(0), 16, DL, II, AC, DT) >=
         16) {
       Type *OpPtrTy =
         PointerType::getUnqual(II->getArgOperand(1)->getType());
       Value *Ptr = Builder->CreateBitCast(II->getArgOperand(0), OpPtrTy);
       return new StoreInst(II->getArgOperand(1), Ptr);
     }
     break;
 
----------------
ab wrote:
> I couldn't help but notice that this is very similar to the ppc case above.  All else being equal, can you keep them together?
> 
> Plus, the ph2ps case is similar to ss2si below!
Yes there is a lot of code duplication going in this file - splitting off common code into helper functions should be quite straightforward.

================
Comment at: test/Transforms/InstCombine/x86-f16c.ll:3-4
@@ +2,4 @@
+
+declare <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16>) nounwind readonly
+declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readonly
+
----------------
ab wrote:
> Unnecessary attributes?
Just matching what is done in other tests - I'll strip them off.


Repository:
  rL LLVM

http://reviews.llvm.org/D12731





More information about the llvm-commits mailing list