Skip to content

Optimize ckfinite for modern baselines. #48022

Open

Description

As per #47843 (comment), Ckfinite is currently doing manual bit manipulation to check if a floating-point value is finite.

Given that SSE2 and AdvSimd are the required baselines for RyuJIT, we should look at optimizing the output of this instruction to just use the optimal codegen.

Notably, this can be done as effectively:

andnot value, -0.0  ; Get absolute value
cmp value, +inf     ; Compare with +infinity
setne result        ; Set if not equal to true

On x86, these would be andnps and ucomiss respectively and functions given that nan never compares equal to any other value, so we only need to check if the absolute value is or is not infinity.

category:cq
theme:codegen
skill-level:intermediate
cost:medium
impact:small

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions