Skip to content

ClangImporter: handle -target-cpu for x86 targets #72603

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

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

compnerd
Copy link
Member

-mcpu is a deprecated "alias" (unsupported) on x86 targets for -mtune. Unlike -mcpu, -mtune simply tunes the code for the CPU but does not prevent execution on other targets. In order to match the behaviour of -mcpu on ARM, we must use both -march= and -mtune=. Adjust this behaviour to allow tuning of code for non-Darwin targets.

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@hyp
Copy link
Contributor

hyp commented Mar 27, 2024

Could you add a test case as well?

@compnerd
Copy link
Member Author

@hyp there already are test cases for this (which is made obvious by the failure in the tests).

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@compnerd
Copy link
Member Author

Hmm, that is surprising ... the clang importer tests didn't catch this change. I can try to add a test case I suppose.

`-mcpu` is a deprecated "alias" (unsupported) on x86 targets for
`-mtune`. Unlike `-mcpu`, `-mtune` simply tunes the code for the CPU but
does not prevent execution on other targets. In order to match the
behaviour of `-mcpu` on ARM, we must use both `-march=` and `-mtune=`.
Adjust this behaviour to allow tuning of code for non-Darwin targets.
@compnerd
Copy link
Member Author

compnerd commented Apr 1, 2024

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Apr 2, 2024

@swift-ci please test Linux platform

@compnerd
Copy link
Member Author

compnerd commented Apr 2, 2024

@swift-ci please test macOS platform

@compnerd
Copy link
Member Author

compnerd commented Apr 2, 2024

@swift-ci please test macOS platform

1 similar comment
@compnerd
Copy link
Member Author

compnerd commented Apr 3, 2024

@swift-ci please test macOS platform

@compnerd compnerd merged commit fc5da53 into swiftlang:main Apr 3, 2024
@compnerd compnerd deleted the target-cpu branch April 3, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants