| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target sse3 } */ |
| 3 |
/* { dg-options "-O3 -msse3" } */ |
| 4 |
|
| 5 |
#ifndef CHECK_H |
| 6 |
#define CHECK_H "sse3-check.h" |
| 7 |
#endif |
| 8 |
|
| 9 |
#ifndef TEST |
| 10 |
#define TEST sse3_test |
| 11 |
#endif |
| 12 |
|
| 13 |
#include CHECK_H |
| 14 |
|
| 15 |
double a[2], b[2], c[2]; |
| 16 |
|
| 17 |
void __attribute__((noipa)) |
| 18 |
foo () |
| 19 |
{ |
| 20 |
/* When we want to use addsubpd we have to keep permuting both |
| 21 |
loads, if instead we blend the result of an add and a sub we |
| 22 |
can combine the blend with the permute. Both are similar in cost, |
| 23 |
verify we did not wrongly apply both. */ |
| 24 |
double tem0 = a[1] - b[1]; |
| 25 |
double tem1 = a[0] + b[0]; |
| 26 |
c[0] = tem0; |
| 27 |
c[1] = tem1; |
| 28 |
} |
| 29 |
|
| 30 |
static void |
| 31 |
TEST (void) |
| 32 |
{ |
| 33 |
a[0] = 1.; a[1] = 2.; |
| 34 |
b[0] = 2.; b[1] = 4.; |
| 35 |
foo (); |
| 36 |
if (c[0] != -2. || c[1] != 3.) |
| 37 |
__builtin_abort (); |
| 38 |
} |