Details
Diff Detail
Event Timeline
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
10705 | Is there any way we can generalize this? All of the operations listed here are like ftrunc in this regard (they're idempotent for integer inputs). |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
10705 | I did not find any function to tell if a value is rounded to integer. Thinking about that function it might be non-trivial, given that we might have denorms. So I decided to go with opcodes which guarantied to produce integral value no matter what. A function like that most likely shall also check for these opcodes first before taking more complex analysis. |
We could potentially update visitCEIL and visitFLOOR as well, and use the same opcode test in each, although I don't think such combinations are very likely.
Right, that is possible but unlikely to happen. The current situation we have is due to the fact we have (fptosi (rint x)). I.e. we have rounded value but now we need to get integer from rounded float, and trunc is a part of that fptosi expansion.
Okay. That makes sense. Please add a comment noting that here (i.e. that trunc is part of the fpto[su]i expansions on some targets, so we're likely to generate this combination).
Is there any way we can generalize this? All of the operations listed here are like ftrunc in this regard (they're idempotent for integer inputs).