public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Georg-Johann Lay <avr@gjlay.de>
To: gcc-patches@gcc.gnu.org
Cc: Denis Chertykov <chertykov@gmail.com>,
	 Anatoly Sokolov <aesok@post.ru>,
	Eric Weddington <eric.weddington@atmel.com>
Subject: [Patch,AVR]: Housekeeping: Clean-up notice_update_cc
Date: Mon, 26 Sep 2011 17:34:00 -0000	[thread overview]
Message-ID: <4E80A0CF.2030806@gjlay.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

This patchlet represents the impact of insn ashrqi3 on CC by means of attribute
"cc" instead of hard-coding it in notice_update_cc.

Testsuite passes fine. Moreover, tested against code like

char c;

void func_1 (char a)
{
    a = a >> 7;
    if (a)
        c = a;
}

that triggered PR39633.

Ok?

Johann

	* config/avr/avr.md (ashrqi3): Split alternative "n"
	into its remaining parts C03, C04, C05, C06, C07 and describe
	impact on CC by attribute "cc" appropriately.
	* config/avr/avr.c (notice_update_cc): Clean-up: Don't patch CC0
	by digging RTX.


[-- Attachment #2: cleanup-update-cc.diff --]
[-- Type: text/x-patch, Size: 1990 bytes --]

Index: config/avr/avr.md
===================================================================
--- config/avr/avr.md	(revision 179191)
+++ config/avr/avr.md	(working copy)
@@ -2820,14 +2820,14 @@ (define_insn "*ashlsi3_const"
 ;; arithmetic shift right
 
 (define_insn "ashrqi3"
-  [(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r,r")
-	(ashiftrt:QI (match_operand:QI 1 "register_operand" "0,0,0,0,0,0")
-		     (match_operand:QI 2 "general_operand"  "r,L,P,K,n,Qm")))]
+  [(set (match_operand:QI 0 "register_operand"             "=r,r,r,r,r          ,r      ,r")
+        (ashiftrt:QI (match_operand:QI 1 "register_operand" "0,0,0,0,0          ,0      ,0")
+                     (match_operand:QI 2 "general_operand"  "r,L,P,K,C03 C04 C05,C06 C07,Qm")))]
   ""
   "* return ashrqi3_out (insn, operands, NULL);"
-  [(set_attr "length" "5,0,1,2,5,9")
+  [(set_attr "length" "5,0,1,2,5,5,9")
    (set_attr "adjust_len" "ashrqi")
-   (set_attr "cc" "clobber,none,clobber,clobber,clobber,clobber")])
+   (set_attr "cc" "clobber,none,set_czn,set_czn,set_czn,clobber,clobber")])
 
 (define_insn "ashrhi3"
   [(set (match_operand:HI 0 "register_operand"             "=r,r,r,r,r,r,r")
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 179191)
+++ config/avr/avr.c	(working copy)
@@ -1574,26 +1574,6 @@ notice_update_cc (rtx body ATTRIBUTE_UNU
     case CC_CLOBBER:
       /* Insn doesn't leave CC in a usable state.  */
       CC_STATUS_INIT;
-
-      /* Correct CC for the ashrqi3 with the shift count as CONST_INT < 6 */
-      set = single_set (insn);
-      if (set)
-	{
-	  rtx src = SET_SRC (set);
-	  
-	  if (GET_CODE (src) == ASHIFTRT
-	      && GET_MODE (src) == QImode)
-	    {
-	      rtx x = XEXP (src, 1);
-
-	      if (CONST_INT_P (x)
-		  && IN_RANGE (INTVAL (x), 1, 5))
-		{
-		  cc_status.value1 = SET_DEST (set);
-		  cc_status.flags |= CC_OVERFLOW_UNUSABLE;
-		}
-	    }
-	}
       break;
     }
 }

             reply	other threads:[~2011-09-26 16:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-26 17:34 Georg-Johann Lay [this message]
2011-09-26 19:36 ` Denis Chertykov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E80A0CF.2030806@gjlay.de \
    --to=avr@gjlay.de \
    --cc=aesok@post.ru \
    --cc=chertykov@gmail.com \
    --cc=eric.weddington@atmel.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).