Open
Description
bool IsInRange(int value, int lower, int upper) =>
value >= lower && value <= upper;
Current arm64 codegen:
; Method Program:IsInRange(int,int,int):ubyte:this (FullOpts)
G_M32893_IG01: ;; offset=0x0000
stp fp, lr, [sp, #-0x10]!
mov fp, sp
G_M32893_IG02: ;; offset=0x0008
cmp w1, w2
blt G_M32893_IG05
G_M32893_IG03: ;; offset=0x0010
cmp w1, w3
cset x0, le
G_M32893_IG04: ;; offset=0x0018
ldp fp, lr, [sp], #0x10
ret lr
G_M32893_IG05: ;; offset=0x0020
mov w0, wzr
G_M32893_IG06: ;; offset=0x0024
ldp fp, lr, [sp], #0x10
ret lr
; Total bytes of code: 44
Expected codgen:
G_M32893_IG01: ;; offset=0x0000
stp fp, lr, [sp, #-0x10]!
mov fp, sp
G_M32893_IG02: ;; offset=0x0008
cmp w1, w2
ccmp w1, w3, #0, ge
cset w1, le
ret
G_M32893_IG06: ;; offset=0x0024
ldp fp, lr, [sp], #0x10
ret lr
; Total bytes of code: 32
(based on https://godbolt.org/z/oqjfMPosj)
cc @jakobbotsch @dotnet/jit-contrib