2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / cris / peep2-andu2.c
blobfd19cdd906a9608624ab8757fae046d33bbefa72
1 /* { dg-do assemble } */
2 /* { dg-final { scan-assembler "movu.w \\\$r10,\\\$|movu.w 2047," } } */
3 /* { dg-final { scan-assembler "and.w 2047,\\\$|and.d \\\$r10," } } */
4 /* { dg-final { scan-assembler-not "move.d \\\$r10,\\\$" } } */
5 /* { dg-final { scan-assembler "movu.b \\\$r10,\\\$|movu.b 95," } } */
6 /* { dg-final { scan-assembler "and.b 95,\\\$|and.d \\\$r10," } } */
7 /* { dg-final { scan-assembler "andq -2,\\\$" } } */
8 /* { dg-final { scan-assembler-not "movu.b 254,\\\$" } } */
9 /* { dg-options "-O2 -save-temps" } */
11 /* Originally used to test the "andu" peephole2 trivially, register operand.
12 Due to reload changes (r186861), the suboptimal sequence isn't
13 generated and the peephole2 doesn't trig for this trivial code
14 anymore. Another minimal sequence is generated, where the constant
15 is loaded to a free register first. Instead another case is exposed;
16 handled by the "andqu" peephole2, trigged by and_peep2_q (the andq
17 and scan-assembler-not-movu.b lines above). */
19 unsigned int
20 and_peep2_hi (unsigned int y, unsigned int *x)
22 *x = y & 0x7ff;
23 return y;
26 unsigned int
27 and_peep2_qi (unsigned int y, unsigned int *x)
29 *x = y & 0x5f;
30 return y;
34 unsigned int
35 and_peep2_q (unsigned int y, unsigned int *x)
37 *x = y & 0xfe;
38 return y;