From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from s02.bc.larksuite.com (s02.bc.larksuite.com [209.127.230.20]) by sourceware.org (Postfix) with UTF8SMTPS id CF3253857016 for ; Wed, 24 May 2023 09:41:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF3253857016 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oss.cipunited.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=oss.cipunited.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2303200042; d=oss.cipunited.com; t=1684921284; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=tfHUlndUS9Ke/H/BH7Go1jTTKd2EhtlEyAPsB2QvChI=; b=ELOPTgMenpqFcFvPSrnUZqedugpvObsfmwBOP1XbXj+WpdhW1XeuicJ254KG2UX8nUjGIw WMHvB4W5U2/YTV32UOK62FOTdfZCOWgcgLEOsKotQvyq8I3C55nZZewtT7TYtW3wuM6cFE 8ExJrI/BZ3oNHUgy8Gz5XXI5a+3fFu98c0b9QZSbsdqoA48mZs9cl+jO2BRlun7QgRWhcE llt/S9T3sqaPF/bEGWBqgADqx5GQIx1LDNu7wKEjsHx1Y8swazRoxw+6NobX85CTx7nsuG c7mtGKsRI9L1IGDPnpdStoSCuDoMdFyyqQk+Z0oWnIZVd5ufh542RdeVsq6xUg== Cc: "YunQiang Su" , "Maciej W . Rozycki" Mime-Version: 1.0 X-Lms-Return-Path: Content-Transfer-Encoding: 8bit From: "Jie Mei" Subject: [PATCH v3 9/9] MIPS: Make mips16e2 generating ZEB/ZEH instead of ANDI under certain conditions Message-Id: <7b8c006b3cd91120331c759b213bac49ad7a8286.1684918169.git.jie.mei@oss.cipunited.com> X-Mailer: git-send-email 2.40.1 To: Date: Wed, 24 May 2023 17:41:24 +0800 Content-Type: multipart/alternative; boundary=f0c3d17f27128919e41de0eb54600f6d342e8f14ff46d24613a31646e9e6 In-Reply-To: References: X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_ADSP_NXDOMAIN,DKIM_INVALID,DKIM_SIGNED,GIT_PATCH_0,HTML_MESSAGE,HTML_NONELEMENT_30_40,KAM_DMARC_STATUS,NO_DNS_FOR_FROM,SPF_HELO_NONE,SPF_NONE,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 List-Id: --f0c3d17f27128919e41de0eb54600f6d342e8f14ff46d24613a31646e9e6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 This patch allows mips16e2 acts the same with -O1~3 when generating ZEB/ZEH instead of ANDI under the -O0 option, which shrinks the code size. gcc/ChangeLog: * config/mips/mips.md(*and3_mips16): Generates ZEB/ZEH instructions. --- gcc/config/mips/mips.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 7eb65891820..85ed1735d83 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -3357,9 +3357,9 @@ (set_attr "mode" "")]) =20 (define_insn "*and3_mips16" - [(set (match_operand:GPR 0 "register_operand" "=3Dd,d,d,d,d,d,d,d") - (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "%W,W,W,d,0,d,0,0?") - (match_operand:GPR 2 "and_operand" "Yb,Yh,Yw,Yw,d,Yx,Yz,K")))] + [(set (match_operand:GPR 0 "register_operand" "=3Dd,d,d,d,d,d,d,d,d,d") + (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,W,W,W,d,0,d,0,= 0?") + (match_operand:GPR 2 "and_operand" "Yb,Yh,Yb,Yh,Yw,Yw,d,Yx,Yz,K")))] "TARGET_MIPS16 && and_operands_ok (mode, operands[1], operands[2])" { int len; @@ -3368,38 +3368,42 @@ switch (which_alternative) { case 0: + return "zeb\t%0"; + case 1: + return "zeh\t%0"; + case 2: operands[1] =3D gen_lowpart (QImode, operands[1]); return "lbu\t%0,%1"; - case 1: + case 3: operands[1] =3D gen_lowpart (HImode, operands[1]); return "lhu\t%0,%1"; - case 2: + case 4: operands[1] =3D gen_lowpart (SImode, operands[1]); return "lwu\t%0,%1"; - case 3: + case 5: return "#"; - case 4: + case 6: return "and\t%0,%2"; - case 5: + case 7: len =3D low_bitmask_len (mode, INTVAL (operands[2])); operands[2] =3D GEN_INT (len); return "ext\t%0,%1,0,%2"; - case 6: + case 8: mips_bit_clear_info (mode, INTVAL (operands[2]), &pos, &len); operands[1] =3D GEN_INT (pos); operands[2] =3D GEN_INT (len); return "ins\t%0,$0,%1,%2"; - case 7: + case 9: return "andi\t%0,%x2"; default: gcc_unreachable (); } } - [(set_attr "move_type" "load,load,load,shift_shift,logical,ext_ins,ext_i= ns,andi") + [(set_attr "move_type" "andi,andi,load,load,load,shift_shift,logical,ext= _ins,ext_ins,andi") (set_attr "mode" "") - (set_attr "extended_mips16" "no,no,no,no,no,yes,yes,yes") + (set_attr "extended_mips16" "no,no,no,no,no,no,no,yes,yes,yes") (set (attr "enabled") - (cond [(and (eq_attr "alternative" "7") + (cond [(and (eq_attr "alternative" "9") (not (match_test "ISA_HAS_MIPS16E2"))) (const_string "no") (and (eq_attr "alternative" "0,1") --=20 2.40.1= --f0c3d17f27128919e41de0eb54600f6d342e8f14ff46d24613a31646e9e6--