diff options
Diffstat (limited to 'gcc/config/alpha/alpha.c')
-rw-r--r-- | gcc/config/alpha/alpha.c | 347 |
1 files changed, 92 insertions, 255 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index d8d2f4126d1..4885be6227e 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -1453,10 +1453,7 @@ get_aligned_mem (rtx ref, rtx *paligned_mem, rtx *pbitnum) *paligned_mem = widen_memory_access (ref, SImode, -offset); /* Convert the byte offset within the word to a bit offset. */ - if (WORDS_BIG_ENDIAN) - offset = 32 - (GET_MODE_BITSIZE (GET_MODE (ref)) + offset * 8); - else - offset *= 8; + offset *= BITS_PER_UNIT; *pbitnum = GEN_INT (offset); } @@ -3295,8 +3292,6 @@ alpha_expand_unaligned_load (rtx tgt, rtx mem, HOST_WIDE_INT size, { meml = adjust_address (mem, QImode, ofs); memh = adjust_address (mem, QImode, ofs+1); - if (BYTES_BIG_ENDIAN) - tmp = meml, meml = memh, memh = tmp; extl = gen_reg_rtx (DImode); exth = gen_reg_rtx (DImode); emit_insn (gen_zero_extendqidi2 (extl, meml)); @@ -3348,23 +3343,12 @@ alpha_expand_unaligned_load (rtx tgt, rtx mem, HOST_WIDE_INT size, set_mem_alias_set (tmp, 0); emit_move_insn (memh, tmp); - if (WORDS_BIG_ENDIAN && sign && (size == 2 || size == 4)) - { - emit_move_insn (addr, plus_constant (mema, -1)); - - emit_insn (gen_extqh_be (extl, meml, addr)); - emit_insn (gen_extxl_be (exth, memh, GEN_INT (64), addr)); - - addr = expand_binop (DImode, ior_optab, extl, exth, tgt, 1, OPTAB_WIDEN); - addr = expand_binop (DImode, ashr_optab, addr, GEN_INT (64 - size*8), - addr, 1, OPTAB_WIDEN); - } - else if (sign && size == 2) + if (sign && size == 2) { emit_move_insn (addr, plus_constant (mema, ofs+2)); - emit_insn (gen_extxl_le (extl, meml, GEN_INT (64), addr)); - emit_insn (gen_extqh_le (exth, memh, addr)); + emit_insn (gen_extxl (extl, meml, GEN_INT (64), addr)); + emit_insn (gen_extqh (exth, memh, addr)); /* We must use tgt here for the target. Alpha-vms port fails if we use addr for the target, because addr is marked as a pointer and combine @@ -3375,55 +3359,27 @@ alpha_expand_unaligned_load (rtx tgt, rtx mem, HOST_WIDE_INT size, } else { - if (WORDS_BIG_ENDIAN) - { - emit_move_insn (addr, plus_constant (mema, ofs+size-1)); - switch ((int) size) - { - case 2: - emit_insn (gen_extwh_be (extl, meml, addr)); - mode = HImode; - break; - - case 4: - emit_insn (gen_extlh_be (extl, meml, addr)); - mode = SImode; - break; - - case 8: - emit_insn (gen_extqh_be (extl, meml, addr)); - mode = DImode; - break; - - default: - gcc_unreachable (); - } - emit_insn (gen_extxl_be (exth, memh, GEN_INT (size*8), addr)); - } - else + emit_move_insn (addr, plus_constant (mema, ofs)); + emit_insn (gen_extxl (extl, meml, GEN_INT (size*8), addr)); + switch ((int) size) { - emit_move_insn (addr, plus_constant (mema, ofs)); - emit_insn (gen_extxl_le (extl, meml, GEN_INT (size*8), addr)); - switch ((int) size) - { - case 2: - emit_insn (gen_extwh_le (exth, memh, addr)); - mode = HImode; - break; + case 2: + emit_insn (gen_extwh (exth, memh, addr)); + mode = HImode; + break; - case 4: - emit_insn (gen_extlh_le (exth, memh, addr)); - mode = SImode; - break; + case 4: + emit_insn (gen_extlh (exth, memh, addr)); + mode = SImode; + break; - case 8: - emit_insn (gen_extqh_le (exth, memh, addr)); - mode = DImode; - break; + case 8: + emit_insn (gen_extqh (exth, memh, addr)); + mode = DImode; + break; - default: - gcc_unreachable (); - } + default: + gcc_unreachable (); } addr = expand_binop (mode, ior_optab, gen_lowpart (mode, extl), @@ -3457,8 +3413,6 @@ alpha_expand_unaligned_store (rtx dst, rtx src, meml = adjust_address (dst, QImode, ofs); memh = adjust_address (dst, QImode, ofs+1); - if (BYTES_BIG_ENDIAN) - addr = meml, meml = memh, memh = addr; emit_move_insn (meml, dstl); emit_move_insn (memh, dsth); @@ -3492,86 +3446,48 @@ alpha_expand_unaligned_store (rtx dst, rtx src, emit_move_insn (dsth, memh); emit_move_insn (dstl, meml); - if (WORDS_BIG_ENDIAN) - { - addr = copy_addr_to_reg (plus_constant (dsta, ofs+size-1)); - if (src != const0_rtx) - { - switch ((int) size) - { - case 2: - emit_insn (gen_inswl_be (insh, gen_lowpart (HImode,src), addr)); - break; - case 4: - emit_insn (gen_insll_be (insh, gen_lowpart (SImode,src), addr)); - break; - case 8: - emit_insn (gen_insql_be (insh, gen_lowpart (DImode,src), addr)); - break; - } - emit_insn (gen_insxh (insl, gen_lowpart (DImode, src), - GEN_INT (size*8), addr)); - } + addr = copy_addr_to_reg (plus_constant (dsta, ofs)); + + if (src != CONST0_RTX (GET_MODE (src))) + { + emit_insn (gen_insxh (insh, gen_lowpart (DImode, src), + GEN_INT (size*8), addr)); switch ((int) size) { case 2: - emit_insn (gen_mskxl_be (dsth, dsth, GEN_INT (0xffff), addr)); + emit_insn (gen_inswl (insl, gen_lowpart (HImode, src), addr)); break; case 4: - { - rtx msk = immed_double_const (0xffffffff, 0, DImode); - emit_insn (gen_mskxl_be (dsth, dsth, msk, addr)); - break; - } + emit_insn (gen_insll (insl, gen_lowpart (SImode, src), addr)); + break; case 8: - emit_insn (gen_mskxl_be (dsth, dsth, constm1_rtx, addr)); + emit_insn (gen_insql (insl, gen_lowpart (DImode, src), addr)); break; + default: + gcc_unreachable (); } - - emit_insn (gen_mskxh (dstl, dstl, GEN_INT (size*8), addr)); } - else - { - addr = copy_addr_to_reg (plus_constant (dsta, ofs)); - - if (src != CONST0_RTX (GET_MODE (src))) - { - emit_insn (gen_insxh (insh, gen_lowpart (DImode, src), - GEN_INT (size*8), addr)); - - switch ((int) size) - { - case 2: - emit_insn (gen_inswl_le (insl, gen_lowpart (HImode, src), addr)); - break; - case 4: - emit_insn (gen_insll_le (insl, gen_lowpart (SImode, src), addr)); - break; - case 8: - emit_insn (gen_insql_le (insl, gen_lowpart (DImode, src), addr)); - break; - } - } - emit_insn (gen_mskxh (dsth, dsth, GEN_INT (size*8), addr)); + emit_insn (gen_mskxh (dsth, dsth, GEN_INT (size*8), addr)); - switch ((int) size) - { - case 2: - emit_insn (gen_mskxl_le (dstl, dstl, GEN_INT (0xffff), addr)); - break; - case 4: - { - rtx msk = immed_double_const (0xffffffff, 0, DImode); - emit_insn (gen_mskxl_le (dstl, dstl, msk, addr)); - break; - } - case 8: - emit_insn (gen_mskxl_le (dstl, dstl, constm1_rtx, addr)); - break; - } + switch ((int) size) + { + case 2: + emit_insn (gen_mskxl (dstl, dstl, GEN_INT (0xffff), addr)); + break; + case 4: + { + rtx msk = immed_double_const (0xffffffff, 0, DImode); + emit_insn (gen_mskxl (dstl, dstl, msk, addr)); + break; + } + case 8: + emit_insn (gen_mskxl (dstl, dstl, constm1_rtx, addr)); + break; + default: + gcc_unreachable (); } if (src != CONST0_RTX (GET_MODE (src))) @@ -3580,17 +3496,9 @@ alpha_expand_unaligned_store (rtx dst, rtx src, dstl = expand_binop (DImode, ior_optab, insl, dstl, dstl, 0, OPTAB_WIDEN); } - if (WORDS_BIG_ENDIAN) - { - emit_move_insn (meml, dstl); - emit_move_insn (memh, dsth); - } - else - { - /* Must store high before low for degenerate case of aligned. */ - emit_move_insn (memh, dsth); - emit_move_insn (meml, dstl); - } + /* Must store high before low for degenerate case of aligned. */ + emit_move_insn (memh, dsth); + emit_move_insn (meml, dstl); } /* The block move code tries to maximize speed by separating loads and @@ -3653,20 +3561,10 @@ alpha_expand_unaligned_load_words (rtx *out_regs, rtx smem, sreg = copy_addr_to_reg (smema); areg = expand_binop (DImode, and_optab, sreg, GEN_INT (7), NULL, 1, OPTAB_WIDEN); - if (WORDS_BIG_ENDIAN) - emit_move_insn (sreg, plus_constant (sreg, 7)); for (i = 0; i < words; ++i) { - if (WORDS_BIG_ENDIAN) - { - emit_insn (gen_extqh_be (data_regs[i], data_regs[i], sreg)); - emit_insn (gen_extxl_be (ext_tmps[i], data_regs[i+1], i64, sreg)); - } - else - { - emit_insn (gen_extxl_le (data_regs[i], data_regs[i], i64, sreg)); - emit_insn (gen_extqh_le (ext_tmps[i], data_regs[i+1], sreg)); - } + emit_insn (gen_extxl (data_regs[i], data_regs[i], i64, sreg)); + emit_insn (gen_extqh (ext_tmps[i], data_regs[i+1], sreg)); emit_insn (gen_rtx_SET (VOIDmode, ext_tmps[i], gen_rtx_IF_THEN_ELSE (DImode, gen_rtx_EQ (DImode, areg, @@ -3726,22 +3624,12 @@ alpha_expand_unaligned_store_words (rtx *data_regs, rtx dmem, /* Shift the input data into place. */ dreg = copy_addr_to_reg (dmema); - if (WORDS_BIG_ENDIAN) - emit_move_insn (dreg, plus_constant (dreg, 7)); if (data_regs != NULL) { for (i = words-1; i >= 0; --i) { - if (WORDS_BIG_ENDIAN) - { - emit_insn (gen_insql_be (ins_tmps[i], data_regs[i], dreg)); - emit_insn (gen_insxh (data_regs[i], data_regs[i], i64, dreg)); - } - else - { - emit_insn (gen_insxh (ins_tmps[i], data_regs[i], i64, dreg)); - emit_insn (gen_insql_le (data_regs[i], data_regs[i], dreg)); - } + emit_insn (gen_insxh (ins_tmps[i], data_regs[i], i64, dreg)); + emit_insn (gen_insql (data_regs[i], data_regs[i], dreg)); } for (i = words-1; i > 0; --i) { @@ -3752,16 +3640,8 @@ alpha_expand_unaligned_store_words (rtx *data_regs, rtx dmem, } /* Split and merge the ends with the destination data. */ - if (WORDS_BIG_ENDIAN) - { - emit_insn (gen_mskxl_be (st_tmp_2, st_tmp_2, constm1_rtx, dreg)); - emit_insn (gen_mskxh (st_tmp_1, st_tmp_1, i64, dreg)); - } - else - { - emit_insn (gen_mskxh (st_tmp_2, st_tmp_2, i64, dreg)); - emit_insn (gen_mskxl_le (st_tmp_1, st_tmp_1, constm1_rtx, dreg)); - } + emit_insn (gen_mskxh (st_tmp_2, st_tmp_2, i64, dreg)); + emit_insn (gen_mskxl (st_tmp_1, st_tmp_1, constm1_rtx, dreg)); if (data_regs != NULL) { @@ -3772,24 +3652,17 @@ alpha_expand_unaligned_store_words (rtx *data_regs, rtx dmem, } /* Store it all. */ - if (WORDS_BIG_ENDIAN) - emit_move_insn (st_addr_1, st_tmp_1); - else - emit_move_insn (st_addr_2, st_tmp_2); + emit_move_insn (st_addr_2, st_tmp_2); for (i = words-1; i > 0; --i) { rtx tmp = change_address (dmem, DImode, gen_rtx_AND (DImode, - plus_constant(dmema, - WORDS_BIG_ENDIAN ? i*8-1 : i*8), + plus_constant (dmema, i*8), im8)); set_mem_alias_set (tmp, 0); emit_move_insn (tmp, data_regs ? ins_tmps[i-1] : const0_rtx); } - if (WORDS_BIG_ENDIAN) - emit_move_insn (st_addr_2, st_tmp_2); - else - emit_move_insn (st_addr_1, st_tmp_1); + emit_move_insn (st_addr_1, st_tmp_1); } @@ -4438,20 +4311,11 @@ emit_insxl (enum machine_mode mode, rtx op1, rtx op2) rtx ret = gen_reg_rtx (DImode); rtx (*fn) (rtx, rtx, rtx); - if (WORDS_BIG_ENDIAN) - { - if (mode == QImode) - fn = gen_insbl_be; - else - fn = gen_inswl_be; - } + if (mode == QImode) + fn = gen_insbl; else - { - if (mode == QImode) - fn = gen_insbl_le; - else - fn = gen_inswl_le; - } + fn = gen_inswl; + /* The insbl and inswl patterns require a register operand. */ op1 = force_reg (mode, op1); emit_insn (fn (ret, op1, op2)); @@ -4584,10 +4448,7 @@ alpha_split_compare_and_swap_12 (enum machine_mode mode, rtx dest, rtx addr, width = GEN_INT (GET_MODE_BITSIZE (mode)); mask = GEN_INT (mode == QImode ? 0xff : 0xffff); - if (WORDS_BIG_ENDIAN) - emit_insn (gen_extxl_be (dest, scratch, width, addr)); - else - emit_insn (gen_extxl_le (dest, scratch, width, addr)); + emit_insn (gen_extxl (dest, scratch, width, addr)); if (oldval == const0_rtx) x = gen_rtx_NE (DImode, dest, const0_rtx); @@ -4599,10 +4460,7 @@ alpha_split_compare_and_swap_12 (enum machine_mode mode, rtx dest, rtx addr, } emit_unlikely_jump (x, label2); - if (WORDS_BIG_ENDIAN) - emit_insn (gen_mskxl_be (scratch, scratch, mask, addr)); - else - emit_insn (gen_mskxl_le (scratch, scratch, mask, addr)); + emit_insn (gen_mskxl (scratch, scratch, mask, addr)); emit_insn (gen_iordi3 (scratch, scratch, newval)); emit_store_conditional (DImode, scratch, mem, scratch); @@ -4678,16 +4536,8 @@ alpha_split_lock_test_and_set_12 (enum machine_mode mode, rtx dest, rtx addr, width = GEN_INT (GET_MODE_BITSIZE (mode)); mask = GEN_INT (mode == QImode ? 0xff : 0xffff); - if (WORDS_BIG_ENDIAN) - { - emit_insn (gen_extxl_be (dest, scratch, width, addr)); - emit_insn (gen_mskxl_be (scratch, scratch, mask, addr)); - } - else - { - emit_insn (gen_extxl_le (dest, scratch, width, addr)); - emit_insn (gen_mskxl_le (scratch, scratch, mask, addr)); - } + emit_insn (gen_extxl (dest, scratch, width, addr)); + emit_insn (gen_mskxl (scratch, scratch, mask, addr)); emit_insn (gen_iordi3 (scratch, scratch, val)); emit_store_conditional (DImode, scratch, mem, scratch); @@ -5279,20 +5129,13 @@ print_operand (FILE *file, rtx x, int code) break; case 's': - /* Write the constant value divided by 8 for little-endian mode or - (56 - value) / 8 for big-endian mode. */ - + /* Write the constant value divided by 8. */ if (!CONST_INT_P (x) - || (unsigned HOST_WIDE_INT) INTVAL (x) >= (WORDS_BIG_ENDIAN - ? 56 - : 64) + || (unsigned HOST_WIDE_INT) INTVAL (x) >= 64 || (INTVAL (x) & 7) != 0) output_operand_lossage ("invalid %%s value"); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - WORDS_BIG_ENDIAN - ? (56 - INTVAL (x)) / 8 - : INTVAL (x) / 8); + fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) / 8); break; case 'S': @@ -6391,27 +6234,27 @@ enum alpha_builtin static enum insn_code const code_for_builtin[ALPHA_BUILTIN_max] = { CODE_FOR_builtin_cmpbge, - CODE_FOR_builtin_extbl, - CODE_FOR_builtin_extwl, - CODE_FOR_builtin_extll, - CODE_FOR_builtin_extql, - CODE_FOR_builtin_extwh, - CODE_FOR_builtin_extlh, - CODE_FOR_builtin_extqh, + CODE_FOR_extbl, + CODE_FOR_extwl, + CODE_FOR_extll, + CODE_FOR_extql, + CODE_FOR_extwh, + CODE_FOR_extlh, + CODE_FOR_extqh, CODE_FOR_builtin_insbl, CODE_FOR_builtin_inswl, CODE_FOR_builtin_insll, - CODE_FOR_builtin_insql, - CODE_FOR_builtin_inswh, - CODE_FOR_builtin_inslh, - CODE_FOR_builtin_insqh, - CODE_FOR_builtin_mskbl, - CODE_FOR_builtin_mskwl, - CODE_FOR_builtin_mskll, - CODE_FOR_builtin_mskql, - CODE_FOR_builtin_mskwh, - CODE_FOR_builtin_msklh, - CODE_FOR_builtin_mskqh, + CODE_FOR_insql, + CODE_FOR_inswh, + CODE_FOR_inslh, + CODE_FOR_insqh, + CODE_FOR_mskbl, + CODE_FOR_mskwl, + CODE_FOR_mskll, + CODE_FOR_mskql, + CODE_FOR_mskwh, + CODE_FOR_msklh, + CODE_FOR_mskqh, CODE_FOR_umuldi3_highpart, CODE_FOR_builtin_zap, CODE_FOR_builtin_zapnot, @@ -6779,9 +6622,7 @@ alpha_fold_builtin_extxx (tree op[], unsigned HOST_WIDE_INT opint[], unsigned HOST_WIDE_INT loc; loc = opint[1] & 7; - if (BYTES_BIG_ENDIAN) - loc ^= 7; - loc *= 8; + loc *= BITS_PER_UNIT; if (loc != 0) { @@ -6820,8 +6661,6 @@ alpha_fold_builtin_insxx (tree op[], unsigned HOST_WIDE_INT opint[], tree *zap_op = NULL; loc = opint[1] & 7; - if (BYTES_BIG_ENDIAN) - loc ^= 7; bytemask <<= loc; temp = opint[0]; @@ -6861,8 +6700,6 @@ alpha_fold_builtin_mskxx (tree op[], unsigned HOST_WIDE_INT opint[], unsigned HOST_WIDE_INT loc; loc = opint[1] & 7; - if (BYTES_BIG_ENDIAN) - loc ^= 7; bytemask <<= loc; if (is_high) |