On Fri, Jun 27, 2025 at 08:17:46AM +0200, Tobias Burnus wrote: > Hi Yuao, > > > Yuao Ma wrote: > > >//but the testcases don't seem to be conditionalized on this. Would the > > >//new tests fail if gcc is built against an insufficiently recent version > > >//of mpfr, > … > > The test case is indeed conditionalized, though in a different manner > > than you > > might expect. The condition depends on the version of MPFR we're using, > > and > > unfortunately, I haven't found a predefined macro that indicates which > > MPFR > > version GCC is linked against. > > I think there is a detour way: The 'print_version' function (toplev.cc) > prints the MPFR version, but only when not printing to stderr. > > > Thus, I get the desired output with: > > > gcc -S -fverbose-asm -o - -x c - < /dev/null > > > [I think the /dev/null is not quite portable; possibly a pipe ("echo |...") > or an empty file is more portable.] > > > The output contains here "... MPFR version 4.2.2 ..."
Though, parsing MPFR version in tcl and determining what is later than 4.2.2 might be difficult. I think the __builtin_constant_p(acospi(0.5)) approach is usable, but would be much better done on the lib/target-supports.exp side. So, have foldable_pi_based_trigonometry effective target, which would test if __builtin_constant_p(acospi(0.5)) is 1. The advantage of doing it that way is that it is visible in the test log files whether it is supported (then the tests can PASS or perhaps FAIL) or not (then the test will be UNSUPPORTED). Jakub