cris-peep2-xsrand.c, [...]: New tests.

* gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-andu1.c,
	gcc.dg/cris-peep2-andu2.c: New tests.

From-SVN: r85040
This commit is contained in:
Hans-Peter Nilsson 2004-07-22 10:08:29 +00:00 committed by Hans-Peter Nilsson
parent 26277d4179
commit 7413a13251
4 changed files with 111 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2004-07-22 Hans-Peter Nilsson <hp@axis.com>
* gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-andu1.c,
gcc.dg/cris-peep2-andu2.c: New tests.
2004-07-22 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/15052

View File

@ -0,0 +1,42 @@
/* { dg-do compile { target cris-*-* } } */
/* { dg-final { scan-assembler-not "and.d " } } */
/* { dg-final { scan-assembler-not "move.d " } } */
/* { dg-final { scan-assembler "cLear.b" } } */
/* { dg-final { scan-assembler "movu.b" } } */
/* { dg-final { scan-assembler "and.b" } } */
/* { dg-final { scan-assembler "movu.w" } } */
/* { dg-final { scan-assembler "and.w" } } */
/* { dg-final { scan-assembler "andq" } } */
/* { dg-options "-O2" } */
/* Test the "andu" peephole2 trivially, memory operand. */
int
clearb (int x, int *y)
{
return *y & 0xff00;
}
int
andb (int x, int *y)
{
return *y & 0x3f;
}
int
andw (int x, int *y)
{
return *y & 0xfff;
}
int
andq (int x, int *y)
{
return *y & 0xf0;
}
int
andq2 (int x, int *y)
{
return *y & 0xfff0;
}

View File

@ -0,0 +1,32 @@
/* { dg-do compile { target cris-*-* } } */
/* { dg-final { scan-assembler "movu.w \\\$r10,\\\$r" } } */
/* { dg-final { scan-assembler "and.w 2047,\\\$r" } } */
/* { dg-final { scan-assembler-not "move.d \\\$r10,\\\$r" } } */
/* { dg-final { scan-assembler "movu.b \\\$r10,\\\$r" } } */
/* { dg-final { scan-assembler "and.b 95,\\\$r" } } */
/* { dg-final { scan-assembler "andq -2,\\\$r" } } */
/* { dg-options "-O2" } */
/* Test the "andu" peephole2 trivially, register operand. */
unsigned int
and_peep2_hi (unsigned int y, unsigned int *x)
{
*x = y & 0x7ff;
return y;
}
unsigned int
and_peep2_qi (unsigned int y, unsigned int *x)
{
*x = y & 0x5f;
return y;
}
unsigned int
and_peep2_q (unsigned int y, unsigned int *x)
{
*x = y & 0xfe;
return y;
}

View File

@ -0,0 +1,32 @@
/* { dg-do compile { target cris-*-* } } */
/* { dg-final { scan-assembler "and.w " } } */
/* { dg-final { scan-assembler "and.b " } } */
/* { dg-final { scan-assembler-not "and.d" } } */
/* { dg-options "-O2" } */
/* Test the "asrandb", "asrandw", "lsrandb" and "lsrandw" peephole2:s
trivially. */
unsigned int
andwlsr (unsigned int x)
{
return (x >> 17) & 0x7ff;
}
unsigned int
andblsr (unsigned int x)
{
return (x >> 25) & 0x5f;
}
int
andwasr (int x)
{
return (x >> 17) & 0x7ff;
}
int
andbasr (int x)
{
return (x >> 25) & 0x5f;
}