From ee9bb2c687509a46cd2e9f6fb7e20e5b494a7662 Mon Sep 17 00:00:00 2001 From: Jonathan Albrecht Date: Wed, 8 Nov 2023 10:09:01 -0500 Subject: [PATCH] On s390x, compile the FMA test with -O2 to avoid over-optimization The test for fused multiply add is compiled with -O3 by default but on s390x with g++ 11 or 12 at least, -O3 will optimize out the math instructions so the FMA optimization doesn't get a chance to be applied. Reduce the optimization level to -O2 so FMA can be detected. This allows some of the mtr tests to pass that otherwise fail if FMA is applied. --- cmake/floating_point.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/floating_point.cmake b/cmake/floating_point.cmake index 3ad7e7e8106a..a4d52845a041 100644 --- a/cmake/floating_point.cmake +++ b/cmake/floating_point.cmake @@ -49,7 +49,11 @@ SET(code " ) CMAKE_PUSH_CHECK_STATE() -STRING_APPEND(CMAKE_REQUIRED_FLAGS " -O3") +IF(LINUX AND CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x") + STRING_APPEND(CMAKE_REQUIRED_FLAGS " -O2") +ELSE() + STRING_APPEND(CMAKE_REQUIRED_FLAGS " -O3") +ENDIF() IF(MY_COMPILER_IS_GNU) CHECK_C_SOURCE_RUNS("${code}" HAVE_C_FLOATING_POINT_FUSED_MADD)