1 /* { dg-do compile { target { powerpc64le-*-* } } } */
2 /* { dg-skip-if "do not override -mcpu" { powerpc64le-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
3 /* { dg-options "-mcpu=power8 -O3" } */
5 /* Verify that swap optimization properly removes swaps for unaligned
6 vector stores. See PR65456. */
8 typedef unsigned char UChar
;
9 typedef unsigned short UShort
;
10 typedef unsigned int UWord
;
12 typedef unsigned long SizeT
;
13 typedef unsigned long Addr
;
15 void *memmove(void *dst
, const void *src
, SizeT len
)
17 const Addr WS
= sizeof(UWord
);/* 8 or 4 */
18 const Addr WM
= WS
- 1;/* 7 or 3 */
20 /* Copying backwards. */
25 if (((s
^ d
) & WM
) == 0) {
26 /* s and d have same UWord alignment. */
27 /* Pull up to a UWord boundary. */
28 while ((s
& WM
) != 0 && n
>= 1) {
29 *(UChar
*) d
= *(UChar
*) s
;
36 *(UWord
*) d
= *(UWord
*) s
;
44 if (((s
| d
) & 1) == 0) {
45 /* Both are 16-aligned; copy what we can thusly. */
47 *(UShort
*) d
= *(UShort
*) s
;
53 /* Copy leftovers, or everything if misaligned. */
55 *(UChar
*) d
= *(UChar
*) s
;
64 /* { dg-final { scan-assembler-not "xxpermdi" } } */
65 /* { dg-final { scan-assembler-not "xxswapd" } } */