mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-04 04:19:25 +00:00
Use range for
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -222,10 +222,8 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(TargetMachine &TM) :
|
|||||||
static const MVT::SimpleValueType IntTypes[] = {
|
static const MVT::SimpleValueType IntTypes[] = {
|
||||||
MVT::v2i32, MVT::v4i32
|
MVT::v2i32, MVT::v4i32
|
||||||
};
|
};
|
||||||
const size_t NumIntTypes = array_lengthof(IntTypes);
|
|
||||||
|
|
||||||
for (unsigned int x = 0; x < NumIntTypes; ++x) {
|
for (MVT VT : IntTypes) {
|
||||||
MVT::SimpleValueType VT = IntTypes[x];
|
|
||||||
//Expand the following operations for the current type by default
|
//Expand the following operations for the current type by default
|
||||||
setOperationAction(ISD::ADD, VT, Expand);
|
setOperationAction(ISD::ADD, VT, Expand);
|
||||||
setOperationAction(ISD::AND, VT, Expand);
|
setOperationAction(ISD::AND, VT, Expand);
|
||||||
@@ -249,10 +247,8 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(TargetMachine &TM) :
|
|||||||
static const MVT::SimpleValueType FloatTypes[] = {
|
static const MVT::SimpleValueType FloatTypes[] = {
|
||||||
MVT::v2f32, MVT::v4f32
|
MVT::v2f32, MVT::v4f32
|
||||||
};
|
};
|
||||||
const size_t NumFloatTypes = array_lengthof(FloatTypes);
|
|
||||||
|
|
||||||
for (unsigned int x = 0; x < NumFloatTypes; ++x) {
|
for (MVT VT : FloatTypes) {
|
||||||
MVT::SimpleValueType VT = FloatTypes[x];
|
|
||||||
setOperationAction(ISD::FABS, VT, Expand);
|
setOperationAction(ISD::FABS, VT, Expand);
|
||||||
setOperationAction(ISD::FADD, VT, Expand);
|
setOperationAction(ISD::FADD, VT, Expand);
|
||||||
setOperationAction(ISD::FCOS, VT, Expand);
|
setOperationAction(ISD::FCOS, VT, Expand);
|
||||||
|
@@ -54,7 +54,7 @@ unsigned AMDGPURegisterInfo::getSubRegFromChannel(unsigned Channel) const {
|
|||||||
AMDGPU::sub15
|
AMDGPU::sub15
|
||||||
};
|
};
|
||||||
|
|
||||||
assert (Channel < array_lengthof(SubRegs));
|
assert(Channel < array_lengthof(SubRegs));
|
||||||
return SubRegs[Channel];
|
return SubRegs[Channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,61 +39,55 @@ using namespace llvm;
|
|||||||
// TargetLowering Class Implementation Begins
|
// TargetLowering Class Implementation Begins
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
void AMDGPUTargetLowering::InitAMDILLowering() {
|
void AMDGPUTargetLowering::InitAMDILLowering() {
|
||||||
static const int types[] = {
|
static const MVT::SimpleValueType types[] = {
|
||||||
(int)MVT::i8,
|
MVT::i8,
|
||||||
(int)MVT::i16,
|
MVT::i16,
|
||||||
(int)MVT::i32,
|
MVT::i32,
|
||||||
(int)MVT::f32,
|
MVT::f32,
|
||||||
(int)MVT::f64,
|
MVT::f64,
|
||||||
(int)MVT::i64,
|
MVT::i64,
|
||||||
(int)MVT::v2i8,
|
MVT::v2i8,
|
||||||
(int)MVT::v4i8,
|
MVT::v4i8,
|
||||||
(int)MVT::v2i16,
|
MVT::v2i16,
|
||||||
(int)MVT::v4i16,
|
MVT::v4i16,
|
||||||
(int)MVT::v4f32,
|
MVT::v4f32,
|
||||||
(int)MVT::v4i32,
|
MVT::v4i32,
|
||||||
(int)MVT::v2f32,
|
MVT::v2f32,
|
||||||
(int)MVT::v2i32,
|
MVT::v2i32,
|
||||||
(int)MVT::v2f64,
|
MVT::v2f64,
|
||||||
(int)MVT::v2i64
|
MVT::v2i64
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int IntTypes[] = {
|
static const MVT::SimpleValueType IntTypes[] = {
|
||||||
(int)MVT::i8,
|
MVT::i8,
|
||||||
(int)MVT::i16,
|
MVT::i16,
|
||||||
(int)MVT::i32,
|
MVT::i32,
|
||||||
(int)MVT::i64
|
MVT::i64
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int FloatTypes[] = {
|
static const MVT::SimpleValueType FloatTypes[] = {
|
||||||
(int)MVT::f32,
|
MVT::f32,
|
||||||
(int)MVT::f64
|
MVT::f64
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int VectorTypes[] = {
|
static const MVT::SimpleValueType VectorTypes[] = {
|
||||||
(int)MVT::v2i8,
|
MVT::v2i8,
|
||||||
(int)MVT::v4i8,
|
MVT::v4i8,
|
||||||
(int)MVT::v2i16,
|
MVT::v2i16,
|
||||||
(int)MVT::v4i16,
|
MVT::v4i16,
|
||||||
(int)MVT::v4f32,
|
MVT::v4f32,
|
||||||
(int)MVT::v4i32,
|
MVT::v4i32,
|
||||||
(int)MVT::v2f32,
|
MVT::v2f32,
|
||||||
(int)MVT::v2i32,
|
MVT::v2i32,
|
||||||
(int)MVT::v2f64,
|
MVT::v2f64,
|
||||||
(int)MVT::v2i64
|
MVT::v2i64
|
||||||
};
|
};
|
||||||
const size_t NumTypes = array_lengthof(types);
|
|
||||||
const size_t NumFloatTypes = array_lengthof(FloatTypes);
|
|
||||||
const size_t NumIntTypes = array_lengthof(IntTypes);
|
|
||||||
const size_t NumVectorTypes = array_lengthof(VectorTypes);
|
|
||||||
|
|
||||||
const AMDGPUSubtarget &STM = getTargetMachine().getSubtarget<AMDGPUSubtarget>();
|
const AMDGPUSubtarget &STM = getTargetMachine().getSubtarget<AMDGPUSubtarget>();
|
||||||
// These are the current register classes that are
|
// These are the current register classes that are
|
||||||
// supported
|
// supported
|
||||||
|
|
||||||
for (unsigned int x = 0; x < NumTypes; ++x) {
|
for (MVT VT : types) {
|
||||||
MVT::SimpleValueType VT = (MVT::SimpleValueType)types[x];
|
|
||||||
|
|
||||||
setOperationAction(ISD::SUBE, VT, Expand);
|
setOperationAction(ISD::SUBE, VT, Expand);
|
||||||
setOperationAction(ISD::SUBC, VT, Expand);
|
setOperationAction(ISD::SUBC, VT, Expand);
|
||||||
setOperationAction(ISD::ADDE, VT, Expand);
|
setOperationAction(ISD::ADDE, VT, Expand);
|
||||||
@@ -109,9 +103,7 @@ void AMDGPUTargetLowering::InitAMDILLowering() {
|
|||||||
setOperationAction(ISD::SDIV, VT, Custom);
|
setOperationAction(ISD::SDIV, VT, Custom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (unsigned int x = 0; x < NumFloatTypes; ++x) {
|
for (MVT VT : FloatTypes) {
|
||||||
MVT::SimpleValueType VT = (MVT::SimpleValueType)FloatTypes[x];
|
|
||||||
|
|
||||||
// IL does not have these operations for floating point types
|
// IL does not have these operations for floating point types
|
||||||
setOperationAction(ISD::FP_ROUND_INREG, VT, Expand);
|
setOperationAction(ISD::FP_ROUND_INREG, VT, Expand);
|
||||||
setOperationAction(ISD::SETOLT, VT, Expand);
|
setOperationAction(ISD::SETOLT, VT, Expand);
|
||||||
@@ -124,9 +116,7 @@ void AMDGPUTargetLowering::InitAMDILLowering() {
|
|||||||
setOperationAction(ISD::SETULE, VT, Expand);
|
setOperationAction(ISD::SETULE, VT, Expand);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int x = 0; x < NumIntTypes; ++x) {
|
for (MVT VT : IntTypes) {
|
||||||
MVT::SimpleValueType VT = (MVT::SimpleValueType)IntTypes[x];
|
|
||||||
|
|
||||||
// GPU also does not have divrem function for signed or unsigned
|
// GPU also does not have divrem function for signed or unsigned
|
||||||
setOperationAction(ISD::SDIVREM, VT, Expand);
|
setOperationAction(ISD::SDIVREM, VT, Expand);
|
||||||
|
|
||||||
@@ -142,9 +132,7 @@ void AMDGPUTargetLowering::InitAMDILLowering() {
|
|||||||
setOperationAction(ISD::CTLZ, VT, Expand);
|
setOperationAction(ISD::CTLZ, VT, Expand);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int ii = 0; ii < NumVectorTypes; ++ii) {
|
for (MVT VT : VectorTypes) {
|
||||||
MVT::SimpleValueType VT = (MVT::SimpleValueType)VectorTypes[ii];
|
|
||||||
|
|
||||||
setOperationAction(ISD::VECTOR_SHUFFLE, VT, Expand);
|
setOperationAction(ISD::VECTOR_SHUFFLE, VT, Expand);
|
||||||
setOperationAction(ISD::SDIVREM, VT, Expand);
|
setOperationAction(ISD::SDIVREM, VT, Expand);
|
||||||
setOperationAction(ISD::SMUL_LOHI, VT, Expand);
|
setOperationAction(ISD::SMUL_LOHI, VT, Expand);
|
||||||
|
@@ -179,8 +179,7 @@ SITargetLowering::SITargetLowering(TargetMachine &TM) :
|
|||||||
MVT::v8i32, MVT::v8f32, MVT::v16i32, MVT::v16f32
|
MVT::v8i32, MVT::v8f32, MVT::v16i32, MVT::v16f32
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t NumVecTypes = array_lengthof(VecTypes);
|
for (MVT VT : VecTypes) {
|
||||||
for (unsigned Type = 0; Type < NumVecTypes; ++Type) {
|
|
||||||
for (unsigned Op = 0; Op < ISD::BUILTIN_OP_END; ++Op) {
|
for (unsigned Op = 0; Op < ISD::BUILTIN_OP_END; ++Op) {
|
||||||
switch(Op) {
|
switch(Op) {
|
||||||
case ISD::LOAD:
|
case ISD::LOAD:
|
||||||
@@ -194,7 +193,7 @@ SITargetLowering::SITargetLowering(TargetMachine &TM) :
|
|||||||
case ISD::EXTRACT_SUBVECTOR:
|
case ISD::EXTRACT_SUBVECTOR:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
setOperationAction(Op, VecTypes[Type], Expand);
|
setOperationAction(Op, VT, Expand);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user