From patchwork Sat Jul 1 17:20:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takayuki 'January June' Suwa X-Patchwork-Id: 1802265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=dpP9CLpe; 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QtfB733KSz20b1 for ; Sun, 2 Jul 2023 03:21:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 04C433857C43 for ; Sat, 1 Jul 2023 17:21:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04C433857C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688232103; bh=AneKbtzJcO6N4sr7WUjgPd0cSDk+pz+lAFVbqSKlMvY=; h=Date:To:Cc:Subject:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=dpP9CLpemO/5nQ0sDw4yaJWIq/LHgHYpQxLDoWIrhpCQsTFjGxFJBnnFZstiiaIrc Rjeixk76uHyZdHMtZNmfu0JpnMGdIP09yNorMzoQtrQIAF9APnuJRfalUgGtSBYKev rOVD1kh/zeFT+9Sk19lRHog+7VfsBg7n3JzBk7/M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omggw0021.mail.otm.yahoo.co.jp (omggw0021.mail.otm.yahoo.co.jp [182.22.18.37]) by sourceware.org (Postfix) with ESMTPS id 5C26B3858D39 for ; Sat, 1 Jul 2023 17:21:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C26B3858D39 X-YMail-OSG: IUtn1.oVM1nkuot3CGXVd2V.UpnzaFPj3fGmPsqRD5fMJv2U03dqJefqG_GHzCe EwyGjAdV9WbA4L2baKusvsruCAH_vP.6g2RB0Oz.OOcFJwJ60VheeG4bpp1TSDUp3D0.ccAnoTfI CtH99brzQHXxCi4g5eI9dC69GVBYzLDYe2L_UCoA3AVbBJIYxsBxfdh9YqTkIKNHsDU2aJrcexLD O7KCzCv5zOAmrYfdm4id9hlCtlrCeo2rBzMCyEDOQoV.TIHFUUMZsNfiOfglEYUvCoKn4oDVbf_x JBztdCN5gxmsy6aw_KsFauJNO6t4CD7ZSmH7q08Wn22faMGNcRFNSRYqX10fvwYMSycT7PhrqZGJ vXSOExh.C1o3H.QWZrSEjE0wU9WI48PouQG1nhECEyegROZqd.VNXZRgjkHttRaJwSiTjtdOe4S. Yr3nclBWOuL8b8jADhjDj2sEp24fd1C6Up3RL7rO53eGkkfKY.GU1GUnEkvFbTiLT5kXrjOgqrLl lPSHuDItSlhaCSMCuym9O4Cy_pVq6p_PXeDBrL9Grqa.DGKe0qVpAKwpSwzOQg1TTLrc5YDlpamY 456hSnLi3rpJBZUO1A48XXWnqtjCVZOwrJRawBXMSof34bBjV3uR5OkkCJSuAUoHD48bn5rzde6l 4BING4OUxPPWTHh6Ihv_xGGO.3oXbCT513rL6AsO67JwSlUGEgik1TCuwKPp8womFFpzSMiTS1_B _ZV1_hymnEfL5rn_BOZdvEYI891l3J7CZ3U9E4wK5YpS0maIHhVKDoCdbpua3M1e6dEGNjs0HOel Mlg8E79uHM5ece1J4.q7uS9d0aCxc76r5ekt96eJwd0KvNdzSGopeknZ9QdSDQi1QwtccMAQRqtD SVcDQL4a.AHXzOmpa43v_bOewMUgC3ZPbhyaXbiflmvLe9hV8c91_5F5YpI1IysQ4xvA3Ej3JGqr 17C6CQqTyxVZjRaca.BmgCRemjaqI3QUhUR7GSfq_feonPu54q3XTj5viOLtaKm8AFA-- Received: from sonicgw.mail.yahoo.co.jp by sonicconh6003.mail.ssk.yahoo.co.jp with HTTP; Sat, 1 Jul 2023 17:21:18 +0000 Received: by smtphe6005.mail.ssk.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID ed106e3c87e8a8e38d4dfe23d04cb3ae; Sun, 02 Jul 2023 02:21:13 +0900 (JST) Message-ID: Date: Sun, 2 Jul 2023 02:20:08 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 To: GCC Patches Cc: Max Filippov Subject: [PATCH 2/2] xtensa: The use of CLAMPS instruction also requires TARGET_MINMAX, as well as TARGET_CLAMPS References: X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-Patchwork-Original-From: Takayuki 'January June' Suwa via Gcc-patches From: Takayuki 'January June' Suwa Reply-To: Takayuki 'January June' Suwa Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Because both smin and smax requiring TARGET_MINMAX are essential to the RTL representation. gcc/ChangeLog: * config/xtensa/xtensa.cc (xtensa_match_CLAMPS_imms_p): Simplify. * config/xtensa/xtensa.md (*xtensa_clamps): Add TARGET_MINMAX to the condition. --- gcc/config/xtensa/xtensa.cc | 7 ++----- gcc/config/xtensa/xtensa.md | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index dd35e63c094..3298d53493c 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -2649,11 +2649,8 @@ xtensa_emit_add_imm (rtx dst, rtx src, HOST_WIDE_INT imm, rtx scratch, bool xtensa_match_CLAMPS_imms_p (rtx cst_max, rtx cst_min) { - int max, min; - - return IN_RANGE (max = exact_log2 (-INTVAL (cst_max)), 7, 22) - && IN_RANGE (min = exact_log2 (INTVAL (cst_min) + 1), 7, 22) - && max == min; + return IN_RANGE (exact_log2 (-INTVAL (cst_max)), 7, 22) + && (INTVAL (cst_max) + INTVAL (cst_min)) == -1; } diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index b1af08eba8a..664424f1239 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -522,7 +522,7 @@ (smax:SI (smin:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "const_int_operand" "i")) (match_operand:SI 3 "const_int_operand" "i")))] - "TARGET_CLAMPS + "TARGET_MINMAX && TARGET_CLAMPS && xtensa_match_CLAMPS_imms_p (operands[3], operands[2])" "#" "&& 1" @@ -540,7 +540,7 @@ (smin:SI (smax:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "const_int_operand" "i")) (match_operand:SI 3 "const_int_operand" "i")))] - "TARGET_CLAMPS + "TARGET_MINMAX && TARGET_CLAMPS && xtensa_match_CLAMPS_imms_p (operands[2], operands[3])" { static char result[64];