public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/55634] New: ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction
@ 2012-12-09 22:16 siarhei.siamashka at gmail dot com
2012-12-10 9:41 ` [Bug target/55634] " rguenth at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: siarhei.siamashka at gmail dot com @ 2012-12-09 22:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55634
Bug #: 55634
Summary: ARM: gcc vector extensions: storing vector to
unaligned memory location does not use VST1.8 NEON
instruction
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: siarhei.siamashka@gmail.com
The following test program tries to use GCC vector extensions to add two
vectors together and store the result to unaligned memory location in a
"portable" way with memcpy:
/***********************************************/
#include <string.h>
typedef unsigned int T __attribute__ ((vector_size (16)));
void foo (void *result, T *a, T *b)
{
T tmp = *a + *b;
memcpy (result, &tmp, sizeof(tmp));
}
/***********************************************/
Compiling with gcc 4.7.2:
$ arm-none-linux-gnueabi-gcc -O2 -mcpu=cortex-a8 -mfpu=neon -c test.c
$ objdump -d test.o
00000000 <foo>:
0: e52d4004 push {r4} ; (str r4, [sp, #-4]!)
4: ecd12b04 vldmia r1, {d18-d19}
8: e24dd014 sub sp, sp, #20
c: ecd20b04 vldmia r2, {d16-d17}
10: e28dc010 add ip, sp, #16
14: f26208e0 vadd.i32 q8, q9, q8
18: ed6c0b04 vstmdb ip!, {d16-d17}
1c: e1a0c00d mov ip, sp
20: e1a04000 mov r4, r0
24: e8bc000f ldm ip!, {r0, r1, r2, r3}
28: e5840000 str r0, [r4]
2c: e5841004 str r1, [r4, #4]
30: e5842008 str r2, [r4, #8]
34: e584300c str r3, [r4, #12]
38: e28dd014 add sp, sp, #20
3c: e8bd0010 pop {r4}
40: e12fff1e bx lr
The same test program results in the following code if compiled for x86-64:
0000000000000000 <foo>:
0: 66 0f 6f 06 movdqa (%rsi),%xmm0
4: 66 0f fe 02 paddd (%rdx),%xmm0
8: f3 0f 7f 07 movdqu %xmm0,(%rdi)
c: c3 retq
So x86-64 target is able to use MOVDQU instruction. Hence ARM target should be
able to use VST1.8 as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/55634] ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction
2012-12-09 22:16 [Bug target/55634] New: ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction siarhei.siamashka at gmail dot com
@ 2012-12-10 9:41 ` rguenth at gcc dot gnu.org
2013-08-05 20:35 ` ramana at gcc dot gnu.org
2024-04-03 4:03 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-10 9:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55634
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-10 09:40:59 UTC ---
Issue with the movmisalign instructions. They seem to take only a limited
set of modes, in particular not the mode that is requested.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/55634] ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction
2012-12-09 22:16 [Bug target/55634] New: ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction siarhei.siamashka at gmail dot com
2012-12-10 9:41 ` [Bug target/55634] " rguenth at gcc dot gnu.org
@ 2013-08-05 20:35 ` ramana at gcc dot gnu.org
2024-04-03 4:03 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: ramana at gcc dot gnu.org @ 2013-08-05 20:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55634
Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-08-05
CC| |ramana at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
On AArch64 with no strict alignment we end up generating with .002t.original
trunk
{
T tmp = *a + *b;
extern void * memcpy (void *, const void *, long unsigned int);
T tmp = *a + *b;
MEM[(char * {ref-all})result] = MEM[(char * {ref-all})&tmp];, result;
}
On A32 or indeed AArch64 with -mstrict-align we end up generating
{
T tmp = *a + *b;
extern void * memcpy (void *, const void *, long unsigned int);
T tmp = *a + *b;
memcpy (result, (const void *) &tmp, 16);
}
Where do you expect the memcpy to have been made redundant or a use of the
appropriate movmisalign insn - richi ?
Ramana
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/55634] ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction
2012-12-09 22:16 [Bug target/55634] New: ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction siarhei.siamashka at gmail dot com
2012-12-10 9:41 ` [Bug target/55634] " rguenth at gcc dot gnu.org
2013-08-05 20:35 ` ramana at gcc dot gnu.org
@ 2024-04-03 4:03 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-03 4:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55634
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Resolution|--- |FIXED
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=102125
Target Milestone|--- |12.0
Status|NEW |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 12.1.0 via the patches which fixed PR 102125 .
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-03 4:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-09 22:16 [Bug target/55634] New: ARM: gcc vector extensions: storing vector to unaligned memory location does not use VST1.8 NEON instruction siarhei.siamashka at gmail dot com
2012-12-10 9:41 ` [Bug target/55634] " rguenth at gcc dot gnu.org
2013-08-05 20:35 ` ramana at gcc dot gnu.org
2024-04-03 4:03 ` pinskia at gcc dot gnu.org
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).