From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 46A513858C52 for ; Thu, 21 Dec 2023 15:07:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46A513858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 46A513858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703171238; cv=none; b=XnCv9gsJQ0TdUZA8SZ+EJmk0YVq7sBe+t1Di9siO9ggI1pgw3uAfkbizWIFwwaZWTfXxBaswry7i4P2NhK6tGYUKIcScaa3/gifZac4nciwchKsmSINfQhNpNmxAO7zNY6bnqtYMNKAMjSJyRtfp4guaXtCXEfNMv/1QjfpdBA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703171238; c=relaxed/simple; bh=knunZttQrb036mEhPO8ljJrCiIrwpGGbbtPjFVgDBpc=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=VjWTc3sigRS6Xb+5RLktnkGoiQ0GyaazeZATBBuzTAV3H1xEdDahmdwB/gKmbuUM2/AaFN4pscPe50cNXUOXGSSJpsh/3YhqB6UCJQ1baVxecJWtVJqwr8AdHrXkU1yGTT0EeV3+k6JC+6X2nCjT5sEqn9r48gZRQAHAvQhnNdM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 5E34B340DE6; Thu, 21 Dec 2023 15:07:16 +0000 (UTC) Date: Thu, 21 Dec 2023 10:07:14 -0500 From: Mike Frysinger To: jaydeep.patil@imgtec.com Cc: gdb-patches@sourceware.org, aburgess@redhat.com, joseph.faulls@imgtec.com, bhushan.attarde@imgtec.com Subject: Re: [PATCH v4 2/2] [sim/riscv] Add support for compressed integer instructions Message-ID: References: <20231221111139.26341-1-jaydeep.patil@imgtec.com> <20231221111337.26415-1-jaydeep.patil@imgtec.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aXnr9Rivqj4Kel5F" Content-Disposition: inline In-Reply-To: <20231221111337.26415-1-jaydeep.patil@imgtec.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --aXnr9Rivqj4Kel5F Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 21 Dec 2023 11:13, jaydeep.patil@imgtec.com wrote: > --- a/sim/riscv/sim-main.c > +++ b/sim/riscv/sim-main.c > > + case INSN_CLASS_C: > + /* Check whether model with C extension is selected. */ > + if ((riscv_cpu->csr.misa & 4) !=3D 4) can simplify to: if (riscv_cpu->csr.misa & 4)=20 > --- a/sim/testsuite/riscv/allinsn.exp > +++ b/sim/testsuite/riscv/allinsn.exp > @@ -5,10 +5,29 @@ sim_init > # all machines > set all_machs "riscv" > =20 > +# Detect model based on -dumpmachine option of the compiler > +set result [target_compile $srcdir/lib/compilercheck.c \ > + $objdir/compilercheck.x "preprocess" \ > + "additional_flags=3D-dumpmachine"] > +if { [string match "riscv32-*" $result] } { > + set model "RV32IC" > +} { > + set model "RV64IC" > +} > + > foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.s]] { > # If we're only testing specific files and this isn't one of them, s= kip it. > if ![runtest_file_p $runtests $src] { > continue > } > + > + # The c-ext.s needs a model with C extension > + global SIMFLAGS_FOR_TARGET > + set SIMFLAGS_FOR_TARGET "" > + set fname [file tail $src] > + if {$fname =3D=3D "c-ext.s"} { > + set SIMFLAGS_FOR_TARGET "--model $model" > + } tests normally declare their requirements, and the exp file processes those rather than the exp file hardcoding things directly. try doing: * change allinsn.exp to do: set all_machs "riscv32 riscv64" * change "mach: riscv" in all testsuite/riscv/*.s files to "mach: all" * add to c-ext.s: # sim(riscv32): --model RV32IC # sim(riscv64): --model RV64IC then i think you can omit the rest of this logic in riscv/allinsn.exp. this will set us up better for being able to support & test RV32 & RV64 in the same binary. > --- /dev/null > +++ b/sim/testsuite/riscv/c-ext.s > @@ -0,0 +1,110 @@ > +# Basic load store tests. > +# mach: riscv > + > +.include "testutils.inc" > + > + .data > + .align 4 > +_data: > + .word 1234 > + .word 0 > + > + start > + la a0, _data > + > + # Test load-store instructions. > + .option push > + .option arch, +c instead of pushing gas arguments, use # directives at the top of the file: # as: -mike --aXnr9Rivqj4Kel5F Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmWEVKIACgkQQWM7n+g3 9YGJQA/7Bf6S8dDvn61ra3wCduMYqB5TP9s+0w16vcF2RFpfYIwb+YtCFuTOSsFz YEt76FbnrSCNrb9Htgg+M4sXNlW7wHQb+lpPNg1f1/Y5p5a0wVOF/ugRCVMHJ0qn 0t9XoIG/nD9BaH60tz2zlbsAQ3YvFWbdcfE9Ds+Guobm5qZQ/IUOGWSc6CLZbL1W 2ilhHyn1ZycrWk+mXTjUj1K5oGho7Ta6fwfy39VBKfm6nrM0qCE0Ab946SyrH+dz HmIj87wYgd3cGOljRvQ2dPwiyKxDn06C9P0xnLOznnTtDJTBVQZSzTrg7N19iP9r 6T3Xna/g8EAOOEb86/I0VzacpLvRBrRo29+JSe5OFNHUPFgXk9+1R0H2vpAa2pLl 4+0VL1mrc1mb91biSxxVM1zE/RpSxR0Z94TdRlNQOYBgupyeZT8YCnfl7W2uVYpw c/45jllbWYyfhqcZRFlDXldlQ5mv/APE9CLQervpWZI+soSzBCJ3jZoIGaNfX4A6 J+We6+FCsqsJ1CsIYvJxVRLMERnsvzOLVBHsvMUTdbTGX54bXhRIvieW4bTVDZSg hl1asotzoWLphWCBS61otZUhWct/0HKZTTAVv+JFBIjPjk0Wb9qKKLtta3JpEWAf vX0WJtKHIms/n4bHAKD+3jftK87W7nRzk6f9BAWAnSqIP12UjuA= =Lxij -----END PGP SIGNATURE----- --aXnr9Rivqj4Kel5F--