[llvm-commits] [llvm-gcc-4.2] r84678 - /llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
Bob Wilson
bob.wilson at apple.com
Tue Oct 20 14:08:21 PDT 2009
Author: bwilson
Date: Tue Oct 20 16:08:21 2009
New Revision: 84678
URL: http://llvm.org/viewvc/llvm-project?rev=84678&view=rev
Log:
Translate NEON vget_high and vget_low builtins to extract_element with a
v2f64 type instead of using vector shuffles. The code generator does not
produce good code for a shuffle where the inputs have more elements than
the result.
Modified:
llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=84678&r1=84677&r2=84678&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Tue Oct 20 16:08:21 2009
@@ -1690,14 +1690,11 @@
case NEON_BUILTIN_vget_high:
case NEON_BUILTIN_vget_low: {
- unsigned NUnits = GET_MODE_NUNITS(insn_data[icode].operand[0].mode);
- std::vector<Constant*> Idxs;
- unsigned Idx = (neon_code == NEON_BUILTIN_vget_low ? 0 : NUnits);
- for (unsigned i = 0; i != NUnits; ++i)
- Idxs.push_back(getInt32Const(Idx++));
- Result = Builder.CreateShuffleVector(Ops[0],
- UndefValue::get(Ops[0]->getType()),
- ConstantVector::get(Idxs));
+ const Type *v2f64Ty = VectorType::get(Type::getDoubleTy(Context), 2);
+ unsigned Idx = (neon_code == NEON_BUILTIN_vget_low ? 0 : 1);
+ Result = Builder.CreateBitCast(Ops[0], v2f64Ty);
+ Result = Builder.CreateExtractElement(Result, getInt32Const(Idx));
+ Result = Builder.CreateBitCast(Result, ResultType);
break;
}
More information about the llvm-commits
mailing list