[PATCH] rs6000: Fix a handful of 32-bit built-in function problems in the new support
Bill Schmidt
wschmidt@linux.ibm.com
Tue Nov 9 21:46:54 GMT 2021
Hi! Some time ago I realized I hadn't tested the new builtin support against 32-bit
big-endian in quite a while. When I did, I found a handful of errors that needed
correcting.
- One builtin needs to be disabled for 32-bit.
- One builtin needs to be restricted to 32-bit only.
- One builtin used unsigned long when it needed unsigned long long.
- Six builtins used unsigned long long when they needed unsigned long.
- One test case needed its expected error message adjusted.
Otherwise things were fine.
Bootstrapped and tested on powerpc64le-linux-gnu and powerpc64-linux-gnu with no
regressions. Is this okay for trunk?
Thanks!
Bill
2021-09-02 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-builtin-new.def (CMPB): Flag as no32bit.
(BPERMD): Flag as 32bit.
(UNPACK_TD): Return unsigned long long instead of unsigned long.
(SET_TEXASR): Pass unsigned long instead of unsigned long long.
(SET_TEXASRU): Likewise.
(SET_TFHAR): Likewise.
(SET_TFIAR): Likewise.
(TABORTDC): Likewise.
(TABORTDCI): Likewise.
* config/rs6000/rs6000-call.c (rs6000_expand_new_builtin): Fix error
handling for no32bit. Add 32bit handling for RS6000_BIF_BPERMD.
gcc/testsuite/
* gcc.target/powerpc/cmpb-3.c: Adjust error message.
---
gcc/config/rs6000/rs6000-builtin-new.def | 22 +++++++++++-----------
gcc/config/rs6000/rs6000-call.c | 9 ++++++---
gcc/testsuite/gcc.target/powerpc/cmpb-3.c | 2 +-
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-builtin-new.def b/gcc/config/rs6000/rs6000-builtin-new.def
index 1dd8f6b40b2..b9f7768c2f4 100644
--- a/gcc/config/rs6000/rs6000-builtin-new.def
+++ b/gcc/config/rs6000/rs6000-builtin-new.def
@@ -267,7 +267,7 @@
; Power6 builtins (ISA 2.05).
[power6]
const signed long __builtin_p6_cmpb (signed long, signed long);
- CMPB cmpbdi3 {}
+ CMPB cmpbdi3 {no32bit}
const signed int __builtin_p6_cmpb_32 (signed int, signed int);
CMPB_32 cmpbsi3 {}
@@ -2015,7 +2015,7 @@
ADDG6S addg6s {}
const signed long __builtin_bpermd (signed long, signed long);
- BPERMD bpermd_di {}
+ BPERMD bpermd_di {32bit}
const unsigned int __builtin_cbcdtd (unsigned int);
CBCDTD cbcdtd {}
@@ -2968,7 +2968,7 @@
void __builtin_set_fpscr_drn (const int[0,7]);
SET_FPSCR_DRN rs6000_set_fpscr_drn {}
- const unsigned long __builtin_unpack_dec128 (_Decimal128, const int<1>);
+ const unsigned long long __builtin_unpack_dec128 (_Decimal128, const int<1>);
UNPACK_TD unpacktd {}
@@ -3023,27 +3023,27 @@
unsigned long long __builtin_get_tfiar ();
GET_TFIAR nothing {htm,htmspr}
- void __builtin_set_texasr (unsigned long long);
+ void __builtin_set_texasr (unsigned long);
SET_TEXASR nothing {htm,htmspr}
- void __builtin_set_texasru (unsigned long long);
+ void __builtin_set_texasru (unsigned long);
SET_TEXASRU nothing {htm,htmspr}
- void __builtin_set_tfhar (unsigned long long);
+ void __builtin_set_tfhar (unsigned long);
SET_TFHAR nothing {htm,htmspr}
- void __builtin_set_tfiar (unsigned long long);
+ void __builtin_set_tfiar (unsigned long);
SET_TFIAR nothing {htm,htmspr}
unsigned int __builtin_tabort (unsigned int);
TABORT tabort {htm,htmcr}
- unsigned int __builtin_tabortdc (unsigned long long, unsigned long long, \
- unsigned long long);
+ unsigned int __builtin_tabortdc (unsigned long, unsigned long, \
+ unsigned long);
TABORTDC tabortdc {htm,htmcr}
- unsigned int __builtin_tabortdci (unsigned long long, unsigned long long, \
- unsigned long long);
+ unsigned int __builtin_tabortdci (unsigned long, unsigned long, \
+ unsigned long);
TABORTDCI tabortdci {htm,htmcr}
unsigned int __builtin_tabortwc (unsigned int, unsigned int, unsigned int);
diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 83e1abb6118..800a3bb8a33 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -15732,9 +15732,10 @@ rs6000_expand_new_builtin (tree exp, rtx target,
}
if (bif_is_no32bit (*bifaddr) && TARGET_32BIT)
- fatal_error (input_location,
- "%<%s%> is not supported in 32-bit mode",
- bifaddr->bifname);
+ {
+ error ("%<%s%> is not supported in 32-bit mode", bifaddr->bifname);
+ return const0_rtx;
+ }
if (bif_is_cpu (*bifaddr))
return new_cpu_expand_builtin (fcode, exp, target);
@@ -15758,6 +15759,8 @@ rs6000_expand_new_builtin (tree exp, rtx target,
{
if (fcode == RS6000_BIF_MFTB)
icode = CODE_FOR_rs6000_mftb_si;
+ else if (fcode == RS6000_BIF_BPERMD)
+ icode = CODE_FOR_bpermd_si;
else
gcc_unreachable ();
}
diff --git a/gcc/testsuite/gcc.target/powerpc/cmpb-3.c b/gcc/testsuite/gcc.target/powerpc/cmpb-3.c
index de111a80144..9c465de383f 100644
--- a/gcc/testsuite/gcc.target/powerpc/cmpb-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/cmpb-3.c
@@ -8,7 +8,7 @@ void abort ();
long long int
do_compare (long long int a, long long int b)
{
- return __builtin_cmpb (a, b); /* { dg-error "'__builtin_cmpb' is not supported in this compiler configuration" } */
+ return __builtin_cmpb (a, b); /* { dg-error "'__builtin_p6_cmpb' is not supported in 32-bit mode" } */
}
void expect (long long int pattern, long long int value)
--
2.27.0
More information about the Gcc-patches
mailing list