Skip to content

Commit 588cff7

Browse files
Claudiu Zissulescuartemiy-volkov
authored andcommitted
arc64: Use sign_extend when loading.
1 parent be8c453 commit 588cff7

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

gcc/config/arc64/arc64.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,17 +2791,6 @@ arc_expand_compare_and_swap_qh (rtx bool_result, rtx result, rtx mem,
27912791
emit_move_insn (result, gen_lowpart (GET_MODE (result), res));
27922792
}
27932793

2794-
/* On some RISC architectures with 64-bit registers, the processor
2795-
also maintains 32-bit condition codes that make it possible to do
2796-
real 32-bit arithmetic, although the operations are performed on
2797-
the full registers. This hook needs to be define if
2798-
WORD_REGISTER_OPERATIONS is not defined to 1. */
2799-
2800-
static unsigned int
2801-
arc64_min_arithmeric_precision (void)
2802-
{
2803-
return 32;
2804-
}
28052794

28062795
/* This hook may conditionally modify five variables: fixed_regs,
28072796
call_used_regs, global_regs, reg_names and reg_class_contents. */
@@ -3470,6 +3459,12 @@ arc64_rtx_costs (rtx x, machine_mode mode, rtx_code outer,
34703459
op0 = XEXP (x, 0);
34713460

34723461
/* Zero extending from an SI operation is cheap. */
3462+
if (MEM_P (op0))
3463+
{
3464+
/* All loads can zero extend to any size for free. */
3465+
*cost += rtx_cost (op0, VOIDmode, ZERO_EXTEND, 0, speed);
3466+
return true;
3467+
}
34733468
if (mode == DImode
34743469
&& GET_MODE (op0) == SImode
34753470
&& outer == SET)
@@ -3479,12 +3474,6 @@ arc64_rtx_costs (rtx x, machine_mode mode, rtx_code outer,
34793474
*cost = op_cost;
34803475
return true;
34813476
}
3482-
else if (MEM_P (op0))
3483-
{
3484-
/* All loads can zero extend to any size for free. */
3485-
*cost = rtx_cost (op0, VOIDmode, ZERO_EXTEND, 0, speed);
3486-
return true;
3487-
}
34883477
break;
34893478

34903479
case SIGN_EXTEND:
@@ -4926,9 +4915,6 @@ arc64_expand_fvect_shr (rtx *operands)
49264915
#undef TARGET_MACHINE_DEPENDENT_REORG
49274916
#define TARGET_MACHINE_DEPENDENT_REORG arc64_reorg
49284917

4929-
#undef TARGET_MIN_ARITHMETIC_PRECISION
4930-
#define TARGET_MIN_ARITHMETIC_PRECISION arc64_min_arithmeric_precision
4931-
49324918
#undef TARGET_CONDITIONAL_REGISTER_USAGE
49334919
#define TARGET_CONDITIONAL_REGISTER_USAGE arc64_conditional_register_usage
49344920

gcc/config/arc64/arc64.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,15 @@ enum reg_class
344344
/* Tell GCC to use RETURN_IN_MEMORY. */
345345
#define DEFAULT_PCC_STRUCT_RETURN 0
346346

347-
/* WORD_REGISTER_OPERATIONS does not hold for arc64. The assigned
348-
word_mode is DImode but operations narrower than SImode behave as
349-
32-bit operations. */
350-
#define WORD_REGISTER_OPERATIONS 0
347+
/* To be check: WORD_REGISTER_OPERATIONS, ARC64 has 32bit
348+
opertations. */
349+
#define WORD_REGISTER_OPERATIONS 1
351350

352351
/* Define if loading from memory in MODE, an integral mode narrower than
353352
BITS_PER_WORD will either zero-extend or sign-extend. The value of this
354353
macro should be the code that says which one of the two operations is
355354
implicitly done, or UNKNOWN if none. */
356-
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
355+
#define LOAD_EXTEND_OP(MODE) (((MODE) == SImode) ? SIGN_EXTEND : ZERO_EXTEND)
357356

358357
#define SLOW_BYTE_ACCESS 0
359358

gcc/config/arc64/arc64.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ vfrep, vpack, xbfu, xor, xorl"
15181518
[(set (match_operand:DI 0 "register_operand" "=r,r")
15191519
(sign_extend:DI
15201520
(match_operand:EXT 1 "nonimmediate_operand" "r,m")))]
1521-
""
1521+
"(!TARGET_VOLATILE_DI) || (!MEM_VOLATILE_P (operands[1]))"
15221522
"@
15231523
sex<exttab>l\\t%0,%1
15241524
ld<sfxtab>.x%U1\\t%0,%1"

0 commit comments

Comments
 (0)