summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2014-03-17 17:06:14 +0000
committerAdam Nemet <anemet@apple.com>2014-03-17 17:06:14 +0000
commit8c8fe42a0d81f002fbae486ed45027d32dae7eeb (patch)
treee35694db56baf6a419fce418b20633fc7337927d /include
parentad52f4f70c90b72efbcf270152397e6b2df47170 (diff)
downloadllvm-8c8fe42a0d81f002fbae486ed45027d32dae7eeb.tar.gz
llvm-8c8fe42a0d81f002fbae486ed45027d32dae7eeb.tar.bz2
llvm-8c8fe42a0d81f002fbae486ed45027d32dae7eeb.tar.xz
[VectorLegalizer/X86] Don't unvectorize fp_to_uint for v8f32->v8i16
Rather than LegalizeAction::Expand, this needs LegalizeAction::Promote to get promoted to fp_to_sint v8f32->v8i32. This is a legal operation on AVX. For that to work properly, we also need to teach the legalizer about the specific promotion required here. The default vector promotion uses bitcasting to a vector type of the same total size. We want to promote the vector element type, effectively widening the operation and then truncating the result. This is analogous to the current logic of how int_to_fp is promoted. The change also factors out some code from the int_to_fp promotion code to ValueType::widenIntegerVectorElementType. This is now shared between int_to_fp and fp_to_int. There is no longer need for the custom lowering of fp_to_sint f32->v8i16 in X86. It can now go through the new target-independent fp_to_*int promotion logic. I also checked that no other target uses Promote for these ops yet, so there shouldn't be any unexpected change in behavior. Fixes <rdar://problem/16202247> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/ValueTypes.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index b5dc14a704..8cf26fa30d 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -280,6 +280,14 @@ namespace llvm {
return getIntegerVT(Context, (EVTSize + 1) / 2);
}
+ /// \brief Return a VT for an integer vector type with the size of the
+ /// elements doubled. The typed returned may be an extended type.
+ EVT widenIntegerVectorElementType(LLVMContext &Context) const {
+ EVT EltVT = getVectorElementType();
+ EltVT = EVT::getIntegerVT(Context, 2 * EltVT.getSizeInBits());
+ return EVT::getVectorVT(Context, EltVT, getVectorNumElements());
+ }
+
/// isPow2VectorType - Returns true if the given vector is a power of 2.
bool isPow2VectorType() const {
unsigned NElts = getVectorNumElements();