re PR tree-optimization/63641 (Invalid shift leads to incorrect code on 32-bit system)
PR tree-optimization/63641 * tree-ssa-reassoc.c (optimize_range_tests_to_bit_test): Set high to low + prec - 1 - clz (mask) instead of low + prec - clz (mask). * gcc.c-torture/execute/pr63641.c: New test. From-SVN: r216693
This commit is contained in:
parent
608b9c889e
commit
46a547083a
|
@ -1,3 +1,9 @@
|
|||
2014-10-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/63641
|
||||
* tree-ssa-reassoc.c (optimize_range_tests_to_bit_test): Set high
|
||||
to low + prec - 1 - clz (mask) instead of low + prec - clz (mask).
|
||||
|
||||
2014-10-25 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR rtl-optimization/63615
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2014-10-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/63641
|
||||
* gcc.c-torture/execute/pr63641.c: New test.
|
||||
|
||||
2014-10-24 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
* gfortran.dg/coarray_collectives_9.f90: Remove dg-error.
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* PR tree-optimization/63641 */
|
||||
|
||||
__attribute__ ((noinline, noclone)) int
|
||||
foo (unsigned char b)
|
||||
{
|
||||
if (0x0 <= b && b <= 0x8)
|
||||
goto lab;
|
||||
if (b == 0x0b)
|
||||
goto lab;
|
||||
if (0x0e <= b && b <= 0x1a)
|
||||
goto lab;
|
||||
if (0x1c <= b && b <= 0x1f)
|
||||
goto lab;
|
||||
return 0;
|
||||
lab:
|
||||
return 1;
|
||||
}
|
||||
|
||||
__attribute__ ((noinline, noclone)) int
|
||||
bar (unsigned char b)
|
||||
{
|
||||
if (0x0 <= b && b <= 0x8)
|
||||
goto lab;
|
||||
if (b == 0x0b)
|
||||
goto lab;
|
||||
if (0x0e <= b && b <= 0x1a)
|
||||
goto lab;
|
||||
if (0x3c <= b && b <= 0x3f)
|
||||
goto lab;
|
||||
return 0;
|
||||
lab:
|
||||
return 1;
|
||||
}
|
||||
|
||||
char tab1[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 };
|
||||
char tab2[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 };
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i;
|
||||
asm volatile ("" : : : "memory");
|
||||
for (i = 0; i < 256; i++)
|
||||
if (foo (i) != (i < 32 ? tab1[i] : 0))
|
||||
__builtin_abort ();
|
||||
for (i = 0; i < 256; i++)
|
||||
if (bar (i) != (i < 64 ? tab2[i] : 0))
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
|
@ -2513,7 +2513,7 @@ optimize_range_tests_to_bit_test (enum tree_code opcode, int first, int length,
|
|||
{
|
||||
tree high = wide_int_to_tree (TREE_TYPE (lowi),
|
||||
wi::to_widest (lowi)
|
||||
+ prec - wi::clz (mask));
|
||||
+ prec - 1 - wi::clz (mask));
|
||||
operand_entry_t oe = (*ops)[ranges[i].idx];
|
||||
tree op = oe->op;
|
||||
gimple stmt = op ? SSA_NAME_DEF_STMT (op)
|
||||
|
|
Loading…
Reference in New Issue