would fail. E.g. udiv sint X, Y or sdiv uint X, Y would fail to find a
type match in the switch statement and fail the operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31338
91177308-0d34-0410-b5e6-
96231b3b80d8
+#define IMPLEMENT_SIGNLESS_BINOP(OP, TY1, TY2) \
+ case Type::TY2##TyID: IMPLEMENT_BINARY_OPERATOR(OP, TY1)
+
static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2,
const Type *Ty) {
GenericValue Dest;
if (Ty->isSigned())
Ty = Ty->getUnsignedVersion();
switch (Ty->getTypeID()) {
static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2,
const Type *Ty) {
GenericValue Dest;
if (Ty->isSigned())
Ty = Ty->getUnsignedVersion();
switch (Ty->getTypeID()) {
- IMPLEMENT_BINARY_OPERATOR(/, UByte);
- IMPLEMENT_BINARY_OPERATOR(/, UShort);
- IMPLEMENT_BINARY_OPERATOR(/, UInt);
- IMPLEMENT_BINARY_OPERATOR(/, ULong);
+ IMPLEMENT_SIGNLESS_BINOP(/, UByte, SByte);
+ IMPLEMENT_SIGNLESS_BINOP(/, UShort, Short);
+ IMPLEMENT_SIGNLESS_BINOP(/, UInt, Int);
+ IMPLEMENT_SIGNLESS_BINOP(/, ULong, Long);
default:
std::cout << "Unhandled type for UDiv instruction: " << *Ty << "\n";
abort();
default:
std::cout << "Unhandled type for UDiv instruction: " << *Ty << "\n";
abort();
if (Ty->isUnsigned())
Ty = Ty->getSignedVersion();
switch (Ty->getTypeID()) {
if (Ty->isUnsigned())
Ty = Ty->getSignedVersion();
switch (Ty->getTypeID()) {
- IMPLEMENT_BINARY_OPERATOR(/, SByte);
- IMPLEMENT_BINARY_OPERATOR(/, Short);
- IMPLEMENT_BINARY_OPERATOR(/, Int);
- IMPLEMENT_BINARY_OPERATOR(/, Long);
+ IMPLEMENT_SIGNLESS_BINOP(/, SByte, UByte);
+ IMPLEMENT_SIGNLESS_BINOP(/, Short, UShort);
+ IMPLEMENT_SIGNLESS_BINOP(/, Int, UInt);
+ IMPLEMENT_SIGNLESS_BINOP(/, Long, ULong);
default:
std::cout << "Unhandled type for SDiv instruction: " << *Ty << "\n";
abort();
default:
std::cout << "Unhandled type for SDiv instruction: " << *Ty << "\n";
abort();