1 /* { dg-do compile { target { powerpc64le-*-* } } } */
2 /* { dg-options "-mdejagnu-cpu=power8 -O3" } */
4 /* Verify that swap optimization properly removes swaps for unaligned
5 vector stores. See PR65456. */
7 typedef unsigned char UChar
;
8 typedef unsigned short UShort
;
9 typedef unsigned int UWord
;
11 typedef unsigned long SizeT
;
12 typedef unsigned long Addr
;
14 void *memmove(void *dst
, const void *src
, SizeT len
)
16 const Addr WS
= sizeof(UWord
);/* 8 or 4 */
17 const Addr WM
= WS
- 1;/* 7 or 3 */
19 /* Copying backwards. */
24 if (((s
^ d
) & WM
) == 0) {
25 /* s and d have same UWord alignment. */
26 /* Pull up to a UWord boundary. */
27 while ((s
& WM
) != 0 && n
>= 1) {
28 *(UChar
*) d
= *(UChar
*) s
;
35 *(UWord
*) d
= *(UWord
*) s
;
43 if (((s
| d
) & 1) == 0) {
44 /* Both are 16-aligned; copy what we can thusly. */
46 *(UShort
*) d
= *(UShort
*) s
;
52 /* Copy leftovers, or everything if misaligned. */
54 *(UChar
*) d
= *(UChar
*) s
;
63 /* { dg-final { scan-assembler-not "xxpermdi" } } */
64 /* { dg-final { scan-assembler-not "xxswapd" } } */