[llvm] r336296 - [mips] Warn when crc, ginv, virt flags are used with too old revision
Vladimir Stefanovic via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 4 12:26:31 PDT 2018
Author: vstefanovic
Date: Wed Jul 4 12:26:31 2018
New Revision: 336296
URL: http://llvm.org/viewvc/llvm-project?rev=336296&view=rev
Log:
[mips] Warn when crc, ginv, virt flags are used with too old revision
CRC and GINV ASE require revision 6, Virtualization requires revision 5.
Print a warning when revision is older than required.
Differential Revision: https://reviews.llvm.org/D48843
Added:
llvm/trunk/test/CodeGen/Mips/ase_warnings.ll
Removed:
llvm/trunk/test/CodeGen/Mips/dsp_msa_warning.ll
Modified:
llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
llvm/trunk/lib/Target/Mips/MipsSubtarget.h
Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=336296&r1=336295&r2=336296&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Wed Jul 4 12:26:31 2018
@@ -61,8 +61,10 @@ static cl::opt<bool>
cl::desc("Enable gp-relative addressing of mips small data items"));
bool MipsSubtarget::DspWarningPrinted = false;
-
bool MipsSubtarget::MSAWarningPrinted = false;
+bool MipsSubtarget::VirtWarningPrinted = false;
+bool MipsSubtarget::CRCWarningPrinted = false;
+bool MipsSubtarget::GINVWarningPrinted = false;
void MipsSubtarget::anchor() {}
@@ -172,16 +174,27 @@ MipsSubtarget::MipsSubtarget(const Tripl
}
}
- if (hasMSA() && !MSAWarningPrinted) {
- if (hasMips64() && !hasMips64r5()) {
- errs() << "warning: the 'msa' ASE requires MIPS64 revision 5 or "
- << "greater\n";
- MSAWarningPrinted = true;
- } else if (hasMips32() && !hasMips32r5()) {
- errs() << "warning: the 'msa' ASE requires MIPS32 revision 5 or "
- << "greater\n";
- MSAWarningPrinted = true;
- }
+ StringRef ArchName = hasMips64() ? "MIPS64" : "MIPS32";
+
+ if (!hasMips32r5() && hasMSA() && !MSAWarningPrinted) {
+ errs() << "warning: the 'msa' ASE requires " << ArchName
+ << " revision 5 or greater\n";
+ MSAWarningPrinted = true;
+ }
+ if (!hasMips32r5() && hasVirt() && !VirtWarningPrinted) {
+ errs() << "warning: the 'virt' ASE requires " << ArchName
+ << " revision 5 or greater\n";
+ VirtWarningPrinted = true;
+ }
+ if (!hasMips32r6() && hasCRC() && !CRCWarningPrinted) {
+ errs() << "warning: the 'crc' ASE requires " << ArchName
+ << " revision 6 or greater\n";
+ CRCWarningPrinted = true;
+ }
+ if (!hasMips32r6() && hasGINV() && !GINVWarningPrinted) {
+ errs() << "warning: the 'ginv' ASE requires " << ArchName
+ << " revision 6 or greater\n";
+ GINVWarningPrinted = true;
}
CallLoweringInfo.reset(new MipsCallLowering(*getTargetLowering()));
Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.h?rev=336296&r1=336295&r2=336296&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSubtarget.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsSubtarget.h Wed Jul 4 12:26:31 2018
@@ -54,6 +54,15 @@ class MipsSubtarget : public MipsGenSubt
// Used to avoid printing msa warnings multiple times.
static bool MSAWarningPrinted;
+ // Used to avoid printing crc warnings multiple times.
+ static bool CRCWarningPrinted;
+
+ // Used to avoid printing ginv warnings multiple times.
+ static bool GINVWarningPrinted;
+
+ // Used to avoid printing virt warnings multiple times.
+ static bool VirtWarningPrinted;
+
// Mips architecture version
MipsArchEnum MipsArchVersion;
Added: llvm/trunk/test/CodeGen/Mips/ase_warnings.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/ase_warnings.ll?rev=336296&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/ase_warnings.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/ase_warnings.ll Wed Jul 4 12:26:31 2018
@@ -0,0 +1,89 @@
+; Check msa warnings.
+; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+msa -mattr=+fp64 < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=MSA_32
+; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+msa < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=MSA_64
+; RUN: llc -march=mips -mattr=+mips32r5 -mattr=+msa -mattr=+fp64 < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=MSA_32_NO_WARNING
+; RUN: llc -march=mips64 -mattr=+mips64r5 -mattr=+msa < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=MSA_64_NO_WARNING
+
+; Check dspr2 warnings.
+; RUN: llc -march=mips -mattr=+mips32 -mattr=+dspr2 < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSPR2_32
+; RUN: llc -march=mips64 -mattr=+mips64 -mattr=+dspr2 < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSPR2_64
+; RUN: llc -march=mips64 -mattr=+mips64r3 -mattr=+dspr2 < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSPR2_64_NO_WARNING
+; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+dspr2 < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSPR2_32_NO_WARNING
+
+; Check dsp warnings.
+; RUN: llc -march=mips -mattr=+mips32 -mattr=+dsp < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSP_32
+; RUN: llc -march=mips64 -mattr=+mips64 -mattr=+dsp < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSP_64
+; RUN: llc -march=mips -mattr=+mips32r5 -mattr=+dsp < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSP_32_NO_WARNING
+; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+dsp < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=DSP_64_NO_WARNING
+
+; Check virt warnings.
+; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+virt < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=VIRT_32
+; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+virt < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=VIRT_64
+; RUN: llc -march=mips -mattr=+mips32r5 -mattr=+virt < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=VIRT_32_NO_WARNING
+; RUN: llc -march=mips64 -mattr=+mips64r5 -mattr=+virt < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=VIRT_64_NO_WARNING
+
+; Check crc warnings.
+; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+crc < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=CRC_32
+; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+crc < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=CRC_64
+; RUN: llc -march=mips -mattr=+mips32r6 -mattr=+crc < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=CRC_32_NO_WARNING
+; RUN: llc -march=mips64 -mattr=+mips64r6 -mattr=+crc < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=CRC_64_NO_WARNING
+
+; Check ginv warnings.
+; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+ginv < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=GINV_32
+; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+ginv < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=GINV_64
+; RUN: llc -march=mips -mattr=+mips32r6 -mattr=+ginv < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=GINV_32_NO_WARNING
+; RUN: llc -march=mips64 -mattr=+mips64r6 -mattr=+ginv < %s 2>&1 | \
+; RUN: FileCheck %s -check-prefix=GINV_64_NO_WARNING
+
+; MSA_32: warning: the 'msa' ASE requires MIPS32 revision 5 or greater
+; MSA_64: warning: the 'msa' ASE requires MIPS64 revision 5 or greater
+; MSA_32_NO_WARNING-NOT: warning: the 'msa' ASE requires MIPS32 revision 5 or greater
+; MSA_64_NO_WARNING-NOT: warning: the 'msa' ASE requires MIPS64 revision 5 or greater
+
+; DSPR2_32: warning: the 'dspr2' ASE requires MIPS32 revision 2 or greater
+; DSPR2_64: warning: the 'dspr2' ASE requires MIPS64 revision 2 or greater
+; DSPR2_32_NO_WARNING-NOT: warning: the 'dspr2' ASE requires MIPS32 revision 2 or greater
+; DSPR2_64_NO_WARNING-NOT: warning: the 'dspr2' ASE requires MIPS64 revision 2 or greater
+
+; DSP_32: warning: the 'dsp' ASE requires MIPS32 revision 2 or greater
+; DSP_64: warning: the 'dsp' ASE requires MIPS64 revision 2 or greater
+; DSP_32_NO_WARNING-NOT: warning: the 'dsp' ASE requires MIPS32 revision 2 or greater
+; DSP_64_NO_WARNING-NOT: warning: the 'dsp' ASE requires MIPS64 revision 2 or greater
+
+; VIRT_32: warning: the 'virt' ASE requires MIPS32 revision 5 or greater
+; VIRT_64: warning: the 'virt' ASE requires MIPS64 revision 5 or greater
+; VIRT_32_NO_WARNING-NOT: warning: the 'virt' ASE requires MIPS32 revision 5 or greater
+; VIRT_64_NO_WARNING-NOT: warning: the 'virt' ASE requires MIPS64 revision 5 or greater
+
+; CRC_32: warning: the 'crc' ASE requires MIPS32 revision 6 or greater
+; CRC_64: warning: the 'crc' ASE requires MIPS64 revision 6 or greater
+; CRC_32_NO_WARNING-NOT: warning: the 'crc' ASE requires MIPS32 revision 6 or greater
+; CRC_64_NO_WARNING-NOT: warning: the 'crc' ASE requires MIPS64 revision 6 or greater
+
+; GINV_32: warning: the 'ginv' ASE requires MIPS32 revision 6 or greater
+; GINV_64: warning: the 'ginv' ASE requires MIPS64 revision 6 or greater
+; GINV_32_NO_WARNING-NOT: warning: the 'ginv' ASE requires MIPS32 revision 6 or greater
+; GINV_64_NO_WARNING-NOT: warning: the 'ginv' ASE requires MIPS64 revision 6 or greater
Removed: llvm/trunk/test/CodeGen/Mips/dsp_msa_warning.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/dsp_msa_warning.ll?rev=336295&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/dsp_msa_warning.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/dsp_msa_warning.ll (removed)
@@ -1,44 +0,0 @@
-; Check msa warnings.
-; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+msa -mattr=+fp64 < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=MSA_32
-; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+msa < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=MSA_64
-; RUN: llc -march=mips -mattr=+mips32r5 -mattr=+msa -mattr=+fp64 < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=MSA_32_NO_WARNING
-; RUN: llc -march=mips64 -mattr=+mips64r5 -mattr=+msa < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=MSA_64_NO_WARNING
-
-; Check dspr2 warnings.
-; RUN: llc -march=mips -mattr=+mips32 -mattr=+dspr2 < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSPR2_32
-; RUN: llc -march=mips64 -mattr=+mips64 -mattr=+dspr2 < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSPR2_64
-; RUN: llc -march=mips64 -mattr=+mips64r3 -mattr=+dspr2 < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSPR2_64_NO_WARNING
-; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+dspr2 < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSPR2_32_NO_WARNING
-
-; Check dsp warnings.
-; RUN: llc -march=mips -mattr=+mips32 -mattr=+dsp < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSP_32
-; RUN: llc -march=mips64 -mattr=+mips64 -mattr=+dsp < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSP_64
-; RUN: llc -march=mips -mattr=+mips32r5 -mattr=+dsp < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSP_32_NO_WARNING
-; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+dsp < %s 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DSP_64_NO_WARNING
-
-; MSA_32: warning: the 'msa' ASE requires MIPS32 revision 5 or greater
-; MSA_64: warning: the 'msa' ASE requires MIPS64 revision 5 or greater
-; MSA_32_NO_WARNING-NOT: warning: the 'msa' ASE requires MIPS32 revision 5 or greater
-; MSA_64_NO_WARNING-NOT: warning: the 'msa' ASE requires MIPS64 revision 5 or greater
-
-; DSPR2_32: warning: the 'dspr2' ASE requires MIPS32 revision 2 or greater
-; DSPR2_64: warning: the 'dspr2' ASE requires MIPS64 revision 2 or greater
-; DSPR2_32_NO_WARNING-NOT: warning: the 'dspr2' ASE requires MIPS32 revision 2 or greater
-; DSPR2_64_NO_WARNING-NOT: warning: the 'dspr2' ASE requires MIPS64 revision 2 or greater
-
-; DSP_32: warning: the 'dsp' ASE requires MIPS32 revision 2 or greater
-; DSP_64: warning: the 'dsp' ASE requires MIPS64 revision 2 or greater
-; DSP_32_NO_WARNING-NOT: warning: the 'dsp' ASE requires MIPS32 revision 2 or greater
-; DSP_64_NO_WARNING-NOT: warning: the 'dsp' ASE requires MIPS64 revision 2 or greater
More information about the llvm-commits
mailing list