From: Michael Meissner Date: Tue, 5 May 2020 17:30:07 +0000 (-0400) Subject: Patch ieee128-lib-patch002b X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9fc1dff1196d4b7784c64b21e7536112106b18da;p=gcc.git Patch ieee128-lib-patch002b --- diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner index 332f5ead10b..ab1d5afa56a 100644 --- a/gcc/ChangeLog.meissner +++ b/gcc/ChangeLog.meissner @@ -1,3 +1,11 @@ +2020-05-05 Michael Meissner + + (ieee128-lib-patch002b) + PR target/94630 + * config/rs6000/rs6000.c (rs6000_mangle_decl_assembler_name): When + long double is IEEE 128-bit, map *printf and *scanf built-in + functions to the IEEE 128-bit name. + 2020-05-05 Michael Meissner (ieee128-lib-patch001b) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index abc1b8909eb..dc184419d44 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -26340,7 +26340,33 @@ rs6000_mangle_decl_assembler_name (tree decl, tree id) size_t len = IDENTIFIER_LENGTH (id); const char *name = IDENTIFIER_POINTER (id); - if (name[len - 1] == 'l') + /* Update the __builtin_*printf && __builtin_*scanf functions. */ + const size_t printf_len = sizeof ("printf") - 1; + const size_t scanf_len = sizeof ("scanf") - 1; + const size_t printf_extra = sizeof ("__") - 1 + sizeof ("ieee128") - 1; + const size_t scanf_extra = sizeof ("__isoc99_") - 1 + sizeof ("ieee128") - 1; + + if (len >= printf_len + && strcmp (name + len - printf_len, "printf") == 0) + { + char *newname = (char *) alloca (len + 1 + printf_extra); + strcpy (newname, "__"); + memcpy (newname + 2, name, len); + strcpy (newname + 2 + len, "ieee128"); + id = get_identifier (newname); + } + + else if (len >= scanf_len + && strcmp (name + len - scanf_len, "scanf") == 0) + { + char *newname = (char *) alloca (len + 1 + scanf_extra); + strcpy (newname, "__isoc99_"); + memcpy (newname + sizeof ("__isoc99") - 1, name, len); + strcpy (newname + sizeof ("__isoc99") - 1 + len, "ieee128"); + id = get_identifier (newname); + } + + else if (name[len - 1] == 'l') { bool uses_ieee128_p = false; tree type = TREE_TYPE (decl);