public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Meissner <meissner@linux.ibm.com>
To: Michael Meissner <meissner@linux.ibm.com>,
	gcc-patches@gcc.gnu.org,
	Segher Boessenkool <segher@kernel.crashing.org>,
	"Kewen.Lin" <linkw@linux.ibm.com>,
	David Edelsohn <dje.gcc@gmail.com>,
	Peter Bergner <bergner@linux.ibm.com>,
	Will Schmidt <will_schmidt@vnet.ibm.com>
Subject: [PATCH 3/5] Support IEEE 128-bit overload comparison built-in functions.
Date: Thu, 28 Jul 2022 00:50:43 -0400	[thread overview]
Message-ID: <YuIVo7MN5hmUzlOr@toto.the-meissners.org> (raw)
In-Reply-To: <YuIUBVkLjqjYMZhp@toto.the-meissners.org>

PATCH 3/5] Support IEEE 128-bit overload comparison built-in functions.

This patch adds support for overloading the IEEE 128-bit comparison
built-in functions bewteeen KFmode and TFmode arguments.

I have tested these patches on a power10 that is running Fedora 36, which
defaults to using long doubles that are IEEE 128-bit.  I have built two
parallel GCC compilers, one that defaults to using IEEE 128-bit long doubles
and one that defaults to using IBM 128-bit long doubles.

I have compared the test results to the original compiler results, comparing a
modified GCC to the original compiler using an IEEE 128-bit long double
default, and also comparing a modified GCC to the original compiler using an
IBM 128-bit long double default.  In both cases, the results are the same.

I have also compared the compilers with the future patch in progress that does
switch the internal type handling.  Once those patches are installed, the
overload mechanism will insure the correct built-in is used.

Can I install this patch to the trunk, assuming I have installed the first two
patches in the series?

2022-07-27   Michael Meissner  <meissner@linux.ibm.com>

gcc/

	* config/rs6000/rs6000-builtins.def
	(__builtin_vsx_scalar_cmp_exp_qp_eq_kf): Rename KFmode comparison
	built-in functions to have a KF suffix to allow overloading.
	(__builtin_vsx_scalar_cmp_exp_qp_gt_kf): Likewise.
	(__builtin_vsx_scalar_cmp_exp_qp_lt_kf): Likewise.
	(__builtin_vsx_scalar_cmp_exp_qp_unordered_kf): Likewise.
	(__builtin_vsx_scalar_cmp_exp_qp_eq_tf): Add TFmode comparison
	built-in functions.
	(__builtin_vsx_scalar_cmp_exp_qp_gt_tf): Likewise.
	(__builtin_vsx_scalar_cmp_exp_qp_lt_tf): Likewise.
	(__builtin_vsx_scalar_cmp_exp_qp_unordered_tf): Likewise.
	* config/rs6000/rs6000-overload.def
	(__builtin_vec_scalar_cmp_exp_eq): Add TFmode overloaded
	functions.
	(__builtin_vec_scalar_cmp_exp_gt): Likewise.
	(__builtin_vec_scalar_cmp_exp_lt): Likewise.
	(__builtin_vec_scalar_cmp_exp_unordered): Likewise.
---
 gcc/config/rs6000/rs6000-builtins.def | 32 ++++++++++++++++++++-------
 gcc/config/rs6000/rs6000-overload.def | 16 ++++++++++----
 2 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def
index d72ff8cb7fe..23fc4a5f108 100644
--- a/gcc/config/rs6000/rs6000-builtins.def
+++ b/gcc/config/rs6000/rs6000-builtins.def
@@ -2880,18 +2880,18 @@
   fpmath _Float128 __builtin_mulf128_round_to_odd_kf (_Float128, _Float128);
     MULF128_ODD_KF mulkf3_odd {}
 
-  const signed int __builtin_vsx_scalar_cmp_exp_qp_eq (_Float128, _Float128);
-    VSCEQPEQ xscmpexpqp_eq_kf {}
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_eq_kf (_Float128, _Float128);
+    VSCEQPEQ_KF xscmpexpqp_eq_kf {}
 
-  const signed int __builtin_vsx_scalar_cmp_exp_qp_gt (_Float128, _Float128);
-    VSCEQPGT xscmpexpqp_gt_kf {}
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_gt_kf (_Float128, _Float128);
+    VSCEQPGT_KF xscmpexpqp_gt_kf {}
 
-  const signed int __builtin_vsx_scalar_cmp_exp_qp_lt (_Float128, _Float128);
-    VSCEQPLT xscmpexpqp_lt_kf {}
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_lt_kf (_Float128, _Float128);
+    VSCEQPLT_KF xscmpexpqp_lt_kf {}
 
   const signed int \
-      __builtin_vsx_scalar_cmp_exp_qp_unordered (_Float128, _Float128);
-    VSCEQPUO xscmpexpqp_unordered_kf {}
+      __builtin_vsx_scalar_cmp_exp_qp_unordered_kf (_Float128, _Float128);
+    VSCEQPUO_KF xscmpexpqp_unordered_kf {}
 
   fpmath _Float128 __builtin_sqrtf128_round_to_odd_kf (_Float128);
     SQRTF128_ODD_KF sqrtkf2_odd {}
@@ -2942,6 +2942,22 @@
 							long double);
     MULF128_ODD_TF multf3_odd {ieeeld}
 
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_eq_tf (long double, \
+							  long double);
+    VSCEQPEQ_TF xscmpexpqp_eq_tf {ieeeld}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_gt_tf (long double, \
+							  long double);
+    VSCEQPGT_TF xscmpexpqp_gt_kf {ieeeld}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_lt_tf (long double, \
+							  long double);
+    VSCEQPLT_TF xscmpexpqp_lt_tf {ieeeld}
+
+  const signed int \
+      __builtin_vsx_scalar_cmp_exp_qp_unordered_tf (long double, long double);
+    VSCEQPUO_TF xscmpexpqp_unordered_tf {ieeeld}
+
   fpmath long double __builtin_sqrtf128_round_to_odd_tf (long double);
     SQRTF128_ODD_TF sqrttf2_odd {ieeeld}
 
diff --git a/gcc/config/rs6000/rs6000-overload.def b/gcc/config/rs6000/rs6000-overload.def
index f406a16a882..511a3821d5b 100644
--- a/gcc/config/rs6000/rs6000-overload.def
+++ b/gcc/config/rs6000/rs6000-overload.def
@@ -4474,25 +4474,33 @@
   signed int __builtin_vec_scalar_cmp_exp_eq (double, double);
     VSCEDPEQ
   signed int __builtin_vec_scalar_cmp_exp_eq (_Float128, _Float128);
-    VSCEQPEQ
+    VSCEQPEQ_KF
+  signed int __builtin_vec_scalar_cmp_exp_eq (long double, long double);
+    VSCEQPEQ_TF
 
 [VEC_VSCEGT, scalar_cmp_exp_gt, __builtin_vec_scalar_cmp_exp_gt]
   signed int __builtin_vec_scalar_cmp_exp_gt (double, double);
     VSCEDPGT
   signed int __builtin_vec_scalar_cmp_exp_gt (_Float128, _Float128);
-    VSCEQPGT
+    VSCEQPGT_KF
+  signed int __builtin_vec_scalar_cmp_exp_gt (long double, long double);
+    VSCEQPGT_TF
 
 [VEC_VSCELT, scalar_cmp_exp_lt, __builtin_vec_scalar_cmp_exp_lt]
   signed int __builtin_vec_scalar_cmp_exp_lt (double, double);
     VSCEDPLT
   signed int __builtin_vec_scalar_cmp_exp_lt (_Float128, _Float128);
-    VSCEQPLT
+    VSCEQPLT_KF
+  signed int __builtin_vec_scalar_cmp_exp_lt (long double, long double);
+    VSCEQPLT_TF
 
 [VEC_VSCEUO, scalar_cmp_exp_unordered, __builtin_vec_scalar_cmp_exp_unordered]
   signed int __builtin_vec_scalar_cmp_exp_unordered (double, double);
     VSCEDPUO
   signed int __builtin_vec_scalar_cmp_exp_unordered (_Float128, _Float128);
-    VSCEQPUO
+    VSCEQPUO_KF
+  signed int __builtin_vec_scalar_cmp_exp_unordered (long double, long double);
+    VSCEQPUO_TF
 
 [VEC_VSEE, scalar_extract_exp, __builtin_vec_scalar_extract_exp]
   unsigned int __builtin_vec_scalar_extract_exp (double);
-- 
2.35.3


-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meissner@linux.ibm.com

  parent reply	other threads:[~2022-07-28  4:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  4:43 [PATCH 0/5] IEEE 128-bit built-in overload support Michael Meissner
2022-07-28  4:47 ` [PATCH 1/5] " Michael Meissner
2022-07-28  4:48 ` [PATCH 2/5] Support IEEE 128-bit overload round_to_odd built-in functions Michael Meissner
2022-07-28  4:50 ` Michael Meissner [this message]
2022-07-28  4:52 ` [PATCH 4/5] Support IEEE 128-bit overload extract and insert " Michael Meissner
2022-07-28  4:54 ` [PATCH 5/5] Support IEEE 128-bit overload test data " Michael Meissner
2022-08-03 17:58 ` Ping: [PATCH 0/5] IEEE 128-bit built-in overload support Michael Meissner
2022-08-05 18:19 ` Segher Boessenkool
2022-08-10  6:23   ` Michael Meissner
2022-08-10 17:03     ` Segher Boessenkool
2022-08-11 20:01       ` Michael Meissner
2022-08-11 20:44         ` Joseph Myers
2022-08-16 18:07           ` Jakub Jelinek
2022-08-16 18:55             ` Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YuIVo7MN5hmUzlOr@toto.the-meissners.org \
    --to=meissner@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=segher@kernel.crashing.org \
    --cc=will_schmidt@vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).