https://gcc.gnu.org/g:f16aa1c29ef9fe49ef11f9735e8d01954dfb8b01
commit r17-5226-gf16aa1c29ef9fe49ef11f9735e8d01954dfb8b01 Author: Uros Bizjak <[email protected]> Date: Thu Oct 15 15:38:11 2026 +0200 i386: Use UNITS_PER_WORD more UNITS_PER_WORD is the size of word_mode in bytes, so use it directly instead of calling GET_MODE_SIZE (word_mode). No functional changes. gcc/ChangeLog: * config/i386/i386-expand.cc (emit_memmov): Use UNITS_PER_WORD instead of GET_MODE_SIZE (word_mode). (emit_memset): Ditto. (ix86_expand_set_or_cpymem): Ditto. (ix86_expand_set_or_movmem): Ditto. * config/i386/i386.cc (print_reg): Ditto. (ix86_preferred_reload_class): Ditto. * config/i386/i386.md (push and pop peephole2): Ditto. Diff: --- gcc/config/i386/i386-expand.cc | 12 ++++++------ gcc/config/i386/i386.cc | 6 +++--- gcc/config/i386/i386.md | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index deae439814b6..dab5e98a2e35 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -8233,9 +8233,9 @@ emit_memmov (rtx destmem, rtx *srcmem, rtx destptr, rtx srcptr, /* Find the corresponding vector mode with the same size as MOVE_MODE. MOVE_MODE is an integer mode at the moment (SI, DI, TI, etc.). */ - if (GET_MODE_SIZE (move_mode) > GET_MODE_SIZE (word_mode)) + if (GET_MODE_SIZE (move_mode) > UNITS_PER_WORD) { - int nunits = GET_MODE_SIZE (move_mode) / GET_MODE_SIZE (word_mode); + int nunits = GET_MODE_SIZE (move_mode) / UNITS_PER_WORD; if (!mode_for_vector (word_mode, nunits).exists (&move_mode) || (code = optab_handler (mov_optab, move_mode)) == CODE_FOR_nothing) { @@ -8442,7 +8442,7 @@ emit_memset (rtx destmem, rtx destptr, rtx promoted_val, for (i = 0; i < size_to_move; i += piece_size) { - if (piece_size <= GET_MODE_SIZE (word_mode)) + if (piece_size <= UNITS_PER_WORD) { emit_insn (gen_strset (destptr, dst, promoted_val)); dst = adjust_automodify_address_nv (dst, move_mode, destptr, @@ -9703,7 +9703,7 @@ ix86_expand_set_or_cpymem (rtx dst, rtx src, rtx count_exp, rtx val_exp, need_zero_guard = true; unroll_factor = 4; /* Get the vector mode to move STORE_MAX_PIECES/MOVE_MAX bytes. */ - nunits /= GET_MODE_SIZE (word_mode); + nunits /= UNITS_PER_WORD; if (nunits > 1) { move_mode = mode_for_vector (word_mode, nunits).require (); @@ -9800,7 +9800,7 @@ ix86_expand_set_or_cpymem (rtx dst, rtx src, rtx count_exp, rtx val_exp, if (alg == vector_loop) { promoted_val = promote_duplicated_reg_to_size (val_exp, - GET_MODE_SIZE (word_mode), + UNITS_PER_WORD, desired_align, align); /* Duplicate the promoted scalar value if not 0 nor -1. */ vec_promoted_val @@ -10735,7 +10735,7 @@ ix86_expand_set_or_movmem (rtx operands[], bool iscpymem, bool issetmem) { /* Use the vector mode based on WORD_MODE to avoid extra GPR moves. */ - nunits = size / GET_MODE_SIZE (word_mode); + nunits = size / UNITS_PER_WORD; machine_mode vector_mode = mode_for_vector (word_mode, nunits).require (); rtx vector = promote_duplicated_reg (vector_mode, diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 8dc89f2dcde3..d556fd101554 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -14075,7 +14075,7 @@ print_reg (rtx x, int code, FILE *file) if (code == 'V') { if (GENERAL_REGNO_P (regno)) - msize = GET_MODE_SIZE (word_mode); + msize = UNITS_PER_WORD; else error ("%<V%> modifier on non-integer register"); } @@ -14087,7 +14087,7 @@ print_reg (rtx x, int code, FILE *file) case 16: case 12: case 8: - if (GENERAL_REGNO_P (regno) && msize > GET_MODE_SIZE (word_mode)) + if (GENERAL_REGNO_P (regno) && msize > UNITS_PER_WORD) warning (0, "unsupported size for integer register"); /* FALLTHRU */ case 4: @@ -21197,7 +21197,7 @@ ix86_preferred_reload_class (rtx x, reg_class_t regclass) { if (TARGET_INTER_UNIT_MOVES_FROM_VEC && TARGET_INTER_UNIT_MOVES_TO_VEC - && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (word_mode)) + && GET_MODE_SIZE (mode) <= UNITS_PER_WORD) return INT_SSE_CLASS_P (regclass) ? regclass : NO_REGS; else return SSE_CLASS_P (regclass) ? regclass : NO_REGS; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 619cd50bc3bb..ffd588e67cc6 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -30081,7 +30081,7 @@ (clobber (reg:CC FLAGS_REG)) (clobber (mem:BLK (scratch)))])] "(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode) + && INTVAL (operands[0]) == -UNITS_PER_WORD && !ix86_red_zone_used" [(clobber (match_dup 1)) (parallel [(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) @@ -30095,7 +30095,7 @@ (clobber (reg:CC FLAGS_REG)) (clobber (mem:BLK (scratch)))])] "(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode) + && INTVAL (operands[0]) == -2*UNITS_PER_WORD && !ix86_red_zone_used" [(clobber (match_dup 1)) (set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) @@ -30110,7 +30110,7 @@ (match_operand:P 0 "const_int_operand"))) (clobber (reg:CC FLAGS_REG))])] "(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode) + && INTVAL (operands[0]) == -UNITS_PER_WORD && !ix86_red_zone_used" [(clobber (match_dup 1)) (set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1))]) @@ -30122,7 +30122,7 @@ (match_operand:P 0 "const_int_operand"))) (clobber (reg:CC FLAGS_REG))])] "(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode) + && INTVAL (operands[0]) == -2*UNITS_PER_WORD && !ix86_red_zone_used" [(clobber (match_dup 1)) (set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) @@ -30137,7 +30137,7 @@ (clobber (reg:CC FLAGS_REG)) (clobber (mem:BLK (scratch)))])] "(TARGET_SINGLE_POP || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == UNITS_PER_WORD" [(parallel [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) (clobber (mem:BLK (scratch)))])]) @@ -30152,7 +30152,7 @@ (clobber (reg:CC FLAGS_REG)) (clobber (mem:BLK (scratch)))])] "(TARGET_DOUBLE_POP || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == 2*UNITS_PER_WORD" [(parallel [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) (clobber (mem:BLK (scratch)))]) (set (match_dup 2) (mem:W (post_inc:P (reg:P SP_REG))))]) @@ -30165,7 +30165,7 @@ (clobber (reg:CC FLAGS_REG)) (clobber (mem:BLK (scratch)))])] "optimize_insn_for_size_p () - && INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == 2*UNITS_PER_WORD" [(parallel [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) (clobber (mem:BLK (scratch)))]) (set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG))))]) @@ -30177,7 +30177,7 @@ (plus:P (reg:P SP_REG) (match_operand:P 0 "const_int_operand"))) (clobber (reg:CC FLAGS_REG))])] - "INTVAL (operands[0]) == GET_MODE_SIZE (word_mode)" + "INTVAL (operands[0]) == UNITS_PER_WORD" [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG))))]) ;; Two pops case is tricky, since pop causes dependency @@ -30189,7 +30189,7 @@ (plus:P (reg:P SP_REG) (match_operand:P 0 "const_int_operand"))) (clobber (reg:CC FLAGS_REG))])] - "INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" + "INTVAL (operands[0]) == 2*UNITS_PER_WORD" [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) (set (match_dup 2) (mem:W (post_inc:P (reg:P SP_REG))))]) @@ -30200,7 +30200,7 @@ (match_operand:P 0 "const_int_operand"))) (clobber (reg:CC FLAGS_REG))])] "optimize_insn_for_size_p () - && INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == 2*UNITS_PER_WORD" [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) (set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG))))])
