From patchwork Sat Jul 11 18:44:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1327379 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nextmovesoftware.com header.i=@nextmovesoftware.com header.a=rsa-sha256 header.s=default header.b=aQyi0M7U; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B3zNW5DG0z9sRK for ; Sun, 12 Jul 2020 04:44:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A1A4B3857C42; Sat, 11 Jul 2020 18:44:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 066FC3857C42 for ; Sat, 11 Jul 2020 18:44:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 066FC3857C42 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=roger@nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RVCgz6eKePnAomb6Z+npHbQfcJUpgJhFrw7sKY93ck8=; b=aQyi0M7U/07gKovLuDE4TkMp14 G1j1wFMCP1771JJpK4HEe06c4g5OnLA/FXrlZcpvuAaB7kIsIOAPXL8caH8Sf3VaqEMVY1H/Ch87v E4FhzhLWKBkHcXQ3wpR8uE8R8BvW83K3H5ntySpiLqaWW51Rq0v0e51urWHBedBMm6B63Cqp+XEsy WFdllaSE8nH+RXwVQ1cc3E6rHXQY/G7YF5ybfpTIhYE1lt27p7O0kq1uCPqJ7uOs454SGKTYbN0H1 y8pntqG6MtA6JrueEbtAJn+QR22p7qICE7vnydh6czLdKjr6xG8uCLBLdGCaOcEpgeHGjjIvyqrLS Votgy3VQ==; Received: from host86-137-89-56.range86-137.btcentralplus.com ([86.137.89.56]:64638 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1juKUG-0005bq-CH; Sat, 11 Jul 2020 14:44:36 -0400 From: "Roger Sayle" To: Subject: [PATCH] nvptx: Support 16-bit shifts and extendqihi2. Date: Sat, 11 Jul 2020 19:44:35 +0100 Message-ID: <007701d657b3$539c6810$fad53830$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdZXsYIhUQS4n2vST4uev9IuWjYTJw== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The following patch adds support for 16-bits shifts and for sign extension from 8 bits to 16 bits. This patch has been tested on nvptx-none with no new regressions. Ok for mainline? 2020-07-11 Roger Sayle gcc/ChangeLog * config/nvptx/nvptx.md (extendqihi2): New instruction. (ashl3, ashr3, lshr3): Support HImode. Thanks in advance, Roger --- Roger Sayle NextMove Software Cambridge, UK diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index 6545b81..0538e83 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -319,6 +319,13 @@ %.\\tld%A1%u1\\t%0, %1;" [(set_attr "subregs_ok" "true")]) +(define_insn "extendqihi2" + [(set (match_operand:HI 0 "nvptx_register_operand" "=R") + (sign_extend:HI (match_operand:QI 1 "nvptx_register_operand" "R")))] + "" + "%.\\tcvt.s16.s8\\t%0, %1;" + [(set_attr "subregs_ok" "true")]) + (define_insn "extendsi2" [(set (match_operand:SI 0 "nvptx_register_operand" "=R,R") (sign_extend:SI (match_operand:QHIM 1 "nvptx_nonimmediate_operand" "R,m")))] @@ -556,23 +563,23 @@ ;; Shifts (define_insn "ashl3" - [(set (match_operand:SDIM 0 "nvptx_register_operand" "=R") - (ashift:SDIM (match_operand:SDIM 1 "nvptx_register_operand" "R") - (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")))] + [(set (match_operand:HSDIM 0 "nvptx_register_operand" "=R") + (ashift:HSDIM (match_operand:HSDIM 1 "nvptx_register_operand" "R") + (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")))] "" "%.\\tshl.b%T0\\t%0, %1, %2;") (define_insn "ashr3" - [(set (match_operand:SDIM 0 "nvptx_register_operand" "=R") - (ashiftrt:SDIM (match_operand:SDIM 1 "nvptx_register_operand" "R") - (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")))] + [(set (match_operand:HSDIM 0 "nvptx_register_operand" "=R") + (ashiftrt:HSDIM (match_operand:HSDIM 1 "nvptx_register_operand" "R") + (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")))] "" "%.\\tshr.s%T0\\t%0, %1, %2;") (define_insn "lshr3" - [(set (match_operand:SDIM 0 "nvptx_register_operand" "=R") - (lshiftrt:SDIM (match_operand:SDIM 1 "nvptx_register_operand" "R") - (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")))] + [(set (match_operand:HSDIM 0 "nvptx_register_operand" "=R") + (lshiftrt:HSDIM (match_operand:HSDIM 1 "nvptx_register_operand" "R") + (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")))] "" "%.\\tshr.u%T0\\t%0, %1, %2;")