-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
The following two functions emit different codegen (suboptimal in case of Test1):
void Test1(char c)
{
if (c is ' ' or '\t' or '\r' or '\n')
Console.WriteLine("Hello, World!");
}
void Test2(char c)
{
if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
Console.WriteLine("Hello, World!");
}Codegen:
; Assembly listing for method Program:Test1(ushort):this (FullOpts)
movzx rcx, dx
lea eax, [rcx-0x09]
cmp eax, 4
ja SHORT G_M39625_IG04
mov ecx, eax
lea rax, [reloc @RWD00]
mov eax, dword ptr [rax+4*rcx]
lea rdx, G_M39625_IG02
add rax, rdx
jmp rax
G_M39625_IG04:
cmp ecx, 32
je SHORT G_M39625_IG06
G_M39625_IG05:
ret
G_M39625_IG06:
mov rcx, 0x21100204D88 ; 'Hello, World!'
tail.jmp [System.Console:WriteLine(System.String)]
RWD00 dd 00000029h ; case G_M39625_IG06
dd 00000029h ; case G_M39625_IG06
dd 00000028h ; case G_M39625_IG05
dd 00000028h ; case G_M39625_IG05
dd 00000029h ; case G_M39625_IG06
; Total bytes of code 57
; Assembly listing for method Program:Test2(ushort):this (FullOpts)
movzx rcx, dx
cmp ecx, 32
ja SHORT G_M37482_IG04
mov eax, 0xFFFFD9FF
bt rax, rcx
jae SHORT G_M37482_IG05
G_M37482_IG04:
ret
G_M37482_IG05:
mov rcx, 0x21100204D88 ; 'Hello, World!'
tail.jmp [System.Console:WriteLine(System.String)]
; Total bytes of code 36jnyrup, neon-sunset, MihaZupan, colejohnson66, omariom and 6 more
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 contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged