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 } } */
6
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 } } } } */
10
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 } } } } */
15
16 /* { dg-final { scan-assembler-times "shld" 9 { target { has_dyn_shift } } } } */
17
18 void
test_0(unsigned char * x,unsigned int * y)19 test_0 (unsigned char* x, unsigned int* y)
20 {
21 y[0] = x[1] >> 1;
22 }
23
24 void
test_1(unsigned char * x,unsigned int * y)25 test_1 (unsigned char* x, unsigned int* y)
26 {
27 y[0] = x[1] >> 2;
28 }
29
30 void
test_2(unsigned char * x,unsigned int * y)31 test_2 (unsigned char* x, unsigned int* y)
32 {
33 y[0] = x[1] >> 3;
34 }
35
36 void
test_3(unsigned char * x,unsigned int * y)37 test_3 (unsigned char* x, unsigned int* y)
38 {
39 y[0] = x[1] >> 4;
40 }
41
42 void
test_4(unsigned char * x,unsigned int * y)43 test_4 (unsigned char* x, unsigned int* y)
44 {
45 y[0] = x[1] >> 5;
46 }
47
48 void
test_5(unsigned char * x,unsigned int * y)49 test_5 (unsigned char* x, unsigned int* y)
50 {
51 y[0] = x[1] >> 6;
52 }
53
54 void
test_6(unsigned char * x,unsigned int * y)55 test_6 (unsigned char* x, unsigned int* y)
56 {
57 /* non-SH2A: shll, movt
58 SH2A: bld, movt */
59 y[0] = x[1] >> 7;
60 }
61
62
63 void
test_100(unsigned short * x,unsigned int * y)64 test_100 (unsigned short* x, unsigned int* y)
65 {
66 y[0] = x[1] >> 1;
67 }
68
69 void
test_101(unsigned short * x,unsigned int * y)70 test_101 (unsigned short* x, unsigned int* y)
71 {
72 y[0] = x[1] >> 2;
73 }
74
75 void
test_102(unsigned short * x,unsigned int * y)76 test_102 (unsigned short* x, unsigned int* y)
77 {
78 y[0] = x[1] >> 3;
79 }
80
81 void
test_103(unsigned short * x,unsigned int * y)82 test_103 (unsigned short* x, unsigned int* y)
83 {
84 y[0] = x[1] >> 4;
85 }
86
87 void
test_104(unsigned short * x,unsigned int * y)88 test_104 (unsigned short* x, unsigned int* y)
89 {
90 y[0] = x[1] >> 5;
91 }
92
93 void
test_105(unsigned short * x,unsigned int * y)94 test_105 (unsigned short* x, unsigned int* y)
95 {
96 y[0] = x[1] >> 6;
97 }
98
99 void
test_106(unsigned short * x,unsigned int * y)100 test_106 (unsigned short* x, unsigned int* y)
101 {
102 y[0] = x[1] >> 7;
103 }
104
105 void
test_107(unsigned short * x,unsigned int * y)106 test_107 (unsigned short* x, unsigned int* y)
107 {
108 y[0] = x[1] >> 8;
109 }
110
111 void
test_108(unsigned short * x,unsigned int * y)112 test_108 (unsigned short* x, unsigned int* y)
113 {
114 y[0] = x[1] >> 9;
115 }
116
117 void
test_109(unsigned short * x,unsigned int * y)118 test_109 (unsigned short* x, unsigned int* y)
119 {
120 y[0] = x[1] >> 10;
121 }
122
123 void
test_110(unsigned short * x,unsigned int * y)124 test_110 (unsigned short* x, unsigned int* y)
125 {
126 y[0] = x[1] >> 11;
127 }
128
129 void
test_111(unsigned short * x,unsigned int * y)130 test_111 (unsigned short* x, unsigned int* y)
131 {
132 y[0] = x[1] >> 12;
133 }
134
135 void
test_112(unsigned short * x,unsigned int * y)136 test_112 (unsigned short* x, unsigned int* y)
137 {
138 y[0] = x[1] >> 13;
139 }
140
141 void
test_113(unsigned short * x,unsigned int * y)142 test_113 (unsigned short* x, unsigned int* y)
143 {
144 y[0] = x[1] >> 14;
145 }
146
147 void
test_114(unsigned short * x,unsigned int * y)148 test_114 (unsigned short* x, unsigned int* y)
149 {
150 /* non-SH2A: shll, movt
151 SH2A: cmp/pz, movrt */
152 y[0] = x[1] >> 15;
153 }
154