2 /* { dg-require-effective-target p9vector_hw } */
3 /* { dg-options "-O2 -mdejagnu-cpu=power9" } */
12 vector
float vfa
, vfb
;
13 vector
unsigned short vresult
, vexpected
;
15 vfa
= (vector
float){0.4, 1.6, 20.0, 99.9 };
16 vfb
= (vector
float){10.0, -2.0, 70.0, 999.0 };
18 /* Expected results. */
20 vexpected
= (vector
unsigned short) { 0x4900, 0xc000, 0x5460, 0x63ce,
21 0x3666, 0x3e66, 0x4d00, 0x563e };
23 vexpected
= (vector
unsigned short) { 0x3666, 0x3e66, 0x4d00, 0x563e,
24 0x4900, 0xc000, 0x5460, 0x63ce };
28 vresult = vec_pack_to_short_fp32 (vfa, vfb);
29 This built-in converts a pair of vector floats into a single vector of
30 packed half-precision (F16) values. The result type is a vector of
32 The expected codegen for this builtin is
41 vresult
= vec_pack_to_short_fp32 (vfa
, vfb
);
44 for(i
= 0; i
< 4; i
++) { printf("i=[%d] %f \n",i
,vfa
[i
]); }
45 for(i
= 0; i
< 4; i
++) { printf("i=[%d] %f \n",i
+4,vfb
[i
]); }
46 for(i
= 0; i
< 8; i
++) { printf("i=[%d] %d \n",i
,vresult
[i
]); }
49 for(i
= 0; i
< 8; i
++) {
50 if (vresult
[i
] != vexpected
[i
]) {
51 printf("i=[%d] 0x%x != 0x%x \n",i
,vresult
[i
],vexpected
[i
]);