Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Issue 21490 - Optimizer can add SSE integer multiply for machines… #12038

Merged
merged 1 commit into from Dec 20, 2020

Conversation

WalterBright
Copy link
Member

… less than SSE4.1 which do not have it

The test case is adding -O to dmd/test/runnable/testxmm.d, but both this PR and #12035 are necessary for that to work. So they are mutually blocking each other. One has to be pulled first. I suggest this one.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
21490 normal Optimizer can add SSE integer multiply for machines less than SSE4.1 which do not have it

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#12038"

@ibuclaw
Copy link
Member

ibuclaw commented Dec 20, 2020

I see nothing wrong here, maybe you are just building the compiler with the default CPU set too high?

@ibuclaw
Copy link
Member

ibuclaw commented Dec 20, 2020

Or cpuid is mis-detecting the native CPU.

dmd/src/dmd/mars.d

Lines 1420 to 1423 in b475122

import core.cpuid;
params.cpu = core.cpuid.avx2 ? CPU.avx2 :
core.cpuid.avx ? CPU.avx :
CPU.sse2;

@WalterBright
Copy link
Member Author

The detection in the front end is correct. The problem is the optimizer does not check the SSE support level before inserting a multiply.

@PetarKirov
Copy link
Member

I don't like merging bug fixes without corresponding tests, but #12039 should fill the gap once this is merged.

I will merge this PR first and then I will cherry-pick #12039 in #12035 and rebase on master.

@dlang-bot dlang-bot merged commit 9eb0ab0 into dlang:master Dec 20, 2020
@WalterBright
Copy link
Member Author

@PetarKirov thanks!

@WalterBright WalterBright deleted the fix21490 branch December 20, 2020 11:00
@PetarKirov
Copy link
Member

@WalterBright you're most welcome, thanks for fixing this bug so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants