view gcc/testsuite/gcc.dg/divmod-6.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-require-effective-target divmod } */
/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */

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 q = x / y;                     \
  bigtype r1 = 0, r2 = 0;                \
  if (cond)                              \
    r1 = x % y;                          \
  else                                   \
    r2 = x % y;                          \
  return q + r1 + r2;                    \
}

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" } } */