-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 SuperPMI
Milestone
Description
public int VecSize => Vector<float>.Count;
public int M1(int length) => (int)((uint)length % Vector<float>.Count);
public int M2(int length) => (int)((uint)length % (uint)Vector<float>.Count);
public int Vec256Size => Vector256<float>.Count;
public int N1(int length) => (int)((uint)length % Vector256<float>.Count);
public int N2(int length) => (int)((uint)length % (uint)Vector256<float>.Count);The .Count are treated as constant, but for the division and modulo it's not treated as unsigned to allow bit-hack fast computation.
; Core CLR 6.0.21.52210 on amd64
C.get_VecSize()
L0000: mov eax, 8
L0005: ret
C.M1(Int32)
L0000: mov eax, edx
L0002: mov rdx, rax
L0005: sar rdx, 0x3f
L0009: and rdx, 7
L000d: add rdx, rax
L0010: and rdx, 0xfffffffffffffff8
L0014: sub rax, rdx
L0017: ret
C.M2(Int32)
L0000: mov eax, edx
L0002: and eax, 7
L0005: ret
C.get_Vec256Size()
L0000: mov eax, 8
L0005: ret
C.N1(Int32)
L0000: mov eax, edx
L0002: mov rdx, rax
L0005: sar rdx, 0x3f
L0009: and rdx, 7
L000d: add rdx, rax
L0010: and rdx, 0xfffffffffffffff8
L0014: sub rax, rdx
L0017: ret
C.N2(Int32)
L0000: mov eax, edx
L0002: and eax, 7
L0005: retEdit: this link is wrong, see comment below.
At least fo .NET 6 on sharplab -- didn't find any issue or PR addressing this for .NET 7.
JimBobSquarePants, brianpopow and br3aker
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 SuperPMI