Commit c4984bad by Marek Michalkiewicz Committed by Denis Chertykov

avr.c (out_adj_frame_ptr): Make "frame pointer change too big for -mtiny-stack"…

avr.c (out_adj_frame_ptr): Make "frame pointer change too big for -mtiny-stack" a warning, if larger than 63.

	* config/avr/avr.c (out_adj_frame_ptr): Make "frame pointer
	change too big for -mtiny-stack" a warning, if larger than 63.
	(out_set_stack_ptr): Change the logic so -mno-interrupts is
	always safe to use on possible future devices.
	(function_prologue): Write SPH before SPL, for consistency.
	If interrupt_func_p true, we know we have enabled interrupts.
	(avr_num_arg_regs): New function.  Round up to even number of
	bytes if no -mpack-args or if calling a libgcc function.
	(function_arg, function_arg_advance): Use it.
	(output_movsisf, ashlsi3_out, ashrsi3_out, lshrsi3_out):
	Output "movw" if available.
	(out_tsthi, out_tstsi, ashlqi3_out, lshrqi3_out): Change uses
	of TEST_HARD_REG_CLASS macro to test_hard_reg_class function.
	(asm_output_section_name): Add blanks for consistent output.
	(encode_section_info): Set TREE_READONLY for progmem data to
	avoid gas warnings about changed section attributes.
	(avr_hard_regno_mode_ok): Force non-QImode data to start in
	even numbered registers on devices with "movw".
	* config/avr/avr.h (MASK_*): Define bits for target_flags.
	(TARGET_SWITCHES): Mark help strings for translation.
	Add new -mpack-args and -menhanced switches.
	(TARGET_OPTIONS): Mark help strings for translation.
	(progmem_section): Add section attributes.
	* config/avr/avr.md (*movhi, call_insn, call_value_insn):
	Output "movw" if available.
	(mulqi3, mulqihi3, umulqihi3, mulhi3, *tablejump_enh):
	New patterns.
	* config/avr/libgcc.S (_mulqi3, _divqi3): Update to the new
	call convention (arguments aligned on even registers).
	(_cleanup, _exit): Make weak symbols libc can override.

From-SVN: r34847
parent 2e637721
2000-07-01 Marek Michalkiewicz <marekm@linux.org.pl>
* config/avr/avr.c (out_adj_frame_ptr): Make "frame pointer
change too big for -mtiny-stack" a warning, if larger than 63.
(out_set_stack_ptr): Change the logic so -mno-interrupts is
always safe to use on possible future devices.
(function_prologue): Write SPH before SPL, for consistency.
If interrupt_func_p true, we know we have enabled interrupts.
(avr_num_arg_regs): New function. Round up to even number of
bytes if no -mpack-args or if calling a libgcc function.
(function_arg, function_arg_advance): Use it.
(output_movsisf, ashlsi3_out, ashrsi3_out, lshrsi3_out):
Output "movw" if available.
(out_tsthi, out_tstsi, ashlqi3_out, lshrqi3_out): Change uses
of TEST_HARD_REG_CLASS macro to test_hard_reg_class function.
(asm_output_section_name): Add blanks for consistent output.
(encode_section_info): Set TREE_READONLY for progmem data to
avoid gas warnings about changed section attributes.
(avr_hard_regno_mode_ok): Force non-QImode data to start in
even numbered registers on devices with "movw".
* config/avr/avr.h (MASK_*): Define bits for target_flags.
(TARGET_SWITCHES): Mark help strings for translation.
Add new -mpack-args and -menhanced switches.
(TARGET_OPTIONS): Mark help strings for translation.
(progmem_section): Add section attributes.
* config/avr/avr.md (*movhi, call_insn, call_value_insn):
Output "movw" if available.
(mulqi3, mulqihi3, umulqihi3, mulhi3, *tablejump_enh):
New patterns.
* config/avr/libgcc.S (_mulqi3, _divqi3): Update to the new
call convention (arguments aligned on even registers).
(_cleanup, _exit): Make weak symbols libc can override.
2000-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fp-bit.h: New file. * fp-bit.h: New file.
......
...@@ -249,6 +249,9 @@ ...@@ -249,6 +249,9 @@
switch (which_alternative) switch (which_alternative)
{ {
case 0: /* mov r,r */ case 0: /* mov r,r */
if (TARGET_ENHANCED)
return (AS2 (movw,%0,%1)); /* FIXME: length = 2 -> 1 */
if (true_regnum (operands[0]) > true_regnum (operands[1])) if (true_regnum (operands[0]) > true_regnum (operands[1]))
return (AS2 (mov,%B0,%B1) CR_TAB return (AS2 (mov,%B0,%B1) CR_TAB
AS2 (mov,%A0,%A1)); AS2 (mov,%A0,%A1));
...@@ -653,6 +656,57 @@ ...@@ -653,6 +656,57 @@
[(set_attr "length" "4,4") [(set_attr "length" "4,4")
(set_attr "cc" "set_czn,set_czn")]) (set_attr "cc" "set_czn,set_czn")])
;******************************************************************************
; mul
(define_insn "mulqi3"
[(set (match_operand:QI 0 "register_operand" "=r")
(mult:QI (match_operand:QI 1 "register_operand" "r")
(match_operand:QI 2 "register_operand" "r")))]
"TARGET_ENHANCED"
"mul %1,%2
mov %0,r0
clr r1"
[(set_attr "length" "3")
(set_attr "cc" "clobber")])
(define_insn "mulqihi3"
[(set (match_operand:HI 0 "register_operand" "=r")
(mult:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "d"))
(sign_extend:HI (match_operand:QI 2 "register_operand" "d"))))]
"TARGET_ENHANCED"
"muls %1,%2
movw %0,r0
clr r1"
[(set_attr "length" "3")
(set_attr "cc" "clobber")])
(define_insn "umulqihi3"
[(set (match_operand:HI 0 "register_operand" "=r")
(mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "r"))
(zero_extend:HI (match_operand:QI 2 "register_operand" "r"))))]
"TARGET_ENHANCED"
"mul %1,%2
movw %0,r0
clr r1"
[(set_attr "length" "3")
(set_attr "cc" "clobber")])
(define_insn "mulhi3"
[(set (match_operand:HI 0 "register_operand" "=&r")
(mult:HI (match_operand:HI 1 "register_operand" "r")
(match_operand:HI 2 "register_operand" "r")))]
"TARGET_ENHANCED"
"mul %A1,%A2
movw %0,r0
mul %A1,%B2
add %B0,r0
mul %B1,%A2
add %B0,r0
clr r1"
[(set_attr "length" "7")
(set_attr "cc" "clobber")])
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
; and ; and
...@@ -1604,9 +1658,15 @@ ...@@ -1604,9 +1658,15 @@
if (which_alternative==0) if (which_alternative==0)
return \"icall\"; return \"icall\";
else if (which_alternative==1) else if (which_alternative==1)
return (AS2 (mov, r30,%A0) CR_TAB {
AS2 (mov, r31,%B0) CR_TAB if (TARGET_ENHANCED)
\"icall\"); return (AS2 (movw, r30, %0) CR_TAB
\"icall\");
else
return (AS2 (mov, r30, %A0) CR_TAB
AS2 (mov, r31, %B0) CR_TAB
\"icall\");
}
else if (!AVR_MEGA) else if (!AVR_MEGA)
return AS1(rcall,%c0); return AS1(rcall,%c0);
return AS1(call,%c0); return AS1(call,%c0);
...@@ -1634,9 +1694,15 @@ ...@@ -1634,9 +1694,15 @@
if (which_alternative==0) if (which_alternative==0)
return \"icall\"; return \"icall\";
else if (which_alternative==1) else if (which_alternative==1)
return (AS2 (mov, r30,%A1) CR_TAB {
AS2 (mov, r31,%B1) CR_TAB if (TARGET_ENHANCED)
\"icall\"); return (AS2 (movw, r30, %1) CR_TAB
\"icall\");
else
return (AS2 (mov, r30, %A1) CR_TAB
AS2 (mov, r31, %B1) CR_TAB
\"icall\");
}
else if (!AVR_MEGA) else if (!AVR_MEGA)
return AS1(rcall,%c1); return AS1(rcall,%c1);
return AS1(call,%c1); return AS1(call,%c1);
...@@ -1676,6 +1742,21 @@ ...@@ -1676,6 +1742,21 @@
"optimize" "optimize"
"") "")
(define_insn "*tablejump_enh"
[(set (pc) (mem:HI
(plus:HI (match_operand:HI 0 "register_operand" "=&z")
(label_ref (match_operand 2 "" "")))))
(use (label_ref (match_operand 1 "" "")))]
"TARGET_ENHANCED"
"subi r30,lo8(-(%2))
sbci r31,hi8(-(%2))
lpm __tmp_reg__,Z+
lpm r31,Z
mov r30,__tmp_reg__
ijmp"
[(set_attr "length" "6")
(set_attr "cc" "clobber")])
(define_insn "*tablejump" (define_insn "*tablejump"
[(set (pc) (mem:HI [(set (pc) (mem:HI
(plus:HI (match_operand:HI 0 "register_operand" "=&z") (plus:HI (match_operand:HI 0 "register_operand" "=&z")
...@@ -1686,10 +1767,10 @@ ...@@ -1686,10 +1767,10 @@
sbci r31,hi8(-(%2)) sbci r31,hi8(-(%2))
lpm lpm
push r0 push r0
adiw r30,1 adiw r30,1
lpm lpm
push r0 push r0
ret" ret"
[(set_attr "length" "8") [(set_attr "length" "8")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
......
...@@ -39,7 +39,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -39,7 +39,7 @@ Boston, MA 02111-1307, USA. */
*******************************************************/ *******************************************************/
#if defined (Lmulqi3) #if defined (Lmulqi3)
#define r_arg2 r25 /* multiplicand */ #define r_arg2 r22 /* multiplicand */
#define r_arg1 r24 /* multiplier */ #define r_arg1 r24 /* multiplier */
#define r_res __tmp_reg__ /* result */ #define r_res __tmp_reg__ /* result */
...@@ -201,8 +201,8 @@ __mulsi3_exit: ...@@ -201,8 +201,8 @@ __mulsi3_exit:
Division 8 / 8 => (result + remainder) Division 8 / 8 => (result + remainder)
*******************************************************/ *******************************************************/
#define r_rem r26 /* remainder */ #define r_rem r26 /* remainder */
#define r_arg1 r25 /* dividend */ #define r_arg1 r24 /* dividend */
#define r_arg2 r24 /* divisor */ #define r_arg2 r22 /* divisor */
#define r_cnt r27 /* loop count */ #define r_cnt r27 /* loop count */
#if defined (Lumodqi3) #if defined (Lumodqi3)
...@@ -272,8 +272,7 @@ __divqi3_1: ...@@ -272,8 +272,7 @@ __divqi3_1:
sbrc __tmp_reg__,7 sbrc __tmp_reg__,7
neg r_arg1 ; correct result sign neg r_arg1 ; correct result sign
__divqi3_exit: __divqi3_exit:
mov r24,r_arg1 ; put result to return register ret ; result already in r24 (r_arg1)
ret
.endfunc .endfunc
#endif /* defined (Ldivqi3) */ #endif /* defined (Ldivqi3) */
...@@ -434,8 +433,6 @@ _umodsi3_ret: ...@@ -434,8 +433,6 @@ _umodsi3_ret:
mov r24,r_remHL mov r24,r_remHL
mov r23,r_remH mov r23,r_remH
mov r22,r_remL mov r22,r_remL
.global _cleanup
_cleanup:
ret ret
.endfunc .endfunc
#endif /* defined (Lumodsi3) */ #endif /* defined (Lumodsi3) */
...@@ -630,9 +627,12 @@ __epilogue_restores__: ...@@ -630,9 +627,12 @@ __epilogue_restores__:
#endif /* defined (Lepilogue) */ #endif /* defined (Lepilogue) */
#ifdef L__exit #ifdef L__exit
.global _exit .weak _exit
.func _exit .func _exit
_exit: _exit:
rjmp _exit rjmp _exit
.weak _cleanup
_cleanup:
ret
.endfunc .endfunc
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment