Commit e9727bda by Aaron Sawdey Committed by Aaron Sawdey

rs6000-string.c (expand_strn_compare): Handle -m32 correctly.

2018-06-22  Aaron Sawdey  <acsawdey@linux.ibm.com>

	* config/rs6000/rs6000-string.c (expand_strn_compare): Handle -m32
	correctly.

From-SVN: r261905
parent 84ee4321
2018-06-22 Aaron Sawdey <acsawdey@linux.ibm.com>
* config/rs6000/rs6000-string.c (expand_strn_compare): Handle -m32
correctly.
2018-06-22 Martin Liska <mliska@suse.cz>
PR tree-optimization/86263
......
......@@ -1925,20 +1925,15 @@ expand_strn_compare (rtx operands[], int no_length)
/* -m32 -mpowerpc64 results in word_mode being DImode even
though otherwise it is 32-bit. The length arg to strncmp
is a size_t which will be the same size as pointers. */
rtx len_rtx;
if (TARGET_64BIT)
len_rtx = gen_reg_rtx (DImode);
else
len_rtx = gen_reg_rtx (SImode);
emit_move_insn (len_rtx, bytes_rtx);
rtx len_rtx = gen_reg_rtx (Pmode);
emit_move_insn (len_rtx, gen_int_mode (bytes, Pmode));
tree fun = builtin_decl_explicit (BUILT_IN_STRNCMP);
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,
len_rtx, GET_MODE (len_rtx));
len_rtx, Pmode);
}
rtx fin_ref = gen_rtx_LABEL_REF (VOIDmode, final_label);
......@@ -2126,18 +2121,12 @@ expand_strn_compare (rtx operands[], int no_length)
}
else
{
rtx len_rtx;
if (TARGET_64BIT)
len_rtx = gen_reg_rtx (DImode);
else
len_rtx = gen_reg_rtx (SImode);
emit_move_insn (len_rtx, GEN_INT (bytes - compare_length));
rtx len_rtx = gen_reg_rtx (Pmode);
emit_move_insn (len_rtx, gen_int_mode (bytes - compare_length, Pmode));
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, GET_MODE (len_rtx));
src1, Pmode, src2, Pmode, len_rtx, Pmode);
}
rtx fin_ref = gen_rtx_LABEL_REF (VOIDmode, final_label);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment