-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Set minimum ISAs when compiling native code #130556
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
Open
MichalPetryka
wants to merge
6
commits into
dotnet:main
Choose a base branch
from
MichalPetryka:patch-67
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+41
−73
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
130f254
Set minimum ISAs when compiling native code
MichalPetryka 5f5f5ca
Update compile options for target architectures
MichalPetryka cf6c6ad
Fix syntax for add_compile_options in CMake
MichalPetryka 115e220
Apply suggestion from @am11
jkotas a6febbe
Merge remote-tracking branch 'upstream/main' into patch-67
MichalPetryka 96a87b3
Move code and enable define
MichalPetryka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,9 +24,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/configureoptimization.cmake) | |
| if(CLR_CMAKE_TARGET_BROWSER AND DEFINED TRYRUN_BROWSER_EMSCRIPTEN_VERSION) | ||
| file(READ "${CMAKE_CURRENT_LIST_DIR}/../../src/mono/browser/emscripten-version.txt" CURRENT_EMSCRIPTEN_VERSION) | ||
| string(STRIP "${CURRENT_EMSCRIPTEN_VERSION}" CURRENT_EMSCRIPTEN_VERSION) | ||
|
|
||
| if(NOT TRYRUN_BROWSER_EMSCRIPTEN_VERSION STREQUAL CURRENT_EMSCRIPTEN_VERSION) | ||
| message(WARNING | ||
| message(WARNING | ||
| "Emscripten version mismatch detected!\n" | ||
| " Current Emscripten: ${CURRENT_EMSCRIPTEN_VERSION}\n" | ||
| " Cached features for: ${TRYRUN_BROWSER_EMSCRIPTEN_VERSION}\n" | ||
|
|
@@ -880,40 +880,55 @@ if(CLR_CMAKE_TARGET_OPENBSD) | |
| endif() | ||
|
|
||
| if(CLR_CMAKE_HOST_UNIX_ARM) | ||
| if (NOT DEFINED CLR_ARM_FPU_TYPE) | ||
| set(CLR_ARM_FPU_TYPE vfpv3) | ||
| endif(NOT DEFINED CLR_ARM_FPU_TYPE) | ||
|
|
||
| # Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang | ||
| # we have to set the triple by adding a compiler argument | ||
| add_compile_options(-mthumb) | ||
| add_compile_options(-mfpu=${CLR_ARM_FPU_TYPE}) | ||
| if (NOT DEFINED CLR_ARM_FPU_CAPABILITY) | ||
| set(CLR_ARM_FPU_CAPABILITY 0x7) | ||
| endif(NOT DEFINED CLR_ARM_FPU_CAPABILITY) | ||
| add_definitions(-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY}) | ||
| add_compile_options(-march=armv7-a) | ||
| if(ARM_SOFTFP) | ||
| add_definitions(-DARM_SOFTFP) | ||
| add_compile_options(-mfloat-abi=softfp) | ||
| endif(ARM_SOFTFP) | ||
| if (NOT DEFINED CLR_ARM_FPU_TYPE) | ||
| set(CLR_ARM_FPU_TYPE vfpv3) | ||
| endif(NOT DEFINED CLR_ARM_FPU_TYPE) | ||
|
|
||
| # Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang | ||
| # we have to set the triple by adding a compiler argument | ||
| add_compile_options(-mthumb) | ||
| add_compile_options(-mfpu=${CLR_ARM_FPU_TYPE}) | ||
| if (NOT DEFINED CLR_ARM_FPU_CAPABILITY) | ||
| set(CLR_ARM_FPU_CAPABILITY 0x7) | ||
| endif(NOT DEFINED CLR_ARM_FPU_CAPABILITY) | ||
| add_definitions(-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY}) | ||
| add_compile_options(-march=armv7-a) | ||
| if(ARM_SOFTFP) | ||
| add_definitions(-DARM_SOFTFP) | ||
| add_compile_options(-mfloat-abi=softfp) | ||
| endif(ARM_SOFTFP) | ||
| endif(CLR_CMAKE_HOST_UNIX_ARM) | ||
|
|
||
| if(CLR_CMAKE_HOST_UNIX_ARMV6) | ||
| add_compile_options(-mfpu=vfp) | ||
| add_definitions(-DCLR_ARM_FPU_CAPABILITY=0x0) | ||
| add_compile_options(-march=armv6zk) | ||
| add_compile_options(-mcpu=arm1176jzf-s) | ||
| add_compile_options(-mfloat-abi=hard) | ||
| add_compile_options(-mfpu=vfp) | ||
| add_definitions(-DCLR_ARM_FPU_CAPABILITY=0x0) | ||
| add_compile_options(-march=armv6zk) | ||
| add_compile_options(-mcpu=arm1176jzf-s) | ||
| add_compile_options(-mfloat-abi=hard) | ||
| endif(CLR_CMAKE_HOST_UNIX_ARMV6) | ||
|
|
||
| if(CLR_CMAKE_HOST_UNIX_RISCV64) | ||
| add_compile_options(-march=rv64gc) | ||
| add_compile_options(-mabi=lp64d) | ||
| endif(CLR_CMAKE_HOST_UNIX_RISCV64) | ||
|
|
||
| if(CLR_CMAKE_HOST_UNIX_X86) | ||
| add_compile_options(-msse2) | ||
| if(CLR_CMAKE_TARGET_ARCH_AMD64) | ||
| if(CLR_CMAKE_HOST_WIN32) | ||
| add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/arch:SSE4.2>) | ||
| else() | ||
| add_compile_options(-march=x86-64-v2) | ||
| endif() | ||
| elseif(CLR_CMAKE_TARGET_ARCH_I386) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: This should use consistent style with above - either use if/endif blocks for all arche, or use elseif chain for all arches. |
||
| if(CLR_CMAKE_HOST_WIN32) | ||
| add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/arch:SSE2>) | ||
| else() | ||
| add_compile_options(-march=x86-64) | ||
| endif() | ||
| elseif(CLR_CMAKE_TARGET_ARCH_ARM64) | ||
| if(CLR_CMAKE_HOST_WIN32) | ||
| add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/arch:armv8.0+lse>) | ||
| add_compile_definitions(LSE_INSTRUCTIONS_ENABLED_BY_DEFAULT) | ||
| endif() | ||
| endif() | ||
|
|
||
| if(CLR_CMAKE_HOST_UNIX) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be based on TARGET. It should be based on HOST