Retype calls as SIMD when applicable.#53578
Merged
sandreenko merged 7 commits intodotnet:mainfrom Jun 4, 2021
Merged
Conversation
Contributor
Author
|
PTAL @AndyAyersMS @dotnet/jit-contrib |
Contributor
Author
|
/azp run runtime-coreclr jitstress |
|
Azure Pipelines successfully started running 1 pipeline(s). |
AndyAyersMS
approved these changes
Jun 3, 2021
added 2 commits
June 3, 2021 12:00
Contributor
Author
|
I have pushed a change to retype multireg returns as well, note that now the change has some diffs but they are potential bug fixes: Generating: N065 ( 18, 3) [000012] --CXG------- t12 = * CALL ind unman struct REG mm0,mm1 $280
+IN0014: vpslldq xmm1, 12
+IN0015: vpsrldq xmm1, 12
/--* t12 struct
Generating: N081 ( 18, 3) [000015] DA-XG------- * STORE_LCL_VAR simd16<System.Numerics.Vector3> V06 tmp3 d:1 mm0 REG mm0
IN001c: vshufpd xmm0, xmm1, 0
as we see from runtime/src/coreclr/jit/codegenxarch.cpp Lines 5414 to 5418 in 2c508d4 there were no guarantees that top bytes of xmm1 were zeroed by the native compiler. diffs: all in |
Contributor
Author
|
/azp run runtime-coreclr jitstress |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| // RyuJIT assumes that the upper unused bits of xmm1 are cleared but | ||
| // the native compiler doesn't guarantee it. | ||
| if (returnType == TYP_SIMD12) | ||
| if (call->IsUnmanaged() && (returnType == TYP_SIMD12)) |
Member
There was a problem hiding this comment.
Just noting, the shift left, shift right idiom isn't the "best" codegen for modern hardware. It would likely be better for us to use one of the zero insertion idioms instead.
I'll log a bug for this.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Retype calls that return System.Numerics.Vector2/3/4 as
TYP_SIMD8/12/16between importation and lowering.It better aligns with the fact that we retype
System.Numerics.Vector2/3/4locals and returns asSIMD.some IR diffs:
STMT00007 (IL 0x02B... ???) [000027] --C-G------- * RETURN simd8 - [000026] --C-G------- \--* CALL struct Runtime_49489.Program.ReturnSIMD2 + [000026] --C-G------- \--* CALL simd8 Runtime_49489.Program.ReturnSIMD2 STMT00011 (IL 0x003...0x008) [000040] -ACXG------- * ASG simd8 (copy) [000038] D------N---- +--* LCL_VAR simd8 <System.Numerics.Vector2> V03 tmp1 - [000034] --CXG+-N---- \--* CALL struct Runtime_49489.Program.ReturnSIMD2 + [000034] --CXG+-N---- \--* CALL simd8 Runtime_49489.Program.ReturnSIMD2I am not a huge fan of this retyping but the improved check in
gtNewLclvNodeshould make the code overall safer in my opinion.No asm diffs.
Fixes #52864.