From fd6bdf0b0ffd15fba8d1c2ddbc3dd729b1f11775 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 17 Apr 2006 22:26:56 +0000 Subject: [PATCH] Turn x86 unaligned load/store intrinsics into aligned load/store instructions if the pointer is known aligned. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27781 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 4a0bbf714e5..be3868dca8c 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5471,7 +5471,11 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { default: break; case Intrinsic::ppc_altivec_lvx: case Intrinsic::ppc_altivec_lvxl: - // Turn lvx -> load if the pointer is known aligned. + case Intrinsic::x86_sse_loadu_ps: + case Intrinsic::x86_sse2_loadu_pd: + case Intrinsic::x86_sse2_loadu_dq: + // Turn PPC lvx -> load if the pointer is known aligned. + // Turn X86 loadups -> load if the pointer is known aligned. if (GetKnownAlignment(II->getOperand(1), TD) >= 16) { Value *Ptr = InsertCastBefore(II->getOperand(1), PointerType::get(II->getType()), CI); @@ -5487,6 +5491,17 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return new StoreInst(II->getOperand(1), Ptr); } break; + case Intrinsic::x86_sse_storeu_ps: + case Intrinsic::x86_sse2_storeu_pd: + case Intrinsic::x86_sse2_storeu_dq: + case Intrinsic::x86_sse2_storel_dq: + // Turn X86 storeu -> store if the pointer is known aligned. + if (GetKnownAlignment(II->getOperand(1), TD) >= 16) { + const Type *OpPtrTy = PointerType::get(II->getOperand(2)->getType()); + Value *Ptr = InsertCastBefore(II->getOperand(1), OpPtrTy, CI); + return new StoreInst(II->getOperand(2), Ptr); + } + break; case Intrinsic::ppc_altivec_vperm: // Turn vperm(V1,V2,mask) -> shuffle(V1,V2,mask) if mask is a constant. if (ConstantPacked *Mask = dyn_cast(II->getOperand(3))) { -- 2.34.1