GCC compilation error Half.h: `_cvtss_sh` not declared in this scope

Summary

Compiling a program that uses Eigen with the current master and GCC (11.1.0) throws the following error:

In file included from /usr/local/include/eigen3/Eigen/Core:175,
                 from /usr/local/include/eigen3/Eigen/Dense:1,
                 from /usr/local/include/eigen3/Eigen/Eigen:1,
                 from /home/buchwalj/github/ogs/GeoLib/AABB.h:27,
                 from /home/buchwalj/github/ogs/GeoLib/Polygon.h:20,
                 from /home/buchwalj/github/ogs/GeoLib/AnalyticalGeometry.h:19,
                 from /home/buchwalj/github/ogs/GeoLib/AnalyticalGeometry.cpp:15,
                 from /home/buchwalj/github/ogs/build_mkl_eigengcc/GeoLib/CMakeFiles/GeoLib.dir/Unity/unity_0_cxx.cxx:3:
/usr/local/include/eigen3/Eigen/src/Core/arch/Default/Half.h: In function ‘Eigen::half_impl::__half_raw Eigen::half_impl::float_to_half_rtne(float)’:
/usr/local/include/eigen3/Eigen/src/Core/arch/Default/Half.h:538:9: error: ‘_cvtss_sh’ was not declared in this scope
  538 |   h.x = _cvtss_sh(ff, 0);
      |         ^~~~~~~~~
/usr/local/include/eigen3/Eigen/src/Core/arch/Default/Half.h: In function ‘float Eigen::half_impl::half_to_float(Eigen::half_impl::__half_raw)’:
/usr/local/include/eigen3/Eigen/src/Core/arch/Default/Half.h:599:10: error: ‘_cvtsh_ss’ was not declared in this scope
  599 |   return _cvtsh_ss(h.x);
      |          ^~~~~~~~~

This did not happen with earlier versions of Eigen (I guess, I tried 3.3.x). It also happens only with GCC. Clang compiles it without complaining.

Environment

  • Operating System : Windows/Linux
  • Architecture : x64/Arm64/PowerPC ...
  • Eigen Version : master
  • Compiler Version : Gcc 11.1.0
  • Compile Flags : -fopenmp -O3 -DNDEBUG -O3 -fdiagnostics-color=always -fext-numeric-literals -march=native -Wall -Wextra -Wunreachable-code -fopenmp -pthread -std=c++20
Edited by Joerg Buchwald