+2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com>
+
+ * config/nds32/nds32.md (call): Use pseudo instruction bal which
+ clobbers TA_REGNUM if large code model is specified.
+ (call_register): Likewise.
+ (call_immediate): Likewise.
+ (call_value): Likewise.
+ (call_value_register): Likewise.
+ (call_value_immediate): Likewise.
+
2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.h (TARGET_CMODEL_SMALL): New macro.
(define_expand "call"
[(parallel [(call (match_operand 0 "memory_operand" "")
(match_operand 1))
- (clobber (reg:SI LP_REGNUM))])]
+ (clobber (reg:SI LP_REGNUM))
+ (clobber (reg:SI TA_REGNUM))])]
""
""
)
(define_insn "*call_register"
[(parallel [(call (mem (match_operand:SI 0 "register_operand" "r, r"))
(match_operand 1))
- (clobber (reg:SI LP_REGNUM))])]
+ (clobber (reg:SI LP_REGNUM))
+ (clobber (reg:SI TA_REGNUM))])]
""
"@
jral5\t%0
(define_insn "*call_immediate"
[(parallel [(call (mem (match_operand:SI 0 "immediate_operand" "i"))
(match_operand 1))
- (clobber (reg:SI LP_REGNUM))])]
+ (clobber (reg:SI LP_REGNUM))
+ (clobber (reg:SI TA_REGNUM))])]
""
- "jal\t%0"
+{
+ if (TARGET_CMODEL_LARGE)
+ return "bal\t%0";
+ else
+ return "jal\t%0";
+}
[(set_attr "type" "branch")
- (set_attr "length" "4")])
+ (set (attr "length")
+ (if_then_else (match_test "TARGET_CMODEL_LARGE")
+ (const_int 12)
+ (const_int 4)))])
;; Subroutine call instruction returning a value.
[(parallel [(set (match_operand 0)
(call (match_operand 1 "memory_operand" "")
(match_operand 2)))
- (clobber (reg:SI LP_REGNUM))])]
+ (clobber (reg:SI LP_REGNUM))
+ (clobber (reg:SI TA_REGNUM))])]
""
""
)
[(parallel [(set (match_operand 0)
(call (mem (match_operand:SI 1 "register_operand" "r, r"))
(match_operand 2)))
- (clobber (reg:SI LP_REGNUM))])]
+ (clobber (reg:SI LP_REGNUM))
+ (clobber (reg:SI TA_REGNUM))])]
""
"@
jral5\t%1
[(parallel [(set (match_operand 0)
(call (mem (match_operand:SI 1 "immediate_operand" "i"))
(match_operand 2)))
- (clobber (reg:SI LP_REGNUM))])]
+ (clobber (reg:SI LP_REGNUM))
+ (clobber (reg:SI TA_REGNUM))])]
""
- "jal\t%1"
+{
+ if (TARGET_CMODEL_LARGE)
+ return "bal\t%1";
+ else
+ return "jal\t%1";
+}
[(set_attr "type" "branch")
- (set_attr "length" "4")])
+ (set (attr "length")
+ (if_then_else (match_test "TARGET_CMODEL_LARGE")
+ (const_int 12)
+ (const_int 4)))])
;; prologue and epilogue.