Commit d0c42859 by J"orn Rennecke Committed by Joern Rennecke

sh.c (gen_ashift_hi): Implement right shifts via gen_ashift.

	* sh.c (gen_ashift_hi): Implement right shifts via gen_ashift.
	* sh.md (ashrhi3_k, lshrhi3_k, lshrhi3_m, lshrhi3, lshrhi3+1): Delete.

From-SVN: r19385
parent 6df38d6d
Thu Apr 23 20:21:06 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
* sh.c (gen_ashift_hi): Implement right shifts via gen_ashift.
* sh.md (ashrhi3_k, lshrhi3_k, lshrhi3_m, lshrhi3, lshrhi3+1): Delete.
Wed Apr 22 17:07:35 1998 Michael Meissner <meissner@cygnus.com> Wed Apr 22 17:07:35 1998 Michael Meissner <meissner@cygnus.com>
* loop.c (note_addr_stored): Correct function to take 2 arguments, * loop.c (note_addr_stored): Correct function to take 2 arguments,
......
...@@ -916,13 +916,13 @@ gen_ashift_hi (type, n, reg) ...@@ -916,13 +916,13 @@ gen_ashift_hi (type, n, reg)
switch (type) switch (type)
{ {
case ASHIFTRT: case ASHIFTRT:
emit_insn (gen_ashrhi3_k (reg, reg, GEN_INT (n)));
break;
case LSHIFTRT: case LSHIFTRT:
if (n == 1) /* We don't have HImode right shift operations because using the
emit_insn (gen_lshrhi3_m (reg, reg, GEN_INT (n))); ordinary 32 bit shift instructions for that doesn't generate proper
else zero/sign extension.
emit_insn (gen_lshrhi3_k (reg, reg, GEN_INT (n))); gen_ashift_hi is only called in contexts where we know that the
sign extension works out correctly. */
gen_ashift (type, n, gen_rtx_SUBREG (SImode, reg, 0));
break; break;
case ASHIFT: case ASHIFT:
emit_insn (gen_ashlhi3_k (reg, reg, GEN_INT (n))); emit_insn (gen_ashlhi3_k (reg, reg, GEN_INT (n)));
......
...@@ -1208,14 +1208,11 @@ ...@@ -1208,14 +1208,11 @@
"shar %0" "shar %0"
[(set_attr "type" "arith")]) [(set_attr "type" "arith")])
(define_insn "ashrhi3_k" ;; We can't do HImode right shifts correctly unless we start out with an
[(set (match_operand:HI 0 "arith_reg_operand" "=r") ;; explicit zero / sign extension; doing that would result in worse overall
(ashiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0") ;; code, so just let the machine independent code widen the mode.
(match_operand:HI 2 "const_int_operand" "M"))) ;; That's why we don't have ashrhi3_k / lshrhi3_k / lshrhi3_m / lshrhi3 .
(clobber (reg:SI 18))]
"INTVAL (operands[2]) == 1"
"shar %0"
[(set_attr "type" "arith")])
;; ??? This should be a define expand. ;; ??? This should be a define expand.
...@@ -1328,24 +1325,6 @@ ...@@ -1328,24 +1325,6 @@
"shlr%O2 %0" "shlr%O2 %0"
[(set_attr "type" "arith")]) [(set_attr "type" "arith")])
(define_insn "lshrhi3_m"
[(set (match_operand:HI 0 "arith_reg_operand" "=r")
(lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0")
(match_operand:HI 2 "const_int_operand" "M")))
(clobber (reg:SI 18))]
"CONST_OK_FOR_M (INTVAL (operands[2]))"
"shlr %0"
[(set_attr "type" "arith")])
(define_insn "lshrhi3_k"
[(set (match_operand:HI 0 "arith_reg_operand" "=r")
(lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0")
(match_operand:HI 2 "const_int_operand" "K")))]
"CONST_OK_FOR_K (INTVAL (operands[2]))
&& ! CONST_OK_FOR_M (INTVAL (operands[2]))"
"shlr%O2 %0"
[(set_attr "type" "arith")])
(define_insn "lshrsi3_n" (define_insn "lshrsi3_n"
[(set (match_operand:SI 0 "arith_reg_operand" "=r") [(set (match_operand:SI 0 "arith_reg_operand" "=r")
(lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
...@@ -1398,35 +1377,6 @@ ...@@ -1398,35 +1377,6 @@
FAIL; FAIL;
}") }")
(define_insn "lshrhi3"
[(set (match_operand:HI 0 "arith_reg_operand" "=r")
(lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0")
(match_operand:HI 2 "const_int_operand" "n")))
(clobber (reg:SI 18))]
""
"#"
;; ??? length attribute is sometimes six instead of four.
[(set (attr "length")
(cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
(const_string "2")
(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
(const_string "4")]
(const_string "6")))
(set_attr "type" "arith")])
(define_split
[(set (match_operand:HI 0 "arith_reg_operand" "")
(lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "")
(match_operand:HI 2 "const_int_operand" "n")))
(clobber (reg:SI 18))]
""
[(use (reg:SI 0))]
"
{
gen_shifty_hi_op (LSHIFTRT, operands);
DONE;
}")
;; ??? This should be a define expand. ;; ??? This should be a define expand.
(define_insn "ashldi3_k" (define_insn "ashldi3_k"
......
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