[mips] Add support to '.set mips64'.
authorMatheus Almeida <matheus.almeida@imgtec.com>
Wed, 26 Mar 2014 15:14:32 +0000 (15:14 +0000)
committerMatheus Almeida <matheus.almeida@imgtec.com>
Wed, 26 Mar 2014 15:14:32 +0000 (15:14 +0000)
The '.set mips64' directive enables the feature Mips:FeatureMips64
from assembly. Note that it doesn't modify the ELF header as opposed
to the use of -mips64 from the command-line. The reason for this
is that we want to be as compatible as possible with existing assemblers
like GAS.

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

lib/Target/Mips/AsmParser/MipsAsmParser.cpp
lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
lib/Target/Mips/MipsTargetStreamer.h
test/MC/Mips/mips_directives.s

index 2244e3dec646c8d0101816fe8e6c00dc2bfe48c5..35c1f4bf4f59dc9241a19548cfc17bad40e6968f 100644 (file)
@@ -2489,6 +2489,10 @@ bool MipsAsmParser::parseSetFeature(uint64_t Feature) {
       setFeatureBits(Mips::FeatureMips32r2, "mips32r2");
       getTargetStreamer().emitDirectiveSetMips32R2();
     break;
+    case Mips::FeatureMips64:
+      setFeatureBits(Mips::FeatureMips64, "mips64");
+      getTargetStreamer().emitDirectiveSetMips64();
+    break;
     case Mips::FeatureMips64r2:
       setFeatureBits(Mips::FeatureMips64r2, "mips64r2");
       getTargetStreamer().emitDirectiveSetMips64R2();
@@ -2526,6 +2530,8 @@ bool MipsAsmParser::parseDirectiveSet() {
       return parseSetFeature(Mips::FeatureMicroMips);
   } else if (Tok.getString() == "mips32r2") {
       return parseSetFeature(Mips::FeatureMips32r2);
+  } else if (Tok.getString() == "mips64") {
+      return parseSetFeature(Mips::FeatureMips64);
   } else if (Tok.getString() == "mips64r2") {
       return parseSetFeature(Mips::FeatureMips64r2);
   } else if (Tok.getString() == "dsp") {
index f21dbed3c8a6ff6332fa6d7383db6ff0097c47da..01730dd773c8206ce4bb4052becc7b09a831d963 100644 (file)
@@ -105,6 +105,10 @@ void MipsTargetAsmStreamer::emitDirectiveSetMips32R2() {
   OS << "\t.set\tmips32r2\n";
 }
 
+void MipsTargetAsmStreamer::emitDirectiveSetMips64() {
+  OS << "\t.set\tmips64\n";
+}
+
 void MipsTargetAsmStreamer::emitDirectiveSetMips64R2() {
   OS << "\t.set\tmips64r2\n";
 }
@@ -359,6 +363,10 @@ void MipsTargetELFStreamer::emitDirectiveSetMips32R2() {
   // No action required for ELF output.
 }
 
+void MipsTargetELFStreamer::emitDirectiveSetMips64() {
+  // No action required for ELF output.
+}
+
 void MipsTargetELFStreamer::emitDirectiveSetMips64R2() {
   // No action required for ELF output.
 }
index e8349a6e3e775b9328370e8a35add7797f4fbe58..5f4b74b3ba054536f9b8b512427a128e3941f470 100644 (file)
@@ -42,6 +42,7 @@ public:
   virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) = 0;
 
   virtual void emitDirectiveSetMips32R2() = 0;
+  virtual void emitDirectiveSetMips64() = 0;
   virtual void emitDirectiveSetMips64R2() = 0;
   virtual void emitDirectiveSetDsp() = 0;
 };
@@ -75,6 +76,7 @@ public:
   virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
 
   virtual void emitDirectiveSetMips32R2();
+  virtual void emitDirectiveSetMips64();
   virtual void emitDirectiveSetMips64R2();
   virtual void emitDirectiveSetDsp();
 };
@@ -117,6 +119,7 @@ public:
   virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
 
   virtual void emitDirectiveSetMips32R2();
+  virtual void emitDirectiveSetMips64();
   virtual void emitDirectiveSetMips64R2();
   virtual void emitDirectiveSetDsp();
 };
index b856095120698c1b80c68b6d054336122941d591..6780dd0b3ca5128d03240a616d52cbee6424f76f 100644 (file)
@@ -65,6 +65,11 @@ $BB0_4:
     luxc1   $f0, $6($5)
     lwxc1   $f6, $2($5)
 
+# CHECK: .set mips64
+# CHECK: dadd $3, $3, $3
+    .set mips64
+    dadd   $3, $3, $3                  # encoding: [0x00,0x62,0x18,0x2c]
+
 # CHECK: .set mips64r2
 # CHECK: drotr $9, $6, 30              # encoding: [0x00,0x26,0x4f,0xba]
     .set mips64r2