1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[X86] Make some for loops over MVTs more explicit (and shorter) by just mentioning all the relevant types in an initializer list. NFC

llvm-svn: 251500
This commit is contained in:
Craig Topper 2015-10-28 05:48:32 +00:00
parent 552163ae71
commit f193656e65

View File

@ -858,14 +858,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
// ISD::CTTZ_ZERO_UNDEF v2i64 - scalarization is faster. // ISD::CTTZ_ZERO_UNDEF v2i64 - scalarization is faster.
// Custom lower build_vector, vector_shuffle, and extract_vector_elt. // Custom lower build_vector, vector_shuffle, and extract_vector_elt.
for (int i = MVT::v16i8; i != MVT::v2i64; ++i) { for (auto VT : { MVT::v16i8, MVT::v8i16, MVT::v4i32 }) {
MVT VT = (MVT::SimpleValueType)i;
// Do not attempt to custom lower non-power-of-2 vectors
if (!isPowerOf2_32(VT.getVectorNumElements()))
continue;
// Do not attempt to custom lower non-128-bit vectors
if (!VT.is128BitVector())
continue;
setOperationAction(ISD::BUILD_VECTOR, VT, Custom); setOperationAction(ISD::BUILD_VECTOR, VT, Custom);
setOperationAction(ISD::VECTOR_SHUFFLE, VT, Custom); setOperationAction(ISD::VECTOR_SHUFFLE, VT, Custom);
setOperationAction(ISD::VSELECT, VT, Custom); setOperationAction(ISD::VSELECT, VT, Custom);
@ -903,13 +896,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
} }
// Promote v16i8, v8i16, v4i32 load, select, and, or, xor to v2i64. // Promote v16i8, v8i16, v4i32 load, select, and, or, xor to v2i64.
for (int i = MVT::v16i8; i != MVT::v2i64; ++i) { for (auto VT : { MVT::v16i8, MVT::v8i16, MVT::v4i32 }) {
MVT VT = (MVT::SimpleValueType)i;
// Do not attempt to promote non-128-bit vectors
if (!VT.is128BitVector())
continue;
setOperationAction(ISD::AND, VT, Promote); setOperationAction(ISD::AND, VT, Promote);
AddPromotedToType (ISD::AND, VT, MVT::v2i64); AddPromotedToType (ISD::AND, VT, MVT::v2i64);
setOperationAction(ISD::OR, VT, Promote); setOperationAction(ISD::OR, VT, Promote);
@ -1288,13 +1275,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setOperationAction(ISD::VSELECT, MVT::v32i8, Legal); setOperationAction(ISD::VSELECT, MVT::v32i8, Legal);
// Promote v32i8, v16i16, v8i32 select, and, or, xor to v4i64. // Promote v32i8, v16i16, v8i32 select, and, or, xor to v4i64.
for (int i = MVT::v32i8; i != MVT::v4i64; ++i) { for (auto VT : { MVT::v32i8, MVT::v16i16, MVT::v8i32 }) {
MVT VT = (MVT::SimpleValueType)i;
// Do not attempt to promote non-256-bit vectors
if (!VT.is256BitVector())
continue;
setOperationAction(ISD::AND, VT, Promote); setOperationAction(ISD::AND, VT, Promote);
AddPromotedToType (ISD::AND, VT, MVT::v4i64); AddPromotedToType (ISD::AND, VT, MVT::v4i64);
setOperationAction(ISD::OR, VT, Promote); setOperationAction(ISD::OR, VT, Promote);
@ -1602,13 +1583,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setOperationAction(ISD::MSTORE, VT, Legal); setOperationAction(ISD::MSTORE, VT, Legal);
} }
} }
for (int i = MVT::v32i8; i != MVT::v8i64; ++i) { for (auto VT : { MVT::v64i8, MVT::v32i16, MVT::v16i32 }) {
MVT VT = (MVT::SimpleValueType)i;
// Do not attempt to promote non-512-bit vectors.
if (!VT.is512BitVector())
continue;
setOperationAction(ISD::SELECT, VT, Promote); setOperationAction(ISD::SELECT, VT, Promote);
AddPromotedToType (ISD::SELECT, VT, MVT::v8i64); AddPromotedToType (ISD::SELECT, VT, MVT::v8i64);
} }
@ -1685,19 +1660,9 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setOperationAction(ISD::CTLZ_ZERO_UNDEF, MVT::v64i8, Custom); setOperationAction(ISD::CTLZ_ZERO_UNDEF, MVT::v64i8, Custom);
} }
for (int i = MVT::v32i8; i != MVT::v8i64; ++i) { for (auto VT : { MVT::v64i8, MVT::v32i16 }) {
const MVT VT = (MVT::SimpleValueType)i; setOperationAction(ISD::BUILD_VECTOR, VT, Custom);
setOperationAction(ISD::VSELECT, VT, Legal);
const unsigned EltSize = VT.getVectorElementType().getSizeInBits();
// Do not attempt to promote non-512-bit vectors.
if (!VT.is512BitVector())
continue;
if (EltSize < 32) {
setOperationAction(ISD::BUILD_VECTOR, VT, Custom);
setOperationAction(ISD::VSELECT, VT, Legal);
}
} }
} }