summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/mips/truncate-6.c
blob: 1ccd6c59c3d623c59724c6bc458ccd8b2dcf9f3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* setup_incoming_promotions should detect x to be already sign-extended due
   to PROMOTE_MODE.  Thus the truncation should be removed by combine.  Based
   on gcc.c-torture/execute/pr34070-2.c.  */
/* { dg-options "-O -mgp64" } */
/* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */

NOMIPS16 int f(unsigned int x, int n, int *p)
{
  if (p)
    *p = 1;
  return ((int)x) / (1 << n);
}