I wonder if it hit some max execution time heuristic or something like that.
As a quick test, I added a static_assert() that depends on the returned value, which seems to force complete evaluation to happen at compile time. With that, all 3 compilers generate the expected single-instruction implementation: https://godbolt.org/z/onMannzM5
As a quick test, I added a static_assert() that depends on the returned value, which seems to force complete evaluation to happen at compile time. With that, all 3 compilers generate the expected single-instruction implementation: https://godbolt.org/z/onMannzM5