[Bug target/47617] SSE rounding mode works -g, not -O3
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Feb 8 01:59:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47617
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |DUPLICATE
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-02-08 01:58:40 UTC ---
The problem is the same as recorded as PR 34678. We are optimizing all the
_mm_cvtps_pi16 to one of them because we don't see the rounding mode has
changed. To get the correct values each time do the following:
void test_rounding(void)
{
__m128 source = {-1.1, 0.0, 1.1, 1.5};
__m64 dest;
unsigned int initial_mode;
initial_mode = _MM_GET_ROUNDING_MODE();
print_rounding_mode("initial rounding mode", initial_mode);
/* now set the rounding mode to each value to see the result */
asm("":"+X"(source)); // force source to be different but the same
_MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);
dest = _mm_cvtps_pi16(source);
_mm_empty();
print_round_results("with _MM_ROUND_NEAREST ", source, dest);
asm("":"+X"(source)); // force source to be different but the same
_MM_SET_ROUNDING_MODE(_MM_ROUND_DOWN);
dest = _mm_cvtps_pi16(source);
_mm_empty();
print_round_results("with _MM_ROUND_DOWN ", source, dest);
asm("":"+X"(source)); // force source to be different but the same
_MM_SET_ROUNDING_MODE(_MM_ROUND_UP);
dest = _mm_cvtps_pi16(source);
_mm_empty();
print_round_results("with _MM_ROUND_UP ", source, dest);
asm("":"+X"(source)); // force source to be different but the same
_MM_SET_ROUNDING_MODE(_MM_ROUND_TOWARD_ZERO);
dest = _mm_cvtps_pi16(source);
_mm_empty();
print_round_results("with _MM_ROUND_TOWARD_ZERO ", source, dest);
/* restore initial rounding mode */
_MM_SET_ROUNDING_MODE(initial_mode);
}
*** This bug has been marked as a duplicate of bug 34678 ***
More information about the Gcc-bugs
mailing list