summaryrefslogtreecommitdiff
path: root/gcc/config/arc/predicates.md
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2017-03-27 12:56:14 +0200
committerClaudiu Zissulescu <claziss@gcc.gnu.org>2017-03-27 12:56:14 +0200
commitac2551850669c3013b1b6e142a167060328ff52d (patch)
tree932a01f52bdd5ce1ba609e7395383d4da83390bf /gcc/config/arc/predicates.md
parent84804c5b47636c7fa8bbbd1481ed426f2efc2654 (diff)
downloadgcc-ac2551850669c3013b1b6e142a167060328ff52d.tar.gz
[ARC] Fix detection of long immediate for load/store operands.
ARC can use scaled offsets when loading (i.e. ld.as rA,[base, offset]). Where base and offset can be a register or an immediate operand. The scaling only applies on the offset part of the instruction. The compiler can accept an address like this: (plus:SI (mult:SI (reg:SI 2 r2 [orig:596 _2129 ] [596]) (const_int 4 [0x4])) (const_int 60 [0x3c])) Hence, to emit this instruction we place the (const_int 60) into base and the register into offset to take advantage of the scaled offset facility of the load instruction. As a result the length of the load instruction is 8 bytes. However, the long_immediate_loadstore_operand predicate used for calculating the length attribute doesn't recognize this address and returns a wrong decision leading to a wrong length computation for a load instruction using the above address. gcc/ 2017-03-27 Claudiu Zissulescu <claziss@synopsys.com> * config/arc/predicates.md (long_immediate_loadstore_operand): Consider scaled addresses cases. From-SVN: r246496
Diffstat (limited to 'gcc/config/arc/predicates.md')
-rw-r--r--gcc/config/arc/predicates.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/config/arc/predicates.md b/gcc/config/arc/predicates.md
index 0dec736be5f..8dd8d558b9e 100644
--- a/gcc/config/arc/predicates.md
+++ b/gcc/config/arc/predicates.md
@@ -148,6 +148,11 @@
{
rtx x = XEXP (op, 1);
+ if ((GET_CODE (XEXP (op, 0)) == MULT)
+ && REG_P (XEXP (XEXP (op, 0), 0))
+ && CONSTANT_P (x))
+ return 1;
+
if (GET_CODE (x) == CONST)
{
x = XEXP (x, 0);