mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
c: Rename uimaxabs to umaxabs
The following patch implements https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3577.txt No big deal on the GCC side, for uimaxabs we just won't recognize it as builtin and I don't see it worth preserving __builtin_uimaxabs, I doubt anything but gcc testsuite used that. But on the glibc side I think it will need to remain exported for ABI compatibility :( 2025-09-01 Jakub Jelinek <jakub@redhat.com> * builtins.def: Implement C2Y N3577 - Rename s/uimaxabs/umaxabs/. (BUILT_IN_UIMAXABS): Rename to ... (BUILT_IN_UMAXABS): ... this. Change second argument to "umaxabs". * builtins.cc (fold_builtin_1): Use BUILT_IN_UMAXABS rather than BUILT_IN_UIMAXABS. * gcc.c-torture/execute/builtins/lib/abs.c (uimaxabs): Rename to ... (umaxabs): ... this. * gcc.c-torture/execute/builtins/uabs-2.c (uimaxabs): Rename to ... (umaxabs): ... this. (main_test): Use umaxabs instead of uimaxabs. * gcc.c-torture/execute/builtins/uabs-3.c (main_test): Use umaxabs instead of uimaxabs.
This commit is contained in:
committed by
Jakub Jelinek
parent
082483dd79
commit
086d0d8c9c
@@ -10679,7 +10679,7 @@ fold_builtin_1 (location_t loc, tree expr, tree fndecl, tree arg0)
|
||||
case BUILT_IN_UABS:
|
||||
case BUILT_IN_ULABS:
|
||||
case BUILT_IN_ULLABS:
|
||||
case BUILT_IN_UIMAXABS:
|
||||
case BUILT_IN_UMAXABS:
|
||||
return fold_builtin_abs (loc, arg0, type);
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_CONJ):
|
||||
|
||||
@@ -1137,7 +1137,7 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_STRFMON, "strfmon", BT_FN_SSIZE_STRING_SIZE_CON
|
||||
DEF_LIB_BUILTIN (BUILT_IN_STRFTIME, "strftime", BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_TM_PTR, ATTR_FORMAT_STRFTIME_NOTHROW_3_0)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_TRAP, "trap", BT_FN_VOID, ATTR_NORETURN_NOTHROW_LEAF_COLD_LIST)
|
||||
DEF_C2Y_BUILTIN (BUILT_IN_UABS, "uabs", BT_FN_UINT_INT, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2Y_BUILTIN (BUILT_IN_UIMAXABS, "uimaxabs", BT_FN_UINTMAX_INTMAX, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2Y_BUILTIN (BUILT_IN_UMAXABS, "umaxabs", BT_FN_UINTMAX_INTMAX, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2Y_BUILTIN (BUILT_IN_ULABS, "ulabs", BT_FN_ULONG_LONG, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2Y_BUILTIN (BUILT_IN_ULLABS, "ullabs", BT_FN_ULONGLONG_LONGLONG, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_UNREACHABLE_TRAP, "unreachable trap", BT_FN_VOID, ATTR_CONST_NORETURN_NOTHROW_LEAF_COLD_LIST)
|
||||
|
||||
@@ -67,7 +67,7 @@ ullabs (long long x)
|
||||
|
||||
__attribute__ ((__noinline__))
|
||||
uintmax_t
|
||||
uimaxabs (intmax_t x)
|
||||
umaxabs (intmax_t x)
|
||||
{
|
||||
ABORT_INSIDE_MAIN;
|
||||
return x < 0 ? -(uintmax_t) x : x;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Test for builtin uabs, ulabs, ullabs, uimaxabs. */
|
||||
/* Test for builtin uabs, ulabs, ullabs, umaxabs. */
|
||||
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
|
||||
|
||||
#include <limits.h>
|
||||
@@ -9,7 +9,7 @@ typedef unsigned __INTMAX_TYPE__ uintmax_t;
|
||||
extern unsigned int uabs (int);
|
||||
extern unsigned long ulabs (long);
|
||||
extern unsigned long long ullabs (long long);
|
||||
extern uintmax_t uimaxabs (intmax_t);
|
||||
extern uintmax_t umaxabs (intmax_t);
|
||||
extern void abort (void);
|
||||
extern void link_error (void);
|
||||
|
||||
@@ -96,28 +96,28 @@ main_test (void)
|
||||
abort ();
|
||||
if (ullabs (__LONG_LONG_MAX__) != __LONG_LONG_MAX__)
|
||||
link_error ();
|
||||
if (uimaxabs (imax0) != 0)
|
||||
if (umaxabs (imax0) != 0)
|
||||
abort ();
|
||||
if (uimaxabs (0) != 0)
|
||||
if (umaxabs (0) != 0)
|
||||
link_error ();
|
||||
if (uimaxabs (imax1) != 1)
|
||||
if (umaxabs (imax1) != 1)
|
||||
abort ();
|
||||
if (uimaxabs (1) != 1)
|
||||
if (umaxabs (1) != 1)
|
||||
link_error ();
|
||||
if (uimaxabs (imaxm1) != 1)
|
||||
if (umaxabs (imaxm1) != 1)
|
||||
abort ();
|
||||
if (uimaxabs (-1) != 1)
|
||||
if (umaxabs (-1) != 1)
|
||||
link_error ();
|
||||
if (uimaxabs (imaxmin) != INTMAX_MAX)
|
||||
if (umaxabs (imaxmin) != INTMAX_MAX)
|
||||
abort ();
|
||||
if (uimaxabs (imaxmin - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
if (umaxabs (imaxmin - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
abort ();
|
||||
if (uimaxabs (-INTMAX_MAX) != INTMAX_MAX)
|
||||
if (umaxabs (-INTMAX_MAX) != INTMAX_MAX)
|
||||
link_error ();
|
||||
if (uimaxabs (-INTMAX_MAX - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
if (umaxabs (-INTMAX_MAX - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
link_error ();
|
||||
if (uimaxabs (imaxmax) != INTMAX_MAX)
|
||||
if (umaxabs (imaxmax) != INTMAX_MAX)
|
||||
abort ();
|
||||
if (uimaxabs (INTMAX_MAX) != INTMAX_MAX)
|
||||
if (umaxabs (INTMAX_MAX) != INTMAX_MAX)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Test for builtin uabs, ulabs, ullabs, uimaxabs. Test for __builtin versions. */
|
||||
/* Test for builtin uabs, ulabs, ullabs, umaxabs. Test for __builtin versions. */
|
||||
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
|
||||
|
||||
#include <limits.h>
|
||||
@@ -92,28 +92,28 @@ main_test (void)
|
||||
abort ();
|
||||
if (__builtin_ullabs (__LONG_LONG_MAX__) != __LONG_LONG_MAX__)
|
||||
link_error ();
|
||||
if (__builtin_uimaxabs (imax0) != 0)
|
||||
if (__builtin_umaxabs (imax0) != 0)
|
||||
abort ();
|
||||
if (__builtin_uimaxabs (0) != 0)
|
||||
if (__builtin_umaxabs (0) != 0)
|
||||
link_error ();
|
||||
if (__builtin_uimaxabs (imax1) != 1)
|
||||
if (__builtin_umaxabs (imax1) != 1)
|
||||
abort ();
|
||||
if (__builtin_uimaxabs (1) != 1)
|
||||
if (__builtin_umaxabs (1) != 1)
|
||||
link_error ();
|
||||
if (__builtin_uimaxabs (imaxm1) != 1)
|
||||
if (__builtin_umaxabs (imaxm1) != 1)
|
||||
abort ();
|
||||
if (__builtin_uimaxabs (-1) != 1)
|
||||
if (__builtin_umaxabs (-1) != 1)
|
||||
link_error ();
|
||||
if (__builtin_uimaxabs (imaxmin) != INTMAX_MAX)
|
||||
if (__builtin_umaxabs (imaxmin) != INTMAX_MAX)
|
||||
abort ();
|
||||
if (__builtin_uimaxabs (imaxmin - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
if (__builtin_umaxabs (imaxmin - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
abort ();
|
||||
if (__builtin_uimaxabs (-INTMAX_MAX) != INTMAX_MAX)
|
||||
if (__builtin_umaxabs (-INTMAX_MAX) != INTMAX_MAX)
|
||||
link_error ();
|
||||
if (__builtin_uimaxabs (-INTMAX_MAX - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
if (__builtin_umaxabs (-INTMAX_MAX - 1) != (uintmax_t) 1 + INTMAX_MAX)
|
||||
link_error ();
|
||||
if (__builtin_uimaxabs (imaxmax) != INTMAX_MAX)
|
||||
if (__builtin_umaxabs (imaxmax) != INTMAX_MAX)
|
||||
abort ();
|
||||
if (__builtin_uimaxabs (INTMAX_MAX) != INTMAX_MAX)
|
||||
if (__builtin_umaxabs (INTMAX_MAX) != INTMAX_MAX)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user