Index: lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h =================================================================== --- lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h +++ lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h @@ -115,7 +115,7 @@ 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 @@ 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; } Index: lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp =================================================================== --- lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp +++ lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp @@ -41,6 +41,12 @@ } } +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 Index: test/MC/Mips/mips_abi_flags_xx.s =================================================================== --- test/MC/Mips/mips_abi_flags_xx.s +++ test/MC/Mips/mips_abi_flags_xx.s @@ -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: }