aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/canonical-cmpu.c
blob: 29bbd0a8690a7acee6953e86bb97d85227652d19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// canonicalize to == or !=
int cmp_ltu_eq0(unsigned int x) { return (x <  1) == (x == 0); }
int cmp_geu_ne0(unsigned int x) { return (x >= 1) == (x != 0); }

// canonicalize to the smaller value
int cmp_ltu(unsigned int x) { return (x <  256) == (x <= 255); }
int cmp_geu(unsigned int x) { return (x >= 256) == (x >  255); }

/*
 * check-name: canonical-cmpu
 * check-command: test-linearize -Wno-decl $file
 *
 * check-output-ignore
 * check-output-returns: 1
 */