This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ms1] Cleanup & defaults
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 30 Nov 2005 11:28:18 +0000
- Subject: [ms1] Cleanup & defaults
Aldy,
Here's a patch to clean up a few things on the ms1 port.
1) There's no real need for a separate no-clobber dbnz pattern. I'm adding
doloop instructions and the separate pattern gets in the way anyway.
2) The scratch reg lacks an early clobber. I don't think the lack of an early
clobber causes harm in this case, because the only input reg is also an output
reg, but the early clobber certainly indicates intent.
3) the mul instruction was gated on the now never set TARGET_MUL flag. I've
corrected that.
4) Without any -march flag we'd generate ms1 code but fail to pick up the
correct linker script. (I suspect this bit might change when multilibs are added).
built & tested for ms2-elf
ok for mainline & 4.1?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2005-11-30 Nathan Sidwell <nathan@codesourcery.com>
* config/ms1/ms1.md (decrement_and_branch_until_zero): Add early
clobber to scratch reg.
(*decrement_and_branch_until_zero_no_clobber): Remove.
(decrement_and_branch peephole): Add dummy scratch reg to pattern.
(mulhish3): Use TARGET_MS1_16_003, TARGET_MS2.
* config/ms1/ms1.opt (mmul): Remove.
* config/ms1/ms1.h (ASM_SPEC): Cope with uppercase arch names.
(LINK_SPEC, STARTFILE_SPEC, ENDFILE_SPEC): Default to 16-002.
Index: config/ms1/ms1.md
===================================================================
--- config/ms1/ms1.md (revision 107604)
+++ config/ms1/ms1.md (working copy)
@@ -88,30 +88,13 @@
(set (match_dup 0)
(plus:SI (match_dup 0)
(const_int -1)))
- (clobber (match_scratch:SI 2 "=X,r"))]
+ (clobber (match_scratch:SI 2 "=X,&r"))]
"TARGET_MS1_16_003 || TARGET_MS2"
"@
dbnz\t%0, %l1%#
#"
- [(set_attr "length" "4,16")]
-)
-
-;; Same as above, but without the clobber. The peephole below will
-;; match this pattern.
-(define_insn "*decrement_and_branch_until_zero_no_clobber"
- [(set (pc)
- (if_then_else
- (ne (match_operand:SI 0 "register_operand" "+r")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "TARGET_MS1_16_003 || TARGET_MS2"
- "dbnz\t%0, %l1%#"
- [(set_attr "length" "4")
- (set_attr "type" "branch")]
+ [(set_attr "length" "4,16")
+ (set_attr "type" "branch,unknown")]
)
;; Split the above to handle the case where operand 0 is in memory
@@ -148,12 +131,11 @@
[(set (match_operand:SI 0 "register_operand" "")
(plus:SI (match_dup 0) (const_int -1)))
(set (match_operand:SI 1 "register_operand" "")
- (const_int -1))
+ (const_int -1))
(set (pc) (if_then_else
(ne (match_dup 0) (match_dup 1))
(label_ref (match_operand 2 "" ""))
- (pc)))
- ]
+ (pc)))]
"TARGET_MS1_16_003 || TARGET_MS2"
[(parallel [(set (pc)
(if_then_else
@@ -162,10 +144,9 @@
(pc)))
(set (match_dup 0)
(plus:SI (match_dup 0) (const_int -1)))
- ])
- ]
- ""
-)
+ (clobber (reg:SI 0))])]
+ "")
+
;; Moves
@@ -959,7 +940,7 @@
[(set (match_operand:SI 0 "register_operand" "=r,r")
(mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%r,r"))
(sign_extend:SI (match_operand:HI 2 "arith_operand" "r,I"))))]
- "TARGET_MUL"
+ "TARGET_MS1_16_003 || TARGET_MS2"
"@
mul %0, %1, %2
muli %0, %1, %2"
Index: config/ms1/ms1.opt
===================================================================
--- config/ms1/ms1.opt (revision 107604)
+++ config/ms1/ms1.opt (working copy)
@@ -19,10 +19,6 @@
; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
; 02110-1301, USA.
-mmul
-Target Report Mask(MUL)
-Generate multiply instructions
-
mbacc
Target Report Mask(BYTE_ACCESS)
Use byte loads and stores when generating code.
Index: config/ms1/ms1.h
===================================================================
--- config/ms1/ms1.h (revision 107604)
+++ config/ms1/ms1.h (working copy)
@@ -41,7 +41,7 @@ extern enum processor_type ms1_cpu;
/* A C string constant that tells the GCC driver program options to pass to
the assembler. */
#undef ASM_SPEC
-#define ASM_SPEC "%{march=ms1-16-002: -march=ms1-16-002} %{march=ms1-16-003: -march=ms1-16-003} %{march=ms2: -march=ms2} %{!march=*: -march=ms1-16-002}"
+#define ASM_SPEC "%{march=*} %{!march=*: -march=ms1-16-002}"
/* A string to pass to at the end of the command given to the linker. */
#undef LIB_SPEC
@@ -54,7 +54,8 @@ march=MS1-16-002:-T 16-002.ld%s; \
march=ms1-16-003:-T 16-003.ld%s; \
march=MS1-16-003:-T 16-003.ld%s; \
march=ms2:-T ms2.ld%s; \
-march=MS2:-T ms2.ld%s}"
+march=MS2:-T ms2.ld%s; \
+ : -T 16-002.ld}"
/* A string to pass at the very beginning of the command given to the
linker. */
@@ -67,7 +68,8 @@ march=MS1-16-002:%{!mno-crt0:crt0-16-002
march=ms1-16-003:%{!mno-crt0:crt0-16-003.o%s} startup-16-003.o%s; \
march=MS1-16-003:%{!mno-crt0:crt0-16-003.o%s} startup-16-003.o%s; \
march=ms2:%{!mno-crt0:crt0-ms2.o%s} startup-ms2.o%s; \
-march=MS2:%{!mno-crt0:crt0-ms2.o%s} startup-ms2.o%s} \
+march=MS2:%{!mno-crt0:crt0-ms2.o%s} startup-ms2.o%s; \
+ :%{!mno-crt0:crt0-16-002.o%s} startup-16-002.o%s} \
crti.o%s crtbegin.o%s"
/* A string to pass at the end of the command given to the linker. */
@@ -80,7 +82,8 @@ march=MS1-16-002:exit-16-002.o%s; \
march=ms1-16-003:exit-16-003.o%s; \
march=MS1-16-003:exit-16-003.o%s; \
march=ms2:exit-ms2.o%s; \
-march=MS2:exit-ms2.o%s} \
+march=MS2:exit-ms2.o%s; \
+ :exit-16-002.o%s} \
crtend.o%s crtn.o%s"
/* Run-time target specifications. */