Bill:
On Wed, 2020-03-11 at 14:12 -0500, Bill Schmidt wrote:
> I believe you need %qs here. Also replace mno-fprnd with %qs and
> put
> "-mno-fprnd" as the associated parameter.
>
> Example from nearby code: error ("%qs requires %qs", "-mdirect-
> move",
> "-mvsx");
Yes. I had originally tried to put in -mno-fprnd in the message and
got compilation errors. Had to drop the leading dash to get it to
compile. The %qs fixes that!
I re-did the patch, retested on Power 8 and Power 9. The test results
are now:
gcc -g -mno-fprnd vsx-builtin-3.c -o vsx-builtin-3
vsx-builtin-3.c: In function ‘do_math’:
vsx-builtin-3.c:145:3: error: ‘__builtin_vsx_xsrdpim’ is incompatible with
‘-mno-fprnd’ option
145 | z[i][0] = __builtin_vsx_xsrdpim (z[i][1]); i++;
| ^
vsx-builtin-3.c:146:3: error: ‘__builtin_vsx_xsrdpip’ is incompatible with
‘-mno-fprnd’ option
146 | z[i][0] = __builtin_vsx_xsrdpip (z[i][1]); i++;
| ^
The updated patch is below. Please let me know if there are any
additional things needing fixing for mainline. Thanks.
Carl Love
---------------------------------------------------------------------
rs6000: Add command line and builtin compatibility check
PR/target 87583
gcc/ChangeLog
2020-03-11 Carl Love <[email protected]>
* gcc/config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
Add check for TARGET_FRND and VSX_BUILTIN_XSRDPIM,
VSX_BUILTIN_XSRDPIP compatibility.
---
gcc/config/rs6000/rs6000-c.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 8c1fbbf..558e829 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -915,6 +915,14 @@ altivec_resolve_overloaded_builtin (location_t loc, tree
fndecl,
const struct altivec_builtin_types *desc;
unsigned int n;
+ /* Check builtin for command line argument conflicts. */
+ if (!TARGET_FPRND &&
+ (fcode == VSX_BUILTIN_XSRDPIM || fcode == VSX_BUILTIN_XSRDPIP)) {
+ error ("%qs is incompatible with %qs option",
+ IDENTIFIER_POINTER (DECL_NAME (fndecl)),
"-mno-fprnd");
+ return error_mark_node;
+ }
+
if (!rs6000_overloaded_builtin_p (fcode))
return NULL_TREE;
--
2.7.4