diff --git a/clang/test/Driver/riscv-cpus.c b/clang/test/Driver/riscv-cpus.c --- a/clang/test/Driver/riscv-cpus.c +++ b/clang/test/Driver/riscv-cpus.c @@ -174,6 +174,7 @@ // MCPU-SIFIVE-X280-SAME: "-target-feature" "+c" "-target-feature" "+v" // MCPU-SIFIVE-X280-SAME: "-target-feature" "+zicsr" "-target-feature" "+zifencei" // MCPU-SIFIVE-X280-SAME: "-target-feature" "+zfh" +// MCPU-SIFIVE-X280-SAME: "-target-feature" "+zba" "-target-feature" "+zbb" // MCPU-SIFIVE-X280-SAME: "-target-feature" "+experimental-zvfh" // MCPU-SIFIVE-X280-SAME: "-target-feature" "+zvl128b" // MCPU-SIFIVE-X280-SAME: "-target-feature" "+zvl256b" "-target-feature" "+zvl32b" diff --git a/llvm/lib/Target/RISCV/RISCVProcessors.td b/llvm/lib/Target/RISCV/RISCVProcessors.td --- a/llvm/lib/Target/RISCV/RISCVProcessors.td +++ b/llvm/lib/Target/RISCV/RISCVProcessors.td @@ -177,7 +177,9 @@ FeatureStdExtV, FeatureStdExtZvl512b, FeatureStdExtZfh, - FeatureStdExtZvfh], + FeatureStdExtZvfh, + FeatureStdExtZba, + FeatureStdExtZbb], [TuneSiFive7]>; def SYNTACORE_SCR1_BASE : RISCVProcessorModel<"syntacore-scr1-base", diff --git a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td --- a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td +++ b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td @@ -205,6 +205,35 @@ let ResourceCycles = [1, 15]; } +// Bitmanip +let Latency = 3 in { +// Rotates are in the late-B ALU. +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +// clz[w]/ctz[w] are in the late-B ALU. +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +// cpop[w] look exactly like multiply. +def : WriteRes; +def : WriteRes; + +// orc.b is in the late-B ALU. +def : WriteRes; + +// rev8 is in the late-A and late-B ALUs. +def : WriteRes; + +// shNadd[.uw] is on the early-B and late-B ALUs. +def : WriteRes; +def : WriteRes; +} + // Memory def : WriteRes; def : WriteRes; @@ -859,10 +888,24 @@ // Others def : ReadAdvance; +// Bitmanip +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; + //===----------------------------------------------------------------------===// // Unsupported extensions -defm : UnsupportedSchedZba; -defm : UnsupportedSchedZbb; defm : UnsupportedSchedZbc; defm : UnsupportedSchedZbs; defm : UnsupportedSchedZbkb;