-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
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 contributorsoptimization
Milestone
Description
I expected the reg and mem variant to have same codegen, https://godbolt.org/z/MGzTd3s3c
JitOptRepeat seems to help a little for SubMem only.
static int AddReg(int mem)
{
int a = mem;
int b = mem;
int c = mem;
int r = a + b + c;
return r;
}
static int AddMem(ref int mem)
{
int a = mem;
int b = mem;
int c = mem;
int r = a + b + c;
return r;
}
static int SubReg(int mem)
{
int a = mem;
int b = mem;
int c = mem;
int r = a - b - c;
return r;
}
static int SubMem(ref int mem)
{
int a = mem;
int b = mem;
int c = mem;
int r = a - b - c;
return r;
}Program:AddReg(int):int (FullOpts):
lea eax, [rdi+2*rdi]
ret
Program:AddMem(byref):int (FullOpts):
mov eax, dword ptr [rdi]
lea ecx, [rax+rax]
add eax, ecx
ret
Program:SubReg(int):int (FullOpts):
xor eax, eax
sub eax, edi
ret
Program:SubMem(byref):int (FullOpts):
mov eax, dword ptr [rdi]
mov ecx, eax
sub ecx, eax
sub ecx, eax
mov eax, ecx
ret 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 contributorsoptimization