aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2011-07-14 15:10:12 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2011-07-14 15:10:12 +0000
commitd772f97cb639014ca02c6109e902cf1d1280af10 (patch)
treed17b83ce9559a5f11cb454402c4e8a5642745ac8
parent1a5d20a4e01472c30e360f94b33373f1ab8e2354 (diff)
downloadgcc-d772f97cb639014ca02c6109e902cf1d1280af10.zip
gcc-d772f97cb639014ca02c6109e902cf1d1280af10.tar.gz
gcc-d772f97cb639014ca02c6109e902cf1d1280af10.tar.bz2
re PR target/49487 ([avr] ICE in bytewise rotate)
PR target/49487 * config/avr/avr.md (rotl<mode>3): Generate SCRATCH instead of REG. (*rotw<mode>): Use const_int_operand for operand2. Use match_scatch for operand3. (*rotb<mode>): Ditto * config/avr/avr.c (avr_rotate_bytes): Treat SCRATCH. From-SVN: r176276
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/avr/avr.c6
-rw-r--r--gcc/config/avr/avr.md60
3 files changed, 47 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07b9252..5ffb0dc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2011-07-14 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/49487
+ * config/avr/avr.md (rotl<mode>3): Generate SCRATCH instead
+ of REG.
+ (*rotw<mode>): Use const_int_operand for operand2.
+ Use match_scatch for operand3.
+ (*rotb<mode>): Ditto
+ * config/avr/avr.c (avr_rotate_bytes): Treat SCRATCH.
+
2011-07-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49651
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index d535f33..209a5b9 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -4438,7 +4438,9 @@ avr_rotate_bytes (rtx operands[])
if (mode == DImode)
move_mode = QImode;
/* Make scratch smaller if needed. */
- if (GET_MODE (scratch) == HImode && move_mode == QImode)
+ if (SCRATCH != GET_CODE (scratch)
+ && HImode == GET_MODE (scratch)
+ && QImode == move_mode)
scratch = simplify_gen_subreg (move_mode, scratch, HImode, 0);
move_size = GET_MODE_SIZE (move_mode);
@@ -4534,6 +4536,8 @@ avr_rotate_bytes (rtx operands[])
When this move occurs, it will break chain deadlock.
The scratch register is substituted for real move. */
+ gcc_assert (SCRATCH != GET_CODE (scratch));
+
move[size].src = move[blocked].dst;
move[size].dst = scratch;
/* Scratch move is never blocked. */
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 4637abf..bbfcb10 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -1597,18 +1597,18 @@
(match_operand:VOID 2 "const_int_operand" "")))
(clobber (match_dup 3))])]
""
- "
-{
- if (CONST_INT_P (operands[2]) && 0 == (INTVAL (operands[2]) % 8))
{
- if (AVR_HAVE_MOVW && 0 == INTVAL (operands[2]) % 16)
- operands[3] = gen_reg_rtx (<rotsmode>mode);
- else
- operands[3] = gen_reg_rtx (QImode);
- }
- else
- FAIL;
-}")
+ if (CONST_INT_P (operands[2])
+ && 0 == INTVAL (operands[2]) % 8)
+ {
+ if (AVR_HAVE_MOVW && 0 == INTVAL (operands[2]) % 16)
+ operands[3] = gen_rtx_SCRATCH (<rotsmode>mode);
+ else
+ operands[3] = gen_rtx_SCRATCH (QImode);
+ }
+ else
+ FAIL;
+ })
;; Overlapping non-HImode registers often (but not always) need a scratch.
@@ -1620,34 +1620,38 @@
; Split word aligned rotates using scratch that is mode dependent.
(define_insn_and_split "*rotw<mode>"
[(set (match_operand:HIDI 0 "register_operand" "=r,r,#&r")
- (rotate:HIDI (match_operand:HIDI 1 "register_operand" "0,r,r")
- (match_operand 2 "immediate_operand" "n,n,n")))
- (clobber (match_operand:<rotsmode> 3 "register_operand" "=<rotx>" ))]
- "(CONST_INT_P (operands[2]) &&
- (0 == (INTVAL (operands[2]) % 16) && AVR_HAVE_MOVW))"
+ (rotate:HIDI (match_operand:HIDI 1 "register_operand" "0,r,r")
+ (match_operand 2 "const_int_operand" "n,n,n")))
+ (clobber (match_scratch:<rotsmode> 3 "=<rotx>"))]
+ "AVR_HAVE_MOVW
+ && CONST_INT_P (operands[2])
+ && 0 == INTVAL (operands[2]) % 16"
"#"
"&& (reload_completed || <MODE>mode == DImode)"
[(const_int 0)]
- "avr_rotate_bytes (operands);
- DONE;"
-)
+ {
+ avr_rotate_bytes (operands);
+ DONE;
+ })
; Split byte aligned rotates using scratch that is always QI mode.
(define_insn_and_split "*rotb<mode>"
[(set (match_operand:HIDI 0 "register_operand" "=r,r,#&r")
- (rotate:HIDI (match_operand:HIDI 1 "register_operand" "0,r,r")
- (match_operand 2 "immediate_operand" "n,n,n")))
- (clobber (match_operand:QI 3 "register_operand" "=<rotx>" ))]
- "(CONST_INT_P (operands[2]) &&
- (8 == (INTVAL (operands[2]) % 16)
- || (!AVR_HAVE_MOVW && 0 == (INTVAL (operands[2]) % 16))))"
+ (rotate:HIDI (match_operand:HIDI 1 "register_operand" "0,r,r")
+ (match_operand 2 "const_int_operand" "n,n,n")))
+ (clobber (match_scratch:QI 3 "=<rotx>"))]
+ "CONST_INT_P (operands[2])
+ && (8 == INTVAL (operands[2]) % 16
+ || (!AVR_HAVE_MOVW
+ && 0 == INTVAL (operands[2]) % 16))"
"#"
"&& (reload_completed || <MODE>mode == DImode)"
[(const_int 0)]
- "avr_rotate_bytes (operands);
- DONE;"
-)
+ {
+ avr_rotate_bytes (operands);
+ DONE;
+ })
;;<< << << << << << << << << << << << << << << << << << << << << << << << << <<