[llvm] [Hexagon] Improve QFP Optimizer (PR #166647)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 5 13:38:37 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp llvm/lib/Target/Hexagon/HexagonInstrInfo.h llvm/lib/Target/Hexagon/HexagonQFPOptimizer.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
index 3e30a1908..55bafdea2 100644
--- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
@@ -4753,17 +4753,17 @@ bool HexagonInstrInfo::getBundleNoShuf(const MachineInstr &MIB) const {
return (Operand.isImm() && (Operand.getImm() & memShufDisabledMask) != 0);
}
-bool HexagonInstrInfo::isQFPMul(const MachineInstr* MI) const {
+bool HexagonInstrInfo::isQFPMul(const MachineInstr *MI) const {
return (MI->getOpcode() == Hexagon::V6_vmpy_qf16_hf ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
- MI->getOpcode() == Hexagon::V6_vmpy_qf32);
+ MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
+ MI->getOpcode() == Hexagon::V6_vmpy_qf32);
}
// Addressing mode relations.
diff --git a/llvm/lib/Target/Hexagon/HexagonQFPOptimizer.cpp b/llvm/lib/Target/Hexagon/HexagonQFPOptimizer.cpp
index 17ad0ee8a..94b606ccb 100644
--- a/llvm/lib/Target/Hexagon/HexagonQFPOptimizer.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonQFPOptimizer.cpp
@@ -86,10 +86,9 @@ using namespace llvm;
cl::opt<bool>
DisableQFOptimizer("disable-qfp-opt", cl::init(false),
cl::desc("Disable optimization of Qfloat operations."));
-cl::opt<bool>
- DisableQFOptForMul("disable-qfp-opt-mul", cl::init(true),
- cl::desc(
- "Disable optimization of Qfloat operations for multiply."));
+cl::opt<bool> DisableQFOptForMul(
+ "disable-qfp-opt-mul", cl::init(true),
+ cl::desc("Disable optimization of Qfloat operations for multiply."));
namespace {
const std::map<unsigned short, unsigned short> QFPInstMap{
@@ -133,6 +132,7 @@ public:
AU.setPreservesCFG();
MachineFunctionPass::getAnalysisUsage(AU);
}
+
private:
const HexagonSubtarget *HST = nullptr;
const HexagonInstrInfo *HII = nullptr;
@@ -350,7 +350,7 @@ bool HexagonQFPOptimizer::runOnMachineFunction(MachineFunction &MF) {
continue;
if (OpC != Hexagon::V6_vconv_sf_qf32 &&
OpC != Hexagon::V6_vconv_hf_qf16) {
- LLVM_DEBUG(dbgs() << "\n###Analyzing for removal: ";MI->dump());
+ LLVM_DEBUG(dbgs() << "\n###Analyzing for removal: "; MI->dump());
if (optimizeQfp(MI, MBB)) {
MI->eraseFromParent();
LLVM_DEBUG(dbgs() << "\t....Removing....");
``````````
</details>
https://github.com/llvm/llvm-project/pull/166647
More information about the llvm-commits
mailing list