From: Uros Bizjak Date: Sun, 28 Jun 2015 19:38:56 +0000 (+0200) Subject: i386.md (_ldx): Do not zero-extend non-Pmode operand 2 here. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2aee355b5a77c60e3c43294ee9469a35a5b95a9c;p=gcc.git i386.md (_ldx): Do not zero-extend non-Pmode operand 2 here. * config/i386/i386.md (_ldx): Do not zero-extend non-Pmode operand 2 here. Use copy_addr_to_reg to copy non-index register operand 2 to a temporary. (_stx): Ditto for operand 1. (*_ldx, *_stx): Remove enclosing parallel. * config/i386/i386.c (ix86_load_bounds): Zero-extend non-Pmode ptr here. (ix86_store_bounds): Ditto. From-SVN: r225105 --- diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7bace3c80c0..95986006ec8 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8886,9 +8886,8 @@ ix86_setup_incoming_vararg_bounds (cumulative_args_t cum_v, for (i = cum->regno; i < max; i++) { rtx addr = plus_constant (Pmode, save_area, i * UNITS_PER_WORD); - rtx reg = gen_rtx_REG (DImode, + rtx ptr = gen_rtx_REG (Pmode, x86_64_int_parameter_registers[i]); - rtx ptr = reg; rtx bounds; if (bnd_reg <= LAST_BND_REG) @@ -40344,6 +40343,9 @@ ix86_load_bounds (rtx slot, rtx ptr, rtx slot_no) ptr = copy_addr_to_reg (slot); } + if (!register_operand (ptr, Pmode)) + ptr = ix86_zero_extend_to_Pmode (ptr); + emit_insn (BNDmode == BND64mode ? gen_bnd64_ldx (reg, addr, ptr) : gen_bnd32_ldx (reg, addr, ptr)); @@ -40378,6 +40380,9 @@ ix86_store_bounds (rtx ptr, rtx slot, rtx bounds, rtx slot_no) ptr = copy_addr_to_reg (slot); } + if (!register_operand (ptr, Pmode)) + ptr = ix86_zero_extend_to_Pmode (ptr); + gcc_assert (POINTER_BOUNDS_MODE_P (GET_MODE (bounds))); if (!register_operand (bounds, BNDmode)) bounds = copy_to_mode_reg (BNDmode, bounds); diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index c23177b02bc..25935818ac9 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -18950,52 +18950,52 @@ (define_expand "_mk" [(set (match_operand:BND 0 "register_operand") - (unspec:BND - [(mem: - (match_par_dup 3 - [(match_operand: 1 "register_operand") - (match_operand: 2 "address_mpx_no_base_operand")]))] - UNSPEC_BNDMK))] + (unspec:BND + [(mem: + (match_par_dup 3 + [(match_operand: 1 "register_operand") + (match_operand: 2 "address_mpx_no_base_operand")]))] + UNSPEC_BNDMK))] "TARGET_MPX" { operands[3] = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, operands[1], operands[2]), - UNSPEC_BNDMK_ADDR); + UNSPEC_BNDMK_ADDR); }) (define_insn "*_mk" [(set (match_operand:BND 0 "register_operand" "=w") - (unspec:BND - [(match_operator: 3 "bnd_mem_operator" - [(unspec: - [(match_operand: 1 "register_operand" "r") - (match_operand: 2 "address_mpx_no_base_operand" "Tb")] - UNSPEC_BNDMK_ADDR)])] - UNSPEC_BNDMK))] + (unspec:BND + [(match_operator: 3 "bnd_mem_operator" + [(unspec: + [(match_operand: 1 "register_operand" "r") + (match_operand: 2 "address_mpx_no_base_operand" "Tb")] + UNSPEC_BNDMK_ADDR)])] + UNSPEC_BNDMK))] "TARGET_MPX" "bndmk\t{%3, %0|%0, %3}" [(set_attr "type" "mpxmk")]) (define_expand "mov" [(set (match_operand:BND 0 "general_operand") - (match_operand:BND 1 "general_operand"))] + (match_operand:BND 1 "general_operand"))] "TARGET_MPX" -{ - ix86_expand_move (mode, operands);DONE; -}) + "ix86_expand_move (mode, operands); DONE;") (define_insn "*mov_internal_mpx" [(set (match_operand:BND 0 "nonimmediate_operand" "=w,m") - (match_operand:BND 1 "general_operand" "wm,w"))] + (match_operand:BND 1 "general_operand" "wm,w"))] "TARGET_MPX" "bndmov\t{%1, %0|%0, %1}" [(set_attr "type" "mpxmov")]) (define_expand "_" - [(parallel [(unspec [(match_operand:BND 0 "register_operand") - (match_operand: 1 "address_no_seg_operand")] BNDCHECK) - (set (match_dup 2) - (unspec:BLK [(match_dup 2)] UNSPEC_MPX_FENCE))])] + [(parallel + [(unspec + [(match_operand:BND 0 "register_operand") + (match_operand: 1 "address_no_seg_operand")] BNDCHECK) + (set (match_dup 2) + (unspec:BLK [(match_dup 2)] UNSPEC_MPX_FENCE))])] "TARGET_MPX" { operands[2] = gen_rtx_MEM (BLKmode, operands[1]); @@ -19003,107 +19003,94 @@ }) (define_insn "*_" - [(parallel [(unspec [(match_operand:BND 0 "register_operand" "w") - (match_operand: 1 "address_no_seg_operand" "Ts")] BNDCHECK) - (set (match_operand:BLK 2 "bnd_mem_operator") - (unspec:BLK [(match_dup 2)] UNSPEC_MPX_FENCE))])] + [(unspec + [(match_operand:BND 0 "register_operand" "w") + (match_operand: 1 "address_no_seg_operand" "Ts")] BNDCHECK) + (set (match_operand:BLK 2 "bnd_mem_operator") + (unspec:BLK [(match_dup 2)] UNSPEC_MPX_FENCE))] "TARGET_MPX" "bnd\t{%a1, %0|%0, %a1}" [(set_attr "type" "mpxchk")]) (define_expand "_ldx" - [(parallel [(set (match_operand:BND 0 "register_operand") - (unspec:BND - [(mem: - (match_par_dup 3 - [(match_operand: 1 "address_mpx_no_index_operand") - (match_operand: 2 "register_operand")]))] - UNSPEC_BNDLDX)) - (use (mem:BLK (match_dup 1)))])] + [(parallel + [(set (match_operand:BND 0 "register_operand") + (unspec:BND + [(mem: + (match_par_dup 3 + [(match_operand: 1 "address_mpx_no_index_operand") + (match_operand: 2 "register_operand")]))] + UNSPEC_BNDLDX)) + (use (mem:BLK (match_dup 1)))])] "TARGET_MPX" { - /* Avoid registers which connot be used as index. */ + /* Avoid registers which cannot be used as index. */ if (!index_register_operand (operands[2], Pmode)) - { - rtx temp = gen_reg_rtx (Pmode); - emit_move_insn (temp, operands[2]); - operands[2] = temp; - } - - /* If it was a register originally then it may have - mode other than Pmode. We need to extend in such - case because bndldx may work only with Pmode regs. */ - if (GET_MODE (operands[2]) != Pmode) - operands[2] = ix86_zero_extend_to_Pmode (operands[2]); + operands[2] = copy_addr_to_reg (operands[2]); operands[3] = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, operands[1], - operands[2]), + operands[2]), UNSPEC_BNDLDX_ADDR); }) (define_insn "*_ldx" - [(parallel [(set (match_operand:BND 0 "register_operand" "=w") - (unspec:BND - [(match_operator: 3 "bnd_mem_operator" - [(unspec: - [(match_operand: 1 "address_mpx_no_index_operand" "Ti") - (match_operand: 2 "register_operand" "l")] - UNSPEC_BNDLDX_ADDR)])] - UNSPEC_BNDLDX)) - (use (mem:BLK (match_dup 1)))])] + [(set (match_operand:BND 0 "register_operand" "=w") + (unspec:BND + [(match_operator: 3 "bnd_mem_operator" + [(unspec: + [(match_operand: 1 "address_mpx_no_index_operand" "Ti") + (match_operand: 2 "register_operand" "l")] + UNSPEC_BNDLDX_ADDR)])] + UNSPEC_BNDLDX)) + (use (mem:BLK (match_dup 1)))] "TARGET_MPX" "bndldx\t{%3, %0|%0, %3}" [(set_attr "type" "mpxld")]) (define_expand "_stx" - [(parallel [(unspec [(mem: - (match_par_dup 3 - [(match_operand: 0 "address_mpx_no_index_operand") - (match_operand: 1 "register_operand")])) - (match_operand:BND 2 "register_operand")] UNSPEC_BNDSTX) - (set (match_dup 4) - (unspec:BLK [(match_dup 4)] UNSPEC_MPX_FENCE))])] + [(parallel + [(unspec + [(mem: + (match_par_dup 3 + [(match_operand: 0 "address_mpx_no_index_operand") + (match_operand: 1 "register_operand")])) + (match_operand:BND 2 "register_operand")] + UNSPEC_BNDSTX) + (set (match_dup 4) + (unspec:BLK [(match_dup 4)] UNSPEC_MPX_FENCE))])] "TARGET_MPX" { - /* Avoid registers which connot be used as index. */ + /* Avoid registers which cannot be used as index. */ if (!index_register_operand (operands[1], Pmode)) - { - rtx temp = gen_reg_rtx (Pmode); - emit_move_insn (temp, operands[1]); - operands[1] = temp; - } - - /* If it was a register originally then it may have - mode other than Pmode. We need to extend in such - case because bndstx may work only with Pmode regs. */ - if (GET_MODE (operands[1]) != Pmode) - operands[1] = ix86_zero_extend_to_Pmode (operands[1]); + operands[1] = copy_addr_to_reg (operands[1]); operands[3] = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, operands[0], - operands[1]), + operands[1]), UNSPEC_BNDLDX_ADDR); operands[4] = gen_rtx_MEM (BLKmode, operands[0]); MEM_VOLATILE_P (operands[4]) = 1; }) (define_insn "*_stx" - [(parallel [(unspec [(match_operator: 3 "bnd_mem_operator" - [(unspec: - [(match_operand: 0 "address_mpx_no_index_operand" "Ti") - (match_operand: 1 "register_operand" "l")] - UNSPEC_BNDLDX_ADDR)]) - (match_operand:BND 2 "register_operand" "w")] UNSPEC_BNDSTX) - (set (match_operand:BLK 4 "bnd_mem_operator") - (unspec:BLK [(match_dup 4)] UNSPEC_MPX_FENCE))])] + [(unspec + [(match_operator: 3 "bnd_mem_operator" + [(unspec: + [(match_operand: 0 "address_mpx_no_index_operand" "Ti") + (match_operand: 1 "register_operand" "l")] + UNSPEC_BNDLDX_ADDR)]) + (match_operand:BND 2 "register_operand" "w")] + UNSPEC_BNDSTX) + (set (match_operand:BLK 4 "bnd_mem_operator") + (unspec:BLK [(match_dup 4)] UNSPEC_MPX_FENCE))] "TARGET_MPX" "bndstx\t{%2, %3|%3, %2}" [(set_attr "type" "mpxst")]) (define_insn "move_size_reloc_" [(set (match_operand:SWI48 0 "register_operand" "=r") - (unspec:SWI48 - [(match_operand:SWI48 1 "symbol_operand")] - UNSPEC_SIZEOF))] + (unspec:SWI48 + [(match_operand:SWI48 1 "symbol_operand")] + UNSPEC_SIZEOF))] "TARGET_MPX" { if (x86_64_immediate_size_operand (operands[1], VOIDmode))