diff options
author | H.J. Lu <hjl@gcc.gnu.org> | 2010-06-24 11:21:21 -0700 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2010-06-24 11:21:21 -0700 |
commit | 969fd17d1e9902bd79436a718d6dd9304d3b6c34 (patch) | |
tree | 11c92c3765a4fe3181d5f0c93ef18aa57504e344 | |
parent | da0ae97088b798cfc5cc1d903e94e8fec121a247 (diff) | |
download | gcc-969fd17d1e9902bd79436a718d6dd9304d3b6c34.zip gcc-969fd17d1e9902bd79436a718d6dd9304d3b6c34.tar.gz gcc-969fd17d1e9902bd79436a718d6dd9304d3b6c34.tar.bz2 |
Add missing testcases for PR 44588.
From-SVN: r161330
-rw-r--r-- | gcc/testsuite/gcc.target/i386/mod-1.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/umod-1.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/umod-2.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/umod-3.c | 21 |
4 files changed, 75 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/mod-1.c b/gcc/testsuite/gcc.target/i386/mod-1.c new file mode 100644 index 0000000..a7b1a92 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mod-1.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/i386/umod-1.c b/gcc/testsuite/gcc.target/i386/umod-1.c new file mode 100644 index 0000000..54edf13 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/umod-1.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/i386/umod-2.c b/gcc/testsuite/gcc.target/i386/umod-2.c new file mode 100644 index 0000000..6fe7384 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/umod-2.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/i386/umod-3.c b/gcc/testsuite/gcc.target/i386/umod-3.c new file mode 100644 index 0000000..7123bc9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/umod-3.c @@ -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" } } */ |