| 1 |
/* PR tree-optimization/117057 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 4 |
/* { dg-additional-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ |
| 5 |
/* { dg-final { scan-tree-dump-times "return \[0-9\]*;" 4 "optimized" { target i?86-*-* x86_64-*-* aarch64*-*-* powerpc*-*-* } } } */ |
| 6 |
|
| 7 |
#include "strlenopt.h" |
| 8 |
|
| 9 |
typedef unsigned int V __attribute__((vector_size (2 * sizeof (int)))); |
| 10 |
typedef unsigned int W __attribute__((vector_size (4 * sizeof (int)))); |
| 11 |
|
| 12 |
size_t |
| 13 |
foo (void) |
| 14 |
{ |
| 15 |
char a[64]; |
| 16 |
*(long long *) a = 0x12003456789abcdeULL; |
| 17 |
return strlen (a); |
| 18 |
} |
| 19 |
|
| 20 |
size_t |
| 21 |
bar (void) |
| 22 |
{ |
| 23 |
char a[64]; |
| 24 |
*(V *) a = (V) { 0x12345678U, 0x9a00bcdeU }; |
| 25 |
return strlen (a); |
| 26 |
} |
| 27 |
|
| 28 |
size_t |
| 29 |
baz (unsigned int x) |
| 30 |
{ |
| 31 |
char a[64]; |
| 32 |
*(V *) a = (V) { 0x12005678U, x }; |
| 33 |
return strlen (a); |
| 34 |
} |
| 35 |
|
| 36 |
size_t |
| 37 |
qux (unsigned int x) |
| 38 |
{ |
| 39 |
char a[64]; |
| 40 |
*(W *)a = (W) { 0x12345678U, 0x9abcdef0U, 0x12005678U, x }; |
| 41 |
return strlen (a); |
| 42 |
} |