This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][CostModel] Add fneg cost estimation
ClosedPublic

Authored by dfukalov on Jun 17 2020, 5:50 PM.

Details

Summary

The estimation uses AMDGPUTargetLowering::isFNegFree()

Diff Detail

Event Timeline

dfukalov created this revision.Jun 17 2020, 5:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2020, 5:50 PM
arsenm added inline comments.Jun 17 2020, 6:05 PM
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
553

If you're putting in in target code, might as well just return 0

dfukalov updated this revision to Diff 271682.Jun 18 2020, 5:44 AM
dfukalov marked an inline comment as done.

Added comment, fixed typo

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
553

There are different cases when fneg is not free. E.g. neg modifier can make instruction bigger. Or even explicit xor will be generated.
I tried to make cost model less independent from actual transforms. If one changes
isFNegFree() behavior then cost model possible should be updated.

This revision is now accepted and ready to land.Jun 18 2020, 9:58 AM
This revision was automatically updated to reflect the committed changes.