gcc/testsuite/gcc.target/i386/avx256-unaligned-store-5.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-require-effective-target avx } */ |
| 3 | /* { dg-options "-O3 -dp -mavx -mavx256-split-unaligned-store" } */ |
| 4 | |
| 5 | #include "avx-check.h" |
| 6 | |
| 7 | #define N 8 |
| 8 | |
| 9 | float a[N] = { 24.43, 68.346, 43.35, 546.46, 46.79, 82.78, 82.7, 9.4 }; |
| 10 | float b[N+3]; |
| 11 | float c[N+3]; |
| 12 | |
| 13 | void |
| 14 | foo (void) |
| 15 | { |
| 16 | int i; |
| 17 | |
| 18 | for (i = 0; i < N; i++) |
| 19 | b[i+3] = a[i] * 2; |
| 20 | } |
| 21 | |
| 22 | __attribute__ ((noinline)) |
| 23 | float |
| 24 | bar (float x) |
| 25 | { |
| 26 | return x * 2; |
| 27 | } |
| 28 | |
| 29 | void |
| 30 | avx_test (void) |
| 31 | { |
| 32 | int i; |
| 33 | |
| 34 | foo (); |
| 35 | |
| 36 | for (i = 0; i < N; i++) |
| 37 | c[i+3] = bar (a[i]); |
| 38 | |
| 39 | for (i = 0; i < N; i++) |
| 40 | if (b[i+3] != c[i+3]) |
| 41 | abort (); |
| 42 | } |