Skip to content

Commit 3476d6e

Browse files
clazissartemiy-volkov
authored andcommitted
Handle SP updates with large 64bit constants.
1 parent 6e04e0c commit 3476d6e

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

gcc/config/arc64/arc64.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,22 @@ static void
256256
frame_stack_add (HOST_WIDE_INT offset)
257257
{
258258
rtx tmp;
259+
HOST_WIDE_INT lo = sext_hwi (offset, 32);
260+
unsigned HOST_WIDE_INT hi = sext_hwi (offset >> 32, 32);
261+
262+
if (hi != 0xffffffffULL || hi != 0ULL)
263+
tmp = gen_rtx_SET (stack_pointer_rtx,
264+
gen_rtx_PLUS (Pmode, stack_pointer_rtx,
265+
gen_rtx_HIGH (Pmode, GEN_INT (hi))));
259266

260267
tmp = gen_rtx_SET (stack_pointer_rtx,
261-
plus_constant (Pmode, stack_pointer_rtx, offset));
268+
plus_constant (Pmode, stack_pointer_rtx, lo));
262269
tmp = emit_insn (tmp);
263270
RTX_FRAME_RELATED_P (tmp) = 1;
271+
add_reg_note (tmp, REG_FRAME_RELATED_EXPR,
272+
gen_rtx_SET (stack_pointer_rtx,
273+
plus_constant (Pmode, stack_pointer_rtx,
274+
offset)));
264275
}
265276

266277
/* Helper for prologue: emit frame store with pre_modify or pre_dec to

gcc/config/arc64/arc64.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@
191191
;; Instruction types and attributes
192192
;; -------------------------------------------------------------------
193193

194-
(define_attr "type" "abs, add, addl, and, andl, asl, asll, asr, asrl,
195-
bl, block, bmsk, branch, branchcc, bset, bsetl, bxor, bxorl, compare,
196-
div, jl, jump, ld, lsr, lsrl, max, maxl, min, minl, move, neg, nop,
197-
norm, normh, norml, not, notl, or, orl, rem, reml, remu, remul,
198-
return, ror, setcc, sex, st, sub, subl, swape, swapel, udiv, udivl,
199-
unknown, xor, xorl"
194+
(define_attr "type" "abs, add, addhl, addl, and, andl, asl, asll, asr,
195+
asrl, bl, block, bmsk, branch, branchcc, bset, bsetl, bxor, bxorl,
196+
compare, div, jl, jump, ld, lsr, lsrl, max, maxl, min, minl, move,
197+
neg, nop, norm, normh, norml, not, notl, or, orl, rem, reml, remu,
198+
remul, return, ror, setcc, sex, st, sub, subl, swape, swapel, udiv,
199+
udivl, unknown, xor, xorl"
200200
(const_string "unknown"))
201201

202202
(define_attr "iscompact" "yes,no,maybe" (const_string "no"))
@@ -409,14 +409,30 @@ unknown, xor, xorl"
409409

410410
(define_insn "*movdi_lo_sum_iori"
411411
[(set (match_operand:DI 0 "register_operand" "=q, r, h, r")
412-
(lo_sum:DI (match_operand:DI 1 "register_operand" "0, r, 0, r")
412+
(lo_sum:DI (match_operand:DI 1 "register_operand" "0, 0, 0, r")
413413
(match_operand:DI 2 "immediate_operand" "q,S12S0,SymIm,SymIm")))]
414414
""
415415
"orl%?\\t%0,%1,%L2"
416416
[(set_attr "type" "or")
417417
(set_attr "iscompact" "yes,no,yes,no")
418418
(set_attr "length" "2,4,6,8")])
419419

420+
(define_insn "*adddi_high"
421+
[(set (match_operand:DI 0 "register_operand" "= qh, r, r,r, r")
422+
(plus:DI (match_operand:DI 1 "register_operand" " 0, 0, r,r, r")
423+
(high:DI
424+
(match_operand:DI 2 "nonmemory_operand" "S32S0,S12S0,U06S0,r,S32S0"))))]
425+
""
426+
"@
427+
addhl_s\\t%0,%1,%2
428+
addhl\\t%0,%1,%2
429+
addhl\\t%0,%1,%2
430+
addhl\\t%0,%1,%2
431+
addhl\\t%0,%1,%2"
432+
[(set_attr "type" "addhl")
433+
(set_attr "iscompact" "yes,no,no,no,no")
434+
(set_attr "length" "6,4,4,4,8")])
435+
420436
;; -------------------------------------------------------------------
421437
;; Subroutine calls and sibcalls
422438
;; -------------------------------------------------------------------

0 commit comments

Comments
 (0)