[PATCH] D153106: [CSKY] Optimize multiplication with immediates
Zixuan Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 19 01:06:20 PDT 2023
zixuan-wu added a comment.
It's better to add extra test case file to test every condition of `// Break MULT into LSLI + ADDU/SUBU.`
================
Comment at: llvm/lib/Target/CSKY/CSKYISelLowering.cpp:119
- ISD::NodeType FPOpToExpand[] = {ISD::FSIN, ISD::FCOS, ISD::FSINCOS,
- ISD::FPOW, ISD::FREM, ISD::FCOPYSIGN,
- ISD::FP16_TO_FP, ISD::FP_TO_FP16};
+ ISD::NodeType FPOpToExpand[] = {
+ ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW,
----------------
No related code change.
================
Comment at: llvm/lib/Target/CSKY/CSKYISelLowering.cpp:1386
+ // Omit if data size exceeds.
+ const unsigned DataSize = Subtarget.hasE2() ? 32 : 16;
+ if (VT.getSizeInBits() > DataSize)
----------------
As this line code shows, it try to avoid data type larger than machine register size. And, CSKY is always 32-bit machine.
================
Comment at: llvm/lib/Target/CSKY/CSKYISelLowering.cpp:1394
+ if ((Imm + 1).isPowerOf2() || (Imm - 1).isPowerOf2() ||
+ (1 - Imm).isPowerOf2())
+ return true;
----------------
Does `(-1 - Imm).isPowerOf2()` also make sense?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153106/new/
https://reviews.llvm.org/D153106
More information about the llvm-commits
mailing list