Skip to content

runtime: implement fminimum/fmaximum#5196

Open
niaow wants to merge 1 commit intotinygo-org:devfrom
niaow:soft-minimumf
Open

runtime: implement fminimum/fmaximum#5196
niaow wants to merge 1 commit intotinygo-org:devfrom
niaow:soft-minimumf

Conversation

@niaow
Copy link
Member

@niaow niaow commented Feb 9, 2026

The compiler may generate calls to fminimum/fmaximum on some platforms. Neither of the libm implementations we statically link against have these functions yet. Implement them ourselves.

I am not really sure how to test this properly because LLVM can (and usually will) rewrite any calls to these functions.

@niaow
Copy link
Member Author

niaow commented Feb 9, 2026

This fixes #5195, although compilation of these intrinsics may still explode on arm due to llvm/llvm-project#140445

Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions about names and tests.

@niaow
Copy link
Member Author

niaow commented Feb 10, 2026

Just realized I hadn't marked this as draft

@niaow niaow marked this pull request as draft February 10, 2026 00:35
@niaow
Copy link
Member Author

niaow commented Feb 10, 2026

I managed to test this via a linkname, so I think this is okay now.

@niaow niaow marked this pull request as ready for review February 10, 2026 17:55
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions about the tests but otherwise LGTM.

The compiler may generate calls to fminimum/fmaximum on some platforms.
Neither of the libm implementations we statically link against have these functions yet.
Implement them ourselves.
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments