summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-and-rshift-1.c
blob: 11c13d582eb6fc7c46b0b3aacc9a7a4be1ad8521 (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
31
32
33
34
35
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-original" } */

int f(int x)
{
	return (x >> 2) & 128;
}

int g(int x)
{
	return !!(x & 512) << 7;
}

int h(int x)
{
	return ((x >> 9) & 1) << 7;
}

int i(int x)
{
	return (x & 512) >> 9 << 7;
}

int j(int x)
{
	return ((x >> 9) & 1) ? 128 : 0;
}

int k(int x)
{
	return (x & 512) ? 128 : 0;
}

/* { dg-final { scan-tree-dump-not " \\? " "original" } } */
/* { dg-final { scan-assembler-not "sall" { target i?86-*-* x86_64-*-* } } }" */