Make getClass more robust by adding cLong.
authorBrian Gaeke <gaeke@uiuc.edu>
Tue, 16 Mar 2004 22:37:11 +0000 (22:37 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Tue, 16 Mar 2004 22:37:11 +0000 (22:37 +0000)
Add handling for Mul instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12450 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/InstSelectSimple.cpp
lib/Target/Sparc/SparcV8ISelSimple.cpp
lib/Target/SparcV8/InstSelectSimple.cpp
lib/Target/SparcV8/SparcV8ISelSimple.cpp

index 90fdacbeeef00af08954e2f7871940ba23b558d7..1ba42858d0e15dd726d21e3c8299cdbd4dd29bd7 100644 (file)
@@ -143,7 +143,7 @@ FunctionPass *llvm::createSparcV8SimpleInstructionSelector(TargetMachine &TM) {
 }
 
 enum TypeClass {
-  cByte, cShort, cInt, cFloat, cDouble
+  cByte, cShort, cInt, cLong, cFloat, cDouble
 };
 
 static TypeClass getClass (const Type *T) {
@@ -151,6 +151,7 @@ static TypeClass getClass (const Type *T) {
     case Type::UByteTyID:  case Type::SByteTyID:  return cByte;
     case Type::UShortTyID: case Type::ShortTyID:  return cShort;
     case Type::UIntTyID:   case Type::IntTyID:    return cInt;
+    case Type::ULongTyID:  case Type::LongTyID:   return cLong;
     case Type::FloatTyID:                         return cFloat;
     case Type::DoubleTyID:                        return cDouble;
     default:
@@ -261,6 +262,11 @@ void V8ISel::visitBinaryOperator (BinaryOperator &I) {
     case Instruction::Sub: 
       BuildMI (BB, V8::SUBrr, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
       break;
+    case Instruction::Mul: {
+      unsigned MulOpcode = I.getType ()->isSigned () ? V8::SMULrr : V8::UMULrr;
+      BuildMI (BB, MulOpcode, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
+      break;
+    }
     default:
       visitInstruction (I);
       return;
index 90fdacbeeef00af08954e2f7871940ba23b558d7..1ba42858d0e15dd726d21e3c8299cdbd4dd29bd7 100644 (file)
@@ -143,7 +143,7 @@ FunctionPass *llvm::createSparcV8SimpleInstructionSelector(TargetMachine &TM) {
 }
 
 enum TypeClass {
-  cByte, cShort, cInt, cFloat, cDouble
+  cByte, cShort, cInt, cLong, cFloat, cDouble
 };
 
 static TypeClass getClass (const Type *T) {
@@ -151,6 +151,7 @@ static TypeClass getClass (const Type *T) {
     case Type::UByteTyID:  case Type::SByteTyID:  return cByte;
     case Type::UShortTyID: case Type::ShortTyID:  return cShort;
     case Type::UIntTyID:   case Type::IntTyID:    return cInt;
+    case Type::ULongTyID:  case Type::LongTyID:   return cLong;
     case Type::FloatTyID:                         return cFloat;
     case Type::DoubleTyID:                        return cDouble;
     default:
@@ -261,6 +262,11 @@ void V8ISel::visitBinaryOperator (BinaryOperator &I) {
     case Instruction::Sub: 
       BuildMI (BB, V8::SUBrr, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
       break;
+    case Instruction::Mul: {
+      unsigned MulOpcode = I.getType ()->isSigned () ? V8::SMULrr : V8::UMULrr;
+      BuildMI (BB, MulOpcode, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
+      break;
+    }
     default:
       visitInstruction (I);
       return;
index 90fdacbeeef00af08954e2f7871940ba23b558d7..1ba42858d0e15dd726d21e3c8299cdbd4dd29bd7 100644 (file)
@@ -143,7 +143,7 @@ FunctionPass *llvm::createSparcV8SimpleInstructionSelector(TargetMachine &TM) {
 }
 
 enum TypeClass {
-  cByte, cShort, cInt, cFloat, cDouble
+  cByte, cShort, cInt, cLong, cFloat, cDouble
 };
 
 static TypeClass getClass (const Type *T) {
@@ -151,6 +151,7 @@ static TypeClass getClass (const Type *T) {
     case Type::UByteTyID:  case Type::SByteTyID:  return cByte;
     case Type::UShortTyID: case Type::ShortTyID:  return cShort;
     case Type::UIntTyID:   case Type::IntTyID:    return cInt;
+    case Type::ULongTyID:  case Type::LongTyID:   return cLong;
     case Type::FloatTyID:                         return cFloat;
     case Type::DoubleTyID:                        return cDouble;
     default:
@@ -261,6 +262,11 @@ void V8ISel::visitBinaryOperator (BinaryOperator &I) {
     case Instruction::Sub: 
       BuildMI (BB, V8::SUBrr, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
       break;
+    case Instruction::Mul: {
+      unsigned MulOpcode = I.getType ()->isSigned () ? V8::SMULrr : V8::UMULrr;
+      BuildMI (BB, MulOpcode, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
+      break;
+    }
     default:
       visitInstruction (I);
       return;
index 90fdacbeeef00af08954e2f7871940ba23b558d7..1ba42858d0e15dd726d21e3c8299cdbd4dd29bd7 100644 (file)
@@ -143,7 +143,7 @@ FunctionPass *llvm::createSparcV8SimpleInstructionSelector(TargetMachine &TM) {
 }
 
 enum TypeClass {
-  cByte, cShort, cInt, cFloat, cDouble
+  cByte, cShort, cInt, cLong, cFloat, cDouble
 };
 
 static TypeClass getClass (const Type *T) {
@@ -151,6 +151,7 @@ static TypeClass getClass (const Type *T) {
     case Type::UByteTyID:  case Type::SByteTyID:  return cByte;
     case Type::UShortTyID: case Type::ShortTyID:  return cShort;
     case Type::UIntTyID:   case Type::IntTyID:    return cInt;
+    case Type::ULongTyID:  case Type::LongTyID:   return cLong;
     case Type::FloatTyID:                         return cFloat;
     case Type::DoubleTyID:                        return cDouble;
     default:
@@ -261,6 +262,11 @@ void V8ISel::visitBinaryOperator (BinaryOperator &I) {
     case Instruction::Sub: 
       BuildMI (BB, V8::SUBrr, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
       break;
+    case Instruction::Mul: {
+      unsigned MulOpcode = I.getType ()->isSigned () ? V8::SMULrr : V8::UMULrr;
+      BuildMI (BB, MulOpcode, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
+      break;
+    }
     default:
       visitInstruction (I);
       return;