From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 53253385828F for ; Mon, 18 Dec 2023 12:54:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 53253385828F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 53253385828F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702904075; cv=none; b=s8CARCMQJbRdP1wsjIl0N/ZT2Vd8lxJRtwv5pyIfQawBGrwJMM10HTQZLBZKOeDr4zyeyqu9TpKawfBxVGYGh8ROfz9GUSX6TztcDOLaa5SopYzDj0ZDVn1yl52Z/7U84cVRbfLhchxXmRehmfcCoavR4UkpPUD1364keOBaf0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702904075; c=relaxed/simple; bh=5IJeAdhAXLLOuCgKrvQbf5wmHUoAISE8pV8yQCHGetw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oFt9/gDrmJcpctA/gsZvKw2s6yB3VpxtBs3eUxJyz61tIh2a9NCnA5WYyAcEJaosp0iQJh9NNLEybX+4ODLCMOtql9kGCJBq+9ZVt9R/PiFP3uiX0dPQmNc2ryDjO+L2tLKnzh1qSZLxY+fcDDh4+0nPTiigP88ka4NoVepvZ3U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702904071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=22YxNBjlX3BA0CftCQW00nzN71MrljjWvg5SrbfklR8=; b=WsnKHKPiW0/QARWFpNiJswHE1sd6Nd+R0mRVpZqcOoUVNGBFUS0zjA+L46lzHEuvPl3LK9 fbnJzgcFPbVR2RAXLjESHx+MrIATPdVSrjrkXOd+xgnJNecXnaULX9Yeu5iMRu/dcGQwcp 1fkMZSd5JuxA7vPFB8yZn8Y8JkkuUFw= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-151-JZO2Ko9aMae-ZkGbvmR_OA-1; Mon, 18 Dec 2023 07:54:30 -0500 X-MC-Unique: JZO2Ko9aMae-ZkGbvmR_OA-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-336599bf718so2018345f8f.0 for ; Mon, 18 Dec 2023 04:54:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702904069; x=1703508869; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=22YxNBjlX3BA0CftCQW00nzN71MrljjWvg5SrbfklR8=; b=mrUAa5/8Cv/r9TOaqpx7GpGRXQIu+PWRzNETVjmnrropfdyzHwPOOpvksdmDvA0tw7 8y9slBkZ/NIIdfU3+ScPXqC1/9iV2qgmkDsVbcA3SAlKwSY3gaHHRiuHrMfDzE4cHlqb Mz/cgAOohVaw3Y4e/8fZTDhShX8ZyIiR9pB3Ot7S7WkKJgtcgDai+66zROouN1kjFHxD e65eodFdG9rT5q3iDtfnWaW+kZQwXzvWI8WUadcKHBL4kyNMwsKfmoSnMYgXTUsQt8Mu Sp/TXIx4CucuN9q98QTLYx7bolWbajnJjWKKy3FxdkZ8Ol30xDiaReaeFg7EpC/umtMz +ZZg== X-Gm-Message-State: AOJu0Yyje05ZSfWjS1WfQ4MXtlklPsCeIpCrRD3pUIqPTYMAzTN+n6d4 MXHZD3b594VhRh6F+qW0/x8ZxmFmjuxhNsJZDxwEjh78Qf461CaayxB775ju4LpK/qkO7cHX+VV FJTpdpcuDfvkxjEQ58jQTWA== X-Received: by 2002:a05:600c:3556:b0:405:3e9a:f1e3 with SMTP id i22-20020a05600c355600b004053e9af1e3mr9437865wmq.11.1702904069417; Mon, 18 Dec 2023 04:54:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJavvl5m6YuUJ5eXlz2RLFUKAdZ4RLmk1ms1hg2xtuwWkkeI3TTY/v0yM4zLfQXzwzmnoBdw== X-Received: by 2002:a05:600c:3556:b0:405:3e9a:f1e3 with SMTP id i22-20020a05600c355600b004053e9af1e3mr9437862wmq.11.1702904069143; Mon, 18 Dec 2023 04:54:29 -0800 (PST) Received: from localhost (105.226.159.143.dyn.plus.net. [143.159.226.105]) by smtp.gmail.com with ESMTPSA id l12-20020a05600c4f0c00b0040b4b2a15ebsm41806329wmq.28.2023.12.18.04.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 04:54:28 -0800 (PST) From: Andrew Burgess To: Jeff Law , apinski--- via Gdb-patches Subject: Re: Fwd: Yet another fix for mcore-sim In-Reply-To: <6de3406e-b76a-4599-b946-10e431a2dd75@gmail.com> References: <6de3406e-b76a-4599-b946-10e431a2dd75@gmail.com> Date: Mon, 18 Dec 2023 12:54:28 +0000 Message-ID: <87plz34qnv.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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: Jeff Law writes: > Someday I'll type "sourceware.org" correctly on a consistent basis. > > > > -------- Forwarded Message -------- > Subject: Yet another fix for mcore-sim > Date: Sat, 16 Dec 2023 21:52:12 -0700 > From: Jeff Law > To: gdb-patches@sourcware.org > > > This came up testing the CRC optimization work from Mariam@RAU. > Basically to optimize some CRC loops into table lookups or carryless > multiplies, we may need to do a bit reflection, which on the mcore > processor is done using a rotate instruction. > > Unfortunately the simulator implementation of rotates has the exact same > problem as we saw with right shifts. The input value may have been sign > extended from 32 to 64 bits. When we rotate the extended value, we get > those sign extension bits and thus the wrong result. > > The fix is the same. Rather than using a "long", use a uint32_t for the > type of the temporary. This fixes a handful of tests in the GCC testsuite: > >> mcore-sim: gcc.c-torture/execute/20100805-1.c -O0 execution test >> mcore-sim: gcc.c-torture/execute/20100805-1.c -O1 execution test >> mcore-sim: gcc.c-torture/execute/20100805-1.c -O2 execution test >> mcore-sim: gcc.c-torture/execute/20100805-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test >> mcore-sim: gcc.c-torture/execute/20100805-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test >> mcore-sim: gcc.c-torture/execute/20100805-1.c -O3 -g execution test >> mcore-sim: gcc.c-torture/execute/20100805-1.c -Os execution test >> mcore-sim: gcc.c-torture/execute/20180112-1.c -O0 execution test >> mcore-sim: gcc.c-torture/execute/20180112-1.c -O1 execution test >> mcore-sim: gcc.c-torture/execute/20180112-1.c -O2 execution test >> mcore-sim: gcc.c-torture/execute/20180112-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test >> mcore-sim: gcc.c-torture/execute/20180112-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test >> mcore-sim: gcc.c-torture/execute/20180112-1.c -O3 -g execution test >> mcore-sim: gcc.c-torture/execute/20180112-1.c -Os execution test >> mcore-sim: gcc.dg/20050922-1.c execution test >> mcore-sim: gcc.dg/crc-25.c execution test >> mcore-sim: gcc.dg/crc-26.c execution test >> mcore-sim: gcc.dg/crc-8.c execution test >> mcore-sim: gcc.dg/pr57233.c execution test > > > The crc-* tests are Mariam's CRC optimizer tests. The rest are > regression tests already in the GCC testsuite. > > OK for the trunk? It would be nice if there were some tests added to the simulator tree. Could you create one similar to sim/testsuite/mcore/lsr.s maybe? (Pre-)Approved with a test: Approved-By: Andrew Burgess Thanks, Andrew > > Jeff > diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c > index 8bfb745a11f..94e0a1675be 100644 > --- a/sim/mcore/interp.c > +++ b/sim/mcore/interp.c > @@ -1015,7 +1015,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu) > case 0x38: case 0x39: /* xsr, rotli */ > { > unsigned imm = IMM5; > - unsigned long tmp = gr[RD]; > + uint32_t tmp = gr[RD]; > if (imm == 0) > { > int32_t cbit;