Skip to content

f32::min()/max() not inlined #42423

Closed
Closed
@kornelski

Description

@kornelski
fn test(x: f32) -> f32 {
    x.max(0.)
}

compiles to (with optimizations):

jmp	fmaxf@PLT

but I'd expect it to be inlined and generate code that is exactly the same as if x > 0. {x} else {0.}, which compiles to maxss inline. I've checked that even LTO doesn't inline the calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions