From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id A0D31385454D for ; Thu, 17 Nov 2022 23:36:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0D31385454D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x429.google.com with SMTP id b185so3272926pfb.9 for ; Thu, 17 Nov 2022 15:36:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=e7srDnVnQG0ZUxUgpM0HIeh01Qjr58EspUxScNZOkY4=; b=J+7m1cFVVhRUOm4WiIdXB76x2NWPy5LET4mOk5V0Ibfdi4GZgsCWjg6FdqTlnpzlbD /y+p+Y5Pe7aJvsJsOsGdQCrhRXhO3GKli/4BcZyvhuw4zre9uyiOmJe5UzFbczgRaajX QI+AnOR/ZOzbdLC42dMIVL2OiccpYNVeiksnPewlsULuydzCowPEA832a5hhzu3DaWhY vxp3jSHiev1eD1vnSOWBjE8SsE/zDv8ySCq7mssqBzKttGL0t6G+IT9nFReF+HFx5RCQ iiGyVuG1ZuXeYkPxrpkX79KdhuUveh4DCQIjOdVBusYZ4l0Z+ihSw7H9c+u3x2GNZwIJ gTiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=e7srDnVnQG0ZUxUgpM0HIeh01Qjr58EspUxScNZOkY4=; b=qq6bT+CKhzcbghaQWzu1fAprpsCsikypfyOg6k2jRlepr0m06shzpAfW6WLDAUbqbx C/q9+nii1fiUOX0fnN860V6eTcOL1Ib/JdDrCrM9Ksg/eGNWUzKHX1yfSftNvb9vFOPb egVl44J53Fq0+7UxgmpUuIrDsKSXa2MuNF2aRlAkKWt8xRn+PvLzmPCt4GQ3e2z/uTLS XwGkG7Qg5rw3udLgJfXgo+JaoLxel8HvZdNvAxt4mwFMKAWqRCalFvQY8NvG4eDlBaao JGKMWZ2FMzSe/+nJtq+6ZZY2R38qRC2fxOZi0dyaJFPdy3TBdlt10r6TAlK0+DR40aPT Kquw== X-Gm-Message-State: ANoB5pmoOyfKpuj3KOZDLnl+UQpXofhFP3W5EQyG2+rSkAzYMmk7owZ2 zNRjd+naKm1WNfWqbRVfpRU= X-Google-Smtp-Source: AA0mqf6jdn2eA11tIRv6YUqGU2w/nKOZT0VBv0sxv8cG8QMns/WtZ4UvLILJRUWyWU9kHdiMqytolg== X-Received: by 2002:a63:d816:0:b0:43a:a67c:4f61 with SMTP id b22-20020a63d816000000b0043aa67c4f61mr3997530pgh.549.1668728182550; Thu, 17 Nov 2022 15:36:22 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id w18-20020a170902e89200b00183e2a96414sm1988874plg.121.2022.11.17.15.36.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 15:36:21 -0800 (PST) Message-ID: <4df9e791-a335-0850-4c1c-44a2460f875c@gmail.com> Date: Thu, 17 Nov 2022 16:36:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 6/7] RISC-V: Support immediates in XVentanaCondOps Content-Language: en-US To: Philipp Tomsich , gcc-patches@gcc.gnu.org Cc: Vineet Gupta , Palmer Dabbelt , Christoph Muellner , Kito Cheng , Jeff Law , Henry Brausen References: <20221112212943.3068249-1-philipp.tomsich@vrull.eu> <20221112212943.3068249-7-philipp.tomsich@vrull.eu> From: Jeff Law In-Reply-To: <20221112212943.3068249-7-philipp.tomsich@vrull.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On 11/12/22 14:29, Philipp Tomsich wrote: > When if-conversion encounters sequences using immediates, the > sequences can't trivially map back onto vt.maskc/vt.maskcn (even if > benefitial) due to vt.maskc and vt.maskcn not having immediate forms. > > This adds a splitter to rewrite opportunities for XVentanaCondOps that > operate on an immediate by first putting the immediate into a register > to enable the non-immediate vt.maskc/vt.maskcn instructions to operate > on the value. > > Consider code, such as > > long func2 (long a, long c) > { > if (c) > a = 2; > else > a = 5; > return a; > } > > which will be converted to > > func2: > seqz a0,a2 > neg a0,a0 > andi a0,a0,3 > addi a0,a0,2 > ret > > Following this change, we generate > > li a0,3 > vt.maskcn a0,a0,a2 > addi a0,a0,2 > ret > > This commit also introduces a simple unit test for if-conversion with > immediate (literal) values as the sources for simple sets in the THEN > and ELSE blocks. The test checks that Ventana's conditional mask > instruction (vt.maskc) is emitted as part of the resultant branchless > instruction sequence. > > gcc/ChangeLog: > > * config/riscv/xventanacondops.md: Support immediates for > vt.maskc/vt.maskcn through a splitter. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/xventanacondops-ifconv-imm.c: New test. OK once we've cleared the non-technical hurdles to committing vendor specific extensions. Jeff