From c2614b31d955f799179c34215b1225d0131da378 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 27 Apr 2022 10:32:54 -0700 Subject: [PATCH] [RISCV] Add isCommutable to scalar FMA instructions. The default implementation of findCommutedOpIndices picks the first two source operands. That's exactly what we want for the scalar FMA instructions. Reviewed By: reames Differential Revision: https://reviews.llvm.org/D124463 --- llvm/lib/Target/RISCV/RISCVInstrInfoF.td | 2 +- llvm/test/CodeGen/RISCV/machine-cse.ll | 432 ++++++++++++++++++++++- 2 files changed, 431 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td index 6b1a61419a70..a2cd4a0f618c 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td @@ -159,7 +159,7 @@ class FPStore_r funct3, string opcodestr, RegisterClass rty, Sched<[sw, ReadStoreData, ReadFMemBase]>; let hasSideEffects = 0, mayLoad = 0, mayStore = 0, mayRaiseFPException = 1, - UseNamedOperandTable = 1, hasPostISelHook = 1 in + UseNamedOperandTable = 1, hasPostISelHook = 1, isCommutable = 1 in class FPFMA_rrr_frm funct2, string opcodestr, DAGOperand rty> : RVInstR4Frm