Commit 59324685 by J"orn Rennecke Committed by Joern Rennecke

sh.h (LOAD_EXTEND_OP): QImode zero-extends on SHmedia.

	* sh.h (LOAD_EXTEND_OP): QImode zero-extends on SHmedia.
	* sh.md (truncdiqi2, movqi_media): Likewise.

From-SVN: r55757
parent 9b331d8d
Thu Jul 25 20:34:50 2002 J"orn Rennecke <joern.rennecke@superh.com>
* sh.h (LOAD_EXTEND_OP): QImode zero-extends on SHmedia.
* sh.md (truncdiqi2, movqi_media): Likewise.
2002-07-25 Neil Booth <neil@daikokuya.co.uk> 2002-07-25 Neil Booth <neil@daikokuya.co.uk>
* gcse.c (obstack_chunk_alloc): Remove. * gcse.c (obstack_chunk_alloc): Remove.
......
...@@ -2623,9 +2623,12 @@ while (0) ...@@ -2623,9 +2623,12 @@ while (0)
will either zero-extend or sign-extend. The value of this macro should will either zero-extend or sign-extend. The value of this macro should
be the code that says which one of the two operations is implicitly be the code that says which one of the two operations is implicitly
done, NIL if none. */ done, NIL if none. */
/* For SHmedia, we can truncate to QImode easier using zero extension. */
/* FP registers can load SImode values, but don't implicitly sign-extend /* FP registers can load SImode values, but don't implicitly sign-extend
them to DImode. */ them to DImode. */
#define LOAD_EXTEND_OP(MODE) ((MODE) != SImode ? SIGN_EXTEND : NIL) #define LOAD_EXTEND_OP(MODE) \
(((MODE) == QImode && TARGET_SHMEDIA) ? ZERO_EXTEND \
: (MODE) != SImode ? SIGN_EXTEND : NIL)
/* Define if loading short immediate values into registers sign extends. */ /* Define if loading short immediate values into registers sign extends. */
#define SHORT_IMMEDIATES_SIGN_EXTEND #define SHORT_IMMEDIATES_SIGN_EXTEND
......
...@@ -3382,17 +3382,15 @@ ...@@ -3382,17 +3382,15 @@
[(set_attr "type" "arith_media,store_media") [(set_attr "type" "arith_media,store_media")
(set_attr "length" "8,4")]) (set_attr "length" "8,4")])
; N.B. we want sign-extension here because ; N.B. This should agree with LOAD_EXTEND_OP and movqi.
; - we need to be consistent with LOAD_EXTEND_OP and movqi ; Because we use zero extension, we can't provide signed QImode compares
; - only sign extension allows us to do signed compares transparently. ; using a simple compare or conditional banch insn.
; unsigned compares don't care about the kind of extension as long as
; it's consistent.
(define_insn "truncdiqi2" (define_insn "truncdiqi2"
[(set (match_operand:QI 0 "general_movdst_operand" "=r,m") [(set (match_operand:QI 0 "general_movdst_operand" "=r,m")
(truncate:QI (match_operand:DI 1 "register_operand" "r,r")))] (truncate:QI (match_operand:DI 1 "register_operand" "r,r")))]
"TARGET_SHMEDIA" "TARGET_SHMEDIA"
"@ "@
ori %1, -256, %0 and %1, 255, %0
st%M0.b %m0, %1" st%M0.b %m0, %1"
[(set_attr "type" "arith_media,store")]) [(set_attr "type" "arith_media,store")])
...@@ -3741,7 +3739,7 @@ ...@@ -3741,7 +3739,7 @@
"@ "@
add.l %1, r63, %0 add.l %1, r63, %0
movi %1, %0 movi %1, %0
ld%M1.b %m1, %0 ld%M1.ub %m1, %0
st%M0.b %m0, %1" st%M0.b %m0, %1"
[(set_attr "type" "arith_media,arith_media,load_media,store_media")]) [(set_attr "type" "arith_media,arith_media,load_media,store_media")])
......
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