[llvm-commits] [llvm-gcc-4.0] r45331 - /llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp
Dale Johannesen
dalej at apple.com
Sat Dec 22 19:21:24 PST 2007
Author: johannes
Date: Sat Dec 22 21:21:24 2007
New Revision: 45331
URL: http://llvm.org/viewvc/llvm-project?rev=45331&view=rev
Log:
Add VPERM and VSEL builtins.
Modified:
llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp
Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=45331&r1=45330&r2=45331&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp Sat Dec 22 21:21:24 2007
@@ -329,6 +329,37 @@
Result = Builder.CreateCall(smax, ActualOps, ActualOps+2, "tmp");
return true;
}
+ case ALTIVEC_BUILTIN_VPERM_4SI:
+ case ALTIVEC_BUILTIN_VPERM_4SF:
+ case ALTIVEC_BUILTIN_VPERM_8HI:
+ case ALTIVEC_BUILTIN_VPERM_16QI: {
+ // Operation is identical on all types; we have a single intrinsic.
+ const Type *VecTy = VectorType::get(Type::Int32Ty, 4);
+ Value *Op0 = CastToType(Instruction::BitCast, Ops[0], VecTy);
+ Value *Op1 = CastToType(Instruction::BitCast, Ops[1], VecTy);
+ Value *ActualOps[] = { Op0, Op1, Ops[2]};
+ Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::ppc_altivec_vperm),
+ ActualOps, ActualOps+3, "tmp");
+ Result = CastToType(Instruction::BitCast, Result, Ops[0]->getType());
+ return true;
+ }
+ case ALTIVEC_BUILTIN_VSEL_4SI:
+ case ALTIVEC_BUILTIN_VSEL_4SF:
+ case ALTIVEC_BUILTIN_VSEL_8HI:
+ case ALTIVEC_BUILTIN_VSEL_16QI: {
+ // Operation is identical on all types; we have a single intrinsic.
+ const Type *VecTy = VectorType::get(Type::Int32Ty, 4);
+ Value *Op0 = CastToType(Instruction::BitCast, Ops[0], VecTy);
+ Value *Op1 = CastToType(Instruction::BitCast, Ops[1], VecTy);
+ Value *Op2 = CastToType(Instruction::BitCast, Ops[2], VecTy);
+ Value *ActualOps[] = { Op0, Op1, Op2 };
+ Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::ppc_altivec_vsel),
+ ActualOps, ActualOps+3, "tmp");
+ Result = CastToType(Instruction::BitCast, Result, Ops[0]->getType());
+ return true;
+ }
}
return false;
More information about the llvm-commits
mailing list