build: target x86-64-v3 without floating-point contraction

This commit is contained in:
nmzik
2026-10-27 06:57:29 +01:00
parent 6cee2dc0bd
commit fd6b28c4b2
3 changed files with 25 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
#include <cstdio>
#if !defined(__AVX2__) || !defined(__BMI2__) || !defined(__FMA__)
#error "x86-64 builds target x86-64-v3"
#endif
int main() {
// (1 + 2^-23)^2 = 1 + 2^-22 + 2^-46; only a fused multiply-add keeps the 2^-46.
volatile float a = 1.0f + 0x1p-23f;
const float result = a * a - (1.0f + 0x1p-22f);
if (result != 0.0f) {
std::fprintf(stderr, "BuildFlagsTests: failed: a * a - b was contracted (%a)\n", result);
return 1;
}
std::puts("BuildFlagsTests: all cases passed");
return 0;
}