From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id 2D4C23858D35 for ; Sun, 11 Feb 2024 18:38:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D4C23858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2D4C23858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707676734; cv=none; b=vYm45aHbTcOhhbk3w+dOd7Uq9NbKq5XeLALlRGnGGGjHR0uBNBJnu8UZmjAQ4EXamlRP/S4ve7y9FQdRRXGWURljD7H12CTUHWhTr31wz9wImsyLwdlwaa4g4EkY1zSTJIjh2rHcm3cRdEV2kD5Ysek1F4TvAP9S1cNVSR/Frvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707676734; c=relaxed/simple; bh=V7JaPUOoa+FsAFr5Us+p48vQ2mBjQgvqFaYEg2rjJr4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=ri8HCVmEAoufFUCusw7ChTk79UF4j82dtRBHWoM0KbGjHiWF1zOBnsTIRHEMFjrlnNVplqNupaJcnv0ReaJY63urwbShevKeiPot/INjU95iBWOW+p/Oz5cpyFjAfAJJpLv4lEbjVn490ZQus+U1FYYjh3NyJbmHMgnWjdEIXTM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2d0512f6e32so35741651fa.1 for ; Sun, 11 Feb 2024 10:38:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707676730; x=1708281530; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ezvpt/fiU41zQlHHItNVGFQM8rvVZPOg20fSnVgRHi8=; b=YX0qVAMgEFvSrkiX/5TXyaHmCBdJcLfqIpFrqnc8bTgQYnyctlLEmiAZmCan4FsVRI BPT69E0GQBQUp0rVMgtDuIFGzBUCbcbG8K9wFwPAXck0resF9bR1hDaZFkdhOXzh+Wnv yw+CbmpXFShm/EqsjcM3WE0H8yMeccBgHueQik3kzs6ZT0i4xuS930ry6YBWysTKRDuK LqIWyhQqemj5TBkMVLxyXP8YQCd3FFZh2oZg9GGYWeBN2x7iWiflGIKAhmizj/n60J4+ BXA1m384IG/+lOnSLEcmd/z9BDQyIRdjHqvXmPHoBtQvrfUrSs1PTkj6ij7ZzDBUZKi8 NORA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707676730; x=1708281530; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ezvpt/fiU41zQlHHItNVGFQM8rvVZPOg20fSnVgRHi8=; b=CdSA8I9RWnFLYvN5t1B3pTWePLAYjn6iKZyoa6wxpgSPu9405C2d+ZmTSXYiOahs/i 0miy7g3mr+IXq/9VueBHHPz2fmqqvY/S8QOzXWrZjgxgyV9pynLazmumjjqsAx2FjBT8 WKZJ/6AILFVASVnzlMtUwX1EYn3AfTxWwxFmpeE+Ukqu3CGzDKfUjhSPGnxbTpz1wo5q gK54p4fV+Y8Xu0gg/CKknqWTo3/hRxKPfs94AvEFi281vzuE8urpqfRWpbmKm7O3jiBD /eqnZVXi+uD0/+MkWSekL4IMF9yDbQt8wdaaXgSuoESzfy3K3kJnPQpokl3B+KClrj2p Qpeg== X-Gm-Message-State: AOJu0YxbKeTdXnCBauGvjlT90ZDWCo7ayylIsTBeC0rYCi6K7N3mnGiH lxRLoCE0NwSSykjTcGyRGnQwafXnHmsDYc2xFQUIu7nn9gMVrFKESQdsbLpnqsUVNzGiVnAYFAa 9WPA8FazQsVuWlCotXBM2FQSR61E= X-Google-Smtp-Source: AGHT+IF1U3oOKr92dvq7vCqSlSJmATeBNlWh/xV2B+yWq7rsDE4GubNBcGsjntzQrGBXL4p+ZQ974mV3MrmWYuu20GQ= X-Received: by 2002:a05:651c:1a0a:b0:2d0:e9a0:82b8 with SMTP id by10-20020a05651c1a0a00b002d0e9a082b8mr2945778ljb.9.1707676730268; Sun, 11 Feb 2024 10:38:50 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Claudiu Zissulescu Ianculescu Date: Sun, 11 Feb 2024 20:38:38 +0200 Message-ID: Subject: Re: [PATCH] arc: Put DBNZ instruction to a separate class To: Yuriy Kolerov Cc: "binutils@sourceware.org" , Claudiu Zissulescu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 List-Id: Hi Yuriy, Looks good to me. Thank you for your contribution, Claudiu On Fri, Feb 9, 2024 at 4:27=E2=80=AFPM Yuriy Kolerov wrote: > > DBNZ instruction decrements its source register operand, and if > the result is non-zero it branches to the location defined by a signed > half-word displacement operand. > > DBNZ instruction is in BRANCH class as other branch instrucitons > like B, Bcc, etc. However, DBNZ is the only branch instruction > that stores a branch offset in the second operand. Thus it must > be placed in a distinct class and treated differently. > > For example, current logic of arc_insn_get_branch_target in GDB > assumes that a branch offset is always stored in the first operand > for BRANCH class and it's wrong for DBNZ. > > Signed-off-by: Yuriy Kolerov > --- > gas/config/tc-arc.c | 1 + > include/opcode/arc.h | 1 + > opcodes/arc-dis.c | 1 + > opcodes/arc-tbl.h | 2 +- > 4 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c > index bf2f5e0fd4c..a76d3a7eee8 100644 > --- a/gas/config/tc-arc.c > +++ b/gas/config/tc-arc.c > @@ -114,6 +114,7 @@ enum arc_rlx_types > || (op)->insn_class =3D=3D BBIT0 = \ > || (op)->insn_class =3D=3D BBIT1 = \ > || (op)->insn_class =3D=3D BI = \ > + || (op)->insn_class =3D=3D DBNZ = \ > || (op)->insn_class =3D=3D EI = \ > || (op)->insn_class =3D=3D ENTER = \ > || (op)->insn_class =3D=3D JLI = \ > diff --git a/include/opcode/arc.h b/include/opcode/arc.h > index fe3278ab706..67362431800 100644 > --- a/include/opcode/arc.h > +++ b/include/opcode/arc.h > @@ -52,6 +52,7 @@ typedef enum > BRANCH, > BRCC, > CONTROL, > + DBNZ, > DIVREM, > DMA, > DPI, > diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c > index dbcd0dbd7f8..68b1c2043cc 100644 > --- a/opcodes/arc-dis.c > +++ b/opcodes/arc-dis.c > @@ -979,6 +979,7 @@ arc_opcode_to_insn_type (const struct arc_opcode *opc= ode) > case BI: > case BIH: > case BRCC: > + case DBNZ: > case EI: > case JLI: > case JUMP: > diff --git a/opcodes/arc-tbl.h b/opcodes/arc-tbl.h > index b90413de7ef..40184ab76be 100644 > --- a/opcodes/arc-tbl.h > +++ b/opcodes/arc-tbl.h > @@ -3656,7 +3656,7 @@ > { "daddh22", 0x36F77F80, 0xFFFF7FE0, ARC_OPCODE_ARCv2EM, FLOAT, DPA, { Z= A, LIMM, LIMMdup }, { C_F, C_CC }}, > > /* dbnz<.d> b,s13 00100bbb1000110N0BBBssssssSSSSSS. */ > -{ "dbnz", 0x208C0000, 0xF8FE8000, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2H= S, BRANCH, NONE, { RB, SIMM13_A16_20}, { C_DNZ_D }}, > +{ "dbnz", 0x208C0000, 0xF8FE8000, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2H= S, DBNZ, NONE, { RB, SIMM13_A16_20}, { C_DNZ_D }}, > > /* dexcl1<.f> a,b,c 00110bbb00011000FBBBCCCCCCAAAAAA. */ > { "dexcl1", 0x30180000, 0xF8FF0000, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2= EM, FLOAT, DPX, { RA, RB, RC }, { C_F }}, > -- > 2.34.1 >