Skip to content

JIT: 'X <= uint.MaxValue' to 'X >> 32' #76525

Closed
@EgorBo

Description

@EgorBo
bool Foo(ulong x) => x <= uint.MaxValue; // same for >

Proposed diff for RyuJIT (what it currently emits vs expected)

; Method T:Foo(ulong):bool:this
-      mov      eax, 0xFFFFFFFF
-      cmp      rdx, rax
-      setbe    al
+      shr      rdi, 32
+      sete     al
       movzx    rax, al
       ret      

grep.app: https://grep.app/search?q=%28%3C%3D%7C%3E%29%20uint.MaxValue&regexp=true

category:implementation
theme:expression-opts
skill-level:beginner
cost:small
impact:small

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIgood first issueIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions