It uses the generic AArch64_IMM::expandMOVImm to get the correct
number of instruction used in immediate materialization.
Details
Diff Detail
Event Timeline
Needs a testcase.
lib/Target/AArch64/AArch64TargetTransformInfo.cpp | ||
---|---|---|
50 | What is this function actually supposed to compute? If it's just the number of instructions an AArch64::MOVi64imm would expand to, I don't understand what a cost of "0" is supposed to mean. We currently don't have any code to try to count the number of instructions AArch64ExpandPseudo::expandMOVImm will eventually emit. The complete logic is complicated if you're trying to compute whether we'll generate 2, 3, or 4 instructions... and "countLeadingZeros" is a terrible approximation. But I guess that isn't really important for most uses of getIntImmCost anyway. |
Updated patch based on previous comments. It depends on https://reviews.llvm.org/D58915. I am trying to come up with a testcase to actually test it. The the main difference for the cost analysis is just for some immediate that contains some 16-bit zero or one chunk (which will have the size adjusted from 3 to 2). Since they are not TCC_Free, TCC_Basic, or TCC_Expensive the change does not actually interfere in the further cost analysis.
I would expect an effect at least in some cases... for example 0xBEEF000000000000 goes from 4 to 1, unless I'm misreading the code.
What is this function actually supposed to compute? If it's just the number of instructions an AArch64::MOVi64imm would expand to, I don't understand what a cost of "0" is supposed to mean.
We currently don't have any code to try to count the number of instructions AArch64ExpandPseudo::expandMOVImm will eventually emit. The complete logic is complicated if you're trying to compute whether we'll generate 2, 3, or 4 instructions... and "countLeadingZeros" is a terrible approximation. But I guess that isn't really important for most uses of getIntImmCost anyway.