From patchwork Tue May 30 09:50:20 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: 100703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2057821vqr; Tue, 30 May 2023 02:51:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7kg6nNom9syIPzWy9hd1qf497y7+26z5SoNu/arPVmxy/urjyJ3+Zytpsmg2Qy3fOG3Fls X-Received: by 2002:a17:907:a4a:b0:96a:63d4:24c5 with SMTP id be10-20020a1709070a4a00b0096a63d424c5mr2220845ejc.77.1685440318597; Tue, 30 May 2023 02:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685440318; cv=none; d=google.com; s=arc-20160816; b=yDU1AWZNFuKeFDGPLR3xOeR/1dT+qNpr8n9LxJpFVaZZ17MVCdg9HK2NgcREknj3xn 85PaBcIULQOE8FuQnm0XsG1JVJvK/RSgmJXlm65HXQ0Ym5TPjBrerBam3EPf+vGBzmf8 AtE70HiaBiF80YZBPHZG3mzqAdA3ZEhifZ+kytJoSLcUnh2ub/VGKCHhfVXuvxJUe7D2 el4nCb6e7Av9m86+yByfHH0mztK8KpuayeQ+jzOIPlBqS9qiTXv95VczpalmC5s5WNzf fPbIdx5N+lXX+l+BtwzG+TcIXkO/nCS1NDgG7lfgmwXH5M7X3init6DyTZzhtB3m/pAM gt8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:references :content-transfer-encoding:subject:cc:to:user-agent:mime-version :date:message-id:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=u7w1QxAZFn7vZZKo0XrgG5ixt7NnGYp0A0UvnlKhWZM=; b=iSC0G8erGON3WuxAP8TZJ1c6slp59Bw+rrRc/TtCQJ1plB7f/giIISEV4md8AQhjT6 nOIdzt2PEr/TtZyJRb+Qp4jon3EwrOm+K1BAzlzLurAPGiQeL2yCMZN+g+aSNGUj/5j8 tamaSfLeBBOvzi1FjbM/6wcICtzBTzJnklDeZ2bIXuMdp3UBQX4XjVz300T52TDv5gaC 6wOqEe6zxQuhUNpxcX7q0WobyN9Qi/M9DWqzvxcmD7RIVOGCMB5qIm+Ew07XvMVx1m7h /wwO4h8L/7O6iw1japPffnQI/vA37FPtscu4ykp95JmelbuEx1H9L7suFCw3FxELIlHO 2LTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=P7GdloQk; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id nb12-20020a1709071c8c00b0096f7955a3a5si6877447ejc.496.2023.05.30.02.51.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 02:51:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=P7GdloQk; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6817D3855884 for ; Tue, 30 May 2023 09:51:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6817D3855884 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685440306; bh=u7w1QxAZFn7vZZKo0XrgG5ixt7NnGYp0A0UvnlKhWZM=; h=Date:To:Cc:Subject:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=P7GdloQkVUuGLObuNgQk7hjQaiYXrpb7R3WopFcYyVAxRhwboAelUfeqBa9uy47nX VwEJSfNExVfTRCLU6k6u/R/tsjFMbqz4PREsnQoatnNfwV+XyoHcxBK8ZOxkxmyRxi pOzqqV5isWhmJa0udZjgx4655i0NwHwrF6gev9hc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omggw7015.mail.djm.ynwl.yahoo.co.jp (omggw7015.mail.djm.yahoo.co.jp [183.79.54.36]) by sourceware.org (Postfix) with ESMTPS id B95DA3857341 for ; Tue, 30 May 2023 09:50:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B95DA3857341 X-YMail-OSG: TeDWU9QVM1nsS_ez05zifvERb7XKeO0FmBEsaS57OBKg1sZYPcrhGZfIhvBZNcm O_cPFKjALqg5jDXQKVnEDlChuWdhAwfV0kZ3JTToes.JLnmh3su0fp1.Oo3zn8LYU9juSn3wwoOU IJGs7NnoTU4ZdiG1vOvXAmfomWt7sArBMWPKciWuf1M9ytyN_Il8bSatUHt0gaYR2uJciOj4ll9O TXXnlVjL4bvrNRW8ZO34ZnyoPv53B7ghLk9kdiRvnYhlzX2kv7o8EM8ovodqFOM26JHYP0ZFj5vO _eOl6xeYRr.IuVAvn7xPqQxSvW2OyEmenuo47CX9gAlc0ibLkq6lgaujfaMl_4OUSZVQfnoS938H bI1kTh9vOcI6WIi7xRlgcxWNoq4Ya9tPC3aBpzsAXbd10cZ94pE5dEZDQrag_2batZloV0I8BaEU cv2hzdk_zcySUflmUi2sbQSoc17gfw1XqHMys2YGK7sV642Zvu7BhXejsQFnfED37qoQSPk2Zwmm tAteonvnZiV0kJcpFyApD5ipCWUD._T59J0BbmWYKk7X6hUooueIGfYpeuO_gjqwBbwLc1mwTm3j 1s8sTKi5KG9po66.wD.YxEwyWv0e7hW_0c.y_L5p1eakn3.aSZ_acQ7Kl1Bku7XYoG2XbQjF3rGy Kkm0OJAQ9xrcQl2PPsjXGidW.63rf3S6BNXr7n2nyyXIJH2qEaQTqCeCbxF8c7ZEweuzSmU3E8zH AkF5iphOYEKYJCYCpZHdHSjLF.X3.5k3b4P2vZwj_wYHgG8bOt_RrHwhdktnzzWpFsNO1OVY5xfx ACImUlX0zkYDXICbAdV0eBoNQtv1BPwxt_lUr.pCzW0jYco8grcfvs6xrmIKtBIWeMFfDvy8g6gd NXPP.7p2Ij0cyhHeoRWQWV04WY_W8sOS86gnnmtTKkzpiZnLm3DWy2K_tTBpBLNtbajum2YeiSnz o.8bsjaHeOoFMe5Y2C7am9_tTrRR2Aotm40WdibbI0fqa1MnGD7KCDw.5tFyXbPppTfM- Received: from sonicgw.mail.yahoo.co.jp by sonicconh5003.mail.kks.yahoo.co.jp with HTTP; Tue, 30 May 2023 09:50:24 +0000 Received: by smtphe5003.mail.kks.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID b4cc1a27d95cfb1afa9b6c50b071683d; Tue, 30 May 2023 18:50:21 +0900 (JST) Message-ID: <95b8b130-caef-12c8-b247-25ec7dbf0ac3@yahoo.co.jp> Date: Tue, 30 May 2023 18:50:20 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 To: GCC Patches Cc: Max Filippov Subject: [PATCH 2/3 v2] xtensa: Add 'adddi3' and 'subdi3' insn patterns References: <95b8b130-caef-12c8-b247-25ec7dbf0ac3.ref@yahoo.co.jp> 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, 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767312267375832047?= X-GMAIL-MSGID: =?utf-8?q?1767312267375832047?= Resubmitting the correct one due to a mistake in merging order of fixes. --- More optimized than the default RTL generation. gcc/ChangeLog: * config/xtensa/xtensa.md (adddi3, subdi3): New RTL generation patterns implemented according to the instruc- tion idioms described in the Xtensa ISA reference manual (p. 600). --- gcc/config/xtensa/xtensa.md | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index eda1353894b..6882baaedfd 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -190,6 +190,32 @@ (set_attr "mode" "SI") (set_attr "length" "3")]) +(define_expand "adddi3" + [(set (match_operand:DI 0 "register_operand") + (plus:DI (match_operand:DI 1 "register_operand") + (match_operand:DI 2 "register_operand")))] + "" +{ + rtx lo_dest, hi_dest, lo_op0, hi_op0, lo_op1, hi_op1; + rtx_code_label *label; + lo_dest = gen_lowpart (SImode, operands[0]); + hi_dest = gen_highpart (SImode, operands[0]); + lo_op0 = gen_lowpart (SImode, operands[1]); + hi_op0 = gen_highpart (SImode, operands[1]); + lo_op1 = gen_lowpart (SImode, operands[2]); + hi_op1 = gen_highpart (SImode, operands[2]); + if (rtx_equal_p (lo_dest, lo_op1)) + FAIL; + emit_clobber (operands[0]); + emit_insn (gen_addsi3 (lo_dest, lo_op0, lo_op1)); + emit_insn (gen_addsi3 (hi_dest, hi_op0, hi_op1)); + emit_cmp_and_jump_insns (lo_dest, lo_op1, GEU, const0_rtx, + SImode, true, label = gen_label_rtx ()); + emit_insn (gen_addsi3 (hi_dest, hi_dest, const1_rtx)); + emit_label (label); + DONE; +}) + (define_insn "addsf3" [(set (match_operand:SF 0 "register_operand" "=f") (plus:SF (match_operand:SF 1 "register_operand" "%f") @@ -237,6 +263,32 @@ (const_int 5) (const_int 6)))]) +(define_expand "subdi3" + [(set (match_operand:DI 0 "register_operand") + (minus:DI (match_operand:DI 1 "register_operand") + (match_operand:DI 2 "register_operand")))] + "" +{ + rtx lo_dest, hi_dest, lo_op0, hi_op0, lo_op1, hi_op1; + rtx_code_label *label; + lo_dest = gen_lowpart (SImode, operands[0]); + hi_dest = gen_highpart (SImode, operands[0]); + lo_op0 = gen_lowpart (SImode, operands[1]); + hi_op0 = gen_highpart (SImode, operands[1]); + lo_op1 = gen_lowpart (SImode, operands[2]); + hi_op1 = gen_highpart (SImode, operands[2]); + if (rtx_equal_p (lo_op0, lo_op1)) + FAIL; + emit_clobber (operands[0]); + emit_insn (gen_subsi3 (lo_dest, lo_op0, lo_op1)); + emit_insn (gen_subsi3 (hi_dest, hi_op0, hi_op1)); + emit_cmp_and_jump_insns (lo_op0, lo_op1, GEU, const0_rtx, + SImode, true, label = gen_label_rtx ()); + emit_insn (gen_addsi3 (hi_dest, hi_dest, constm1_rtx)); + emit_label (label); + DONE; +}) + (define_insn "subsf3" [(set (match_operand:SF 0 "register_operand" "=f") (minus:SF (match_operand:SF 1 "register_operand" "f")