Skip to content

Conversation

@radekdoulik
Copy link
Member

Example of code generated for this method:

void Snippet(Vector128<int> vector)
{
    var v2 = PackedSimd.ShiftLeft (vector, 3);
    var v3 = PackedSimd.ShiftRightArithmetic (vector, 3);
    var v4 = PackedSimd.ShiftRightLogical (vector, 3);

    Print (vector, v2, v3, v4);
}

Relevant parts:

(func Wasm_Browser_Bench_Sample_Sample_VectorTask_Add_Snippet_System_Runtime_Intrinsics_Vector128_1_int(param $0 i32, $1 i32, $2 i32))
...
 local.tee $3
 i32.const 3
 i32x4.shr.u    [SIMD]
 v128.store offset:96 align:4    [SIMD]
 local.get $0
 local.get $3
 i32.const 3
 i32x4.shr.s    [SIMD]
 v128.store offset:80 align:4    [SIMD]
 local.get $0
 local.get $3
 i32.const 3
 i32x4.shl    [SIMD]
 v128.store offset:64 align:4    [SIMD]
...

Example of code generated for this method:

    void Snippet(Vector128<int> vector)
    {
        var v2 = PackedSimd.ShiftLeft (vector, 3);
        var v3 = PackedSimd.ShiftRightArithmetic (vector, 3);
        var v4 = PackedSimd.ShiftRightLogical (vector, 3);

        Print (vector, v2, v3, v4);
    }

Relevant parts:
    (func Wasm_Browser_Bench_Sample_Sample_VectorTask_Add_Snippet_System_Runtime_Intrinsics_Vector128_1_int(param $0 i32, $1 i32, $2 i32))
    ...
     local.tee $3
     i32.const 3
     i32x4.shr.u    [SIMD]
     v128.store offset:96 align:4    [SIMD]
     local.get $0
     local.get $3
     i32.const 3
     i32x4.shr.s    [SIMD]
     v128.store offset:80 align:4    [SIMD]
     local.get $0
     local.get $3
     i32.const 3
     i32x4.shl    [SIMD]
     v128.store offset:64 align:4    [SIMD]
    ...
@ghost
Copy link

ghost commented Mar 24, 2023

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@radekdoulik radekdoulik added this to the 8.0.0 milestone Mar 24, 2023
@ghost
Copy link

ghost commented Mar 24, 2023

Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
See info in area-owners.md if you want to be subscribed.

Issue Details

Example of code generated for this method:

void Snippet(Vector128<int> vector)
{
    var v2 = PackedSimd.ShiftLeft (vector, 3);
    var v3 = PackedSimd.ShiftRightArithmetic (vector, 3);
    var v4 = PackedSimd.ShiftRightLogical (vector, 3);

    Print (vector, v2, v3, v4);
}

Relevant parts:

(func Wasm_Browser_Bench_Sample_Sample_VectorTask_Add_Snippet_System_Runtime_Intrinsics_Vector128_1_int(param $0 i32, $1 i32, $2 i32))
...
 local.tee $3
 i32.const 3
 i32x4.shr.u    [SIMD]
 v128.store offset:96 align:4    [SIMD]
 local.get $0
 local.get $3
 i32.const 3
 i32x4.shr.s    [SIMD]
 v128.store offset:80 align:4    [SIMD]
 local.get $0
 local.get $3
 i32.const 3
 i32x4.shl    [SIMD]
 v128.store offset:64 align:4    [SIMD]
...
Author: radekdoulik
Assignees: radekdoulik
Labels:

area-System.Runtime.Intrinsics, new-api-needs-documentation

Milestone: -

MINI_OP(OP_USHLL2, "unsigned_shift_left_long_2", XREG, XREG, IREG)
MINI_OP(OP_SSHLL, "signed_shift_left_long", XREG, XREG, IREG)
MINI_OP(OP_SSHLL2, "signed_shift_left_long_2", XREG, XREG, IREG)
MINI_OP(OP_SHL, "shl", XREG, XREG, IREG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name these simd_shl or xshl ?

{SN_Negate},
{SN_ReplaceLane},
{SN_ShiftLeft},
{SN_ShiftRightArithmetic},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this to
{SN_ShiftLeft, OP_SHL},
etc. will make this code:

	if (op != 0)
		return emit_simd_ins_for_sig (cfg, klass, op, c0, arg0_type, fsig, args);

automatically emit it, so the switch case will no longer be neccessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Zoltan.

@radekdoulik
Copy link
Member Author

The failures are unrelated. I will address remaining feedback in the following PR.

@radekdoulik radekdoulik merged commit beb708f into dotnet:main Mar 27, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants