Skip to content

Conversation

allevato
Copy link
Member

I hit this issue when I tried targeting Haswell instead of Sandy/Ivy Bridge with our internal build of the toolchain:

Float16Support.cpp:165:10: error: call to 'fromEncoding' is ambiguous
  165 |   return fromEncoding(__gnu_f2h_ieee(f));
      |          ^~~~~~~~~~~~
Float16Support.cpp:45:14: note: candidate function
   45 | static float fromEncoding(unsigned int e) {
      |              ^
Float16Support.cpp:59:17: note: candidate function
   59 | static _Float16 fromEncoding(unsigned short s) {
      |                 ^

I thought it was an issue with our setup, but it repros in isolation on Godbolt: https://godbolt.org/z/9hTqrzPvr

Switching the __F16C__-guarded definitions from short to unsigned short to match the other signatures appears to resolve the issue in our builds.

@allevato
Copy link
Member Author

@stephentyrone Could you double-check this for me? This isn't a space I'm too familiar with, so I wasn't sure if they were specifically short for a reason.

@stephentyrone
Copy link
Contributor

They were short because that's how these were originally defined in compiler-rt ages ago, but they're uint16_t now, so this ought to be fine.

@allevato
Copy link
Member Author

@swift-ci please test and merge

@allevato
Copy link
Member Author

@swift-ci please test

@allevato allevato enabled auto-merge September 12, 2025 11:39
@allevato allevato merged commit e5b732d into swiftlang:main Sep 12, 2025
5 checks passed
@allevato allevato deleted the float16-fix branch September 13, 2025 01:14
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.

2 participants