-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Vector3 Foo1() => new Vector3 { X = 1, Y = 2, Z = 3 };
Vector3 Foo2() => new Vector3(1, 2, 3);
// both are expected to emit the same codegen, but:Codegen:
; Method Prog:Foo1():System.Numerics.Vector3:this
C5F877 vzeroupper
C5F857C0 vxorps xmm0, xmm0, xmm0
C5F8100D00000000 vmovups xmm1, xmmword ptr [reloc @RWD00]
C4E37921C10E vinsertps xmm0, xmm0, xmm1, 14
C5F8100D00000000 vmovups xmm1, xmmword ptr [reloc @RWD16]
C4E37921C110 vinsertps xmm0, xmm0, xmm1, 16
C5F8100D00000000 vmovups xmm1, xmmword ptr [reloc @RWD32]
C4E37921C120 vinsertps xmm0, xmm0, xmm1, 32
C5F828C8 vmovaps xmm1, xmm0
C5F1C6C901 vshufpd xmm1, xmm1, 1
C3 ret
RWD00 dq 3F8000003F800000h, 3F8000003F800000h
RWD16 dq 4000000040000000h, 4000000040000000h
RWD32 dq 4040000040400000h, 4040000040400000h
; Total bytes of code: 59
; Method Prog:Foo2():System.Numerics.Vector3:this
C5F877 vzeroupper
C5F8100500000000 vmovups xmm0, xmmword ptr [reloc @RWD00]
C5F828C8 vmovaps xmm1, xmm0
C5F1C6C901 vshufpd xmm1, xmm1, 1
C3 ret
RWD00 dq 400000003F800000h, DDDDDDDD40400000h
; Total bytes of code: 21Shouldn't be too hard to optimze the 1st pattern, e.g. in morph/VN to recognize:
[000026] ----------- \--* HWINTRINSIC simd12 float WithElement
[000023] ----------- +--* HWINTRINSIC simd12 float WithElement
[000020] ----------- | +--* HWINTRINSIC simd12 float WithElement
[000001] ----------- | | +--* CNS_VEC simd12<0x00000000, 0x00000000, 0x00000000>
[000019] ----------- | | +--* CNS_INT int 0
[000005] ----------- | | \--* CNS_DBL float 1.0000000000000000
[000022] ----------- | +--* CNS_INT int 1
[000009] ----------- | \--* CNS_DBL float 2.0000000000000000
[000025] ----------- +--* CNS_INT int 2
[000013] ----------- \--* CNS_DBL float 3.0000000000000000
as GT_CNS_VEC. Can be a good first issue for JIT contributors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors