Commit 02bb8bce by Uros Bizjak

re PR rtl-optimization/37544 (Conversion double -> unsigned long long ->…

re PR rtl-optimization/37544 (Conversion double -> unsigned long long -> unsigned -> double gives wrong results)

	PR rtl-optimization/37544
	* regrename.c (maybe_mode_change): Exit early when copy_mode
	is narrower than orig_mode and narrower than new_mode.

testsuite/ChangeLog:

	PR rtl-optimization/37544
	* gcc.dg/pr37544.c: New test.

From-SVN: r140446
parent d9e74dfc
...@@ -1314,6 +1314,10 @@ maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode, ...@@ -1314,6 +1314,10 @@ maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode,
enum machine_mode new_mode, unsigned int regno, enum machine_mode new_mode, unsigned int regno,
unsigned int copy_regno ATTRIBUTE_UNUSED) unsigned int copy_regno ATTRIBUTE_UNUSED)
{ {
if (GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (orig_mode)
&& GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
return NULL_RTX;
if (orig_mode == new_mode) if (orig_mode == new_mode)
return gen_rtx_raw_REG (new_mode, regno); return gen_rtx_raw_REG (new_mode, regno);
else if (mode_change_ok (orig_mode, new_mode, regno)) else if (mode_change_ok (orig_mode, new_mode, regno))
......
2008-09-18 Uros Bizjak <ubizjak@gmail.com>
PR rtl-optimization/37544
* gcc.dg/pr37544.c: New test.
2008-09-17 Janis Johnson <janis187@us.ibm.com> 2008-09-17 Janis Johnson <janis187@us.ibm.com>
PR testsuite/25241 PR testsuite/25241
......
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -msse2 -mtune=core2 -mfpmath=387" { target { i?86-*-* x86_64-*-* } } } */
#ifdef __i386__
#include "cpuid.h"
#endif
extern void abort (void);
int main(void)
{
double arr[1000];
double a, b;
int i;
#ifdef __i386__
unsigned int eax, ebx, ecx, edx;
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return 0;
/* Run SSE2 test only if host has SSE2 support. */
if (!(edx & bit_SSE2))
return 0;
#endif
for (i = 0; i < 1000; i++)
arr[i] = 4294967296.0 + (double)i;
a = arr[0];
b = (unsigned int)((unsigned long long int)a % 4294967296ULL);
if (b >= 4294967296.0)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment