From 122d6c36552fd516efee6e57e68103ec693a9ff5 Mon Sep 17 00:00:00 2001 From: Aaron Sawdey Date: Fri, 2 Nov 2018 17:02:38 +0000 Subject: [PATCH] rs6000-string.c (expand_strncmp_gpr_sequence): Pay attention to TARGET_AVOID_XFORM and BYTES_BIG_ENDIAN. 2018-11-02 Aaron Sawdey * config/rs6000/rs6000-string.c (expand_strncmp_gpr_sequence): Pay attention to TARGET_AVOID_XFORM and BYTES_BIG_ENDIAN. From-SVN: r265751 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/rs6000-string.c | 16 +++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ddb1492ede..5cf291da2d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-11-02 Aaron Sawdey + + * config/rs6000/rs6000-string.c (expand_strncmp_gpr_sequence): Pay + attention to TARGET_AVOID_XFORM and BYTES_BIG_ENDIAN. + 2018-11-02 Richard Earnshaw * config/aarch64/aarch64.c ((aarch64_override_options): Disable diff --git a/gcc/config/rs6000/rs6000-string.c b/gcc/config/rs6000/rs6000-string.c index 96729d9663c..22fe966d572 100644 --- a/gcc/config/rs6000/rs6000-string.c +++ b/gcc/config/rs6000/rs6000-string.c @@ -1798,12 +1798,18 @@ expand_strncmp_gpr_sequence (unsigned HOST_WIDE_INT bytes_to_compare, rid of the extra bytes. */ cmp_bytes = bytes_to_compare; - rtx offset_reg = gen_reg_rtx (Pmode); - emit_move_insn (offset_reg, GEN_INT (offset)); - - rtx addr1 = gen_rtx_PLUS (Pmode, src1_addr, offset_reg); + rtx offset_rtx; + if (BYTES_BIG_ENDIAN || TARGET_AVOID_XFORM) + offset_rtx = GEN_INT (offset); + else + { + offset_rtx = gen_reg_rtx (Pmode); + emit_move_insn (offset_rtx, GEN_INT (offset)); + } + rtx addr1 = gen_rtx_PLUS (Pmode, src1_addr, offset_rtx); + rtx addr2 = gen_rtx_PLUS (Pmode, src2_addr, offset_rtx); + do_load_for_compare_from_addr (load_mode, tmp_reg_src1, addr1, orig_src1); - rtx addr2 = gen_rtx_PLUS (Pmode, src2_addr, offset_reg); do_load_for_compare_from_addr (load_mode, tmp_reg_src2, addr2, orig_src2); /* We must always left-align the data we read, and -- 2.30.2