| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target xop } */ |
| 3 |
/* { dg-options "-O2 -mxop" } */ |
| 4 |
|
| 5 |
#include "xop-check.h" |
| 6 |
|
| 7 |
#include <x86intrin.h> |
| 8 |
|
| 9 |
void |
| 10 |
check_mm_vmfrcz_sd (__m128d __A, __m128d __B) |
| 11 |
{ |
| 12 |
union128d a, b, c; |
| 13 |
double d[2]; |
| 14 |
|
| 15 |
a.x = __A; |
| 16 |
b.x = __B; |
| 17 |
c.x = _mm_frcz_sd (__A, __B); |
| 18 |
d[0] = b.a[0] - (int)b.a[0] ; |
| 19 |
d[1] = a.a[1]; |
| 20 |
if (check_union128d (c, d)) |
| 21 |
abort (); |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
check_mm_vmfrcz_ss (__m128 __A, __m128 __B) |
| 26 |
{ |
| 27 |
union128 a, b, c; |
| 28 |
float f[4]; |
| 29 |
|
| 30 |
a.x = __A; |
| 31 |
b.x = __B; |
| 32 |
c.x = _mm_frcz_ss (__A, __B); |
| 33 |
f[0] = b.a[0] - (int)b.a[0] ; |
| 34 |
f[1] = a.a[1]; |
| 35 |
f[2] = a.a[2]; |
| 36 |
f[3] = a.a[3]; |
| 37 |
if (check_union128 (c, f)) |
| 38 |
abort (); |
| 39 |
} |
| 40 |
|
| 41 |
static void |
| 42 |
xop_test (void) |
| 43 |
{ |
| 44 |
union128 a, b; |
| 45 |
union128d c,d; |
| 46 |
int i; |
| 47 |
|
| 48 |
for (i = 0; i < 4; i++) |
| 49 |
{ |
| 50 |
a.a[i] = i + 3.5; |
| 51 |
b.a[i] = i + 7.9; |
| 52 |
} |
| 53 |
for (i = 0; i < 2; i++) |
| 54 |
{ |
| 55 |
c.a[i] = i + 3.5; |
| 56 |
d.a[i] = i + 7.987654321; |
| 57 |
} |
| 58 |
check_mm_vmfrcz_ss (a.x, b.x); |
| 59 |
check_mm_vmfrcz_sd (c.x, d.x); |
| 60 |
} |