This is an archive of the discontinued LLVM Phabricator instance.

[x86] Enable bypassing 64-bit division on generic x86-64
ClosedPublic

Authored by atdt on Mar 3 2020, 1:54 PM.

Details

Summary

This is currently enabled for Intel big cores from Sandy Bridge onward, as well as Atom, Silvermont, and KNL, due to 64-bit division being so slow on these cores. AMD cores can do this in hardware (use 32-bit division based on input operand width), so it's not a win there. But since the majority of x86 CPUs benefit from this optimization, and since the potential upside is significantly greater than the downside, we should enable this for the generic x86-64 target.

Diff Detail

Event Timeline

atdt created this revision.Mar 3 2020, 1:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2020, 1:54 PM

Test cases?

@craig.topper Any objections?

atdt added a comment.Apr 3 2020, 8:54 AM

Test cases?

I'm not sure what kind of test case to add. The codegen tests for bypassing slow division use -mattr=[+-]idivq-to-divl to explicitly control this feature, rather than assume it is enabled or disabled for a particular target.

I don't have any objections

Test cases?

I'm not sure what kind of test case to add. The codegen tests for bypassing slow division use -mattr=[+-]idivq-to-divl to explicitly control this feature, rather than assume it is enabled or disabled for a particular target.

In which case we probably just need to add an additional -mcpu=x86-64 test to bypass-slow-division-tune.ll ?

atdt updated this revision to Diff 260005.Apr 24 2020, 3:09 PM

Update unit test for bypassing 64-bit division on generic x86-64

This revision is now accepted and ready to land.Apr 24 2020, 3:11 PM
RKSimon accepted this revision.Apr 25 2020, 2:13 AM

LGTM - cheers

atdt added a comment.Apr 26 2020, 2:28 PM

Thanks! I can't commit this myself.

This revision was automatically updated to reflect the committed changes.