[PATCH v1 1/2][PPC64] [PR88877]

Kamlesh Kumar kamleshbhalui@gmail.com
Sun May 24 13:33:13 GMT 2020


Here is a discussion we did some time ago regarding the defect.
https://gcc.gnu.org/pipermail/gcc/2019-January/227834.html
please see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 for testcase
behavior.

We incorporating below Jakub's suggestion in this patch series.

Jakub wrote:
""
Yeah, all the callers of emit_library_call* would need to be changed to pass
triplets rtx, machine_mode, int/bool /*unsignedp*/, instead of just
rtx_mode_t pair.
""


In this patch series trying to address same by creating a struct Tuple
which bundles existing rtx and machine_mode and added one more
bool member which store unsigned_p which by default is false.
This patch does not change underlying behavior yet. This will be done in
follow up patches.

ChangeLog Entry:

2020-05-24 Kamlesh Kumar <kamleshbhalui@gmail.com>

        * rtl.h (Tuple): Defined and typedefed to rtx_mode_t.
        (emit_library_call): Added default arg unsigned_p.
        (emit_library_call_value): Added default arg unsigned_p.
---
 gcc/rtl.h | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index b0b1aac..ee42de7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2238,10 +2238,20 @@ struct address_info {
   enum rtx_code base_outer_code;
 };
 
-/* This is used to bundle an rtx and a mode together so that the pair
-   can be used with the wi:: routines.  If we ever put modes into rtx
-   integer constants, this should go away and then just pass an rtx in.  */
-typedef std::pair <rtx, machine_mode> rtx_mode_t;
+/* This is used to bundle an rtx and a mode and unsignedness together so
+   that the tuple can be used with the wi:: routines.  If we ever put modes
+   into rtx integer constants, this should go away and then just pass an rtx in.  */
+typedef struct Tuple {
+  rtx first;
+  machine_mode second;
+  /* unsigned_p  */
+  bool third;
+  Tuple (rtx f, machine_mode s, bool t = false) {
+    first = f;
+    second = s;
+    third = t;
+  }
+} rtx_mode_t;
 
 namespace wi
 {
@@ -4176,9 +4186,9 @@ emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode)
 
 inline void
 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
-		   rtx arg1, machine_mode arg1_mode)
+		   rtx arg1, machine_mode arg1_mode, bool unsigned_p = false)
 {
-  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
+  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode, unsigned_p) };
   emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 1, args);
 }
 
@@ -4238,9 +4248,9 @@ emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
 inline rtx
 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
 			 machine_mode outmode,
-			 rtx arg1, machine_mode arg1_mode)
+			 rtx arg1, machine_mode arg1_mode, bool unsigned_p = false)
 {
-  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
+  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode, unsigned_p) };
   return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 1, args);
 }
 
-- 
2.7.4



More information about the Gcc-patches mailing list