apivovarov created this revision. apivovarov added reviewers: MaskRay, evandro. Herald added subscribers: vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya. apivovarov requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits.
Add RISC-V sifive-e20 cpu (rv32imc) sifive-e20 spec: https://www.sifive.com/cores/e20 gcc: https://github.com/riscv/riscv-gcc/blob/c3911e6425f35e0722129cb30cc5ccaf3390cd75/gcc/config/riscv/riscv-cores.def#L34 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109260 Files: clang/docs/ReleaseNotes.rst clang/test/Driver/riscv-cpus.c clang/test/Misc/target-invalid-cpu-note.c llvm/include/llvm/Support/RISCVTargetParser.def llvm/lib/Target/RISCV/RISCV.td Index: llvm/lib/Target/RISCV/RISCV.td =================================================================== --- llvm/lib/Target/RISCV/RISCV.td +++ llvm/lib/Target/RISCV/RISCV.td @@ -250,6 +250,9 @@ def : ProcessorModel<"sifive-7-rv32", SiFive7Model, []>; def : ProcessorModel<"sifive-7-rv64", SiFive7Model, [Feature64Bit]>; +def : ProcessorModel<"sifive-e20", RocketModel, [FeatureStdExtM, + FeatureStdExtC]>; + def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM, FeatureStdExtA, FeatureStdExtC]>; Index: llvm/include/llvm/Support/RISCVTargetParser.def =================================================================== --- llvm/include/llvm/Support/RISCVTargetParser.def +++ llvm/include/llvm/Support/RISCVTargetParser.def @@ -19,6 +19,7 @@ PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""}) PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""}) PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""}) +PROC(SIFIVE_E20, {"sifive-e20"}, FK_NONE, {"rv32imc"}) PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"}) PROC(SIFIVE_S51, {"sifive-s51"}, FK_64BIT, {"rv64imac"}) PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"}) Index: clang/test/Misc/target-invalid-cpu-note.c =================================================================== --- clang/test/Misc/target-invalid-cpu-note.c +++ clang/test/Misc/target-invalid-cpu-note.c @@ -192,7 +192,7 @@ // RUN: not %clang_cc1 -triple riscv32 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV32 // RISCV32: error: unknown target CPU 'not-a-cpu' -// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e31, sifive-e76 +// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e20, sifive-e31, sifive-e76 // RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64 // RISCV64: error: unknown target CPU 'not-a-cpu' @@ -200,7 +200,7 @@ // RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32 // TUNE-RISCV32: error: unknown target CPU 'not-a-cpu' -// TUNE-RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e31, sifive-e76, generic, rocket, sifive-7-series +// TUNE-RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e20, sifive-e31, sifive-e76, generic, rocket, sifive-7-series // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64 // TUNE-RISCV64: error: unknown target CPU 'not-a-cpu' Index: clang/test/Driver/riscv-cpus.c =================================================================== --- clang/test/Driver/riscv-cpus.c +++ clang/test/Driver/riscv-cpus.c @@ -45,6 +45,12 @@ // RUN: %clang -target riscv64 -### -c %s 2>&1 -mtune=sifive-7-series | FileCheck -check-prefix=MTUNE-SIFIVE7-SERIES-64 %s // MTUNE-SIFIVE7-SERIES-64: "-tune-cpu" "sifive-7-rv64" +// mcpu with mabi option +// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-e20 -mabi=ilp32 | FileCheck -check-prefix=MCPU-ABI-SIFIVE-E20 %s +// MCPU-ABI-SIFIVE-E20: "-nostdsysteminc" "-target-cpu" "sifive-e20" +// MCPU-ABI-SIFIVE-E20: "-target-feature" "+m" "-target-feature" "+c" +// MCPU-ABI-SIFIVE-E20: "-target-abi" "ilp32" + // mcpu with mabi option // RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-s51 -mabi=lp64 | FileCheck -check-prefix=MCPU-ABI-SIFIVE-S51 %s // MCPU-ABI-SIFIVE-S51: "-nostdsysteminc" "-target-cpu" "sifive-s51" Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -73,6 +73,7 @@ - Support has been added for the following processors (``-mcpu`` identifiers in parentheses): + - RISC-V SiFive E20 (``sifive-e20``). - RISC-V SiFive S51 (``sifive-s51``). Removed Compiler Flags
Index: llvm/lib/Target/RISCV/RISCV.td =================================================================== --- llvm/lib/Target/RISCV/RISCV.td +++ llvm/lib/Target/RISCV/RISCV.td @@ -250,6 +250,9 @@ def : ProcessorModel<"sifive-7-rv32", SiFive7Model, []>; def : ProcessorModel<"sifive-7-rv64", SiFive7Model, [Feature64Bit]>; +def : ProcessorModel<"sifive-e20", RocketModel, [FeatureStdExtM, + FeatureStdExtC]>; + def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM, FeatureStdExtA, FeatureStdExtC]>; Index: llvm/include/llvm/Support/RISCVTargetParser.def =================================================================== --- llvm/include/llvm/Support/RISCVTargetParser.def +++ llvm/include/llvm/Support/RISCVTargetParser.def @@ -19,6 +19,7 @@ PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""}) PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""}) PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""}) +PROC(SIFIVE_E20, {"sifive-e20"}, FK_NONE, {"rv32imc"}) PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"}) PROC(SIFIVE_S51, {"sifive-s51"}, FK_64BIT, {"rv64imac"}) PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"}) Index: clang/test/Misc/target-invalid-cpu-note.c =================================================================== --- clang/test/Misc/target-invalid-cpu-note.c +++ clang/test/Misc/target-invalid-cpu-note.c @@ -192,7 +192,7 @@ // RUN: not %clang_cc1 -triple riscv32 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV32 // RISCV32: error: unknown target CPU 'not-a-cpu' -// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e31, sifive-e76 +// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e20, sifive-e31, sifive-e76 // RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64 // RISCV64: error: unknown target CPU 'not-a-cpu' @@ -200,7 +200,7 @@ // RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32 // TUNE-RISCV32: error: unknown target CPU 'not-a-cpu' -// TUNE-RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e31, sifive-e76, generic, rocket, sifive-7-series +// TUNE-RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e20, sifive-e31, sifive-e76, generic, rocket, sifive-7-series // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64 // TUNE-RISCV64: error: unknown target CPU 'not-a-cpu' Index: clang/test/Driver/riscv-cpus.c =================================================================== --- clang/test/Driver/riscv-cpus.c +++ clang/test/Driver/riscv-cpus.c @@ -45,6 +45,12 @@ // RUN: %clang -target riscv64 -### -c %s 2>&1 -mtune=sifive-7-series | FileCheck -check-prefix=MTUNE-SIFIVE7-SERIES-64 %s // MTUNE-SIFIVE7-SERIES-64: "-tune-cpu" "sifive-7-rv64" +// mcpu with mabi option +// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-e20 -mabi=ilp32 | FileCheck -check-prefix=MCPU-ABI-SIFIVE-E20 %s +// MCPU-ABI-SIFIVE-E20: "-nostdsysteminc" "-target-cpu" "sifive-e20" +// MCPU-ABI-SIFIVE-E20: "-target-feature" "+m" "-target-feature" "+c" +// MCPU-ABI-SIFIVE-E20: "-target-abi" "ilp32" + // mcpu with mabi option // RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-s51 -mabi=lp64 | FileCheck -check-prefix=MCPU-ABI-SIFIVE-S51 %s // MCPU-ABI-SIFIVE-S51: "-nostdsysteminc" "-target-cpu" "sifive-s51" Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -73,6 +73,7 @@ - Support has been added for the following processors (``-mcpu`` identifiers in parentheses): + - RISC-V SiFive E20 (``sifive-e20``). - RISC-V SiFive S51 (``sifive-s51``). Removed Compiler Flags
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits