aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/shl-and1.c
blob: 5f4fdcb13deb378f5c3c68bc8583e2f0946fcb2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// If (t << S) is simplified into (x << S)
// then the whole expression will be 0.
// The test is only interesting if the sub-expression
// (x & M) is referenced more than once
// (because otherwise other simplifications apply).
unsigned shl_and1(unsigned x)
{
	unsigned t = (x & 0x000fffff);
	return ((t << 12) ^ (x << 12)) & t;
}

/*
 * check-name: shl-and1
 * check-command: test-linearize -Wno-decl $file
 * check-known-to-fail
 *
 * check-output-ignore
 * check-output-contains: ret\\..*\\$0$
 */