From: Aaron Sawdey Date: Fri, 22 Jun 2018 15:36:31 +0000 (+0000) Subject: rs6000-string.c (expand_strn_compare): Handle -m32 correctly. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9727bda050fe9733fafe84ee4bb58ce8c5a1eff;p=gcc.git rs6000-string.c (expand_strn_compare): Handle -m32 correctly. 2018-06-22 Aaron Sawdey * config/rs6000/rs6000-string.c (expand_strn_compare): Handle -m32 correctly. From-SVN: r261905 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 58729e76dbb..30dbbbdbd17 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-06-22 Aaron Sawdey + + * config/rs6000/rs6000-string.c (expand_strn_compare): Handle -m32 + correctly. + 2018-06-22 Martin Liska PR tree-optimization/86263 diff --git a/gcc/config/rs6000/rs6000-string.c b/gcc/config/rs6000/rs6000-string.c index 8d9afc41b8f..7e49568a1ed 100644 --- a/gcc/config/rs6000/rs6000-string.c +++ b/gcc/config/rs6000/rs6000-string.c @@ -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);