You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this PR, the unnecessary move has been removed from both the caller and the callee. Here I am using caller function in the same example as #60068 (comment) to demonstrate the difference.
AMD64 Before
Generated unoptimized LLVM IR
*** Unoptimized LLVM IR for HelloWorld.Program:test (System.Runtime.Intrinsics.Vector128`1<int>,System.Runtime.Intrinsics.Vector128`1<int>,System.Runtime.Intrinsics.Vector128`1<int>) ***
; ModuleID = 'jit-module-test'
source_filename = "jit-module-test"
; Function Attrs: noinline uwtable
define dso_local monocc void @"HelloWorld.Program:test (System.Runtime.Intrinsics.Vector128`1<int>,System.Runtime.Intrinsics.Vector128`1<int>,System.Runtime.Intrinsics.Vector128`1<int>)"(i64 %vret, i64 %arg_a, i64 %0, i64 %arg_b, i64 %1, <4 x i32>* byval(<4 x i32>) %arg_c) #0 {
BB0:
%2 = alloca <4 x i32>, align 16
%3 = alloca <4 x i32>, align 16
%4 = bitcast <4 x i32>* %3 to i8*
%5 = getelementptr i8, i8* %4, i32 0
%6 = bitcast i8* %5 to i64*
store i64 %arg_a, i64* %6, align 4
%7 = getelementptr i8, i8* %4, i32 8
%8 = bitcast i8* %7 to i64*
store i64 %0, i64* %8, align 4
%simd_vtype = load <4 x i32>, <4 x i32>* %3, align 16
%9 = bitcast <4 x i32>* %2 to i8*
%10 = getelementptr i8, i8* %9, i32 0
%11 = bitcast i8* %10 to i64*
store i64 %arg_b, i64* %11, align 4
%12 = getelementptr i8, i8* %9, i32 8
%13 = bitcast i8* %12 to i64*
store i64 %1, i64* %13, align 4
%simd_vtype1 = load <4 x i32>, <4 x i32>* %2, align 16
%simd_vtype2 = load <4 x i32>, <4 x i32>* %arg_c, align 16
br label %BB2
BB2: ; preds = %BB0
br label %BB3
BB3: ; preds = %BB2
%14 = icmp slt <4 x i32> %simd_vtype, %simd_vtype1
%15 = select <4 x i1> %14, <4 x i32> %simd_vtype, <4 x i32> %simd_vtype1
br label %BB4
BB4: ; preds = %BB3
%16 = add i64 %vret, 0
%17 = inttoptr i64 %16 to <4 x i32>*
store <4 x i32> %15, <4 x i32>* %17, align 1
br label %BB1
BB1: ; preds = %BB4
ret void
}
This PR enables passing Vector128 in SIMD registers for both Amd64 and Arm64, when LLVM is enabled.
Always or only when it is required by the ABI? For example, Windows x64 calling convention would not by default pass these in register; only Windows __vectorcall would.
Build windows x64 Release AllSubsets_Mono - rolling build showed the same failure Build Browser wasm windows Release WasmBuildTests - same test failures could be found on other PR.
This PR only handles the managed-to-managed calls. To enable those PInvoke tests, more work is needed to make sure the ABI/calling conventions are handled correctly, as @lambdageek mentioned earlier.
ghost
locked as resolved and limited conversation to collaborators
Jun 30, 2022
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
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 enables passing Vector128 in SIMD registers between managed function calls for both Amd64 and Arm64, when LLVM is enabled.
Contributes to #60068
With this PR, the unnecessary move has been removed from both the caller and the callee. Here I am using caller function in the same example as #60068 (comment) to demonstrate the difference.
AMD64
Before
After
ARM64
Before
After