[llvm] r373618 - [RISCV] Add obsolete aliases of fscsr, frcsr (fssr, frsr)

Edward Jones via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 08:47:29 PDT 2019


Author: edjones
Date: Thu Oct  3 08:47:28 2019
New Revision: 373618

URL: http://llvm.org/viewvc/llvm-project?rev=373618&view=rev
Log:
[RISCV] Add obsolete aliases of fscsr, frcsr (fssr, frsr)

These old aliases were renamed, but are still used by some projects (eg newlib).

Differential Revision: https://reviews.llvm.org/D68392

Modified:
    llvm/trunk/lib/Target/RISCV/RISCVInstrInfoF.td
    llvm/trunk/test/MC/RISCV/rvf-aliases-valid.s

Modified: llvm/trunk/lib/Target/RISCV/RISCVInstrInfoF.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVInstrInfoF.td?rev=373618&r1=373617&r2=373618&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVInstrInfoF.td (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVInstrInfoF.td Thu Oct  3 08:47:28 2019
@@ -227,6 +227,12 @@ def : InstAlias<"frcsr $rd",      (CSRRS
 def : InstAlias<"fscsr $rd, $rs", (CSRRW GPR:$rd, FCSR.Encoding, GPR:$rs)>;
 def : InstAlias<"fscsr $rs",      (CSRRW      X0, FCSR.Encoding, GPR:$rs), 2>;
 
+// frsr, fssr are obsolete aliases replaced by frcsr, fscsr, so give them
+// zero weight.
+def : InstAlias<"frsr $rd",       (CSRRS GPR:$rd, FCSR.Encoding, X0), 0>;
+def : InstAlias<"fssr $rd, $rs",  (CSRRW GPR:$rd, FCSR.Encoding, GPR:$rs), 0>;
+def : InstAlias<"fssr $rs",       (CSRRW      X0, FCSR.Encoding, GPR:$rs), 0>;
+
 def : InstAlias<"frrm $rd",        (CSRRS  GPR:$rd, FRM.Encoding, X0), 2>;
 def : InstAlias<"fsrm $rd, $rs",   (CSRRW  GPR:$rd, FRM.Encoding, GPR:$rs)>;
 def : InstAlias<"fsrm $rs",        (CSRRW       X0, FRM.Encoding, GPR:$rs), 2>;

Modified: llvm/trunk/test/MC/RISCV/rvf-aliases-valid.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/RISCV/rvf-aliases-valid.s?rev=373618&r1=373617&r2=373618&view=diff
==============================================================================
--- llvm/trunk/test/MC/RISCV/rvf-aliases-valid.s (original)
+++ llvm/trunk/test/MC/RISCV/rvf-aliases-valid.s Thu Oct  3 08:47:28 2019
@@ -55,6 +55,18 @@ fscsr x6, x7
 # CHECK-ALIAS: fscsr t3
 fscsr x28
 
+# These are obsolete aliases of frcsr/fscsr. They are accepted by the assembler
+# but the disassembler should always print them as the equivalent, new aliases.
+# CHECK-INST: csrrs t4, fcsr, zero
+# CHECK-ALIAS: frcsr t4
+frsr x29
+# CHECK-INST: csrrw t5, fcsr, t6
+# CHECK-ALIAS: fscsr t5, t6
+fssr x30, x31
+# CHECK-INST: csrrw zero, fcsr, s0
+# CHECK-ALIAS: fscsr s0
+fssr x8
+
 # CHECK-INST: csrrs t4, frm, zero
 # CHECK-ALIAS: frrm t4
 frrm x29




More information about the llvm-commits mailing list