2 /* { dg-options "-mips3d forbid_cpu=octeon.*" } */
4 /* Test MIPS-3D builtin functions */
8 typedef float v2sf
__attribute__ ((vector_size(8)));
14 float f1
, f2
, f3
, f4
, f5
, f6
;
15 double d1
, d2
, d3
, d4
, d5
, d6
, d7
, d8
, d9
;
16 v2sf ps1
, ps2
, ps3
, ps4
, ps5
, ps6
;
18 union { long long ll
; int i
[2]; } endianness_test
;
19 endianness_test
.ll
= 1;
20 little_endian
= endianness_test
.i
[0];
25 c
= __builtin_mips_addr_ps (a
, b
);
31 if (!__builtin_mips_all_c_eq_ps(c
, d
))
37 c
= __builtin_mips_mulr_ps (a
, b
);
39 d
= (v2sf
) {3015, 408};
41 d
= (v2sf
) {408, 3015};
43 if (!__builtin_mips_all_c_eq_ps(c
, d
))
47 a
= (v2sf
) {12345.34, 67890.45};
48 b
= __builtin_mips_cvt_pw_ps (a
);
51 c
= __builtin_mips_cvt_ps_pw (b
);
52 d
= (v2sf
) {12345.0, 67890.0};
54 if (!__builtin_mips_all_c_eq_ps(c
, d
))
57 /* recip1.s recip2.s */
59 f2
= __builtin_mips_recip1_s (f1
);
60 f3
= __builtin_mips_recip2_s (f2
, f1
);
67 /* recip1.d recip2.d */
69 d2
= __builtin_mips_recip1_d (d1
);
70 d3
= __builtin_mips_recip2_d (d2
, d1
);
72 d5
= __builtin_mips_recip2_d (d4
, d1
);
79 /* recip1.ps recip2.ps */
80 ps1
= (v2sf
) {100, 200};
81 ps2
= __builtin_mips_recip1_ps (ps1
);
82 ps3
= __builtin_mips_recip2_ps (ps2
, ps1
);
83 ps4
= ps2
+ ps2
* ps3
;
84 ps5
= (v2sf
) {0.01, 0.005};
86 if (!__builtin_mips_all_c_eq_ps(ps4
, ps5
))
89 /* rsqrt1.s rsqrt2.s */
91 f2
= __builtin_mips_rsqrt1_s (f1
);
93 f4
= __builtin_mips_rsqrt2_s (f3
, f2
);
100 /* rsqrt1.d rsqrt2.d */
102 d2
= __builtin_mips_rsqrt1_d (d1
);
104 d4
= __builtin_mips_rsqrt2_d (d3
, d2
);
107 d7
= __builtin_mips_rsqrt2_d (d6
, d5
);
114 /* rsqrt1.ps rsqrt2.ps */
115 ps1
= (v2sf
) {400, 100};
116 ps2
= __builtin_mips_rsqrt1_ps (ps1
);
118 ps4
= __builtin_mips_rsqrt2_ps (ps3
, ps2
);
119 ps5
= ps2
+ ps2
* ps4
;
120 ps6
= (v2sf
) {0.05, 0.1};
122 if (!__builtin_mips_all_c_eq_ps(ps5
, ps6
))
125 printf ("Test Passes\n");