[llvm] r213243 - [mips] Correct .MIPS.abiflags for -mfpxx on MIPS32r6

Daniel Sanders daniel.sanders at imgtec.com
Thu Jul 17 02:57:23 PDT 2014


Author: dsanders
Date: Thu Jul 17 04:57:23 2014
New Revision: 213243

URL: http://llvm.org/viewvc/llvm-project?rev=213243&view=rev
Log:
[mips] Correct .MIPS.abiflags for -mfpxx on MIPS32r6

Summary:
The cpr1_size field describes the minimum register width to run the program
rather than the size of the registers on the target. MIPS32r6 was acting
as if -mfp64 has been given because it starts off with 64-bit FPU registers.

Differential Revision: http://reviews.llvm.org/D4538

Modified:
    llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp
    llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h
    llvm/trunk/test/MC/Mips/mips_abi_flags_xx.s

Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp?rev=213243&r1=213242&r2=213243&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp Thu Jul 17 04:57:23 2014
@@ -41,6 +41,12 @@ StringRef MipsABIFlagsSection::getFpABIS
   }
 }
 
+uint8_t MipsABIFlagsSection::getCPR1SizeValue() {
+  if (FpABI == FpABIKind::XX)
+    return (uint8_t)AFL_REG_32;
+  return (uint8_t)CPR1Size;
+}
+
 namespace llvm {
 MCStreamer &operator<<(MCStreamer &OS, MipsABIFlagsSection &ABIFlagsSection) {
   // Write out a Elf_Internal_ABIFlags_v0 struct

Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h?rev=213243&r1=213242&r2=213243&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h Thu Jul 17 04:57:23 2014
@@ -115,7 +115,7 @@ public:
   uint8_t getISALevelValue() { return (uint8_t)ISALevel; }
   uint8_t getISARevisionValue() { return (uint8_t)ISARevision; }
   uint8_t getGPRSizeValue() { return (uint8_t)GPRSize; }
-  uint8_t getCPR1SizeValue() { return (uint8_t)CPR1Size; }
+  uint8_t getCPR1SizeValue();
   uint8_t getCPR2SizeValue() { return (uint8_t)CPR2Size; }
   uint8_t getFpABIValue();
   uint32_t getISAExtensionSetValue() { return (uint32_t)ISAExtensionSet; }
@@ -212,10 +212,10 @@ public:
     if (P.isABI_N32() || P.isABI_N64())
       FpABI = FpABIKind::S64;
     else if (P.isABI_O32()) {
-      if (P.isFP64bit())
-        FpABI = FpABIKind::S64;
-      else if (P.isABI_FPXX())
+      if (P.isABI_FPXX())
         FpABI = FpABIKind::XX;
+      else if (P.isFP64bit())
+        FpABI = FpABIKind::S64;
       else
         FpABI = FpABIKind::S32;
     }

Modified: llvm/trunk/test/MC/Mips/mips_abi_flags_xx.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips_abi_flags_xx.s?rev=213243&r1=213242&r2=213243&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips_abi_flags_xx.s (original)
+++ llvm/trunk/test/MC/Mips/mips_abi_flags_xx.s Thu Jul 17 04:57:23 2014
@@ -3,11 +3,15 @@
 #
 # RUN: llvm-mc %s -arch=mips -mcpu=mips32 -filetype=obj -o - | \
 # RUN:   llvm-readobj -sections -section-data -section-relocations - | \
-# RUN:     FileCheck %s -check-prefix=CHECK-OBJ
+# RUN:     FileCheck %s -check-prefix=CHECK-OBJ -check-prefix=CHECK-OBJ-R1
 
 # RUN: llvm-mc /dev/null -arch=mips -mcpu=mips32 -mattr=fpxx -filetype=obj -o - | \
 # RUN:   llvm-readobj -sections -section-data -section-relocations - | \
-# RUN:     FileCheck %s -check-prefix=CHECK-OBJ
+# RUN:     FileCheck %s -check-prefix=CHECK-OBJ -check-prefix=CHECK-OBJ-R1
+
+# RUN: llvm-mc /dev/null -arch=mips -mcpu=mips32r6 -mattr=fpxx -filetype=obj -o - | \
+# RUN:   llvm-readobj -sections -section-data -section-relocations - | \
+# RUN:     FileCheck %s -check-prefix=CHECK-OBJ -check-prefix=CHECK-OBJ-R6
 
 # CHECK-ASM: .module fp=xx
 
@@ -28,7 +32,8 @@
 # CHECK-OBJ:         Relocations [
 # CHECK-OBJ:         ]
 # CHECK-OBJ:         SectionData (
-# CHECK-OBJ:           0000: 00002001 01010005 00000000 00000000  |.. .............|
+# CHECK-OBJ-R1:        0000: 00002001 01010005 00000000 00000000  |.. .............|
+# CHECK-OBJ-R6:        0000: 00002006 01010005 00000000 00000000  |.. .............|
 # CHECK-OBJ:           0010: 00000001 00000000                    |........|
 # CHECK-OBJ:         )
 # CHECK-OBJ-LABEL: }





More information about the llvm-commits mailing list