1 /* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */
2 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
3 /* { dg-options "-mcpu=power9 -O2" } */
9 #include <altivec.h> // vector
15 vector
float vfr
, vfexpt
;
16 vector
unsigned short vusha
;
18 /* 1.0, -2.0, 0.0, 8.5, 1.5, 0.5, 1.25, -0.25 */
19 vusha
= (vector
unsigned short){0B011110000000000
, 0B1100000000000000
,
20 0B000000000000000
, 0B0100100001000000
,
21 0B011111000000000
, 0B0011100000000000
,
22 0B011110100000000
, 0B1011010000000000
};
25 printf ("Claim, source data is 8 16-bit floats:\n");
26 printf (" {1.0, -2.0, 0.0, 8.5, 1.5, 0.5, 1.25, -0.25}\n");
27 printf ("vusha = (vector unsigned short){0B011110000000000, 0B1100000000000000,\n");
28 printf (" 0B000000000000000, 0B0100100001000000,\n");
29 printf (" 0B011111000000000, 0B0011100000000000,\n");
30 printf (" 0B011110100000000, 0B1011010000000000};\n\n");
33 vfexpt
= (vector
float){1.0, -2.0, 0.0, 8.5};
34 vfr
= vec_extract_fp_from_shorth(vusha
);
37 printf ("vec_extract_fp_from_shorth\n");
39 printf("result[%d] = %f; expected[%d] = %f\n",
40 i
, vfr
[i
], i
, vfexpt
[i
]);
44 if (vfr
[i
] != vfexpt
[i
])
48 vfexpt
= (vector
float){1.5, 0.5, 1.25, -0.25};
49 vfr
= vec_extract_fp_from_shortl(vusha
);
52 printf ("\nvec_extract_fp_from_shortl\n");
54 printf("result[%d] = %f; expected[%d] = %f\n",
55 i
, vfr
[i
], i
, vfexpt
[i
]);
59 if (vfr
[i
] != vfexpt
[i
])