-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
arch-arm64area-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 SuperPMIoptimizationtenet-performancePerformance related issuePerformance related issue
Milestone
Description
int Test(int a) => 1000 / b; // same for 'C % b'Current arm64 codegen:
G_M17171_IG01:
A9BF7BFD stp fp, lr, [sp,#-16]!
910003FD mov fp, sp
G_M17171_IG02:
52807D00 mov w0, #0x3e8
7100005F cmp w2, #0
54000140 beq G_M17171_IG06
3100045F cmn w2, #1
54000081 bne G_M17171_IG03
2B00001F adds wzr, w0, w0
54000041 bne G_M17171_IG03 ; <-- btw, two subsequent jumps??
54000086 bvs G_M17171_IG05
G_M17171_IG03:
1AC20C00 sdiv w0, w0, w2
G_M17171_IG04:
A8C17BFD ldp fp, lr, [sp],#16
D65F03C0 ret lr
G_M17171_IG05:
94000000 bl CORINFO_HELP_OVERFLOW
G_M17171_IG06:
94000000 bl CORINFO_HELP_THROWDIVZERO
D43E0000 bkpt
; Total bytes of code 64As far as I understand overflow can only happen if we divide int.MinValue by -1 so it's not the case for C / x where C is not int.MinValue
Also, GT_ARRLEN can't be -1 and int.MinValue so e.g. array.Length % x or x % array.Length shouldn't produce any overflow checks as well.
category:cq
theme:div-mod-rem
skill-level:intermediate
cost:medium
impact:medium
GSPP, JulieLeeMSFT, SwapnilGaikwad and xsoheilalizadeh
Metadata
Metadata
Assignees
Labels
arch-arm64area-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 SuperPMIoptimizationtenet-performancePerformance related issuePerformance related issue
Type
Projects
Status
Done