-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize new Vector3 { X=,Y=,Z=} pattern #84543
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue DetailsVector3 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: 21 Shouldn't be too hard to optimze the 1st pattern, e.g. in morph's
as
|
I would like to give this a try. Can you assign me? |
@SkiFoD are you still working on this or we can re-assign? |
@EgorBo Yeah sure, you can re-assign. |
Codegen:
Shouldn't be too hard to optimze the 1st pattern, e.g. in morph/VN to recognize:
as
GT_CNS_VEC
. Can be a good first issue for JIT contributors.The text was updated successfully, but these errors were encountered: