Skip to content

Conversation

kripken
Copy link
Member

@kripken kripken commented May 5, 2020

  1. Define only floating point exceptions we support (none). That
    avoids a lot of float pragmas we don't support.
  2. Ifdef out the remaining such pragmas.

Helps #11086 , but does not fix it as user code may still be broken
due to LLVM failing ISel on those pragmas now.

@kripken
Copy link
Member Author

kripken commented May 5, 2020

This makes libc 164 bytes smaller.

@dschuff
Copy link
Member

dschuff commented May 5, 2020

I think some change to the fenv defs might make sense (although, should we do something similar for rounding modes?), but I'm not so thrilled about ifdef-ing out the pragmas for the long term. I think we will still want to handle the constrained intrinsics in one form or another. Perhaps with an ISel fix.
This PR doesn't fix the fact that users might have code that has that pragma too, where we previously ignored it but now crash. So at least we should not mark #11086 as fixed.
But this should work to unblock the LLVM roll for now. let me test it with the new LLVM.

Copy link
Member

@dschuff dschuff left a comment

Choose a reason for hiding this comment

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

Seems to work. I still predict that if we don't fix this for real soon, somebody will complain about the regression. Or maybe theyll just comment out their pragmas, who knows 🤷

@kripken kripken merged commit 3d61162 into master May 6, 2020
@kripken kripken deleted the float branch May 6, 2020 00:28
#define FE_DIVBYZERO 4
#define FE_OVERFLOW 8
#define FE_UNDERFLOW 16
#define FE_INEXACT 32
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these designed to be disabled by simply not being defined? That seems unusual, but I don't know this part of the standard.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I learned this today as well. It is quite unusual for the C spec, I agree.

Libraries may define in <fenv.h> only the macro values above they support (the others may not be defined).

http://www.cplusplus.com/reference/cfenv/FE_INEXACT/

And musl in fact checks whether things are defined in order to ifdef relevant code. Which actually is helpful in this case!

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if they are designed that way exactly, but musl code seems to use them that way: see e.g. https://github.com/emscripten-core/emscripten/blob/master/system/lib/libc/musl/src/fenv/__flt_rounds.c and in particular https://github.com/emscripten-core/emscripten/blob/2bca083cbbd5a4133db61fbd74d04f7feecfa907/system/lib/libc/musl/src/math/lrint.c gates its use of the FENV_ACCESS pragma on FE_INEXACT being defined.

rhuffy pushed a commit to rhuffy/julia that referenced this pull request Nov 23, 2022
mihaip added a commit to mihaip/dingusppc that referenced this pull request Oct 20, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Oct 27, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Oct 28, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 2, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 4, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 10, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 10, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 17, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 23, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 25, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 25, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 27, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 28, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 29, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 29, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 29, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Nov 30, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Dec 3, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Dec 4, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Dec 7, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Dec 8, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Dec 9, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Dec 11, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Dec 20, 2024
mihaip added a commit to mihaip/dingusppc that referenced this pull request Jan 2, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Jan 22, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Jan 28, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Mar 1, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Mar 3, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Mar 7, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Mar 23, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Mar 29, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Apr 2, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Apr 13, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request May 3, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Jul 3, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Jul 28, 2025
mihaip added a commit to mihaip/dingusppc that referenced this pull request Aug 25, 2025
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