Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / mips / truncate-6.c
1 /* setup_incoming_promotions should detect x to be already sign-extended due
2    to PROMOTE_MODE.  Thus the truncation should be removed by combine.  Based
3    on gcc.c-torture/execute/pr34070-2.c.  */
4 /* { dg-options "-mgp64" } */
5 /* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
6 /* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */
7
8 NOMIPS16 int f(unsigned int x, int n, int *p)
9 {
10   if (p)
11     *p = 1;
12   return ((int)x) / (1 << n);
13 }