From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86959 invoked by alias); 27 Feb 2018 15:33:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 86894 invoked by uid 89); 27 Feb 2018 15:33:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*UA:Outlook, H*x:Outlook, H*UA:Microsoft, H*x:Microsoft X-HELO: relmlie2.idc.renesas.com Received: from relmlor3.renesas.com (HELO relmlie2.idc.renesas.com) (210.160.252.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Feb 2018 15:33:34 +0000 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 28 Feb 2018 00:33:31 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 3561687D11; Wed, 28 Feb 2018 00:33:31 +0900 (JST) Received: from unknown (HELO REEBED03978) ([10.226.37.54]) by relmlii1.idc.renesas.com with ESMTP; 28 Feb 2018 00:33:30 +0900 From: "Sebastian Perta" To: "'DJ Delorie'" Cc: References: <000501d3aa44$69a44e30$3cecea90$@renesas.com> (sebastian.perta@renesas.com) In-Reply-To: Subject: RE: [PATCH] RL78 one_cmplhi2 improvement Date: Tue, 27 Feb 2018 15:33:00 -0000 Message-ID: <000101d3afe0$523338a0$f699a9e0$@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-SW-Source: 2018-02/txt/msg01507.txt.bz2 HI DJ, > One thing to try is to use (subreg:QI in a define_expand, so that > there's a one_cmplhi2 pattern that expands to two QImode insns that > operate on HImode input/outputs via SUBREGs. Thank you for the suggestion! After several attempts the following is the only successful one, however the code produced is identical with and without the patch: (define_expand "one_cmplhi2" [(set (subreg:QI (match_operand:HI 0 "nonimmediate_operand") 0) (xor:HI (subreg:QI (match_operand:HI 1 "general_operand") 0) (const_int -1))) (set (subreg:QI (match_dup 0) 1) (xor:HI (subreg:QI (match_dup 1) 1) (const_int -1))) ] "" "DONE;" ) Is this similar to what you had in mind? Output code (same as before the patch ... the patch makes no difference): _test_one_cmplhi: mov a, [sp+4] xor a, #-1 mov r8, a mov a, [sp+5] xor a, #-1 mov r9, a ret I also explored other options including define_split without any success. > If it doesn't work out, consider this patch approved, though. Can I checkin now? Best Regards, Sebastian > -----Original Message----- > From: DJ Delorie [mailto:dj@redhat.com] > Sent: 20 February 2018 19:39 > To: Sebastian Perta > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH] RL78 one_cmplhi2 improvement > > > Const type promotion is the bane of embedded developers... > > One thing to try is to use (subreg:QI in a define_expand, so that > there's a one_cmplhi2 pattern that expands to two QImode insns that > operate on HImode input/outputs via SUBREGs. > > I don't have high hopes of gcc optimizing this properly in all cases, > but it's worth trying. > > If it doesn't work out, consider this patch approved, though. > > Thanks!