summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/divmod-4.c
blob: 861ecbdec4b874c1277bbd54d7ffcc262c87b84b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* { dg-require-effective-target divmod } */
/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */
/* mod comes before div in same bb.  */ 

typedef int SImode __attribute__((mode(SI)));
typedef unsigned USImode __attribute__((mode(SI)));

typedef int DImode __attribute__((mode(DI)));
typedef unsigned UDImode __attribute__((mode(DI)));

extern int cond;
void foo(void);

#define FOO(smalltype, bigtype, no)	\
bigtype f_##no(smalltype x, bigtype y)  \
{					\
  bigtype r = x % y;                    \
  bigtype q = x / y;                    \
  return q + r;                         \
}

FOO(SImode, DImode, 3)
FOO(SImode, UDImode, 4)
FOO(USImode, DImode, 6)
FOO(USImode, UDImode, 7)
FOO(DImode, DImode, 8)
FOO(DImode, UDImode, 9)
FOO(UDImode, UDImode, 10)

/* { dg-final { scan-tree-dump-times "DIVMOD" 7 "widening_mul" } } */