diff options
author | kelvin <kelvin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-23 21:56:58 +0000 |
---|---|---|
committer | kelvin <kelvin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-23 21:56:58 +0000 |
commit | b8588f71a764829e7cc3bd50d840a9cbb0725e6a (patch) | |
tree | beb69c9b1d00c84729c22cc2585d61d1cab4d840 | |
parent | 76b0d9e5ef36b57eaaa59dc6fb3fae89f1e15461 (diff) | |
download | gcc-b8588f71a764829e7cc3bd50d840a9cbb0725e6a.tar.gz |
gcc/testsuite/ChangeLog:
2017-01-23 Kelvin Nilsen <kelvin@gcc.gnu.org>
* gcc.target/powerpc/bfp/scalar-insert-exp-3.c: New test.
* gcc.target/powerpc/bfp/scalar-insert-exp-4.c: New test.
* gcc.target/powerpc/bfp/scalar-insert-exp-5.c: New test.
* gcc.target/powerpc/bfp/scalar-test-data-class-0.c: Adjust return
type of test function to reflect change in built-in function's
return type.
* gcc.target/powerpc/bfp/scalar-test-data-class-1.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-data-class-2.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-data-class-3.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-data-class-4.c: Adjust return
type and second argument type to reflect change in built-in
function's type signature.
* gcc.target/powerpc/bfp/scalar-test-data-class-5.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-data-class-6.c: Adjust return
type of test function to reflect change in built-in function's
return type.
* gcc.target/powerpc/bfp/scalar-test-data-class-7.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-neg-0.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-neg-1.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-neg-2.c: Likewise.
* gcc.target/powerpc/bfp/scalar-test-neg-3.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-exp-0.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-exp-1.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-exp-2.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-exp-3.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-sig-0.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-sig-1.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-sig-2.c: Likewise.
* gcc.target/powerpc/bfp/vec-extract-sig-3.c: Likewise.
* gcc.target/powerpc/bfp/vec-insert-exp-4.c: New test.
* gcc.target/powerpc/bfp/vec-insert-exp-5.c: New test.
* gcc.target/powerpc/bfp/vec-insert-exp-6.c: New test.
* gcc.target/powerpc/bfp/vec-insert-exp-7.c: New test.
* gcc.target/powerpc/bfp/vec-test-data-class-0.c: Adjust return
type of test function to reflect change in built-in function's
return type.
* gcc.target/powerpc/bfp/vec-test-data-class-1.c: Likewise.
* gcc.target/powerpc/bfp/vec-test-data-class-2.c: Likewise.
* gcc.target/powerpc/bfp/vec-test-data-class-3.c: Likewise.
* gcc.target/powerpc/bfp/vec-test-data-class-4.c: Likewise.
* gcc.target/powerpc/bfp/vec-test-data-class-5.c: Likewise.
* gcc.target/powerpc/bfp/vec-test-data-class-6.c: Adjust types of
test function's result and second argument to reflect change in
built-in function's type signature.
* gcc.target/powerpc/bfp/vec-test-data-class-7.c: Likewise.
gcc/ChangeLog:
2017-01-23 Kelvin Nilsen <kelvin@gcc.gnu.org>
* config/rs6000/rs6000-builtin.def (VSIEDPF): Add scalar insert
exponent support with double type for first argument.
* config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Changed
type returned by __builtin_vec_extract_sig,
__builtin_vec_extract_sig_sp, and __builtin_vec_extract_sig_dp
functions from "vector int" to "vector unsigned int" or from
"vector long long int" to "vector unsigned long long int".
Changed type returned by __builtin_vec_extract_exp,
__builtin_vec_extract_exp_sp, and __builtin_vec_extract_exp_dp
functions from "vector int" to "vector unsigned int" or from
"vector long long int" to "vector unsigned long long int".
Changed return type of __builtin_vec_test_data_class,
__builtin_vec_test_data_class_sp, and
__builtin_vec_test_data_class_dp from "vector int" to
"vector bool int" or from "vector long long int" to "vector bool
long long int" and changed second argument type from "unsigned
int" to "int". Added new overloaded function forms "vector float
__builtin_vec_insert_exp (vector float, vector unsigned int)" and
"vector float __builtin_vec_insert_exp_sp (vector float, vector
unsigned int)" and "vector double __builtin_vec_insert_exp (vector
double, vector unsigned long long int)" and "vector double
__builtin_vec_insert_exp_dp (vector double, vector unsigned long
long int)". Changed return type of
__builtin_scalar_test_data_class and
__builtin_scalar_test_data_class_sp and
__builtin_scalar_test_data_class_dp from "unsigned int" to "bool
int" and changed second argument from "unsigned int" to "int".
Changed type returned by __builtin_scalar_test_neg,
__builtin_scalar_test_neg_sp, and __builtin_scalar_test_neg_dp
from "int" to "bool int". Added new overloaded function form
"double __builtin_scalar_insert_exp (double, unsigned long long int)".
* config/rs6000/vsx.md (xsiexpdpf): New insn for scalar insert
exponent double-precision with floating point first argument.
* doc/extend.texi (PowerPC AltiVec Built-in Functions): Adjust
documentation of scalar_test_data_class, scalar_test_neg,
scalar_extract_sig, scalar_extract_exp, scalar_insert_exp,
vector_extract_exp, vec_extract_sig, vec_insert_exp, and
vec_test_data_class built-in functions to reflect refinements in
their type signatures.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244834 138bc75d-0d04-0410-961f-82ee72b054a4
41 files changed, 378 insertions, 88 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29d55742cc1..468e012b14e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,45 @@ +2017-01-23 Kelvin Nilsen <kelvin@gcc.gnu.org> + + * config/rs6000/rs6000-builtin.def (VSIEDPF): Add scalar insert + exponent support with double type for first argument. + * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Changed + type returned by __builtin_vec_extract_sig, + __builtin_vec_extract_sig_sp, and __builtin_vec_extract_sig_dp + functions from "vector int" to "vector unsigned int" or from + "vector long long int" to "vector unsigned long long int". + Changed type returned by __builtin_vec_extract_exp, + __builtin_vec_extract_exp_sp, and __builtin_vec_extract_exp_dp + functions from "vector int" to "vector unsigned int" or from + "vector long long int" to "vector unsigned long long int". + Changed return type of __builtin_vec_test_data_class, + __builtin_vec_test_data_class_sp, and + __builtin_vec_test_data_class_dp from "vector int" to + "vector bool int" or from "vector long long int" to "vector bool + long long int" and changed second argument type from "unsigned + int" to "int". Added new overloaded function forms "vector float + __builtin_vec_insert_exp (vector float, vector unsigned int)" and + "vector float __builtin_vec_insert_exp_sp (vector float, vector + unsigned int)" and "vector double __builtin_vec_insert_exp (vector + double, vector unsigned long long int)" and "vector double + __builtin_vec_insert_exp_dp (vector double, vector unsigned long + long int)". Changed return type of + __builtin_scalar_test_data_class and + __builtin_scalar_test_data_class_sp and + __builtin_scalar_test_data_class_dp from "unsigned int" to "bool + int" and changed second argument from "unsigned int" to "int". + Changed type returned by __builtin_scalar_test_neg, + __builtin_scalar_test_neg_sp, and __builtin_scalar_test_neg_dp + from "int" to "bool int". Added new overloaded function form + "double __builtin_scalar_insert_exp (double, unsigned long long int)". + * config/rs6000/vsx.md (xsiexpdpf): New insn for scalar insert + exponent double-precision with floating point first argument. + * doc/extend.texi (PowerPC AltiVec Built-in Functions): Adjust + documentation of scalar_test_data_class, scalar_test_neg, + scalar_extract_sig, scalar_extract_exp, scalar_insert_exp, + vector_extract_exp, vec_extract_sig, vec_insert_exp, and + vec_test_data_class built-in functions to reflect refinements in + their type signatures. + 2017-01-23 Andreas Tobler <andreast@gcc.gnu.org> * config/aarch64/aarch64.c (aarch64_elf_asm_constructor): Increase diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index d17aeae754c..61aed2ba98a 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -1964,6 +1964,7 @@ BU_P9V_VSX_1 (XXBRH_V8HI, "xxbrh_v8hi", CONST, p9_xxbrh_v8hi) /* 2 argument vsx scalar functions added in ISA 3.0 (power9). */ BU_P9V_64BIT_VSX_2 (VSIEDP, "scalar_insert_exp", CONST, xsiexpdp) +BU_P9V_64BIT_VSX_2 (VSIEDPF, "scalar_insert_exp_dp", CONST, xsiexpdpf) BU_P9V_VSX_2 (VSCEDPGT, "scalar_cmp_exp_dp_gt", CONST, xscmpexpdp_gt) BU_P9V_VSX_2 (VSCEDPLT, "scalar_cmp_exp_dp_lt", CONST, xscmpexpdp_lt) diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 8b87a0a441a..fd6da7e77e0 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -4360,64 +4360,74 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { RS6000_BTI_unsigned_V4SI, 0 }, { P9V_BUILTIN_VEC_VES, P9V_BUILTIN_VESSP, - RS6000_BTI_V4SI, RS6000_BTI_V4SF, 0, 0 }, + RS6000_BTI_unsigned_V4SI, RS6000_BTI_V4SF, 0, 0 }, { P9V_BUILTIN_VEC_VES, P9V_BUILTIN_VESDP, - RS6000_BTI_V2DI, RS6000_BTI_V2DF, 0, 0 }, + RS6000_BTI_unsigned_V2DI, RS6000_BTI_V2DF, 0, 0 }, { P9V_BUILTIN_VEC_VESSP, P9V_BUILTIN_VESSP, - RS6000_BTI_V4SI, RS6000_BTI_V4SF, 0, 0 }, + RS6000_BTI_unsigned_V4SI, RS6000_BTI_V4SF, 0, 0 }, { P9V_BUILTIN_VEC_VESDP, P9V_BUILTIN_VESDP, - RS6000_BTI_V2DI, RS6000_BTI_V2DF, 0, 0 }, + RS6000_BTI_unsigned_V2DI, RS6000_BTI_V2DF, 0, 0 }, { P9V_BUILTIN_VEC_VEE, P9V_BUILTIN_VEESP, - RS6000_BTI_V4SI, RS6000_BTI_V4SF, 0, 0 }, + RS6000_BTI_unsigned_V4SI, RS6000_BTI_V4SF, 0, 0 }, { P9V_BUILTIN_VEC_VEE, P9V_BUILTIN_VEEDP, - RS6000_BTI_V2DI, RS6000_BTI_V2DF, 0, 0 }, + RS6000_BTI_unsigned_V2DI, RS6000_BTI_V2DF, 0, 0 }, { P9V_BUILTIN_VEC_VEESP, P9V_BUILTIN_VEESP, - RS6000_BTI_V4SI, RS6000_BTI_V4SF, 0, 0 }, + RS6000_BTI_unsigned_V4SI, RS6000_BTI_V4SF, 0, 0 }, { P9V_BUILTIN_VEC_VEEDP, P9V_BUILTIN_VEEDP, - RS6000_BTI_V2DI, RS6000_BTI_V2DF, 0, 0 }, + RS6000_BTI_unsigned_V2DI, RS6000_BTI_V2DF, 0, 0 }, { P9V_BUILTIN_VEC_VTDC, P9V_BUILTIN_VTDCSP, - RS6000_BTI_V4SI, RS6000_BTI_V4SF, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VTDC, P9V_BUILTIN_VTDCDP, - RS6000_BTI_V2DI, RS6000_BTI_V2DF, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VTDCSP, P9V_BUILTIN_VTDCSP, - RS6000_BTI_V4SI, RS6000_BTI_V4SF, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VTDCDP, P9V_BUILTIN_VTDCDP, - RS6000_BTI_V2DI, RS6000_BTI_V2DF, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VIE, P9V_BUILTIN_VIESP, RS6000_BTI_V4SF, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, + { P9V_BUILTIN_VEC_VIE, P9V_BUILTIN_VIESP, + RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_unsigned_V4SI, 0 }, + { P9V_BUILTIN_VEC_VIE, P9V_BUILTIN_VIEDP, RS6000_BTI_V2DF, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, + { P9V_BUILTIN_VEC_VIE, P9V_BUILTIN_VIEDP, + RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_unsigned_V2DI, 0 }, { P9V_BUILTIN_VEC_VIESP, P9V_BUILTIN_VIESP, RS6000_BTI_V4SF, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, + { P9V_BUILTIN_VEC_VIESP, P9V_BUILTIN_VIESP, + RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_unsigned_V4SI, 0 }, + { P9V_BUILTIN_VEC_VIEDP, P9V_BUILTIN_VIEDP, RS6000_BTI_V2DF, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, + { P9V_BUILTIN_VEC_VIEDP, P9V_BUILTIN_VIEDP, + RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_unsigned_V2DI, 0 }, { P9V_BUILTIN_VEC_VSTDC, P9V_BUILTIN_VSTDCSP, - RS6000_BTI_UINTSI, RS6000_BTI_float, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_float, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VSTDC, P9V_BUILTIN_VSTDCDP, - RS6000_BTI_UINTSI, RS6000_BTI_double, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_double, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VSTDCSP, P9V_BUILTIN_VSTDCSP, - RS6000_BTI_UINTSI, RS6000_BTI_float, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_float, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VSTDCDP, P9V_BUILTIN_VSTDCDP, - RS6000_BTI_UINTSI, RS6000_BTI_double, RS6000_BTI_UINTSI, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_double, RS6000_BTI_INTSI, 0 }, { P9V_BUILTIN_VEC_VSTDCN, P9V_BUILTIN_VSTDCNSP, - RS6000_BTI_INTSI, RS6000_BTI_float, 0, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_float, 0, 0 }, { P9V_BUILTIN_VEC_VSTDCN, P9V_BUILTIN_VSTDCNDP, - RS6000_BTI_INTSI, RS6000_BTI_double, 0, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_double, 0, 0 }, { P9V_BUILTIN_VEC_VSTDCNSP, P9V_BUILTIN_VSTDCNSP, - RS6000_BTI_INTSI, RS6000_BTI_float, 0, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_float, 0, 0 }, { P9V_BUILTIN_VEC_VSTDCNDP, P9V_BUILTIN_VSTDCNDP, - RS6000_BTI_INTSI, RS6000_BTI_double, 0, 0 }, + RS6000_BTI_bool_int, RS6000_BTI_double, 0, 0 }, { P9V_BUILTIN_VEC_VSEEDP, P9V_BUILTIN_VSEEDP, RS6000_BTI_UINTSI, RS6000_BTI_double, 0, 0 }, @@ -4427,6 +4437,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { { P9V_BUILTIN_VEC_VSIEDP, P9V_BUILTIN_VSIEDP, RS6000_BTI_double, RS6000_BTI_UINTDI, RS6000_BTI_UINTDI, 0 }, + { P9V_BUILTIN_VEC_VSIEDP, P9V_BUILTIN_VSIEDPF, + RS6000_BTI_double, RS6000_BTI_double, RS6000_BTI_UINTDI, 0 }, { P9V_BUILTIN_VEC_VSCEDPGT, P9V_BUILTIN_VSCEDPGT, RS6000_BTI_INTSI, RS6000_BTI_double, RS6000_BTI_double, 0 }, diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 52686881700..28bbeb2a7d9 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -3426,6 +3426,16 @@ "xsiexpdp %x0,%1,%2" [(set_attr "type" "fpsimple")]) +;; VSX Scalar Insert Exponent Double-Precision Floating Point Argument +(define_insn "xsiexpdpf" + [(set (match_operand:DF 0 "vsx_register_operand" "=wa") + (unspec:DF [(match_operand:DF 1 "register_operand" "r") + (match_operand:DI 2 "register_operand" "r")] + UNSPEC_VSX_SIEXPDP))] + "TARGET_P9_VECTOR && TARGET_64BIT" + "xsiexpdp %x0,%1,%2" + [(set_attr "type" "fpsimple")]) + ;; VSX Scalar Compare Exponents Double-Precision (define_expand "xscmpexpdp_<code>" [(set (match_dup 3) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index f575806ed99..5cb4748e032 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -15133,17 +15133,19 @@ unsigned long long int scalar_extract_sig (double source); double scalar_insert_exp (unsigned long long int significand, unsigned long long int exponent); +double +scalar_insert_exp (double significand, unsigned long long int exponent); int scalar_cmp_exp_gt (double arg1, double arg2); int scalar_cmp_exp_lt (double arg1, double arg2); int scalar_cmp_exp_eq (double arg1, double arg2); int scalar_cmp_exp_unordered (double arg1, double arg2); -int scalar_test_data_class (float source, unsigned int condition); -int scalar_test_data_class (double source, unsigned int condition); +bool scalar_test_data_class (float source, const int condition); +bool scalar_test_data_class (double source, const int condition); -int scalar_test_neg (float source); -int scalar_test_neg (double source); +bool scalar_test_neg (float source); +bool scalar_test_neg (double source); int __builtin_byte_in_set (unsigned char u, unsigned long long set); int __builtin_byte_in_range (unsigned char u, unsigned int range); @@ -15178,19 +15180,30 @@ random number. The @code{__builtin_darn_raw} function provides a 64-bit raw random number. The @code{__builtin_darn_32} function provides a 32-bit random number. -The @code{scalar_extract_sig} and @code{scalar_insert_exp} +The @code{scalar_extract_exp} and @code{scalar_extract_sig} functions require a 64-bit environment supporting ISA 3.0 or later. -The @code{scalar_extract_exp} and @code{vec_extract_sig} built-in -functions return the significand and exponent respectively of their -@code{source} arguments. The -@code{scalar_insert_exp} built-in function returns a double-precision +The @code{scalar_extract_exp} and @code{scalar_extract_sig} built-in +functions return the significand and the biased exponent value +respectively of their @code{source} arguments. +Within the result returned by @code{scalar_extract_sig}, +the @code{0x10000000000000} bit is set if the +function's @code{source} argument is in normalized form. +Otherwise, this bit is set to 0. +Note that the sign of the significand is not represented in the result +returned from the @code{scalar_extract_sig} function. Use the +@code{scalar_test_neg} function to test the sign of its @code{double} +argument. + +The @code{scalar_insert_exp} +function requires a 64-bit environment supporting ISA 3.0 or later. +The @code{scalar_insert_exp} built-in function returns a double-precision floating point value that is constructed by assembling the values of its @code{significand} and @code{exponent} arguments. The sign of the result is copied from the most significant bit of the @code{significand} argument. The significand and exponent components of the result are composed of the least significant 11 bits of the -@code{significand} argument and the least significant 52 bits of the -@code{exponent} argument. +@code{exponent} argument and the least significant 52 bits of the +@code{significand} argument. The @code{scalar_cmp_exp_gt}, @code{scalar_cmp_exp_lt}, @code{scalar_cmp_exp_eq}, and @code{scalar_cmp_exp_unordered} built-in @@ -15199,11 +15212,11 @@ than, equal to, or not comparable to @code{arg2} respectively. The arguments are not comparable if one or the other equals NaN (not a number). -The @code{scalar_test_data_class} built-in functions return a non-zero -value if any of the condition tests enabled by the value of the -@code{condition} variable are true. The -@code{condition} argument must be an unsigned integer with value not -exceeding 127. The +The @code{scalar_test_data_class} built-in function returns 1 +if any of the condition tests enabled by the value of the +@code{condition} variable are true, and 0 otherwise. The +@code{condition} argument must be a compile-time constant integer with +value not exceeding 127. The @code{condition} argument is encoded as a bitmask with each bit enabling the testing of a different condition, as characterized by the following: @@ -15217,10 +15230,8 @@ following: 0x01 Test for -Denormal @end smallexample -If all of the enabled test conditions are false, the return value is 0. - -The @code{scalar_test_neg} built-in functions return a non-zero value -if their @code{source} argument holds a negative value. +The @code{scalar_test_neg} built-in function returns 1 if its +@code{source} argument holds a negative value, 0 otherwise. The @code{__builtin_byte_in_set} function requires a 64-bit environment supporting ISA 3.0 or later. This function returns @@ -18140,39 +18151,66 @@ elements of the vector result. The following built-in functions are available for the PowerPC family of processors, starting with ISA 3.0 or later (@option{-mcpu=power9}): @smallexample -__vector int +__vector unsigned int vec_extract_exp (__vector float source); -__vector long long int +__vector unsigned long long int vec_extract_exp (__vector double source); -__vector int +__vector unsigned int vec_extract_sig (__vector float source); -__vector long long int +__vector unsigned long long int vec_extract_sig (__vector double source); __vector float vec_insert_exp (__vector unsigned int significands, __vector unsigned int exponents); +__vector float +vec_insert_exp (__vector unsigned float significands, + __vector unsigned int exponents); __vector double vec_insert_exp (__vector unsigned long long int significands, __vector unsigned long long int exponents); +__vector double +vec_insert_exp (__vector unsigned double significands, + __vector unsigned long long int exponents); -__vector int vec_test_data_class (__vector float source, - unsigned int condition); -__vector long long int vec_test_data_class (__vector double source, - unsigned int condition); +__vector bool int vec_test_data_class (__vector float source, + const int condition); +__vector bool long long int vec_test_data_class (__vector double source, + const int condition); @end smallexample The @code{vec_extract_sig} and @code{vec_extract_exp} built-in -functions return vectors representing the significands and exponents -of their @code{source} arguments respectively. The -@code{vec_insert_exp} built-in functions return a vector of single- or -double-precision floating +functions return vectors representing the significands and biased +exponent values of their @code{source} arguments respectively. +Within the result vector returned by @code{vec_extract_sig}, the +@code{0x800000} bit of each vector element returned when the +function's @code{source} argument is of type @code{float} is set to 1 +if the corresponding floating point value is in normalized form. +Otherwise, this bit is set to 0. When the @code{source} argument is +of type @code{double}, the @code{0x10000000000000} bit within each of +the result vector's elements is set according to the same rules. +Note that the sign of the significand is not represented in the result +returned from the @code{vec_extract_sig} function. To extract the +sign bits, use the +@code{vec_cpsgn} function, which returns a new vector within which all +of the sign bits of its second argument vector are overwritten with the +sign bits copied from the coresponding elements of its first argument +vector, and all other (non-sign) bits of the second argument vector +are copied unchanged into the result vector. + +The @code{vec_insert_exp} built-in functions return a vector of +single- or double-precision floating point values constructed by assembling the values of their @code{significands} and @code{exponents} arguments into the -corresponding elements of the returned vector. The sign of each +corresponding elements of the returned vector. +The sign of each element of the result is copied from the most significant bit of the -corresponding entry within the @code{significands} argument. The +corresponding entry within the @code{significands} argument. +Note that the relevant +bits of the @code{significands} argument are the same, for both integer +and floating point types. +The significand and exponent components of each element of the result are composed of the least significant bits of the corresponding @code{significands} element and the least significant bits of the @@ -18181,8 +18219,8 @@ corresponding @code{exponents} element. The @code{vec_test_data_class} built-in function returns a vector representing the results of testing the @code{source} vector for the condition selected by the @code{condition} argument. The -@code{condition} argument must be an unsigned integer with value not -exceeding 127. The +@code{condition} argument must be a compile-time constant integer with +value not exceeding 127. The @code{condition} argument is encoded as a bitmask with each bit enabling the testing of a different condition, as characterized by the following: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee1f19ce993..004bff932bb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,51 @@ +2017-01-23 Kelvin Nilsen <kelvin@gcc.gnu.org> + + * gcc.target/powerpc/bfp/scalar-insert-exp-3.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-4.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-5.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-0.c: Adjust return + type of test function to reflect change in built-in function's + return type. + * gcc.target/powerpc/bfp/scalar-test-data-class-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-3.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-4.c: Adjust return + type and second argument type to reflect change in built-in + function's type signature. + * gcc.target/powerpc/bfp/scalar-test-data-class-5.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-6.c: Adjust return + type of test function to reflect change in built-in function's + return type. + * gcc.target/powerpc/bfp/scalar-test-data-class-7.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-0.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-1.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-2.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-0.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-1.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-2.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-4.c: New test. + * gcc.target/powerpc/bfp/vec-insert-exp-5.c: New test. + * gcc.target/powerpc/bfp/vec-insert-exp-6.c: New test. + * gcc.target/powerpc/bfp/vec-insert-exp-7.c: New test. + * gcc.target/powerpc/bfp/vec-test-data-class-0.c: Adjust return + type of test function to reflect change in built-in function's + return type. + * gcc.target/powerpc/bfp/vec-test-data-class-1.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-2.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-4.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-5.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-6.c: Adjust types of + test function's result and second argument to reflect change in + built-in function's type signature. + * gcc.target/powerpc/bfp/vec-test-data-class-7.c: Likewise. + 2017-01-23 Nathan Sidwell <nathan@acm.org> PR C++/71710 diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-3.c new file mode 100644 index 00000000000..4dbd7ca2efa --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-3.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +double +insert_exponent (double *significand_p, + unsigned long long int *exponent_p) +{ + double significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); +} + +/* { dg-final { scan-assembler "xsiexpdp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-4.c new file mode 100644 index 00000000000..8b72cec88d9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +double +insert_exponent (double *significand_p, + unsigned long long int *exponent_p) +{ + double significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return __builtin_vec_scalar_insert_exp (significand, exponent); /* { dg-error "Builtin function __builtin_vsx_scalar_insert_exp_dp requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-5.c new file mode 100644 index 00000000000..e831f20e589 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-5.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test only runs on 32-bit configurations, where a compiler error + should be issued because this builtin is not available on + 32-bit configurations. */ + +#include <altivec.h> + +double +insert_exponent (double *significand_p, + unsigned long long int *exponent_p) +{ + double significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); /* { dg-error "Builtin function __builtin_vec_scalar_insert_exp not supported in this compiler configuration" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-0.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-0.c index c7fe4b38076..eba19c3cc0f 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-0.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-0.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_data_class (double *p) { double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-1.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-1.c index 0b074c2694b..98c13ff5f9c 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-1.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_data_class (float *p) { float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-2.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-2.c index 6e2955e18e4..05ef48dddfc 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-2.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_data_class (double *p) { double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-3.c index ef8ec708abc..b13f470ade5 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-3.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-3.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_data_class (float *p) { float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-4.c index e5c7770ea34..054fd7d3f6b 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-4.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-4.c @@ -4,9 +4,10 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int -test_data_class (double *p, unsigned int condition_flag) +bool +test_data_class (double *p, const int condition_flag) { double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-5.c index 1051ad13de5..d039c900544 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-5.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-5.c @@ -4,9 +4,10 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int -test_data_class (float *p, unsigned int condition_flag) +bool +test_data_class (float *p, const int condition_flag) { float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-6.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-6.c index 56489aac34c..10405a386c0 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-6.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-6.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power8" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_data_class (double *p) { double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-7.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-7.c index eae63459d45..a7482eff559 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-7.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-7.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power8" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_data_class (float *p) { float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-0.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-0.c index 94f4c285a14..c89cee71ba1 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-0.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-0.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_neg (double *p) { double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-1.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-1.c index b79d1f997fe..2d9622be173 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-1.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power9" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_neg (float *p) { float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-2.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-2.c index bfc0552b905..3d93376e4bd 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-2.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power8" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_neg (float *p) { float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-3.c index 712788285cc..33971f6574c 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-3.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-3.c @@ -4,8 +4,9 @@ /* { dg-options "-mcpu=power8" } */ #include <altivec.h> +#include <stdbool.h> -unsigned int +bool test_neg (double *p) { double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-0.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-0.c index 75eea0ebe29..7bb819c7c96 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-0.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-0.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector int +__vector unsigned int get_exponents (__vector float *p) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-1.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-1.c index ed464cc2ead..5f8b2eb5d4b 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-1.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector long long int +__vector unsigned long long int get_exponents (__vector double *p) { __vector double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-2.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-2.c index 0b456e4d3e9..1462e4797bf 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-2.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector long long int +__vector unsigned long long int get_exponents (__vector double *p) { __vector double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-3.c index 09e0724f729..15dc0dde7ad 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-3.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-3.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector int +__vector unsigned int get_exponents (__vector float *p) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-0.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-0.c index c6758091922..9def7c1d67e 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-0.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-0.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector int +__vector unsigned int get_significands (__vector float *p) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-1.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-1.c index f244942c6c4..74e5355385c 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-1.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector long long int +__vector unsigned long long int get_significands (__vector double *p) { __vector double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-2.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-2.c index 5d1d1223bae..c4088cfc67e 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-2.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector long long int +__vector unsigned long long int get_significands (__vector double *p) { __vector double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-3.c index 40d0c47873b..0adbbc25ee2 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-3.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-3.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector int +__vector unsigned int get_significands (__vector float *p) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-4.c new file mode 100644 index 00000000000..4f075708138 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> + +__vector float +make_floats (__vector float *significands_p, + __vector unsigned int *exponents_p) +{ + __vector float significands = *significands_p; + __vector unsigned int exponents = *exponents_p; + + return vec_insert_exp (significands, exponents); +} + +/* { dg-final { scan-assembler "xviexpsp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-5.c new file mode 100644 index 00000000000..4a396d68078 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-5.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> + +__vector double +make_doubles (__vector double *significands_p, + __vector unsigned long long int *exponents_p) +{ + __vector double significands = *significands_p; + __vector unsigned long long int exponents = *exponents_p; + + return vec_insert_exp (significands, exponents); +} + +/* { dg-final { scan-assembler "xviexpdp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-6.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-6.c new file mode 100644 index 00000000000..5a76af7ed67 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +#include <altivec.h> + +__vector float +make_floats (__vector float *significands_p, + __vector unsigned int *exponents_p) +{ + __vector float significands = *significands_p; + __vector unsigned int exponents = *exponents_p; + + return __builtin_vec_insert_exp (significands, exponents); /* { dg-error "Builtin function __builtin_vsx_insert_exp_sp requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-7.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-7.c new file mode 100644 index 00000000000..8655818fc40 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-7.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +#include <altivec.h> + +__vector double +make_doubles (__vector double *significands_p, + __vector unsigned long long int *exponents_p) +{ + __vector double significands = *significands_p; + __vector unsigned long long int exponents = *exponents_p; + + return __builtin_vec_insert_exp (significands, exponents); /* { dg-error "Builtin function __builtin_vsx_insert_exp_dp requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-0.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-0.c index 65b2786f445..cea500b8960 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-0.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-0.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector int +__vector bool int get_data_class_flags (__vector float *p) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-1.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-1.c index 7db579719ad..c965c0f721f 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-1.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector long long int +__vector bool long long int get_data_class_flags (__vector double *p) { __vector double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-2.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-2.c index cdcc19e511f..c7e236fdb82 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-2.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector long long int +__vector bool long long int get_data_class_flags (__vector double *p) { __vector double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-3.c index 23f5acefcc2..9a6c069ac11 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-3.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-3.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector int +__vector bool int get_data_class_flags (__vector float *p) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-4.c index 91c2293ea16..7392a4da85e 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-4.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-4.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector int +__vector bool int get_data_class_flags (__vector float *p) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-5.c index cf46d8590a8..bd94d3f9379 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-5.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-5.c @@ -5,7 +5,7 @@ #include <altivec.h> -__vector long long int +__vector bool long long int get_data_class_flags (__vector double *p) { __vector double source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-6.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-6.c index b780adcf532..cc77e04a496 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-6.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-6.c @@ -5,8 +5,8 @@ #include <altivec.h> -__vector int -get_data_class_flags (__vector float *p, unsigned int condition_flag) +__vector bool int +get_data_class_flags (__vector float *p, int condition_flag) { __vector float source = *p; diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-7.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-7.c index 3fde79314ed..61aa7cc3a8f 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-7.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-7.c @@ -5,8 +5,8 @@ #include <altivec.h> -__vector long long int -get_data_class_flags (__vector double *p, unsigned int condition_flag) +__vector bool long long int +get_data_class_flags (__vector double *p, int condition_flag) { __vector double source = *p; |