| 1 |
/* { dg-require-effective-target vect_float } */ |
| 2 |
|
| 3 |
#include "tree-vect.h" |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
|
| 7 |
#define NOINLINE __attribute__((noinline)) |
| 8 |
|
| 9 |
typedef float float32x4_t __attribute__ ((__vector_size__ (16))); |
| 10 |
typedef float float32x2_t __attribute__ ((__vector_size__ (8))); |
| 11 |
|
| 12 |
NOINLINE float |
| 13 |
foo32x4_be (float32x4_t x) |
| 14 |
{ |
| 15 |
return x[3]; |
| 16 |
} |
| 17 |
|
| 18 |
NOINLINE float |
| 19 |
foo32x4_le (float32x4_t x) |
| 20 |
{ |
| 21 |
return x[0]; |
| 22 |
} |
| 23 |
|
| 24 |
NOINLINE float |
| 25 |
bar (float a) |
| 26 |
{ |
| 27 |
return a; |
| 28 |
} |
| 29 |
|
| 30 |
NOINLINE float |
| 31 |
foo32x2_be (float32x2_t x) |
| 32 |
{ |
| 33 |
#ifdef __i386__ |
| 34 |
/* ix86 passes float32x2 vector arguments in mmx registers. We need to |
| 35 |
emit emms to empty MMS state and reenable x87 stack before float value |
| 36 |
can be loaded to and passed in x87 floating-point return register. */ |
| 37 |
__builtin_ia32_emms (); |
| 38 |
#endif |
| 39 |
return bar (x[1]); |
| 40 |
} |
| 41 |
|
| 42 |
NOINLINE float |
| 43 |
foo32x2_le (float32x2_t x) |
| 44 |
{ |
| 45 |
#ifdef __i386__ |
| 46 |
__builtin_ia32_emms (); |
| 47 |
#endif |
| 48 |
return bar (x[0]); |
| 49 |
} |
| 50 |
|
| 51 |
NOINLINE int |
| 52 |
test (void) |
| 53 |
{ |
| 54 |
float32x4_t a = { 0.0f, 1.0f, 2.0f, 3.0f }; |
| 55 |
float32x2_t b = { 0.0f, 1.0f }; |
| 56 |
|
| 57 |
if (foo32x2_be (b) != 1.0f) |
| 58 |
abort (); |
| 59 |
|
| 60 |
if (foo32x2_le (b) != 0.0f) |
| 61 |
abort (); |
| 62 |
|
| 63 |
if (foo32x4_be (a) != 3.0f) |
| 64 |
abort (); |
| 65 |
|
| 66 |
if (foo32x4_le (a) != 0.0f) |
| 67 |
abort (); |
| 68 |
|
| 69 |
return 0; |
| 70 |
} |
| 71 |
|
| 72 |
int |
| 73 |
main () |
| 74 |
{ |
| 75 |
check_vect (); |
| 76 |
return test (); |
| 77 |
} |