[clang] [llvm] [RISCV] Xqccmp Code Generation (PR #128815)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 26 09:22:11 PST 2025
================
@@ -783,6 +783,54 @@ void RISCVFrameLowering::allocateStack(MachineBasicBlock &MBB,
}
}
+static bool isPush(unsigned Opcode) {
+ switch (Opcode) {
+ case RISCV::CM_PUSH:
+ case RISCV::QC_CM_PUSH:
+ case RISCV::QC_CM_PUSHFP:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool isPop(unsigned Opcode) {
+ // There are other pops but these are the only ones introduced during this
+ // pass.
+ switch (Opcode) {
+ case RISCV::CM_POP:
+ case RISCV::QC_CM_POP:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static unsigned getPushOpcode(RISCVMachineFunctionInfo::PushKind Kind,
+ bool hasFP) {
+ switch (Kind) {
+ case RISCVMachineFunctionInfo::PushKind::StdExtZcmp:
+ return RISCV::CM_PUSH;
+ case RISCVMachineFunctionInfo::PushKind::VendorXqccmp:
+ return hasFP ? RISCV::QC_CM_PUSHFP : RISCV::QC_CM_PUSH;
+ default:
+ llvm_unreachable("Unhandled PushKind");
+ }
+}
+
+static unsigned getPopOpcode(RISCVMachineFunctionInfo::PushKind Kind) {
+ // There are other pops but they are introduced later by the Push/Pop
+ // Optimizer.
+ switch (Kind) {
+ case RISCVMachineFunctionInfo::PushKind::StdExtZcmp:
+ return RISCV::CM_POP;
+ case llvm::RISCVMachineFunctionInfo::PushKind::VendorXqccmp:
+ return RISCV::CM_POP;
+ default:
+ llvm_unreachable("Unhandled Push Kind");
----------------
lenary wrote:
I used "Push Kind" to echo the enum name, but now I think I shall call the enum PushPopKind to make it clearer that it applies to both.
https://github.com/llvm/llvm-project/pull/128815
More information about the llvm-commits
mailing list