@@ -564,7 +564,8 @@ static bool
564
564
arc64_legitimate_address_1_p (machine_mode mode ,
565
565
rtx x ,
566
566
bool strict ATTRIBUTE_UNUSED ,
567
- bool load_p )
567
+ bool load_p ,
568
+ bool scaling_p )
568
569
{
569
570
if (REG_P (x ))
570
571
return true;
@@ -577,7 +578,8 @@ arc64_legitimate_address_1_p (machine_mode mode,
577
578
offset as address. */
578
579
if (GET_CODE (x ) == PLUS
579
580
&& REG_P (XEXP (x , 0 ))
580
- && (ARC64_CHECK_SMALL_IMMEDIATE (XEXP (x , 1 ), mode )
581
+ && (ARC64_CHECK_SMALL_IMMEDIATE (XEXP (x , 1 ),
582
+ scaling_p ? mode : QImode )
581
583
|| (load_p && CONST_INT_P (XEXP (x , 1 ))
582
584
&& !lra_in_progress && !optimize_size )))
583
585
return true;
@@ -590,7 +592,8 @@ arc64_legitimate_address_1_p (machine_mode mode,
590
592
return true;
591
593
592
594
/* Scalled addresses. */
593
- if (GET_CODE (x ) == PLUS
595
+ if (scaling_p
596
+ && GET_CODE (x ) == PLUS
594
597
&& GET_CODE (XEXP (x , 0 )) == MULT
595
598
&& ((load_p && REG_P (XEXP (x , 1 )))
596
599
|| (load_p && CONST_INT_P (XEXP (x , 1 )))
@@ -615,7 +618,8 @@ arc64_legitimate_address_1_p (machine_mode mode,
615
618
return true;
616
619
617
620
if ((GET_CODE (x ) == PRE_MODIFY || GET_CODE (x ) == POST_MODIFY ))
618
- return arc64_legitimate_address_1_p (mode , XEXP (x , 1 ), strict , load_p );
621
+ return arc64_legitimate_address_1_p (mode , XEXP (x , 1 ), strict ,
622
+ load_p , false);
619
623
620
624
/* PIC address (LARGE). */
621
625
if (GET_CODE (x ) == LO_SUM
@@ -651,7 +655,7 @@ arc64_legitimate_address_p (machine_mode mode,
651
655
bool strict ATTRIBUTE_UNUSED )
652
656
{
653
657
/* Allow all the addresses accepted by load. */
654
- return arc64_legitimate_address_1_p (mode , x , strict , true);
658
+ return arc64_legitimate_address_1_p (mode , x , strict , true, true );
655
659
}
656
660
657
661
/* Implement TARGET_LEGITIMATE_CONSTANT_P hook. Return true for constants
@@ -2519,7 +2523,8 @@ arc64_prepare_move_operands (rtx op0, rtx op1, machine_mode mode)
2519
2523
2520
2524
/* Check and fix unsupported store addresses. */
2521
2525
if (MEM_P (op0 )
2522
- && !arc64_legitimate_address_1_p (mode , XEXP (op0 , 0 ), false, false))
2526
+ && !arc64_legitimate_address_1_p (mode , XEXP (op0 , 0 ), false,
2527
+ false, true))
2523
2528
{
2524
2529
rtx tmp = gen_reg_rtx (Pmode );
2525
2530
rtx addr = XEXP (op0 , 0 );
@@ -2884,7 +2889,7 @@ arc64_limm_addr_p (rtx op)
2884
2889
bool
2885
2890
arc64_legitimate_store_address_p (machine_mode mode , rtx addr )
2886
2891
{
2887
- return arc64_legitimate_address_1_p (mode , addr , true, false);
2892
+ return arc64_legitimate_address_1_p (mode , addr , true, false, true );
2888
2893
}
2889
2894
2890
2895
/* Return true if an address fits a short load/store instruction. */
0 commit comments