while investigating performance degradation of imagick benchmark there were found inefficient pattern for UINT_TO_FP conversion. That pattern causes RAW hazard in assembly code. Specifically, uitofp IR operator results in poor assembler : st %i0, [%fp - 952] ldd [%fp - 952], %f0 it stores 32-bit integer register into memory location and then loads 64-bit floating point data from that location. That is exactly RAW hazard case. To optimize that case it is possible to use SPISD::ITOF and SPISD::XTOF for conversion from integer to floating point data type and to use ISD::BITCAST to copy from integer register into floating point register. The fix is to write custom UINT_TO_FP pattern using SPISD::ITOF, SPISD::XTOF, ISD::BITCAST.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Maybe a test for bitcast from int to float, without the uitofp, too?
lib/Target/Sparc/SparcISelLowering.cpp | ||
---|---|---|
1392 ↗ | (On Diff #111671) | Move both these functions down below with the rest of the Lower* members (near where LowerUINT_TO_FP was previously) -- this section is for the calling convention lowering. |
test/CodeGen/SPARC/uint_to_fp.ll | ||
1 ↗ | (On Diff #111671) | Tests for i64? Do these overlap with some tests from "float.ll"? (If so, seems reasonable to pull those out here, too.) |
test/CodeGen/SPARC/vis3.ll | ||
1 ↗ | (On Diff #111671) | Merge with the previous file? |
Comment Actions
updated a fix according to comments, specifically:
- moved down LowerBITCAST, LowerUINT_TO_FP
- moved tests into float.ll(it already has test for i64)
- added test for bitcast from int to float(without uitofp)
- added test for uitofp for float
Comment Actions
James, Fedor, Could you integrate this ? I do not have commit rights yet.
Thank you, Alexey.