[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr79004.c
blobcaf1f6c1eefe4dd240d1376c9212523566bed431
1 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-require-effective-target powerpc_vsx_ok } */
3 /* { dg-options "-mdejagnu-cpu=power9 -mvsx -O2 -mfloat128" } */
5 #include <math.h>
7 #ifndef TYPE
8 #define TYPE __float128
9 #endif
11 TYPE from_double (double a) { return (TYPE)a; }
12 TYPE from_single (float a) { return (TYPE)a; }
14 TYPE from_double_load (double *a) { return (TYPE)*a; }
15 TYPE from_single_load (float *a) { return (TYPE)*a; }
17 double to_double (TYPE a) { return (double)a; }
18 float to_single (TYPE a) { return (float)a; }
20 void to_double_store (TYPE a, double *p) { *p = (double)a; }
21 void to_single_store (TYPE a, float *p) { *p = (float)a; }
23 TYPE from_sign_char (signed char a) { return (TYPE)a; }
24 TYPE from_sign_short (short a) { return (TYPE)a; }
25 TYPE from_sign_int (int a) { return (TYPE)a; }
26 TYPE from_sign_long (long a) { return (TYPE)a; }
28 TYPE from_sign_char_load (signed char *a) { return (TYPE)*a; }
29 TYPE from_sign_short_load (short *a) { return (TYPE)*a; }
30 TYPE from_sign_int_load (int *a) { return (TYPE)*a; }
31 TYPE from_sign_long_load (long *a) { return (TYPE)*a; }
33 TYPE from_sign_char_load_4 (signed char *a) { return (TYPE)a[4]; }
34 TYPE from_sign_short_load_4 (short *a) { return (TYPE)a[4]; }
35 TYPE from_sign_int_load_4 (int *a) { return (TYPE)a[4]; }
36 TYPE from_sign_long_load_4 (long *a) { return (TYPE)a[4]; }
38 TYPE from_sign_char_load_n (signed char *a, long n) { return (TYPE)a[n]; }
39 TYPE from_sign_short_load_n (short *a, long n) { return (TYPE)a[n]; }
40 TYPE from_sign_int_load_n (int *a, long n) { return (TYPE)a[n]; }
41 TYPE from_sign_long_load_n (long *a, long n) { return (TYPE)a[n]; }
43 signed char to_sign_char (TYPE a) { return (signed char)a; }
44 short to_sign_short (TYPE a) { return (short)a; }
45 int to_sign_int (TYPE a) { return (int)a; }
46 long to_sign_long (TYPE a) { return (long)a; }
48 void to_sign_char_store (TYPE a, signed char *p) { *p = (signed char)a; }
49 void to_sign_short_store (TYPE a, short *p) { *p = (short)a; }
50 void to_sign_int_store (TYPE a, int *p) { *p = (int)a; }
51 void to_sign_long_store (TYPE a, long *p) { *p = (long)a; }
53 void to_sign_char_store_4 (TYPE a, signed char *p) { p[4] = (signed char)a; }
54 void to_sign_short_store_4 (TYPE a, short *p) { p[4] = (short)a; }
55 void to_sign_int_store_4 (TYPE a, int *p) { p[4] = (int)a; }
56 void to_sign_long_store_4 (TYPE a, long *p) { p[4] = (long)a; }
58 void to_sign_char_store_n (TYPE a, signed char *p, long n) { p[n] = (signed char)a; }
59 void to_sign_short_store_n (TYPE a, short *p, long n) { p[n] = (short)a; }
60 void to_sign_int_store_n (TYPE a, int *p, long n) { p[n] = (int)a; }
61 void to_sign_long_store_n (TYPE a, long *p, long n) { p[n] = (long)a; }
63 TYPE from_uns_char (unsigned char a) { return (TYPE)a; }
64 TYPE from_uns_short (unsigned short a) { return (TYPE)a; }
65 TYPE from_uns_int (unsigned int a) { return (TYPE)a; }
66 TYPE from_uns_long (unsigned long a) { return (TYPE)a; }
68 TYPE from_uns_char_load (unsigned char *a) { return (TYPE)*a; }
69 TYPE from_uns_short_load (unsigned short *a) { return (TYPE)*a; }
70 TYPE from_uns_int_load (unsigned int *a) { return (TYPE)*a; }
71 TYPE from_uns_long_load (unsigned long *a) { return (TYPE)*a; }
73 TYPE from_uns_char_load_4 (unsigned char *a) { return (TYPE)a[4]; }
74 TYPE from_uns_short_load_4 (unsigned short *a) { return (TYPE)a[4]; }
75 TYPE from_uns_int_load_4 (unsigned int *a) { return (TYPE)a[4]; }
76 TYPE from_uns_long_load_4 (unsigned long *a) { return (TYPE)a[4]; }
78 TYPE from_uns_char_load_n (unsigned char *a, long n) { return (TYPE)a[n]; }
79 TYPE from_uns_short_load_n (unsigned short *a, long n) { return (TYPE)a[n]; }
80 TYPE from_uns_int_load_n (unsigned int *a, long n) { return (TYPE)a[n]; }
81 TYPE from_uns_long_load_n (unsigned long *a, long n) { return (TYPE)a[n]; }
83 unsigned char to_uns_char (TYPE a) { return (unsigned char)a; }
84 unsigned short to_uns_short (TYPE a) { return (unsigned short)a; }
85 unsigned int to_uns_int (TYPE a) { return (unsigned int)a; }
86 unsigned long to_uns_long (TYPE a) { return (unsigned long)a; }
88 void to_uns_char_store (TYPE a, unsigned char *p) { *p = (unsigned char)a; }
89 void to_uns_short_store (TYPE a, unsigned short *p) { *p = (unsigned short)a; }
90 void to_uns_int_store (TYPE a, unsigned int *p) { *p = (unsigned int)a; }
91 void to_uns_long_store (TYPE a, unsigned long *p) { *p = (unsigned long)a; }
93 void to_uns_char_store_4 (TYPE a, unsigned char *p) { p[4] = (unsigned char)a; }
94 void to_uns_short_store_4 (TYPE a, unsigned short *p) { p[4] = (unsigned short)a; }
95 void to_uns_int_store_4 (TYPE a, unsigned int *p) { p[4] = (unsigned int)a; }
96 void to_uns_long_store_4 (TYPE a, unsigned long *p) { p[4] = (unsigned long)a; }
98 void to_uns_char_store_n (TYPE a, unsigned char *p, long n) { p[n] = (unsigned char)a; }
99 void to_uns_short_store_n (TYPE a, unsigned short *p, long n) { p[n] = (unsigned short)a; }
100 void to_uns_int_store_n (TYPE a, unsigned int *p, long n) { p[n] = (unsigned int)a; }
101 void to_uns_long_store_n (TYPE a, unsigned long *p, long n) { p[n] = (unsigned long)a; }
103 /* { dg-final { scan-assembler-not {\mbl __} } } */
104 /* { dg-final { scan-assembler {\mxscvdpqp\M} } } */
105 /* { dg-final { scan-assembler {\mxscvqpdp\M} } } */
106 /* { dg-final { scan-assembler {\mxscvqpdpo\M} } } */
107 /* { dg-final { scan-assembler {\mxscvqpsdz\M} } } */
108 /* { dg-final { scan-assembler {\mxscvqpswz\M} } } */
109 /* { dg-final { scan-assembler {\mxscvsdqp\M} } } */
110 /* { dg-final { scan-assembler {\mxscvudqp\M} } } */
111 /* { dg-final { scan-assembler {\mlxsd\M} } } */
112 /* { dg-final { scan-assembler {\mlxsiwax\M} } } */
113 /* { dg-final { scan-assembler {\mlxsiwzx\M} } } */
114 /* { dg-final { scan-assembler {\mlxssp\M} } } */
115 /* { dg-final { scan-assembler {\mstxsd\M} } } */
116 /* { dg-final { scan-assembler {\mstxsiwx\M} } } */
117 /* { dg-final { scan-assembler {\mstxssp\M} } } */