2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr54089-10.c
blob85aeabd122c6d2f6b763db76d074ed0689ca2ded
1 /* Check that there are no redundant zero extensions around logical right
2 shifts. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1" } */
5 /* { dg-final { scan-assembler-times "extu" 20 } } */
7 /* { dg-final { scan-assembler-times "shll" 2 { target { "! sh2a" && has_dyn_shift } } } } */
8 /* { dg-final { scan-assembler-times "shll" 3 { target { "! sh2a" && "! has_dyn_shift" } } } } */
9 /* { dg-final { scan-assembler-times "movt" 2 { target { ! sh2a } } } } */
11 /* { dg-final { scan-assembler-times "bld" 1 { target { sh2a } } } } */
12 /* { dg-final { scan-assembler-times "movt" 1 { target { sh2a } } } } */
13 /* { dg-final { scan-assembler-times "movrt" 1 { target { sh2a } } } } */
14 /* { dg-final { scan-assembler-times "cmp/pz" 1 { target { sh2a } } } } */
16 /* { dg-final { scan-assembler-times "shld" 9 { target { has_dyn_shift } } } } */
18 void
19 test_0 (unsigned char* x, unsigned int* y)
21 y[0] = x[1] >> 1;
24 void
25 test_1 (unsigned char* x, unsigned int* y)
27 y[0] = x[1] >> 2;
30 void
31 test_2 (unsigned char* x, unsigned int* y)
33 y[0] = x[1] >> 3;
36 void
37 test_3 (unsigned char* x, unsigned int* y)
39 y[0] = x[1] >> 4;
42 void
43 test_4 (unsigned char* x, unsigned int* y)
45 y[0] = x[1] >> 5;
48 void
49 test_5 (unsigned char* x, unsigned int* y)
51 y[0] = x[1] >> 6;
54 void
55 test_6 (unsigned char* x, unsigned int* y)
57 /* non-SH2A: shll, movt
58 SH2A: bld, movt */
59 y[0] = x[1] >> 7;
63 void
64 test_100 (unsigned short* x, unsigned int* y)
66 y[0] = x[1] >> 1;
69 void
70 test_101 (unsigned short* x, unsigned int* y)
72 y[0] = x[1] >> 2;
75 void
76 test_102 (unsigned short* x, unsigned int* y)
78 y[0] = x[1] >> 3;
81 void
82 test_103 (unsigned short* x, unsigned int* y)
84 y[0] = x[1] >> 4;
87 void
88 test_104 (unsigned short* x, unsigned int* y)
90 y[0] = x[1] >> 5;
93 void
94 test_105 (unsigned short* x, unsigned int* y)
96 y[0] = x[1] >> 6;
99 void
100 test_106 (unsigned short* x, unsigned int* y)
102 y[0] = x[1] >> 7;
105 void
106 test_107 (unsigned short* x, unsigned int* y)
108 y[0] = x[1] >> 8;
111 void
112 test_108 (unsigned short* x, unsigned int* y)
114 y[0] = x[1] >> 9;
117 void
118 test_109 (unsigned short* x, unsigned int* y)
120 y[0] = x[1] >> 10;
123 void
124 test_110 (unsigned short* x, unsigned int* y)
126 y[0] = x[1] >> 11;
129 void
130 test_111 (unsigned short* x, unsigned int* y)
132 y[0] = x[1] >> 12;
135 void
136 test_112 (unsigned short* x, unsigned int* y)
138 y[0] = x[1] >> 13;
141 void
142 test_113 (unsigned short* x, unsigned int* y)
144 y[0] = x[1] >> 14;
147 void
148 test_114 (unsigned short* x, unsigned int* y)
150 /* non-SH2A: shll, movt
151 SH2A: cmp/pz, movrt */
152 y[0] = x[1] >> 15;