Commit 02fa47a9 by Carl Love Committed by Carl Love

p9-extract-1.c: Add test case.

gcc/testsuite/ChangeLog:

2018-06-28  Carl Love  <cel@us.ibm.com>

	* gcc.target/p9-extract-1.c: Add test case.
	* gcc.target/builtins-3-p9-runnable.c: Add test case to match
	name in ABI.

From-SVN: r262230
parent 81c8283f
2018-06-28 Carl Love <cel@us.ibm.com>
* gcc.target/p9-extract-1.c: Add test case.
* gcc.target/builtins-3-p9-runnable.c: Add test case to match
name in ABI.
2018-06-28 Uros Bizjak <ubizjak@gmail.com>
PR target/86348
......
......@@ -30,6 +30,48 @@ int main() {
printf (" 0B011110100000000, 0B1011010000000000};\n\n");
#endif
/* The ABI lists the builtins as:
vec_extract_fp32_from_shorth()
vec_extract_fp32_from_shortl()
GCC will also accept and map the builtin names
vec_extract_fp_from_shorth()
vec_extract_fp_from_shortl()
to the same builtins internally. For completeness,
test both builtin function names. */
vfexpt = (vector float){1.0, -2.0, 0.0, 8.5};
vfr = vec_extract_fp32_from_shorth(vusha);
#ifdef DEBUG
printf ("vec_extract_fp32_from_shorth\n");
for (i=0; i<4; i++)
printf("result[%d] = %f; expected[%d] = %f\n",
i, vfr[i], i, vfexpt[i]);
#endif
for (i=0; i<4; i++) {
if (vfr[i] != vfexpt[i])
abort();
}
vfexpt = (vector float){1.5, 0.5, 1.25, -0.25};
vfr = vec_extract_fp32_from_shortl(vusha);
#ifdef DEBUG
printf ("\nvec_extract_fp32_from_shortl\n");
for (i=0; i<4; i++)
printf("result[%d] = %f; expected[%d] = %f\n",
i, vfr[i], i, vfexpt[i]);
#endif
for (i=0; i<4; i++) {
if (vfr[i] != vfexpt[i])
abort();
}
vfexpt = (vector float){1.0, -2.0, 0.0, 8.5};
vfr = vec_extract_fp_from_shorth(vusha);
......
......@@ -122,6 +122,14 @@ extract_bool_int_0 (vector bool int a)
return b;
}
unsigned short int
extract_bool_short_int_0 (vector bool short int a)
{
int c = 0;
unsigned short int b = vec_extract (a, c);
return b;
}
/* { dg-final { scan-assembler "vextub\[lr\]x " } } */
/* { dg-final { scan-assembler "vextuh\[lr\]x " } } */
/* { dg-final { scan-assembler "vextuw\[lr\]x " } } */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment