Add missing testcases for PR 44588.

From-SVN: r161330
This commit is contained in:
H.J. Lu 2010-06-24 11:21:21 -07:00
parent da0ae97088
commit 969fd17d1e
4 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,29 @@
/* { dg-do compile } */
/* { dg-options "-Os -mtune=generic" } */
typedef struct {
int a;
} VCR;
typedef struct {
VCR vcr[8];
} VCRC;
typedef struct {
char vcr;
} OWN;
OWN Own[16];
void
f (VCRC *x, OWN *own)
{
x[own->vcr / 8].vcr[own->vcr % 8].a--;
x[own->vcr / 8].vcr[own->vcr % 8].a = x[own->vcr / 8].vcr[own->vcr % 8].a;
}
/* { dg-final { scan-assembler-times "idivb" 1 } } */
/* { dg-final { scan-assembler-not "incl" } } */
/* { dg-final { scan-assembler-not "orl" } } */
/* { dg-final { scan-assembler-not "andb" } } */
/* { dg-final { scan-assembler-not "jns" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=atom" } */
unsigned char
foo (unsigned char x, unsigned char y)
{
return x % y;
}
/* { dg-final { scan-assembler-times "divb" 1 } } */
/* { dg-final { scan-assembler-not "divw" } } */

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=atom" } */
extern unsigned char z;
unsigned char
foo (unsigned char x, unsigned char y)
{
z = x/y;
return x % y;
}
/* { dg-final { scan-assembler-times "divb" 1 } } */
/* { dg-final { scan-assembler-not "divw" } } */

View File

@ -0,0 +1,21 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=atom" } */
extern void abort (void);
extern void exit (int);
unsigned char cx = 7;
int
main ()
{
unsigned char cy;
cy = cx / 6; if (cy != 1) abort ();
cy = cx % 6; if (cy != 1) abort ();
exit(0);
}
/* { dg-final { scan-assembler-times "divb" 1 } } */
/* { dg-final { scan-assembler-not "divw" } } */