summaryrefslogtreecommitdiff
path: root/gcc/config/gmicro
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-04-10 07:13:16 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-04-10 07:13:16 -0400
commit996a5f59fb5faefcb6e056ec3976cdb3d7f8d439 (patch)
treed8afeb52a2270dc0735207fb9d836241cc3da073 /gcc/config/gmicro
parentedd2e9fe0bdd048e91cb134c89a5c310f616ac82 (diff)
downloadgcc-996a5f59fb5faefcb6e056ec3976cdb3d7f8d439.tar.gz
Remove references to LSHIFT and lshlsi3.
From-SVN: r7016
Diffstat (limited to 'gcc/config/gmicro')
-rw-r--r--gcc/config/gmicro/gmicro.md102
1 files changed, 68 insertions, 34 deletions
diff --git a/gcc/config/gmicro/gmicro.md b/gcc/config/gmicro/gmicro.md
index 95b6f5d511f..b405ec21540 100644
--- a/gcc/config/gmicro/gmicro.md
+++ b/gcc/config/gmicro/gmicro.md
@@ -1,8 +1,6 @@
-;;- Machine description for GNU compiler
-;;- Fujitsu Gmicro Version
-;;- Ported by M.Yuhara, Fujitsu Laboratories LTD.
-;;
-;; Copyright (C) 1990 Free Software Foundation, Inc.
+;;- Machine description for GNU compiler, Fujitsu Gmicro Version
+;; Copyright (C) 1990, 1994 Free Software Foundation, Inc.
+;; Contributed by M.Yuhara, Fujitsu Laboratories LTD.
;; This file is part of GNU CC.
@@ -1858,50 +1856,86 @@
;; logical shift instructions
-(define_insn "lshlsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (lshift:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "shl.w %2,%0")
+;; Logical right shift on the gmicro works by negating the shift count,
+;; then emitting a right shift with the shift count negated. This means
+;; that all actual shift counts in the RTL will be positive. This
+;; prevents converting shifts to ZERO_EXTRACTs with negative positions,
+;; which isn't valid.
-(define_insn "lshlhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (lshift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
+(define_expand "lshrsi3"
+ [(set (match_operand:SI 0 "general_operand" "=g")
+ (lshiftrt:SI (match_operand:SI 1 "general_operand" "g")
+ (match_operand:SI 2 "general_operand" "g")))]
""
- "shl.h %2,%0")
+ "
+{
+ if (GET_CODE (operands[2]) != CONST_INT)
+ operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
+}")
-(define_insn "lshlqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (lshift:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
+(define_insn ""
+ [(set (match_operand:SI 0 "general_operand" "=rm")
+ (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
+ (match_operand:SI 2 "const_int_operand" "n")))]
""
- "shl.b %2,%0")
+ "shl.w %n2,%0")
-;; lshiftrt -> lshift
-(define_expand "lshrsi3"
+(define_insn ""
[(set (match_operand:SI 0 "general_operand" "=rm")
- (lshift:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
+ (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
+ (neg:SI (match_operand:SI 2 "general_operand" "rm"))))]
""
- " { operands[2] = negate_rtx (SImode, operands[2]); }")
+ "shl.w %2,%0")
-;; lshiftrt -> lshift
(define_expand "lshrhi3"
+ [(set (match_operand:HI 0 "general_operand" "=g")
+ (lshiftrt:HI (match_operand:HI 1 "general_operand" "g")
+ (match_operand:HI 2 "general_operand" "g")))]
+ ""
+ "
+{
+ if (GET_CODE (operands[2]) != CONST_INT)
+ operands[2] = gen_rtx (NEG, HImode, negate_rtx (HImode, operands[2]));
+}")
+
+(define_insn ""
[(set (match_operand:HI 0 "general_operand" "=rm")
- (lshift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
+ (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
+ (match_operand:HI 2 "const_int_operand" "n")))]
""
- " { operands[2] = negate_rtx (HImode, operands[2]); }")
+ "shl.h %n2,%0")
+
+(define_insn ""
+ [(set (match_operand:HI 0 "general_operand" "=rm")
+ (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
+ (neg:HI (match_operand:HI 2 "general_operand" "rm"))))]
+ ""
+ "shl.h %2,%0")
-;; lshiftrt -> lshift
(define_expand "lshrqi3"
+ [(set (match_operand:QI 0 "general_operand" "=g")
+ (lshiftrt:QI (match_operand:QI 1 "general_operand" "g")
+ (match_operand:QI 2 "general_operand" "g")))]
+ ""
+ "
+{
+ if (GET_CODE (operands[2]) != CONST_INT)
+ operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
+}")
+
+(define_insn ""
[(set (match_operand:QI 0 "general_operand" "=rm")
- (lshift:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
+ (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
+ (match_operand:QI 2 "const_int_operand" "n")))]
""
- " { operands[2] = negate_rtx (QImode, operands[2]); }")
+ "shl.b %n2,%0")
+
+(define_insn ""
+ [(set (match_operand:QI 0 "general_operand" "=rm")
+ (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
+ (neg:QI (match_operand:QI 2 "general_operand" "rm"))))]
+ ""
+ "shl.b %2,%0")
;; rotate instructions