This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PA assembly clean up (bv instructions)
- To: egcs-patches at egcs dot cygnus dot com
- Subject: PA assembly clean up (bv instructions)
- From: Jeffrey A Law <law at upchuck dot cygnus dot com>
- Date: Tue, 13 Apr 1999 12:25:05 -0600
- Reply-To: law at cygnus dot com
Similar to the previous patch. Avoid using an immediate when we really want
a register.
* pa.c: Use a register name, not a raw immediate in "bv" instructions.
* pa.md, pa.h, ee.asm, ee_fp.asm, lib2funcs.asm: Likewise.
Index: ee.asm
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/pa/ee.asm,v
retrieving revision 1.3
diff -c -3 -p -r1.3 ee.asm
*** ee.asm 1999/04/13 01:13:01 1.3
--- ee.asm 1999/04/13 18:25:50
*************** L$0000
*** 150,156 ****
nop
L$0001
; Return
! bv,n 0(%r31)
.EXIT
.PROCEND
--- 150,156 ----
nop
L$0001
; Return
! bv,n %r0(%r31)
.EXIT
.PROCEND
*************** L$0004
*** 255,261 ****
nop
L$0005
; Return and deallocate our frame.
! bv 0(%r31)
sub %r30,%r21,%r30
.EXIT
.PROCEND
--- 255,261 ----
nop
L$0005
; Return and deallocate our frame.
! bv %r0(%r31)
sub %r30,%r21,%r30
.EXIT
.PROCEND
Index: ee_fp.asm
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/pa/ee_fp.asm,v
retrieving revision 1.3
diff -c -3 -p -r1.3 ee_fp.asm
*** ee_fp.asm 1999/04/13 01:13:02 1.3
--- ee_fp.asm 1999/04/13 18:25:50
*************** L$0002
*** 154,160 ****
nop
L$0003
; Return, setting up a frame pointer in the delay slot
! bv 0(%r31)
sub %r30,%r21,%r3
.EXIT
.PROCEND
--- 154,160 ----
nop
L$0003
; Return, setting up a frame pointer in the delay slot
! bv %r0(%r31)
sub %r30,%r21,%r3
.EXIT
.PROCEND
*************** L$0006
*** 266,272 ****
nop
L$0007
; Return and deallocate our frame.
! bv 0(%r31)
copy %r21,%r30
.EXIT
.PROCEND
--- 266,272 ----
nop
L$0007
; Return and deallocate our frame.
! bv %r0(%r31)
copy %r21,%r30
.EXIT
.PROCEND
Index: lib1funcs.asm
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/pa/lib1funcs.asm,v
retrieving revision 1.3
diff -c -3 -p -r1.3 lib1funcs.asm
*** lib1funcs.asm 1998/12/16 21:10:56 1.3
--- lib1funcs.asm 1999/04/13 18:25:51
*************** $$divU
*** 282,293 ****
ds %r1,divisor,%r1
addc dividend,dividend,quotient
ds %r1,divisor,%r1
! bv 0(ret)
addc quotient,quotient,quotient
L$largedivisor
comclr,<< dividend,divisor,quotient
ldi 1,quotient
! bv,n 0(ret)
.exit
.procend
#endif
--- 282,293 ----
ds %r1,divisor,%r1
addc dividend,dividend,quotient
ds %r1,divisor,%r1
! bv %r0(ret)
addc quotient,quotient,quotient
L$largedivisor
comclr,<< dividend,divisor,quotient
ldi 1,quotient
! bv,n %r0(ret)
.exit
.procend
#endif
*************** $$remU
*** 376,387 ****
ds %r1,divisor,%r1
comclr,>= %r1,%r0,%r0
addl %r1,divisor,%r1
! bv 0(ret)
copy %r1,quotient
L$largedivisor
sub,>>= dividend,divisor,quotient
copy dividend,quotient
! bv,n 0(ret)
.exit
.procend
#endif
--- 376,387 ----
ds %r1,divisor,%r1
comclr,>= %r1,%r0,%r0
addl %r1,divisor,%r1
! bv %r0(ret)
copy %r1,quotient
L$largedivisor
sub,>>= dividend,divisor,quotient
copy dividend,quotient
! bv,n %r0(ret)
.exit
.procend
#endif
*************** $$divI
*** 479,490 ****
addl %r1,divisor,%r1
comclr,>= quotient,%r0,%r0 ; skip of no need to negate
sub %r0,dividend,dividend
! bv 0(ret)
copy dividend,quotient
L$largedivisor
comclr,<< dividend,divisor,quotient
ldi 1,quotient
! bv,n 0(ret)
.exit
.procend
#endif
--- 479,490 ----
addl %r1,divisor,%r1
comclr,>= quotient,%r0,%r0 ; skip of no need to negate
sub %r0,dividend,dividend
! bv %r0(ret)
copy dividend,quotient
L$largedivisor
comclr,<< dividend,divisor,quotient
ldi 1,quotient
! bv,n %r0(ret)
.exit
.procend
#endif
*************** $$remI
*** 582,593 ****
addl %r1,divisor,%r1
comclr,>= quotient,%r0,%r0 ; skip of no need to negate
sub %r0,%r1,%r1
! bv 0(ret)
copy %r1,quotient
L$largedivisor
sub,>>= dividend,divisor,quotient
copy dividend,quotient
! bv,n 0(ret)
.exit
.procend
#endif
--- 582,593 ----
addl %r1,divisor,%r1
comclr,>= quotient,%r0,%r0 ; skip of no need to negate
sub %r0,%r1,%r1
! bv %r0(ret)
copy %r1,quotient
L$largedivisor
sub,>>= dividend,divisor,quotient
copy dividend,quotient
! bv,n %r0(ret)
.exit
.procend
#endif
*************** $$divU_3
*** 630,636 ****
sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
addc %r29,%r0,%r29
! bv 0(ret)
extru %r29,30,31,result
.exit
.procend
--- 630,636 ----
sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
addc %r29,%r0,%r29
! bv %r0(ret)
extru %r29,30,31,result
.exit
.procend
*************** $$divU_5
*** 674,680 ****
sh2add %r29,%r26,%r0 ; r0 = lo(1000 x r) + dividend
shd %r1,%r29,30,%r29 ; r29 = hi(1000 x r)
addc %r29,%r0,%r29
! bv 0(ret)
extru %r29,29,30,result
.exit
.procend
--- 674,680 ----
sh2add %r29,%r26,%r0 ; r0 = lo(1000 x r) + dividend
shd %r1,%r29,30,%r29 ; r29 = hi(1000 x r)
addc %r29,%r0,%r29
! bv %r0(ret)
extru %r29,29,30,result
.exit
.procend
*************** $$divU_6
*** 718,724 ****
sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
addc %r29,%r0,%r29
! bv 0(ret)
extru %r29,29,30,result
.exit
.procend
--- 718,724 ----
sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
addc %r29,%r0,%r29
! bv %r0(ret)
extru %r29,29,30,result
.exit
.procend
*************** $$divU_9
*** 762,768 ****
sh3add %r29,%r26,%r0
shd %r1,%r29,29,%r29
addc %r29,0,%r29 /* 111000111000111000111000111001 */
! bv 0(ret)
extru %r29,30,31,result
.exit
.procend
--- 762,768 ----
sh3add %r29,%r26,%r0
shd %r1,%r29,29,%r29
addc %r29,0,%r29 /* 111000111000111000111000111001 */
! bv %r0(ret)
extru %r29,30,31,result
.exit
.procend
*************** $$divU_10
*** 806,812 ****
sh2add %r29,%r26,%r0 ; r0 = lo(1000 x r) + dividend
shd %r1,%r29,30,%r29 ; r29 = hi(1000 x r)
addc %r29,%r0,%r29
! bv 0(ret)
extru %r29,28,29,result
.exit
.procend
--- 806,812 ----
sh2add %r29,%r26,%r0 ; r0 = lo(1000 x r) + dividend
shd %r1,%r29,30,%r29 ; r29 = hi(1000 x r)
addc %r29,%r0,%r29
! bv %r0(ret)
extru %r29,28,29,result
.exit
.procend
*************** $$divU_12
*** 850,856 ****
sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
addc %r29,%r0,%r29
! bv 0(ret)
extru %r29,28,29,result
.exit
.procend
--- 850,856 ----
sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
addc %r29,%r0,%r29
! bv %r0(ret)
extru %r29,28,29,result
.exit
.procend
Index: pa.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/pa/pa.c,v
retrieving revision 1.32
diff -c -3 -p -r1.32 pa.c
*** pa.c 1999/04/13 01:13:05 1.32
--- pa.c 1999/04/13 18:25:58
*************** output_cbranch (operands, nullify, lengt
*** 4580,4586 ****
output_asm_insn ("bl .+8,%%r1\n\taddil L'%l0-%l4,%%r1", xoperands);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
CODE_LABEL_NUMBER (xoperands[4]));
! output_asm_insn ("ldo R'%l0-%l4(%%r1),%%r1\n\tbv 0(%%r1)", xoperands);
}
/* Now restore the value of %r1 in the delay slot. We're not
--- 4580,4587 ----
output_asm_insn ("bl .+8,%%r1\n\taddil L'%l0-%l4,%%r1", xoperands);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
CODE_LABEL_NUMBER (xoperands[4]));
! output_asm_insn ("ldo R'%l0-%l4(%%r1),%%r1\n\tbv %%r0(%%r1)",
! xoperands);
}
/* Now restore the value of %r1 in the delay slot. We're not
*************** output_millicode_call (insn, call_dest)
*** 5159,5165 ****
output_asm_insn ("blr 0,%%r31", xoperands);
/* Jump to our target address in %r29. */
! output_asm_insn ("bv,n 0(%%r29)", xoperands);
/* Empty delay slot. Note this insn gets fetched twice and
executed once. To be safe we use a nop. */
--- 5160,5166 ----
output_asm_insn ("blr 0,%%r31", xoperands);
/* Jump to our target address in %r29. */
! output_asm_insn ("bv,n %%r0(%%r29)", xoperands);
/* Empty delay slot. Note this insn gets fetched twice and
executed once. To be safe we use a nop. */
*************** output_millicode_call (insn, call_dest)
*** 5184,5190 ****
output_asm_insn ("blr 0,%%r31", xoperands);
/* Branch to our target which is in %r1. */
! output_asm_insn ("bv,n 0(%%r1)", xoperands);
/* Empty delay slot. Note this insn gets fetched twice and
executed once. To be safe we use a nop. */
--- 5185,5191 ----
output_asm_insn ("blr 0,%%r31", xoperands);
/* Branch to our target which is in %r1. */
! output_asm_insn ("bv,n %%r0(%%r1)", xoperands);
/* Empty delay slot. Note this insn gets fetched twice and
executed once. To be safe we use a nop. */
*************** output_call (insn, call_dest)
*** 5417,5423 ****
output_asm_insn ("blr 0,%%r31", xoperands);
/* Branch to our target which is in %r1. */
! output_asm_insn ("bv 0(%%r1)", xoperands);
/* Copy the return address into %r2 also. */
output_asm_insn ("copy %%r31,%%r2", xoperands);
--- 5418,5424 ----
output_asm_insn ("blr 0,%%r31", xoperands);
/* Branch to our target which is in %r1. */
! output_asm_insn ("bv %%r0(%%r1)", xoperands);
/* Copy the return address into %r2 also. */
output_asm_insn ("copy %%r31,%%r2", xoperands);
Index: pa.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/pa/pa.h,v
retrieving revision 1.41
diff -c -3 -p -r1.41 pa.h
*** pa.h 1999/04/13 01:13:06 1.41
--- pa.h 1999/04/13 18:26:02
*************** DTORS_SECTION_FUNCTION
*** 2342,2348 ****
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
if (TARGET_BIG_SWITCH) \
! fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'L$%04d(%%r19),%%r1\n\tbv 0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE); \
else \
fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
--- 2342,2348 ----
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
if (TARGET_BIG_SWITCH) \
! fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'L$%04d(%%r19),%%r1\n\tbv %%r0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE); \
else \
fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
Index: pa.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/pa/pa.md,v
retrieving revision 1.25
diff -c -3 -p -r1.25 pa.md
*** pa.md 1999/04/13 01:13:07 1.25
--- pa.md 1999/04/13 18:26:07
***************
*** 3975,3981 ****
(define_insn "return"
[(return)]
"hppa_can_use_return_insn_p ()"
! "bv%* 0(%%r2)"
[(set_attr "type" "branch")
(set_attr "length" "4")])
--- 3975,3981 ----
(define_insn "return"
[(return)]
"hppa_can_use_return_insn_p ()"
! "bv%* %%r0(%%r2)"
[(set_attr "type" "branch")
(set_attr "length" "4")])
***************
*** 3985,3991 ****
[(use (reg:SI 2))
(return)]
""
! "bv%* 0(%%r2)"
[(set_attr "type" "branch")
(set_attr "length" "4")])
--- 3985,3991 ----
[(use (reg:SI 2))
(return)]
""
! "bv%* %%r0(%%r2)"
[(set_attr "type" "branch")
(set_attr "length" "4")])
***************
*** 4079,4085 ****
output_asm_insn (\"bl .+8,%%r1\\n\\taddil L'%l0-%l1,%%r1\", xoperands);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
CODE_LABEL_NUMBER (xoperands[1]));
! output_asm_insn (\"ldo R'%l0-%l1(%%r1),%%r1\\n\\tbv 0(%%r1)\",
xoperands);
}
else
--- 4079,4085 ----
output_asm_insn (\"bl .+8,%%r1\\n\\taddil L'%l0-%l1,%%r1\", xoperands);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
CODE_LABEL_NUMBER (xoperands[1]));
! output_asm_insn (\"ldo R'%l0-%l1(%%r1),%%r1\\n\\tbv %%r0(%%r1)\",
xoperands);
}
else
***************
*** 4276,4282 ****
/* Long millicode call for portable runtime. */
if (get_attr_length (insn) == 20)
! return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr 0,%%r2\;bv,n 0(%%r31)\;nop\";
/* If we're generating PIC code. */
xoperands[0] = operands[0];
--- 4276,4282 ----
/* Long millicode call for portable runtime. */
if (get_attr_length (insn) == 20)
! return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr 0,%%r2\;bv,n %%r0(%%r31)\;nop\";
/* If we're generating PIC code. */
xoperands[0] = operands[0];
***************
*** 4287,4293 ****
CODE_LABEL_NUMBER (xoperands[1]));
output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
output_asm_insn (\"blr 0,%%r2\", xoperands);
! output_asm_insn (\"bv,n 0(%%r1)\\n\\tnop\", xoperands);
return \"\";
}"
[(set_attr "type" "dyncall")
--- 4287,4293 ----
CODE_LABEL_NUMBER (xoperands[1]));
output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
output_asm_insn (\"blr 0,%%r2\", xoperands);
! output_asm_insn (\"bv,n %%r0(%%r1)\\n\\tnop\", xoperands);
return \"\";
}"
[(set_attr "type" "dyncall")
***************
*** 4436,4442 ****
/* Long millicode call for portable runtime. */
if (get_attr_length (insn) == 20)
! return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr 0,%%r2\;bv,n 0(%%r31)\;nop\";
/* If we're generating PIC code. */
xoperands[0] = operands[1];
--- 4436,4442 ----
/* Long millicode call for portable runtime. */
if (get_attr_length (insn) == 20)
! return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr 0,%%r2\;bv,n %%r0(%%r31)\;nop\";
/* If we're generating PIC code. */
xoperands[0] = operands[1];
***************
*** 4447,4453 ****
CODE_LABEL_NUMBER (xoperands[1]));
output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
output_asm_insn (\"blr 0,%%r2\", xoperands);
! output_asm_insn (\"bv,n 0(%%r1)\\n\\tnop\", xoperands);
return \"\";
}"
[(set_attr "type" "dyncall")
--- 4447,4453 ----
CODE_LABEL_NUMBER (xoperands[1]));
output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
output_asm_insn (\"blr 0,%%r2\", xoperands);
! output_asm_insn (\"bv,n %%r0(%%r1)\\n\\tnop\", xoperands);
return \"\";
}"
[(set_attr "type" "dyncall")
***************
*** 4548,4554 ****
(define_insn "indirect_jump"
[(set (pc) (match_operand:SI 0 "register_operand" "r"))]
""
! "bv%* 0(%0)"
[(set_attr "type" "branch")
(set_attr "length" "4")])
--- 4548,4554 ----
(define_insn "indirect_jump"
[(set (pc) (match_operand:SI 0 "register_operand" "r"))]
""
! "bv%* %%r0(%0)"
[(set_attr "type" "branch")
(set_attr "length" "4")])