forked from OSchip/llvm-project
[mips] implement .set dspr2 directive
Implement .set dspr2 directive with appropriate feature bits. This directive is a counterpart of -mattr=dspr2 command line option with the exception that it does not influence elf header flags. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D38537 llvm-svn: 314994
This commit is contained in:
parent
2d3f8f333d
commit
65f10246bb
|
@ -6584,6 +6584,10 @@ bool MipsAsmParser::parseSetFeature(uint64_t Feature) {
|
|||
setFeatureBits(Mips::FeatureDSP, "dsp");
|
||||
getTargetStreamer().emitDirectiveSetDsp();
|
||||
break;
|
||||
case Mips::FeatureDSPR2:
|
||||
setFeatureBits(Mips::FeatureDSPR2, "dspr2");
|
||||
getTargetStreamer().emitDirectiveSetDspr2();
|
||||
break;
|
||||
case Mips::FeatureMicroMips:
|
||||
setFeatureBits(Mips::FeatureMicroMips, "micromips");
|
||||
getTargetStreamer().emitDirectiveSetMicroMips();
|
||||
|
@ -6928,6 +6932,8 @@ bool MipsAsmParser::parseDirectiveSet() {
|
|||
return parseSetFeature(Mips::FeatureMips64r6);
|
||||
} else if (Tok.getString() == "dsp") {
|
||||
return parseSetFeature(Mips::FeatureDSP);
|
||||
} else if (Tok.getString() == "dspr2") {
|
||||
return parseSetFeature(Mips::FeatureDSPR2);
|
||||
} else if (Tok.getString() == "nodsp") {
|
||||
return parseSetNoDspDirective();
|
||||
} else if (Tok.getString() == "msa") {
|
||||
|
|
|
@ -98,6 +98,7 @@ void MipsTargetStreamer::emitDirectiveSetHardFloat() {
|
|||
forbidModuleDirective();
|
||||
}
|
||||
void MipsTargetStreamer::emitDirectiveSetDsp() { forbidModuleDirective(); }
|
||||
void MipsTargetStreamer::emitDirectiveSetDspr2() { forbidModuleDirective(); }
|
||||
void MipsTargetStreamer::emitDirectiveSetNoDsp() { forbidModuleDirective(); }
|
||||
void MipsTargetStreamer::emitDirectiveCpLoad(unsigned RegNo) {}
|
||||
bool MipsTargetStreamer::emitDirectiveCpRestore(
|
||||
|
@ -547,6 +548,11 @@ void MipsTargetAsmStreamer::emitDirectiveSetDsp() {
|
|||
MipsTargetStreamer::emitDirectiveSetDsp();
|
||||
}
|
||||
|
||||
void MipsTargetAsmStreamer::emitDirectiveSetDspr2() {
|
||||
OS << "\t.set\tdspr2\n";
|
||||
MipsTargetStreamer::emitDirectiveSetDspr2();
|
||||
}
|
||||
|
||||
void MipsTargetAsmStreamer::emitDirectiveSetNoDsp() {
|
||||
OS << "\t.set\tnodsp\n";
|
||||
MipsTargetStreamer::emitDirectiveSetNoDsp();
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
virtual void emitDirectiveSetMips64R5();
|
||||
virtual void emitDirectiveSetMips64R6();
|
||||
virtual void emitDirectiveSetDsp();
|
||||
virtual void emitDirectiveSetDspr2();
|
||||
virtual void emitDirectiveSetNoDsp();
|
||||
virtual void emitDirectiveSetPop();
|
||||
virtual void emitDirectiveSetPush();
|
||||
|
@ -244,6 +245,7 @@ public:
|
|||
void emitDirectiveSetMips64R5() override;
|
||||
void emitDirectiveSetMips64R6() override;
|
||||
void emitDirectiveSetDsp() override;
|
||||
void emitDirectiveSetDspr2() override;
|
||||
void emitDirectiveSetNoDsp() override;
|
||||
void emitDirectiveSetPop() override;
|
||||
void emitDirectiveSetPush() override;
|
||||
|
|
|
@ -83,3 +83,10 @@ $BB0_4:
|
|||
.set dsp
|
||||
lbux $7, $10($11)
|
||||
lhx $5, $6($7)
|
||||
|
||||
# CHECK: .set dspr2
|
||||
# CHECK: append $7, $10, 2 # encoding: [0x7d,0x47,0x10,0x31]
|
||||
# CHECK: balign $5, $6, 3 # encoding: [0x7c,0xc5,0x1c,0x31]
|
||||
.set dspr2
|
||||
append $7, $10, 2
|
||||
balign $5, $6, 3
|
|
@ -157,6 +157,10 @@
|
|||
.module fp=64
|
||||
# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
|
||||
|
||||
.set dspr2
|
||||
.module fp=64
|
||||
# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
|
||||
|
||||
.llvm_internal_mips_reallow_module_directive
|
||||
.module fp=32
|
||||
# CHECK-NOT: :[[@LINE-1]]:13: error: .module directive must appear before any code
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# RUN: not llvm-mc %s -mcpu=mips32 -mattr=+dsp -triple mips-unknown-linux 2>%t1
|
||||
# RUN: not llvm-mc %s -mcpu=mips32 -mattr=+dspr2 -triple mips-unknown-linux 2>%t1
|
||||
# RUN: FileCheck %s < %t1
|
||||
|
||||
lbux $7, $10($11)
|
||||
append $4, $10, 2
|
||||
|
||||
.set nodsp
|
||||
lbux $6, $10($11)
|
||||
|
@ -10,3 +11,11 @@
|
|||
.set dsp
|
||||
lbux $5, $10($11)
|
||||
# CHECK-NOT: error: instruction requires a CPU feature not currently enabled
|
||||
|
||||
.set nodsp
|
||||
append $3, $10, 2
|
||||
# CHECK: error: instruction requires a CPU feature not currently enabled
|
||||
|
||||
.set dspr2
|
||||
append $2, $10, 2
|
||||
# CHECK-NOT: error: instruction requires a CPU feature not currently enabled
|
||||
|
|
Loading…
Reference in New Issue