public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/3][AArch64] DImode vector compares
@ 2015-04-17 15:37 Alan Lawrence
  2015-04-17 15:39 ` [PATCH 1/3] optabs.c: Make vector_compare_rtx cope with VOIDmode constants (e.g. const0_rtx) Alan Lawrence
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Alan Lawrence @ 2015-04-17 15:37 UTC (permalink / raw)
  To: gcc-patches

Hi,

Comparing 64x1 vector types (defined by hand or from arm_neon.h) using GCC 
vector extensions currently generates very poor assembly code, for example 
"uint64x1_t foo (uint64x1_t a, uint64x1_t b) { return a >= b; }" generates (at -O3):

fmov x0, d0 // 22 movdi_aarch64/12 [length = 4]
fmov x1, d1 // 23 movdi_aarch64/12 [length = 4]
cmp x0, x1 // 10 cmpdi/1 [length = 4]
csinv x0, xzr, xzr, cc // 17 cmovdi_insn/3 [length = 4]
fmov d0, x0 // 24 *movdi_aarch64/11 [length = 4]
ret // 27 simple_return [length = 4]

Meaning that arm_neon.h instead has to use rather awkward forms like "return 
(uint64x1_t) {__a[0] >= __b[0] ? -1ll : 0ll};" to produce the desired assembly

cmhs d0, d0, d1
ret

This series adds vcond(u?)didi patterns for AArch64, to generate appropriate RTL 
from direct comparisons of 64x1 vectors (which are of DImode). However, as 
things stand, adding a vconddidi pattern causes an ICE in vector_compare_rtx 
(maybe_legitimize_operands), because a DImode constant-zero (vector or 
otherwise) is expanded as const0_rtx, which has mode VOIDmode. I tried quite a 
bit to generate an RTL const_vector, or even just something with mode DImode, 
but without success, hence the first patch fixes vector_compare_rtx to use the 
mode from the tree if necessary. (DImode vectors are specifically allowed by 
stor-layout.c, but no other platform defines vconddidi.)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-05-05 11:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-17 15:37 [PATCH 0/3][AArch64] DImode vector compares Alan Lawrence
2015-04-17 15:39 ` [PATCH 1/3] optabs.c: Make vector_compare_rtx cope with VOIDmode constants (e.g. const0_rtx) Alan Lawrence
2015-05-01 15:12   ` Alan Lawrence
2015-05-01 16:32     ` Jeff Law
2015-04-17 15:40 ` [PATCH 2/3][AArch64] Add vcond(u?)didi pattern Alan Lawrence
2015-05-05 11:13   ` Marcus Shawcroft
2015-04-17 15:41 ` [PATCH 3/3][AArch64] Idiomatic 64x1 comparisons in arm_neon.h Alan Lawrence
2015-05-05 11:14   ` Marcus Shawcroft
2015-05-05  9:43 ` [PATCH 0/3][AArch64] DImode vector compares Alan Lawrence

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).