From patchwork Sat Sep 14 09:00:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 1985596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gjlay.de header.i=@gjlay.de header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=AJ7H2AiC; dkim=pass header.d=gjlay.de header.i=@gjlay.de header.a=ed25519-sha256 header.s=strato-dkim-0003 header.b=3DQp3qBv; dkim-atps=neutral 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=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X5QBW6wnlz1y2Q for ; Sat, 14 Sep 2024 19:00:48 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C78643858404 for ; Sat, 14 Sep 2024 09:00:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.221]) by sourceware.org (Postfix) with ESMTPS id 6ABDC3858C5F for ; Sat, 14 Sep 2024 09:00:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6ABDC3858C5F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gjlay.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gjlay.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6ABDC3858C5F Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.221 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1726304424; cv=pass; b=tZ6zkxZRaQ3lugFRT01KiV82RLhIA6ouiQtu2KRFZnDyrw3FnVBHVHzKToMsZlkPkp4dWIM1AQDgj0t/ULj3j4naKL0PjreQ0tZpgqU+4u/gY0JAlNQx3t2LBubBLsrMse68B32x8Pwxs03Y14h8tIK4Ni+luWS2mwxHPnybm7g= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1726304424; c=relaxed/simple; bh=pyyBBloxZz5123/WxClH5fh3FNJYhgCwG5ZbviAZ4oY=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: To:Subject; b=iTjnFtovSYPz6lmas6EuwlqXPuaPCFfKLc0wE5fhQPOJvIBoboV9Kn/RlA9Et/K/BJq7yBZtrt6zxkb4zC0jlQ02PUoEcN67YP9d5GZM/SGiIdYoz4LvlxGlXDaKyvx+4xuJzzBGD+jR6C03M3dxc8dUrqtiizX8b35BD9b1zE0= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1726304420; cv=none; d=strato.com; s=strato-dkim-0002; b=QJG4zI3rvGa1CDH7xESgMxPKEov+fsldhxfRLYiuccHDBTg2MYKEw8EVb6D4RhY5ap 8vcKrgj9ADJo35aC/DnQb6VacGQXUfet74FuGWZ1JfcGp7D35EXlugR6ZWJHaY2/Krwv H7kLtXWQx/2Zz7IDt/PFp+vXD2MZkoXSYxKrbxTTIAAsDQ9Tb3gkBj4qYDD2SymLCyNs CXz1U1k+NiHu7t7iu251rpNRq1/b3sQmYc62E/CLgtVCgiRPfDTRJ9NI9bIJ176YHBx7 BopMYsz2Ut5ORXTcn0W7khuqeYt9yC3PK7IB3WyVYzZXWc0p4wxdsV9Z7+z66IgOxZk3 Kv8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1726304420; s=strato-dkim-0002; d=strato.com; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=pJHF58HBu87W5D8jL7Z/IUkNC83RYegaAU3FXjoohME=; b=H4ng9N0qOOTzEK4uPcIDl27JGG7Ex9vRfokmmGmUV3F/BLKLbxJCmk6Kaenlqg/EPS H95As7nQgJe1L/66/SW2oYbrAwK1LYwJmQvhk3e8Xw1Vzqwf6SYQJWQywMdgiNsVVup6 rAIWcaJlm0pepOjFV4Yn1T+sc2GIL5KmP68WU06HNaj5m+PQUBW60uVj2QGS3bYvrbuE YU7lS8uRTg5P7S7Ew6WD67M8HA+2Y+fNW0HMtDaqs0rATJY9ts+FJ7EsjqQAfYBbjdZR PB9rWPVi8/XyuUdhPDplEI2YQ+h41HcwGC1EfPi1HOwI+qDp1r8DSyPAgNlGwU7Q25So oamw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1726304420; s=strato-dkim-0002; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=pJHF58HBu87W5D8jL7Z/IUkNC83RYegaAU3FXjoohME=; b=AJ7H2AiCWZ1qrDYetXcuKv5ooO+KsFK7PyEftBySso/7JnmHqvvJjbFY4rTJLwhQPF xsT1WbcAfU+1mOPsMAHTQTbNQ2iqEpdDtt78/jkXUQuXbMQr0zuqCfV1r54vD8JaC6x4 7y2MaScmsXjzkaI6DUPd4hjx/Sf6Gyr+sXB85CienkjBIs5o7XjJXvaQOALfXR9b4Kvz AOil96NA2BtY61EN9yhdKPvYnhdjNX40k7Rcwvpl47rLtyN1bv2WC1Bf/ajGpFYOgpRl U3ZV71MC2BHzq+Wb35QBBsCNcmWwb1TrpmiVp3pc4HNbFTbtdmL4YlIAKJbaYcJS7hSd h0yw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1726304420; s=strato-dkim-0003; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=pJHF58HBu87W5D8jL7Z/IUkNC83RYegaAU3FXjoohME=; b=3DQp3qBv1ttECzjQXVwLmomPwBiWe1kdYJ6nJtupuo9yFdlDx+/cDukJ6WtPXyHDVu 3DPSRwFsqVH6ZOFUqLAw== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKXKoq0dKoR0vetzhr/2IDlGFRklUq" Received: from [192.168.2.102] by smtp.strato.de (RZmta 51.2.3 DYNA|AUTH) with ESMTPSA id xccbe708E90KNeb (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 14 Sep 2024 11:00:20 +0200 (CEST) Message-ID: Date: Sat, 14 Sep 2024 11:00:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Georg-Johann Lay Content-Language: en-US To: Denis Chertykov , "gcc-patches@gcc.gnu.org" Subject: [patch,avr] copysign: Use copysign rtx code, allow const_double X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This uses new rtx code copysign instead of an unspec. It also allows const_double as 2nd operand because gcc does not optimize code like __builtin_copysignf (x, -1.0f); Ok for trunk? Johann --- AVR: Use rtx code copysign. gcc/ * config/avr/avr.md (UNSPEC_COPYSIGN): Remove define_enum. (copysignsf3): Use copysign instead of UNSPEC_COPYSIGN. Allow const_double for operand 2. diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 429f537b7d4..2abf3c38d83 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -87,7 +87,6 @@ (define_c_enum "unspec" UNSPEC_FMUL UNSPEC_FMULS UNSPEC_FMULSU - UNSPEC_COPYSIGN UNSPEC_INSERT_BITS UNSPEC_ROUND ]) @@ -9272,12 +9271,18 @@ (define_insn "*ffssihi2.libgcc" ;; Copysign (define_insn "copysignsf3" - [(set (match_operand:SF 0 "register_operand" "=r") - (unspec:SF [(match_operand:SF 1 "register_operand" "0") - (match_operand:SF 2 "register_operand" "r")] - UNSPEC_COPYSIGN))] + [(set (match_operand:SF 0 "register_operand" "=r") + (copysign:SF (match_operand:SF 1 "register_operand" "0") + (match_operand:SF 2 "nonmemory_operand" "rF")))] "" - "bst %D2,7\;bld %D0,7" + { + if (const_double_operand (operands[2], SFmode)) + { + rtx xmsb = simplify_gen_subreg (QImode, operands[2], SFmode, 3); + return INTVAL (xmsb) < 0 ? "set\;bld %D0,7" : "clt\;bld %D0,7"; + } + return "bst %D2,7\;bld %D0,7"; + } [(set_attr "length" "2")])