-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Priority:3Work that is nice to haveWork that is nice to havearea-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 SuperPMIin-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 mergedtenet-performancePerformance related issuePerformance related issue
Milestone
Description
Description
Creating a separate issue from #96380 to track CINC/CSINC not kicking in place of CSEL.
Analysis
Given method
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int RuneLength(in byte value)
{
var lzcnt = (uint)BitOperations.LeadingZeroCount(~((uint)value << 24));
if (lzcnt is 0) lzcnt++;
return (int)lzcnt;
}Currently the following codegen is produced:
G_M000_IG01: ;; offset=0x0000
stp fp, lr, [sp, #-0x10]!
mov fp, sp
G_M000_IG02: ;; offset=0x0008
ldrb w0, [x0]
lsl w0, w0, #24
mvn w0, w0
clz w0, w0
mov w1, #1
cmp w0, #0
csel w0, w0, w1, ne ;; <-- Could have been just cinc with mov 1 elided - we're incrementing zero
G_M000_IG03: ;; offset=0x0024
ldp fp, lr, [sp], #0x10
ret lr
; Total bytes of code 44The mov, cmp, csel sequence can be produced in a more optimal way - cmp, cinc.
Configuration
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.71b9f198
Runtime Environment:
OS Name: Mac OS X
OS Version: 14.1
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.100/
Regression?
No
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Priority:3Work that is nice to haveWork that is nice to havearea-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 SuperPMIin-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 mergedtenet-performancePerformance related issuePerformance related issue