Merge lp:~ramana/gcc-linaro/backport-neon-shiftimm-take2-4.6 into lp:gcc-linaro/4.6
- backport-neon-shiftimm-take2-4.6
- Merge into 4.6
Status: | Merged |
---|---|
Approved by: | Richard Sandiford |
Approved revision: | no longer in the source branch. |
Merged at revision: | 106772 |
Proposed branch: | lp:~ramana/gcc-linaro/backport-neon-shiftimm-take2-4.6 |
Merge into: | lp:gcc-linaro/4.6 |
Diff against target: |
365 lines (+241/-19) 9 files modified
ChangeLog.linaro (+32/-0) gcc/config/arm/arm-protos.h (+4/-0) gcc/config/arm/arm.c (+82/-0) gcc/config/arm/neon.md (+67/-19) gcc/config/arm/predicates.md (+20/-0) gcc/optabs.c (+3/-0) gcc/testsuite/gcc.target/arm/neon-vlshr-imm-1.c (+11/-0) gcc/testsuite/gcc.target/arm/neon-vshl-imm-1.c (+11/-0) gcc/testsuite/gcc.target/arm/neon-vshr-imm-1.c (+11/-0) |
To merge this branch: | bzr merge lp:~ramana/gcc-linaro/backport-neon-shiftimm-take2-4.6 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Richard Sandiford | Approve | ||
Review via email: mp+66796@code.launchpad.net |
Commit message
Description of the change
Proposed for merge to get testing coverage based on comments in review from previous iteration.
Ramana
Linaro Toolchain Builder (cbuild) wrote : | # |
Linaro Toolchain Builder (cbuild) wrote : | # |
cbuild successfully built this on x86_64-
The build results are available at:
http://
The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106767.
The full testsuite results are at:
http://
cbuild-checked: x86_64-
Linaro Toolchain Builder (cbuild) wrote : | # |
cbuild successfully built this on armv7l-
The build results are available at:
http://
The test suite results changed compared to the branch point lp:gcc-linaro/4.6+bzr106767:
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
The full testsuite results are at:
http://
cbuild-checked: armv7l-
Linaro Toolchain Builder (cbuild) wrote : | # |
cbuild successfully built this on i686-natty-
The build results are available at:
http://
The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106767.
The full testsuite results are at:
http://
cbuild-checked: i686-natty-
Linaro Toolchain Builder (cbuild) wrote : | # |
cbuild successfully built this on armv7l-
The build results are available at:
http://
The test suite results changed compared to the branch point lp:gcc-linaro/4.6+bzr106767:
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
The full testsuite results are at:
http://
cbuild-checked: armv7l-
Linaro Toolchain Builder (cbuild) wrote : | # |
cbuild successfully built this on armv7l-
The build results are available at:
http://
The test suite results changed compared to the branch point lp:gcc-linaro/4.6+bzr106767:
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
+PASS: gcc.target/
The full testsuite results are at:
http://
cbuild-checked: armv7l-
Preview Diff
1 | === modified file 'ChangeLog.linaro' |
2 | --- ChangeLog.linaro 2011-07-04 11:13:51 +0000 |
3 | +++ ChangeLog.linaro 2011-07-04 14:15:56 +0000 |
4 | @@ -1,3 +1,35 @@ |
5 | +2011-07-04 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> |
6 | + |
7 | + gcc/ |
8 | + 2011-06-22 Dmitry Plotnikov <dplotnikov@ispras.ru> |
9 | + Dmitry Melnik <dm@ispras.ru> |
10 | + |
11 | + * config/arm/arm.c (neon_immediate_valid_for_shift): New function. |
12 | + (neon_output_shift_immediate): Ditto. |
13 | + * config/arm/arm-protos.h (neon_immediate_valid_for_shift): New |
14 | + prototype. |
15 | + (neon_output_shift_immediate): Ditto. |
16 | + * config/arm/neon.md (vashl<mode>3): Modified constraint. |
17 | + (vashr<mode>3_imm): New insn pattern. |
18 | + (vlshr<mode>3_imm): Ditto. |
19 | + (vashr<mode>3): Modified constraint. |
20 | + (vlshr<mode>3): Ditto. |
21 | + * config/arm/predicates.md (imm_for_neon_lshift_operand): New |
22 | + predicate. |
23 | + (imm_for_neon_rshift_operand): Ditto. |
24 | + (imm_lshift_or_reg_neon): Ditto. |
25 | + (imm_rshift_or_reg_neon): Ditto. |
26 | + |
27 | + * optabs.c (init_optabs): Init optab codes for vashl, vashr, vlshr. |
28 | + |
29 | + gcc/testsuite |
30 | + 2011-06-22 Dmitry Plotnikov <dplotnikov@ispras.ru> |
31 | + Dmitry Melnik <dm@ispras.ru> |
32 | + |
33 | + * gcc.target/arm/neon-vshr-imm-1.c: New testcase. |
34 | + * gcc.target/arm/neon-vshl-imm-1.c: New testcase. |
35 | + * gcc.target/arm/neon-vlshr-imm-1.c: New testcase. |
36 | + |
37 | 2011-07-01 Andrew Stubbs <ams@codesourcery.com> |
38 | |
39 | Merge from FSF GCC 4.6.1 (svn branches/gcc-4_6-branch 175677). |
40 | |
41 | === modified file 'gcc/config/arm/arm-protos.h' |
42 | --- gcc/config/arm/arm-protos.h 2011-06-14 16:00:30 +0000 |
43 | +++ gcc/config/arm/arm-protos.h 2011-07-04 14:15:56 +0000 |
44 | @@ -64,8 +64,12 @@ |
45 | extern int neon_immediate_valid_for_move (rtx, enum machine_mode, rtx *, int *); |
46 | extern int neon_immediate_valid_for_logic (rtx, enum machine_mode, int, rtx *, |
47 | int *); |
48 | +extern int neon_immediate_valid_for_shift (rtx, enum machine_mode, rtx *, |
49 | + int *, bool); |
50 | extern char *neon_output_logic_immediate (const char *, rtx *, |
51 | enum machine_mode, int, int); |
52 | +extern char *neon_output_shift_immediate (const char *, char, rtx *, |
53 | + enum machine_mode, int, bool); |
54 | extern void neon_pairwise_reduce (rtx, rtx, enum machine_mode, |
55 | rtx (*) (rtx, rtx, rtx)); |
56 | extern rtx neon_make_constant (rtx); |
57 | |
58 | === modified file 'gcc/config/arm/arm.c' |
59 | --- gcc/config/arm/arm.c 2011-06-29 09:13:17 +0000 |
60 | +++ gcc/config/arm/arm.c 2011-07-04 14:15:56 +0000 |
61 | @@ -8863,6 +8863,66 @@ |
62 | return 1; |
63 | } |
64 | |
65 | +/* Return TRUE if rtx OP is legal for use in a VSHR or VSHL instruction. If |
66 | + the immediate is valid, write a constant suitable for using as an operand |
67 | + to VSHR/VSHL to *MODCONST and the corresponding element width to |
68 | + *ELEMENTWIDTH. ISLEFTSHIFT is for determine left or right shift, |
69 | + because they have different limitations. */ |
70 | + |
71 | +int |
72 | +neon_immediate_valid_for_shift (rtx op, enum machine_mode mode, |
73 | + rtx *modconst, int *elementwidth, |
74 | + bool isleftshift) |
75 | +{ |
76 | + unsigned int innersize = GET_MODE_SIZE (GET_MODE_INNER (mode)); |
77 | + unsigned int n_elts = CONST_VECTOR_NUNITS (op), i; |
78 | + unsigned HOST_WIDE_INT last_elt = 0; |
79 | + unsigned HOST_WIDE_INT maxshift; |
80 | + |
81 | + /* Split vector constant out into a byte vector. */ |
82 | + for (i = 0; i < n_elts; i++) |
83 | + { |
84 | + rtx el = CONST_VECTOR_ELT (op, i); |
85 | + unsigned HOST_WIDE_INT elpart; |
86 | + |
87 | + if (GET_CODE (el) == CONST_INT) |
88 | + elpart = INTVAL (el); |
89 | + else if (GET_CODE (el) == CONST_DOUBLE) |
90 | + return 0; |
91 | + else |
92 | + gcc_unreachable (); |
93 | + |
94 | + if (i != 0 && elpart != last_elt) |
95 | + return 0; |
96 | + |
97 | + last_elt = elpart; |
98 | + } |
99 | + |
100 | + /* Shift less than element size. */ |
101 | + maxshift = innersize * 8; |
102 | + |
103 | + if (isleftshift) |
104 | + { |
105 | + /* Left shift immediate value can be from 0 to <size>-1. */ |
106 | + if (last_elt >= maxshift) |
107 | + return 0; |
108 | + } |
109 | + else |
110 | + { |
111 | + /* Right shift immediate value can be from 1 to <size>. */ |
112 | + if (last_elt == 0 || last_elt > maxshift) |
113 | + return 0; |
114 | + } |
115 | + |
116 | + if (elementwidth) |
117 | + *elementwidth = innersize * 8; |
118 | + |
119 | + if (modconst) |
120 | + *modconst = CONST_VECTOR_ELT (op, 0); |
121 | + |
122 | + return 1; |
123 | +} |
124 | + |
125 | /* Return a string suitable for output of Neon immediate logic operation |
126 | MNEM. */ |
127 | |
128 | @@ -8885,6 +8945,28 @@ |
129 | return templ; |
130 | } |
131 | |
132 | +/* Return a string suitable for output of Neon immediate shift operation |
133 | + (VSHR or VSHL) MNEM. */ |
134 | + |
135 | +char * |
136 | +neon_output_shift_immediate (const char *mnem, char sign, rtx *op2, |
137 | + enum machine_mode mode, int quad, |
138 | + bool isleftshift) |
139 | +{ |
140 | + int width, is_valid; |
141 | + static char templ[40]; |
142 | + |
143 | + is_valid = neon_immediate_valid_for_shift (*op2, mode, op2, &width, isleftshift); |
144 | + gcc_assert (is_valid != 0); |
145 | + |
146 | + if (quad) |
147 | + sprintf (templ, "%s.%c%d\t%%q0, %%q1, %%2", mnem, sign, width); |
148 | + else |
149 | + sprintf (templ, "%s.%c%d\t%%P0, %%P1, %%2", mnem, sign, width); |
150 | + |
151 | + return templ; |
152 | +} |
153 | + |
154 | /* Output a sequence of pairwise operations to implement a reduction. |
155 | NOTE: We do "too much work" here, because pairwise operations work on two |
156 | registers-worth of operands in one go. Unfortunately we can't exploit those |
157 | |
158 | === modified file 'gcc/config/arm/neon.md' |
159 | --- gcc/config/arm/neon.md 2011-07-01 09:19:21 +0000 |
160 | +++ gcc/config/arm/neon.md 2011-07-04 14:15:56 +0000 |
161 | @@ -956,15 +956,57 @@ |
162 | ; SImode elements. |
163 | |
164 | (define_insn "vashl<mode>3" |
165 | - [(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
166 | - (ashift:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
167 | - (match_operand:VDQIW 2 "s_register_operand" "w")))] |
168 | - "TARGET_NEON" |
169 | - "vshl.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
170 | - [(set (attr "neon_type") |
171 | - (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0)) |
172 | - (const_string "neon_vshl_ddd") |
173 | - (const_string "neon_shift_3")))] |
174 | + [(set (match_operand:VDQIW 0 "s_register_operand" "=w,w") |
175 | + (ashift:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w,w") |
176 | + (match_operand:VDQIW 2 "imm_lshift_or_reg_neon" "w,Dn")))] |
177 | + "TARGET_NEON" |
178 | + { |
179 | + switch (which_alternative) |
180 | + { |
181 | + case 0: return "vshl.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"; |
182 | + case 1: return neon_output_shift_immediate ("vshl", 'i', &operands[2], |
183 | + <MODE>mode, |
184 | + VALID_NEON_QREG_MODE (<MODE>mode), |
185 | + true); |
186 | + default: gcc_unreachable (); |
187 | + } |
188 | + } |
189 | + [(set (attr "neon_type") |
190 | + (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0)) |
191 | + (const_string "neon_vshl_ddd") |
192 | + (const_string "neon_shift_3")))] |
193 | +) |
194 | + |
195 | +(define_insn "vashr<mode>3_imm" |
196 | + [(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
197 | + (ashiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
198 | + (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dn")))] |
199 | + "TARGET_NEON" |
200 | + { |
201 | + return neon_output_shift_immediate ("vshr", 's', &operands[2], |
202 | + <MODE>mode, VALID_NEON_QREG_MODE (<MODE>mode), |
203 | + false); |
204 | + } |
205 | + [(set (attr "neon_type") |
206 | + (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0)) |
207 | + (const_string "neon_vshl_ddd") |
208 | + (const_string "neon_shift_3")))] |
209 | +) |
210 | + |
211 | +(define_insn "vlshr<mode>3_imm" |
212 | + [(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
213 | + (lshiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
214 | + (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dn")))] |
215 | + "TARGET_NEON" |
216 | + { |
217 | + return neon_output_shift_immediate ("vshr", 'u', &operands[2], |
218 | + <MODE>mode, VALID_NEON_QREG_MODE (<MODE>mode), |
219 | + false); |
220 | + } |
221 | + [(set (attr "neon_type") |
222 | + (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0)) |
223 | + (const_string "neon_vshl_ddd") |
224 | + (const_string "neon_shift_3")))] |
225 | ) |
226 | |
227 | ; Used for implementing logical shift-right, which is a left-shift by a negative |
228 | @@ -1004,28 +1046,34 @@ |
229 | (define_expand "vashr<mode>3" |
230 | [(set (match_operand:VDQIW 0 "s_register_operand" "") |
231 | (ashiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "") |
232 | - (match_operand:VDQIW 2 "s_register_operand" "")))] |
233 | + (match_operand:VDQIW 2 "imm_rshift_or_reg_neon" "")))] |
234 | "TARGET_NEON" |
235 | { |
236 | rtx neg = gen_reg_rtx (<MODE>mode); |
237 | - |
238 | - emit_insn (gen_neg<mode>2 (neg, operands[2])); |
239 | - emit_insn (gen_ashl<mode>3_signed (operands[0], operands[1], neg)); |
240 | - |
241 | + if (REG_P (operands[2])) |
242 | + { |
243 | + emit_insn (gen_neg<mode>2 (neg, operands[2])); |
244 | + emit_insn (gen_ashl<mode>3_signed (operands[0], operands[1], neg)); |
245 | + } |
246 | + else |
247 | + emit_insn (gen_vashr<mode>3_imm (operands[0], operands[1], operands[2])); |
248 | DONE; |
249 | }) |
250 | |
251 | (define_expand "vlshr<mode>3" |
252 | [(set (match_operand:VDQIW 0 "s_register_operand" "") |
253 | (lshiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "") |
254 | - (match_operand:VDQIW 2 "s_register_operand" "")))] |
255 | + (match_operand:VDQIW 2 "imm_rshift_or_reg_neon" "")))] |
256 | "TARGET_NEON" |
257 | { |
258 | rtx neg = gen_reg_rtx (<MODE>mode); |
259 | - |
260 | - emit_insn (gen_neg<mode>2 (neg, operands[2])); |
261 | - emit_insn (gen_ashl<mode>3_unsigned (operands[0], operands[1], neg)); |
262 | - |
263 | + if (REG_P (operands[2])) |
264 | + { |
265 | + emit_insn (gen_neg<mode>2 (neg, operands[2])); |
266 | + emit_insn (gen_ashl<mode>3_unsigned (operands[0], operands[1], neg)); |
267 | + } |
268 | + else |
269 | + emit_insn (gen_vlshr<mode>3_imm (operands[0], operands[1], operands[2])); |
270 | DONE; |
271 | }) |
272 | |
273 | |
274 | === modified file 'gcc/config/arm/predicates.md' |
275 | --- gcc/config/arm/predicates.md 2011-06-22 15:50:23 +0000 |
276 | +++ gcc/config/arm/predicates.md 2011-07-04 14:15:56 +0000 |
277 | @@ -585,6 +585,26 @@ |
278 | return neon_immediate_valid_for_move (op, mode, NULL, NULL); |
279 | }) |
280 | |
281 | +(define_predicate "imm_for_neon_lshift_operand" |
282 | + (match_code "const_vector") |
283 | +{ |
284 | + return neon_immediate_valid_for_shift (op, mode, NULL, NULL, true); |
285 | +}) |
286 | + |
287 | +(define_predicate "imm_for_neon_rshift_operand" |
288 | + (match_code "const_vector") |
289 | +{ |
290 | + return neon_immediate_valid_for_shift (op, mode, NULL, NULL, false); |
291 | +}) |
292 | + |
293 | +(define_predicate "imm_lshift_or_reg_neon" |
294 | + (ior (match_operand 0 "s_register_operand") |
295 | + (match_operand 0 "imm_for_neon_lshift_operand"))) |
296 | + |
297 | +(define_predicate "imm_rshift_or_reg_neon" |
298 | + (ior (match_operand 0 "s_register_operand") |
299 | + (match_operand 0 "imm_for_neon_rshift_operand"))) |
300 | + |
301 | (define_predicate "imm_for_neon_logic_operand" |
302 | (match_code "const_vector") |
303 | { |
304 | |
305 | === modified file 'gcc/optabs.c' |
306 | --- gcc/optabs.c 2011-03-04 10:27:10 +0000 |
307 | +++ gcc/optabs.c 2011-07-04 14:15:56 +0000 |
308 | @@ -6171,6 +6171,9 @@ |
309 | init_optab (usashl_optab, US_ASHIFT); |
310 | init_optab (ashr_optab, ASHIFTRT); |
311 | init_optab (lshr_optab, LSHIFTRT); |
312 | + init_optabv (vashl_optab, ASHIFT); |
313 | + init_optabv (vashr_optab, ASHIFTRT); |
314 | + init_optabv (vlshr_optab, LSHIFTRT); |
315 | init_optab (rotl_optab, ROTATE); |
316 | init_optab (rotr_optab, ROTATERT); |
317 | init_optab (smin_optab, SMIN); |
318 | |
319 | === added file 'gcc/testsuite/gcc.target/arm/neon-vlshr-imm-1.c' |
320 | --- gcc/testsuite/gcc.target/arm/neon-vlshr-imm-1.c 1970-01-01 00:00:00 +0000 |
321 | +++ gcc/testsuite/gcc.target/arm/neon-vlshr-imm-1.c 2011-07-04 14:15:56 +0000 |
322 | @@ -0,0 +1,11 @@ |
323 | +/* { dg-do compile } */ |
324 | +/* { dg-require-effective-target arm_neon_ok } */ |
325 | +/* { dg-options "-O2 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize" } */ |
326 | +/* { dg-final { scan-assembler "vshr\.u32.*#3" } } */ |
327 | + |
328 | +/* Verify that VSHR immediate is used. */ |
329 | +void f1(int n, unsigned int x[], unsigned int y[]) { |
330 | + int i; |
331 | + for (i = 0; i < n; ++i) |
332 | + y[i] = x[i] >> 3; |
333 | +} |
334 | |
335 | === added file 'gcc/testsuite/gcc.target/arm/neon-vshl-imm-1.c' |
336 | --- gcc/testsuite/gcc.target/arm/neon-vshl-imm-1.c 1970-01-01 00:00:00 +0000 |
337 | +++ gcc/testsuite/gcc.target/arm/neon-vshl-imm-1.c 2011-07-04 14:15:56 +0000 |
338 | @@ -0,0 +1,11 @@ |
339 | +/* { dg-do compile } */ |
340 | +/* { dg-require-effective-target arm_neon_ok } */ |
341 | +/* { dg-options "-O2 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize" } */ |
342 | +/* { dg-final { scan-assembler "vshl\.i32.*#3" } } */ |
343 | + |
344 | +/* Verify that VSHR immediate is used. */ |
345 | +void f1(int n, int x[], int y[]) { |
346 | + int i; |
347 | + for (i = 0; i < n; ++i) |
348 | + y[i] = x[i] << 3; |
349 | +} |
350 | |
351 | === added file 'gcc/testsuite/gcc.target/arm/neon-vshr-imm-1.c' |
352 | --- gcc/testsuite/gcc.target/arm/neon-vshr-imm-1.c 1970-01-01 00:00:00 +0000 |
353 | +++ gcc/testsuite/gcc.target/arm/neon-vshr-imm-1.c 2011-07-04 14:15:56 +0000 |
354 | @@ -0,0 +1,11 @@ |
355 | +/* { dg-do compile } */ |
356 | +/* { dg-require-effective-target arm_neon_ok } */ |
357 | +/* { dg-options "-O2 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize" } */ |
358 | +/* { dg-final { scan-assembler "vshr\.s32.*#3" } } */ |
359 | + |
360 | +/* Verify that VSHR immediate is used. */ |
361 | +void f1(int n, int x[], int y[]) { |
362 | + int i; |
363 | + for (i = 0; i < n; ++i) |
364 | + y[i] = x[i] >> 3; |
365 | +} |
cbuild has taken a snapshot of this branch at r106768 and queued it for build.
The snapshot is available at: ex.seabright. co.nz/snapshots /gcc-linaro- 4.6+bzr106768~ ramana~ backport- neon-shiftimm- take2-4. 6.tar.xdelta3. xz
http://
and will be built on the following builders:
a9-builder armv5-builder i686 x86_64
You can track the build queue at: ex.seabright. co.nz/helpers/ scheduler
http://
cbuild-snapshot: gcc-linaro- 4.6+bzr106768~ ramana~ backport- neon-shiftimm- take2-4. 6
cbuild-ancestor: lp:gcc-linaro/4.6+bzr106767
cbuild-state: check