From patchwork Wed May 29 18:08:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 1107313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-501896-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com 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 45Ddxt4cYXz9s3l for ; Thu, 30 May 2019 04:08:47 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:message-id:content-type :content-transfer-encoding; q=dns; s=default; b=kpmOIITmeYq3Ky0r MdgJA/VsPcc4Z9Iu+L36s6Kz9R9zrsU+V2T4XtgFplmYukfkB+gj943vaDfIAX5m JIBqT6rI26wS2pE1k7TDQpySiObF1Pi9nRn6fr6JYMxjvbhYuWX1MWFs9D6znKoU QSdn5Xf7vgQaPBGLp5DzEh/1IkQ= 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:to:cc :from:subject:date:mime-version:message-id:content-type :content-transfer-encoding; s=default; bh=Kt272Ml0dfFz9lLysgTn1i 7ZZto=; b=xg7MyLw2QJXkKP43L6E3xI71OYGa2p+UiATsXkvcntS8oZ/5zVJ+3K 3RgEQYfs2twyPQgH0WSQS4/0W5oPADLzZh9pQUd7Wy/TIrSuMKtZzduDEsb0sf5/ wMUw+jM3iEe4dTQbmdRI7BjVlPHVHKO9w6UpfCj6W6fbBwYx399Q4= Received: (qmail 12997 invoked by alias); 29 May 2019 18:08:40 -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 12989 invoked by uid 89); 29 May 2019 18:08:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 May 2019 18:08:38 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4TI38lL040731 for ; Wed, 29 May 2019 14:08:34 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ssxfghhfm-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 29 May 2019 14:08:34 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 May 2019 19:08:33 +0100 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 29 May 2019 19:08:30 +0100 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4TI8TwM38469828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2019 18:08:29 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EF7BFAC062; Wed, 29 May 2019 18:08:28 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9FFA8AC064; Wed, 29 May 2019 18:08:28 +0000 (GMT) Received: from BigMac.local (unknown [9.85.143.85]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 29 May 2019 18:08:28 +0000 (GMT) To: GCC Patches Cc: Segher Boessenkool From: Bill Schmidt Subject: [PATCH] rs6000: Add eI constraint for 34-bit constants Date: Wed, 29 May 2019 13:08:28 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 x-cbid: 19052918-0052-0000-0000-000003C8920F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011180; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01210372; UDB=6.00635907; IPR=6.00991404; MB=3.00027104; MTD=3.00000008; XFM=3.00000015; UTC=2019-05-29 18:08:31 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19052918-0053-0000-0000-00006117807E Message-Id: Hi, This short patch introduces the eI constraint. It also adds the SIGNED_16BIT_OFFSET_P convenience macro that will be used in subsequent patches. Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Is this okay for trunk? Thanks, Bill 2019-05-29 Bill Schmidt Michael Meissner * config/rs6000/constraints.md (eI): New constraint. * config/rs6000/predicates.md (cint34_operand): New predicate. * config/rs6000/rs6000.h (SIGNED_16BIT_OFFSET_P): New #define. (SIGNED_34BIT_OFFSET_P): Likewise. * doc/md.texi (eI): Document constraint. diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md index fd8be343f09..8004a92fd40 100644 --- a/gcc/config/rs6000/constraints.md +++ b/gcc/config/rs6000/constraints.md @@ -210,6 +210,11 @@ (and (match_code "const_int") (match_test "((- (unsigned HOST_WIDE_INT) ival) + 0x8000) < 0x10000"))) +;; 34-bit signed integer constant +(define_constraint "eI" + "34-bit constant integer that can be loaded with PADDI" + (match_operand 0 "cint34_operand")) + ;; Floating-point constraints. These two are defined so that insn ;; length attributes can be calculated exactly. diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 2643f1abd2e..a578e0f27f7 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -302,6 +302,16 @@ (and (match_code "const_int") (match_test "IN_RANGE (INTVAL (op), 0, 15)"))) +;; Return 1 if op is a 34-bit constant integer. +(define_predicate "cint34_operand" + (match_code "const_int") +{ + if (!TARGET_PREFIXED_ADDR) + return 0; + + return SIGNED_34BIT_OFFSET_P (INTVAL (op), 0); +}) + ;; Return 1 if op is a register that is not special. ;; Disallow (SUBREG:SF (REG:SI)) and (SUBREG:SI (REG:SF)) on VSX systems where ;; you need to be careful in moving a SFmode to SImode and vice versa due to diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 335d75ae85f..fc92ff20d11 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2493,3 +2493,17 @@ extern GTY(()) tree rs6000_builtin_decls[RS6000_BUILTIN_COUNT]; #if (GCC_VERSION >= 3000) #pragma GCC poison TARGET_FLOAT128 OPTION_MASK_FLOAT128 MASK_FLOAT128 #endif + +/* Whether a given VALUE is a valid 16- or 34-bit signed offset. EXTRA is the + amount that we can't touch at the high end of the range (typically if the + address is split into smaller addresses, the extra covers the addresses + which might be generated when the insn is split). */ +#define SIGNED_16BIT_OFFSET_P(VALUE, EXTRA) \ + IN_RANGE (VALUE, \ + ~(HOST_WIDE_INT_1 << 15), \ + (HOST_WIDE_INT_1 << 15) - 1 - (EXTRA)) + +#define SIGNED_34BIT_OFFSET_P(VALUE, EXTRA) \ + IN_RANGE (VALUE, \ + ~(HOST_WIDE_INT_1 << 33), \ + (HOST_WIDE_INT_1 << 33) - 1 - (EXTRA)) diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index db9c210edb8..775b8f5b715 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -3367,6 +3367,9 @@ Zero @item P Constant whose negation is a signed 16-bit constant +@item eI +Signed 34-bit integer constant if prefixed instructions are supported. + @item G Floating point constant that can be loaded into a register with one instruction per word