From patchwork Tue Feb 14 22:08:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 141207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 154BEB6FF1 for ; Wed, 15 Feb 2012 09:08:54 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329862135; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=8rmt4qA r4bTkcnw3d6j9fnLm/jc=; b=ZlOJGuxqkoczSQ/KJtWYvxFRFRRN3Q4lCDWfVz7 GqNsfWO5lJHCah+vSjzu/awt8HNLRXQPxfVgNeXSZtIcxHcyDlYi+TOoQV0fBA/w eONhXomW1vQ2K9EhePH19sy7kOQQy7QJLeKyrm93IM7OxoQe5l/U+QWLg4L2Lvzg hikw= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=n7phETWM1P9LN7a8lg1YCcJ9Yz1YtK6KD/Vg/wsiB4PnCqHzmWGlope4u7RTRG ULP63URjxrr8v7/PxMrc/QYmiuTS0uSWxH071Co0v+vfrP1qujRBWCh+bM3ZPo92 e8UkYKWJnoP5G0inpFLc1BIQKpg8l3Vit4QoaTtWW9/w8=; Received: (qmail 9138 invoked by alias); 14 Feb 2012 22:08:49 -0000 Received: (qmail 9126 invoked by uid 22791); 14 Feb 2012 22:08:48 -0000 X-SWARE-Spam-Status: No, hits=0.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MEDICAL_SUBJECT, RCVD_IN_DNSWL_LOW, TW_IV X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Feb 2012 22:08:33 +0000 Received: by ghbf19 with SMTP id f19so375354ghb.20 for ; Tue, 14 Feb 2012 14:08:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.153.104 with SMTP id e68mr28997587yhk.74.1329257313245; Tue, 14 Feb 2012 14:08:33 -0800 (PST) Received: by 10.100.177.19 with HTTP; Tue, 14 Feb 2012 14:08:33 -0800 (PST) Date: Tue, 14 Feb 2012 23:08:33 +0100 Message-ID: Subject: [patch] clean up pdp11.md a bit From: Steven Bosscher To: Paul Koning , GCC Patches X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello, Just a few cleanups for things I noticed last weekend. * Constraints on define_expand are never used, remove them (most other ports do not have constraints on define_expands either) * Some patterns have no name, makes debugging a bit harder * The divmodhi4 expander has been commented out since Day 1 of egcs. Explain why. Tested by building the compiler. For pdp11-elf, which is not a supported target according to backends.html, but it's not rejected. Not sure what the right target is to compile for. In any case, I obviously have no PDP-11 to test on. But the patch has no changes that impact code generation (the constraints were already ignored). OK for trunk? Ciao! Steven * pdp11.md: Add names to some patterns. Clean up constraints on define_expands. Explain why divmodhi4 is commented out. Index: pdp11.md =================================================================== --- pdp11.md (revision 184217) +++ pdp11.md (working copy) @@ -1,6 +1,6 @@ ;;- Machine description for the pdp11 for GNU C compiler ;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2004, 2005 -;; 2007, 2008, 2010 Free Software Foundation, Inc. +;; 2007, 2008, 2010, 2012 Free Software Foundation, Inc. ;; Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at). ;; This file is part of GCC. @@ -195,7 +195,7 @@ ;; sob instruction - we need an assembler which can make this instruction ;; valid under _all_ circumstances! -(define_insn "" +(define_insn "*sob" [(set (pc) (if_then_else (ne (plus:HI (match_operand:HI 0 "register_operand" "+r") @@ -242,8 +242,8 @@ (define_expand "cbranchdf4" [(set (cc0) - (compare (match_operand:DF 1 "general_operand") - (match_operand:DF 2 "register_or_const0_operand"))) + (compare (match_operand:DF 1 "general_operand" "") + (match_operand:DF 2 "register_or_const0_operand" ""))) (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)]) @@ -254,8 +254,8 @@ (define_expand "cbranch4" [(set (cc0) - (compare (match_operand:PDPint 1 "general_operand") - (match_operand:PDPint 2 "general_operand"))) + (compare (match_operand:PDPint 1 "general_operand" "") + (match_operand:PDPint 2 "general_operand" ""))) (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)]) @@ -370,11 +370,11 @@ ;; let constraints only accept a register ... (define_expand "movmemhi" - [(parallel [(set (match_operand:BLK 0 "general_operand" "=g,g") - (match_operand:BLK 1 "general_operand" "g,g")) - (use (match_operand:HI 2 "general_operand" "n,mr")) - (use (match_operand:HI 3 "immediate_operand" "i,i")) - (clobber (match_scratch:HI 4 "=&r,X")) + [(parallel [(set (match_operand:BLK 0 "general_operand" "") + (match_operand:BLK 1 "general_operand" "")) + (use (match_operand:HI 2 "general_operand" "")) + (use (match_operand:HI 3 "immediate_operand" "")) + (clobber (match_scratch:HI 4 "")) (clobber (match_dup 5)) (clobber (match_dup 6)) (clobber (match_dup 2))])] @@ -428,9 +428,9 @@ (define_expand "truncsihi2" - [(set (match_operand:HI 0 "nonimmediate_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "") (subreg:HI - (match_operand:SI 1 "general_operand" "or") + (match_operand:SI 1 "general_operand" "") 0))] "" "") @@ -449,9 +449,9 @@ [(set (subreg:HI (match_dup 0) 2) - (match_operand:HI 1 "register_operand" "r")) + (match_operand:HI 1 "register_operand" "")) (set (subreg:HI - (match_operand:SI 0 "register_operand" "=r") + (match_operand:SI 0 "register_operand" "") 0) (const_int 0))] "" @@ -501,12 +501,12 @@ ;; unconditionally, and then match dependent on CPU type: (define_expand "extendhisi2" - [(set (match_operand:SI 0 "nonimmediate_operand" "=g") - (sign_extend:SI (match_operand:HI 1 "general_operand" "g")))] + [(set (match_operand:SI 0 "nonimmediate_operand" "") + (sign_extend:SI (match_operand:HI 1 "general_operand" "")))] "" "") -(define_insn "" ; "extendhisi2" +(define_insn "*extendhisi2_40" [(set (match_operand:SI 0 "nonimmediate_operand" "=o,<,r") (sign_extend:SI (match_operand:HI 1 "general_operand" "g,g,g")))] "TARGET_40_PLUS" @@ -555,7 +555,7 @@ [(set_attr "length" "10,6,6")]) -(define_insn "" +(define_insn "*extendhisi2_not40" [(set (match_operand:SI 0 "register_operand" "=r") (sign_extend:SI (match_operand:HI 1 "general_operand" "0")))] "(! TARGET_40_PLUS)" @@ -926,9 +926,9 @@ ;; Arithmetic right shift on the pdp works by negating the shift count. (define_expand "ashrsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (ashift:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:HI 2 "general_operand" "g")))] + [(set (match_operand:SI 0 "register_operand" "") + (ashift:SI (match_operand:SI 1 "register_operand" "") + (match_operand:HI 2 "general_operand" "")))] "" " { @@ -993,7 +993,7 @@ (define_expand "lshrsi3" [(match_operand:SI 0 "register_operand" "") - (match_operand:SI 1 "register_operand" "0") + (match_operand:SI 1 "register_operand" "") (match_operand:HI 2 "general_operand" "")] "" " @@ -1128,9 +1128,9 @@ ;; Arithmetic right shift on the pdp works by negating the shift count. (define_expand "ashrhi3" - [(set (match_operand:HI 0 "register_operand" "=r") - (ashift:HI (match_operand:HI 1 "register_operand" "0") - (match_operand:HI 2 "general_operand" "g")))] + [(set (match_operand:HI 0 "register_operand" "") + (ashift:HI (match_operand:HI 1 "register_operand" "") + (match_operand:HI 2 "general_operand" "")))] "" " { @@ -1254,7 +1254,7 @@ (const_int 4) (const_int 2)))]) -(define_insn "" +(define_insn "*jump" [(set (pc) (label_ref (match_operand 0 "" ""))) (clobber (const_int 1))] @@ -1339,15 +1339,15 @@ ;; 32 bit result (define_expand "mulhisi3" [(set (match_dup 3) - (match_operand:HI 1 "nonimmediate_operand" "g,g")) - (set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered! + (match_operand:HI 1 "nonimmediate_operand" "")) + (set (match_operand:SI 0 "register_operand" "") (mult:SI (truncate:HI (match_dup 0)) - (match_operand:HI 2 "general_operand" "rR,Qi")))] + (match_operand:HI 2 "general_operand" "")))] "TARGET_40_PLUS" "operands[3] = gen_lowpart(HImode, operands[1]);") -(define_insn "" +(define_insn "*mulhisi3" [(set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered! (mult:SI (truncate:HI (match_operand:SI 1 "register_operand" "%0,0")) @@ -1384,7 +1384,7 @@ "TARGET_40_PLUS" "") -(define_insn "" +(define_insn "*divhi3" [(set (subreg:HI (match_operand:SI 0 "register_operand" "=r") 0) (div:HI (match_operand:SI 1 "general_operand" "0") (match_operand:HI 2 "general_operand" "g")))] @@ -1401,7 +1401,7 @@ "TARGET_40_PLUS" "") -(define_insn "" +(define_insn "*modhi3" [(set (subreg:HI (match_operand:SI 0 "register_operand" "=r") 2) (mod:HI (match_operand:SI 1 "general_operand" "0") (match_operand:HI 2 "general_operand" "g")))] @@ -1409,6 +1409,19 @@ "div %2,%0" [(set_attr "length" "4")]) +;; +;; FIXME +;; From the GCC internals manual: +;; +;; "For machines with an instruction that produces both a quotient and +;; a remainder, provide a pattern for `divmodm4' but do not provide +;; patterns for `divm3' and `modm3'. This allows optimization in the +;; relatively common case when both the quotient and remainder are +;; computed." +;; +;; On PDP-11, DIV always produces a quotient and a remainder. But CSE +;; cannot optimize the divmods away because the SET_DESTs are SUBREGs. +; ;(define_expand "divmodhi4" ; [(parallel [(set (subreg:HI (match_dup 1) 0) ; (div:HI (match_operand:SI 1 "register_operand" "0")