From patchwork Tue Sep 29 23:34:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bowman X-Patchwork-Id: 524069 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43022140180 for ; Wed, 30 Sep 2015 09:36:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=keYKQaWb; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=dpR fWDOYpn7gPKs1oz/z1/MSgXaKkk+7j25P/qX1QNN7uteHXXhsUxtaNKb7+TL7wUk fyH0gnq6x+ftVAJyMRMjvV+lNzxCJg3MiEhkPu6VLrkcb3vBv80StC9lwTxovdLa S0oQubLSKM10lZtOsRF6uFs2NR7yFYnigxn+90SU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=M4hk/+zZI xmia3eOprwG4QW2NYg=; b=keYKQaWboPL2d25GU4GYnBcsEBEuqkuuwHHqzt2UA CCzLD45z191pRmZejDuWdzT+52TkGVmKYbSU/oEew2IGTS7l1sQ5GL60D7D4rLRQ 42g6pZHX0QKV6Gl4DbYgo33Oym7hvzQDn2ET0nVPnppTnFsVCDNl8mMtwLkKZ9DK 6Q= Received: (qmail 118438 invoked by alias); 29 Sep 2015 23:36:03 -0000 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 Received: (qmail 118428 invoked by uid 89); 29 Sep 2015 23:36:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.0 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp-out4.electric.net Received: from smtp-out4.electric.net (HELO smtp-out4.electric.net) (192.162.216.186) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 29 Sep 2015 23:36:01 +0000 Received: from 1Zh4RB-0001st-V7 by out4b.electric.net with emc1-ok (Exim 4.85) (envelope-from ) id 1Zh4RC-0001tc-Tr for gcc-patches@gcc.gnu.org; Tue, 29 Sep 2015 16:35:58 -0700 Received: by emcmailer; Tue, 29 Sep 2015 16:35:58 -0700 Received: from [188.39.184.227] (helo=GLAEXCH3.ftdi.local) by out4b.electric.net with esmtps (TLSv1:AES128-SHA:128) (Exim 4.86) (envelope-from ) id 1Zh4RB-0001st-V7 for gcc-patches@gcc.gnu.org; Tue, 29 Sep 2015 16:35:57 -0700 Received: from GLAEXCH1.ftdi.local ([172.16.0.121]) by glaexch3 ([172.16.0.161]) with mapi id 14.01.0438.000; Wed, 30 Sep 2015 00:34:45 +0100 From: James Bowman To: "gcc-patches@gcc.gnu.org" Subject: [patch committed FT32] Limit MEMSET, MEMCPY to <512 bytes Date: Tue, 29 Sep 2015 23:34:44 +0000 Message-ID: MIME-Version: 1.0 X-Outbound-IP: 188.39.184.227 X-Env-From: james.bowman@ftdichip.com X-PolicySMART: 3094660 The attached patch limits the MEMSET (setmemsi pattern) and MEMCPY (movmemsi pattern) instructions to 0-511 bytes. There is a hardware limitation on large MEMSET, MEMCPY operations that the library versions of memset() and memcpy() deal with. [gcc] 2015-09-29 James Bowman * config/ft32/predicates.md (ft32_imm_operand): New predicate. * config/ft32/ft32.md (movmemsi, setmemsi): Use ft32_imm_operand predicate, disallow register for operand 2. Index: gcc/config/ft32/ft32.md =================================================================== --- gcc/config/ft32/ft32.md (revision 228109) +++ gcc/config/ft32/ft32.md (working copy) @@ -841,19 +841,19 @@ ) (define_insn "movmemsi" - [(set (match_operand:BLK 0 "memory_operand" "=W,W,BW") - (match_operand:BLK 1 "memory_operand" "W,W,BW")) - (use (match_operand:SI 2 "ft32_rimm_operand" "r,KA,rKA")) + [(set (match_operand:BLK 0 "memory_operand" "=W,BW") + (match_operand:BLK 1 "memory_operand" "W,BW")) + (use (match_operand:SI 2 "ft32_imm_operand" "KA,KA")) (use (match_operand:SI 3)) ] "" - "memcpy.%d3 %b0,%b1,%2 # %3!" + "memcpy.%d3 %b0,%b1,%2 " ) (define_insn "setmemsi" - [(set (match_operand:BLK 0 "memory_operand" "=BW,BW") (unspec:BLK [ - (use (match_operand:QI 2 "register_operand" "r,r")) - (use (match_operand:SI 1 "ft32_rimm_operand" "r,KA")) + [(set (match_operand:BLK 0 "memory_operand" "=BW") (unspec:BLK [ + (use (match_operand:QI 2 "register_operand" "r")) + (use (match_operand:SI 1 "ft32_imm_operand" "KA")) ] UNSPEC_SETMEM)) (use (match_operand:SI 3)) ] Index: gcc/config/ft32/predicates.md =================================================================== --- gcc/config/ft32/predicates.md (revision 228109) +++ gcc/config/ft32/predicates.md (working copy) @@ -80,6 +80,10 @@ (and (match_code "const_int") (match_test "IN_RANGE (INTVAL (op), -512, 511)")))) +(define_predicate "ft32_imm_operand" + (and (match_code "const_int") + (match_test "IN_RANGE (INTVAL (op), -512, 511)"))) + (define_predicate "ft32_bwidth_operand" (and (match_code "const_int") (match_test "IN_RANGE (INTVAL (op), 1, 16)")))