mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
[mips] [IAS] Add support for the .set softfloat/hardfloat directives.
Summary: These directives are used to set the current value of the SoftFloat feature. Reviewers: dsanders Reviewed By: dsanders Subscribers: llvm-commits, mpf Differential Revision: http://reviews.llvm.org/D9074 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d929045eb5
commit
a5f14070fa
@ -247,6 +247,8 @@ class MipsAsmParser : public MCTargetAsmParser {
|
|||||||
bool parseSetFpDirective();
|
bool parseSetFpDirective();
|
||||||
bool parseSetPopDirective();
|
bool parseSetPopDirective();
|
||||||
bool parseSetPushDirective();
|
bool parseSetPushDirective();
|
||||||
|
bool parseSetSoftFloatDirective();
|
||||||
|
bool parseSetHardFloatDirective();
|
||||||
|
|
||||||
bool parseSetAssignment();
|
bool parseSetAssignment();
|
||||||
|
|
||||||
@ -3621,6 +3623,28 @@ bool MipsAsmParser::parseSetPushDirective() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MipsAsmParser::parseSetSoftFloatDirective() {
|
||||||
|
MCAsmParser &Parser = getParser();
|
||||||
|
Parser.Lex();
|
||||||
|
if (getLexer().isNot(AsmToken::EndOfStatement))
|
||||||
|
return reportParseError("unexpected token, expected end of statement");
|
||||||
|
|
||||||
|
setFeatureBits(Mips::FeatureSoftFloat, "soft-float");
|
||||||
|
getTargetStreamer().emitDirectiveSetSoftFloat();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MipsAsmParser::parseSetHardFloatDirective() {
|
||||||
|
MCAsmParser &Parser = getParser();
|
||||||
|
Parser.Lex();
|
||||||
|
if (getLexer().isNot(AsmToken::EndOfStatement))
|
||||||
|
return reportParseError("unexpected token, expected end of statement");
|
||||||
|
|
||||||
|
clearFeatureBits(Mips::FeatureSoftFloat, "soft-float");
|
||||||
|
getTargetStreamer().emitDirectiveSetHardFloat();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MipsAsmParser::parseSetAssignment() {
|
bool MipsAsmParser::parseSetAssignment() {
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
const MCExpr *Value;
|
const MCExpr *Value;
|
||||||
@ -3985,6 +4009,10 @@ bool MipsAsmParser::parseDirectiveSet() {
|
|||||||
return parseSetMsaDirective();
|
return parseSetMsaDirective();
|
||||||
} else if (Tok.getString() == "nomsa") {
|
} else if (Tok.getString() == "nomsa") {
|
||||||
return parseSetNoMsaDirective();
|
return parseSetNoMsaDirective();
|
||||||
|
} else if (Tok.getString() == "softfloat") {
|
||||||
|
return parseSetSoftFloatDirective();
|
||||||
|
} else if (Tok.getString() == "hardfloat") {
|
||||||
|
return parseSetHardFloatDirective();
|
||||||
} else {
|
} else {
|
||||||
// It is just an identifier, look for an assignment.
|
// It is just an identifier, look for an assignment.
|
||||||
parseSetAssignment();
|
parseSetAssignment();
|
||||||
|
@ -81,6 +81,12 @@ void MipsTargetStreamer::emitDirectiveSetMips64R5() { forbidModuleDirective(); }
|
|||||||
void MipsTargetStreamer::emitDirectiveSetMips64R6() { forbidModuleDirective(); }
|
void MipsTargetStreamer::emitDirectiveSetMips64R6() { forbidModuleDirective(); }
|
||||||
void MipsTargetStreamer::emitDirectiveSetPop() { forbidModuleDirective(); }
|
void MipsTargetStreamer::emitDirectiveSetPop() { forbidModuleDirective(); }
|
||||||
void MipsTargetStreamer::emitDirectiveSetPush() { forbidModuleDirective(); }
|
void MipsTargetStreamer::emitDirectiveSetPush() { forbidModuleDirective(); }
|
||||||
|
void MipsTargetStreamer::emitDirectiveSetSoftFloat() {
|
||||||
|
forbidModuleDirective();
|
||||||
|
}
|
||||||
|
void MipsTargetStreamer::emitDirectiveSetHardFloat() {
|
||||||
|
forbidModuleDirective();
|
||||||
|
}
|
||||||
void MipsTargetStreamer::emitDirectiveSetDsp() { forbidModuleDirective(); }
|
void MipsTargetStreamer::emitDirectiveSetDsp() { forbidModuleDirective(); }
|
||||||
void MipsTargetStreamer::emitDirectiveSetNoDsp() { forbidModuleDirective(); }
|
void MipsTargetStreamer::emitDirectiveSetNoDsp() { forbidModuleDirective(); }
|
||||||
void MipsTargetStreamer::emitDirectiveCpLoad(unsigned RegNo) {}
|
void MipsTargetStreamer::emitDirectiveCpLoad(unsigned RegNo) {}
|
||||||
@ -308,6 +314,16 @@ void MipsTargetAsmStreamer::emitDirectiveSetPush() {
|
|||||||
MipsTargetStreamer::emitDirectiveSetPush();
|
MipsTargetStreamer::emitDirectiveSetPush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MipsTargetAsmStreamer::emitDirectiveSetSoftFloat() {
|
||||||
|
OS << "\t.set\tsoftfloat\n";
|
||||||
|
MipsTargetStreamer::emitDirectiveSetSoftFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MipsTargetAsmStreamer::emitDirectiveSetHardFloat() {
|
||||||
|
OS << "\t.set\thardfloat\n";
|
||||||
|
MipsTargetStreamer::emitDirectiveSetHardFloat();
|
||||||
|
}
|
||||||
|
|
||||||
// Print a 32 bit hex number with all numbers.
|
// Print a 32 bit hex number with all numbers.
|
||||||
static void printHex32(unsigned Value, raw_ostream &OS) {
|
static void printHex32(unsigned Value, raw_ostream &OS) {
|
||||||
OS << "0x";
|
OS << "0x";
|
||||||
|
@ -72,6 +72,8 @@ public:
|
|||||||
virtual void emitDirectiveSetNoDsp();
|
virtual void emitDirectiveSetNoDsp();
|
||||||
virtual void emitDirectiveSetPop();
|
virtual void emitDirectiveSetPop();
|
||||||
virtual void emitDirectiveSetPush();
|
virtual void emitDirectiveSetPush();
|
||||||
|
virtual void emitDirectiveSetSoftFloat();
|
||||||
|
virtual void emitDirectiveSetHardFloat();
|
||||||
|
|
||||||
// PIC support
|
// PIC support
|
||||||
virtual void emitDirectiveCpLoad(unsigned RegNo);
|
virtual void emitDirectiveCpLoad(unsigned RegNo);
|
||||||
@ -188,6 +190,8 @@ public:
|
|||||||
void emitDirectiveSetNoDsp() override;
|
void emitDirectiveSetNoDsp() override;
|
||||||
void emitDirectiveSetPop() override;
|
void emitDirectiveSetPop() override;
|
||||||
void emitDirectiveSetPush() override;
|
void emitDirectiveSetPush() override;
|
||||||
|
void emitDirectiveSetSoftFloat() override;
|
||||||
|
void emitDirectiveSetHardFloat() override;
|
||||||
|
|
||||||
// PIC support
|
// PIC support
|
||||||
void emitDirectiveCpLoad(unsigned RegNo) override;
|
void emitDirectiveCpLoad(unsigned RegNo) override;
|
||||||
|
14
test/MC/Mips/set-softfloat-hardfloat-bad.s
Normal file
14
test/MC/Mips/set-softfloat-hardfloat-bad.s
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# RUN: not llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32 -mattr=+soft-float 2>%t1
|
||||||
|
# RUN: FileCheck %s < %t1
|
||||||
|
|
||||||
|
.set hardfloat
|
||||||
|
add.s $f2, $f2, $f2
|
||||||
|
# CHECK-NOT: :[[@LINE-1]]:3: error: instruction requires a CPU feature not currently enabled
|
||||||
|
sub.s $f2, $f2, $f2
|
||||||
|
# CHECK-NOT: :[[@LINE-1]]:3: error: instruction requires a CPU feature not currently enabled
|
||||||
|
|
||||||
|
.set softfloat
|
||||||
|
add.s $f2, $f2, $f2
|
||||||
|
# CHECK: :[[@LINE-1]]:3: error: instruction requires a CPU feature not currently enabled
|
||||||
|
sub.s $f2, $f2, $f2
|
||||||
|
# CHECK: :[[@LINE-1]]:3: error: instruction requires a CPU feature not currently enabled
|
12
test/MC/Mips/set-softfloat-hardfloat.s
Normal file
12
test/MC/Mips/set-softfloat-hardfloat.s
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# RUN: llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r2 -mattr=+soft-float | \
|
||||||
|
# RUN: FileCheck %s
|
||||||
|
|
||||||
|
.set hardfloat
|
||||||
|
add.s $f2, $f2, $f2
|
||||||
|
sub.s $f2, $f2, $f2
|
||||||
|
.set softfloat
|
||||||
|
|
||||||
|
# CHECK: .set hardfloat
|
||||||
|
# CHECK: add.s $f2, $f2, $f2
|
||||||
|
# CHECK: sub.s $f2, $f2, $f2
|
||||||
|
# CHECK: .set softfloat
|
Loading…
Reference in New Issue
Block a user