This is an archive of the discontinued LLVM Phabricator instance.

[X86] Use ADD/SUB instead of INC/DEC for Haswell and Broadwell CPUs
ClosedPublic

Authored by volkalexey on Oct 23 2014, 6:39 AM.

Details

Summary

This patch enables FeatureSlowIncDec for Haswell and Broadwell processors.
This feature was enabled for KNL and SKX CPUs before.

Diff Detail

Event Timeline

volkalexey updated this revision to Diff 15323.Oct 23 2014, 6:39 AM
volkalexey retitled this revision from to [X86] Use ADD/SUB instead of INC/DEC for Haswell and Broadwell CPUs.
volkalexey updated this object.
volkalexey edited the test plan for this revision. (Show Details)
volkalexey added a reviewer: nadav.
volkalexey set the repository for this revision to rL LLVM.
volkalexey added subscribers: zinovy.nis, Unknown Object (MLST).
volkalexey updated this revision to Diff 15381.Oct 24 2014, 1:49 AM

I added test for FeatureSlowIncDec.

I do not see the relationship between the test case and the feature you are adding.
I would expect the test case to use a Haswell and a Broadwell processor.

Any performance numbers on this change?

Thanks.
-Quentin

This test is for feature slow-incdec which is enabled also for Silvermont, KNL and SKX.
I see from other tests that this is common practice to test features itself and not to test that CPU has some feature.

I didn't see major performance impact due to this change, only small improvements on some SPEC2000 tests (by 1-2%).
I enabled this feature per Intel optimization manual:
Assembly/Compiler Coding Rule33. (M impact, H generality)INC and DEC instructions should
be replaced with ADD or SUB instructions, because ADD and SUB overwrite all flags, whereas INC and
DEC do not, therefore creating false dependencies on earlier instructions that set the flags.

Also GCC avoids generation of INC/DEC and uses ADD and SUB.

qcolombet accepted this revision.Nov 14 2014, 9:54 AM
qcolombet added a reviewer: qcolombet.

Thanks for update.

LGTM then.

-Quentin

This revision is now accepted and ready to land.Nov 14 2014, 9:54 AM
Diffusion closed this revision.Nov 17 2014, 8:18 AM
Diffusion updated this revision to Diff 16291.

Closed by commit rL222141 (authored by volkalex).