diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/divmod-2-simode.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/divmod-2-simode.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/divmod-2-simode.c b/gcc/testsuite/gcc.dg/divmod-2-simode.c new file mode 100644 index 00000000000..fa28beb3cef --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-2-simode.c @@ -0,0 +1,25 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* mod dominates div. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype r = x % y; \ + if (cond) \ + foo (); \ + bigtype q = x / y; \ + return q + r; \ +} + +FOO(SImode, SImode, 1) +FOO(SImode, USImode, 2) +FOO(USImode, USImode, 3) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 3 "widening_mul" } } */ |