From: Kelvin Nilsen Date: Tue, 17 Apr 2018 18:58:08 +0000 (+0000) Subject: rs6000-protos.h (rs6000_builtin_is_supported_p): New prototype. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=48784b0065c309540e324db75ee429cb1357b6f8;p=gcc.git rs6000-protos.h (rs6000_builtin_is_supported_p): New prototype. gcc/ChangeLog: 2018-04-13 Kelvin Nilsen * config/rs6000/rs6000-protos.h (rs6000_builtin_is_supported_p): New prototype. * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add note to error message to explain internal mapping of overloaded built-in function name to non-overloaded built-in function name. * config/rs6000/rs6000.c (rs6000_builtin_is_supported_p): New function. gcc/testsuite/ChangeLog: 2018-04-13 Kelvin Nilsen * gcc.target/powerpc/bfp/scalar-extract-sig-5.c: Simplify to prevent cascading of errors and change expected error message. * gcc.target/powerpc/bfp/scalar-test-neg-4.c: Restrict this test to 64-bit targets. * gcc.target/powerpc/bfp/scalar-test-data-class-8.c: Likewise. * gcc.target/powerpc/bfp/scalar-test-data-class-9.c: Likewise. * gcc.target/powerpc/bfp/scalar-test-data-class-10.c: Likewise. * gcc.target/powerpc/bfp/scalar-insert-exp-11.c: Change expected error message. * gcc.target/powerpc/bfp/scalar-extract-exp-5.c: Likewise. From-SVN: r259442 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 54dfb4ff351..a136e541e13 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-04-17 Kelvin Nilsen + + * config/rs6000/rs6000-protos.h (rs6000_builtin_is_supported_p): + New prototype. + * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): + Add note to error message to explain internal mapping of overloaded + built-in function name to non-overloaded built-in function name. + * config/rs6000/rs6000.c (rs6000_builtin_is_supported_p): New + function. + 2018-04-17 Michael Meissner PR target/85424 diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index bdf6405557e..8ed22011b18 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -6894,6 +6894,8 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, { bool unsupported_builtin = false; + enum rs6000_builtins overloaded_code; + tree result = NULL; for (desc = altivec_overloaded_builtins; desc->code && desc->code != fcode; desc++) continue; @@ -6906,7 +6908,6 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, discrimination between the desired forms of the function. */ if (fcode == P6_OV_BUILTIN_CMPB) { - int overloaded_code; machine_mode arg1_mode = TYPE_MODE (types[0]); machine_mode arg2_mode = TYPE_MODE (types[1]); @@ -6941,14 +6942,20 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, && rs6000_builtin_type_compatible (types[1], desc->op2)) { if (rs6000_builtin_decls[desc->overloaded_code] != NULL_TREE) - return altivec_build_resolved_builtin (args, n, desc); + { + result = altivec_build_resolved_builtin (args, n, desc); + /* overloaded_code is set above */ + if (!rs6000_builtin_is_supported_p (overloaded_code)) + unsupported_builtin = true; + else + return result; + } else unsupported_builtin = true; } } else if (fcode == P9V_BUILTIN_VEC_VSIEDP) { - int overloaded_code; machine_mode arg1_mode = TYPE_MODE (types[0]); if (nargs != 2) @@ -6983,12 +6990,20 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, while (desc->code && desc->code == fcode && desc->overloaded_code != overloaded_code) desc++; + if (desc->code && (desc->code == fcode) && rs6000_builtin_type_compatible (types[0], desc->op1) && rs6000_builtin_type_compatible (types[1], desc->op2)) { if (rs6000_builtin_decls[desc->overloaded_code] != NULL_TREE) - return altivec_build_resolved_builtin (args, n, desc); + { + result = altivec_build_resolved_builtin (args, n, desc); + /* overloaded_code is set above. */ + if (!rs6000_builtin_is_supported_p (overloaded_code)) + unsupported_builtin = true; + else + return result; + } else unsupported_builtin = true; } @@ -7007,7 +7022,18 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, || rs6000_builtin_type_compatible (types[2], desc->op3))) { if (rs6000_builtin_decls[desc->overloaded_code] != NULL_TREE) - return altivec_build_resolved_builtin (args, n, desc); + { + result = altivec_build_resolved_builtin (args, n, desc); + if (!rs6000_builtin_is_supported_p (desc->overloaded_code)) + { + /* Allow loop to continue in case a different + definition is supported. */ + overloaded_code = desc->overloaded_code; + unsupported_builtin = true; + } + else + return result; + } else unsupported_builtin = true; } @@ -7017,9 +7043,23 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, if (unsupported_builtin) { const char *name = rs6000_overloaded_builtin_name (fcode); - error ("builtin function %qs not supported in this compiler " - "configuration", name); - return error_mark_node; + if (result != NULL) + { + const char *internal_name + = rs6000_overloaded_builtin_name (overloaded_code); + /* An error message making reference to the name of the + non-overloaded function has already been issued. Add + clarification of the previous message. */ + rich_location richloc (line_table, input_location); + inform (&richloc, "builtin %qs requires builtin %qs", + name, internal_name); + } + else + error ("builtin function %qs not supported in this compiler " + "configuration", name); + /* If an error-representing result tree was returned from + altivec_build_resolved_builtin above, use it. */ + return (result != NULL) ? result : error_mark_node; } } bad: diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index b1e8cf66c54..d2248603753 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -212,6 +212,7 @@ extern void rs6000_sibcall_aix (rtx, rtx, rtx, rtx); extern void rs6000_aix_asm_output_dwarf_table_ref (char *); extern void get_ppc476_thunk_name (char name[32]); extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins); +extern bool rs6000_builtin_is_supported_p (enum rs6000_builtins); extern const char *rs6000_overloaded_builtin_name (enum rs6000_builtins); extern int rs6000_store_data_bypass_p (rtx_insn *, rtx_insn *); extern HOST_WIDE_INT rs6000_builtin_mask_calculate (void); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c74e2a39d80..fd11407367e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -15905,6 +15905,18 @@ paired_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target) return target; } +/* Check whether a builtin function is supported in this target + configuration. */ +bool +rs6000_builtin_is_supported_p (enum rs6000_builtins fncode) +{ + HOST_WIDE_INT fnmask = rs6000_builtin_info[fncode].mask; + if ((fnmask & rs6000_builtin_mask) != fnmask) + return false; + else + return true; +} + /* Raise an error message for a builtin function that is called without the appropriate target options being set. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f0d6035123e..b07c42a75d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2018-04-13 Kelvin Nilsen + + * gcc.target/powerpc/bfp/scalar-extract-sig-5.c: Simplify to + prevent cascading of errors and change expected error message. + * gcc.target/powerpc/bfp/scalar-test-neg-4.c: Restrict this test + to 64-bit targets. + * gcc.target/powerpc/bfp/scalar-test-data-class-8.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-9.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-10.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-11.c: Change expected + error message. + * gcc.target/powerpc/bfp/scalar-extract-exp-5.c: Likewise. + 2018-04-17 Jakub Jelinek PR target/85430 diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c index 739ccc7a6b1..0f9f952a971 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c @@ -15,7 +15,7 @@ get_exponent (__ieee128 *p) { __ieee128 source = *p; - return scalar_extract_exp (source); /* { dg-error "builtin function '__builtin_vec_scalar_extract_exp' not supported in this compiler configuration" } */ + return scalar_extract_exp (source); /* { dg-error "requires ISA 3.0 IEEE 128-bit floating point" } */ } diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c index f82bbe0262d..e2f091b88ba 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c @@ -8,10 +8,10 @@ error because the builtin requires 64 bits. */ #include -unsigned __int128 /* { dg-error "'__int128' is not supported on this target" } */ +unsigned long long int get_significand (__ieee128 *p) { __ieee128 source = *p; - return __builtin_vec_scalar_extract_sig (source); /* { dg-error "builtin function '__builtin_vec_scalar_extract_sig' not supported in this compiler configuration" } */ + return (long long int) __builtin_vec_scalar_extract_sig (source); /* { dg-error "requires ISA 3.0 IEEE 128-bit floating point" } */ } diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c index 3e47a69a0f4..8c8255ac5c0 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c @@ -17,5 +17,5 @@ insert_exponent (__ieee128 *significand_p, __ieee128 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" } */ + return scalar_insert_exp (significand, exponent); /* { dg-error "requires ISA 3.0 IEEE 128-bit floating point" } */ } diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-10.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-10.c index 32fd8b1deee..c125988eaab 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-10.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-10.c @@ -1,5 +1,8 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* Require 64-bit target to select expected error message below. 32-bit + target produces different error message. */ +/* { dg-require-effective-target lp64 } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-options "-mcpu=power9" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-8.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-8.c index 25192506992..e7cf68e7464 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-8.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-8.c @@ -1,5 +1,6 @@ /* { 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" } */ @@ -11,6 +12,8 @@ test_data_class (__ieee128 *p) { __ieee128 source = *p; + /* IEEE 128-bit floating point operations are only supported + on 64-bit targets. */ return scalar_test_data_class (source, 3); } diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-9.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-9.c index 28c1e090ce5..27e62bd8fef 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-9.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-9.c @@ -1,5 +1,6 @@ /* { 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" } */ @@ -11,6 +12,8 @@ test_data_class (__ieee128 *p) { __ieee128 source = *p; + /* IEEE 128-bit floating point operations are only supported + on 64-bit targets. */ return scalar_test_data_class (source, 256); /* { dg-error "argument 2 must be a 7-bit unsigned literal" } */ } diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-4.c index 13fee32cdf8..535bf60ae6e 100644 --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-4.c +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-4.c @@ -1,5 +1,6 @@ /* { 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" } */ @@ -11,6 +12,8 @@ test_neg (__ieee128 *p) { __ieee128 source = *p; + /* IEEE 128-bit floating point operations are only supported + on 64-bit targets. */ return scalar_test_neg (source); }