gcc/
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr53988-1.c
blob4e0d49edfaffc42eee465e07f904ae5bb14ae0f4
1 /* Check that sign/zero extensions are emitted where needed when the
2 tst Rm,Rn instruction is used. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1" } */
5 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
6 /* { dg-final { scan-assembler-times "tst\tr" 8 } } */
7 /* { dg-final { scan-assembler-times "mov.b" 4 } } */
8 /* { dg-final { scan-assembler-times "mov.w" 4 } } */
9 /* { dg-final { scan-assembler-times "extu.b" 4 } } */
10 /* { dg-final { scan-assembler-times "extu.w" 2 } } */
12 int
13 test_00 (char* x, char* y)
15 /* 2x mov.b (sign extending) */
16 return *x & *y ? -40 : 60;
19 int
20 test_01 (short* x, short* y)
22 /* 2x mov.w (sign extending) */
23 return *x & *y ? -40 : 60;
26 int
27 test_02 (char x, char y)
29 /* 1x extu.b */
30 return x & y ? -40 : 60;
33 int
34 test_03 (short x, short y)
36 /* 1x extu.w */
37 return x & y ? -40 : 60;
40 int
41 test_04 (char* x, unsigned char y)
43 /* 1x mov.b, 1x extu.b */
44 return *x & y ? -40 : 60;
47 int
48 test_05 (short* x, unsigned char y)
50 /* 1x mov.w, 1x extu.b */
51 return *x & y ? -40 : 60;
54 int
55 test_06 (short x, short* y, int z, int w)
57 /* 1x mov.w, 1x extu.w */
58 return x & y[0] ? z : w;
61 int
62 test_07 (char x, char* y, int z, int w)
64 /* 1x mov.b, 1x extu.b */
65 return x & y[0] ? z : w;