expmed.c (emit_store_flag_1): Fix choice of zero vs.

2009-07-11  Paolo Bonzini  <bonzini@gnu.org>

	* expmed.c (emit_store_flag_1): Fix choice of zero vs. sign extension.

2009-07-11  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.c-torture/execute/20090711-1.c: New test.

From-SVN: r149509
This commit is contained in:
Paolo Bonzini 2009-07-11 08:28:34 +00:00 committed by Paolo Bonzini
parent 33cde5161f
commit e9edda2372
4 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2009-07-11 Paolo Bonzini <bonzini@gnu.org>
* expmed.c (emit_store_flag_1): Fix choice of zero vs. sign extension.
2009-07-10 DJ Delorie <dj@redhat.com>
* config/mep/mep.c (mep_can_inline_p): Correct logic, and simplify.

View File

@ -5343,7 +5343,7 @@ emit_store_flag_1 (rtx target, enum rtx_code code, rtx op0, rtx op1,
target = gen_reg_rtx (target_mode);
convert_move (target, tem,
0 == (STORE_FLAG_VALUE
0 == ((normalizep ? normalizep : STORE_FLAG_VALUE)
& ((HOST_WIDE_INT) 1
<< (GET_MODE_BITSIZE (word_mode) -1))));
return target;

View File

@ -1,3 +1,7 @@
2009-07-11 Paolo Bonzini <bonzini@gnu.org>
* gcc.c-torture/execute/20090711-1.c: New test.
2009-07-11 Richard Sandiford <rdsandiford@googlemail.com>
PR testsuite/40699

View File

@ -0,0 +1,21 @@
/* Used to be miscompiled at -O0 due to incorrect choice of sign extension
vs. zero extension. __attribute__ ((noinline)) added to try to make it
fail at higher optimization levels too. */
extern void abort (void);
long long __attribute__ ((noinline))
div (long long val)
{
return val / 32768;
}
int main (void)
{
long long d1 = -990000000;
long long d2 = div(d1);
if (d2 != -30212)
abort ();
return 0;
}