From patchwork Thu Oct 31 04:21:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839862 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83612wrb; Wed, 30 Oct 2024 21:22:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXx8+5oZgbPzMvRyZVVujKUjghZ3cGQW3mIR21+HMO6U88m0AbyTR+OQPRU/69pQbdMP3FLHw==@linaro.org X-Google-Smtp-Source: AGHT+IHKCAi8b1Uk75hDrCS6iKMmAycjzu5YcBMVajgj0E0l+BUTCV9JYl2e9PVi1KzDZ9GrBsOs X-Received: by 2002:a05:622a:15d4:b0:460:f34c:12b6 with SMTP id d75a77b69052e-4613c11c0a3mr276317761cf.44.1730348574777; Wed, 30 Oct 2024 21:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348574; cv=none; d=google.com; s=arc-20240605; b=Ua14OGNJMGdEAIAAGboxXl/JTyzbF6lLXXOhMk1hD1jchCzVtmYnEp4puLK1b/v1zf tsVpWObtSGj6BUS+Mcv97XM1fXUiEPYxG85kFBPo15z1Pgufbf9rzepX4p5p37cMnrfH jPLw+9LEeSP+vFrPDvW5jDk7RHceOf5kDXosgLiWxPy98cUSAGU+1n7z87b1CYeSCxi0 0a+gyLpf76+AMJDsORiy8EShUiPHxGLX+0JFISfo5R0NRL+SGzEX0Rz3ZwzebR0/7Xsj pH2Aq1J98YLN1hQEO18DcuNYPVbhFMrqo7m5tu98W2CMzacQtwGsJN1dEl1R4S52FNVO PGeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rNeqiCOGTFAEwkUEnfoTPzEYRHaxcy1ybzEL1jmSNcs=; fh=3rxw23y0bO8wm62IIqsnszR7bawVCJwMYfVfgrzfCHw=; b=Af7103LpSDgH3bI2+VFP7FfshpfDX0S8NsIz+s1IysxZD4rYqIOBQ8IvO1P/NgfRt/ uDONXqweCoGOq/TEja4dZPu+QFlgDLKhRTqhXYo6HNk1ibP8iNKeAez+wErCn4ypNVgn VDGReOiy+s5E3r7/TTzLT9OE9f0BHca2ITi+aXQJpDP0iv4iX9RbnPPr/Uizhuw2Z/CL J6FMl5Tdsm84PT2aIe+5RsHxIokLcPTUaKmRyUEkxJnA5E+/17s3uXngOPkZBd3v8KNt Ikhxt3xyL6JLMPYOP1jS/Om2jo0Wf2p8lMOj63rz4wNGOcK6TbQEiTmUjjSv5g1IcXgv skZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hd+KRJBx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad1f0b09si8424141cf.423.2024.10.30.21.22.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hd+KRJBx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6MhB-0006Xr-1s; Thu, 31 Oct 2024 00:22:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mh9-0006XS-DF for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:03 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mh6-0006pu-Kh for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:03 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-539f53973fdso463422e87.1 for ; Wed, 30 Oct 2024 21:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348518; x=1730953318; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rNeqiCOGTFAEwkUEnfoTPzEYRHaxcy1ybzEL1jmSNcs=; b=hd+KRJBx1haaDZjQr9vZvEvAdiBeMvJDX0LlFejf6IyFcgKqc+8I0EDVboipSBY/7S EbHlR+bCCNGLjq147MC1sJIo2gXw/XBXnfil5A5ijTtWh2oginrfdRYCWlCLV4Wu0lc7 Fkhrk+LnAaO0Qzj/1GLjDPOTB5XZx14LJYxSY4Ey716pggfHsRJfmbydMTuEeY2qqbkr 3NXuG/Oz+mOCuNtOq5VnNdQ1tiX8eOAbhWBIlp8dbGi9iQ0KTkidc/IXbK3MV306IYhW x/xW4GsW6vwjfz7eP1VHn8pZBZJVxHMoImQvvGHJIlCRLrfQSLspwS6ch6qRWakc6zPc x4qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348518; x=1730953318; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rNeqiCOGTFAEwkUEnfoTPzEYRHaxcy1ybzEL1jmSNcs=; b=UD0leziesAGwyvWwnOxyS5jrx8dZJaPywQQBPkkc0ncdEtELppQ71ecLWjfyup63Vw hkRL9juuvlrWmDCmoVcZepQY8b8Ki9XwbWigX/7Ub/nS1uptgIa84wG90y23Ggjy5V8z cXFH11tDd1OmzhtP5s84H9DL/X6piOI16ZFD+KxACbrJ2NdFMRVxVNkomQ/eUj8OpDFl +5bXm3ohbmhf8MVGGrKodv3/NtQyOk1Gi75jPSFPDvHKGoM9qsIvkUrQDCxPUPyyl/1j LaFiv4Usmyi+ozmfRspcwpSQZe6UsWfMF6v3f16oxFbZum7XCDeir3iljAVxbEt7AdTa YfNw== X-Gm-Message-State: AOJu0Yz3yJckpVhhKORhRlMERU2NB1QtNbmqxolinNcXGB8fZbVN1lkC T7mHYZmteLsiJg90zq+9g65v+xQnzciCQNnHRNPeFO+AG1IIGkEynV2oKCnLe+d8RdUqOheeUHf 8 X-Received: by 2002:a19:5f04:0:b0:533:415e:cd9a with SMTP id 2adb3069b0e04-53c7bc0c91dmr219786e87.23.1730348518203; Wed, 30 Oct 2024 21:21:58 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bc958b5sm79608e87.41.2024.10.30.21.21.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:21:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yongbok Kim , Aleksandar Markovic , Aleksandar Rakic , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 01/14] target/mips: Migrate TLB MemoryMapID register Date: Thu, 31 Oct 2024 01:21:17 -0300 Message-ID: <20241031042130.98450-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Yongbok Kim Include CP0 MemoryMapID register in migration state. Fixes: 99029be1c28 ("target/mips: Add implementation of GINVT instruction") Signed-off-by: Yongbok Kim Signed-off-by: Aleksandar Markovic Signed-off-by: Aleksandar Rakic Reviewed-by: Aleksandar Rikalo Message-ID: Signed-off-by: Philippe Mathieu-Daudé --- target/mips/sysemu/machine.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/mips/sysemu/machine.c b/target/mips/sysemu/machine.c index 213fd637fcb..91cd9f19002 100644 --- a/target/mips/sysemu/machine.c +++ b/target/mips/sysemu/machine.c @@ -142,6 +142,7 @@ static int get_tlb(QEMUFile *f, void *pv, size_t size, qemu_get_betls(f, &v->VPN); qemu_get_be32s(f, &v->PageMask); qemu_get_be16s(f, &v->ASID); + qemu_get_be32s(f, &v->MMID); qemu_get_be16s(f, &flags); v->G = (flags >> 10) & 1; v->C0 = (flags >> 7) & 3; @@ -167,6 +168,7 @@ static int put_tlb(QEMUFile *f, void *pv, size_t size, r4k_tlb_t *v = pv; uint16_t asid = v->ASID; + uint32_t mmid = v->MMID; uint16_t flags = ((v->EHINV << 15) | (v->RI1 << 14) | (v->RI0 << 13) | @@ -183,6 +185,7 @@ static int put_tlb(QEMUFile *f, void *pv, size_t size, qemu_put_betls(f, &v->VPN); qemu_put_be32s(f, &v->PageMask); qemu_put_be16s(f, &asid); + qemu_put_be32s(f, &mmid); qemu_put_be16s(f, &flags); qemu_put_be64s(f, &v->PFN[0]); qemu_put_be64s(f, &v->PFN[1]); @@ -204,8 +207,8 @@ static const VMStateInfo vmstate_info_tlb = { static const VMStateDescription vmstate_tlb = { .name = "cpu/tlb", - .version_id = 2, - .minimum_version_id = 2, + .version_id = 3, + .minimum_version_id = 3, .fields = (const VMStateField[]) { VMSTATE_UINT32(nb_tlb, CPUMIPSTLBContext), VMSTATE_UINT32(tlb_in_use, CPUMIPSTLBContext), From patchwork Thu Oct 31 04:21:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839861 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83582wrb; Wed, 30 Oct 2024 21:22:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWTezVGhf70YOvi//cSw8ik/KAvxlKSdHq1RzWxE4OV7Ifo6PfBqGKa1bLN64VfAvqSDaJP6w==@linaro.org X-Google-Smtp-Source: AGHT+IHdAUth3oognf9Lki+lFKQPSbfAedOjSGwb2uw6zpYVv06/+9sDc76IsyR6GMGy9L9nN93X X-Received: by 2002:a05:6214:4885:b0:6d0:19f8:c39d with SMTP id 6a1803df08f44-6d185711c16mr287184756d6.31.1730348562214; Wed, 30 Oct 2024 21:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348562; cv=none; d=google.com; s=arc-20240605; b=YgrBGDBmKrFuD97Kw+2PXOx3EdsdZ++P+6PCPebQS3nSSuNXmBjFGrB7MqrPoJpKnS iSWuiebwuiTtDIHXCZsu5/PCamD4HrN22C/oATT0fHhSY/wcDmBV+V0NbMVE6tiLAtHG gDT8ZXYMelr3Yw8mfmcMRUrbwBSUD69UMON6Iyirjygq8syP+UnZKEw0rfguw15qroAl 7ZCg5dfvdjv+DGk+juc6Xm7DndJXA1KOFMGlg9QojlNQJUacSrgBYbEEITpe6qzdc049 qlmmjNKcC/5OF8/dQIoji2YCEH/60hOn4v7gueFuPa6j8sGPKShikoehfeKV05yr9dL4 yFcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wD31lxn0+ab/GE8FyDVCBUwUXNUGOzaYUAIP9ie+DaI=; fh=Uk8UXQgEx7BONJLSpTdNKVvowKBhSvH9HZ6obTCPwBM=; b=L/qaLmcbkB0/lmnyTgbbsOQRxhKWGw07Pgz0223vDM7gCTJceC/V5W0eIajzvJGyIu RkCSDGgRjDtX9f45rwj+pEyQQfuKIsolG1Yw0JmUBfoXXJy/mWbZPfY2rM98ZBZ1aJ3u 0qk79fsqKO+oCbz1Ukt+O8ih5a88QCBLWnfs3ztECkJkh3GG9vtnzhTedxif5eR34ks6 yyadZTvkQCseT82yzXRTiSj+U2mfoKApPDmH9qhcU+Z5az3QyL73D5iPKy+kpG/Zng2f riY9d0GNdH2wV9kTNmBk7330yJID6YkLaiiE/WnpewzxYgz7YinOYsNby4RQrARXDLG+ nkxw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ot405l/s"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d353fcf5e0si8594576d6.124.2024.10.30.21.22.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ot405l/s"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6MhP-0006ZI-9r; Thu, 31 Oct 2024 00:22:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6MhN-0006Yv-IT for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:17 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6MhL-0006qs-T6 for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:17 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-53c73f01284so637502e87.0 for ; Wed, 30 Oct 2024 21:22:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348534; x=1730953334; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wD31lxn0+ab/GE8FyDVCBUwUXNUGOzaYUAIP9ie+DaI=; b=ot405l/sRPbjhJqfKpWaRQAn9iYK0BCNrQ3eYAVdwGk0hplEzDwbQabIQpDpWtO/LU Q1e40I/1pAzKJ9aVA5oh85Qj5yghA6EtJ3JUwmffctH+SEHxzXMc+Dpp7rsF2Kc1Ki0m 1ruW2yDQ1g/FxBnixIFgLcjtJjgAyQ6DQNnxabNx+BlZ6mW6k62Ksozn0XS4jM6r6vwO fCiLE7iFW+d0DNrImRnSRhNTpJ9HPVU3auyzWka1rZgXgW5IP+LJ+/mMTBxhBC3YXwS+ EDVX1vVs2qqci3vNxOdORoiIzn5Tx6vwVDfiX8CXD4Ste8+7zCM8E53gfkyhWuIc28Qo Kahw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348534; x=1730953334; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wD31lxn0+ab/GE8FyDVCBUwUXNUGOzaYUAIP9ie+DaI=; b=YebH8tYkTralwbdecwaxrfCj1uHy0srBjoFdAAlTbu4tnce1E995sOPJo0O921mw/K 0rSX3u2GwMC7DU7Q+GBOnfaxDZZ3HuB8oXxlAUZ6xDNhcGDstF6fd1Fq5zyXMcydCF5U c4pkR7vF0yDTHqKqFoICLBal4/7kZC+UqHE1FXw5tDsNdJqEO36g3986BU8qhiITjZa+ hOIPy9meDIg0fMz1Zu+MP3Os6LDtDc++AsI/MCZdnK7a98IVa4H95bMGS7+55ogXVIfX TKtdIx/zZtkS8WArqeK80mPKgaLrhrSYEg32GnDz10ImoUfHg8a7/sU/Djri26YZ74DA 2zJw== X-Gm-Message-State: AOJu0Yzz0dzDvKFlhtm8gdBOltZF1uQ+o3tTNcnzeeXWZg6sIXLq0zIq fZqbb/dBqVvtZi+BcEUs/r0ZKI64c/oELjQpq8OlAisBZn5E+9zRecroZlfKkVcYLKTLSa9gJtc l X-Received: by 2002:ac2:4e0b:0:b0:539:d2e2:41ff with SMTP id 2adb3069b0e04-53c79e3254amr793241e87.23.1730348533491; Wed, 30 Oct 2024 21:22:13 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bdcbe17sm76195e87.197.2024.10.30.21.22.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:22:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aleksandar Markovic , Faraz Shahbazker , Aleksandar Rakic , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 02/14] target/mips: Enable MSA ASE for mips32r6-generic Date: Thu, 31 Oct 2024 01:21:18 -0300 Message-ID: <20241031042130.98450-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=philmd@linaro.org; helo=mail-lf1-x134.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Aleksandar Markovic Enable MSA ASE for mips32r6-generic CPU. Signed-off-by: Aleksandar Markovic Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic Reviewed-by: Aleksandar Rikalo Message-ID: Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu-defs.c.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/mips/cpu-defs.c.inc b/target/mips/cpu-defs.c.inc index fbf787d8ce1..1ab026c57e7 100644 --- a/target/mips/cpu-defs.c.inc +++ b/target/mips/cpu-defs.c.inc @@ -478,14 +478,15 @@ const mips_def_t mips_defs[] = (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) | (0 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), .CP0_Config2 = MIPS_CONFIG2, - .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_BP) | (1 << CP0C3_BI) | + .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_MSAP) | + (1 << CP0C3_BP) | (1 << CP0C3_BI) | (2 << CP0C3_ISA) | (1 << CP0C3_ULRI) | (1 << CP0C3_RXI) | (1U << CP0C3_M), .CP0_Config4 = MIPS_CONFIG4 | (0xfc << CP0C4_KScrExist) | (3 << CP0C4_IE) | (1U << CP0C4_M), .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_XNP) | (1 << CP0C5_LLB), - .CP0_Config5_rw_bitmask = (1 << CP0C5_SBRI) | (1 << CP0C5_FRE) | - (1 << CP0C5_UFE), + .CP0_Config5_rw_bitmask = (1 << CP0C5_MSAEn) | (1 << CP0C5_UFE) | + (1 << CP0C5_FRE) | (1 << CP0C5_SBRI), .CP0_LLAddr_rw_bitmask = 0, .CP0_LLAddr_shift = 0, .SYNCI_Step = 32, @@ -499,6 +500,7 @@ const mips_def_t mips_defs[] = (1 << FCR0_S) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV), .CP1_fcr31 = (1 << FCR31_ABS2008) | (1 << FCR31_NAN2008), .CP1_fcr31_rw_bitmask = 0x0103FFFF, + .MSAIR = 0x03 << MSAIR_ProcID, .SEGBITS = 32, .PABITS = 32, .insn_flags = CPU_MIPS32R6 | ASE_MICROMIPS, From patchwork Thu Oct 31 04:21:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839864 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83678wrb; Wed, 30 Oct 2024 21:23:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWeCXA7wCM1pXBcxsw5SwEJiyLD2GLDAT71SlQ0C2YbazFPPfZQKTwJ4YD+WyitM+w+4/953g==@linaro.org X-Google-Smtp-Source: AGHT+IGTaAKAQa/Tuvp54tAXlW02DaVrfGTGv7+oyLJrEMtrXKCZKcrS1qnDAkxo9FbnEBTgfTi/ X-Received: by 2002:a05:6214:2c07:b0:6cb:ee38:1bf8 with SMTP id 6a1803df08f44-6d1856b1236mr295950716d6.13.1730348592108; Wed, 30 Oct 2024 21:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348592; cv=none; d=google.com; s=arc-20240605; b=YARgz368JUeb5cqj6vsYE6LhJa9vTRfimrzLEfLtPwlFcrrt46HVLxh/DplYOD7aC7 mMFzda1kY7+fq6W2IN/SS4wDTtlbNZurcizfga59amnDWNKrNEpRj3mHVE3cSCLJ+Bn0 2N/ZaBGuSX6G2Ytuyic0A3lyhlzGGuKA0jkB0mTr3Wq9POed3razesHueMltm09+Erlh SzhcOqYnxuyG5Iz/xAE1BHOHd08cINHxTV10sHP6C2cSGbLetzsEdQ8W9lQSwRJZgcMZ 6l/d++1qTf296pkW1kYbmBdKXN4uHsgirDXDIw+jnatJde1jCwfaMaavAjO8rZXYgQIu ZItA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DMGxpn8Fe7mTj/qWvu1FAZjbLfiL4gHv/dM/0NNZ6VM=; fh=i/pWNGcx7KiR3ewgypxpPkuORYlkCnVXLqKVm9/UgNc=; b=eY4JUNZ7N+x8MICmOxxJN2EY6ySVs3nDNQvHbuePhk6udXFQlofb9XYGt+MCZIzTrO cU12DKiCPzuDWzd3UmqvjlUZjvCnmEEMuvW0HmZ+UzqdmAa0gM4PqEFFp8PA0tx3RsVy r/PZSg+8uPDTXZrh4jhYIbjnKL32mhskyRAU2NmL+t+s0wKHt3PpflxZnoL8Qnq5c0/v 474OPdThyKEz6amxdHznqFFsK0enL8eVh/UcgSNzM685vhIgl15tCLTli3kUYr3Ecmdb EnQBVqI7m/QlEISChR8JrSscc/HGaWXarUuRKdlDW/DHMxnlkVs7IWn+O+R1mP4/0W3L g7Dg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIuvswHA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d3541801adsi8679826d6.389.2024.10.30.21.23.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:23:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIuvswHA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mhg-0006qd-SF; Thu, 31 Oct 2024 00:22:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mhc-0006in-4h for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:32 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mha-0006rS-GT for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:31 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2fb51e00c05so7304051fa.0 for ; Wed, 30 Oct 2024 21:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348548; x=1730953348; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DMGxpn8Fe7mTj/qWvu1FAZjbLfiL4gHv/dM/0NNZ6VM=; b=TIuvswHA9OrgdujY36XoOGH3Vy3xhr/Ymp0gBHxQK1oL843znj5rHx/Z8+3cLG2sCt tFCl7OLYiiTO/Mr1+WOr8EOgXIGqRxGc8B2Y05lAzyil71FEQWe9EnlwjRnVu3aKJlNB rr/O5KIIX/jL1MUsXEzscHIMCJRLVTBJe8Rh2pIOVHqo+AvKz3ydTHMojgqpxLcBEVQ5 sdfV3RGuqAtjrL9MyMfcK/7aj9IvUBchxfgrKj3z6kUSekb92dmrCGcMGhkjGmx7K9uQ pmrQfT4/7eJGwT9y6Su5YFXJcRBXefl2OW4kAxBCtqeMNrodf46Wj1QLEIsu4bjuDh45 UZCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348548; x=1730953348; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DMGxpn8Fe7mTj/qWvu1FAZjbLfiL4gHv/dM/0NNZ6VM=; b=oCnr7doufs0v6EGUlGnyVa6IfUU1pI02zbieYwR6B7c/tf5uMnll+WiANBHzQvpfwi Ow0+hvCFIOMiDTS6rQHixcenBWZvUbhKtT3Ap0RpyrzhTSLZdU4S/H/GBY26TjAzaPPJ F2oRBxFDHBObqcB90Q8YwNf7dlcw7PNdVRwWxTUE4oZNcZ/PBLt9M/77Eg7RFkVctI1e ii3ynNfB1gBaWdbjPt0osy9ozqTYL10hhlv9sW1XHzkuusFWQLgmULp/NlNtfeyeolku 9B7W/s0lJZDp6mCjAn8RIYO2YKiGv4wl8RGTgz/CLgc1W9FhI5u6jQ5rcMggy94oQch4 eUSw== X-Gm-Message-State: AOJu0YzMGvDWb4eOBINVuixbuGzamWiW5o7CSvXEAohrq93rt4NM+0Rz ke0N2Du1TdYxgvloYai5Hy6Mi9lL5LLZQH8Z6LtPKbMl8kQj5ORJY0L4Ko1my4mjvi4MTxZb8Iy w X-Received: by 2002:a2e:b8c9:0:b0:2fa:fdd1:be23 with SMTP id 38308e7fff4ca-2fcbe0646e6mr149162631fa.28.1730348548194; Wed, 30 Oct 2024 21:22:28 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef8a62d6sm965961fa.86.2024.10.30.21.22.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:22:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 03/14] target/mips: Extract decode_64bit_enabled() helper Date: Thu, 31 Oct 2024 01:21:19 -0300 Message-ID: <20241031042130.98450-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=philmd@linaro.org; helo=mail-lj1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Extract the decode_64bit_enabled() helper which detects whether CPUs can run 64-bit instructions. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Message-Id: <20241026175349.84523-2-philmd@linaro.org> --- target/mips/tcg/translate.h | 2 ++ target/mips/tcg/translate.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h index 5d196e69ac4..ae6c25aa0c4 100644 --- a/target/mips/tcg/translate.h +++ b/target/mips/tcg/translate.h @@ -217,6 +217,8 @@ void msa_translate_init(void); void mxu_translate_init(void); bool decode_ase_mxu(DisasContext *ctx, uint32_t insn); +bool decode_64bit_enabled(DisasContext *ctx); + /* decodetree generated */ bool decode_isa_rel6(DisasContext *ctx, uint32_t insn); bool decode_ase_msa(DisasContext *ctx, uint32_t insn); diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index d92fc418edd..6c881af5618 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -1645,13 +1645,18 @@ static inline void check_ps(DisasContext *ctx) check_cp1_64bitmode(ctx); } +bool decode_64bit_enabled(DisasContext *ctx) +{ + return ctx->hflags & MIPS_HFLAG_64; +} + /* * This code generates a "reserved instruction" exception if cpu is not * 64-bit or 64-bit instructions are not enabled. */ void check_mips_64(DisasContext *ctx) { - if (unlikely((TARGET_LONG_BITS != 64) || !(ctx->hflags & MIPS_HFLAG_64))) { + if (unlikely((TARGET_LONG_BITS != 64) || !decode_64bit_enabled(ctx))) { gen_reserved_instruction(ctx); } } From patchwork Thu Oct 31 04:21:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839863 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83639wrb; Wed, 30 Oct 2024 21:23:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUbHPjQtOR/K9SAL2Duywv+Q6tT5w/DS7lW7MwwIEm7hE7jX0o80rb9z8/Uw0SujCCxEdq5Zw==@linaro.org X-Google-Smtp-Source: AGHT+IEV2odtSI3JYIiZGUpxzjID4Gyzdt92H49WHscngGcmI4Q6RbVaSHiNXBOlGG5v3Dl9RiPP X-Received: by 2002:a05:6214:4b0b:b0:6cb:ae56:1965 with SMTP id 6a1803df08f44-6d1856b3310mr214585396d6.15.1730348582337; Wed, 30 Oct 2024 21:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348582; cv=none; d=google.com; s=arc-20240605; b=Vx67wdlj/C+MK1URNPX6zOIdzygiKhy714CNtCFRhagzVSBUPaP6rOkTzGNCi6C7/c mdZM4SYt41PCfrR9YBVk5FMrHTlr6RuskPywujg7uS2EtsrXXJkRf+JvUq3hQ7vJ1Y2L KXNsO2EC28EM7sPHLQqjqjZutxzsNghJCxeYcYXUt71ThJfG8epKsrHicdWdeV8/ZMqb R1T5ZOcqHKHBFrgYbNFVMLsRN44ULyqL/oFsWWZp34UKRrKjZPb+MUt1lufEdDkVcYj3 yBqwhjs/ExvYVQBblTHDhIBFuAg6RoPfQGZHjXorLzrTl2XtZB5QmKC8pVwrFmn5EAr4 qCow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rkDlginaqK1R/XkBdNnRtGHhPuwXCcLg0DNmwOvev8w=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=Wl/n161Tg4KhGbLCs6e7B9fz579Rnl9KQCZqP4WaG4Xo7Wjn9B7ZwkWq22PSRxpAdE KL9iw4XZHxfRQmATSgQGj6mbEaJtDx4F3yqskaKQOflmMR6m6+dZhub4JTBsBWcj3qg/ II0Y1gNFj375fLmZuvQAyUONKsIEGQvoFXgND3GCCN7+hIMADAwZZflZQAVS8UKxx01K +B4LeuRXLeYPfmnrloS2N2NUGR+TIpEkrKkhePnMzvH5DNL/ieXEQ6YLrWanP9O6zHyw vKafnH/hLzGX3XleOm7RZP1UyE57axfocq+W3c2UIV3j5WVYjrsIsUAaWWxKdjsV+I9I kSlQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u7vQJovg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d353fd0544si9214236d6.141.2024.10.30.21.23.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u7vQJovg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mhr-0007Cj-VS; Thu, 31 Oct 2024 00:22:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mhq-000762-Hr for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:46 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mho-0006ry-SE for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:22:46 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2fb51e00c05so7306561fa.0 for ; Wed, 30 Oct 2024 21:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348563; x=1730953363; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rkDlginaqK1R/XkBdNnRtGHhPuwXCcLg0DNmwOvev8w=; b=u7vQJovg/a0jB9HfrVJLCbU5myUFMnlxTbO1euFwyz5ShkCPazYPn+CGQOJxC90l59 S8NvMuYxuCFNYiUuKbsp7AAT5DLFxHvG7nkPh2PmAj7LWvUhlBraUQXY9PJdCUIvbu1P Clr2JX9SHdb7gqhuHk1svSVMAgMxmPCnTboiMVhCs19Y/pMhdB5dWwqnuU66WIXvhkAQ Zx8eKQtY+cvjOuaZXv2AqabPKicAEImYY6nHhHGOYZsT0b59CvugrkKRF+2m6q2vcOiM G8ghUM3VxTNWdHn8vXORRg87EVmYp1RGZtZBaCI7ybg3gEzt9V6YQTTG46Mgy6qyOra6 U9NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348563; x=1730953363; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rkDlginaqK1R/XkBdNnRtGHhPuwXCcLg0DNmwOvev8w=; b=lnrdELlc0KeMZG0sYz0EaTzY4olRje8L+ME/W+yXLS1qtb18GSXAsX4+Yw1Y4gfQyo gSi6JKemx7MdqveSlLhLnurtRo8N7w5/kU0hYaJa088ckAiwpOmNP2W9TED5KuANvnxw Lr8pWW9GvO/JrO7lz5PSG+UWsNSmym5cx9RUem42Zjjvk+4Ifd05g0p+xgpl2Z+HfU6G AAit5VE09vQQb+tA9YK4azICkAS4zcCPUt+kdPeRtCPiTEJ94fRsmDc/E1vTozGC63XE oJG018JW/mpSgUw0eMs2/9Uxern43fMzRjWH0/NpuCAtWZRTptqDSgpIbG/C4tCg7mL1 cJhQ== X-Gm-Message-State: AOJu0YyIEXixO6EECBfYJOdTiVW6/054aP1BV9X5zcvy8PHhEtSZNBPl aNq73R4lKlLGqObTTJlwh2sb6x2CIoXkFs8+huurapvswI57dXb7nTY/nQk2g2guMs4egZ1m/hq P X-Received: by 2002:a05:651c:b0b:b0:2fa:d84a:bda5 with SMTP id 38308e7fff4ca-2fcbdf616b6mr128760791fa.7.1730348562765; Wed, 30 Oct 2024 21:22:42 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef8a62e3sm941161fa.88.2024.10.30.21.22.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:22:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 04/14] target/mips: Simplify Loongson MULTU.G opcode Date: Thu, 31 Oct 2024 01:21:20 -0300 Message-ID: <20241031042130.98450-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=philmd@linaro.org; helo=mail-lj1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since MULTU opcodes don't record the most significant bits of the infinite result, sign-extending the sources make no difference in the result. Once we remove the sign extension of source registers, MULT and MULTU are identical (as are DMULT and DMULTU). Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20241026175349.84523-3-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/translate.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 6c881af5618..6d7e913263e 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -3615,8 +3615,6 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, break; case OPC_MULTU_G_2E: case OPC_MULTU_G_2F: - tcg_gen_ext32u_tl(t0, t0); - tcg_gen_ext32u_tl(t1, t1); tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); break; From patchwork Thu Oct 31 04:21:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839865 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83692wrb; Wed, 30 Oct 2024 21:23:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUGljSORctx4aFJwM/cBVi+4XZ6Ndyk1qKbHRV/lZosPbzf2Nh9ug9Qb5HgmnfVH5Wzu93XHQ==@linaro.org X-Google-Smtp-Source: AGHT+IFECvITOe2MZJ3iKY+uACtUsmBy3bfQsvrCEJV9/kyGZLXKXPbe8pAo34HwVjmcrUDl4TXa X-Received: by 2002:a05:622a:180d:b0:458:256:bf7d with SMTP id d75a77b69052e-4613c0172a4mr254992181cf.22.1730348593501; Wed, 30 Oct 2024 21:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348593; cv=none; d=google.com; s=arc-20240605; b=BJKGlnyjyfk8H+Fxt5XVyT6543t3HVFQQlh45Bw+WnzREQqFyUAYn4/OuOg4bpthGM 10ikLOuhzC9UqxQWZtXW96WrEpZidfuF7reCIZwm1XdVmaPbttc3mfv08WCHh/Gh7Avv 4rLVz65yf6lcoaO9KqXGeYyC0dzbTXEQJgRFGnX962kBJDU4Zv8y4SXJEbiDPFFmJ4gV eaNPVo8eFee6+SMw5H7rHTH0BdE2mh7vFJo0Emv0GQZk+yAh7Wm5BTH11ZFYPbvO6p3X sZ5oYllCFHl0fTdMQb7TtOGiZc89kGfosaqs7BXm2ovXFYl4zj+N8Fp4etwrIjfXbEtn CODQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=szXkpmPSUeROwD+6VYjwTLHIGyNjyw7b2MJe2LmUrMg=; fh=9uuNj/l342O8eiTbn3hOYQSH1kcDrvj/EMm+RODLpOg=; b=bN+BfbYPWjDMMz/cr4Y2W9NeeSPSJOyhASleoG6n8f3tv0XZ7cYsqHx2YSgW77GLRt CYnenx22o/BhJ0nba239J3dqw5AxNvwO5GUCr1PbcqQa6RHCAOoBSdh687szCaLD5PHA PEh8hiJUCH15ordCQrAcSjQUz8iUQuSx4Q/JjGjRzKDifbEIfj4322KQrAzPhXbkEtJe pcfbILknuJj6VdV8PWZj5fOLVn0AaOo5ExJfQShFkUmCtTzSkqXoCOpSsA2LuikdCyO7 Z60MUabrsDkcqOm5zYC/lqXTNO9B4zoAR1KxV0hY/99EqK6D5HqCgF2ceEiavXaAdXkq z2Tg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b2dFHgtB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad0d044csi9379121cf.164.2024.10.30.21.23.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:23:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b2dFHgtB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mi9-0008OC-E3; Thu, 31 Oct 2024 00:23:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mi7-0008KJ-LX for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:03 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mi5-0006sa-TI for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:03 -0400 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2fb50e84ec7so3131851fa.1 for ; Wed, 30 Oct 2024 21:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348579; x=1730953379; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=szXkpmPSUeROwD+6VYjwTLHIGyNjyw7b2MJe2LmUrMg=; b=b2dFHgtB6RJju2nkBz4nPYMPLsrXddN4WQZlvN59N+Cy/OF26Kr597EIVHut1nI0pl UJ+/R0HNQ77Jr3qPjrhU5895tUIcEXV3r/CmXM8M5+2X7abhgWLWh86eviVGK2K2WlKs W2q+RVxilbAVOr0chSiP2kQxSWO7KxELd3SgXlpHKHAcgyyE/j5eWn1FaMn/RcFdTFxY 6/HdaLets86hI+CBQGzN19ZBcg7yJtCNDatoLyngu7XhqaG3FZowxkQqchfi1j6ZeODI /LC9XchAqC/KhV3e4DuUNrIqT1fEWyWz5XOX+g0sSzNJ+aIHKrvCIacJdK1OcSlJKJBd muOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348579; x=1730953379; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=szXkpmPSUeROwD+6VYjwTLHIGyNjyw7b2MJe2LmUrMg=; b=Z7o0Rnux0oswQd16iy9fj8GC5DAO0bis5b7ZlnTty8c7vzBs3zt0fOq21Yp5Li5G0p kZNS/KlGiZNAOBcU19A1WZTYdWtlSuxddkBLwznBTUyRm/sA1eHoyz8YtAz8vNWdcmrY gy+XpQNDDlbzcxJHZcymfuGvRiZTtUjeB6z/JeJcnS7Pn/h1wFKEV4LUkezMhiggMzKB kOU0NrFM+Vhlk8eyW8Y1D39dHQL0EEhpMst41jeCEvHhWk0kzDzOUlTlkTbR2qqbqlN4 JajUvh3Nc1NnJubUFZY8ADLIOb8lgcTE94pFKHSriaB2mg/kQ7yNTJpMCWejrow9Bdth yNHg== X-Gm-Message-State: AOJu0YzegyI/twVDlq/SBdgCjNBWCC51YFcuiaVdzcfGFhUQq/Ecegvg 2ta6Fv1nF45lmazrtQRT/TYLTxun7KiChpOmGgg3IeDVeA6hOu1O9KzmKFMSgoJXEZc/AjLVq3e u X-Received: by 2002:a2e:a543:0:b0:2fa:cc50:41b with SMTP id 38308e7fff4ca-2fcbdf5fa9amr85198681fa.5.1730348579299; Wed, 30 Oct 2024 21:22:59 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef8c393asm937971fa.107.2024.10.30.21.22.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:22:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jiaxun Yang , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 05/14] target/mips: Re-introduce OPC_ADDUH_QB_DSP and OPC_MUL_PH_DSP Date: Thu, 31 Oct 2024 01:21:21 -0300 Message-ID: <20241031042130.98450-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=philmd@linaro.org; helo=mail-lj1-x234.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé There is no issue having multiple enum declarations with the same value. As we are going to remove the OPC_MULT_G_2E definition in few commits, restore the OPC_ADDUH_QB_DSP and OPC_MUL_PH_DSP definitions and use them where they belong. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Jiaxun Yang Reviewed-by: Richard Henderson Message-Id: <20241026175349.84523-4-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/translate.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 6d7e913263e..509488fdc7a 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -389,16 +389,14 @@ enum { OPC_ADDU_OB_DSP = 0x14 | OPC_SPECIAL3, OPC_ABSQ_S_PH_DSP = 0x12 | OPC_SPECIAL3, OPC_ABSQ_S_QH_DSP = 0x16 | OPC_SPECIAL3, - /* OPC_ADDUH_QB_DSP is same as OPC_MULT_G_2E. */ - /* OPC_ADDUH_QB_DSP = 0x18 | OPC_SPECIAL3, */ + OPC_ADDUH_QB_DSP = 0x18 | OPC_SPECIAL3, OPC_CMPU_EQ_QB_DSP = 0x11 | OPC_SPECIAL3, OPC_CMPU_EQ_OB_DSP = 0x15 | OPC_SPECIAL3, /* MIPS DSP GPR-Based Shift Sub-class */ OPC_SHLL_QB_DSP = 0x13 | OPC_SPECIAL3, OPC_SHLL_OB_DSP = 0x17 | OPC_SPECIAL3, /* MIPS DSP Multiply Sub-class insns */ - /* OPC_MUL_PH_DSP is same as OPC_ADDUH_QB_DSP. */ - /* OPC_MUL_PH_DSP = 0x18 | OPC_SPECIAL3, */ + OPC_MUL_PH_DSP = 0x18 | OPC_SPECIAL3, OPC_DPA_W_PH_DSP = 0x30 | OPC_SPECIAL3, OPC_DPAQ_W_QH_DSP = 0x34 | OPC_SPECIAL3, /* DSP Bit/Manipulation Sub-class */ @@ -556,7 +554,6 @@ enum { OPC_MULQ_S_PH = (0x1E << 6) | OPC_ADDU_QB_DSP, }; -#define OPC_ADDUH_QB_DSP OPC_MULT_G_2E #define MASK_ADDUH_QB(op) (MASK_SPECIAL3(op) | (op & (0x1F << 6))) enum { /* MIPS DSP Arithmetic Sub-class */ @@ -11587,8 +11584,7 @@ static void gen_mipsdsp_arith(DisasContext *ctx, uint32_t op1, uint32_t op2, gen_load_gpr(v2_t, v2); switch (op1) { - /* OPC_MULT_G_2E is equal OPC_ADDUH_QB_DSP */ - case OPC_MULT_G_2E: + case OPC_ADDUH_QB_DSP: check_dsp_r2(ctx); switch (op2) { case OPC_ADDUH_QB: @@ -12271,11 +12267,7 @@ static void gen_mipsdsp_multiply(DisasContext *ctx, uint32_t op1, uint32_t op2, gen_load_gpr(v2_t, v2); switch (op1) { - /* - * OPC_MULT_G_2E, OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have - * the same mask and op1. - */ - case OPC_MULT_G_2E: + case OPC_MUL_PH_DSP: check_dsp_r2(ctx); switch (op2) { case OPC_MUL_PH: @@ -13811,7 +13803,7 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) * OPC_MULT_G_2E, OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have * the same mask and op1. */ - if ((ctx->insn_flags & ASE_DSP_R2) && (op1 == OPC_MULT_G_2E)) { + if ((ctx->insn_flags & ASE_DSP_R2) && (op1 == OPC_MUL_PH_DSP)) { op2 = MASK_ADDUH_QB(ctx->opcode); switch (op2) { case OPC_ADDUH_QB: From patchwork Thu Oct 31 04:21:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839866 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83735wrb; Wed, 30 Oct 2024 21:23:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6vQ04E2KQxjqjiQB5AtqqAC/Dv0eq/KlZEqpgzybLc2u8ZmdToF44d/o9IJnWQi4Mp/ci0A==@linaro.org X-Google-Smtp-Source: AGHT+IFO4ce0y3Hep0sLkil12i5XXKI/tYA/1t+YDBJTjLkFM+NNfy7UAYTAFrxDDRBKoFNDxI9p X-Received: by 2002:ac8:7dc4:0:b0:461:686:74b0 with SMTP id d75a77b69052e-462ab2b397emr23483891cf.36.1730348603795; Wed, 30 Oct 2024 21:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348603; cv=none; d=google.com; s=arc-20240605; b=kid7olpNZXflk3+mftcqxhX9WWUQJGbhRnZoqD5RgFHYVchF4bqRFUV9NxBjGl4mtE Vfwdh2HPJHh0O8rn2mM11mOxEbgaCyCETQniFrExiC44gtPBzSYuCaA6q+nD0BxCSwMC AzJLtACr97cHjWcTkBGY/McYq5R3OUZyxZ0VAgz1N2eJbNTjWBhh4TMAWZPcL9LAs6Xl XHiO1qhGsKqQ2gVmZS7I4bSVprLo/wxHIzM+Mx47xepjshzl2v9dGqlOTK91/sr2k/aw f+W3uW/eR3mvVjtqs8/SW2P/u5qbe4z2e6kP80zgFFt2G0D43PGKF7j2uZ5dum+tI/ND JfhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ILZUHyaOqbrv0aSt3tz0yBDXQDHRKNcl8J2Q6tBi0CQ=; fh=KIfLbk2hkPD5GhSdpV+cNrAHo/qG7XpVtXfxvzRZE4k=; b=EV5DRneXvv2ZeN67mUAKV9MwdgxplbPpEdHBdwPb8vy02+kCYkQeA5L7S//a1/gFU5 +aXpnc/MXJISKEnPPBKMBlSwGbH80T4v3v3uSrvn6RwwhYTR8N9DLP0OgHOW/joi/O/8 HQjVD5wnCe3e7rmPbaMgT5plJb2Mu6Afaueb7AMt1RTGXEw7Lj3tXi+vWU2qoMOfWk8m nH2ihdpuWKeOYdzXEd211+2unmIhk58CKyOcbw9L8fkqp+3jpX3fYX3QiXI4KbpQVnkP 0Sg35vhlgblCIOnxww2Q0pvCf048MHQL/rQz3lZw1JwPWdrT4VP/Ry9rNVgAUPzocUNe V7MQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+e65IXi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad244a99si8428391cf.604.2024.10.30.21.23.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+e65IXi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6MiQ-0001OA-2L; Thu, 31 Oct 2024 00:23:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6MiN-0001EF-EY for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:19 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6MiL-0006tC-9U for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:19 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-539f8490856so524047e87.2 for ; Wed, 30 Oct 2024 21:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348595; x=1730953395; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ILZUHyaOqbrv0aSt3tz0yBDXQDHRKNcl8J2Q6tBi0CQ=; b=i+e65IXiS31VT9RM6/qyPzCnEsneMyB98PTc2/Xva7KGcKkoYLGfya8cZ6aXC02YnC PxWCdiydUKivXIkash/AXWOAdaVHLBjx1d7Iid7xQQLQ84WghpIVKU+33q62a8CWgyT9 MuMuGTKShTaJZOxd66pc83l3HL+4gH1r4HFfKbSah4H5quFx5PUAVZiO6HIcrLyiXdoG 37ZLQSpfpPklmavGRKf9w2lK/RGKXEmFfqDmcElOXhfvXNbbzv0TmGxp0X4JdLQbbOUP 6W06PhwH+duGSomSEwgrVLoW0NHvCtBOPgqnvhx8fh1rXTA54E0BNJ9SpzHWBI8dMgcD +DBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348595; x=1730953395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ILZUHyaOqbrv0aSt3tz0yBDXQDHRKNcl8J2Q6tBi0CQ=; b=c/PuAdSvHkuTb2dK2rHrkdBNhV1NO0p+4XIfJ+iOftQc65mu0x737jWUU5vQiBIaWM CwRRuFLfLa6B6cUkHBEBLZyGNA9qvSv/WMLfzuOSpvaPgTngFhi48TynWmBmNuKW0v/a 3zg9hMUi3d38IlXVjuNeifI8ONshAwbR2cnRydyy09rz0s5BeethFrsTqlM5n8UWgTA8 r4+OCJbvX8UzXnFjm1OIRYh3LDieCxaQmptv9FnCT8fYQs1VsBdRWnjiKEJTD6gdbSXF rKjk0+lyFDgd/sUkV1Pq9ZFpzP58UT6zdkrLevX3bokGKfv2ViJ+F5wPleHvQJ4eLtff joaQ== X-Gm-Message-State: AOJu0YwMNTqJ96b/J7twKtoafnPjvnpSkkzOf8XysC/cNR0wl7UxpHW4 75a6D4BV7hDamwaqskCJhX/IbIoU26NAHsg7+nqVCoXY1nK5LdkjnVtgaXCJ8tjJfzRUnpPULXN P X-Received: by 2002:a05:6512:12d1:b0:539:f035:e158 with SMTP id 2adb3069b0e04-53c79e322eamr777149e87.18.1730348594743; Wed, 30 Oct 2024 21:23:14 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bc961cfsm78333e87.23.2024.10.30.21.23.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:23:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 06/14] target/mips: Convert Loongson DDIV.G opcodes to decodetree Date: Thu, 31 Oct 2024 01:21:22 -0300 Message-ID: <20241031042130.98450-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Introduce decode_loongson() to decode all Loongson vendor specific opcodes. Start converting a single opcode: DDIV.G (divide 64-bit signed integers). Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20241026175349.84523-5-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/translate.h | 1 + target/mips/tcg/godson2.decode | 16 ++++++ target/mips/tcg/loong-ext.decode | 17 ++++++ target/mips/tcg/loong_translate.c | 86 +++++++++++++++++++++++++++++++ target/mips/tcg/translate.c | 26 ++-------- target/mips/tcg/meson.build | 3 ++ 6 files changed, 126 insertions(+), 23 deletions(-) create mode 100644 target/mips/tcg/godson2.decode create mode 100644 target/mips/tcg/loong-ext.decode create mode 100644 target/mips/tcg/loong_translate.c diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h index ae6c25aa0c4..23a489c0f38 100644 --- a/target/mips/tcg/translate.h +++ b/target/mips/tcg/translate.h @@ -223,6 +223,7 @@ bool decode_64bit_enabled(DisasContext *ctx); bool decode_isa_rel6(DisasContext *ctx, uint32_t insn); bool decode_ase_msa(DisasContext *ctx, uint32_t insn); bool decode_ext_txx9(DisasContext *ctx, uint32_t insn); +bool decode_ext_loongson(DisasContext *ctx, uint32_t insn); #if defined(TARGET_MIPS64) bool decode_ase_lcsr(DisasContext *ctx, uint32_t insn); bool decode_ext_tx79(DisasContext *ctx, uint32_t insn); diff --git a/target/mips/tcg/godson2.decode b/target/mips/tcg/godson2.decode new file mode 100644 index 00000000000..47ea5a1c438 --- /dev/null +++ b/target/mips/tcg/godson2.decode @@ -0,0 +1,16 @@ +# Godson2 64-bit Integer instructions +# +# Copyright (C) 2021 Philippe Mathieu-Daudé +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Reference: +# Godson-2E Software Manual +# (Document Number: godson2e-user-manual-V0.6) +# + +&muldiv rs rt rd + +@rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv + +DDIV_G 011111 ..... ..... ..... 00000 011110 @rs_rt_rd diff --git a/target/mips/tcg/loong-ext.decode b/target/mips/tcg/loong-ext.decode new file mode 100644 index 00000000000..8b78ec48599 --- /dev/null +++ b/target/mips/tcg/loong-ext.decode @@ -0,0 +1,17 @@ +# Loongson 64-bit Extension instructions +# +# Copyright (C) 2021 Philippe Mathieu-Daudé +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Reference: +# STLS2F01 User Manual +# Appendix A: new integer instructions +# (Document Number: UM0447) +# + +&muldiv rs rt rd !extern + +@rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv + +DDIV_G 011100 ..... ..... ..... 00000 010101 @rs_rt_rd diff --git a/target/mips/tcg/loong_translate.c b/target/mips/tcg/loong_translate.c new file mode 100644 index 00000000000..53e4047cfa0 --- /dev/null +++ b/target/mips/tcg/loong_translate.c @@ -0,0 +1,86 @@ +/* + * MIPS Loongson 64-bit translation routines + * + * Copyright (c) 2004-2005 Jocelyn Mayer + * Copyright (c) 2006 Marius Groeger (FPU operations) + * Copyright (c) 2006 Thiemo Seufer (MIPS32R2 support) + * Copyright (c) 2011 Richard Henderson + * Copyright (c) 2021 Philippe Mathieu-Daudé + * + * This code is licensed under the GNU GPLv2 and later. + */ + +#include "qemu/osdep.h" +#include "translate.h" + +/* Include the auto-generated decoder. */ +#include "decode-godson2.c.inc" +#include "decode-loong-ext.c.inc" + +/* + * Word or double-word Fixed-point instructions. + * --------------------------------------------- + * + * Fixed-point multiplies and divisions write only + * one result into general-purpose registers. + */ + +static bool gen_lext_DIV_G(DisasContext *s, int rd, int rs, int rt) +{ + TCGv t0, t1; + TCGLabel *l1, *l2, *l3; + + if (TARGET_LONG_BITS != 64) { + return false; + } + check_mips_64(s); + + if (rd == 0) { + /* Treat as NOP. */ + return true; + } + + t0 = tcg_temp_new(); + t1 = tcg_temp_new(); + l1 = gen_new_label(); + l2 = gen_new_label(); + l3 = gen_new_label(); + + gen_load_gpr(t0, rs); + gen_load_gpr(t1, rt); + + tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); + tcg_gen_movi_tl(cpu_gpr[rd], 0); + tcg_gen_br(l3); + gen_set_label(l1); + + tcg_gen_brcondi_tl(TCG_COND_NE, t0, -1LL << 63, l2); + tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); + tcg_gen_mov_tl(cpu_gpr[rd], t0); + + tcg_gen_br(l3); + gen_set_label(l2); + tcg_gen_div_tl(cpu_gpr[rd], t0, t1); + gen_set_label(l3); + + return true; +} + +static bool trans_DDIV_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_DIV_G(s, a->rt, a->rs, a->rd); +} + +bool decode_ext_loongson(DisasContext *ctx, uint32_t insn) +{ + if (!decode_64bit_enabled(ctx)) { + return false; + } + if ((ctx->insn_flags & INSN_LOONGSON2E) && decode_godson2(ctx, ctx->opcode)) { + return true; + } + if ((ctx->insn_flags & ASE_LEXT) && decode_loong_ext(ctx, ctx->opcode)) { + return true; + } + return false; +} diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 509488fdc7a..73445dd9074 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -333,7 +333,6 @@ enum { OPC_MULTU_G_2F = 0x12 | OPC_SPECIAL2, OPC_DMULTU_G_2F = 0x13 | OPC_SPECIAL2, OPC_DIV_G_2F = 0x14 | OPC_SPECIAL2, - OPC_DDIV_G_2F = 0x15 | OPC_SPECIAL2, OPC_DIVU_G_2F = 0x16 | OPC_SPECIAL2, OPC_DDIVU_G_2F = 0x17 | OPC_SPECIAL2, OPC_MOD_G_2F = 0x1c | OPC_SPECIAL2, @@ -375,7 +374,6 @@ enum { OPC_DIVU_G_2E = 0x1B | OPC_SPECIAL3, OPC_DMULT_G_2E = 0x1C | OPC_SPECIAL3, OPC_DMULTU_G_2E = 0x1D | OPC_SPECIAL3, - OPC_DDIV_G_2E = 0x1E | OPC_SPECIAL3, OPC_DDIVU_G_2E = 0x1F | OPC_SPECIAL3, OPC_MOD_G_2E = 0x22 | OPC_SPECIAL3, OPC_MODU_G_2E = 0x23 | OPC_SPECIAL3, @@ -3698,25 +3696,6 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, case OPC_DMULTU_G_2F: tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); break; - case OPC_DDIV_G_2E: - case OPC_DDIV_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - TCGLabel *l3 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l3); - gen_set_label(l1); - tcg_gen_brcondi_tl(TCG_COND_NE, t0, -1LL << 63, l2); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); - tcg_gen_mov_tl(cpu_gpr[rd], t0); - tcg_gen_br(l3); - gen_set_label(l2); - tcg_gen_div_tl(cpu_gpr[rd], t0, t1); - gen_set_label(l3); - } - break; case OPC_DDIVU_G_2E: case OPC_DDIVU_G_2F: { @@ -13654,7 +13633,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) break; case OPC_DMULT_G_2F: case OPC_DMULTU_G_2F: - case OPC_DDIV_G_2F: case OPC_DDIVU_G_2F: case OPC_DMOD_G_2F: case OPC_DMODU_G_2F: @@ -14061,7 +14039,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) } break; #if defined(TARGET_MIPS64) - case OPC_DDIV_G_2E: case OPC_DDIVU_G_2E: case OPC_DMULT_G_2E: case OPC_DMULTU_G_2E: @@ -15262,6 +15239,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) if (cpu_supports_isa(env, INSN_VR54XX) && decode_ext_vr54xx(ctx, ctx->opcode)) { return; } + if (TARGET_LONG_BITS == 64 && decode_ext_loongson(ctx, ctx->opcode)) { + return; + } #if defined(TARGET_MIPS64) if (ase_lcsr_available(env) && decode_ase_lcsr(ctx, ctx->opcode)) { return; diff --git a/target/mips/tcg/meson.build b/target/mips/tcg/meson.build index ea7fb582f2a..fd91148df74 100644 --- a/target/mips/tcg/meson.build +++ b/target/mips/tcg/meson.build @@ -1,4 +1,6 @@ gen = [ + decodetree.process('godson2.decode', extra_args: ['--static-decode=decode_godson2']), + decodetree.process('loong-ext.decode', extra_args: ['--static-decode=decode_loong_ext']), decodetree.process('rel6.decode', extra_args: ['--decode=decode_isa_rel6']), decodetree.process('msa.decode', extra_args: '--decode=decode_ase_msa'), decodetree.process('tx79.decode', extra_args: '--static-decode=decode_tx79'), @@ -28,6 +30,7 @@ mips_ss.add(when: 'TARGET_MIPS64', if_true: files( 'tx79_translate.c', 'octeon_translate.c', 'lcsr_translate.c', + 'loong_translate.c', ), if_false: files( 'mxu_translate.c', )) From patchwork Thu Oct 31 04:21:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839867 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83818wrb; Wed, 30 Oct 2024 21:23:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW/irifQQVlXNW/RMlzdbqwj9WoLevhC1PIBSYk3cCgLeL3eKndFvbHsfYmdS6WFAok9fu6Xg==@linaro.org X-Google-Smtp-Source: AGHT+IHTRFUgHk2cJ8oRSPOZzvo8Znv30cFS4MD6yESlVuLjjxrIE8xgdtvcl8FoSfSilWG0QzOT X-Received: by 2002:ac8:5904:0:b0:461:1734:37e6 with SMTP id d75a77b69052e-4613c1c735emr272313021cf.49.1730348618490; Wed, 30 Oct 2024 21:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348618; cv=none; d=google.com; s=arc-20240605; b=XcCe3SvBIrLAsDWz7z/U5f0ZcaHstwMqizUv5qebx4tD6nc67Kznj01CjM+yJ12Vdm DSL3HrPFc4wYUQC7rMMDVVYFw8hzLq4FFWXwX3HfNYN505bLylWCCIdCMW4QTceubxW/ WjGbIRygsanu2zTuoZtWVjhKy/MKxmH7wGaclAjHJ5n2GGoSgsONW6fOD/s+Bd6rDsmy gurCE9p+1/G9R7YPbSbWs/M4B6D2ilgL8h8OuoeVgDD5f6mHp+f+47hFjUVQBABATMoH ZyEDPYdyW4cBUgaSxhuTAfNdR23YS4HEhJL0vRmTOV2f+jMaG+42m7mF/9Cw/BXponSG sn+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rUVPOYnibuI4tuLgAdfBBa0UcfkSM7OlpkZB5VJi6MM=; fh=KIfLbk2hkPD5GhSdpV+cNrAHo/qG7XpVtXfxvzRZE4k=; b=Ct2u11bl/fzLYIuEOfvF3nE6ie6tSp1a+DeYjQYAZSfoj8Eu07zz8dm7E+Eejl+56l Cd3M5gFu80UwdSqPXJ4jjTS8cB7+bgu3UujRAL+h489LsP1fxmkKUBlwcPE1gOzuNpX8 p+d7KNpAiWcH4FM4ItVYjP4qvUFzMmeDcE8rFt5jraIJ/ZUTojb+R2kt7zzso5KjCjGA zC0ksRKf9RofQ5IrSFZrSoU6EgbtYPZNqbOr6piJauVeEy/PXbEJlHbO8S+qk6WfFRiD bLNF299KEWWrot6feXA8NVz3M8LyiqnHetFqvur0MsVVb4yuyDBMXfyCBc30+IPxUcNN IRjw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zsWSnpnp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad2448afsi8211121cf.581.2024.10.30.21.23.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:23:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zsWSnpnp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mic-0001to-Um; Thu, 31 Oct 2024 00:23:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mib-0001n8-6Z for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:33 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6MiZ-0006te-4U for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:32 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2fb5111747cso4786121fa.2 for ; Wed, 30 Oct 2024 21:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348609; x=1730953409; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rUVPOYnibuI4tuLgAdfBBa0UcfkSM7OlpkZB5VJi6MM=; b=zsWSnpnpllyxjprhZ0Y4j74gZDMupEaK0nCclsFpWBB1dFG55k+sZTpNcABfUW8Du6 2ud6Y3LQfjJeKGLilvyTxY3iMmtTUk3cf4Y7KH3xXavqTPQrc90LdtSt0ssympvqkm5t FamUfE6Nx29C7le3shYzs+TWazjuy5DqkCM/oKQFwjoW1ss5watO/H8ejq+dSIh9VOwq sYXDO4x9TnFPjszL6Px2KFk0GLqbC0C9Iep0Zfforh2zIYcI2Ysqi7V6IToGhUxvGAum ZEuMaSEKfcmJtnaUUJqyttrj1AgKcFmF2ceqd4DnMb7RM000D2BYMEOF46oTcF0VTnbh RdwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348609; x=1730953409; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rUVPOYnibuI4tuLgAdfBBa0UcfkSM7OlpkZB5VJi6MM=; b=sm3OiEGGikmRKzQ2yNqt0nVNAfoSHAZuiCSfHYtk84yPDIsiVJaZyZeGTAikU8wfQt fSc9tdx3DwU7v74j41x4f1ZIACrtVNmxaoLGucnLyqE0fTlxCpNA0Kq/iaXWpLHaje/k +T5HRO0FvF2ikwdWn9QZdMD8goM0O82la2XdNsylyCM9CuHfqx2vgekUo+QtmKGQOgWV vlblnvuLRTEM6bFzBMHhd2JyxZkH9NN8lJ7XW8pLMdbSfMzV1Q396Zm+xzRQLzo0pkWD /egka7fV5Bx/vgLYnd8LipS2I27uMdSlVnqR6e9yNOP4VhKuuVh051pzcJOjYNwSZIhY Vqgg== X-Gm-Message-State: AOJu0YwKFMuE3InGsHtNzXaKUhyRNwtjdXlH1C08O2I+q7Yv6MfDPvIk sWy4OzECzKvMWHfp0MnS3JTOR5f5ylANtzV8kwMaA3mKaGD/hCfH2K1d7rHynQdVrq51Uo4XnOI N X-Received: by 2002:a05:6512:33c7:b0:539:ea49:d163 with SMTP id 2adb3069b0e04-53c79e327d4mr871539e87.21.1730348608947; Wed, 30 Oct 2024 21:23:28 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bc9becasm77914e87.67.2024.10.30.21.23.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:23:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 07/14] target/mips: Convert Loongson DIV.G opcodes to decodetree Date: Thu, 31 Oct 2024 01:21:23 -0300 Message-ID: <20241031042130.98450-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=philmd@linaro.org; helo=mail-lj1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé DIV.G and DDIV.G are very similar. Provide gen_lext_DIV_G() a 'is_double' argument so it can generate DIV.G (divide 32-bit signed integers). With this commit we explicit the template used to generate opcode for 32/64-bit word variants. Next commits will be less verbose by providing both variants at once. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20241026175349.84523-6-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/godson2.decode | 1 + target/mips/tcg/loong-ext.decode | 1 + target/mips/tcg/loong_translate.c | 28 ++++++++++++++++++++++------ target/mips/tcg/translate.c | 26 -------------------------- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/target/mips/tcg/godson2.decode b/target/mips/tcg/godson2.decode index 47ea5a1c438..cbf24ed88da 100644 --- a/target/mips/tcg/godson2.decode +++ b/target/mips/tcg/godson2.decode @@ -13,4 +13,5 @@ @rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv +DIV_G 011111 ..... ..... ..... 00000 011010 @rs_rt_rd DDIV_G 011111 ..... ..... ..... 00000 011110 @rs_rt_rd diff --git a/target/mips/tcg/loong-ext.decode b/target/mips/tcg/loong-ext.decode index 8b78ec48599..9397606beb6 100644 --- a/target/mips/tcg/loong-ext.decode +++ b/target/mips/tcg/loong-ext.decode @@ -14,4 +14,5 @@ @rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv +DIV_G 011100 ..... ..... ..... 00000 010100 @rs_rt_rd DDIV_G 011100 ..... ..... ..... 00000 010101 @rs_rt_rd diff --git a/target/mips/tcg/loong_translate.c b/target/mips/tcg/loong_translate.c index 53e4047cfa0..7c405078795 100644 --- a/target/mips/tcg/loong_translate.c +++ b/target/mips/tcg/loong_translate.c @@ -25,15 +25,18 @@ * one result into general-purpose registers. */ -static bool gen_lext_DIV_G(DisasContext *s, int rd, int rs, int rt) +static bool gen_lext_DIV_G(DisasContext *s, int rd, int rs, int rt, + bool is_double) { TCGv t0, t1; TCGLabel *l1, *l2, *l3; - if (TARGET_LONG_BITS != 64) { - return false; + if (is_double) { + if (TARGET_LONG_BITS != 64) { + return false; + } + check_mips_64(s); } - check_mips_64(s); if (rd == 0) { /* Treat as NOP. */ @@ -49,26 +52,39 @@ static bool gen_lext_DIV_G(DisasContext *s, int rd, int rs, int rt) gen_load_gpr(t0, rs); gen_load_gpr(t1, rt); + if (!is_double) { + tcg_gen_ext32s_tl(t0, t0); + tcg_gen_ext32s_tl(t1, t1); + } tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); tcg_gen_movi_tl(cpu_gpr[rd], 0); tcg_gen_br(l3); gen_set_label(l1); - tcg_gen_brcondi_tl(TCG_COND_NE, t0, -1LL << 63, l2); + tcg_gen_brcondi_tl(TCG_COND_NE, t0, is_double && TARGET_LONG_BITS == 64 + ? LLONG_MIN : INT_MIN, l2); tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); tcg_gen_mov_tl(cpu_gpr[rd], t0); tcg_gen_br(l3); gen_set_label(l2); tcg_gen_div_tl(cpu_gpr[rd], t0, t1); + if (!is_double) { + tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); + } gen_set_label(l3); return true; } +static bool trans_DIV_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_DIV_G(s, a->rt, a->rs, a->rd, false); +} + static bool trans_DDIV_G(DisasContext *s, arg_muldiv *a) { - return gen_lext_DIV_G(s, a->rt, a->rs, a->rd); + return gen_lext_DIV_G(s, a->rt, a->rs, a->rd, true); } bool decode_ext_loongson(DisasContext *ctx, uint32_t insn) diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 73445dd9074..1c38e893d31 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -332,7 +332,6 @@ enum { OPC_DMULT_G_2F = 0x11 | OPC_SPECIAL2, OPC_MULTU_G_2F = 0x12 | OPC_SPECIAL2, OPC_DMULTU_G_2F = 0x13 | OPC_SPECIAL2, - OPC_DIV_G_2F = 0x14 | OPC_SPECIAL2, OPC_DIVU_G_2F = 0x16 | OPC_SPECIAL2, OPC_DDIVU_G_2F = 0x17 | OPC_SPECIAL2, OPC_MOD_G_2F = 0x1c | OPC_SPECIAL2, @@ -370,7 +369,6 @@ enum { /* Loongson 2E */ OPC_MULT_G_2E = 0x18 | OPC_SPECIAL3, OPC_MULTU_G_2E = 0x19 | OPC_SPECIAL3, - OPC_DIV_G_2E = 0x1A | OPC_SPECIAL3, OPC_DIVU_G_2E = 0x1B | OPC_SPECIAL3, OPC_DMULT_G_2E = 0x1C | OPC_SPECIAL3, OPC_DMULTU_G_2E = 0x1D | OPC_SPECIAL3, @@ -3613,28 +3611,6 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); break; - case OPC_DIV_G_2E: - case OPC_DIV_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - TCGLabel *l3 = gen_new_label(); - tcg_gen_ext32s_tl(t0, t0); - tcg_gen_ext32s_tl(t1, t1); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l3); - gen_set_label(l1); - tcg_gen_brcondi_tl(TCG_COND_NE, t0, INT_MIN, l2); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1, l2); - tcg_gen_mov_tl(cpu_gpr[rd], t0); - tcg_gen_br(l3); - gen_set_label(l2); - tcg_gen_div_tl(cpu_gpr[rd], t0, t1); - tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); - gen_set_label(l3); - } - break; case OPC_DIVU_G_2E: case OPC_DIVU_G_2F: { @@ -13598,7 +13574,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) case OPC_MUL: gen_arith(ctx, op1, rd, rs, rt); break; - case OPC_DIV_G_2F: case OPC_DIVU_G_2F: case OPC_MULT_G_2F: case OPC_MULTU_G_2F: @@ -13771,7 +13746,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) op1 = MASK_SPECIAL3(ctx->opcode); switch (op1) { - case OPC_DIV_G_2E: case OPC_DIVU_G_2E: case OPC_MOD_G_2E: case OPC_MODU_G_2E: From patchwork Thu Oct 31 04:21:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839868 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83921wrb; Wed, 30 Oct 2024 21:24:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW8WKM64Z0ECYIazFjphZ8oJgZgUhsczrGilK4QA7QBcxccHNjVXxbZ1y8FaqvPBqNqkjGNgA==@linaro.org X-Google-Smtp-Source: AGHT+IHwuIocqrx21Dty8FpvwXveQMdBxXKsOdjC3I315LIrvIFxEb2VOuteuq1lxKvt0WN2zsFK X-Received: by 2002:a05:6214:5b0c:b0:6cb:f1cb:a161 with SMTP id 6a1803df08f44-6d1858555d7mr263950936d6.43.1730348640789; Wed, 30 Oct 2024 21:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348640; cv=none; d=google.com; s=arc-20240605; b=fZt+EiKwXZqqhI8MYF6TgM1MagIG4muvHg/3lmDTsOYgTKKwHSos+YIlktljz+mBAz Rg7T/RT88Gt1bp4HBMBQrezgYmuViOWhNRTS0bFm2VpDS0rjVprVbFq5NxejKVtu+0Ig 0c2GCCCQkU3sCRj46XJVq3BnX72wvIUk1jeK2g9x5a2mmI/c6CCAXW8smNfOj2hZ/PTL t0JXIMx8FAbkrrN5tP0OVvedzb/QO2ZAP460LoaTBqeBOXTUiZHz8/Pxvl2YRZE2J/GK ftRluEpA8klFnzhtpphrd+Joij3vT+ILAlGenbLokK5gezo3IUHbJeaq+Mdz3RvEsLp2 O8Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gg/KjteIAWlAAHvFgfAU18N2daxBJnjbpffs+ITquTk=; fh=KIfLbk2hkPD5GhSdpV+cNrAHo/qG7XpVtXfxvzRZE4k=; b=SaK+BpFuocOWecxm7K+hi51Yx3GYSLSC/4Qo2Kz+Cd83gE9VaKFJ+ONgbVIem7j8HV Wz1KO+pJSmvOBvoYTAl5SdMgS4TiGhsHDmVMRo6b/cNN0QgDXKarslwyR3UoCniZcFmE stro5agkew/uywBYBpmYUH13DHxcI4w/YfDNeIBxEGqrNypnxLKwuYsyJ6EE1UD3t7xY kUqepEy2uRuTpLKSbJxmbTdy0lGHSAzl3Ymin5muEz4/kVby9y9kAoLcOLaik8BEXgNW i/gV0xtg6mKXoBmvwalqyJCbop1jeEuG7kSR51lhg2o690KJqybSu6amJJUaEv8EaSti uY5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cK9lWOs8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d353fd0992si8448996d6.159.2024.10.30.21.24.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cK9lWOs8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mis-0002dm-Sw; Thu, 31 Oct 2024 00:23:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mir-0002cV-AL for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:49 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mip-0006uY-3f for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:23:48 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2fb5740a03bso4296721fa.1 for ; Wed, 30 Oct 2024 21:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348625; x=1730953425; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gg/KjteIAWlAAHvFgfAU18N2daxBJnjbpffs+ITquTk=; b=cK9lWOs8i/lljXlYzJRrNauUFPHYb+9tZR12/wrAgwV+QYT0pJqSWwjEHigHFyJJkg Cxhdo9FDlM6yTWZbfxNKiKiequQhw47DwDqepmKyBAMQRh+BxGg/cOY3WaEtQVq1iKrQ OZAGQJGF089rLKzyg7SRGnl7Y7UiB92Lib0aZUviTF+O9JMbF1Sx3bPGOP7Mkhv45GYa /tzeP11u4hVFzeJ8Jq88DzMtmU5X83ZeshCx4UqFFGAL4id5Im4+5Yz5K1u8YcBVvJFr neo47DtSpYaIaUwm2jSFHOfeVe4+6PtSGbkXvUZLkFEXzWcWHyH1IcorCHPPump1Q/HO yx+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348625; x=1730953425; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gg/KjteIAWlAAHvFgfAU18N2daxBJnjbpffs+ITquTk=; b=wNOYlIxdLZfPrwr8jE4sCtQM3nLaTHoS33DTw/l9oCkwD6z1xq63gRZfe+Xr+EobP/ jH96g8lDM1/mxvn1iCek8N5/xUmojUEbR4OnQhi6yz84I/zxmA5vXCoypWnyeaHAa1gK 1roc3Of40SsYx80nLkRaM+g87bOFrHJASpGtyiepHJ5tOKU9shgsDKTevFovB9qQrKvX X8W9PQdoM3cCTbOmw2NVq6Wn2AzM2FvZSb+DM/jY+MlWLLyTDulXMpERNdr7BkejmPE8 1ist1TiPRT/nxAB/Rx0B5XW0k4m03dnVrgSNTIAZaU7JG5Ceby5hMHtkRvaUJTXHCNCJ dXmA== X-Gm-Message-State: AOJu0YwLQnCoLq9ggsWMOqLFrzo/Lc2Fc2sZujSclr5P7cmuf1bbB8FI zBI7oNyiMUVmCvJyLmg5XMQtLEW+/Fqc6I9PiIWhNNKPutpS0kvrkmerW6ZCs4i7S8bhPaLtsjO j X-Received: by 2002:a2e:5149:0:b0:2fc:9869:2e14 with SMTP id 38308e7fff4ca-2fd0df91bb1mr21104061fa.45.1730348624792; Wed, 30 Oct 2024 21:23:44 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef617ad0sm930571fa.67.2024.10.30.21.23.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:23:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 08/14] target/mips: Convert Loongson [D]DIVU.G opcodes to decodetree Date: Thu, 31 Oct 2024 01:21:24 -0300 Message-ID: <20241031042130.98450-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=philmd@linaro.org; helo=mail-lj1-x232.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Convert DIVU.G (divide 32-bit unsigned integers) and DDIVU.G (divide 64-bit unsigned integers) opcodes to decodetree. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20241026175349.84523-7-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/godson2.decode | 2 ++ target/mips/tcg/loong-ext.decode | 2 ++ target/mips/tcg/loong_translate.c | 54 +++++++++++++++++++++++++++++++ target/mips/tcg/translate.c | 37 --------------------- 4 files changed, 58 insertions(+), 37 deletions(-) diff --git a/target/mips/tcg/godson2.decode b/target/mips/tcg/godson2.decode index cbf24ed88da..581cb9c8608 100644 --- a/target/mips/tcg/godson2.decode +++ b/target/mips/tcg/godson2.decode @@ -14,4 +14,6 @@ @rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv DIV_G 011111 ..... ..... ..... 00000 011010 @rs_rt_rd +DIVU_G 011111 ..... ..... ..... 00000 011011 @rs_rt_rd DDIV_G 011111 ..... ..... ..... 00000 011110 @rs_rt_rd +DDIVU_G 011111 ..... ..... ..... 00000 011111 @rs_rt_rd diff --git a/target/mips/tcg/loong-ext.decode b/target/mips/tcg/loong-ext.decode index 9397606beb6..e222167af56 100644 --- a/target/mips/tcg/loong-ext.decode +++ b/target/mips/tcg/loong-ext.decode @@ -16,3 +16,5 @@ DIV_G 011100 ..... ..... ..... 00000 010100 @rs_rt_rd DDIV_G 011100 ..... ..... ..... 00000 010101 @rs_rt_rd +DIVU_G 011100 ..... ..... ..... 00000 010110 @rs_rt_rd +DDIVU_G 011100 ..... ..... ..... 00000 010111 @rs_rt_rd diff --git a/target/mips/tcg/loong_translate.c b/target/mips/tcg/loong_translate.c index 7c405078795..903d242e7cc 100644 --- a/target/mips/tcg/loong_translate.c +++ b/target/mips/tcg/loong_translate.c @@ -87,6 +87,60 @@ static bool trans_DDIV_G(DisasContext *s, arg_muldiv *a) return gen_lext_DIV_G(s, a->rt, a->rs, a->rd, true); } +static bool gen_lext_DIVU_G(DisasContext *s, int rd, int rs, int rt, + bool is_double) +{ + TCGv t0, t1; + TCGLabel *l1, *l2; + + if (is_double) { + if (TARGET_LONG_BITS != 64) { + return false; + } + check_mips_64(s); + } + + if (rd == 0) { + /* Treat as NOP. */ + return true; + } + + t0 = tcg_temp_new(); + t1 = tcg_temp_new(); + l1 = gen_new_label(); + l2 = gen_new_label(); + + gen_load_gpr(t0, rs); + gen_load_gpr(t1, rt); + + if (!is_double) { + tcg_gen_ext32u_tl(t0, t0); + tcg_gen_ext32u_tl(t1, t1); + } + tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); + tcg_gen_movi_tl(cpu_gpr[rd], 0); + + tcg_gen_br(l2); + gen_set_label(l1); + tcg_gen_divu_tl(cpu_gpr[rd], t0, t1); + if (!is_double) { + tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); + } + gen_set_label(l2); + + return true; +} + +static bool trans_DIVU_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_DIVU_G(s, a->rt, a->rs, a->rd, false); +} + +static bool trans_DDIVU_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_DIVU_G(s, a->rt, a->rs, a->rd, true); +} + bool decode_ext_loongson(DisasContext *ctx, uint32_t insn) { if (!decode_64bit_enabled(ctx)) { diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 1c38e893d31..53bbbb761f8 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -332,8 +332,6 @@ enum { OPC_DMULT_G_2F = 0x11 | OPC_SPECIAL2, OPC_MULTU_G_2F = 0x12 | OPC_SPECIAL2, OPC_DMULTU_G_2F = 0x13 | OPC_SPECIAL2, - OPC_DIVU_G_2F = 0x16 | OPC_SPECIAL2, - OPC_DDIVU_G_2F = 0x17 | OPC_SPECIAL2, OPC_MOD_G_2F = 0x1c | OPC_SPECIAL2, OPC_DMOD_G_2F = 0x1d | OPC_SPECIAL2, OPC_MODU_G_2F = 0x1e | OPC_SPECIAL2, @@ -369,10 +367,8 @@ enum { /* Loongson 2E */ OPC_MULT_G_2E = 0x18 | OPC_SPECIAL3, OPC_MULTU_G_2E = 0x19 | OPC_SPECIAL3, - OPC_DIVU_G_2E = 0x1B | OPC_SPECIAL3, OPC_DMULT_G_2E = 0x1C | OPC_SPECIAL3, OPC_DMULTU_G_2E = 0x1D | OPC_SPECIAL3, - OPC_DDIVU_G_2E = 0x1F | OPC_SPECIAL3, OPC_MOD_G_2E = 0x22 | OPC_SPECIAL3, OPC_MODU_G_2E = 0x23 | OPC_SPECIAL3, OPC_DMOD_G_2E = 0x26 | OPC_SPECIAL3, @@ -3611,22 +3607,6 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); break; - case OPC_DIVU_G_2E: - case OPC_DIVU_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - tcg_gen_ext32u_tl(t0, t0); - tcg_gen_ext32u_tl(t1, t1); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_divu_tl(cpu_gpr[rd], t0, t1); - tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); - gen_set_label(l2); - } - break; case OPC_MOD_G_2E: case OPC_MOD_G_2F: { @@ -3672,19 +3652,6 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, case OPC_DMULTU_G_2F: tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); break; - case OPC_DDIVU_G_2E: - case OPC_DDIVU_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_divu_tl(cpu_gpr[rd], t0, t1); - gen_set_label(l2); - } - break; case OPC_DMOD_G_2E: case OPC_DMOD_G_2F: { @@ -13574,7 +13541,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) case OPC_MUL: gen_arith(ctx, op1, rd, rs, rt); break; - case OPC_DIVU_G_2F: case OPC_MULT_G_2F: case OPC_MULTU_G_2F: case OPC_MOD_G_2F: @@ -13608,7 +13574,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) break; case OPC_DMULT_G_2F: case OPC_DMULTU_G_2F: - case OPC_DDIVU_G_2F: case OPC_DMOD_G_2F: case OPC_DMODU_G_2F: check_insn(ctx, INSN_LOONGSON2F | ASE_LEXT); @@ -13746,7 +13711,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) op1 = MASK_SPECIAL3(ctx->opcode); switch (op1) { - case OPC_DIVU_G_2E: case OPC_MOD_G_2E: case OPC_MODU_G_2E: case OPC_MULT_G_2E: @@ -14013,7 +13977,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) } break; #if defined(TARGET_MIPS64) - case OPC_DDIVU_G_2E: case OPC_DMULT_G_2E: case OPC_DMULTU_G_2E: case OPC_DMOD_G_2E: From patchwork Thu Oct 31 04:21:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839869 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp83944wrb; Wed, 30 Oct 2024 21:24:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXT/GjUNi8A6XRvPNi0dO7X5+Hf9HJnFqyjAGAcKqIh5icYujLDDTOLGi/oVlwq7rT/fEXQw==@linaro.org X-Google-Smtp-Source: AGHT+IHE21O5NR0cU0T9oACSNtIFjDJ5xVn7Bmld1cCdsMf9tpCJhk8760uvn8BF/sf9MK8UTnJk X-Received: by 2002:a05:620a:1724:b0:7b1:5424:e994 with SMTP id af79cd13be357-7b193eed5d0mr3076466885a.26.1730348646130; Wed, 30 Oct 2024 21:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348646; cv=none; d=google.com; s=arc-20240605; b=QAoMAIEeAECQBTgTL3U3n5LzoOdRlB1YnCUq5jwPI2sjD4cjjosXHo2xaNgmMtyuUj s9SABqFZu1+rGpSslgaWClfREAxhRBvpcl4mZmDYpAF7YuHfzKdVwMBFdwpO4+4E9mH3 nuGqHCaSLDZj/wpMyCoB1HPC7MNtkBLiG/9C6+4wAbDTv8zQXl53M2MbTA3eVhMTzrIn eT3Dc7PpjzeAAY++c6dTzq9RI2r6iueL7yW2DH0JRo73axb69NXv52pY29a7izNPGeco NyvJYxebhJYsIsaaw1dwCyizcWeqdfS2F0V1CE97SuvyFacVlqGAlt3GmBlImyhb7ofn MqDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2JQgKf1pXUp6GzMNahtXpqXpsHcnuvGEOWbJU3l+Jas=; fh=KIfLbk2hkPD5GhSdpV+cNrAHo/qG7XpVtXfxvzRZE4k=; b=COfA9KKNeMDNaNKDsNNVbovxWJsdrE/A0uhJacbI5UOCaR3Nes9SpTrp7naUcb2TvK 7JNsXmSlJ9kfzaufvsglJsxMn/97nw5oTj6UpJ1NmCZ2cHGjtB/1whPJDX4gYUEsyrCj 6tpCnaiJp3cvqdfJK6+YBPVfIuVcS3FNbDoMXmIkr10tWxyr/YO0sawZhXpDFj6M2Mg4 DbPFaMKSq+jHhrRp4a1IJ6wz+xCbWeEN40ObO4VBIqdbj4yNYVM2hpzl5qIy6iKYWNaO UlDPjoMkXQU0GDZDW++IS7U38cmua3oA3tNtOTxT7sGsVHDVp/IR5aGnHniYRx2dOPE3 GMiw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DhRWBdst; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b2f3a8148csi98307685a.358.2024.10.30.21.24.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:24:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DhRWBdst; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mj6-0002lj-Tc; Thu, 31 Oct 2024 00:24:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mj5-0002l4-RJ for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:03 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mj3-0006vH-O8 for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:03 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-539e3f35268so590668e87.3 for ; Wed, 30 Oct 2024 21:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348639; x=1730953439; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2JQgKf1pXUp6GzMNahtXpqXpsHcnuvGEOWbJU3l+Jas=; b=DhRWBdstxI4zpB0htzfyq8umeI7Lbx0Tn1IEkULA+yQYSogs2Cac+Ml+dqZkULjglo S0x/eky5Jrn3l/GVVIV/bPCyzYDTwy7TZCy5Sm/Kg/huYZ2zBdE4kGusI2sj5XP5/wbn 1bBd+2krE9dZnYAPvlo6iiC5lRPR6Wr1HmKX9P6kSdGPWU21L/UeXst9lWJJUDdtKyMq JHK43o7xD/3Nz7y7EPPB5v1FpTQDFNKD7CKoUqeAXt+Vt8iLi6xeUMx3TXo+JNwlFEQK zYyuWYd1HGKhURORQT7cWgsW6xamVkSw+mids+QRDtTyq+2wha/Uog1HuhsYOFxpPueT 3q+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348639; x=1730953439; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2JQgKf1pXUp6GzMNahtXpqXpsHcnuvGEOWbJU3l+Jas=; b=HzMkEVucpKFTaOYO8mv7UvhW7VZytfcKyKvDhLz7sTjmIZjopjs508WvDL7vd99f1r JZlZslecmvt0todL1JDjlTD3wcNGHpA907IPK41ADDvatdZpbkBeW45Dhe+Ar1x+8OSf PR20B6g8L9kkXcUjbMm+oR4Aw1Y2zHld3RQSCQhi7V9CHyFNf15siNyyPIQuUQmZq6Uv JKcM/roEo0W5SBwU3MN8TBZsvbZF69D5mz8hWgt8RdewhQQpwm8smyfvNyiKbcIdcEFM IWvLI0cPlntolawX04msCykFzmMC8w2+NL213huVCMm2WuV/qf1li3Sv7+AeHW8J5dv0 sq/A== X-Gm-Message-State: AOJu0YyKr9YoT3CgxnSENMina+80mXjRLNPBD4JT4VPi+o89etlS94Gg p8ipXPDIIic2eQI846qhrrUX5WGR2MAYg48Dkn8PCyIEc4BAj5aHZ4ktCrvzBoa4ss+s5JVDkF9 / X-Received: by 2002:a05:6512:3ba7:b0:536:796b:4d94 with SMTP id 2adb3069b0e04-53b3491cf63mr8764344e87.41.1730348639307; Wed, 30 Oct 2024 21:23:59 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bc9bddasm78321e87.64.2024.10.30.21.23.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:23:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 09/14] target/mips: Convert Loongson [D]MOD[U].G opcodes to decodetree Date: Thu, 31 Oct 2024 01:21:25 -0300 Message-ID: <20241031042130.98450-10-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=philmd@linaro.org; helo=mail-lf1-x135.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Convert the following opcodes to decodetree: - MOD.G - mod 32-bit signed integers - MODU.G - mod 32-bit unsigned integers - DMOD.G - mod 64-bit signed integers - DMODU.G - mod 64-bit unsigned integers Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20241026175349.84523-8-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/godson2.decode | 5 ++ target/mips/tcg/loong-ext.decode | 5 ++ target/mips/tcg/loong_translate.c | 111 ++++++++++++++++++++++++++++++ target/mips/tcg/translate.c | 82 ---------------------- 4 files changed, 121 insertions(+), 82 deletions(-) diff --git a/target/mips/tcg/godson2.decode b/target/mips/tcg/godson2.decode index 581cb9c8608..c03c8b717d9 100644 --- a/target/mips/tcg/godson2.decode +++ b/target/mips/tcg/godson2.decode @@ -17,3 +17,8 @@ DIV_G 011111 ..... ..... ..... 00000 011010 @rs_rt_rd DIVU_G 011111 ..... ..... ..... 00000 011011 @rs_rt_rd DDIV_G 011111 ..... ..... ..... 00000 011110 @rs_rt_rd DDIVU_G 011111 ..... ..... ..... 00000 011111 @rs_rt_rd + +MOD_G 011111 ..... ..... ..... 00000 100010 @rs_rt_rd +MODU_G 011111 ..... ..... ..... 00000 100011 @rs_rt_rd +DMOD_G 011111 ..... ..... ..... 00000 100110 @rs_rt_rd +DMODU_G 011111 ..... ..... ..... 00000 100111 @rs_rt_rd diff --git a/target/mips/tcg/loong-ext.decode b/target/mips/tcg/loong-ext.decode index e222167af56..f0fd36c9218 100644 --- a/target/mips/tcg/loong-ext.decode +++ b/target/mips/tcg/loong-ext.decode @@ -18,3 +18,8 @@ DIV_G 011100 ..... ..... ..... 00000 010100 @rs_rt_rd DDIV_G 011100 ..... ..... ..... 00000 010101 @rs_rt_rd DIVU_G 011100 ..... ..... ..... 00000 010110 @rs_rt_rd DDIVU_G 011100 ..... ..... ..... 00000 010111 @rs_rt_rd + +MOD_G 011100 ..... ..... ..... 00000 011100 @rs_rt_rd +DMOD_G 011100 ..... ..... ..... 00000 011101 @rs_rt_rd +MODU_G 011100 ..... ..... ..... 00000 011110 @rs_rt_rd +DMODU_G 011100 ..... ..... ..... 00000 011111 @rs_rt_rd diff --git a/target/mips/tcg/loong_translate.c b/target/mips/tcg/loong_translate.c index 903d242e7cc..76c1a8cef2d 100644 --- a/target/mips/tcg/loong_translate.c +++ b/target/mips/tcg/loong_translate.c @@ -141,6 +141,117 @@ static bool trans_DDIVU_G(DisasContext *s, arg_muldiv *a) return gen_lext_DIVU_G(s, a->rt, a->rs, a->rd, true); } +static bool gen_lext_MOD_G(DisasContext *s, int rd, int rs, int rt, + bool is_double) +{ + TCGv t0, t1; + TCGLabel *l1, *l2, *l3; + + if (is_double) { + if (TARGET_LONG_BITS != 64) { + return false; + } + check_mips_64(s); + } + + if (rd == 0) { + /* Treat as NOP. */ + return true; + } + + t0 = tcg_temp_new(); + t1 = tcg_temp_new(); + l1 = gen_new_label(); + l2 = gen_new_label(); + l3 = gen_new_label(); + + gen_load_gpr(t0, rs); + gen_load_gpr(t1, rt); + + if (!is_double) { + tcg_gen_ext32u_tl(t0, t0); + tcg_gen_ext32u_tl(t1, t1); + } + tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); + tcg_gen_brcondi_tl(TCG_COND_NE, t0, is_double && TARGET_LONG_BITS == 64 + ? LLONG_MIN : INT_MIN, l2); + tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); + gen_set_label(l1); + tcg_gen_movi_tl(cpu_gpr[rd], 0); + tcg_gen_br(l3); + gen_set_label(l2); + tcg_gen_rem_tl(cpu_gpr[rd], t0, t1); + if (!is_double) { + tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); + } + gen_set_label(l3); + + return true; +} + +static bool trans_MOD_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_MOD_G(s, a->rt, a->rs, a->rd, false); +} + +static bool trans_DMOD_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_MOD_G(s, a->rt, a->rs, a->rd, true); +} + +static bool gen_lext_MODU_G(DisasContext *s, int rd, int rs, int rt, + bool is_double) +{ + TCGv t0, t1; + TCGLabel *l1, *l2; + + if (is_double) { + if (TARGET_LONG_BITS != 64) { + return false; + } + check_mips_64(s); + } + + if (rd == 0) { + /* Treat as NOP. */ + return true; + } + + t0 = tcg_temp_new(); + t1 = tcg_temp_new(); + l1 = gen_new_label(); + l2 = gen_new_label(); + + gen_load_gpr(t0, rs); + gen_load_gpr(t1, rt); + + if (!is_double) { + tcg_gen_ext32u_tl(t0, t0); + tcg_gen_ext32u_tl(t1, t1); + } + tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); + tcg_gen_movi_tl(cpu_gpr[rd], 0); + tcg_gen_br(l2); + gen_set_label(l1); + tcg_gen_remu_tl(cpu_gpr[rd], t0, t1); + if (!is_double) { + tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); + } + gen_set_label(l2); + + return true; +} + +static bool trans_MODU_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_MODU_G(s, a->rt, a->rs, a->rd, false); +} + +static bool trans_DMODU_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_MODU_G(s, a->rt, a->rs, a->rd, true); +} + bool decode_ext_loongson(DisasContext *ctx, uint32_t insn) { if (!decode_64bit_enabled(ctx)) { diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 53bbbb761f8..4abc30a6a5f 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -332,10 +332,6 @@ enum { OPC_DMULT_G_2F = 0x11 | OPC_SPECIAL2, OPC_MULTU_G_2F = 0x12 | OPC_SPECIAL2, OPC_DMULTU_G_2F = 0x13 | OPC_SPECIAL2, - OPC_MOD_G_2F = 0x1c | OPC_SPECIAL2, - OPC_DMOD_G_2F = 0x1d | OPC_SPECIAL2, - OPC_MODU_G_2F = 0x1e | OPC_SPECIAL2, - OPC_DMODU_G_2F = 0x1f | OPC_SPECIAL2, /* Misc */ OPC_CLZ = 0x20 | OPC_SPECIAL2, OPC_CLO = 0x21 | OPC_SPECIAL2, @@ -369,10 +365,6 @@ enum { OPC_MULTU_G_2E = 0x19 | OPC_SPECIAL3, OPC_DMULT_G_2E = 0x1C | OPC_SPECIAL3, OPC_DMULTU_G_2E = 0x1D | OPC_SPECIAL3, - OPC_MOD_G_2E = 0x22 | OPC_SPECIAL3, - OPC_MODU_G_2E = 0x23 | OPC_SPECIAL3, - OPC_DMOD_G_2E = 0x26 | OPC_SPECIAL3, - OPC_DMODU_G_2E = 0x27 | OPC_SPECIAL3, /* MIPS DSP Load */ OPC_LX_DSP = 0x0A | OPC_SPECIAL3, @@ -3607,42 +3599,6 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); break; - case OPC_MOD_G_2E: - case OPC_MOD_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - TCGLabel *l3 = gen_new_label(); - tcg_gen_ext32u_tl(t0, t0); - tcg_gen_ext32u_tl(t1, t1); - tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); - tcg_gen_brcondi_tl(TCG_COND_NE, t0, INT_MIN, l2); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1, l2); - gen_set_label(l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l3); - gen_set_label(l2); - tcg_gen_rem_tl(cpu_gpr[rd], t0, t1); - tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); - gen_set_label(l3); - } - break; - case OPC_MODU_G_2E: - case OPC_MODU_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - tcg_gen_ext32u_tl(t0, t0); - tcg_gen_ext32u_tl(t1, t1); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_remu_tl(cpu_gpr[rd], t0, t1); - tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); - gen_set_label(l2); - } - break; #if defined(TARGET_MIPS64) case OPC_DMULT_G_2E: case OPC_DMULT_G_2F: @@ -3652,36 +3608,6 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, case OPC_DMULTU_G_2F: tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); break; - case OPC_DMOD_G_2E: - case OPC_DMOD_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - TCGLabel *l3 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); - tcg_gen_brcondi_tl(TCG_COND_NE, t0, -1LL << 63, l2); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); - gen_set_label(l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l3); - gen_set_label(l2); - tcg_gen_rem_tl(cpu_gpr[rd], t0, t1); - gen_set_label(l3); - } - break; - case OPC_DMODU_G_2E: - case OPC_DMODU_G_2F: - { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1); - tcg_gen_movi_tl(cpu_gpr[rd], 0); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_remu_tl(cpu_gpr[rd], t0, t1); - gen_set_label(l2); - } - break; #endif } } @@ -13543,8 +13469,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) break; case OPC_MULT_G_2F: case OPC_MULTU_G_2F: - case OPC_MOD_G_2F: - case OPC_MODU_G_2F: check_insn(ctx, INSN_LOONGSON2F | ASE_LEXT); gen_loongson_integer(ctx, op1, rd, rs, rt); break; @@ -13574,8 +13498,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) break; case OPC_DMULT_G_2F: case OPC_DMULTU_G_2F: - case OPC_DMOD_G_2F: - case OPC_DMODU_G_2F: check_insn(ctx, INSN_LOONGSON2F | ASE_LEXT); gen_loongson_integer(ctx, op1, rd, rs, rt); break; @@ -13711,8 +13633,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) op1 = MASK_SPECIAL3(ctx->opcode); switch (op1) { - case OPC_MOD_G_2E: - case OPC_MODU_G_2E: case OPC_MULT_G_2E: case OPC_MULTU_G_2E: /* @@ -13979,8 +13899,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) #if defined(TARGET_MIPS64) case OPC_DMULT_G_2E: case OPC_DMULTU_G_2E: - case OPC_DMOD_G_2E: - case OPC_DMODU_G_2E: check_insn(ctx, INSN_LOONGSON2E); gen_loongson_integer(ctx, op1, rd, rs, rt); break; From patchwork Thu Oct 31 04:21:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839870 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp84053wrb; Wed, 30 Oct 2024 21:24:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWfFqgWo5h6VWKPQrYOh3F7+1yeqi2Gxtv5meXpAgxZHsUIs77OrYYDY9zudxN2m/nkaTJwFQ==@linaro.org X-Google-Smtp-Source: AGHT+IFHTImINY4VDi6pEN4BCQsy9+HRxo8jBvU8JeZBIqggTnL7TfQftAF/6gFIsPVpdY91pFV4 X-Received: by 2002:a05:6102:510c:b0:4a4:87f8:f414 with SMTP id ada2fe7eead31-4a8cfb25ab2mr18632427137.6.1730348671228; Wed, 30 Oct 2024 21:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348671; cv=none; d=google.com; s=arc-20240605; b=gl5Eo/27LjqvFqispoqk4Ccivr7ptMyaqJ9i2V1E9XFI09LB7n2/yvlhoQ4BgECK/g a6/I2gBql8djarRbEUH0gAytIH759202L2+SODtdZuFqPhA70lIadak5VV6nYJOUdBnb E4ZxMZ1nRrjkSfg+sjOHqZh3mx/dSbwdM/GSS48LqBNM42ijbnr6Kj1mkqJdyZJFsSbZ QZST8sTpoXdmq0fNtTovRPZXDV77NeSqy4kQyrc8agm3PHXmIPFdJAsIKuZHyyrntJ1i /C1UP0Yv0KMjKsTrk9nYeLRFmRT0iVAg/iE4T3gEkafjzbJvzV/f1C65ys3NCdLNebIh jAdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qX8dxvfJ08Ht6ngTOZkjTn6eoR1ftxPI6Vog6jbJNpU=; fh=KIfLbk2hkPD5GhSdpV+cNrAHo/qG7XpVtXfxvzRZE4k=; b=UmO5wymZwumjr0WqhKbooUISzE+4U+BVanGyCeyF56NvkWGNXj2uJrvt3ZsZsbpOHU Ylz5eymO0ORLOrTXD9eTkShaXyTJ4GtjGe27Mcmmf13mv4Jvsf97oDOkz93cvTOK/bQb 5sbAHiZGGR58cW3+pkj6vOgf+a+0A637IIZVY12KPBiSuVDRPKv9cttwCSiaHIcQ0ETk 0PCgHZu0e2Ufru24wT50YAJAVjYt7pycTdT6XmLOPNVNbwNcukzI49GxIcdJs6H/gbeK gt8WfNH/jY40DnuQYImtJp3CyfUKhhkuXCgJGgT5uGl2k+4jMGPLOcxqcCwyYdkSXEJ9 EU7w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yfxlsakM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad0b178bsi8646431cf.107.2024.10.30.21.24.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yfxlsakM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6MjR-0003HO-2l; Thu, 31 Oct 2024 00:24:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6MjL-00039E-Ie for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:19 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6MjJ-0006w1-EJ for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:19 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2fb51e00c05so7321781fa.0 for ; Wed, 30 Oct 2024 21:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348654; x=1730953454; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qX8dxvfJ08Ht6ngTOZkjTn6eoR1ftxPI6Vog6jbJNpU=; b=yfxlsakMznNAQ04Ra6a1Pjliv1B2/tROk/upBSY1aQ1vLvBuczCiSiNhtUDXYtLH9i bryh7jAyhS55IyZQ3fL3WYFbtLFwg/SEiJ1OC1JuJqS6FYyAK0AI3b78LQflumQU/+9A UcWMdNFCfwA4ay6T5hoiAgXkGLy1KISdEsOEhaPh1NGJTfsIbcJ+ELFfE+k0Al9hLB6r hJfxYA42BxNvHRLcn7mmnliagP7OYr/H8ex0atCE82hnkk53kjFCAO4CaMRrHgzvQmjC HMVN+uBbFRvYY8JG9fwE3HtcbAtWOeRITIl+W1J1HVlhcdxUmGv2SN876XjA6mnVDt+W voLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348654; x=1730953454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qX8dxvfJ08Ht6ngTOZkjTn6eoR1ftxPI6Vog6jbJNpU=; b=DH08JFp61MsDp+l3akBwTL9P5Yp0OEqEd3XwG3+xW4avgyPHEhDBlDrAnUlOsyNtaM YhT7/83UscP59yGbu9lP1D9q9paXvYHuVl5Dbfy8J9GWMOWoQZY29PXZ56mKprgpYOUj 7KKG/bkZPRaXoQOMDEOds1H0EL4rlCSwLvFNoFsehb2+N7LvftVbhPdlSpGspL6w32iC kguQNJZ/dJUSLRvi8+WqA1LYuskRFQBoAnhj2UBOnZ3KOwi1bxroSw60zMu4d1exRkFl +j5njesBRBiOdNnq0eeXCgS068r2bdRrL3Sq9l4ewxDDXJJdCjyKBSa0ou4MXvHA3M4e vyzw== X-Gm-Message-State: AOJu0YxNQDGQhQ9ckp9fdkSKSWlYOjxeVOfIjL3QdAWjc1BYbAy59uRK +PIL0UYMmRFFe4vjppPSRIoi2pekZ1nw++VXoKWtCJb41XlCrvnV9hKK1B8IclHZEIrOwOhLRc6 y X-Received: by 2002:a05:6512:224b:b0:531:8f2f:8ae7 with SMTP id 2adb3069b0e04-53b348dac70mr13710657e87.25.1730348654184; Wed, 30 Oct 2024 21:24:14 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bde3a47sm75604e87.291.2024.10.30.21.24.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:24:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 10/14] target/mips: Convert Loongson [D]MULT[U].G opcodes to decodetree Date: Thu, 31 Oct 2024 01:21:26 -0300 Message-ID: <20241031042130.98450-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=philmd@linaro.org; helo=mail-lj1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Convert the following opcodes to decodetree: - MULT.G - multiply 32-bit signed integers - MULTU.G - multiply 32-bit unsigned integers - DMULT.G - multiply 64-bit signed integers - DMULTU.G - multiply 64-bit unsigned integers Now that all opcodes from the extension have been converted, we can remove completely gen_loongson_integer() and its 2 calls in decode_opc_special2_legacy() and decode_opc_special3_legacy(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20241026175349.84523-9-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/godson2.decode | 3 ++ target/mips/tcg/loong-ext.decode | 3 ++ target/mips/tcg/loong_translate.c | 41 +++++++++++++++++ target/mips/tcg/translate.c | 73 +------------------------------ 4 files changed, 49 insertions(+), 71 deletions(-) diff --git a/target/mips/tcg/godson2.decode b/target/mips/tcg/godson2.decode index c03c8b717d9..25b396b6822 100644 --- a/target/mips/tcg/godson2.decode +++ b/target/mips/tcg/godson2.decode @@ -13,6 +13,9 @@ @rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv +MULTu_G 011111 ..... ..... ..... 00000 01100- @rs_rt_rd +DMULTu_G 011111 ..... ..... ..... 00000 01110- @rs_rt_rd + DIV_G 011111 ..... ..... ..... 00000 011010 @rs_rt_rd DIVU_G 011111 ..... ..... ..... 00000 011011 @rs_rt_rd DDIV_G 011111 ..... ..... ..... 00000 011110 @rs_rt_rd diff --git a/target/mips/tcg/loong-ext.decode b/target/mips/tcg/loong-ext.decode index f0fd36c9218..b43979d0ef5 100644 --- a/target/mips/tcg/loong-ext.decode +++ b/target/mips/tcg/loong-ext.decode @@ -14,6 +14,9 @@ @rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv +MULTu_G 011100 ..... ..... ..... 00000 0100-0 @rs_rt_rd +DMULTu_G 011100 ..... ..... ..... 00000 0100-1 @rs_rt_rd + DIV_G 011100 ..... ..... ..... 00000 010100 @rs_rt_rd DDIV_G 011100 ..... ..... ..... 00000 010101 @rs_rt_rd DIVU_G 011100 ..... ..... ..... 00000 010110 @rs_rt_rd diff --git a/target/mips/tcg/loong_translate.c b/target/mips/tcg/loong_translate.c index 76c1a8cef2d..c02e60bb15b 100644 --- a/target/mips/tcg/loong_translate.c +++ b/target/mips/tcg/loong_translate.c @@ -252,6 +252,47 @@ static bool trans_DMODU_G(DisasContext *s, arg_muldiv *a) return gen_lext_MODU_G(s, a->rt, a->rs, a->rd, true); } +static bool gen_lext_MULT_G(DisasContext *s, int rd, int rs, int rt, + bool is_double) +{ + TCGv t0, t1; + + if (is_double) { + if (TARGET_LONG_BITS != 64) { + return false; + } + check_mips_64(s); + } + + if (rd == 0) { + /* Treat as NOP. */ + return true; + } + + t0 = tcg_temp_new(); + t1 = tcg_temp_new(); + + gen_load_gpr(t0, rs); + gen_load_gpr(t1, rt); + + tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); + if (!is_double) { + tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); + } + + return true; +} + +static bool trans_MULTu_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_MULT_G(s, a->rt, a->rs, a->rd, false); +} + +static bool trans_DMULTu_G(DisasContext *s, arg_muldiv *a) +{ + return gen_lext_MULT_G(s, a->rt, a->rs, a->rd, true); +} + bool decode_ext_loongson(DisasContext *ctx, uint32_t insn) { if (!decode_64bit_enabled(ctx)) { diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 4abc30a6a5f..2d01f5c4a8b 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -327,11 +327,6 @@ enum { OPC_MUL = 0x02 | OPC_SPECIAL2, OPC_MSUB = 0x04 | OPC_SPECIAL2, OPC_MSUBU = 0x05 | OPC_SPECIAL2, - /* Loongson 2F */ - OPC_MULT_G_2F = 0x10 | OPC_SPECIAL2, - OPC_DMULT_G_2F = 0x11 | OPC_SPECIAL2, - OPC_MULTU_G_2F = 0x12 | OPC_SPECIAL2, - OPC_DMULTU_G_2F = 0x13 | OPC_SPECIAL2, /* Misc */ OPC_CLZ = 0x20 | OPC_SPECIAL2, OPC_CLO = 0x21 | OPC_SPECIAL2, @@ -360,12 +355,6 @@ enum { OPC_RDHWR = 0x3B | OPC_SPECIAL3, OPC_GINV = 0x3D | OPC_SPECIAL3, - /* Loongson 2E */ - OPC_MULT_G_2E = 0x18 | OPC_SPECIAL3, - OPC_MULTU_G_2E = 0x19 | OPC_SPECIAL3, - OPC_DMULT_G_2E = 0x1C | OPC_SPECIAL3, - OPC_DMULTU_G_2E = 0x1D | OPC_SPECIAL3, - /* MIPS DSP Load */ OPC_LX_DSP = 0x0A | OPC_SPECIAL3, /* MIPS DSP Arithmetic */ @@ -3572,46 +3561,6 @@ static void gen_cl(DisasContext *ctx, uint32_t opc, } } -/* Godson integer instructions */ -static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, - int rd, int rs, int rt) -{ - TCGv t0, t1; - - if (rd == 0) { - /* Treat as NOP. */ - return; - } - - t0 = tcg_temp_new(); - t1 = tcg_temp_new(); - gen_load_gpr(t0, rs); - gen_load_gpr(t1, rt); - - switch (opc) { - case OPC_MULT_G_2E: - case OPC_MULT_G_2F: - tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); - tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); - break; - case OPC_MULTU_G_2E: - case OPC_MULTU_G_2F: - tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); - tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]); - break; -#if defined(TARGET_MIPS64) - case OPC_DMULT_G_2E: - case OPC_DMULT_G_2F: - tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); - break; - case OPC_DMULTU_G_2E: - case OPC_DMULTU_G_2F: - tcg_gen_mul_tl(cpu_gpr[rd], t0, t1); - break; -#endif - } -} - /* Loongson multimedia instructions */ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) { @@ -13467,11 +13416,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) case OPC_MUL: gen_arith(ctx, op1, rd, rs, rt); break; - case OPC_MULT_G_2F: - case OPC_MULTU_G_2F: - check_insn(ctx, INSN_LOONGSON2F | ASE_LEXT); - gen_loongson_integer(ctx, op1, rd, rs, rt); - break; case OPC_CLO: case OPC_CLZ: check_insn(ctx, ISA_MIPS_R1); @@ -13496,11 +13440,6 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) check_mips_64(ctx); gen_cl(ctx, op1, rd, rs); break; - case OPC_DMULT_G_2F: - case OPC_DMULTU_G_2F: - check_insn(ctx, INSN_LOONGSON2F | ASE_LEXT); - gen_loongson_integer(ctx, op1, rd, rs, rt); - break; #endif default: /* Invalid */ MIPS_INVAL("special2_legacy"); @@ -13633,10 +13572,9 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) op1 = MASK_SPECIAL3(ctx->opcode); switch (op1) { - case OPC_MULT_G_2E: - case OPC_MULTU_G_2E: + case OPC_MUL_PH_DSP: /* - * OPC_MULT_G_2E, OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have + * OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have * the same mask and op1. */ if ((ctx->insn_flags & ASE_DSP_R2) && (op1 == OPC_MUL_PH_DSP)) { @@ -13667,8 +13605,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) gen_reserved_instruction(ctx); break; } - } else if (ctx->insn_flags & INSN_LOONGSON2E) { - gen_loongson_integer(ctx, op1, rd, rs, rt); } else { gen_reserved_instruction(ctx); } @@ -13897,11 +13833,6 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx) } break; #if defined(TARGET_MIPS64) - case OPC_DMULT_G_2E: - case OPC_DMULTU_G_2E: - check_insn(ctx, INSN_LOONGSON2E); - gen_loongson_integer(ctx, op1, rd, rs, rt); - break; case OPC_ABSQ_S_QH_DSP: op2 = MASK_ABSQ_S_QH(ctx->opcode); switch (op2) { From patchwork Thu Oct 31 04:21:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839871 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp84097wrb; Wed, 30 Oct 2024 21:24:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUIOImK6G6ZZWji4RZlPwoFv87Lx12m1i0wUkv9UoVrmYjabjQWSRaBgPbxsBwgqJSIc4QxZw==@linaro.org X-Google-Smtp-Source: AGHT+IHMQwTVHU/HrC8IS30ZkBd45TpV767fkt9xxYsH3N/wlVzRnE+4Bh43F0JybpJfuPDwcxOb X-Received: by 2002:a05:6102:1627:b0:4a4:7980:b9c8 with SMTP id ada2fe7eead31-4a900e7f176mr7375892137.13.1730348681304; Wed, 30 Oct 2024 21:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348681; cv=none; d=google.com; s=arc-20240605; b=ZkWytuIDee60mHNxvtyMknwOLB73bVB6uxQo4e9dhRA53BLq64YWvhenRKbULfa/bj 8dtU5hN4ZDek/Q5ujUUCmBNXqznY1g3k88n+zrVn6K4lJWd2WclZeYFe7t7YOrjEReTC GchT8VSC0PRsARrq19U/qQJ8/m6Ku4LuqqXiORdRX7qqWvVDy8bO3fJedhaiL2jEX7rT Sda33indiLQF575WDVpo5vhkF6VMvrDO8ZGyNat5uSbDp9X68KOEsmUHYsfUH820XId1 ZlAr3umIqyw7CX9jSoqtN7CuD6rgFwvk3/EEsR+A1Ouq+4I2gg8Sqs3HBWpM8mOlXHsD 8q3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2x7E4EwIDP0iHX0TCLMI+ENpIXFIMAkBEanU5IejIg4=; fh=ZOEI4bjC5BR2ZQQDBiGKHpAsfXe7zC3VMY773pmcdus=; b=JAvYETrYDuguf30ZYRUIAR8i0cgn0bZwzFvfooGFyoSsF1MWT4X1NbGpiZ8/xeoU3x UpBMZO2z/bUm0EL3CGjPSWa7ekxfaAtBH2MRcSP4WGEf2L/09zEPBZKZuC87yHB4zDWc jMweFdm1wxihPLcQRb2HBbP4k1Mei0Av94XwoDq/t2hfK4yZuLHaWekXlsGfQGBnrN0J Zm23wbYBQs+7ct3afosoj3zcvuHy0/sIPqbrx4WH7s0/NzMy8Av9u0+eDjI8Cepq/Ux3 od3FWkf74ZDTCTBNatqub1v/JwG0RYeMsjseiKzqgNjpLANELPCZ7VuBzhwWAEcD6uZO 4y2w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VOP4QxQ6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad1b524fsi8503631cf.291.2024.10.30.21.24.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VOP4QxQ6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mjc-0003m6-Ll; Thu, 31 Oct 2024 00:24:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6MjY-0003eg-Sp for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:33 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6MjW-0006wW-Sz for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:32 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-539e4b7409fso527433e87.0 for ; Wed, 30 Oct 2024 21:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348668; x=1730953468; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2x7E4EwIDP0iHX0TCLMI+ENpIXFIMAkBEanU5IejIg4=; b=VOP4QxQ6MVfiE8+byr5XN67oenb/0IIMpNgO5RP8owfbZSomfPavpKjgCttgqbLSyI n/j+3pEQVEqLoK3G0sXEsnZ3Lxk/PP0k2gHqW9gS6lvJtx6vTyLjHt4Oedg1xG6Mupdu qCHBz+TTc3J6QeNu+kL71gOIuxnls+1d1RS5HA5683fyk31PugFRyx/FnStMXBP5CRRn Bx7InzqVY8ihVvyQXTBuiAUCIh7PKj6c3zsSdHbf+o7krycdVXa3T52cEMmbuqh6zaBz 1X5k7Re+1wSgQwEUkZYY1oqQ3xbeNqMLnhr3t4YvV9umyEtyZ0kcA9oZW9tAulFouc38 eZ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348668; x=1730953468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2x7E4EwIDP0iHX0TCLMI+ENpIXFIMAkBEanU5IejIg4=; b=jgSqFRxSYSo5uqsexZ0zLw/vb1UOzUrkqvMkX7HUM9l3oGz6a3/QWGfFHlWZdcwP3f CKT8U9U0IVFG4ZRnhHUAHffkbMj3aV+Vps6+0IBrBjbz4g0KLszup/jHyxjocv2crPzt fFWNmykuuK2GXcPJmkt6PagtvDkh9kYU0cKqvNhVmw/A5qFiskblsPSRbdfxPHO7ee39 BhL4pXWs+sA+7QAXOn/RvQrB/Rh6Z3a1Q9TNnK7iv3MRVP1c+If6iRO0ys47CRaN4lmT 7I14MCTrorXN6fwp5aJXAG9varoSoypz0yEIz9syixydcx4INdPR2qijUZr6K7LJqflT LkDA== X-Gm-Message-State: AOJu0YyB7sPEUcOLOZNytWOt4ewMGkUYe3IpfrG3xLxqhz8EdPgnj3e3 zQ0EfWI5onh1oAEW2eHuVbjJ4LXD7/N7TL+Q1eQP0J7IpMQP3MWPMIH4EQCOmX/n3T+WCeR/hvg j X-Received: by 2002:a05:6512:6c4:b0:539:fde9:4bca with SMTP id 2adb3069b0e04-53c7bc5b1fcmr210911e87.29.1730348668422; Wed, 30 Oct 2024 21:24:28 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bc9c070sm78302e87.84.2024.10.30.21.24.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:24:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Pierrick Bouvier Subject: [PULL 11/14] target/mips: Remove unreachable 32-bit code on 64-bit Loongson Ext Date: Thu, 31 Oct 2024 01:21:27 -0300 Message-ID: <20241031042130.98450-12-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=philmd@linaro.org; helo=mail-lf1-x135.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Loongson fixed-point multiplies and divisions opcodes are specific to 64-bit cores (Loongson-2 and Loongson-3 families). Simplify by removing the 32-bit checks. Reported-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Message-Id: <20241026175349.84523-10-philmd@linaro.org> --- target/mips/tcg/loong_translate.c | 41 ++----------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/target/mips/tcg/loong_translate.c b/target/mips/tcg/loong_translate.c index c02e60bb15b..a005c279a3e 100644 --- a/target/mips/tcg/loong_translate.c +++ b/target/mips/tcg/loong_translate.c @@ -31,13 +31,6 @@ static bool gen_lext_DIV_G(DisasContext *s, int rd, int rs, int rt, TCGv t0, t1; TCGLabel *l1, *l2, *l3; - if (is_double) { - if (TARGET_LONG_BITS != 64) { - return false; - } - check_mips_64(s); - } - if (rd == 0) { /* Treat as NOP. */ return true; @@ -61,8 +54,7 @@ static bool gen_lext_DIV_G(DisasContext *s, int rd, int rs, int rt, tcg_gen_br(l3); gen_set_label(l1); - tcg_gen_brcondi_tl(TCG_COND_NE, t0, is_double && TARGET_LONG_BITS == 64 - ? LLONG_MIN : INT_MIN, l2); + tcg_gen_brcondi_tl(TCG_COND_NE, t0, is_double ? LLONG_MIN : INT_MIN, l2); tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); tcg_gen_mov_tl(cpu_gpr[rd], t0); @@ -93,13 +85,6 @@ static bool gen_lext_DIVU_G(DisasContext *s, int rd, int rs, int rt, TCGv t0, t1; TCGLabel *l1, *l2; - if (is_double) { - if (TARGET_LONG_BITS != 64) { - return false; - } - check_mips_64(s); - } - if (rd == 0) { /* Treat as NOP. */ return true; @@ -147,13 +132,6 @@ static bool gen_lext_MOD_G(DisasContext *s, int rd, int rs, int rt, TCGv t0, t1; TCGLabel *l1, *l2, *l3; - if (is_double) { - if (TARGET_LONG_BITS != 64) { - return false; - } - check_mips_64(s); - } - if (rd == 0) { /* Treat as NOP. */ return true; @@ -173,8 +151,7 @@ static bool gen_lext_MOD_G(DisasContext *s, int rd, int rs, int rt, tcg_gen_ext32u_tl(t1, t1); } tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); - tcg_gen_brcondi_tl(TCG_COND_NE, t0, is_double && TARGET_LONG_BITS == 64 - ? LLONG_MIN : INT_MIN, l2); + tcg_gen_brcondi_tl(TCG_COND_NE, t0, is_double ? LLONG_MIN : INT_MIN, l2); tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); gen_set_label(l1); tcg_gen_movi_tl(cpu_gpr[rd], 0); @@ -205,13 +182,6 @@ static bool gen_lext_MODU_G(DisasContext *s, int rd, int rs, int rt, TCGv t0, t1; TCGLabel *l1, *l2; - if (is_double) { - if (TARGET_LONG_BITS != 64) { - return false; - } - check_mips_64(s); - } - if (rd == 0) { /* Treat as NOP. */ return true; @@ -257,13 +227,6 @@ static bool gen_lext_MULT_G(DisasContext *s, int rd, int rs, int rt, { TCGv t0, t1; - if (is_double) { - if (TARGET_LONG_BITS != 64) { - return false; - } - check_mips_64(s); - } - if (rd == 0) { /* Treat as NOP. */ return true; From patchwork Thu Oct 31 04:21:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839872 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp84152wrb; Wed, 30 Oct 2024 21:24:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWE78yBOM0p5kZMuV0wHiwdxaN+Tm+oftuXQyYNtB+QaUvNTVbBxUmuvK/wSXvFcNrV84bcRQ==@linaro.org X-Google-Smtp-Source: AGHT+IGjO28GwCqlYqS4xueR017pJbz9QakfyDvmzR7rBW8BhO7CqPrT2/vATLkTro2XV39vRKy7 X-Received: by 2002:a05:6214:5348:b0:6d3:4992:f585 with SMTP id 6a1803df08f44-6d34992f616mr58055496d6.49.1730348696496; Wed, 30 Oct 2024 21:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348696; cv=none; d=google.com; s=arc-20240605; b=QcIA5/UBAlPwwvs9VPXAMmM1WxqLhP4x596Qn3yqCIoXdA8opGM5uubgQL8LHtfnyH 88dVsA80NL3kriL2Ta22szJc+vuuxCgtxKQH3WuHbZYGuNX7eeidBuV/Ofr5rnzaa0c1 CzG/palsLUwLIAH2lCHB9NCnAYyw7buccJTj36APw1Q2GcuwGEAckckOglXyKjeNhium vlhl7l7Y+E+DoWTiXSyFy5mFwOnFjj9cBXNSm3vF8yK96+Xo9zv0ia3M/M91csDSHKEA KnQm+kD8wIlX11SY8hhv4L6LF9iF/gKgNQvqV0J6klTxDWw9r9eI9zoEfqv5A+610nfR IXfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HAp5Ln/TOaBbXfbAl+alUE9uLY3Kuq1n+bXOlaVNwGY=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=lzSS/fVblL4oFgd8qD6trUySgYlShHOgL0CDK/LHCD31/eUxCJDZlmHUf5zXWuVGpN K2pGTSL/qnzALKoSlw5K84AaBQU4pt/VBt5EY+TQvI+pUcWUbMq053NvZoW8NtreNlgx Lf7NmL1kQKPXxaD5lD9GuWQF6SbDSq78niU6U3rTj0GAsTJ3Dpn7uY6kvX4ya/6rEjZD 8oVG1a4aVwvSjDm0Kq81nmagOFOQc9MQDWNT3aElDvf06VvPCWfpQxreaIqra600mTgn 2rUFBOOEZ7NL96I3PDfcTQsCwPwALK5Ou3czVWd2rlixusEDkO5FlpMt06CuitBSwcQ1 OfHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vbJux36x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d3541801f7si8988926d6.378.2024.10.30.21.24.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vbJux36x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Mjq-00049B-71; Thu, 31 Oct 2024 00:24:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Mjn-00042p-Tl for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:47 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mjj-0006xB-Pl for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:24:46 -0400 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-539d9fffea1so474386e87.2 for ; Wed, 30 Oct 2024 21:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348681; x=1730953481; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HAp5Ln/TOaBbXfbAl+alUE9uLY3Kuq1n+bXOlaVNwGY=; b=vbJux36xnan/fCLg95ptgXmV34ulseeodYyMotBlRDMr3D71dibw5q1+HO7XlMkiP/ I6fQAfC4SUzOUouLAQV0Jd+zlKe+F1UCVaUiNi0vj23qygMUddeAdn1WTSXI9Dad1yQI RYS9pM74zmItPPWuJkFcq3L8g+8oi7KxzVnNZ1G4i4/TKPxUg6IfL5sLMng7HNbdnGap QwrxjVBFiztYBVWGmnDsqOUDH3+GcC1Uu9p/aAFXRhwRM+Q94kdOQfng5HCDNte4GmeP KKh4wHRDH0orTBoHBtqcffV/ngbKBGhngtmNoNMjJGRei35y4KsqVKugCoby9w3qjhbo s1hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348681; x=1730953481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HAp5Ln/TOaBbXfbAl+alUE9uLY3Kuq1n+bXOlaVNwGY=; b=XRw4C84g7w0VMK/vhyxf97mEtb1YCkz9w2Yyb6bHGUDhuCtPZHWJpDERuImv+yalyn nNNwvWCdoY3UZb2T+EuVvTgHUQDMWHrJheOtRPTuuwynbpZclvqLUpHHPdqEuhBdFThG 6Hc2gV8XndWjyF1mhX8dtBlIF056QX0a7JQwrJKF0TYIr9WNMnOWpUdXfhHL0jzO38rL MGYzPwDsQCbdOz4aksHJ0OQI1DYkCXUYzcBOzTR53MjDSGQTT3Aut7DRo4bpqOG5V0gp 7qekadS6z0JSr+9/mweZDteMyHmUFFzHHqjapqFdlQZgN+DO7t9y6XUeskA3IKxBfa65 f4AQ== X-Gm-Message-State: AOJu0YzB4k3GE0ldg79L9j+d5Ng6MUes20pfgbA6G+wrcQ2ZL6NlnIbu /Sor0d+ub/L6ePeLa4iH7Vi98YSs4yBxSrhvJpTWgY20VprVjTYADZ6VEuA8uzej20NluWpvCpV a X-Received: by 2002:a05:6512:2210:b0:539:adb0:b91 with SMTP id 2adb3069b0e04-53b34c8ee46mr7084370e87.57.1730348681405; Wed, 30 Oct 2024 21:24:41 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bc95941sm77940e87.50.2024.10.30.21.24.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:24:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 12/14] target/mips: Introduce ase_3d_available() helper Date: Thu, 31 Oct 2024 01:21:28 -0300 Message-ID: <20241031042130.98450-13-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=philmd@linaro.org; helo=mail-lf1-x132.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Determine if the MIPS-3D ASE is implemented by checking the state of the 3D bit in the FIR CP1 control register. Remove the then unused ASE_MIPS3D definition. Note, this allows using MIPS-3D on the mips64dspr2 model. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20241021145832.34920-1-philmd@linaro.org> --- target/mips/cpu.h | 6 ++++++ target/mips/mips-defs.h | 1 - target/mips/tcg/translate.c | 8 ++++++-- target/mips/cpu-defs.c.inc | 4 ++-- target/mips/tcg/micromips_translate.c.inc | 5 ++++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/target/mips/cpu.h b/target/mips/cpu.h index a4a46ebbe98..3dbfbfdb3d3 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1319,6 +1319,12 @@ bool cpu_type_supports_cps_smp(const char *cpu_type); bool cpu_supports_isa(const CPUMIPSState *env, uint64_t isa_mask); bool cpu_type_supports_isa(const char *cpu_type, uint64_t isa); +/* Check presence of MIPS-3D ASE */ +static inline bool ase_3d_available(const CPUMIPSState *env) +{ + return env->active_fpu.fcr0 & (1 << FCR0_3D); +} + /* Check presence of MSA implementation */ static inline bool ase_msa_available(CPUMIPSState *env) { diff --git a/target/mips/mips-defs.h b/target/mips/mips-defs.h index a6cebe0265c..6b5cd0d8f53 100644 --- a/target/mips/mips-defs.h +++ b/target/mips/mips-defs.h @@ -26,7 +26,6 @@ * bits 24-39: MIPS ASEs */ #define ASE_MIPS16 0x0000000001000000ULL -#define ASE_MIPS3D 0x0000000002000000ULL #define ASE_MDMX 0x0000000004000000ULL #define ASE_DSP 0x0000000008000000ULL #define ASE_DSP_R2 0x0000000010000000ULL diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 2d01f5c4a8b..9a3ae10a919 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -14710,7 +14710,9 @@ static bool decode_opc_legacy(CPUMIPSState *env, DisasContext *ctx) } else { /* OPC_BC1ANY2 */ check_cop1x(ctx); - check_insn(ctx, ASE_MIPS3D); + if (!ase_3d_available(env)) { + return false; + } gen_compute_branch1(ctx, MASK_BC1(ctx->opcode), (rt >> 2) & 0x7, imm << 2); } @@ -14725,7 +14727,9 @@ static bool decode_opc_legacy(CPUMIPSState *env, DisasContext *ctx) check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS_R6); check_cop1x(ctx); - check_insn(ctx, ASE_MIPS3D); + if (!ase_3d_available(env)) { + return false; + } /* fall through */ case OPC_BC1: check_cp1_enabled(ctx); diff --git a/target/mips/cpu-defs.c.inc b/target/mips/cpu-defs.c.inc index 1ab026c57e7..09bd62d430a 100644 --- a/target/mips/cpu-defs.c.inc +++ b/target/mips/cpu-defs.c.inc @@ -663,7 +663,7 @@ const mips_def_t mips_defs[] = .CP1_fcr31_rw_bitmask = 0xFF83FFFF, .SEGBITS = 40, .PABITS = 36, - .insn_flags = CPU_MIPS64R1 | ASE_MIPS3D, + .insn_flags = CPU_MIPS64R1, .mmu_type = MMU_TYPE_R4000, }, { @@ -692,7 +692,7 @@ const mips_def_t mips_defs[] = .CP1_fcr31_rw_bitmask = 0xFF83FFFF, .SEGBITS = 42, .PABITS = 36, - .insn_flags = CPU_MIPS64R2 | ASE_MIPS3D, + .insn_flags = CPU_MIPS64R2, .mmu_type = MMU_TYPE_R4000, }, { diff --git a/target/mips/tcg/micromips_translate.c.inc b/target/mips/tcg/micromips_translate.c.inc index 3cbf53bf2b3..c479bec1081 100644 --- a/target/mips/tcg/micromips_translate.c.inc +++ b/target/mips/tcg/micromips_translate.c.inc @@ -2484,7 +2484,10 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx) mips32_op = OPC_BC1TANY4; do_cp1mips3d: check_cop1x(ctx); - check_insn(ctx, ASE_MIPS3D); + if (!ase_3d_available(env)) { + gen_reserved_instruction(ctx); + break; + } /* Fall through */ do_cp1branch: if (env->CP0_Config1 & (1 << CP0C1_FP)) { From patchwork Thu Oct 31 04:21:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839873 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp84293wrb; Wed, 30 Oct 2024 21:25:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXp1xq/QOm+G6KIbn7h7M5Ei/5QG0JrwU8uuLhISJhk0sPvD7+tHOzxQz9lZiQsURzFUJ0xkQ==@linaro.org X-Google-Smtp-Source: AGHT+IGd7xvjPX51qrRF9zX7tRMxxEjqxOJ5o+uR0Cz6smDbhDaK0j6Edc5Ad3FUborzyvAaC2Jl X-Received: by 2002:a05:6102:d8e:b0:4a4:6858:3365 with SMTP id ada2fe7eead31-4a95437264emr2423013137.21.1730348732594; Wed, 30 Oct 2024 21:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348732; cv=none; d=google.com; s=arc-20240605; b=eFiMnB50zWf1VThzuOXAltKhWezSuRZFjClDkur31K1o+kIe7Ww//rQH14sP7Vg6AY szeOdxdc+EFcsSI6H1UwG8HJdMfOkQvWCP4+keZ2lfo/dYqCxrvqzynWyO0uq9Vi8w5i qPdNlOUxFTFUXSiUZrV3bVnjYdhVOIkxEiB8PCONUs7iKPuJ5N9QLTXUFFE4NAVB8E9D R1OJLj0ThZgFEo1EILg9ZuvIZ7/8JHCaw79wokGl9w0Lqf15a39MLZf/7vtqwjX4E8l1 ZuONaQFlVvYuEZHwGd3uHarVVL3cuUyjE3hQ9rCHO0zBPaf9G4jWUYjy9OWUURUF/axr wj3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c4Vhs6Ob6u6BHe3e6MEeVviB+HaVRV3K5gMILLbeGY4=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=HbQjNmindCkQhaCoMlCsaL9kjQJhXDrknyxg/8XIcpF6Mzget0O/pfghBuiG19q5DR 38S0Rq/4HCSGAZ8Agmsss5Frje1DBcYupXmEVptv23v+QlkpXD+9p43TR1Ib/UGGzA3K lM0y2kmkp8kyjxxLgGedV82zj3i1tv2u8kH/uNSStsXRJWcP5qRbpmKd/EbdRC3jaFhP L1ecd3kgHMNY6q3doRNm5E+YERh+tQIOVgOWKyvkUsgY/mHnyr2ydOHW+H6Ld7+K6iDS zm76w6c14pX7i0sCUu/P+YKTDzC5DUUGDHs/emNEMpyJMIUY2Ej5ecGrwUwq5pHDjuel Tv+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aHMZSoXU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad0b452fsi9200691cf.112.2024.10.30.21.25.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:25:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aHMZSoXU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6MkQ-0005Bq-Gd; Thu, 31 Oct 2024 00:25:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6MkB-00056H-CS for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:25:12 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Mjx-0006yA-DH for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:25:09 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-539e3f35268so591510e87.3 for ; Wed, 30 Oct 2024 21:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348695; x=1730953495; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c4Vhs6Ob6u6BHe3e6MEeVviB+HaVRV3K5gMILLbeGY4=; b=aHMZSoXUY2y+RGNG9SfLCCjft2ForjvG6TuJN9iGxUfD6dOsSX2W4UJy6owV9kX6Kr +Y6wdDDLteGLvRXJw5Y22Nv1xIwIWEV8UuQRt8fLt0FyyRHtZMTU0aNqxcVi68fMh3MH nAmiqEuICiGxTrrKevKAJZutSEdiywUYPaWuPmf3VRdheiT+Udb3O0oJfDAunxPjJunW rmG7RjJ2hD+I86K1vueOknMYb0fX8AseyTfsxm6cTjVnXJmV3FfE0nXiQTpKEcJnF2OK dOv5Gb4kp6+5k+pzrDwqJyDu/NZODSbHE3aC2Ru1VCFvYNarP8NRLjtftZucmubCShYt EVMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348695; x=1730953495; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c4Vhs6Ob6u6BHe3e6MEeVviB+HaVRV3K5gMILLbeGY4=; b=mCHCqddQtFQexV2lKAJxVj2XSZPo7jlhTmf9LMUV2vJ3405z+DrcgN7yVc1TqPg+fm E3z2GPNfAhVkeINqej/2lMxZmnnBxGjyeAuHANELersPnsbkY9JeICDBsi89uRPIoZCo 2PhZI7yHeFS1X52HaasdV2E4LS9XcjifDz7xvR1kn0lkyORjRS7u6f6BCMHNCMO3oA0z WIeRJW3HSrSPLMDvw6uGFTk8bKWFMaf7n0KlSJn5I+EU8BG8g0Q8cFdS6/q+mMdEgjNA 0FVfb6SOXLWCikmm8DvWhIaDQKVKKDrWKQy/qlP71EVFQiIl34apYjlLXfENCebaX3rK d+iA== X-Gm-Message-State: AOJu0YytSu2x6p/WOCQ2kvJqTsvJcP7kOz3IFr6sKjCo5Jm7ac9MzBdk RUN513dwhYAFDy02Q453LLQihSTh8wpf97FHoOwwCkkohXg55cuWdPJz2a4qVa6pxG1vZX9kwl2 0 X-Received: by 2002:ac2:4643:0:b0:53c:7526:e18a with SMTP id 2adb3069b0e04-53cc60cf708mr136535e87.30.1730348694962; Wed, 30 Oct 2024 21:24:54 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bdccb15sm75479e87.238.2024.10.30.21.24.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:24:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 13/14] target/mips: Introduce disas_mt_available() Date: Thu, 31 Oct 2024 01:21:29 -0300 Message-ID: <20241031042130.98450-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=philmd@linaro.org; helo=mail-lf1-x130.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Similarly to commit 17c2c320f3c ("Introduce ase_mt_available helper"), introduce the disas_mt_available() one which takes a DisasContext argument to determine whether Multi-Threading is available by checking the MT bit of the CP0_Config3 register. Remove the then unused ASE_MT definition. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20241024195447.44600-1-philmd@linaro.org> --- target/mips/mips-defs.h | 1 - target/mips/tcg/translate.h | 5 ++ target/mips/tcg/translate.c | 136 ++++++++++++++++++------------------ target/mips/cpu-defs.c.inc | 4 +- 4 files changed, 75 insertions(+), 71 deletions(-) diff --git a/target/mips/mips-defs.h b/target/mips/mips-defs.h index 6b5cd0d8f53..9d4d292586c 100644 --- a/target/mips/mips-defs.h +++ b/target/mips/mips-defs.h @@ -30,7 +30,6 @@ #define ASE_DSP 0x0000000008000000ULL #define ASE_DSP_R2 0x0000000010000000ULL #define ASE_DSP_R3 0x0000000020000000ULL -#define ASE_MT 0x0000000040000000ULL #define ASE_SMARTMIPS 0x0000000080000000ULL #define ASE_MICROMIPS 0x0000000100000000ULL /* diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h index 23a489c0f38..1bf153d1838 100644 --- a/target/mips/tcg/translate.h +++ b/target/mips/tcg/translate.h @@ -231,6 +231,11 @@ bool decode_ext_octeon(DisasContext *ctx, uint32_t insn); #endif bool decode_ext_vr54xx(DisasContext *ctx, uint32_t insn); +static inline bool disas_mt_available(DisasContext *ctx) +{ + return ctx->CP0_Config3 & (1 << CP0C3_MT); +} + /* * Helpers for implementing sets of trans_* functions. * Defer the implementation of NAME to FUNC, with optional extra arguments. diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 9a3ae10a919..de7045874dd 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -5112,17 +5112,17 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Index"; break; case CP0_REG00__MVPCONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_mvpcontrol(arg, tcg_env); register_name = "MVPControl"; break; case CP0_REG00__MVPCONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_mvpconf0(arg, tcg_env); register_name = "MVPConf0"; break; case CP0_REG00__MVPCONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_mvpconf1(arg, tcg_env); register_name = "MVPConf1"; break; @@ -5143,37 +5143,37 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Random"; break; case CP0_REG01__VPECONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEControl)); register_name = "VPEControl"; break; case CP0_REG01__VPECONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf0)); register_name = "VPEConf0"; break; case CP0_REG01__VPECONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf1)); register_name = "VPEConf1"; break; case CP0_REG01__YQMASK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load64(arg, offsetof(CPUMIPSState, CP0_YQMask)); register_name = "YQMask"; break; case CP0_REG01__VPESCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load64(arg, offsetof(CPUMIPSState, CP0_VPESchedule)); register_name = "VPESchedule"; break; case CP0_REG01__VPESCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load64(arg, offsetof(CPUMIPSState, CP0_VPEScheFBack)); register_name = "VPEScheFBack"; break; case CP0_REG01__VPEOPT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEOpt)); register_name = "VPEOpt"; break; @@ -5200,37 +5200,37 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "EntryLo0"; break; case CP0_REG02__TCSTATUS: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tcstatus(arg, tcg_env); register_name = "TCStatus"; break; case CP0_REG02__TCBIND: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tcbind(arg, tcg_env); register_name = "TCBind"; break; case CP0_REG02__TCRESTART: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tcrestart(arg, tcg_env); register_name = "TCRestart"; break; case CP0_REG02__TCHALT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tchalt(arg, tcg_env); register_name = "TCHalt"; break; case CP0_REG02__TCCONTEXT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tccontext(arg, tcg_env); register_name = "TCContext"; break; case CP0_REG02__TCSCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tcschedule(arg, tcg_env); register_name = "TCSchedule"; break; case CP0_REG02__TCSCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tcschefback(arg, tcg_env); register_name = "TCScheFBack"; break; @@ -5869,17 +5869,17 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Index"; break; case CP0_REG00__MVPCONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_mvpcontrol(tcg_env, arg); register_name = "MVPControl"; break; case CP0_REG00__MVPCONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); /* ignored */ register_name = "MVPConf0"; break; case CP0_REG00__MVPCONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); /* ignored */ register_name = "MVPConf1"; break; @@ -5899,39 +5899,39 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Random"; break; case CP0_REG01__VPECONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpecontrol(tcg_env, arg); register_name = "VPEControl"; break; case CP0_REG01__VPECONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpeconf0(tcg_env, arg); register_name = "VPEConf0"; break; case CP0_REG01__VPECONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpeconf1(tcg_env, arg); register_name = "VPEConf1"; break; case CP0_REG01__YQMASK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_yqmask(tcg_env, arg); register_name = "YQMask"; break; case CP0_REG01__VPESCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); tcg_gen_st_tl(arg, tcg_env, offsetof(CPUMIPSState, CP0_VPESchedule)); register_name = "VPESchedule"; break; case CP0_REG01__VPESCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); tcg_gen_st_tl(arg, tcg_env, offsetof(CPUMIPSState, CP0_VPEScheFBack)); register_name = "VPEScheFBack"; break; case CP0_REG01__VPEOPT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpeopt(tcg_env, arg); register_name = "VPEOpt"; break; @@ -5946,37 +5946,37 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "EntryLo0"; break; case CP0_REG02__TCSTATUS: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcstatus(tcg_env, arg); register_name = "TCStatus"; break; case CP0_REG02__TCBIND: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcbind(tcg_env, arg); register_name = "TCBind"; break; case CP0_REG02__TCRESTART: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcrestart(tcg_env, arg); register_name = "TCRestart"; break; case CP0_REG02__TCHALT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tchalt(tcg_env, arg); register_name = "TCHalt"; break; case CP0_REG02__TCCONTEXT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tccontext(tcg_env, arg); register_name = "TCContext"; break; case CP0_REG02__TCSCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcschedule(tcg_env, arg); register_name = "TCSchedule"; break; case CP0_REG02__TCSCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcschefback(tcg_env, arg); register_name = "TCScheFBack"; break; @@ -6619,17 +6619,17 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Index"; break; case CP0_REG00__MVPCONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_mvpcontrol(arg, tcg_env); register_name = "MVPControl"; break; case CP0_REG00__MVPCONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_mvpconf0(arg, tcg_env); register_name = "MVPConf0"; break; case CP0_REG00__MVPCONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_mvpconf1(arg, tcg_env); register_name = "MVPConf1"; break; @@ -6650,40 +6650,40 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Random"; break; case CP0_REG01__VPECONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEControl)); register_name = "VPEControl"; break; case CP0_REG01__VPECONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf0)); register_name = "VPEConf0"; break; case CP0_REG01__VPECONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf1)); register_name = "VPEConf1"; break; case CP0_REG01__YQMASK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); tcg_gen_ld_tl(arg, tcg_env, offsetof(CPUMIPSState, CP0_YQMask)); register_name = "YQMask"; break; case CP0_REG01__VPESCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); tcg_gen_ld_tl(arg, tcg_env, offsetof(CPUMIPSState, CP0_VPESchedule)); register_name = "VPESchedule"; break; case CP0_REG01__VPESCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); tcg_gen_ld_tl(arg, tcg_env, offsetof(CPUMIPSState, CP0_VPEScheFBack)); register_name = "VPEScheFBack"; break; case CP0_REG01__VPEOPT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEOpt)); register_name = "VPEOpt"; break; @@ -6699,37 +6699,37 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "EntryLo0"; break; case CP0_REG02__TCSTATUS: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tcstatus(arg, tcg_env); register_name = "TCStatus"; break; case CP0_REG02__TCBIND: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mfc0_tcbind(arg, tcg_env); register_name = "TCBind"; break; case CP0_REG02__TCRESTART: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_dmfc0_tcrestart(arg, tcg_env); register_name = "TCRestart"; break; case CP0_REG02__TCHALT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_dmfc0_tchalt(arg, tcg_env); register_name = "TCHalt"; break; case CP0_REG02__TCCONTEXT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_dmfc0_tccontext(arg, tcg_env); register_name = "TCContext"; break; case CP0_REG02__TCSCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_dmfc0_tcschedule(arg, tcg_env); register_name = "TCSchedule"; break; case CP0_REG02__TCSCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_dmfc0_tcschefback(arg, tcg_env); register_name = "TCScheFBack"; break; @@ -7336,17 +7336,17 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Index"; break; case CP0_REG00__MVPCONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_mvpcontrol(tcg_env, arg); register_name = "MVPControl"; break; case CP0_REG00__MVPCONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); /* ignored */ register_name = "MVPConf0"; break; case CP0_REG00__MVPCONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); /* ignored */ register_name = "MVPConf1"; break; @@ -7366,39 +7366,39 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "Random"; break; case CP0_REG01__VPECONTROL: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpecontrol(tcg_env, arg); register_name = "VPEControl"; break; case CP0_REG01__VPECONF0: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpeconf0(tcg_env, arg); register_name = "VPEConf0"; break; case CP0_REG01__VPECONF1: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpeconf1(tcg_env, arg); register_name = "VPEConf1"; break; case CP0_REG01__YQMASK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_yqmask(tcg_env, arg); register_name = "YQMask"; break; case CP0_REG01__VPESCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); tcg_gen_st_tl(arg, tcg_env, offsetof(CPUMIPSState, CP0_VPESchedule)); register_name = "VPESchedule"; break; case CP0_REG01__VPESCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); tcg_gen_st_tl(arg, tcg_env, offsetof(CPUMIPSState, CP0_VPEScheFBack)); register_name = "VPEScheFBack"; break; case CP0_REG01__VPEOPT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_vpeopt(tcg_env, arg); register_name = "VPEOpt"; break; @@ -7413,37 +7413,37 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel) register_name = "EntryLo0"; break; case CP0_REG02__TCSTATUS: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcstatus(tcg_env, arg); register_name = "TCStatus"; break; case CP0_REG02__TCBIND: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcbind(tcg_env, arg); register_name = "TCBind"; break; case CP0_REG02__TCRESTART: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcrestart(tcg_env, arg); register_name = "TCRestart"; break; case CP0_REG02__TCHALT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tchalt(tcg_env, arg); register_name = "TCHalt"; break; case CP0_REG02__TCCONTEXT: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tccontext(tcg_env, arg); register_name = "TCContext"; break; case CP0_REG02__TCSCHEDULE: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcschedule(tcg_env, arg); register_name = "TCSchedule"; break; case CP0_REG02__TCSCHEFBACK: - CP0_CHECK(ctx->insn_flags & ASE_MT); + CP0_CHECK(disas_mt_available(ctx)); gen_helper_mtc0_tcschefback(tcg_env, arg); register_name = "TCScheFBack"; break; diff --git a/target/mips/cpu-defs.c.inc b/target/mips/cpu-defs.c.inc index 09bd62d430a..922fc39138d 100644 --- a/target/mips/cpu-defs.c.inc +++ b/target/mips/cpu-defs.c.inc @@ -314,7 +314,7 @@ const mips_def_t mips_defs[] = (0x3fe << CP0SRSC4_SRS14) | (0x3fe << CP0SRSC4_SRS13), .SEGBITS = 32, .PABITS = 32, - .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP | ASE_MT, + .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP, .mmu_type = MMU_TYPE_R4000, }, { @@ -543,7 +543,7 @@ const mips_def_t mips_defs[] = .SEGBITS = 32, .PABITS = 32, .insn_flags = CPU_MIPS32R6 | ISA_NANOMIPS32 | - ASE_DSP | ASE_DSP_R2 | ASE_DSP_R3 | ASE_MT, + ASE_DSP | ASE_DSP_R2 | ASE_DSP_R3, .mmu_type = MMU_TYPE_R4000, }, #if defined(TARGET_MIPS64) From patchwork Thu Oct 31 04:21:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 839874 Delivered-To: patch@linaro.org Received: by 2002:adf:a38c:0:b0:37d:45d0:187 with SMTP id l12csp84388wrb; Wed, 30 Oct 2024 21:25:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVmxbrBhOm3h9MNJHHmkKsGGqxvsiaCjhr3G/MdFkMwxpsZ+m8kTKaAOY3NsQqORTaFjg6iyw==@linaro.org X-Google-Smtp-Source: AGHT+IHFNLq2CxbfaEe8q8G8my+X6wq51hiSq2RyoCBYrS1kYcV8rpkw+Pi/9HatUBIzfnnredcc X-Received: by 2002:a05:6214:398e:b0:6ce:1090:d03a with SMTP id 6a1803df08f44-6d1856c464cmr239132946d6.16.1730348756031; Wed, 30 Oct 2024 21:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730348756; cv=none; d=google.com; s=arc-20240605; b=ZOQE9cxM7PKCZNoccm6t2cg3/6KWDK6u267PraJCYRB8KXaKIj7ART6F7XxtdEByvo g/sTY+jzqV5J3m1C5wkxZJsSZBozqsZqwQ2Xm0xNPNFWhzczvS8vk5TRFQoBzzS64Sqm xmDpJymRmf4KiP4NjaM9Eht8JA3Isiik/7GgedqCeyI2KI0+MQk4fTnRq0pTeUidzGb6 B+wBC4HCwyoQvvDuWHaMwvEALSvB4J1lcHCgo9XdzaMymVhUD6gjaQrmpiSOnuY04a3V y7UNYFw4dFq6gh8GWcjVKADD106j1VEVXvwFnEEi3N0hslGIRREtyP2vmim3zF8dzJR8 HZiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pX4OD63TqJEhHTGtF+j18QE21OZi3tgKJV9VJey4GSg=; fh=jDzlsuVfu9yneD3KBOEB0ptb3EY+AtxVXbt7jaKLMXk=; b=SDLkKpr5xP92Y4HHQqbrX1g9jrSBqJO6EZfYuqPg58KLDx27VEDJy2RRb42dvroS1E YCm53b/+CSfgqraRv02i3rhOrWMvvzsr4nlT+IvEedPxeUT4Er//28drk9LVz93GB/Ch FTfl/4MguuvRsiXgtQzwNBWMgloy0zuitGXO5pDwBC8gSnc83RFtggU6S2+Yd71wZ4dB xIkhE/XnXur614eKkG3vOd8aPUL0J/kRKCwsCjs7mArzFKWLpuvqNQU1VWaIzb2Ic+dE qAuU58rFvYQDtdWlmGaUd4edwy8cjoglNDAbdzQyTIjsmd2JkjQ+R9m4mE4gm01GcbEW QygQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AyWeigAc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d353faa7b4si8793666d6.19.2024.10.30.21.25.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2024 21:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AyWeigAc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6MkV-0005G7-8z; Thu, 31 Oct 2024 00:25:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6MkE-00059R-5H for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:25:17 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6MkB-00074F-SM for qemu-devel@nongnu.org; Thu, 31 Oct 2024 00:25:13 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-53c78ebe580so640575e87.1 for ; Wed, 30 Oct 2024 21:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730348710; x=1730953510; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pX4OD63TqJEhHTGtF+j18QE21OZi3tgKJV9VJey4GSg=; b=AyWeigAcNjTwyVb8nonBaNgUOfffO9E1oJXSY8Ii8YIUA/foq5XA3wv9W7hzBLYmLS BE1HT5rIeRK5/b3nzZnNgARwlFtfYBG545IvskeL3xo2xEPYq/30QfmYo8TGxS1K1YMp ywEdNxPGpLSbeforjpbeCvMfjY/xhv2kADwFRsWBzqTb8MiaOeaXIS8GsoPvGoUVv6rA U4up/NvxzjQSsWFHQZ9I+FncUoKtL9ZFthcdxLzkPhtmm+wOwKpljldrlsDGOkuHjNn0 IL53daO/Q+YORxa37KdcSgavDkCz2jYM/UyenmVtJSMB5B5nL/LdFJ74lZh2eAR7EuzZ DjPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730348710; x=1730953510; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pX4OD63TqJEhHTGtF+j18QE21OZi3tgKJV9VJey4GSg=; b=bwO2N6Sl36ciTJfYEur/4GB9QRlk4KVvxrM1DrMDc7Rc1ldE2964YsG/BrVFQluEtl p+KR2vN44ge5H/XcSAZr+hXgh0PMjUS3FJXuGZcADXIk8wk51NLINHpNbRwueehJWyC2 qKj8LgS/FwDXVCy7iXQmmNPnDfVOSvPM5ElHQxJkE7Wf8hPj/GaJVGSrKz5tTVHrb/ZO v63h04wkAFMRrL4R30+siDVIyd3CyYEu2d5XpM2der6I2PDFRvg0AyxnqBVXH1I7M8yX Sd+9ml4O9AR7CITZz96xcPQQj4V5+cHzmNNZ1mYdlDpvoZYjiCcRT3/5/EYCdn7lKMS5 d1EQ== X-Gm-Message-State: AOJu0YxOdwTaiBWMGENfhcuzr0FX8qX380HtEmqyqwymnTrOe6lO0rkL c3FegTJCoBVRxVhFCZ574LXBVtKjw7rx90muzH8Hpo3ZnLYPQrNyqltF6+/16e8m+2JDUNt7AT/ I X-Received: by 2002:ac2:4a77:0:b0:53b:1ede:9174 with SMTP id 2adb3069b0e04-53c7bc1cfa7mr232233e87.28.1730348709801; Wed, 30 Oct 2024 21:25:09 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bc9589fsm79386e87.32.2024.10.30.21.25.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Oct 2024 21:25:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Richard Henderson Subject: [PULL 14/14] target/mips: Remove unused CPUMIPSState::current_fpu field Date: Thu, 31 Oct 2024 01:21:30 -0300 Message-ID: <20241031042130.98450-15-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241031042130.98450-1-philmd@linaro.org> References: <20241031042130.98450-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=philmd@linaro.org; helo=mail-lf1-x135.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The 'current_fpu' field is unused since commit f01be154589 ("Move the active FPU registers into env again, and use more TCG registers to access them"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-Id: <20241021151253.36443-1-philmd@linaro.org> --- target/mips/cpu.h | 1 - target/mips/sysemu/machine.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 3dbfbfdb3d3..f6877ece8b4 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -530,7 +530,6 @@ typedef struct CPUArchState { CPUMIPSFPUContext active_fpu; uint32_t current_tc; - uint32_t current_fpu; uint32_t SEGBITS; uint32_t PABITS; diff --git a/target/mips/sysemu/machine.c b/target/mips/sysemu/machine.c index 91cd9f19002..8af11fd896b 100644 --- a/target/mips/sysemu/machine.c +++ b/target/mips/sysemu/machine.c @@ -242,7 +242,7 @@ const VMStateDescription vmstate_mips_cpu = { /* CPU metastate */ VMSTATE_UINT32(env.current_tc, MIPSCPU), - VMSTATE_UINT32(env.current_fpu, MIPSCPU), + VMSTATE_UNUSED(sizeof(uint32_t)), /* was current_fpu */ VMSTATE_INT32(env.error_code, MIPSCPU), VMSTATE_UINTTL(env.btarget, MIPSCPU), VMSTATE_UINTTL(env.bcond, MIPSCPU),