+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
/* 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)
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 },
{ 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 },
"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)
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);
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
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:
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
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
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:
+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
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } */
+}
--- /dev/null
+/* { 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" } */
+}
/* { dg-options "-mcpu=power9" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_data_class (double *p)
{
double source = *p;
/* { dg-options "-mcpu=power9" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_data_class (float *p)
{
float source = *p;
/* { dg-options "-mcpu=power9" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_data_class (double *p)
{
double source = *p;
/* { dg-options "-mcpu=power9" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_data_class (float *p)
{
float source = *p;
/* { 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;
/* { 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;
/* { dg-options "-mcpu=power8" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_data_class (double *p)
{
double source = *p;
/* { dg-options "-mcpu=power8" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_data_class (float *p)
{
float source = *p;
/* { dg-options "-mcpu=power9" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_neg (double *p)
{
double source = *p;
/* { dg-options "-mcpu=power9" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_neg (float *p)
{
float source = *p;
/* { dg-options "-mcpu=power8" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_neg (float *p)
{
float source = *p;
/* { dg-options "-mcpu=power8" } */
#include <altivec.h>
+#include <stdbool.h>
-unsigned int
+bool
test_neg (double *p)
{
double source = *p;
#include <altivec.h>
-__vector int
+__vector unsigned int
get_exponents (__vector float *p)
{
__vector float source = *p;
#include <altivec.h>
-__vector long long int
+__vector unsigned long long int
get_exponents (__vector double *p)
{
__vector double source = *p;
#include <altivec.h>
-__vector long long int
+__vector unsigned long long int
get_exponents (__vector double *p)
{
__vector double source = *p;
#include <altivec.h>
-__vector int
+__vector unsigned int
get_exponents (__vector float *p)
{
__vector float source = *p;
#include <altivec.h>
-__vector int
+__vector unsigned int
get_significands (__vector float *p)
{
__vector float source = *p;
#include <altivec.h>
-__vector long long int
+__vector unsigned long long int
get_significands (__vector double *p)
{
__vector double source = *p;
#include <altivec.h>
-__vector long long int
+__vector unsigned long long int
get_significands (__vector double *p)
{
__vector double source = *p;
#include <altivec.h>
-__vector int
+__vector unsigned int
get_significands (__vector float *p)
{
__vector float source = *p;
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } */
+}
--- /dev/null
+/* { 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" } */
+}
#include <altivec.h>
-__vector int
+__vector bool int
get_data_class_flags (__vector float *p)
{
__vector float source = *p;
#include <altivec.h>
-__vector long long int
+__vector bool long long int
get_data_class_flags (__vector double *p)
{
__vector double source = *p;
#include <altivec.h>
-__vector long long int
+__vector bool long long int
get_data_class_flags (__vector double *p)
{
__vector double source = *p;
#include <altivec.h>
-__vector int
+__vector bool int
get_data_class_flags (__vector float *p)
{
__vector float source = *p;
#include <altivec.h>
-__vector int
+__vector bool int
get_data_class_flags (__vector float *p)
{
__vector float source = *p;
#include <altivec.h>
-__vector long long int
+__vector bool long long int
get_data_class_flags (__vector double *p)
{
__vector double source = *p;
#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;
#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;