Implement more Math LLVM intrinsics#16578
Merged
Merged
Conversation
EgorBo
marked this pull request as ready for review
August 30, 2019 23:20
EgorBo
requested review from
SamMonoRT,
lambdageek,
lewurm and
vargaz
as code owners
August 30, 2019 23:20
vargaz
reviewed
Aug 31, 2019
| if (in_corlib && !strcmp (m_class_get_name (cmethod->klass), "MathF") && cfg->r4fp) { | ||
| // (float) | ||
| if (fsig->param_count == 1 && fsig->params [0]->type == MONO_TYPE_R4) { | ||
| if (!strcmp (cmethod->name, "Ceiling")) { |
Contributor
There was a problem hiding this comment.
It might be useful to add an intrinsics-methods.h file similar to simd-methods-netcore.h and do a binary search.
vargaz
approved these changes
Aug 31, 2019
Member
Author
|
@monojenkins build failed |
ManickaP
pushed a commit
to ManickaP/runtime
that referenced
this pull request
Jan 20, 2020
* Implement more Math intrinsics * Test on CI * Update pipeline-netcore-runtime.yml * undo "test on CI" Commit migrated from mono/mono@30625b2
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds all missing Math/MathF intrinsics except:
Round(float)-- is not yet implemented (should not use high levelllvm.round.f32)Asin,Acos, etcMath.SignI reorganized them a bit (grouped by parameters count and type) I suspect it's easier to look at the change like this: https://github.com/EgorBo/mono/blob/llvm-math-more2/mono/mini/intrinsics.c#L108-L245
Also, some opcodes use
OP_XXXFfor float andOP_XXXfor double, the others useOP_RXXXfor float andOP_FXXXfor double so it was difficult to make it consistent (I didn't rename the existing ones).Test:
Codegen:
LLVM IR (fast math): https://gist.github.com/EgorBo/219c5979272e2079b0d063ffbb7b7e19
ASM (fast math): https://gist.github.com/EgorBo/2cec0d58d00a3b19132c1d27962319c3
Some funny optimizations (with

--ffast-math):