From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id D4684383DB93 for ; Thu, 6 Oct 2022 15:58:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D4684383DB93 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-pl1-x636.google.com with SMTP id b2so2090426plc.7 for ; Thu, 06 Oct 2022 08:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=oKY2PUZZkoBRHi1EU5VKJkLQe4fRjSy/be+dcazquPs=; b=t8YqP2nBWFF+pcTgXm1r+MjhpdfV9uD2+t37D/febAmguhJIzj4Chx35UABDEjZwZn WxnE+/Ont0HjLB05ivnnHEOxnQHAMm13z87HOsdB94cSZ/Y4Z/UpLw+via01hUW9qQlr ghOhsVEvcLwMsM5hif3nhawNrrmRCFBCL96pn43gjl1XVall90nrJrqJe6MHcwYHpZ7Z 6PogHr43fXejD6liABnuyacS662cyZgS1+g61pBN4+oZ/tWyxQExPa7bP8Cif+Q3j/0p UYjmls2dIbhwcTQcoO2Yvg8qcbiXQfEQwaZuLz9LZY35TLLe8K7sZ8EH2jkL1vHgM5vw dnXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oKY2PUZZkoBRHi1EU5VKJkLQe4fRjSy/be+dcazquPs=; b=MUfl0RVIYkzbUVrnrbp6GOZxNZIaIWKMSXALDoKmsyfvekbA6eoKQd2PxPoHfZ3DEo fPKFkUZlFIjLHU1dVtCmc7WeLwXHJpHaEPpt2qgW5FjKf+RmvcQgxbIlyQqBoJBH2fzq 21XcIxeJ88+ALIbErcICvcqB0efMNabZBXRTL8Wa+UNgW8Nw/Lt/uSFT2D78jClc7jW6 ar33j5rIMvgrgz/aQECbM09/CX0siv9CN8RCQueZZFm98zkQl+voATjUELIrnrwN/NJG PcaLDWfgn4yn4V7EV+sPp29fMCi1Vb0kJHlt6Koihv6ilf4Jc08COwBTwj88PSeeGCSW GKrw== X-Gm-Message-State: ACrzQf1kGnhs3xttb4NyOvJ507hk+0DFu7ZCaKGM51cEZSKyvzc4tzsK mrS7ubRgjV9yHk+f7nj6VEtJqhO8C3vj4a/K X-Google-Smtp-Source: AMsMyM52XvlPRb2wPVLGDPSVJe8E3D3xGXrw9osbZQFnvLjoPec8aWidtKHtWwUuB7ECIH5KntQPWQ== X-Received: by 2002:a17:90b:3811:b0:202:9e26:bc00 with SMTP id mq17-20020a17090b381100b002029e26bc00mr350561pjb.223.1665071881617; Thu, 06 Oct 2022 08:58:01 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id x25-20020aa79419000000b00561c179e17dsm5335671pfo.76.2022.10.06.08.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:58:00 -0700 (PDT) Date: Thu, 06 Oct 2022 08:58:00 -0700 (PDT) X-Google-Original-Date: Thu, 06 Oct 2022 08:57:59 PDT (-0700) Subject: Re: [PING^3 PATCH 1/1] sim/riscv: PR29595, Fix multiply instructions In-Reply-To: CC: research_trasio@irq.a4lg.com, gdb-patches@sourceware.org From: Palmer Dabbelt To: research_trasio@irq.a4lg.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2022 15:58:05 -0000 On Thu, 06 Oct 2022 03:33:00 PDT (-0700), research_trasio@irq.a4lg.com wrote: > Because of recent 'Zmmul' support, the simulator is now broken. This is > caused by instruction classification changes: > > [Before] > - INSN_CLASS_M : multiply / divide > [After Zmmul] > - INSN_CLASS_M : divide > - INSN_CLASS_ZMMUL : multiply > > The simulator checks the instruction class to execute an instruction: > > - INSN_CLASS_I : 'I' > - INSN_CLASS_M : 'M' (multiply / divide) > - INSN_CLASS_A : 'A' > > 'Zmmul' moved multiply instructions to INSN_CLASS_ZMMUL and that instruction > class is not handled by the simulator. > > This commit handles INSN_CLASS_ZMMUL for all 'M' instructions and adds a > testcase to test all RV32M instructions run without any faults. > --- > sim/riscv/sim-main.c | 1 + > sim/testsuite/riscv/m-ext.s | 18 ++++++++++++++++++ > 2 files changed, 19 insertions(+) > create mode 100644 sim/testsuite/riscv/m-ext.s > > diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c > index 30d2f1e1c9a..0156f791d4b 100644 > --- a/sim/riscv/sim-main.c > +++ b/sim/riscv/sim-main.c > @@ -936,6 +936,7 @@ execute_one (SIM_CPU *cpu, unsigned_word iw, const struct riscv_opcode *op) > case INSN_CLASS_I: > return execute_i (cpu, iw, op); > case INSN_CLASS_M: > + case INSN_CLASS_ZMMUL: > return execute_m (cpu, iw, op); > default: > TRACE_INSN (cpu, "UNHANDLED EXTENSION: %d", op->insn_class); > diff --git a/sim/testsuite/riscv/m-ext.s b/sim/testsuite/riscv/m-ext.s > new file mode 100644 > index 00000000000..b85397a32a0 > --- /dev/null > +++ b/sim/testsuite/riscv/m-ext.s > @@ -0,0 +1,18 @@ > +# check that the RV32M instructions run without any fault. > +# mach: riscv > + > +.include "testutils.inc" > + > + start > + > + .option arch, +m > + mul x0, x1, x2 > + mulh x0, x1, x2 > + mulhu x0, x1, x2 > + mulhsu x0, x1, x2 > + div x0, x1, x2 > + divu x0, x1, x2 > + rem x0, x1, x2 > + remu x0, x1, x2 > + > + pass Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt though as we're talking about in this meeting, I'm not actually a gdbsim maintainer so I'm not sure I can formally approve it.