@@ -13621,7 +13621,7 @@ rs6000_indirect_call_template_1 (rtx *operands, unsigned int funop,
if (DEFAULT_ABI == ABI_AIX)
s += sprintf (s,
"l%s 2,%%%u\n\t",
- ptrload, funop + 2);
+ ptrload, funop + 3);
/* We don't need the extra code to stop indirect call speculation if
calling via LR. */
@@ -13675,12 +13675,12 @@ rs6000_indirect_call_template_1 (rtx *operands, unsigned int funop,
sprintf (s,
"b%%T%ul\n\t"
"l%s 2,%%%u(1)",
- funop, ptrload, funop + 3);
+ funop, ptrload, funop + 4);
else
sprintf (s,
"beq%%T%ul-\n\t"
"l%s 2,%%%u(1)",
- funop, ptrload, funop + 3);
+ funop, ptrload, funop + 4);
}
else if (DEFAULT_ABI == ABI_ELFv2)
{
@@ -13688,12 +13688,12 @@ rs6000_indirect_call_template_1 (rtx *operands, unsigned int funop,
sprintf (s,
"b%%T%ul\n\t"
"l%s 2,%%%u(1)",
- funop, ptrload, funop + 2);
+ funop, ptrload, funop + 3);
else
sprintf (s,
"beq%%T%ul-\n\t"
"l%s 2,%%%u(1)",
- funop, ptrload, funop + 2);
+ funop, ptrload, funop + 3);
}
else
{
@@ -24304,7 +24304,7 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx tlsarg, rtx cookie)
rtx toc_restore = NULL_RTX;
rtx func_addr;
rtx abi_reg = NULL_RTX;
- rtx call[4];
+ rtx call[5];
int n_call;
rtx insn;
bool is_pltseq_longcall;
@@ -24445,7 +24445,8 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx tlsarg, rtx cookie)
call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_addr), tlsarg);
if (value != NULL_RTX)
call[0] = gen_rtx_SET (value, call[0]);
- n_call = 1;
+ call[1] = gen_rtx_USE (VOIDmode, cookie);
+ n_call = 2;
if (toc_load)
call[n_call++] = toc_load;
@@ -10459,11 +10459,11 @@
;; variable argument function. It is > 0 if FP registers were passed
;; and < 0 if they were not.
-(define_insn "*call_local32"
- [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
+(define_insn "*call_local<mode>"
+ [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s,s"))
(match_operand 1))
(use (match_operand:SI 2 "immediate_operand" "O,n"))
- (clobber (reg:SI LR_REGNO))]
+ (clobber (reg:P LR_REGNO))]
"(INTVAL (operands[2]) & CALL_LONG) == 0"
{
if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
@@ -10472,35 +10472,19 @@
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
output_asm_insn ("creqv 6,6,6", operands);
+ if (rs6000_pcrel_p (cfun))
+ return "bl %z0@notoc";
return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@local" : "bl %z0";
}
[(set_attr "type" "branch")
(set_attr "length" "4,8")])
-(define_insn "*call_local64"
- [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
- (match_operand 1))
- (use (match_operand:SI 2 "immediate_operand" "O,n"))
- (clobber (reg:DI LR_REGNO))]
- "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
-{
- if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn ("crxor 6,6,6", operands);
-
- else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn ("creqv 6,6,6", operands);
-
- return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@local" : "bl %z0";
-}
- [(set_attr "type" "branch")
- (set_attr "length" "4,8")])
-
-(define_insn "*call_value_local32"
+(define_insn "*call_value_local<mode>"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
+ (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s,s"))
(match_operand 2)))
(use (match_operand:SI 3 "immediate_operand" "O,n"))
- (clobber (reg:SI LR_REGNO))]
+ (clobber (reg:P LR_REGNO))]
"(INTVAL (operands[3]) & CALL_LONG) == 0"
{
if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
@@ -10509,26 +10493,8 @@
else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
output_asm_insn ("creqv 6,6,6", operands);
- return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@local" : "bl %z1";
-}
- [(set_attr "type" "branch")
- (set_attr "length" "4,8")])
-
-
-(define_insn "*call_value_local64"
- [(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
- (match_operand 2)))
- (use (match_operand:SI 3 "immediate_operand" "O,n"))
- (clobber (reg:DI LR_REGNO))]
- "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
-{
- if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn ("crxor 6,6,6", operands);
-
- else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn ("creqv 6,6,6", operands);
-
+ if (rs6000_pcrel_p (cfun))
+ return "bl %z1@notoc";
return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@local" : "bl %z1";
}
[(set_attr "type" "branch")
@@ -10687,41 +10653,16 @@
(const_int 8)
(const_int 4)))])
-;; Call to AIX abi function in the same module.
-
-(define_insn "*call_local_aix<mode>"
- [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
- (match_operand 1))
- (clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
-{
- if (rs6000_pcrel_p (cfun))
- return "bl %z0@notoc";
- return "bl %z0";
-}
- [(set_attr "type" "branch")])
-
-(define_insn "*call_value_local_aix<mode>"
- [(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
- (match_operand 2)))
- (clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
-{
- if (rs6000_pcrel_p (cfun))
- return "bl %z1@notoc";
- return "bl %z1";
-}
- [(set_attr "type" "branch")])
-
;; Call to AIX abi function which may be in another module.
;; Restore the TOC pointer (r2) after the call.
(define_insn "*call_nonlocal_aix<mode>"
[(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
(match_operand 1))
+ (use (match_operand:SI 2 "immediate_operand" "n"))
(clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
+ "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
+ && (INTVAL (operands[2]) & CALL_LONG) == 0"
{
return rs6000_call_template (operands, 0);
}
@@ -10735,8 +10676,10 @@
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
(match_operand:P 2 "unspec_tls" "")))
+ (use (match_operand:SI 3 "immediate_operand" "n"))
(clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
+ "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
+ && (INTVAL (operands[3]) & CALL_LONG) == 0"
{
return rs6000_call_template (operands, 1);
}
@@ -10748,14 +10691,15 @@
;; Call to indirect functions with the AIX abi using a 3 word descriptor.
;; Operand0 is the addresss of the function to call
-;; Operand2 is the location in the function descriptor to load r2 from
-;; Operand3 is the offset of the stack location holding the current TOC pointer
+;; Operand3 is the location in the function descriptor to load r2 from
+;; Operand4 is the offset of the stack location holding the current TOC pointer
(define_insn "*call_indirect_aix<mode>"
[(call (mem:SI (match_operand:P 0 "indirect_call_operand" "c,*l,X"))
(match_operand 1))
- (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>,<ptrm>"))
- (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 3 "const_int_operand" "n,n,n")] UNSPEC_TOCSLOT))
+ (use (match_operand:SI 2 "immediate_operand" "n,n,n"))
+ (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>,<ptrm>"))
+ (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 4 "const_int_operand" "n,n,n")] UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX"
{
@@ -10772,9 +10716,10 @@
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "indirect_call_operand" "c,*l,X"))
(match_operand:P 2 "unspec_tls" "")))
- (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>,<ptrm>"))
+ (use (match_operand:SI 3 "immediate_operand" "n,n,n"))
+ (use (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>,<ptrm>"))
(set (reg:P TOC_REGNUM)
- (unspec:P [(match_operand:P 4 "const_int_operand" "n,n,n")]
+ (unspec:P [(match_operand:P 5 "const_int_operand" "n,n,n")]
UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX"
@@ -10790,12 +10735,13 @@
;; Call to indirect functions with the ELFv2 ABI.
;; Operand0 is the addresss of the function to call
-;; Operand2 is the offset of the stack location holding the current TOC pointer
+;; Operand3 is the offset of the stack location holding the current TOC pointer
(define_insn "*call_indirect_elfv2<mode>"
[(call (mem:SI (match_operand:P 0 "indirect_call_operand" "c,*l,X"))
(match_operand 1))
- (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 2 "const_int_operand" "n,n,n")] UNSPEC_TOCSLOT))
+ (use (match_operand:SI 2 "immediate_operand" "n,n,n"))
+ (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 3 "const_int_operand" "n,n,n")] UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_ELFv2"
{
@@ -10811,6 +10757,7 @@
(define_insn "*call_indirect_pcrel<mode>"
[(call (mem:SI (match_operand:P 0 "indirect_call_operand" "c,*l,X"))
(match_operand 1))
+ (use (match_operand:SI 2 "immediate_operand" "n,n,n"))
(clobber (reg:P LR_REGNO))]
"rs6000_pcrel_p (cfun)"
{
@@ -10827,8 +10774,9 @@
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "indirect_call_operand" "c,*l,X"))
(match_operand:P 2 "unspec_tls" "")))
+ (use (match_operand:SI 3 "immediate_operand" "n,n,n"))
(set (reg:P TOC_REGNUM)
- (unspec:P [(match_operand:P 3 "const_int_operand" "n,n,n")]
+ (unspec:P [(match_operand:P 4 "const_int_operand" "n,n,n")]
UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_ELFv2"
@@ -10846,6 +10794,7 @@
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "indirect_call_operand" "c,*l,X"))
(match_operand:P 2 "unspec_tls" "")))
+ (use (match_operand:SI 3 "immediate_operand" "n,n,n"))
(clobber (reg:P LR_REGNO))]
"rs6000_pcrel_p (cfun)"
{