public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][PPC64] [PR88877]
@ 2020-03-23 14:46 kamlesh kumar
  2020-03-24 17:13 ` Hans-Peter Nilsson
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: kamlesh kumar @ 2020-03-23 14:46 UTC (permalink / raw)
  To: gcc-patches, Segher Boessenkool, jakub, rguenth

[-- Attachment #1: Type: text/plain, Size: 2414 bytes --]

Attached patch fixes.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877.
ChangeLog Entry.

2020-03-23  Kamlesh Kumar  <kamleshbhalui@gmail.com>

        * rtl.h : Defined Tuple for bundling rtx, mode and
unsignedness default as 0
        Added Extra argument (unsignedp) in emit_library_call and
emit_library_call_value.
        * except.c : Likewise.
        * explow.c : Likewise.
        * expmed.c : Likewise.
        * expr.c : Likewise.
        * optabs.c : Likewise.
        * asan.c : Likewise.
        * builtins.c : Likewise.
        * calls.c : Likewise.
        * cfgexpand.c : Likewise.
        * config/aarch64/aarch64.c : Likewise.
        * config/aarch64/aarch64.h : Likewise.
        * config/aarch64/atomics.md : Likewise.
        * config/alpha/alpha.c : Likewise.
        * config/arc/arc.c : Likewise.
        * config/arc/elf.h : Likewise.
        * config/arc/linux.h : Likewise.
        * config/arm/arm.c : Likewise.
        * config/bfin/bfin.md : Likewise.
        * config/c6x/c6x.c : Likewise.
        * config/csky/csky.c : Likewise.
        * config/frv/frv.c : Likewise.
        * config/i386/i386-expand.c : Likewise.
        * config/i386/i386.c : Likewise.
        * config/ia64/ia64.c : Likewise.
        * config/ia64/ia64.md : Likewise.
        * config/m32r/m32r.c : Likewise.
        * config/m68k/linux.h : Likewise.
        * config/m68k/m68k.c : Likewise.
        * config/microblaze/microblaze.c : Likewise.
        * config/mips/mips.h : Likewise.
        * config/mips/sdemtk.h : Likewise.
        * config/nds32/nds32.h : Likewise.
        * config/nios2/nios2.c : Likewise.
        * config/or1k/or1k.c : Likewise.
        * config/pa/pa.c : Likewise.
        * config/pa/pa.md : Likewise.
        * config/pru/pru.c : Likewise.
        * config/riscv/riscv.h : Likewise.
        * config/riscv/riscv.md : Likewise.
        * config/rl78/rl78.c : Likewise.
        * config/rs6000/rs6000-string.c : Likewise.
        * config/rs6000/rs6000.c : Likewise.
        * config/rs6000/rs6000.md : Likewise.
        * config/rs6000/vsx.md : Likewise.
        * config/sh/sh.c : Likewise.
        * config/sparc/sparc.c : Likewise.
        * config/tilegx/tilegx.c : Likewise.
        * config/tilepro/tilepro.c : Likewise.
        * config/visium/visium.c : Likewise.
        * config/xtensa/xtensa.c : Likewise.
        * testsuite/gcc.target/powerpc/pr88877.c : Newtest

[-- Attachment #2: pr88877.patch --]
[-- Type: text/x-patch, Size: 58731 bytes --]

diff --git a/gcc/asan.c b/gcc/asan.c
index cc8f9122e3d..ec4d6bdc161 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1488,7 +1488,7 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
       ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode,
 				     GEN_INT (asan_frame_size
 					      + base_align_bias),
-				     TYPE_MODE (pointer_sized_int_node));
+				     TYPE_MODE (pointer_sized_int_node), 0);
       /* __asan_stack_malloc_[n] returns a pointer to fake stack if succeeded
 	 and NULL otherwise.  Check RET value is NULL here and jump over the
 	 BASE reassignment in this case.  Otherwise, reassign BASE to RET.  */
@@ -1615,7 +1615,7 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
 	  emit_library_call (ret, LCT_NORMAL, ptr_mode, addr, ptr_mode,
 			     GEN_INT (asan_frame_size + base_align_bias),
 			     TYPE_MODE (pointer_sized_int_node),
-			     orig_addr, ptr_mode);
+			     orig_addr, ptr_mode, 0);
 	}
       lab = gen_label_rtx ();
       emit_jump (lab);
@@ -1715,7 +1715,7 @@ asan_emit_allocas_unpoison (rtx top, rtx bot, rtx_insn *before)
   top = convert_memory_address (ptr_mode, top);
   bot = convert_memory_address (ptr_mode, bot);
   emit_library_call (ret, LCT_NORMAL, ptr_mode,
-		     top, ptr_mode, bot, ptr_mode);
+		     top, ptr_mode, bot, ptr_mode, 0);
 
   do_pending_stack_adjust ();
   rtx_insn *insns = get_insns ();
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 53bae599d3e..99fa50bd515 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2979,7 +2979,7 @@ expand_builtin_powi (tree exp, rtx target)
 
   target = emit_library_call_value (optab_libfunc (powi_optab, mode),
 				    target, LCT_CONST, mode,
-				    op0, mode, op1, mode2);
+				    op0, mode, op1, mode2, 0);
 
   return target;
 }
@@ -5858,7 +5858,7 @@ expand_asan_emit_allocas_unpoison (tree exp)
 			     OPTAB_LIB_WIDEN);
   rtx ret = init_one_libfunc ("__asan_allocas_unpoison");
   ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode,
-				 top, ptr_mode, bot, ptr_mode);
+				 top, ptr_mode, bot, ptr_mode, 0);
   return ret;
 }
 
diff --git a/gcc/calls.c b/gcc/calls.c
index 4c3a8f3c215..20324ff6f04 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -5247,7 +5247,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
     {
       rtx val = args[i].first;
       function_arg_info arg (args[i].second, /*named=*/true);
-      int unsigned_p = 0;
+      int unsigned_p = GET_THIRD(args[i]);
 
       /* We cannot convert the arg value to the mode the library wants here;
 	 must do it earlier where we know the signedness of the arg.  */
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index a7ec77d5c85..c5e7c67b5e8 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -6244,7 +6244,7 @@ expand_main_function (void)
      || (!defined(HAS_INIT_SECTION)			\
 	 && !defined(INIT_SECTION_ASM_OP)		\
 	 && !defined(INIT_ARRAY_SECTION_ASM_OP)))
-  emit_library_call (init_one_libfunc (NAME__MAIN), LCT_NORMAL, VOIDmode);
+  emit_library_call (init_one_libfunc (NAME__MAIN), LCT_NORMAL, VOIDmode, 0);
 #endif
 }
 \f
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index c90de65de12..69a476bfdcc 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -10356,7 +10356,7 @@ aarch64_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
 		     LCT_NORMAL, VOIDmode, a_tramp, ptr_mode,
 		     plus_constant (ptr_mode, a_tramp, TRAMPOLINE_SIZE),
-		     ptr_mode);
+		     ptr_mode, 0);
 }
 
 static unsigned char
@@ -18516,7 +18516,7 @@ aarch64_expand_compare_and_swap (rtx operands[])
       rtx func = aarch64_atomic_ool_func (mode, mod_s, &aarch64_ool_cas_names);
       rval = emit_library_call_value (func, NULL_RTX, LCT_NORMAL, r_mode,
 				      oldval, mode, newval, mode,
-				      XEXP (mem, 0), Pmode);
+				      XEXP (mem, 0), Pmode, 0);
       cc_reg = aarch64_gen_compare_reg_maybe_ze (NE, rval, oldval, mode);
     }
   else
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 8f08bad3562..983d7a543b0 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -1092,7 +1092,7 @@ typedef struct
     rtx fun, lr;							\
     lr = get_hard_reg_initial_val (Pmode, LR_REGNUM);			\
     fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_NAME);			\
-    emit_library_call (fun, LCT_NORMAL, VOIDmode, lr, Pmode);		\
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, lr, Pmode, 0);	\
   }
 
 /* All the work done in PROFILE_HOOK, but still required.  */
diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
index 996947799b5..581f2732399 100644
--- a/gcc/config/aarch64/atomics.md
+++ b/gcc/config/aarch64/atomics.md
@@ -199,7 +199,7 @@
 					    &aarch64_ool_swp_names);
 	rtx rval = emit_library_call_value (func, operands[0], LCT_NORMAL,
 					    mode, operands[2], mode,
-					    XEXP (operands[1], 0), Pmode);
+					    XEXP (operands[1], 0), Pmode, 0);
         emit_move_insn (operands[0], rval);
       }
     else
@@ -321,7 +321,7 @@
 	rtx func = aarch64_atomic_ool_func (mode, operands[2], names);
 	emit_library_call_value (func, NULL_RTX, LCT_NORMAL, mode,
 				 operands[1], mode,
-				 XEXP (operands[0], 0), Pmode);
+				 XEXP (operands[0], 0), Pmode, 0);
         DONE;
       }
     else
@@ -479,7 +479,7 @@
       rtx func = aarch64_atomic_ool_func (mode, operands[3], names);
       rtx rval = emit_library_call_value (func, operands[0], LCT_NORMAL, mode,
 					  operands[2], mode,
-					  XEXP (operands[1], 0), Pmode);
+					  XEXP (operands[1], 0), Pmode, 0);
       emit_move_insn (operands[0], rval);
       DONE;
     }
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 7e5d1cbb0c4..426719f23a5 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -5533,7 +5533,7 @@ alpha_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
       emit_insn (gen_imb ());
 #ifdef HAVE_ENABLE_EXECUTE_STACK
       emit_library_call (init_one_libfunc ("__enable_execute_stack"),
-			 LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
+			 LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode, 0);
 #endif
     }
 }
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 922ccc5c9f9..7d263f688be 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -4421,7 +4421,7 @@ arc_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt)
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
 		     LCT_NORMAL, VOIDmode, XEXP (tramp, 0), Pmode,
 		     plus_constant (Pmode, XEXP (tramp, 0), TRAMPOLINE_SIZE),
-		     Pmode);
+		     Pmode, 0);
 }
 
 /* Add the given function declaration to emit code in JLI section.  */
diff --git a/gcc/config/arc/elf.h b/gcc/config/arc/elf.h
index 1fd29cfeaf8..56523d3e331 100644
--- a/gcc/config/arc/elf.h
+++ b/gcc/config/arc/elf.h
@@ -85,7 +85,7 @@ along with GCC; see the file COPYING3.  If not see
   {								\
     rtx fun;							\
     fun = gen_rtx_SYMBOL_REF (Pmode, "__mcount");		\
-    emit_library_call (fun, LCT_NORMAL, VOIDmode);		\
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, 0);		\
   }
 
 /* Enter/Leave default value.  */
diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
index 0b99da3fcda..eb44e2e915d 100644
--- a/gcc/config/arc/linux.h
+++ b/gcc/config/arc/linux.h
@@ -131,7 +131,7 @@ along with GCC; see the file COPYING3.  If not see
    rtx fun, rt;							\
    rt = get_hard_reg_initial_val (Pmode, RETURN_ADDR_REGNUM);	\
    fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount");			\
-   emit_library_call (fun, LCT_NORMAL, VOIDmode, rt, Pmode);	\
+   emit_library_call (fun, LCT_NORMAL, VOIDmode, rt, Pmode, 0);	\
   }
 
 /* Enter/Leave ops are default off for linux targets.  */
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 9b799084d44..3736e947b69 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -4151,7 +4151,7 @@ arm_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
   a_tramp = XEXP (m_tramp, 0);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
 		     LCT_NORMAL, VOIDmode, a_tramp, Pmode,
-		     plus_constant (Pmode, a_tramp, TRAMPOLINE_SIZE), Pmode);
+		     plus_constant (Pmode, a_tramp, TRAMPOLINE_SIZE), Pmode, 0);
 }
 
 /* Thumb trampolines should be entered in thumb mode, so set
@@ -8918,7 +8918,7 @@ arm_call_tls_get_addr (rtx x, rtx reg, rtx *valuep, int reloc)
 
   *valuep = emit_library_call_value (get_tls_get_addr (), NULL_RTX,
 				     LCT_PURE, /* LCT_CONST?  */
-				     Pmode, reg, Pmode);
+				     Pmode, reg, Pmode, 0);
 
   rtx_insn *insns = get_insns ();
   end_sequence ();
@@ -32883,7 +32883,7 @@ arm_expand_divmod_libfunc (rtx libfunc, machine_mode mode,
   rtx libval = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
 					libval_mode,
 					op0, GET_MODE (op0),
-					op1, GET_MODE (op1));
+					op1, GET_MODE (op1), 0);
 
   rtx quotient = simplify_gen_subreg (mode, libval, libval_mode, 0);
   rtx remainder = simplify_gen_subreg (mode, libval, libval_mode,
@@ -33097,7 +33097,7 @@ arm_constant_alignment (const_tree exp, HOST_WIDE_INT align)
 void
 arm_emit_speculation_barrier_function ()
 {
-  emit_library_call (speculation_barrier_libfunc, LCT_NORMAL, VOIDmode);
+  emit_library_call (speculation_barrier_libfunc, LCT_NORMAL, VOIDmode, 0);
 }
 
 /* Have we recorded an explicit access to the Q bit of APSR?.  */
diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md
index aecb8138181..094d5589bad 100644
--- a/gcc/config/bfin/bfin.md
+++ b/gcc/config/bfin/bfin.md
@@ -1580,7 +1580,7 @@
 
       emit_library_call_value (umulsi3_highpart_libfunc,
 			       operands[0], LCT_NORMAL, SImode,
-			       operands[1], SImode, operands[2], SImode);
+			       operands[1], SImode, operands[2], SImode, 0);
     }
   DONE;
 })
@@ -1630,7 +1630,7 @@
 
       emit_library_call_value (smulsi3_highpart_libfunc,
 			       operands[0], LCT_NORMAL, SImode,
-			       operands[1], SImode, operands[2], SImode);
+			       operands[1], SImode, operands[2], SImode, 0);
     }
   DONE;
 })
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
index 39b0f753047..a68dbc6f344 100644
--- a/gcc/config/c6x/c6x.c
+++ b/gcc/config/c6x/c6x.c
@@ -727,7 +727,7 @@ c6x_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt)
   tramp = XEXP (tramp, 0);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__gnu_clear_cache"),
 		     LCT_NORMAL, VOIDmode, tramp, Pmode,
-		     plus_constant (Pmode, tramp, TRAMPOLINE_SIZE), Pmode);
+		     plus_constant (Pmode, tramp, TRAMPOLINE_SIZE), Pmode, 0);
 #endif
 }
 \f
@@ -1579,7 +1579,7 @@ c6x_expand_compare (rtx comparison, machine_mode mode)
 	  start_sequence ();
 
 	  cmp = emit_library_call_value (libfunc, 0, LCT_CONST, SImode,
-					 op0, op_mode, op1, op_mode);
+					 op0, op_mode, op1, op_mode, 0);
 	  insns = get_insns ();
 	  end_sequence ();
 
@@ -1715,7 +1715,7 @@ c6x_expand_cpymem (rtx dst, rtx src, rtx count_exp, rtx align_exp,
       if (dst_expr)
 	mark_addressable (dst_expr);
       emit_library_call (fn, LCT_NORMAL, VOIDmode,
-			 dstreg, Pmode, srcreg, Pmode, count_exp, SImode);
+			 dstreg, Pmode, srcreg, Pmode, count_exp, SImode, 0);
       return true;
     }
 
diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c
index 7ba3ed3e74e..3c317dee314 100644
--- a/gcc/config/csky/csky.c
+++ b/gcc/config/csky/csky.c
@@ -2739,7 +2739,7 @@ csky_call_tls_get_addr (rtx x, rtx reg, rtx *valuep, int reloc)
   emit_insn (gen_addsi3 (reg, reg, tmp));
   *valuep = emit_library_call_value (get_tls_get_addr (),
 				     NULL_RTX, LCT_PURE, /* LCT_CONST?	*/
-				     Pmode, reg, Pmode);
+				     Pmode, reg, Pmode, 0);
   insns = get_insns ();
   end_sequence ();
   return insns;
@@ -5858,7 +5858,7 @@ csky_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
   a_tramp = XEXP (m_tramp, 0);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
 		     LCT_NORMAL, VOIDmode, a_tramp, Pmode,
-		     plus_constant (Pmode, a_tramp, TRAMPOLINE_SIZE), Pmode);
+		     plus_constant (Pmode, a_tramp, TRAMPOLINE_SIZE), Pmode, 0);
 }
 
 
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 125346dee8c..391afa6654f 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -6204,7 +6204,7 @@ frv_trampoline_init (rtx m_tramp, tree fndecl, rtx static_chain)
 		     addr, Pmode,
 		     GEN_INT (frv_trampoline_size ()), SImode,
 		     fnaddr, Pmode,
-		     sc_reg, Pmode);
+		     sc_reg, Pmode, 0);
 }
 
 \f
diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 2a7bf72318a..8abaa31d576 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -20268,7 +20268,7 @@ ix86_expand_divmod_libfunc (rtx libfunc, machine_mode mode,
 
   rtx quot = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
 				      mode, op0, mode, op1, mode,
-				      XEXP (rem, 0), Pmode);
+				      XEXP (rem, 0), Pmode, 0);
   *quot_p = quot;
   *rem_p = rem;
 }
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 049ca4f4fdb..a1079691933 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -17100,7 +17100,7 @@ ix86_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
   if (CHECK_EXECUTE_STACK_ENABLED)
 #endif
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
+		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode, 0);
 #endif
 }
 
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 1500985a1f6..d54409b703d 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -1225,7 +1225,7 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1,
 
       tga_ret = emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
 					 LCT_CONST, Pmode,
-					 tga_op1, Pmode, tga_op2, Pmode);
+					 tga_op1, Pmode, tga_op2, Pmode, 0);
 
       insns = get_insns ();
       end_sequence ();
@@ -1249,7 +1249,7 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1,
 
       tga_ret = emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
 					 LCT_CONST, Pmode,
-					 tga_op1, Pmode, tga_op2, Pmode);
+					 tga_op1, Pmode, tga_op2, Pmode, 0);
 
       insns = get_insns ();
       end_sequence ();
@@ -1860,7 +1860,7 @@ ia64_expand_compare (rtx *expr, rtx *op0, rtx *op1)
 
       ret = emit_library_call_value (cmptf_libfunc, 0, LCT_CONST, DImode,
 				     *op0, TFmode, *op1, TFmode,
-				     GEN_INT (magic), DImode);
+				     GEN_INT (magic), DImode, 0);
       cmp = gen_reg_rtx (BImode);
       emit_insn (gen_rtx_SET (cmp, gen_rtx_fmt_ee (ncode, BImode,
 						   ret, const0_rtx)));
@@ -11203,7 +11203,7 @@ ia64_profile_hook (int labelno)
                      VOIDmode,
 		     gen_rtx_REG (Pmode, BR_REG (0)), Pmode,
 		     ip, Pmode,
-		     label, Pmode);
+		     label, Pmode, 0);
 }
 
 /* Return the mangling of TYPE if it is an extended fundamental type.  */
diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md
index 15a0a025a11..9e84a550118 100644
--- a/gcc/config/ia64/ia64.md
+++ b/gcc/config/ia64/ia64.md
@@ -5057,7 +5057,7 @@
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
 					 \"__ia64_save_stack_nonlocal\"),
 		     LCT_NORMAL, VOIDmode, XEXP (operands[0], 0), Pmode,
-		     operands[1], Pmode);
+		     operands[1], Pmode, 0);
   DONE;
 })
 
@@ -5072,7 +5072,7 @@
 		     LCT_NORETURN, VOIDmode,
 		     operands[1], Pmode,
 		     copy_to_reg (XEXP (operands[2], 0)), Pmode,
-		     operands[3], Pmode);
+		     operands[3], Pmode, 0);
   emit_barrier ();
   DONE;
 })
@@ -5135,7 +5135,7 @@
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
 					 "__ia64_restore_stack_nonlocal"),
 		     LCT_NORMAL, VOIDmode,
-		     copy_to_reg (XEXP (operands[1], 0)), Pmode);
+		     copy_to_reg (XEXP (operands[1], 0)), Pmode, 0);
   DONE;
 })
 
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 1c015609524..02c6cd48a8b 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -2498,7 +2498,7 @@ block_move_call (rtx dest_reg, rtx src_reg, rtx bytes_rtx)
 		     VOIDmode, dest_reg, Pmode, src_reg, Pmode,
 		     convert_to_mode (TYPE_MODE (sizetype), bytes_rtx,
 				      TYPE_UNSIGNED (sizetype)),
-		     TYPE_MODE (sizetype));
+		     TYPE_MODE (sizetype), 0);
 }
 
 /* Expand string/block move operations.
@@ -2819,7 +2819,7 @@ m32r_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
     emit_library_call (m32r_function_symbol (m32r_cache_flush_func),
 		       LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode,
 		       gen_int_mode (TRAMPOLINE_SIZE, SImode), SImode,
-		       GEN_INT (3), SImode);
+		       GEN_INT (3), SImode, 0);
 }
 
 /* True if X is a reg that can be used as a base reg.  */
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
index 0d18e5ae5ac..ab34c57679e 100644
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -197,7 +197,7 @@ along with GCC; see the file COPYING3.  If not see
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),	\
 		     LCT_NORMAL, VOIDmode, TRAMP, Pmode,		\
 		     plus_constant (Pmode, TRAMP, TRAMPOLINE_SIZE), 	\
-		     Pmode);
+		     Pmode, 0);
 
 /* Clear the instruction cache from `beg' to `end'.  This makes an
    inline system call to SYS_cacheflush.  The arguments are as
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 67b109447b3..633c4dc7f56 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -2720,7 +2720,7 @@ m68k_call_tls_get_addr (rtx x, rtx eqv, enum m68k_reloc reloc)
 
   m68k_libcall_value_in_a0_p = true;
   a0 = emit_library_call_value (m68k_get_tls_get_addr (), NULL_RTX, LCT_PURE,
-				Pmode, x, Pmode);
+				Pmode, x, Pmode, 0);
   m68k_libcall_value_in_a0_p = false;
   
   insns = get_insns ();
@@ -2769,7 +2769,7 @@ m68k_call_m68k_read_tp (void)
   /* Emit the call sequence.  */
   m68k_libcall_value_in_a0_p = true;
   a0 = emit_library_call_value (m68k_get_m68k_read_tp (), NULL_RTX, LCT_PURE,
-				Pmode);
+				Pmode, 0);
   m68k_libcall_value_in_a0_p = false;
   insns = get_insns ();
   end_sequence ();
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index b4754b12160..509c9e4c0ac 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -583,7 +583,7 @@ microblaze_call_tls_get_addr (rtx x, rtx reg, rtx *valuep, int reloc)
 
   *valuep = emit_library_call_value (get_tls_get_addr (), NULL_RTX,
                                      LCT_PURE, /* LCT_CONST?  */
-                                     Pmode, reg, Pmode);
+                                     Pmode, reg, Pmode, 0);
 
   insns = get_insns ();
   end_sequence ();
@@ -3721,7 +3721,7 @@ microblaze_expand_divide (rtx operands[])
 				 operands[0], LCT_NORMAL,
 				 GET_MODE (operands[0]),
 				 operands[1], GET_MODE (operands[1]),
-				 operands[2], GET_MODE (operands[2]));
+				 operands[2], GET_MODE (operands[2]), 0);
   if (ret != operands[0])
                 emit_move_insn (operands[0], ret);    
 
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 3ce0c19a29a..9706f2d6750 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2577,7 +2577,7 @@ typedef struct mips_args {
      the system has a write-back cache.  */				\
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func),	\
 		     LCT_NORMAL, VOIDmode, ADDR, Pmode, SIZE, Pmode,	\
-		     GEN_INT (3), TYPE_MODE (integer_type_node))
+		     GEN_INT (3), TYPE_MODE (integer_type_node), 0)
 
 \f
 /* Addressing modes, and classification of registers for them.  */
diff --git a/gcc/config/mips/sdemtk.h b/gcc/config/mips/sdemtk.h
index 6a5a8178066..dd442e07300 100644
--- a/gcc/config/mips/sdemtk.h
+++ b/gcc/config/mips/sdemtk.h
@@ -71,7 +71,7 @@ extern void mips_sync_icache (void *beg, unsigned long len);
 #define MIPS_ICACHE_SYNC(ADDR, SIZE)					\
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func),	\
 		     LCT_NORMAL, VOIDmode, ADDR, Pmode,			\
-		     SIZE, TYPE_MODE (sizetype))
+		     SIZE, TYPE_MODE (sizetype), 0)
 
 /* This version of _mcount does not pop 2 words from the stack.  */
 #undef FUNCTION_PROFILER
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index 17a9ddc58ec..943cd161287 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -1385,7 +1385,7 @@ enum reg_class
     rtx fun, lp;							\
     lp = get_hard_reg_initial_val (Pmode, LP_REGNUM);			\
     fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount");			\
-    emit_library_call (fun, LCT_NORMAL, VOIDmode, lp, Pmode);		\
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, lp, Pmode, 0);	\
   }
 
 \f
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index ba0a0a9ba43..cd2a4d5244e 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -1857,7 +1857,7 @@ nios2_emit_expensive_div (rtx *operands, machine_mode mode)
   final_result = emit_library_call_value (libfunc, NULL_RTX,
                                           LCT_CONST, SImode,
                                           operands[1], SImode,
-                                          operands[2], SImode);
+                                          operands[2], SImode, 0);
 
   insns = get_insns ();
   end_sequence ();
@@ -3478,7 +3478,7 @@ nios2_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
 
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"),
 		     LCT_NORMAL, VOIDmode, addr, Pmode, fnaddr, Pmode,
-		     ctx_reg, Pmode);
+		     ctx_reg, Pmode, 0);
 }
 
 /* Implement TARGET_FUNCTION_VALUE.  */
diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c
index 5fa5425aa2b..7342d2e5244 100644
--- a/gcc/config/or1k/or1k.c
+++ b/gcc/config/or1k/or1k.c
@@ -647,7 +647,7 @@ static void
 or1k_tls_call (rtx dest, rtx arg)
 {
   emit_library_call_value (gen_tls_get_addr (), dest, LCT_CONST,
-			   Pmode, arg, Pmode);
+			   Pmode, arg, Pmode, 0);
 }
 
 /* Helper for or1k_legitimize_address_1.  Wrap X in an unspec.  */
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index a662de96ac9..f6d2e95eee2 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -927,7 +927,7 @@ hppa_tls_call (rtx arg)
 
   ret = gen_reg_rtx (Pmode);
   emit_library_call_value (gen_tls_get_addr (), ret,
-			   LCT_CONST, Pmode, arg, Pmode);
+			   LCT_CONST, Pmode, arg, Pmode, 0);
 
   return ret;
 }
@@ -10214,7 +10214,7 @@ pa_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
 
 #ifdef HAVE_ENABLE_EXECUTE_STACK
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
+		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode, 0);
 #endif
 }
 
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index 6350c685a59..0b27562f67d 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -9663,7 +9663,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
 
       emit_library_call_value (canonicalize_funcptr_for_compare_libfunc,
       			       operands[0], LCT_NORMAL, Pmode,
-			       operands[1], Pmode);
+			       operands[1], Pmode, 0);
       DONE;
     }
 
diff --git a/gcc/config/pru/pru.c b/gcc/config/pru/pru.c
index 37394c5e3b9..787e53b9052 100644
--- a/gcc/config/pru/pru.c
+++ b/gcc/config/pru/pru.c
@@ -982,7 +982,7 @@ pru_expand_fp_compare (rtx comparison, machine_mode mode)
   start_sequence ();
 
   cmp = emit_library_call_value (libfunc, 0, LCT_CONST, SImode,
-				 op0, op_mode, op1, op_mode);
+				 op0, op_mode, op1, op_mode, 0);
   insns = get_insns ();
   end_sequence ();
 
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index 567c23380fe..09452e6f8b1 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -336,7 +336,7 @@ along with GCC; see the file COPYING3.  If not see
     rtx fun, ra;							\
     ra = get_hard_reg_initial_val (Pmode, RETURN_ADDR_REGNUM);		\
     fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_NAME);			\
-    emit_library_call (fun, LCT_NORMAL, VOIDmode, ra, Pmode);		\
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, ra, Pmode, 0);	\
   }
 
 /* All the work done in PROFILE_HOOK, but still required.  */
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index 434e064e095..9d7a5e8ab15 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -1527,7 +1527,7 @@
 #ifdef ICACHE_FLUSH_FUNC
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, ICACHE_FLUSH_FUNC),
 		     LCT_NORMAL, VOIDmode, operands[0], Pmode,
-		     operands[1], Pmode, const0_rtx, Pmode);
+		     operands[1], Pmode, const0_rtx, Pmode, 0);
 #else
   emit_insn (gen_fence_i ());
 #endif
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 71f67b79e77..5a2fa74ff1d 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -4937,7 +4937,7 @@ rl78_emit_libcall (const char *name, enum rtx_code code,
     {
     case 2:
       ret = emit_library_call_value (libcall, NULL_RTX, LCT_CONST,
-                                     dmode, operands[1], smode);
+                                     dmode, operands[1], smode, 0);
       equiv = gen_rtx_fmt_e (code, dmode, operands[1]);
       break;
 
@@ -4945,7 +4945,7 @@ rl78_emit_libcall (const char *name, enum rtx_code code,
       ret = emit_library_call_value (libcall, NULL_RTX,
                                      LCT_CONST, dmode,
                                      operands[1], smode, operands[2],
-                                     smode);
+                                     smode, 0);
       equiv = gen_rtx_fmt_ee (code, dmode, operands[1], operands[2]);
       break;
 
diff --git a/gcc/config/rs6000/rs6000-string.c b/gcc/config/rs6000/rs6000-string.c
index fe7177f10fd..e99ae4df900 100644
--- a/gcc/config/rs6000/rs6000-string.c
+++ b/gcc/config/rs6000/rs6000-string.c
@@ -1618,7 +1618,7 @@ expand_compare_loop (rtx operands[])
 			       target, LCT_NORMAL, GET_MODE (target),
 			       src1_addr, Pmode,
 			       src2_addr, Pmode,
-			       len_rtx, GET_MODE (len_rtx));
+			       len_rtx, GET_MODE (len_rtx), 0);
     }
 
   /* emit final_label */
@@ -2583,7 +2583,7 @@ expand_strn_compare (rtx operands[], int no_length)
 	  emit_library_call_value (XEXP (DECL_RTL (fun), 0),
 				   target, LCT_NORMAL, GET_MODE (target),
 				   force_reg (Pmode, src1_addr), Pmode,
-				   force_reg (Pmode, src2_addr), Pmode);
+				   force_reg (Pmode, src2_addr), Pmode, 0);
 	}
       else
 	{
@@ -2598,7 +2598,7 @@ expand_strn_compare (rtx operands[], int no_length)
 				   target, LCT_NORMAL, GET_MODE (target),
 				   force_reg (Pmode, src1_addr), Pmode,
 				   force_reg (Pmode, src2_addr), Pmode,
-				   len_rtx, Pmode);
+				   len_rtx, Pmode, 0);
 	}
 
       rtx fin_ref = gen_rtx_LABEL_REF (VOIDmode, final_label);
@@ -2653,7 +2653,7 @@ expand_strn_compare (rtx operands[], int no_length)
 	  tree fun = builtin_decl_explicit (BUILT_IN_STRCMP);
 	  emit_library_call_value (XEXP (DECL_RTL (fun), 0),
 				   target, LCT_NORMAL, GET_MODE (target),
-				   src1, Pmode, src2, Pmode);
+				   src1, Pmode, src2, Pmode, 0);
 	}
       else
 	{
@@ -2662,7 +2662,7 @@ expand_strn_compare (rtx operands[], int no_length)
 	  tree fun = builtin_decl_explicit (BUILT_IN_STRNCMP);
 	  emit_library_call_value (XEXP (DECL_RTL (fun), 0),
 				   target, LCT_NORMAL, GET_MODE (target),
-				   src1, Pmode, src2, Pmode, len_rtx, Pmode);
+				   src1, Pmode, src2, Pmode, len_rtx, Pmode, 0);
 	}
 
       rtx fin_ref = gen_rtx_LABEL_REF (VOIDmode, final_label);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 07f7cf516ba..361ce68ac07 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8660,7 +8660,7 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
 	  rtx argreg = gen_rtx_REG (Pmode, 3);
 	  emit_insn (gen_rtx_SET (argreg, arg));
 	  global_tlsarg = arg;
-	  emit_library_call_value (tga, dest, LCT_CONST, Pmode, argreg, Pmode);
+	  emit_library_call_value (tga, dest, LCT_CONST, Pmode, argreg, Pmode, 0);
 	  global_tlsarg = NULL_RTX;
 
 	  /* Make a note so that the result of this call can be CSEd.  */
@@ -8676,7 +8676,7 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
 	  rtx argreg = gen_rtx_REG (Pmode, 3);
 	  emit_insn (gen_rtx_SET (argreg, arg));
 	  global_tlsarg = arg;
-	  emit_library_call_value (tga, tmp1, LCT_CONST, Pmode, argreg, Pmode);
+	  emit_library_call_value (tga, tmp1, LCT_CONST, Pmode, argreg, Pmode, 0);
 	  global_tlsarg = NULL_RTX;
 
 	  /* Make a note so that the result of this call can be CSEd.  */
@@ -13934,7 +13934,7 @@ rs6000_generate_compare (rtx cmp, machine_mode mode)
 
       if (!check_nan)
 	dest = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-					SImode, op0, mode, op1, mode);
+					SImode, op0, mode, op1, mode, 0);
 
       /* The library signals an exception for signalling NaNs, so we need to
 	 handle isgreater, etc. by first checking isordered.  */
@@ -13950,7 +13950,7 @@ rs6000_generate_compare (rtx cmp, machine_mode mode)
 	  /* Test for either value being a NaN.  */
 	  gcc_assert (unord_func);
 	  unord_dest = emit_library_call_value (unord_func, NULL_RTX, LCT_CONST,
-						SImode, op0, mode, op1, mode);
+						SImode, op0, mode, op1, mode, 0);
 
 	  /* Set value (0) if either value is a NaN, and jump to the join
 	     label.  */
@@ -13969,7 +13969,7 @@ rs6000_generate_compare (rtx cmp, machine_mode mode)
 	  /* Do the normal comparison, knowing that the values are not
 	     NaNs.  */
 	  normal_dest = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-						 SImode, op0, mode, op1, mode);
+						 SImode, op0, mode, op1, mode, 0);
 
 	  emit_insn (gen_cstoresi4 (dest,
 				    gen_rtx_fmt_ee (code, SImode, normal_dest,
@@ -14297,7 +14297,7 @@ rs6000_expand_float128_convert (rtx dest, rtx src, bool unsigned_p)
       gcc_assert (libfunc != NULL_RTX);
 
       dest2 = emit_library_call_value (libfunc, dest, LCT_CONST, dest_mode,
-				       src, src_mode);
+				       src, src_mode, 0);
 
       gcc_assert (dest2 != NULL_RTX);
       if (!rtx_equal_p (dest, dest2))
@@ -16658,7 +16658,7 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED)
 #endif
       if (NO_PROFILE_COUNTERS)
 	emit_library_call (init_one_libfunc (RS6000_MCOUNT),
-			   LCT_NORMAL, VOIDmode);
+			   LCT_NORMAL, VOIDmode, 0);
       else
 	{
 	  char buf[30];
@@ -16670,7 +16670,7 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED)
 	  fun = gen_rtx_SYMBOL_REF (Pmode, label_name);
 
 	  emit_library_call (init_one_libfunc (RS6000_MCOUNT),
-			     LCT_NORMAL, VOIDmode, fun, Pmode);
+			     LCT_NORMAL, VOIDmode, fun, Pmode, 0);
 	}
     }
   else if (DEFAULT_ABI == ABI_DARWIN)
@@ -16690,7 +16690,7 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED)
 #endif
       emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mcount_name),
 			 LCT_NORMAL, VOIDmode,
-			 gen_rtx_REG (Pmode, caller_addr_regno), Pmode);
+			 gen_rtx_REG (Pmode, caller_addr_regno), Pmode, 0);
     }
 }
 
@@ -19042,7 +19042,7 @@ rs6000_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
 			 addr, Pmode,
 			 GEN_INT (rs6000_trampoline_size ()), SImode,
 			 fnaddr, Pmode,
-			 ctx_reg, Pmode);
+			 ctx_reg, Pmode, 0);
       break;
     }
 }
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index ad88b6783af..d1197ccbadb 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -8156,7 +8156,7 @@
 	  rtx libfunc = optab_libfunc (neg_optab, <MODE>mode);
 	  rtx target = emit_library_call_value (libfunc, operands[0], LCT_CONST,
 						<MODE>mode,
-						operands[1], <MODE>mode);
+						operands[1], <MODE>mode, 0);
 
 	  if (target && !rtx_equal_p (target, operands[0]))
 	    emit_move_insn (operands[0], target);
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 1fcc1b03096..17805a5b663 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -1627,7 +1627,7 @@
       rtx target = emit_library_call_value (libfunc,
 					    op5, LCT_NORMAL, DImode,
 					    op3, DImode,
-					    op4, DImode);
+					    op4, DImode, 0);
       emit_move_insn (op5, target);
     }
   emit_insn (gen_vsx_extract_v2di (op3, op1, GEN_INT (1)));
@@ -1640,7 +1640,7 @@
       rtx target = emit_library_call_value (libfunc,
 					    op3, LCT_NORMAL, DImode,
 					    op3, DImode,
-					    op4, DImode);
+					    op4, DImode, 0);
       emit_move_insn (op3, target);
     }
   emit_insn (gen_vsx_concat_v2di (op0, op5, op3));
@@ -1674,7 +1674,7 @@
       rtx target = emit_library_call_value (libfunc,
 					    op5, LCT_NORMAL, DImode,
 					    op3, DImode,
-					    op4, DImode);
+					    op4, DImode, 0);
       emit_move_insn (op5, target);
     }
   emit_insn (gen_vsx_extract_v2di (op3, op1, GEN_INT (1)));
@@ -1687,7 +1687,7 @@
       rtx target = emit_library_call_value (libfunc,
 					    op3, LCT_NORMAL, DImode,
 					    op3, DImode,
-					    op4, DImode);
+					    op4, DImode, 0);
       emit_move_insn (op3, target);
     }
   emit_insn (gen_vsx_concat_v2di (op0, op5, op3));
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 84c0ea025b4..9f97317873e 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -10116,7 +10116,7 @@ sh_trampoline_init (rtx tramp_mem, tree fndecl, rtx cxt)
 	  || (!(TARGET_SH4A || TARGET_SH4_300) && TARGET_USERMODE))
 	emit_library_call (function_symbol (NULL, "__ic_invalidate",
 					    FUNCTION_ORDINARY).sym,
-			   LCT_NORMAL, VOIDmode, tramp, SImode);
+			   LCT_NORMAL, VOIDmode, tramp, SImode, 0);
       else
 	emit_insn (gen_ic_invalidate_line (tramp));
     }
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index aefced85fe1..a22033d67a1 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -3667,12 +3667,12 @@ emit_soft_tfmode_libcall (const char *func_name, int nargs, rtx *operands)
       if (nargs == 2)
 	emit_library_call (func_sym, LCT_NORMAL, VOIDmode,
 			   arg[0], GET_MODE (arg[0]),
-			   arg[1], GET_MODE (arg[1]));
+			   arg[1], GET_MODE (arg[1]), 0);
       else
 	emit_library_call (func_sym, LCT_NORMAL, VOIDmode,
 			   arg[0], GET_MODE (arg[0]),
 			   arg[1], GET_MODE (arg[1]),
-			   arg[2], GET_MODE (arg[2]));
+			   arg[2], GET_MODE (arg[2]), 0);
 
       if (ret_slot)
 	emit_move_insn (operands[0], ret_slot);
@@ -3685,7 +3685,7 @@ emit_soft_tfmode_libcall (const char *func_name, int nargs, rtx *operands)
 
       ret = emit_library_call_value (func_sym, operands[0], LCT_NORMAL,
 				     GET_MODE (operands[0]),
-				     arg[1], GET_MODE (arg[1]));
+				     arg[1], GET_MODE (arg[1]), 0);
 
       if (ret != operands[0])
 	emit_move_insn (operands[0], ret);
@@ -8486,7 +8486,7 @@ sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison)
       emit_library_call (libfunc, LCT_NORMAL,
 			 DImode,
 			 XEXP (slot0, 0), Pmode,
-			 XEXP (slot1, 0), Pmode);
+			 XEXP (slot1, 0), Pmode, 0);
       mode = DImode;
     }
   else
@@ -8494,7 +8494,7 @@ sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison)
       libfunc = gen_rtx_SYMBOL_REF (Pmode, qpfunc);
       emit_library_call (libfunc, LCT_NORMAL,
 			 SImode,
-			 x, TFmode, y, TFmode);
+			 x, TFmode, y, TFmode, 0);
       mode = SImode;
     }
 
@@ -9985,7 +9985,7 @@ sparc32_initialize_trampoline (rtx m_tramp, rtx fnaddr, rtx cxt)
      the stack address is accessible.  */
 #ifdef HAVE_ENABLE_EXECUTE_STACK
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-                     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
+                     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode, 0);
 #endif
 
 }
@@ -10032,7 +10032,7 @@ sparc64_initialize_trampoline (rtx m_tramp, rtx fnaddr, rtx cxt)
      the stack address is accessible.  */
 #ifdef HAVE_ENABLE_EXECUTE_STACK
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-                     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
+                     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode, 0);
 #endif
 }
 
@@ -10571,13 +10571,13 @@ sparc_profile_hook (int labelno)
   fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_FUNCTION);
   if (NO_PROFILE_COUNTERS)
     {
-      emit_library_call (fun, LCT_NORMAL, VOIDmode);
+      emit_library_call (fun, LCT_NORMAL, VOIDmode, 0);
     }
   else
     {
       ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
       lab = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
-      emit_library_call (fun, LCT_NORMAL, VOIDmode, lab, Pmode);
+      emit_library_call (fun, LCT_NORMAL, VOIDmode, lab, Pmode, 0);
     }
 }
 \f
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index 92a16551ac0..4e36a80cad9 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -5051,7 +5051,7 @@ tilegx_trampoline_init (rtx m_tramp, tree fndecl, rtx static_chain)
 
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
 		     LCT_NORMAL, VOIDmode, begin_addr, Pmode,
-		     end_addr, Pmode);
+		     end_addr, Pmode, 0);
 }
 
 
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index 540c6356c08..9de7fd79e47 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -4460,7 +4460,7 @@ tilepro_trampoline_init (rtx m_tramp, tree fndecl, rtx static_chain)
 
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
 		     LCT_NORMAL, VOIDmode, begin_addr, Pmode,
-		     end_addr, Pmode);
+		     end_addr, Pmode, 0);
 }
 
 
diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c
index 843a9a5c1da..b80ff5277a5 100644
--- a/gcc/config/visium/visium.c
+++ b/gcc/config/visium/visium.c
@@ -2441,7 +2441,7 @@ expand_block_move_4 (rtx dst, rtx dst_reg, rtx src, rtx src_reg, rtx bytes_rtx)
 		       convert_to_mode (TYPE_MODE (sizetype),
 					GEN_INT (bytes >> 2),
 				        TYPE_UNSIGNED (sizetype)),
-		       TYPE_MODE (sizetype));
+		       TYPE_MODE (sizetype), 0);
   if (rem == 0)
     return;
 
@@ -2477,7 +2477,7 @@ expand_block_move_2 (rtx dst, rtx dst_reg, rtx src, rtx src_reg, rtx bytes_rtx)
 		     convert_to_mode (TYPE_MODE (sizetype),
 				      GEN_INT (bytes >> 1),
 				      TYPE_UNSIGNED (sizetype)),
-		     TYPE_MODE (sizetype));
+		     TYPE_MODE (sizetype), 0);
   if (rem == 0)
     return;
 
@@ -2501,7 +2501,7 @@ expand_block_move_1 (rtx dst_reg, rtx src_reg, rtx bytes_rtx)
 		     convert_to_mode (TYPE_MODE (sizetype),
 				      bytes_rtx,
 				      TYPE_UNSIGNED (sizetype)),
-		     TYPE_MODE (sizetype));
+		     TYPE_MODE (sizetype), 0);
 }
 
 /* Generate a call to a library function to set BYTES_RTX bytes of DST with
@@ -2520,7 +2520,7 @@ expand_block_set_4 (rtx dst, rtx dst_reg, rtx value_rtx, rtx bytes_rtx)
 		     convert_to_mode (TYPE_MODE (sizetype),
 				      GEN_INT (bytes >> 2),
 				      TYPE_UNSIGNED (sizetype)),
-		     TYPE_MODE (sizetype));
+		     TYPE_MODE (sizetype), 0);
   if (rem == 0)
     return;
 
@@ -2566,7 +2566,7 @@ expand_block_set_2 (rtx dst, rtx dst_reg, rtx value_rtx, rtx bytes_rtx)
 		     convert_to_mode (TYPE_MODE (sizetype),
 				      GEN_INT (bytes >> 1),
 				      TYPE_UNSIGNED (sizetype)),
-		     TYPE_MODE (sizetype));
+		     TYPE_MODE (sizetype), 0);
   if (rem == 0)
     return;
 
@@ -2590,7 +2590,7 @@ expand_block_set_1 (rtx dst_reg, rtx value_rtx, rtx bytes_rtx)
 		     convert_to_mode (TYPE_MODE (sizetype),
 				      bytes_rtx,
 				      TYPE_UNSIGNED (sizetype)),
-		     TYPE_MODE (sizetype));
+		     TYPE_MODE (sizetype), 0);
 }
 
 /* Expand string/block move operations.
@@ -2746,7 +2746,7 @@ visium_trampoline_init (rtx m_tramp, tree fndecl, rtx static_chain)
 				 0x04940000));
 
   emit_library_call (set_trampoline_parity_libfunc, LCT_NORMAL, VOIDmode,
-		     addr, SImode);
+		     addr, SImode, 0);
 }
 
 /* Return true if the current function must have and use a frame pointer.  */
@@ -2785,7 +2785,7 @@ visium_profile_hook (void)
 {
   visium_frame_needed = true;
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "mcount"), LCT_NORMAL,
-		     VOIDmode);
+		     VOIDmode, 0);
 }
 
 /* A C expression whose value is RTL representing the address in a stack frame
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 0a5ecd23352..074bd324b20 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1374,7 +1374,7 @@ xtensa_expand_nonlocal_goto (rtx *operands)
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_nonlocal_goto"),
 		     LCT_NORMAL, VOIDmode,
 		     containing_fp, Pmode,
-		     goto_handler, Pmode);
+		     goto_handler, Pmode, 0);
 }
 
 
@@ -1652,7 +1652,7 @@ xtensa_setup_frame_addresses (void)
   if (TARGET_WINDOWED_ABI)
     emit_library_call
       (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_libgcc_window_spill"),
-       LCT_NORMAL, VOIDmode);
+       LCT_NORMAL, VOIDmode, 0);
 }
 
 
@@ -4100,7 +4100,7 @@ xtensa_trampoline_init (rtx m_tramp, tree fndecl, rtx chain)
   emit_move_insn (adjust_address (m_tramp, SImode, chain_off), chain);
   emit_move_insn (adjust_address (m_tramp, SImode, func_off), func);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_sync_caches"),
-		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
+		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode, 0);
 }
 
 /* Implement TARGET_LEGITIMATE_CONSTANT_P.  */
diff --git a/gcc/except.c b/gcc/except.c
index 5df0a4c163d..b2db29ce50e 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1209,7 +1209,7 @@ sjlj_emit_function_enter (rtx_code_label *dispatch_label)
     }
 
   emit_library_call (unwind_sjlj_register_libfunc, LCT_NORMAL, VOIDmode,
-		     XEXP (fc, 0), Pmode);
+		     XEXP (fc, 0), Pmode, 0);
 
   seq = get_insns ();
   end_sequence ();
@@ -1273,7 +1273,7 @@ sjlj_emit_function_exit (void)
   start_sequence ();
 
   emit_library_call (unwind_sjlj_unregister_libfunc, LCT_NORMAL, VOIDmode,
-		     XEXP (crtl->eh.sjlj_fc, 0), Pmode);
+		     XEXP (crtl->eh.sjlj_fc, 0), Pmode, 0);
 
   seq = get_insns ();
   end_sequence ();
diff --git a/gcc/explow.c b/gcc/explow.c
index b838f035870..15ae649c67c 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -1454,7 +1454,7 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
       func = init_one_libfunc ("__morestack_allocate_stack_space");
 
       space = emit_library_call_value (func, target, LCT_NORMAL, Pmode,
-				       ask, Pmode);
+				       ask, Pmode, 0);
 
       if (available_label == NULL_RTX)
 	return space;
@@ -1681,7 +1681,7 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
 					         plus_constant (Pmode,
 								size, first)));
       emit_library_call (stack_check_libfunc, LCT_THROW, VOIDmode,
-			 addr, Pmode);
+			 addr, Pmode, 0);
     }
 
   /* Next see if we have an insn to check the stack.  */
diff --git a/gcc/expmed.c b/gcc/expmed.c
index e7c03fbf92c..a23d9049be0 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -3486,7 +3486,7 @@ expand_mult (machine_mode mode, rtx op0, rtx op1, rtx target,
       else if (CONST_DOUBLE_AS_INT_P (scalar_op1))
 #endif
 	{
-	  int shift = wi::exact_log2 (rtx_mode_t (scalar_op1, mode));
+	  int shift = wi::exact_log2 (rtx_mode_t (scalar_op1, mode, unsignedp));
 	  /* Perfect power of 2 (other than 1, which is handled above).  */
 	  if (shift > 0)
 	    return expand_shift (LSHIFT_EXPR, mode, op0,
@@ -4199,7 +4199,7 @@ expand_divmod (int rem_flag, enum tree_code code, machine_mode mode,
   op1_is_constant = CONST_INT_P (op1);
   if (op1_is_constant)
     {
-      wide_int ext_op1 = rtx_mode_t (op1, mode);
+      wide_int ext_op1 = rtx_mode_t (op1, mode, unsignedp);
       op1_is_pow2 = (wi::popcount (ext_op1) == 1
 		     || (! unsignedp
 			 && wi::popcount (wi::neg (ext_op1)) == 1));
@@ -4341,7 +4341,7 @@ expand_divmod (int rem_flag, enum tree_code code, machine_mode mode,
       op1_is_constant = CONST_INT_P (op1);
       if (op1_is_constant)
 	{
-	  wide_int ext_op1 = rtx_mode_t (op1, compute_mode);
+	  wide_int ext_op1 = rtx_mode_t (op1, compute_mode, unsignedp);
 	  op1_is_pow2 = (wi::popcount (ext_op1) == 1
 			 || (! unsignedp
 			     && wi::popcount (wi::neg (ext_op1)) == 1));
@@ -4389,7 +4389,7 @@ expand_divmod (int rem_flag, enum tree_code code, machine_mode mode,
 		unsigned HOST_WIDE_INT mh, ml;
 		int pre_shift, post_shift;
 		int dummy;
-		wide_int wd = rtx_mode_t (op1, int_mode);
+		wide_int wd = rtx_mode_t (op1, int_mode, unsignedp);
 		unsigned HOST_WIDE_INT d = wd.to_uhwi ();
 
 		if (wi::popcount (wd) == 1)
diff --git a/gcc/expr.c b/gcc/expr.c
index b97c217e86d..af4f9567d51 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -353,7 +353,7 @@ convert_mode_scalar (rtx to, rtx from, int unsignedp)
 
       start_sequence ();
       value = emit_library_call_value (libcall, NULL_RTX, LCT_CONST, to_mode,
-				       from, from_mode);
+				       from, from_mode, unsignedp);
       insns = get_insns ();
       end_sequence ();
       emit_libcall_block (insns, to, value,
@@ -703,7 +703,7 @@ convert_modes (machine_mode mode, machine_mode oldmode, rtx x, int unsignedp)
 	 assume that all the bits are significant.  */
       if (GET_MODE_CLASS (oldmode) != MODE_INT)
 	oldmode = MAX_MODE_INT;
-      wide_int w = wide_int::from (rtx_mode_t (x, oldmode),
+      wide_int w = wide_int::from (rtx_mode_t (x, oldmode, unsignedp),
 				   GET_MODE_PRECISION (int_mode),
 				   unsignedp ? UNSIGNED : SIGNED);
       return immed_wide_int_const (w, int_mode);
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 8dd351286cd..a731e2633dc 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1830,7 +1830,7 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
 	 if the libcall is cse'd or moved.  */
       value = emit_library_call_value (libfunc,
 				       NULL_RTX, LCT_CONST, mode,
-				       op0, mode, op1x, op1_mode);
+				       op0, mode, op1x, op1_mode, unsignedp);
 
       insns = get_insns ();
       end_sequence ();
@@ -2167,7 +2167,7 @@ expand_twoval_binop_libfunc (optab binoptab, rtx op0, rtx op1,
   libval = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
 				    libval_mode,
 				    op0, mode,
-				    op1, mode);
+				    op1, mode, 0);
   /* Get the part of VAL containing the value that we want.  */
   libval = simplify_gen_subreg (mode, libval, libval_mode,
 				targ0 ? 0 : GET_MODE_SIZE (mode));
@@ -3054,7 +3054,7 @@ expand_unop (machine_mode mode, optab unoptab, rtx op0, rtx target,
       /* Pass 1 for NO_QUEUE so we don't lose any increments
 	 if the libcall is cse'd or moved.  */
       value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, outmode,
-				       op0, mode);
+				       op0, mode, unsignedp);
       insns = get_insns ();
       end_sequence ();
 
@@ -4041,7 +4041,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size,
 
       ret_mode = targetm.libgcc_cmp_return_mode ();
       result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-					ret_mode, x, mode, y, mode);
+					ret_mode, x, mode, y, mode, unsignedp);
 
       /* There are two kinds of comparison routines. Biased routines
 	 return 0/1/2, and unbiased routines return -1/0/1. Other parts
@@ -4293,7 +4293,7 @@ prepare_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison,
 
   start_sequence ();
   value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-				   cmp_mode, x, mode, y, mode);
+				   cmp_mode, x, mode, y, mode, 0);
   insns = get_insns ();
   end_sequence ();
 
@@ -4935,7 +4935,7 @@ expand_float (rtx to, rtx from, int unsignedp)
       start_sequence ();
 
       value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-				       GET_MODE (to), from, GET_MODE (from));
+				       GET_MODE (to), from, GET_MODE (from), unsignedp);
       insns = get_insns ();
       end_sequence ();
 
@@ -5127,7 +5127,7 @@ expand_fix (rtx to, rtx from, int unsignedp)
       start_sequence ();
 
       value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-				       GET_MODE (to), from, GET_MODE (from));
+				       GET_MODE (to), from, GET_MODE (from), unsignedp);
       insns = get_insns ();
       end_sequence ();
 
@@ -5219,7 +5219,7 @@ expand_fixed_convert (rtx to, rtx from, int uintp, int satp)
 
   start_sequence ();
   value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, to_mode,
-				   from, from_mode);
+				   from, from_mode, uintp);
   insns = get_insns ();
   end_sequence ();
 
@@ -6205,7 +6205,7 @@ maybe_emit_sync_lock_test_and_set (rtx target, rtx mem, rtx val,
 	  addr = convert_memory_address (ptr_mode, XEXP (mem, 0));
 	  return emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
 					  mode, addr, ptr_mode,
-					  val, mode);
+					  val, mode, 0);
 	}
     }
 
@@ -6513,7 +6513,7 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval,
       rtx addr = convert_memory_address (ptr_mode, XEXP (mem, 0));
       rtx target = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
 					    mode, addr, ptr_mode,
-					    expected, mode, desired, mode);
+					    expected, mode, desired, mode, 0);
       emit_move_insn (target_oval, target);
 
       /* Compute the boolean return value only if requested.  */
@@ -6584,7 +6584,7 @@ expand_mem_thread_fence (enum memmodel model)
   else if (targetm.have_memory_barrier ())
     emit_insn (targetm.gen_memory_barrier ());
   else if (synchronize_libfunc != NULL_RTX)
-    emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode);
+    emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0);
   else
     expand_memory_blockage ();
 }
@@ -7100,7 +7100,7 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
 	{
 	  rtx addr = convert_memory_address (ptr_mode, XEXP (mem, 0));
 	  result = emit_library_call_value (libfunc, NULL, LCT_NORMAL, mode,
-					    addr, ptr_mode, val, mode);
+					    addr, ptr_mode, val, mode, 0);
 
 	  if (!unused_result && fixup)
 	    result = expand_simple_binop (mode, code, result, val, target,
diff --git a/gcc/rtl.h b/gcc/rtl.h
index eb12d61e140..58441af4ac7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2237,10 +2237,27 @@ struct address_info {
   enum rtx_code base_outer_code;
 };
 
-/* This is used to bundle an rtx and a mode together so that the pair
+template<typename T1, typename T2, typename T3>
+struct Tuple
+  {
+   T1 first;
+   T2 second;
+   T3 third;
+   Tuple(T1 f, T2 s, T3 t=0)
+   {
+    first = f;
+    second = s;
+    third = t;
+   }
+  };
+
+/* This is used to bundle an rtx, a mode and unsigned_p 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 std::pair <rtx, machine_mode> rtx_mode_t;
+typedef Tuple <rtx, machine_mode, int> rtx_mode_t;
+#define GET_FIRST(x) x.first
+#define GET_SECOND(x) x.second
+#define GET_THIRD(x) x.third
 
 namespace wi
 {
@@ -2261,7 +2278,7 @@ namespace wi
 inline unsigned int
 wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
 {
-  return GET_MODE_PRECISION (as_a <scalar_mode> (x.second));
+  return GET_MODE_PRECISION (as_a <scalar_mode> (GET_SECOND(x)));
 }
 
 inline wi::storage_ref
@@ -2270,25 +2287,25 @@ wi::int_traits <rtx_mode_t>::decompose (HOST_WIDE_INT *,
 					const rtx_mode_t &x)
 {
   gcc_checking_assert (precision == get_precision (x));
-  switch (GET_CODE (x.first))
+  switch (GET_CODE (GET_FIRST(x)))
     {
     case CONST_INT:
       if (precision < HOST_BITS_PER_WIDE_INT)
 	/* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
 	   targets is 1 rather than -1.  */
-	gcc_checking_assert (INTVAL (x.first)
-			     == sext_hwi (INTVAL (x.first), precision)
-			     || (x.second == BImode && INTVAL (x.first) == 1));
+	gcc_checking_assert (INTVAL (GET_FIRST(x))
+			     == sext_hwi (INTVAL (GET_FIRST(x)), precision)
+			     || (GET_SECOND(x) == BImode && INTVAL (GET_FIRST(x)) == 1));
 
-      return wi::storage_ref (&INTVAL (x.first), 1, precision);
+      return wi::storage_ref (&INTVAL (GET_FIRST(x)), 1, precision);
 
     case CONST_WIDE_INT:
-      return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0),
-			      CONST_WIDE_INT_NUNITS (x.first), precision);
+      return wi::storage_ref (&CONST_WIDE_INT_ELT (GET_FIRST(x), 0),
+			      CONST_WIDE_INT_NUNITS (GET_FIRST(x)), precision);
 
 #if TARGET_SUPPORTS_WIDE_INT == 0
     case CONST_DOUBLE:
-      return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision);
+      return wi::storage_ref (&CONST_DOUBLE_LOW (GET_FIRST(x)), 2, precision);
 #endif
 
     default:
@@ -4168,27 +4185,28 @@ extern rtx emit_library_call_value_1 (int, rtx, rtx, enum libcall_type,
    of arguments.  In each case the argument value is followed by its mode.  */
 
 inline void
-emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode)
+emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode, int)
 {
   emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 0, NULL);
 }
 
 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, int unsignedp)
 {
-  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
+  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode, unsignedp) };
   emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 1, args);
 }
 
 inline void
 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
 		   rtx arg1, machine_mode arg1_mode,
-		   rtx arg2, machine_mode arg2_mode)
+		   rtx arg2, machine_mode arg2_mode,
+                   int unsignedp)
 {
   rtx_mode_t args[] = {
-    rtx_mode_t (arg1, arg1_mode),
-    rtx_mode_t (arg2, arg2_mode)
+    rtx_mode_t (arg1, arg1_mode, unsignedp),
+    rtx_mode_t (arg2, arg2_mode, unsignedp)
   };
   emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 2, args);
 }
@@ -4197,12 +4215,13 @@ inline void
 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
 		   rtx arg1, machine_mode arg1_mode,
 		   rtx arg2, machine_mode arg2_mode,
-		   rtx arg3, machine_mode arg3_mode)
+		   rtx arg3, machine_mode arg3_mode,
+                   int unsignedp)
 {
   rtx_mode_t args[] = {
-    rtx_mode_t (arg1, arg1_mode),
-    rtx_mode_t (arg2, arg2_mode),
-    rtx_mode_t (arg3, arg3_mode)
+    rtx_mode_t (arg1, arg1_mode, unsignedp),
+    rtx_mode_t (arg2, arg2_mode, unsignedp),
+    rtx_mode_t (arg3, arg3_mode, unsignedp)
   };
   emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 3, args);
 }
@@ -4212,13 +4231,14 @@ emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
 		   rtx arg1, machine_mode arg1_mode,
 		   rtx arg2, machine_mode arg2_mode,
 		   rtx arg3, machine_mode arg3_mode,
-		   rtx arg4, machine_mode arg4_mode)
+		   rtx arg4, machine_mode arg4_mode,
+                   int unsignedp)
 {
   rtx_mode_t args[] = {
-    rtx_mode_t (arg1, arg1_mode),
-    rtx_mode_t (arg2, arg2_mode),
-    rtx_mode_t (arg3, arg3_mode),
-    rtx_mode_t (arg4, arg4_mode)
+    rtx_mode_t (arg1, arg1_mode, unsignedp),
+    rtx_mode_t (arg2, arg2_mode, unsignedp),
+    rtx_mode_t (arg3, arg3_mode, unsignedp),
+    rtx_mode_t (arg4, arg4_mode, unsignedp)
   };
   emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 4, args);
 }
@@ -4229,7 +4249,7 @@ emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
 
 inline rtx
 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
-			 machine_mode outmode)
+			 machine_mode outmode, int)
 {
   return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 0, NULL);
 }
@@ -4237,9 +4257,10 @@ 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,
+                         int unsignedp)
 {
-  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
+  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode, unsignedp) };
   return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 1, args);
 }
 
@@ -4247,11 +4268,12 @@ inline rtx
 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
 			 machine_mode outmode,
 			 rtx arg1, machine_mode arg1_mode,
-			 rtx arg2, machine_mode arg2_mode)
+			 rtx arg2, machine_mode arg2_mode,
+                         int unsignedp)
 {
   rtx_mode_t args[] = {
-    rtx_mode_t (arg1, arg1_mode),
-    rtx_mode_t (arg2, arg2_mode)
+    rtx_mode_t (arg1, arg1_mode, unsignedp),
+    rtx_mode_t (arg2, arg2_mode, unsignedp)
   };
   return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 2, args);
 }
@@ -4261,12 +4283,13 @@ emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
 			 machine_mode outmode,
 			 rtx arg1, machine_mode arg1_mode,
 			 rtx arg2, machine_mode arg2_mode,
-			 rtx arg3, machine_mode arg3_mode)
+			 rtx arg3, machine_mode arg3_mode,
+                         int unsignedp)
 {
   rtx_mode_t args[] = {
-    rtx_mode_t (arg1, arg1_mode),
-    rtx_mode_t (arg2, arg2_mode),
-    rtx_mode_t (arg3, arg3_mode)
+    rtx_mode_t (arg1, arg1_mode, unsignedp),
+    rtx_mode_t (arg2, arg2_mode, unsignedp),
+    rtx_mode_t (arg3, arg3_mode, unsignedp)
   };
   return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 3, args);
 }
@@ -4277,13 +4300,14 @@ emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
 			 rtx arg1, machine_mode arg1_mode,
 			 rtx arg2, machine_mode arg2_mode,
 			 rtx arg3, machine_mode arg3_mode,
-			 rtx arg4, machine_mode arg4_mode)
+			 rtx arg4, machine_mode arg4_mode,
+                         int unsignedp)
 {
   rtx_mode_t args[] = {
-    rtx_mode_t (arg1, arg1_mode),
-    rtx_mode_t (arg2, arg2_mode),
-    rtx_mode_t (arg3, arg3_mode),
-    rtx_mode_t (arg4, arg4_mode)
+    rtx_mode_t (arg1, arg1_mode, unsignedp),
+    rtx_mode_t (arg2, arg2_mode, unsignedp),
+    rtx_mode_t (arg3, arg3_mode, unsignedp),
+    rtx_mode_t (arg4, arg4_mode, unsignedp)
   };
   return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 4, args);
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/pr88877.c b/gcc/testsuite/gcc.target/powerpc/pr88877.c
new file mode 100644
index 00000000000..0bc69c4be0f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr88877.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { powerpc64*-*-* } } } */
+/* { dg-options "-msoft-float -m64" } */
+/* { dg-final { scan-assembler "lwz" } } */
+/* { dg-final { scan-assembler-not "lwa" } } */
+
+void foo(){
+unsigned int x=-1;
+double d=x;
+}

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-03-23 14:46 [PATCH][PPC64] [PR88877] kamlesh kumar
@ 2020-03-24 17:13 ` Hans-Peter Nilsson
  2020-03-24 17:24   ` Hans-Peter Nilsson
  2020-04-06  6:16 ` kamlesh kumar
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 28+ messages in thread
From: Hans-Peter Nilsson @ 2020-03-24 17:13 UTC (permalink / raw)
  To: kamlesh kumar; +Cc: gcc-patches

Please excuse some cheap points:

On Mon, 23 Mar 2020, kamlesh kumar via Gcc-patches wrote:

> Attached patch fixes.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877.
> ChangeLog Entry.
>
> 2020-03-23  Kamlesh Kumar  <kamleshbhalui@gmail.com>
>
>         * rtl.h : Defined Tuple for bundling rtx, mode and
> unsignedness default as 0
>         Added Extra argument (unsignedp) in emit_library_call and
> emit_library_call_value.

Formatting issue: "." ends sentences, but you should not
terminate the line.  No space before ":".  See other entries.

>         * except.c : Likewise.
>         * explow.c : Likewise.
>         * expmed.c : Likewise.
>         * expr.c : Likewise.
>         * optabs.c : Likewise.
>         * asan.c : Likewise.
>         * builtins.c : Likewise.
>         * calls.c : Likewise.
>         * cfgexpand.c : Likewise.
>         * config/aarch64/aarch64.c : Likewise.
>         * config/aarch64/aarch64.h : Likewise.
>         * config/aarch64/atomics.md : Likewise.
>         * config/alpha/alpha.c : Likewise.
>         * config/arc/arc.c : Likewise.

...

The new argument is default 0, so make use of that: do not patch
all those files where 0 is fine.

brgds, H-P

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-03-24 17:13 ` Hans-Peter Nilsson
@ 2020-03-24 17:24   ` Hans-Peter Nilsson
  2020-03-24 17:54     ` kamlesh kumar
  0 siblings, 1 reply; 28+ messages in thread
From: Hans-Peter Nilsson @ 2020-03-24 17:24 UTC (permalink / raw)
  To: kamlesh kumar; +Cc: gcc-patches


On Tue, 24 Mar 2020, Hans-Peter Nilsson wrote:
> The new argument is default 0, so make use of that: do not patch
> all those files where 0 is fine.

Oops, I was tricked by the comment; it's not actually "default 0"
in the C++ sense.  And you have an overloaded function with
different numbers of parameters; I don't know if you can get
away cheaper than all those files you patched.  Sorry for the
noise in that part; the ChangeLog formatting comment still
applies.

brgds, H-P

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-03-24 17:24   ` Hans-Peter Nilsson
@ 2020-03-24 17:54     ` kamlesh kumar
  0 siblings, 0 replies; 28+ messages in thread
From: kamlesh kumar @ 2020-03-24 17:54 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

Thanks Hans-Peter for reviewing.
Here is Formatted ChangeLog Entry.

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

* rtl.h: Defined Tuple for bundling rtx, mode and unsignedness
(default as 0), Added Extra argument (unsignedp)
in emit_library_call and emit_library_call_value.
* except.c: Likewise.
* explow.c: Likewise.
* expmed.c: Likewise.
* expr.c: Likewise.
* optabs.c: Likewise.
* asan.c: Likewise.
* builtins.c: Likewise.
* calls.c: Likewise.
* cfgexpand.c: Likewise.
* config/aarch64/aarch64.c: Likewise.
* config/aarch64/aarch64.h: Likewise.
* config/aarch64/atomics.md: Likewise.
* config/alpha/alpha.c: Likewise.
* config/arc/arc.c: Likewise.
* config/arc/elf.h: Likewise.
* config/arc/linux.h: Likewise.
* config/arm/arm.c: Likewise.
* config/bfin/bfin.md: Likewise.
* config/c6x/c6x.c: Likewise.
* config/csky/csky.c: Likewise.
* config/frv/frv.c: Likewise.
* config/i386/i386-expand.c: Likewise.
* config/i386/i386.c: Likewise.
* config/ia64/ia64.c: Likewise.
* config/ia64/ia64.md: Likewise.
* config/m32r/m32r.c: Likewise.
* config/m68k/linux.h: Likewise.
* config/m68k/m68k.c: Likewise.
* config/microblaze/microblaze.c: Likewise.
* config/mips/mips.h: Likewise.
* config/mips/sdemtk.h: Likewise.
* config/nds32/nds32.h: Likewise.
* config/nios2/nios2.c: Likewise.
* config/or1k/or1k.c: Likewise.
* config/pa/pa.c: Likewise.
* config/pa/pa.md: Likewise.
* config/pru/pru.c: Likewise.
* config/riscv/riscv.h: Likewise.
* config/riscv/riscv.md: Likewise.
* config/rl78/rl78.c: Likewise.
* config/rs6000/rs6000-string.c: Likewise.
* config/rs6000/rs6000.c: Likewise.
* config/rs6000/rs6000.md: Likewise.
* config/rs6000/vsx.md: Likewise.
* config/sh/sh.c: Likewise.
* config/sparc/sparc.c: Likewise.
* config/tilegx/tilegx.c: Likewise.
* config/tilepro/tilepro.c: Likewise.
* config/visium/visium.c: Likewise.
* config/xtensa/xtensa.c: Likewise.
* testsuite/gcc.target/powerpc/pr88877.c: Newtest

./kamlesh


On Tue, Mar 24, 2020 at 10:54 PM Hans-Peter Nilsson <hp@bitrange.com> wrote:
>
>
> On Tue, 24 Mar 2020, Hans-Peter Nilsson wrote:
> > The new argument is default 0, so make use of that: do not patch
> > all those files where 0 is fine.
>
> Oops, I was tricked by the comment; it's not actually "default 0"
> in the C++ sense.  And you have an overloaded function with
> different numbers of parameters; I don't know if you can get
> away cheaper than all those files you patched.  Sorry for the
> noise in that part; the ChangeLog formatting comment still
> applies.
>
> brgds, H-P

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-03-23 14:46 [PATCH][PPC64] [PR88877] kamlesh kumar
  2020-03-24 17:13 ` Hans-Peter Nilsson
@ 2020-04-06  6:16 ` kamlesh kumar
  2020-04-06  9:17   ` Richard Biener
  2020-04-07 21:02   ` Segher Boessenkool
  2020-05-23 14:43 ` Segher Boessenkool
  2020-06-13 10:27 ` [PATCH] Defined libcall_arg_t Kamlesh Kumar
  3 siblings, 2 replies; 28+ messages in thread
From: kamlesh kumar @ 2020-04-06  6:16 UTC (permalink / raw)
  To: gcc-patches, Segher Boessenkool, jakub, rguenth

Segher,
Please provide your suggestion/thought on the fix.

On Mon, Mar 23, 2020 at 8:16 PM kamlesh kumar <kamleshbhalui@gmail.com> wrote:
>
> Attached patch fixes.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877.
> ChangeLog Entry.
>
> 2020-03-23  Kamlesh Kumar  <kamleshbhalui@gmail.com>
>
>         * rtl.h : Defined Tuple for bundling rtx, mode and
> unsignedness default as 0
>         Added Extra argument (unsignedp) in emit_library_call and
> emit_library_call_value.
>         * except.c : Likewise.
>         * explow.c : Likewise.
>         * expmed.c : Likewise.
>         * expr.c : Likewise.
>         * optabs.c : Likewise.
>         * asan.c : Likewise.
>         * builtins.c : Likewise.
>         * calls.c : Likewise.
>         * cfgexpand.c : Likewise.
>         * config/aarch64/aarch64.c : Likewise.
>         * config/aarch64/aarch64.h : Likewise.
>         * config/aarch64/atomics.md : Likewise.
>         * config/alpha/alpha.c : Likewise.
>         * config/arc/arc.c : Likewise.
>         * config/arc/elf.h : Likewise.
>         * config/arc/linux.h : Likewise.
>         * config/arm/arm.c : Likewise.
>         * config/bfin/bfin.md : Likewise.
>         * config/c6x/c6x.c : Likewise.
>         * config/csky/csky.c : Likewise.
>         * config/frv/frv.c : Likewise.
>         * config/i386/i386-expand.c : Likewise.
>         * config/i386/i386.c : Likewise.
>         * config/ia64/ia64.c : Likewise.
>         * config/ia64/ia64.md : Likewise.
>         * config/m32r/m32r.c : Likewise.
>         * config/m68k/linux.h : Likewise.
>         * config/m68k/m68k.c : Likewise.
>         * config/microblaze/microblaze.c : Likewise.
>         * config/mips/mips.h : Likewise.
>         * config/mips/sdemtk.h : Likewise.
>         * config/nds32/nds32.h : Likewise.
>         * config/nios2/nios2.c : Likewise.
>         * config/or1k/or1k.c : Likewise.
>         * config/pa/pa.c : Likewise.
>         * config/pa/pa.md : Likewise.
>         * config/pru/pru.c : Likewise.
>         * config/riscv/riscv.h : Likewise.
>         * config/riscv/riscv.md : Likewise.
>         * config/rl78/rl78.c : Likewise.
>         * config/rs6000/rs6000-string.c : Likewise.
>         * config/rs6000/rs6000.c : Likewise.
>         * config/rs6000/rs6000.md : Likewise.
>         * config/rs6000/vsx.md : Likewise.
>         * config/sh/sh.c : Likewise.
>         * config/sparc/sparc.c : Likewise.
>         * config/tilegx/tilegx.c : Likewise.
>         * config/tilepro/tilepro.c : Likewise.
>         * config/visium/visium.c : Likewise.
>         * config/xtensa/xtensa.c : Likewise.
>         * testsuite/gcc.target/powerpc/pr88877.c : Newtest

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-04-06  6:16 ` kamlesh kumar
@ 2020-04-06  9:17   ` Richard Biener
  2020-04-06  9:28     ` kamlesh kumar
  2020-04-07 21:02   ` Segher Boessenkool
  1 sibling, 1 reply; 28+ messages in thread
From: Richard Biener @ 2020-04-06  9:17 UTC (permalink / raw)
  To: kamlesh kumar; +Cc: gcc-patches, Segher Boessenkool, Jakub Jelinek

On Mon, 6 Apr 2020, kamlesh kumar wrote:

> Segher,
> Please provide your suggestion/thought on the fix.

There is not a single line of explanation what the change does so what
do you expect?

Richard.

> On Mon, Mar 23, 2020 at 8:16 PM kamlesh kumar <kamleshbhalui@gmail.com> wrote:
> >
> > Attached patch fixes.
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877.
> > ChangeLog Entry.
> >
> > 2020-03-23  Kamlesh Kumar  <kamleshbhalui@gmail.com>
> >
> >         * rtl.h : Defined Tuple for bundling rtx, mode and
> > unsignedness default as 0
> >         Added Extra argument (unsignedp) in emit_library_call and
> > emit_library_call_value.
> >         * except.c : Likewise.
> >         * explow.c : Likewise.
> >         * expmed.c : Likewise.
> >         * expr.c : Likewise.
> >         * optabs.c : Likewise.
> >         * asan.c : Likewise.
> >         * builtins.c : Likewise.
> >         * calls.c : Likewise.
> >         * cfgexpand.c : Likewise.
> >         * config/aarch64/aarch64.c : Likewise.
> >         * config/aarch64/aarch64.h : Likewise.
> >         * config/aarch64/atomics.md : Likewise.
> >         * config/alpha/alpha.c : Likewise.
> >         * config/arc/arc.c : Likewise.
> >         * config/arc/elf.h : Likewise.
> >         * config/arc/linux.h : Likewise.
> >         * config/arm/arm.c : Likewise.
> >         * config/bfin/bfin.md : Likewise.
> >         * config/c6x/c6x.c : Likewise.
> >         * config/csky/csky.c : Likewise.
> >         * config/frv/frv.c : Likewise.
> >         * config/i386/i386-expand.c : Likewise.
> >         * config/i386/i386.c : Likewise.
> >         * config/ia64/ia64.c : Likewise.
> >         * config/ia64/ia64.md : Likewise.
> >         * config/m32r/m32r.c : Likewise.
> >         * config/m68k/linux.h : Likewise.
> >         * config/m68k/m68k.c : Likewise.
> >         * config/microblaze/microblaze.c : Likewise.
> >         * config/mips/mips.h : Likewise.
> >         * config/mips/sdemtk.h : Likewise.
> >         * config/nds32/nds32.h : Likewise.
> >         * config/nios2/nios2.c : Likewise.
> >         * config/or1k/or1k.c : Likewise.
> >         * config/pa/pa.c : Likewise.
> >         * config/pa/pa.md : Likewise.
> >         * config/pru/pru.c : Likewise.
> >         * config/riscv/riscv.h : Likewise.
> >         * config/riscv/riscv.md : Likewise.
> >         * config/rl78/rl78.c : Likewise.
> >         * config/rs6000/rs6000-string.c : Likewise.
> >         * config/rs6000/rs6000.c : Likewise.
> >         * config/rs6000/rs6000.md : Likewise.
> >         * config/rs6000/vsx.md : Likewise.
> >         * config/sh/sh.c : Likewise.
> >         * config/sparc/sparc.c : Likewise.
> >         * config/tilegx/tilegx.c : Likewise.
> >         * config/tilepro/tilepro.c : Likewise.
> >         * config/visium/visium.c : Likewise.
> >         * config/xtensa/xtensa.c : Likewise.
> >         * testsuite/gcc.target/powerpc/pr88877.c : Newtest
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-04-06  9:17   ` Richard Biener
@ 2020-04-06  9:28     ` kamlesh kumar
  2020-04-08 15:58       ` Jeff Law
  0 siblings, 1 reply; 28+ messages in thread
From: kamlesh kumar @ 2020-04-06  9:28 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, Segher Boessenkool, Jakub Jelinek

Hi Richard,
Here is a discussion we did some time ago
https://gcc.gnu.org/pipermail/gcc/2019-January/227834.html
please see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 for more
info regarding the bug.

We incorporated below Jakub's suggestion in this patch.

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.
Jakub
""

On Mon, Apr 6, 2020 at 2:47 PM Richard Biener <rguenther@suse.de> wrote:
>
> On Mon, 6 Apr 2020, kamlesh kumar wrote:
>
> > Segher,
> > Please provide your suggestion/thought on the fix.
>
> There is not a single line of explanation what the change does so what
> do you expect?
>
> Richard.
>
> > On Mon, Mar 23, 2020 at 8:16 PM kamlesh kumar <kamleshbhalui@gmail.com> wrote:
> > >
> > > Attached patch fixes.
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877.
> > > ChangeLog Entry.
> > >
> > > 2020-03-23  Kamlesh Kumar  <kamleshbhalui@gmail.com>
> > >
> > >         * rtl.h : Defined Tuple for bundling rtx, mode and
> > > unsignedness default as 0
> > >         Added Extra argument (unsignedp) in emit_library_call and
> > > emit_library_call_value.
> > >         * except.c : Likewise.
> > >         * explow.c : Likewise.
> > >         * expmed.c : Likewise.
> > >         * expr.c : Likewise.
> > >         * optabs.c : Likewise.
> > >         * asan.c : Likewise.
> > >         * builtins.c : Likewise.
> > >         * calls.c : Likewise.
> > >         * cfgexpand.c : Likewise.
> > >         * config/aarch64/aarch64.c : Likewise.
> > >         * config/aarch64/aarch64.h : Likewise.
> > >         * config/aarch64/atomics.md : Likewise.
> > >         * config/alpha/alpha.c : Likewise.
> > >         * config/arc/arc.c : Likewise.
> > >         * config/arc/elf.h : Likewise.
> > >         * config/arc/linux.h : Likewise.
> > >         * config/arm/arm.c : Likewise.
> > >         * config/bfin/bfin.md : Likewise.
> > >         * config/c6x/c6x.c : Likewise.
> > >         * config/csky/csky.c : Likewise.
> > >         * config/frv/frv.c : Likewise.
> > >         * config/i386/i386-expand.c : Likewise.
> > >         * config/i386/i386.c : Likewise.
> > >         * config/ia64/ia64.c : Likewise.
> > >         * config/ia64/ia64.md : Likewise.
> > >         * config/m32r/m32r.c : Likewise.
> > >         * config/m68k/linux.h : Likewise.
> > >         * config/m68k/m68k.c : Likewise.
> > >         * config/microblaze/microblaze.c : Likewise.
> > >         * config/mips/mips.h : Likewise.
> > >         * config/mips/sdemtk.h : Likewise.
> > >         * config/nds32/nds32.h : Likewise.
> > >         * config/nios2/nios2.c : Likewise.
> > >         * config/or1k/or1k.c : Likewise.
> > >         * config/pa/pa.c : Likewise.
> > >         * config/pa/pa.md : Likewise.
> > >         * config/pru/pru.c : Likewise.
> > >         * config/riscv/riscv.h : Likewise.
> > >         * config/riscv/riscv.md : Likewise.
> > >         * config/rl78/rl78.c : Likewise.
> > >         * config/rs6000/rs6000-string.c : Likewise.
> > >         * config/rs6000/rs6000.c : Likewise.
> > >         * config/rs6000/rs6000.md : Likewise.
> > >         * config/rs6000/vsx.md : Likewise.
> > >         * config/sh/sh.c : Likewise.
> > >         * config/sparc/sparc.c : Likewise.
> > >         * config/tilegx/tilegx.c : Likewise.
> > >         * config/tilepro/tilepro.c : Likewise.
> > >         * config/visium/visium.c : Likewise.
> > >         * config/xtensa/xtensa.c : Likewise.
> > >         * testsuite/gcc.target/powerpc/pr88877.c : Newtest
> >
>
> --
> Richard Biener <rguenther@suse.de>
> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
> Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-04-06  6:16 ` kamlesh kumar
  2020-04-06  9:17   ` Richard Biener
@ 2020-04-07 21:02   ` Segher Boessenkool
  1 sibling, 0 replies; 28+ messages in thread
From: Segher Boessenkool @ 2020-04-07 21:02 UTC (permalink / raw)
  To: kamlesh kumar; +Cc: gcc-patches, jakub, rguenth

On Mon, Apr 06, 2020 at 11:46:17AM +0530, kamlesh kumar wrote:
> Segher,
> Please provide your suggestion/thought on the fix.

Why me?

I cannot approve almost all of this patch.  It is huge.  It is stage 1
so patches like this should not be submitted at all now (you can ask for
people to look at it, etc., but you didn't).


Segher

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-04-06  9:28     ` kamlesh kumar
@ 2020-04-08 15:58       ` Jeff Law
  2020-05-19 12:02         ` kamlesh kumar
  0 siblings, 1 reply; 28+ messages in thread
From: Jeff Law @ 2020-04-08 15:58 UTC (permalink / raw)
  To: kamlesh kumar, Richard Biener
  Cc: Jakub Jelinek, gcc-patches, Segher Boessenkool

On Mon, 2020-04-06 at 14:58 +0530, kamlesh kumar via Gcc-patches wrote:
> Hi Richard,
> Here is a discussion we did some time ago
> https://gcc.gnu.org/pipermail/gcc/2019-January/227834.html
> please see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 for more
> info regarding the bug.
> 
> We incorporated below Jakub's suggestion in this patch.
> 
> 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.
> Jakub
> ""
I think you're generally on the right track here, but I'm deferring this to gcc11
(other maintainers are, of course, welcome to push it for gcc10 as it's a code
correctness issue).

Jeff
> 


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-04-08 15:58       ` Jeff Law
@ 2020-05-19 12:02         ` kamlesh kumar
  2020-05-22 15:18           ` kamlesh kumar
  0 siblings, 1 reply; 28+ messages in thread
From: kamlesh kumar @ 2020-05-19 12:02 UTC (permalink / raw)
  To: law; +Cc: Richard Biener, Jakub Jelinek, gcc-patches List, Segher Boessenkool

can someone look at the patch, please?


On Wed, Apr 8, 2020 at 9:29 PM Jeff Law <law@redhat.com> wrote:

> On Mon, 2020-04-06 at 14:58 +0530, kamlesh kumar via Gcc-patches wrote:
> > Hi Richard,
> > Here is a discussion we did some time ago
> > https://gcc.gnu.org/pipermail/gcc/2019-January/227834.html
> > please see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 for more
> > info regarding the bug.
> >
> > We incorporated below Jakub's suggestion in this patch.
> >
> > 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.
> > Jakub
> > ""
> I think you're generally on the right track here, but I'm deferring this
> to gcc11
> (other maintainers are, of course, welcome to push it for gcc10 as it's a
> code
> correctness issue).
>
> Jeff
> >
>
>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-05-19 12:02         ` kamlesh kumar
@ 2020-05-22 15:18           ` kamlesh kumar
  0 siblings, 0 replies; 28+ messages in thread
From: kamlesh kumar @ 2020-05-22 15:18 UTC (permalink / raw)
  To: law; +Cc: Richard Biener, Jakub Jelinek, gcc-patches List, Segher Boessenkool

ping?

On Tue, May 19, 2020 at 5:32 PM kamlesh kumar <kamleshbhalui@gmail.com>
wrote:

> can someone look at the patch, please?
>
>
> On Wed, Apr 8, 2020 at 9:29 PM Jeff Law <law@redhat.com> wrote:
>
>> On Mon, 2020-04-06 at 14:58 +0530, kamlesh kumar via Gcc-patches wrote:
>> > Hi Richard,
>> > Here is a discussion we did some time ago
>> > https://gcc.gnu.org/pipermail/gcc/2019-January/227834.html
>> > please see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 for more
>> > info regarding the bug.
>> >
>> > We incorporated below Jakub's suggestion in this patch.
>> >
>> > 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.
>> > Jakub
>> > ""
>> I think you're generally on the right track here, but I'm deferring this
>> to gcc11
>> (other maintainers are, of course, welcome to push it for gcc10 as it's a
>> code
>> correctness issue).
>>
>> Jeff
>> >
>>
>>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH][PPC64] [PR88877]
  2020-03-23 14:46 [PATCH][PPC64] [PR88877] kamlesh kumar
  2020-03-24 17:13 ` Hans-Peter Nilsson
  2020-04-06  6:16 ` kamlesh kumar
@ 2020-05-23 14:43 ` Segher Boessenkool
  2020-05-24 13:33   ` [PATCH v1 1/2][PPC64] [PR88877] Kamlesh Kumar
  2020-06-13 10:27 ` [PATCH] Defined libcall_arg_t Kamlesh Kumar
  3 siblings, 1 reply; 28+ messages in thread
From: Segher Boessenkool @ 2020-05-23 14:43 UTC (permalink / raw)
  To: kamlesh kumar; +Cc: gcc-patches, jakub, rguenth

Hi!

On Mon, Mar 23, 2020 at 08:16:51PM +0530, kamlesh kumar wrote:
>         * rtl.h : Defined Tuple for bundling rtx, mode and
> unsignedness default as 0

This line is too long (and your mailer wrapped it).  No space before
colon.  Full stop at the end of a line.

Write changelogs in the imperative.

>         Added Extra argument (unsignedp) in emit_library_call and
> emit_library_call_value.

Use "bool" for boolean arguments (just like anywhere else), not "int".

Boolean arguments are problematic usually: there is no way someone can
tell from a call site what that argument is, usually.  Written as "0" it
is even worse than "false".

And it doesn't even mean "not unsigned" here, in most cases!  It just
means "we don't care", or "we don't know", or "whatever".

>         * testsuite/gcc.target/powerpc/pr88877.c : Newtest

That should be in a separate changelog (and be "New." or "New test." or
similar).


Please split this into a bunch of patches: the first few only change the
interface (so add the extra "bool" arguments), but in such a way that no
behaviour changes at all.  One patch for every function that is used a
lot it easiest to review (and to write, and to write the changelog for,
this is not extra work for you either, quite the opposite).

Followed by a patch that actually changes things.  I could not find
anywhere where you do not pass "false" for that new bool argument, btw.,
which illustrates my point here.

Do we really want function calls that are indented fifty characters, and
then have nine(!) arguments?  At some point adding stuff on top makes
things topple over, and it is better to restructure things first.  Of
course that isn't fair to demand of you here, but maybe you see some
opportunity to improve things?


Segher

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-23 14:43 ` Segher Boessenkool
@ 2020-05-24 13:33   ` Kamlesh Kumar
  2020-05-24 16:22     ` Segher Boessenkool
  2020-05-26 11:42     ` Richard Sandiford
  0 siblings, 2 replies; 28+ messages in thread
From: Kamlesh Kumar @ 2020-05-24 13:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: segher, jakub, rguenth

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-24 13:33   ` [PATCH v1 1/2][PPC64] [PR88877] Kamlesh Kumar
@ 2020-05-24 16:22     ` Segher Boessenkool
  2020-05-25  7:16       ` kamlesh kumar
  2020-06-09 20:29       ` Jeff Law
  2020-05-26 11:42     ` Richard Sandiford
  1 sibling, 2 replies; 28+ messages in thread
From: Segher Boessenkool @ 2020-05-24 16:22 UTC (permalink / raw)
  To: Kamlesh Kumar; +Cc: gcc-patches, jakub, rguenth

Hi!

On Sun, May 24, 2020 at 07:03:13PM +0530, Kamlesh Kumar wrote:
> 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.

The idea is good.  However, you cannot call something as specific as this
"tuple", in a header file that is used everywhere even.  (We also do not
have a "leading caps on types" convention).

> This patch does not change underlying behavior yet. This will be done in
> follow up patches.

Thanks :-)

>         * rtl.h (Tuple): Defined and typedefed to rtx_mode_t.

It's the other way around: rtx_mode_t is typedeffed to struct Tuple, so
rtx_mode_t should be listed to the left of a : as well.

OTOH, you don't need to name Tuple at all...  It should not *have* a
constructor, since you declared it as class...  But you can just use
std::tuple here?

>         (emit_library_call): Added default arg unsigned_p.
>         (emit_library_call_value): Added default arg unsigned_p.

Yeah, eww.  Default arguments have all the problems you had before,
except now it is hidden and much more surprising.

Those functions really should take rtx_mode_t arguments?

Thanks again for working on this,


Segher

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-24 16:22     ` Segher Boessenkool
@ 2020-05-25  7:16       ` kamlesh kumar
  2020-05-25 16:31         ` Segher Boessenkool
  2020-06-09 20:29       ` Jeff Law
  1 sibling, 1 reply; 28+ messages in thread
From: kamlesh kumar @ 2020-05-25  7:16 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc-patches List, Jakub Jelinek, rguenth

> OTOH, you don't need to name Tuple at all...  It should not *have* a
> constructor, since you declared it as class...  But you can just use
> std::tuple here?

I thought of using std::tuple  but it requires c++11 support.
I am not sure we always build gcc with c++11?

>
> >         (emit_library_call): Added default arg unsigned_p.
> >         (emit_library_call_value): Added default arg unsigned_p.
>
> Yeah, eww.  Default arguments have all the problems you had before,
> except now it is hidden and much more surprising.
>
> Those functions really should take rtx_mode_t arguments?

I was thinking the same. will incorporate this.

./kamlesh

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-25  7:16       ` kamlesh kumar
@ 2020-05-25 16:31         ` Segher Boessenkool
  2020-05-25 16:37           ` Richard Biener
  0 siblings, 1 reply; 28+ messages in thread
From: Segher Boessenkool @ 2020-05-25 16:31 UTC (permalink / raw)
  To: kamlesh kumar; +Cc: gcc-patches List, Jakub Jelinek, rguenth

On Mon, May 25, 2020 at 12:46:02PM +0530, kamlesh kumar wrote:
> > OTOH, you don't need to name Tuple at all...  It should not *have* a
> > constructor, since you declared it as class...  But you can just use
> > std::tuple here?
> 
> I thought of using std::tuple  but it requires c++11 support.
> I am not sure we always build gcc with c++11?

https://gcc.gnu.org/install/prerequisites.html

We do for GCC 11 :-)  Since we pay the price for progress, let's reap the
benefits as well :-)

> > >         (emit_library_call): Added default arg unsigned_p.
> > >         (emit_library_call_value): Added default arg unsigned_p.
> >
> > Yeah, eww.  Default arguments have all the problems you had before,
> > except now it is hidden and much more surprising.
> >
> > Those functions really should take rtx_mode_t arguments?
> 
> I was thinking the same. will incorporate this.

Thanks!


Segher

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-25 16:31         ` Segher Boessenkool
@ 2020-05-25 16:37           ` Richard Biener
  2020-05-25 16:43             ` Jakub Jelinek
  0 siblings, 1 reply; 28+ messages in thread
From: Richard Biener @ 2020-05-25 16:37 UTC (permalink / raw)
  To: Segher Boessenkool, kamlesh kumar
  Cc: gcc-patches List, Jakub Jelinek, rguenth

On May 25, 2020 6:31:29 PM GMT+02:00, Segher Boessenkool <segher@kernel.crashing.org> wrote:
>On Mon, May 25, 2020 at 12:46:02PM +0530, kamlesh kumar wrote:
>> > OTOH, you don't need to name Tuple at all...  It should not *have*
>a
>> > constructor, since you declared it as class...  But you can just
>use
>> > std::tuple here?
>> 
>> I thought of using std::tuple  but it requires c++11 support.
>> I am not sure we always build gcc with c++11?
>
>https://gcc.gnu.org/install/prerequisites.html
>
>We do for GCC 11 :-)  Since we pay the price for progress, let's reap
>the
>benefits as well :-)

Not sure if the benefit is enough to warrant an extra (complex?) standard header in almost every TU. 

>> > >         (emit_library_call): Added default arg unsigned_p.
>> > >         (emit_library_call_value): Added default arg unsigned_p.
>> >
>> > Yeah, eww.  Default arguments have all the problems you had before,
>> > except now it is hidden and much more surprising.
>> >
>> > Those functions really should take rtx_mode_t arguments?
>> 
>> I was thinking the same. will incorporate this.
>
>Thanks!
>
>
>Segher


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-25 16:37           ` Richard Biener
@ 2020-05-25 16:43             ` Jakub Jelinek
  2020-05-25 16:53               ` Iain Sandoe
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Jelinek @ 2020-05-25 16:43 UTC (permalink / raw)
  To: Richard Biener
  Cc: Segher Boessenkool, kamlesh kumar, gcc-patches List, rguenth

On Mon, May 25, 2020 at 06:37:57PM +0200, Richard Biener wrote:
> >> I thought of using std::tuple  but it requires c++11 support.
> >> I am not sure we always build gcc with c++11?
> >
> >https://gcc.gnu.org/install/prerequisites.html
> >
> >We do for GCC 11 :-)  Since we pay the price for progress, let's reap
> >the
> >benefits as well :-)
> 
> Not sure if the benefit is enough to warrant an extra (complex?) standard header in almost every TU. 

Yeah, especially when one can just define the 3 fields of the small struct
to be descriptive, rather than being first/second/third.

	Jakub


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-25 16:43             ` Jakub Jelinek
@ 2020-05-25 16:53               ` Iain Sandoe
  0 siblings, 0 replies; 28+ messages in thread
From: Iain Sandoe @ 2020-05-25 16:53 UTC (permalink / raw)
  To: gcc-patches List
  Cc: Richard Biener, Segher Boessenkool, rguenth, Jakub Jelinek

Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

> On Mon, May 25, 2020 at 06:37:57PM +0200, Richard Biener wrote:
>>>> I thought of using std::tuple  but it requires c++11 support.
>>>> I am not sure we always build gcc with c++11?
>>>
>>> https://gcc.gnu.org/install/prerequisites.html
>>>
>>> We do for GCC 11 :-)  Since we pay the price for progress, let's reap
>>> the
>>> benefits as well :-)
>>
>> Not sure if the benefit is enough to warrant an extra (complex?)  
>> standard header in almost every TU.
>
> Yeah, especially when one can just define the 3 fields of the small struct
> to be descriptive, rather than being first/second/third.
+1,
tuple (and pair) have the property that the use of the fields might be  
obvious to the code author, but probably will not be to the code reader.   
IMO most of the time as Jakub says something descriptive is better - and I  
don’t believe it’s a performance penalty.

Iain


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-24 13:33   ` [PATCH v1 1/2][PPC64] [PR88877] Kamlesh Kumar
  2020-05-24 16:22     ` Segher Boessenkool
@ 2020-05-26 11:42     ` Richard Sandiford
  1 sibling, 0 replies; 28+ messages in thread
From: Richard Sandiford @ 2020-05-26 11:42 UTC (permalink / raw)
  To: Kamlesh Kumar via Gcc-patches; +Cc: Kamlesh Kumar, jakub, segher, rguenth

Thanks for working on this.

Kamlesh Kumar via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> 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;
>  

I think rtx_mode_t should continue to be what it is now: an rtx
and a mode only.  That's all that most rtl code cares about, since
in rtl signedness is a property of an operation (where necessary)
instead of an operand.

(FWIW, the type was originally added to enable wide-int operators
to be applied to rtx constants, to get around the fact that CONST_INT
& co. don't store a mode.  We should continue not to have signedness
information in that situation.)

I think instead we should make emit_library_call operate on a new and
differently-named type that contains the three pieces of information.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-05-24 16:22     ` Segher Boessenkool
  2020-05-25  7:16       ` kamlesh kumar
@ 2020-06-09 20:29       ` Jeff Law
  2020-06-11 23:13         ` Segher Boessenkool
  1 sibling, 1 reply; 28+ messages in thread
From: Jeff Law @ 2020-06-09 20:29 UTC (permalink / raw)
  To: Segher Boessenkool, Kamlesh Kumar; +Cc: jakub, gcc-patches, rguenth

On Sun, 2020-05-24 at 11:22 -0500, Segher Boessenkool wrote:
> Hi!
> 
> On Sun, May 24, 2020 at 07:03:13PM +0530, Kamlesh Kumar wrote:
> > 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.
> 
> The idea is good.  However, you cannot call something as specific as this
> "tuple", in a header file that is used everywhere even.  (We also do not
> have a "leading caps on types" convention).
> 
> > This patch does not change underlying behavior yet. This will be done in
> > follow up patches.
> 
> Thanks :-)
> 
> >         * rtl.h (Tuple): Defined and typedefed to rtx_mode_t.
> 
> It's the other way around: rtx_mode_t is typedeffed to struct Tuple, so
> rtx_mode_t should be listed to the left of a : as well.
> 
> OTOH, you don't need to name Tuple at all...  It should not *have* a
> constructor, since you declared it as class...  But you can just use
> std::tuple here?
> 
> >         (emit_library_call): Added default arg unsigned_p.
> >         (emit_library_call_value): Added default arg unsigned_p.
> 
> Yeah, eww.  Default arguments have all the problems you had before,
> except now it is hidden and much more surprising.
> 
> Those functions really should take rtx_mode_t arguments?
> 
> Thanks again for working on this,
ISTM that using std::tuple would be better than defining our own types.

I'd rather see the argument be explicit rather than using default arguments too. 
While I have ack'd some patches with default arguments, I still don't like 'em.

I do like the approach of getting the infrastructure in place without changing
behavior, then having the behavior fix as a distinct change.

jeff


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-06-09 20:29       ` Jeff Law
@ 2020-06-11 23:13         ` Segher Boessenkool
  2020-06-13 10:17           ` [PATCH] Defined libcall_arg_t Kamlesh Kumar
  2020-06-13 10:47           ` [PATCH v1 1/2][PPC64] [PR88877] kamlesh kumar
  0 siblings, 2 replies; 28+ messages in thread
From: Segher Boessenkool @ 2020-06-11 23:13 UTC (permalink / raw)
  To: Jeff Law; +Cc: Kamlesh Kumar, jakub, gcc-patches, rguenth

On Tue, Jun 09, 2020 at 02:29:13PM -0600, Jeff Law wrote:
> On Sun, 2020-05-24 at 11:22 -0500, Segher Boessenkool wrote:
> > OTOH, you don't need to name Tuple at all...  It should not *have* a
> > constructor, since you declared it as class...  But you can just use
> > std::tuple here?
> > 
> > >         (emit_library_call): Added default arg unsigned_p.
> > >         (emit_library_call_value): Added default arg unsigned_p.
> > 
> > Yeah, eww.  Default arguments have all the problems you had before,
> > except now it is hidden and much more surprising.
> > 
> > Those functions really should take rtx_mode_t arguments?
> > 
> > Thanks again for working on this,
> ISTM that using std::tuple would be better than defining our own types.

Yeah.  But as Jakub an Iain said, not using a container type (but a more
concrete type, instead) is much better anyway :-)

> I'd rather see the argument be explicit rather than using default arguments too. 
> While I have ack'd some patches with default arguments, I still don't like 'em.

Default arguments have their place (but it's not here :-) )

> I do like the approach of getting the infrastructure in place without changing
> behavior, then having the behavior fix as a distinct change.

With Git, commits are easy and cheap, and massaging a patch series into
shape is easy and cheap as well.  If you develop using Git in the first
place (and you should!), you should naturally end up with many patches
in your series, and the preparatory patches first (after you reshuffle
things a bit, if you are like me and your foresight is severly limited).

So you have this separate *anyway* (or should have).  Since it helps
reviewing a lot, and also later bisecting, it is good to keep it.


Segher

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] Defined libcall_arg_t
  2020-06-11 23:13         ` Segher Boessenkool
@ 2020-06-13 10:17           ` Kamlesh Kumar
  2020-06-13 10:47           ` [PATCH v1 1/2][PPC64] [PR88877] kamlesh kumar
  1 sibling, 0 replies; 28+ messages in thread
From: Kamlesh Kumar @ 2020-06-13 10:17 UTC (permalink / raw)
  To: gcc-patches

This is first patch where I have just defined a struct libcall_arg_t which contains
three member rtx, machine_mode and a boolean unsigned_p and will be used in passing args in
emit_library_[call/value] functions.

Once this patch is approved then i will create second patch in which arg type libcall_arg_t will be
propogated on all instances needed.
Then final patch which will fix the actual problem reported in PR88877.

ChangeLog Entry:

2020-06-13  Kamlesh Kumar  <kamleshbhalui@gmail.com>

       * rtl.h (libcall_arg_t): Defined.


---
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0872cc4..c023ff0 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2238,6 +2238,18 @@ struct address_info {
   enum rtx_code base_outer_code;
 };
 
+/* This is used for passing args in emit_library_* functions */
+typedef struct libcall_arg {
+  rtx value;
+  machine_mode mode;
+  bool unsigned_p;
+  libcall_arg (rtx v, machine_mode m, bool u) {
+    value = v;
+    mode = m;
+    unsigned_p = u;
+  }
+} libcall_arg_t;
+
 /* 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.  */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] Defined libcall_arg_t
  2020-03-23 14:46 [PATCH][PPC64] [PR88877] kamlesh kumar
                   ` (2 preceding siblings ...)
  2020-05-23 14:43 ` Segher Boessenkool
@ 2020-06-13 10:27 ` Kamlesh Kumar
  2020-06-16  9:04   ` Richard Sandiford
  3 siblings, 1 reply; 28+ messages in thread
From: Kamlesh Kumar @ 2020-06-13 10:27 UTC (permalink / raw)
  To: gcc-patches

This is first patch where I have just defined a struct libcall_arg_t which contains
three member rtx, machine_mode and a boolean unsigned_p and will be used in passing args in
emit_library_[call/value] functions.

Once this patch is approved then i will create second patch in which arg type libcall_arg_t will be
propogated on all instances needed.
Then final patch which will fix the actual problem reported in PR88877.

ChangeLog Entry:

2020-06-13  Kamlesh Kumar  <kamleshbhalui@gmail.com>

       * rtl.h (libcall_arg_t): Defined.


---
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0872cc4..c023ff0 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2238,6 +2238,18 @@ struct address_info {
   enum rtx_code base_outer_code;
 };
 
+/* This is used for passing args in emit_library_* functions */
+typedef struct libcall_arg {
+  rtx value;
+  machine_mode mode;
+  bool unsigned_p;
+  libcall_arg (rtx v, machine_mode m, bool u) {
+    value = v;
+    mode = m;
+    unsigned_p = u;
+  }
+} libcall_arg_t;
+
 /* 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.  */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v1 1/2][PPC64] [PR88877]
  2020-06-11 23:13         ` Segher Boessenkool
  2020-06-13 10:17           ` [PATCH] Defined libcall_arg_t Kamlesh Kumar
@ 2020-06-13 10:47           ` kamlesh kumar
  1 sibling, 0 replies; 28+ messages in thread
From: kamlesh kumar @ 2020-06-13 10:47 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Jeff Law, Jakub Jelinek, gcc-patches List, rguenth

Thank you all for the suggestions.
This is first patch where I have just defined a struct libcall_arg_t
which contains
three member rtx, machine_mode and a boolean unsigned_p and will be
used in passing args in
emit_library_[call/value] functions.

Once this patch is approved then i will create second patch in which
arg type libcall_arg_t will be
propogated on all instances needed.
Then final patch which will fix the actual problem reported in PR88877.

ChangeLog Entry:

2020-06-13  Kamlesh Kumar  <kamleshbhalui@gmail.com>

       * rtl.h (libcall_arg_t): Defined.


---
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0872cc4..c023ff0 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2238,6 +2238,18 @@ struct address_info {
   enum rtx_code base_outer_code;
 };

+/* This is used for passing args in emit_library_* functions */
+typedef struct libcall_arg {
+  rtx value;
+  machine_mode mode;
+  bool unsigned_p;
+  libcall_arg (rtx v, machine_mode m, bool u) {
+    value = v;
+    mode = m;
+    unsigned_p = u;
+  }
+} libcall_arg_t;
+
 /* 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.  */
--
2.7.4

On Fri, Jun 12, 2020 at 4:43 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Tue, Jun 09, 2020 at 02:29:13PM -0600, Jeff Law wrote:
> > On Sun, 2020-05-24 at 11:22 -0500, Segher Boessenkool wrote:
> > > OTOH, you don't need to name Tuple at all...  It should not *have* a
> > > constructor, since you declared it as class...  But you can just use
> > > std::tuple here?
> > >
> > > >         (emit_library_call): Added default arg unsigned_p.
> > > >         (emit_library_call_value): Added default arg unsigned_p.
> > >
> > > Yeah, eww.  Default arguments have all the problems you had before,
> > > except now it is hidden and much more surprising.
> > >
> > > Those functions really should take rtx_mode_t arguments?
> > >
> > > Thanks again for working on this,
> > ISTM that using std::tuple would be better than defining our own types.
>
> Yeah.  But as Jakub an Iain said, not using a container type (but a more
> concrete type, instead) is much better anyway :-)
>
> > I'd rather see the argument be explicit rather than using default arguments too.
> > While I have ack'd some patches with default arguments, I still don't like 'em.
>
> Default arguments have their place (but it's not here :-) )
>
> > I do like the approach of getting the infrastructure in place without changing
> > behavior, then having the behavior fix as a distinct change.
>
> With Git, commits are easy and cheap, and massaging a patch series into
> shape is easy and cheap as well.  If you develop using Git in the first
> place (and you should!), you should naturally end up with many patches
> in your series, and the preparatory patches first (after you reshuffle
> things a bit, if you are like me and your foresight is severly limited).
>
> So you have this separate *anyway* (or should have).  Since it helps
> reviewing a lot, and also later bisecting, it is good to keep it.
>
>
> Segher

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] Defined libcall_arg_t
  2020-06-13 10:27 ` [PATCH] Defined libcall_arg_t Kamlesh Kumar
@ 2020-06-16  9:04   ` Richard Sandiford
  2020-06-16 11:07     ` Kamlesh Kumar
  0 siblings, 1 reply; 28+ messages in thread
From: Richard Sandiford @ 2020-06-16  9:04 UTC (permalink / raw)
  To: Kamlesh Kumar via Gcc-patches

Thanks for doing this.

Kamlesh Kumar via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 0872cc4..c023ff0 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -2238,6 +2238,18 @@ struct address_info {
>    enum rtx_code base_outer_code;
>  };
>  
> +/* This is used for passing args in emit_library_* functions */
> +typedef struct libcall_arg {

There's not really any need for a typedef here.  We should just
use “libcall_arg” directly.

> +  rtx value;
> +  machine_mode mode;
> +  bool unsigned_p;
> +  libcall_arg (rtx v, machine_mode m, bool u) {
> +    value = v;
> +    mode = m;
> +    unsigned_p = u;
> +  }

Please use member initialisation for the fields instead.

Now that we're C++11, the constructor might as well be constexpr.

Thanks,
Richard

> +} libcall_arg_t;
> +
>  /* 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.  */


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] Defined libcall_arg_t
  2020-06-16  9:04   ` Richard Sandiford
@ 2020-06-16 11:07     ` Kamlesh Kumar
  2020-06-16 12:09       ` Richard Sandiford
  0 siblings, 1 reply; 28+ messages in thread
From: Kamlesh Kumar @ 2020-06-16 11:07 UTC (permalink / raw)
  To: Kamlesh Kumar via Gcc-patches, richard.sandiford

thanks Richard,

addressed your concern.

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0872cc4..7206c8a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2238,6 +2238,16 @@ struct address_info {
    enum rtx_code base_outer_code;
  };

+/* This is used for passing args in emit_library_* functions */
+struct libcall_arg {
+  rtx value;
+  machine_mode mode;
+  bool unsigned_p;
+  constexpr
+  libcall_arg (rtx v, machine_mode m, bool u) : value(v), mode(m),
+                                                unsigned_p(u) {}
+};
+
  /* 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.  */

On 16/06/20 2:34 pm, Richard Sandiford wrote:
> Thanks for doing this.
>
> Kamlesh Kumar via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>> diff --git a/gcc/rtl.h b/gcc/rtl.h
>> index 0872cc4..c023ff0 100644
>> --- a/gcc/rtl.h
>> +++ b/gcc/rtl.h
>> @@ -2238,6 +2238,18 @@ struct address_info {
>>     enum rtx_code base_outer_code;
>>   };
>>   
>> +/* This is used for passing args in emit_library_* functions */
>> +typedef struct libcall_arg {
> There's not really any need for a typedef here.  We should just
> use “libcall_arg” directly.
>
>> +  rtx value;
>> +  machine_mode mode;
>> +  bool unsigned_p;
>> +  libcall_arg (rtx v, machine_mode m, bool u) {
>> +    value = v;
>> +    mode = m;
>> +    unsigned_p = u;
>> +  }
> Please use member initialisation for the fields instead.
>
> Now that we're C++11, the constructor might as well be constexpr.
>
> Thanks,
> Richard
>
>> +} libcall_arg_t;
>> +
>>   /* 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.  */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] Defined libcall_arg_t
  2020-06-16 11:07     ` Kamlesh Kumar
@ 2020-06-16 12:09       ` Richard Sandiford
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Sandiford @ 2020-06-16 12:09 UTC (permalink / raw)
  To: Kamlesh Kumar; +Cc: Kamlesh Kumar via Gcc-patches

Kamlesh Kumar <kamleshbhalui@gmail.com> writes:
> thanks Richard,
>
> addressed your concern.
>
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 0872cc4..7206c8a 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -2238,6 +2238,16 @@ struct address_info {
>     enum rtx_code base_outer_code;
>   };
>
> +/* This is used for passing args in emit_library_* functions */
> +struct libcall_arg {
> +  rtx value;
> +  machine_mode mode;
> +  bool unsigned_p;
> +  constexpr
> +  libcall_arg (rtx v, machine_mode m, bool u) : value(v), mode(m),
> +                                                unsigned_p(u) {}

Think this should be formatted with the ":" on the next line.
There should also be spaces before each "(":

  constexpr libcall_arg (rtx v, machine_mode m, bool u)
    : value (v), mode (m), unsigned_p (u) {}

Looks good otherwise, thanks, but please only apply at the same
time as the patch that needs it.

Richard

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2020-06-16 12:09 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 14:46 [PATCH][PPC64] [PR88877] kamlesh kumar
2020-03-24 17:13 ` Hans-Peter Nilsson
2020-03-24 17:24   ` Hans-Peter Nilsson
2020-03-24 17:54     ` kamlesh kumar
2020-04-06  6:16 ` kamlesh kumar
2020-04-06  9:17   ` Richard Biener
2020-04-06  9:28     ` kamlesh kumar
2020-04-08 15:58       ` Jeff Law
2020-05-19 12:02         ` kamlesh kumar
2020-05-22 15:18           ` kamlesh kumar
2020-04-07 21:02   ` Segher Boessenkool
2020-05-23 14:43 ` Segher Boessenkool
2020-05-24 13:33   ` [PATCH v1 1/2][PPC64] [PR88877] Kamlesh Kumar
2020-05-24 16:22     ` Segher Boessenkool
2020-05-25  7:16       ` kamlesh kumar
2020-05-25 16:31         ` Segher Boessenkool
2020-05-25 16:37           ` Richard Biener
2020-05-25 16:43             ` Jakub Jelinek
2020-05-25 16:53               ` Iain Sandoe
2020-06-09 20:29       ` Jeff Law
2020-06-11 23:13         ` Segher Boessenkool
2020-06-13 10:17           ` [PATCH] Defined libcall_arg_t Kamlesh Kumar
2020-06-13 10:47           ` [PATCH v1 1/2][PPC64] [PR88877] kamlesh kumar
2020-05-26 11:42     ` Richard Sandiford
2020-06-13 10:27 ` [PATCH] Defined libcall_arg_t Kamlesh Kumar
2020-06-16  9:04   ` Richard Sandiford
2020-06-16 11:07     ` Kamlesh Kumar
2020-06-16 12:09       ` Richard Sandiford

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).