This patch adds handling for the llvm.powi.* intrinsics in BasicTTIImplBase::getIntrinsicInstrCost() and improves vectorization.
Closes #53887.
Differential D128172
[SLP] Add cost model for `llvm.powi.*` intrinsics n-omer on Jun 20 2022, 2:52 AM. Authored by
Details This patch adds handling for the llvm.powi.* intrinsics in BasicTTIImplBase::getIntrinsicInstrCost() and improves vectorization. Closes #53887.
Diff Detail Event TimelineComment Actions diff with context?
Comment Actions @craig.topper @dmgreen Are the aarch64/riscv cost changes OK? They are in 'unsupported' sections - so not sure if they have extra meaning? Comment Actions I think it is fine so long as the backend can handle it: Can you change the test lines to this, which should still return an invalid cost: %powi = call <vscale x 4 x float> @llvm.powi.nxv4f32.i32(<vscale x 4 x float> %vec, i32 %extraarg) Comment Actions Maybe copy the immediate tests below so we have coverage for both constant / variable exponent values? Comment Actions Thanks, LGTM. Although I was wondering why the cost came out as 12, not 14 from the constant 42. It may be possible to get a slightly better costs that more accurately match the code from ExpandPowI.
Comment Actions Thanks. I guess that changes all the negative constant values too.. If you want a cost for negative numbers I think it would use the abs of the value in the ActiveBits+PopCount-2 computation, plus the div like you already have it.
Comment Actions Thanks. The ticket is still "closed", so I cant properly accept it again. But it LGTM. |