From patchwork Tue Oct 17 06:11:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734256 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322159wro; Mon, 16 Oct 2023 23:13:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9zFVn/UmjnNulwtB80pw5z0PP/ae+log9uv/UN8iA6o+oY3hJfqevkagQTdInOGnwdwZM X-Received: by 2002:a05:620a:bc5:b0:774:1e07:ea0d with SMTP id s5-20020a05620a0bc500b007741e07ea0dmr1611210qki.44.1697523230422; Mon, 16 Oct 2023 23:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523230; cv=none; d=google.com; s=arc-20160816; b=bKrx17OMoNQIOAEsbY9cqxAZsoUmcZ4ubM9bKZ2UCNOxykKtEUXoLCKp8f/EjWWvk5 Xbku8ZMJGlGfEo1/HrEebGg9oVV6AP5Va20G3+DMKMuDhROb/mhpcvVK3/KXMZZbW1SU dixOzMTcVitAo3yy7BCDjYQ3VF2KhxDouhzBJqfwb3i3Cet+g0SX0Ul7sZlnt6JAAj2z 7Ct5twHgS3wx+PBiUlZYF1gUtcO4pU0y/maIZtka86Bb2kpaIWhLGApJxbQD9qcka/6q mMjIlG6PWQfXWLc3L+OvvoRg5VwUgTo3GIy093/jACU85FHOWpIQIGSl0nNYew/wIZNV T0HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=CzYqIAe/hPtmLAqL3h5jbLKf5tJAkAbl6Tgcozc9Vko=; fh=tZJ625WOV7jgOfp8Y+f3bhkxwtNCMo5ecPunHzXn1rY=; b=nvGBLeqRfZrcaWDLD69VJxL8H7Y1xtZjfFTD4QywDPgEYytgCT58t1wwK4Bh00xgI6 j/pIKR/GX5Sg/OEBQ8cNnxNqK0m1ad8+nN6cuVnuFrq6y5pFKmvoE1nEmN38L2qCsuRa 17o25GTatH89d3eFWtu1H3DwDvBb3kWDAwZOFqgf40A+F1SN/FSnm3fO1xs01e2BO46/ BXg0gcNn+1KIaHd5B6+84UmphwH47aaTEIeBlLyGyh+HTTZSV95yelQpt+vKFTHcAqBx QmH9nl4tFv2u98BupkeOk4Ubkjxkx3yP/m7CSr2rACZ/FJrlUnBZ38AesdHm9YI3fY24 C4qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yu6Zx0A4; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v17-20020a0ccd91000000b0066d1e8d7d73si533744qvm.20.2023.10.16.23.13.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:13:50 -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=yu6Zx0A4; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdJy-0008Lj-NP; Tue, 17 Oct 2023 02:12: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 1qsdJx-0008LC-VX for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:49 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdJw-0003oP-AG for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:49 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c9c5a1b87bso35851135ad.3 for ; Mon, 16 Oct 2023 23:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523167; x=1698127967; 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=CzYqIAe/hPtmLAqL3h5jbLKf5tJAkAbl6Tgcozc9Vko=; b=yu6Zx0A43Xp+hfqLSHTsuXOcFUWFi2FJmueWd+N6O3cg9GkYlXApZlzmarJZTDVcD+ AfYrZ24vichmLs9SWdYl2ajmDS6fcZKH4T456XCBBhCSkC4zBbUpHprcbQyGZuPlIgIu 5FT5M51JIik2w0WyYDXWShXQo6xK9DhjkEu676JrgmW38SNybQqaeftR7LUZc072eW/R y8zln6goEBO1Ca/CG7W8/k2qZizsn4CTkvcOhO5B4PMer737bLnHEMnYkZkVgA2DSyfs 7YsbhNBUxTrlDhRsEHv/Up1SckPrOF6aJHW24qqDRViUNuB6aOWKAw4kAKnrl4ajUDfs i2vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523167; x=1698127967; 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=CzYqIAe/hPtmLAqL3h5jbLKf5tJAkAbl6Tgcozc9Vko=; b=m617pr9/VUNUAW394nnWJijx89X4iem00+8ymP6DnA7oPuU5m7Zs5ZlmXdxmEkDQfp OPtLpRPdHLo6Ud+4hglYmf2ARaoVHiIruFRkSqm8CI81dCg5g09nR8ju4idi++wtcnft TpfaoI7C4PgVSGSZcag1Q+oSK2V8lkt4VqwPlc2TFpTaraV8LbexnbOhpWWLjzLrbD0n ol8rlzLNv/5K9i21aITww09cHuMYES+MG35fiIaMvu6BxBI0nTKWh6fxyJPzBGHGV/fa 3OC1+MSE2Ak4Uh7pzihWjae5KBLT49Qb7cFhmVqJSOQIbf8I7Hkd5Qjrtx+LsBq5br/8 govA== X-Gm-Message-State: AOJu0YwvBUDT7upgfyHweIlwWo1UrQ7J3Mt8N+6+AaqRPo13Py+ar8Mf 6dzOVN3T6Pc2QdZ40rjSzI8Dxvn+1qRR0P+Hw5I= X-Received: by 2002:a17:903:228e:b0:1ca:86a9:cace with SMTP id b14-20020a170903228e00b001ca86a9cacemr1479119plh.2.1697523166547; Mon, 16 Oct 2023 23:12:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, qemu-stable@nongnu.org Subject: [PATCH v2 01/90] target/sparc: Clear may_lookup for npc == DYNAMIC_PC Date: Mon, 16 Oct 2023 23:11:15 -0700 Message-Id: <20231017061244.681584-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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=unavailable 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 With pairs of jmp+rett, pc == DYNAMIC_PC_LOOKUP and npc == DYNAMIC_PC. Make sure that we exit for interrupts. Cc: qemu-stable@nongnu.org Fixes: 633c42834c7 ("target/sparc: Introduce DYNAMIC_PC_LOOKUP") Tested-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index f92ff80ac8..8fabed28fd 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5654,10 +5654,10 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) break; } + may_lookup = true; if (dc->pc & 3) { switch (dc->pc) { case DYNAMIC_PC_LOOKUP: - may_lookup = true; break; case DYNAMIC_PC: may_lookup = false; @@ -5667,10 +5667,24 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } else { tcg_gen_movi_tl(cpu_pc, dc->pc); - may_lookup = true; } - save_npc(dc); + if (dc->npc & 3) { + switch (dc->npc) { + case JUMP_PC: + gen_generic_branch(dc); + break; + case DYNAMIC_PC: + may_lookup = false; + break; + case DYNAMIC_PC_LOOKUP: + break; + default: + g_assert_not_reached(); + } + } else { + tcg_gen_movi_tl(cpu_npc, dc->npc); + } if (may_lookup) { tcg_gen_lookup_and_goto_ptr(); } else { From patchwork Tue Oct 17 06:11:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734257 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322183wro; Mon, 16 Oct 2023 23:13:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZpfMhNWIlKMsFO7j4F4ORcJDPqLbXvmiEIE+SD2F26zIo9up25bzQI7N/pBIQaDKkWUsG X-Received: by 2002:a1f:29c5:0:b0:4a8:4218:7b90 with SMTP id p188-20020a1f29c5000000b004a842187b90mr1417416vkp.9.1697523235451; Mon, 16 Oct 2023 23:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523235; cv=none; d=google.com; s=arc-20160816; b=XZjOFdmsQtpRDaevHJ8MUE998uD9X9KbXdFeGX6kdsFPVYoMTX725vRfPUYmgr3FQj JScrFGftFBDYgCwC9lvZ1IvA26HzS2ZQX/RtHB7znOR9rNsx9eSrdjMtegZzOnTsAUCL svJycaUOP/SKwDgRNv0bMHYLPUlrTxIGrdvSxwUrgumq0pZwUcCvIbjNW29dkv2bjDwQ H2FPum9Cl3IdYCWDG4QAP3pJJJuUpzK0FosOi84DtBqsNaDJexKU1m3+Ksx0lpMQf5fn KcG5RvEUlnS5Oz5sjeN5ejK5VehrAB8my0OZ8pdtZWiQ3IBqoJuDQdqgM/B2T88Ubent Sw7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=jXlmVTgalHfsB9Nikgsdxk0ApYZwOaGhGlv+ImBLl8Q=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=I9eGuqct8CVUtcbTuV+TgHaIc0tipAQenPRZPpNQVtDY0htF17hFO3KDZwHhb1wuih mI8kHEQKK+9s9C84sG1G9SC89R+BCnD1AOKJrPyFQ50sAun0n+WFyaMN5kDYUBqVLPE8 P1059/HoLKBpEs2murlCJV+U+WQ0u6DXGeVj4pw0kGUFtpJyxF33HvHYhInL9/p3V6rn u0bnI6HXpYoaobLyOOn4qCm8jx/pLQhmdGlZ6WeHbXYVEqR54puCyAqinnJzVcMUO0vv itD5pGZe9Mj7MCalbnbZn3R5orvNVrZCdkG2VYCTNAml3TNGoy6f8n/Nod18vmGUfvj2 Ec/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dY7SUlNP; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id de6-20020a05620a370600b0076dae6bce18si623182qkb.352.2023.10.16.23.13.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:13:55 -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=dY7SUlNP; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK0-0008NL-K1; Tue, 17 Oct 2023 02:12:52 -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 1qsdJz-0008Mj-GK for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:51 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdJx-0003og-Hy for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:51 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c9d407bb15so44465185ad.0 for ; Mon, 16 Oct 2023 23:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523168; x=1698127968; 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=jXlmVTgalHfsB9Nikgsdxk0ApYZwOaGhGlv+ImBLl8Q=; b=dY7SUlNPM6BAgWpJw407RKkJhTHsTB5hFkPHgi5E+7RIkQ++YJDJDnld8DDd88Xatw 6h9QFXAFczZD8J+6Ok1HEtJnAgoIsnjrsipm5x0msAEKSJgiul/TcUDXxW/DUEbtzV/g IHWe6U6lLM8YXsza6k0eXPl6ffw6YBzV+ZJVLLzJ44ZhjnNM6vevaBQAZajUt6ZwHK8+ wZ1R+ncAZTOM/hq0bIP0/vUxlULAhlqfCkU/6NZ0ZWM7lFO2G9dsGi0EA0bhf3UGA+jM pUzfj5xqFnyfqjRqMeyO6EQR66dNa2FC50F3YuDjo8TUPDWILp3TiZPBGRHfvi1tQltr /9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523168; x=1698127968; 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=jXlmVTgalHfsB9Nikgsdxk0ApYZwOaGhGlv+ImBLl8Q=; b=Jjdjzn0k/qt58w8iHMBopSuCPeqUK6sobSIkMDDsCWqDxb22tdrtgqHB9SNMnFUJB5 n1hwrYYLxybUXkfIcACMGlrlUWV+bBmRoPomwfMZl7j0iA4qCCapojV7jEvyLOaEake+ WTiwKZHfLhnoioYa2Wq9MR/1K6DLJYuUjCjuPKoWLDtRZUPzgvjrYMSJuOjgKFMwBx6v tSbMny1Q7nsEuq7v6lWfThaysZ39lzy0MHiyQl1zvsCBKHt56/IM5xrOJ8ixsZPQeC8y SqODodI3fG/2wd/cgvESw68RoBjCT/IvICjn565FKfJNTnZ8N5lesVqT7EZ1XrjhaEar XdWg== X-Gm-Message-State: AOJu0YyPat8wFb21Fb2U6RFYDv2Lyok3xCl+kt5ss/cJ72qmJQEonkn2 y084AOrSTVtwuGC8AOU02E2dzSZd7Kdjy8VAbVY= X-Received: by 2002:a17:902:e742:b0:1c7:7e00:8075 with SMTP id p2-20020a170902e74200b001c77e008075mr1372861plf.66.1697523167511; Mon, 16 Oct 2023 23:12:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 02/90] target/sparc: Implement check_align inline Date: Mon, 16 Oct 2023 23:11:16 -0700 Message-Id: <20231017061244.681584-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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 Emit the exception at the end of the translation block, so that the non-exception case can fall through. Signed-off-by: Richard Henderson --- target/sparc/helper.h | 1 - target/sparc/ldst_helper.c | 7 ++-- target/sparc/translate.c | 68 +++++++++++++++++++++++++++++++++----- 3 files changed, 61 insertions(+), 15 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index b8f1e78c75..b116ddcb29 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -24,7 +24,6 @@ DEF_HELPER_FLAGS_2(tick_set_count, TCG_CALL_NO_RWG, void, ptr, i64) DEF_HELPER_FLAGS_3(tick_get_count, TCG_CALL_NO_WG, i64, env, ptr, int) DEF_HELPER_FLAGS_2(tick_set_limit, TCG_CALL_NO_RWG, void, ptr, i64) #endif -DEF_HELPER_FLAGS_3(check_align, TCG_CALL_NO_WG, void, env, tl, i32) DEF_HELPER_1(debug, void, env) DEF_HELPER_1(save, void, env) DEF_HELPER_1(restore, void, env) diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 78b03308ae..246de86c98 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -360,6 +360,7 @@ static inline void do_check_asi(CPUSPARCState *env, int asi, uintptr_t ra) #endif /* !CONFIG_USER_ONLY */ #endif +#if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) static void do_check_align(CPUSPARCState *env, target_ulong addr, uint32_t align, uintptr_t ra) { @@ -367,11 +368,7 @@ static void do_check_align(CPUSPARCState *env, target_ulong addr, cpu_raise_exception_ra(env, TT_UNALIGNED, ra); } } - -void helper_check_align(CPUSPARCState *env, target_ulong addr, uint32_t align) -{ - do_check_align(env, addr, align, GETPC()); -} +#endif #if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) && \ defined(DEBUG_MXCC) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 8fabed28fd..8f6fd453e7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -68,6 +68,15 @@ static TCGv cpu_wim; /* Floating point registers */ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; +typedef struct DisasDelayException { + struct DisasDelayException *next; + TCGLabel *lab; + TCGv_i32 excp; + /* Saved state at parent insn. */ + target_ulong pc; + target_ulong npc; +} DisasDelayException; + typedef struct DisasContext { DisasContextBase base; target_ulong pc; /* current Program Counter: integer or DYNAMIC_PC */ @@ -89,6 +98,7 @@ typedef struct DisasContext { int fprs_dirty; int asi; #endif + DisasDelayException *delay_excp_list; } DisasContext; typedef struct { @@ -984,9 +994,38 @@ static void gen_exception(DisasContext *dc, int which) dc->base.is_jmp = DISAS_NORETURN; } -static void gen_check_align(TCGv addr, int mask) +static TCGLabel *delay_exceptionv(DisasContext *dc, TCGv_i32 excp) { - gen_helper_check_align(tcg_env, addr, tcg_constant_i32(mask)); + DisasDelayException *e = g_new0(DisasDelayException, 1); + + e->next = dc->delay_excp_list; + dc->delay_excp_list = e; + + e->lab = gen_new_label(); + e->excp = excp; + e->pc = dc->pc; + /* Caller must have used flush_cond before branch. */ + assert(e->npc != JUMP_PC); + e->npc = dc->npc; + + return e->lab; +} + +static TCGLabel *delay_exception(DisasContext *dc, int excp) +{ + return delay_exceptionv(dc, tcg_constant_i32(excp)); +} + +static void gen_check_align(DisasContext *dc, TCGv addr, int mask) +{ + TCGv t = tcg_temp_new(); + TCGLabel *lab; + + tcg_gen_andi_tl(t, addr, mask); + + flush_cond(dc); + lab = delay_exception(dc, TT_UNALIGNED); + tcg_gen_brcondi_tl(TCG_COND_NE, t, 0, lab); } static void gen_mov_pc_npc(DisasContext *dc) @@ -5019,9 +5058,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) tcg_gen_mov_tl(cpu_tmp0, cpu_src1); } } + gen_check_align(dc, cpu_tmp0, 3); gen_helper_restore(tcg_env); gen_mov_pc_npc(dc); - gen_check_align(cpu_tmp0, 3); tcg_gen_mov_tl(cpu_npc, cpu_tmp0); dc->npc = DYNAMIC_PC_LOOKUP; goto jmp_insn; @@ -5044,12 +5083,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) switch (xop) { case 0x38: /* jmpl */ { - TCGv t = gen_dest_gpr(dc, rd); - tcg_gen_movi_tl(t, dc->pc); - gen_store_gpr(dc, rd, t); - + gen_check_align(dc, cpu_tmp0, 3); + gen_store_gpr(dc, rd, tcg_constant_tl(dc->pc)); gen_mov_pc_npc(dc); - gen_check_align(cpu_tmp0, 3); gen_address_mask(dc, cpu_tmp0); tcg_gen_mov_tl(cpu_npc, cpu_tmp0); dc->npc = DYNAMIC_PC_LOOKUP; @@ -5060,8 +5096,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) { if (!supervisor(dc)) goto priv_insn; + gen_check_align(dc, cpu_tmp0, 3); gen_mov_pc_npc(dc); - gen_check_align(cpu_tmp0, 3); tcg_gen_mov_tl(cpu_npc, cpu_tmp0); dc->npc = DYNAMIC_PC; gen_helper_rett(tcg_env); @@ -5643,6 +5679,7 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); + DisasDelayException *e, *e_next; bool may_lookup; switch (dc->base.is_jmp) { @@ -5704,6 +5741,19 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) default: g_assert_not_reached(); } + + for (e = dc->delay_excp_list; e ; e = e_next) { + gen_set_label(e->lab); + + tcg_gen_movi_tl(cpu_pc, e->pc); + if (e->npc % 4 == 0) { + tcg_gen_movi_tl(cpu_npc, e->npc); + } + gen_helper_raise_exception(tcg_env, e->excp); + + e_next = e->next; + g_free(e); + } } static void sparc_tr_disas_log(const DisasContextBase *dcbase, From patchwork Tue Oct 17 06:11:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734292 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324295wro; Mon, 16 Oct 2023 23:21:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhr5Eo5A9iotpcorMx5aiZPtr0l/rIVriKGHR3Ye1hP4+XfNitW7ht+5gA2toQSh/aL0Yt X-Received: by 2002:a05:620a:400a:b0:775:8e55:3da7 with SMTP id h10-20020a05620a400a00b007758e553da7mr1546692qko.54.1697523671562; Mon, 16 Oct 2023 23:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523671; cv=none; d=google.com; s=arc-20160816; b=tje3juMRIGdhcTYI5Lxnjp8207DGyNRuCvQF3Sqh699viVF4QGh+s0NBimpX+2SvGP tpQ36Ni49emgQ6ZwTYJq10I5p2UsMeoOPWmPPD/iK2fdJ0YHlmh0Iu8LqVejuoaE/2la oP9BYJSIemFJW6mDbC8HC2HSpR6uoGiAvAgWWffyoKPvpjgAOc671h7TiJIiy9HCo1z0 qwPKcfgrSo7lbmXGMbSisqEhdKnnbOcmjII6WEZIiop6nv67yPQBYpRb0hGeeutc6EWc 9Vob9ysLAHXZKy0UDaTw12834m31nPMj2WyoYDJDCsDUDSEBoJZcKs6uWrRJS8cN7Wy3 REVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=/T5XaZy2rs7d2UUVgUOSmmRBHeDvLpxjj7qjWAVo54c=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=sudwNXiq1NdprvHowxr1n0SbJP4W6UNu30j0/wjpBWvDx/sCXOmKBl8zvYbCxBs9Am GfdX6+JLGGAsPP7vb+4PQTl8ubKHJzmpxVaSja9yT1Bm2ZtpN4T+B8O2p71xbeKXsCjp GmKBjSE0E20L9tqW4Q/liHlQmpfR3Jp9TtEr7cKBfkAr+H+FQNftgRmoGjhRdyJX2qyX xpFW+0xXcdT5CxzpTWes7bosIpbAQTbnQAupFhYPt3sxc2EtuJ2T4nRDmvt0AWZNGljU VCjBNZ7NXc2zKYG0JfDy4xlk23sihS9YW7iahFnGrf8PBZ6iS+IbCsiB2otM4CnZgdim 996g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U1Hneme1; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q15-20020a05620a024f00b00767f3ee54a3si593170qkn.80.2023.10.16.23.21.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:11 -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=U1Hneme1; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK1-0008Nd-8X; Tue, 17 Oct 2023 02:12:53 -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 1qsdJz-0008Mk-I0 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:51 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdJx-0003oq-U0 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:51 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5ab94fc098cso1987635a12.1 for ; Mon, 16 Oct 2023 23:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523168; x=1698127968; 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=/T5XaZy2rs7d2UUVgUOSmmRBHeDvLpxjj7qjWAVo54c=; b=U1Hneme1dZUPUISq7/8N8msYOy1ZbcRWY0XA8c7SHv1xPhgZwMa+8ZTTIR/El+KP4S q4VQ19PuoZiqkGofLdNhcIHfIyYLHNPQ7DJecvJhew015/uLwkZmeqEQ3MLPTb5NJmN7 6KgdsEikJNNxA2naq9FgDEkeVfY05KPAGr/U6/vBligZxXJyyhLEYOHW0sgPZziUpVUn OGdqx0Xz7uF62gt4++lo428zWEeKGSeZB6l+SCi2bD7kx+W9JnraUhmnefHHsUKXn/Yj 74lfR83j7X644IEQfTm2obwq+G+0qmZdl+Eb3A0g/N4RqUk8NxDUO6qV9RpSkLmrDwcS +28g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523168; x=1698127968; 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=/T5XaZy2rs7d2UUVgUOSmmRBHeDvLpxjj7qjWAVo54c=; b=ZLpPgjKRPlrW9tlxlh1YgAi/cCYGAJ2paHFa7O0NQb/5hKeMwAc7WhRVmUtwoQc6Ny DUoghDCG3K7y+Wk75LezBXf9qc3IOP8LQWqpXa9YCA4ZruOVI6agBctoiLSUB2A8oWs3 MNtWqfczrj6CVBZ1kcHdqA0amGrg9tSY4YMBnnCNl5SIPaHqDm/S2D6P3eqMXSxP/vyv kn11l4gjG0NbaXe/0C0I+BMqx5IdmnWh/7tfDbs6uKQs0Z6dl3Z2GOiVjCDT4toOv0i4 PBLyrn3OVuCGB0/pWMFaOaGP2fwFwedakv5PfGZ11zpK4RLJu4qA/Qyp/pjfqlVDQDIQ KOcw== X-Gm-Message-State: AOJu0YxsnoSjmht0+R4GZUdRM3DlPLOuVjceF0euzgV6teiywiKJGsQU gV6Qrmx6Y2vmghAKTBPQz4F+eY9tdmMVjSh/QYU= X-Received: by 2002:a05:6a21:7802:b0:14d:abc:73dc with SMTP id be2-20020a056a21780200b0014d0abc73dcmr1112968pzc.32.1697523168365; Mon, 16 Oct 2023 23:12:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 03/90] target/sparc: Avoid helper_raise_exception in helper_st_asi Date: Mon, 16 Oct 2023 23:11:17 -0700 Message-Id: <20231017061244.681584-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 Always use cpu_raise_exception_ra with GETPC for unwind. Signed-off-by: Richard Henderson --- target/sparc/ldst_helper.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 246de86c98..09066d5487 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -1650,7 +1650,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, int idx = ((asi & 2) >> 1) | ((asi & 8) >> 2); env->dmmu.sun4v_tsb_pointers[idx] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case 0x33: @@ -1662,7 +1662,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, */ env->dmmu.sun4v_ctx_config[(asi & 8) >> 3] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case 0x35: @@ -1679,7 +1679,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, int idx = ((asi & 2) >> 1) | ((asi & 8) >> 2); env->immu.sun4v_tsb_pointers[idx] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case 0x37: @@ -1691,7 +1691,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, */ env->immu.sun4v_ctx_config[(asi & 8) >> 3] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case ASI_UPA_CONFIG: /* UPA config */ @@ -1920,6 +1920,8 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, default: sparc_raise_mmu_fault(cs, addr, true, false, 1, size, GETPC()); return; + illegal_insn: + cpu_raise_exception_ra(env, TT_ILL_INSN, GETPC()); } } #endif /* CONFIG_USER_ONLY */ From patchwork Tue Oct 17 06:11:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734269 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322930wro; Mon, 16 Oct 2023 23:16:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSjPKO6ZL2gpgAb3aGneU8RJON8DI8T47KENPtMoZ8nhf50Oi4jkSlf1AuA3OEdI3tPTfz X-Received: by 2002:ad4:5be2:0:b0:66d:23e4:2ce6 with SMTP id k2-20020ad45be2000000b0066d23e42ce6mr1602033qvc.47.1697523387118; Mon, 16 Oct 2023 23:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523387; cv=none; d=google.com; s=arc-20160816; b=r6iQ4Jy7hO0AXZ/ooDMmM8XBbs7czEFl49y2JfAIFqR/F9f4VcOAgkiTqJ3jVjqOh9 T3rDjRwOspluuxpiMyVWfXxWwjv8KwkQXhf/8a6CEr9vQRvjUTBnuFpJelhPe4yIA4R+ 56vdG7J6bxvMj3HJzfN3Z+Z9CYaTA/NnLgIr/Yhp5ZHMkYNF5VhHEoxu0wWijnhyfjpH CXGXiZxMDto3+BsdS0XDpONkmBZBF8MyDfoPlBVCZ6MEWPGMYn2u7c5m6ki8EtI8zGVZ bkERDMLx/8bJk+9FmgyOVig4oI4i+v+virUWr2tWUgfEUGwGloccAUluf6+XR3MoSY2k Y9CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Xd5Svu0+B7OGG++QiM45a02WgNYRHjpbrT0y5ShkAgs=; fh=GkmytpQ/aBK+SnhsUxtqa1dYh9qnVue5D4c8ejqHfb0=; b=xWRlLepWs3bR58KhCbpnCLupvMpA91lqDppNfvZQBHKptL0VJF+tdTu8rWTO83IvB8 gj/EjYFh39zcTabUnMCpNtvEhgHAmZ1dWklBU0NTXjJBlJbwrHMc8FQkmx1y+wGUTZjc /Zv/z/I1qd/tTQipjJATI+EaTQkLH8sJgMiJtJaTrwdHPsgXb8dM4A3OGFFu8Atmj7vp o/elbt0lVIiRGPnERUtZjzKiULwoLir6Qs1gx7xY/9fY6QeaH8P+VfFtatAGbD65E/il fhNGqtQNPG0jvNibhELxAod4uRnKRRkWVdY/wQF5yGgHJxcGwN5uWNR+zc7Te/spSmDc pmcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WfuHpglZ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b11-20020a0cfb4b000000b0065afce4a725si541041qvq.47.2023.10.16.23.16.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:16:27 -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=WfuHpglZ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK2-0008Oe-8A; Tue, 17 Oct 2023 02:12:54 -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 1qsdK0-0008NE-Db for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:52 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdJy-0003pH-QS for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:52 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6be1bc5aa1cso1587059b3a.3 for ; Mon, 16 Oct 2023 23:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523169; x=1698127969; 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=Xd5Svu0+B7OGG++QiM45a02WgNYRHjpbrT0y5ShkAgs=; b=WfuHpglZnG5ZjPSh3W77/LCOpPSKW5xqHvPwZSTbDp8r3XKXmwyoRp0fLmTfPEUFOf tnicUqPl66+wOUkKCdsbX3o5/GSnbRDgleZXGVtSVpHgvWS4Ng2NYo1EcD4HJ3OHzxCc 73GI93IiNBkTOMQZYvSYxZkpil9JHOJYqabFNREpByufby6sXok0CwHHd/7X5nL1gK8Q jkGrZXFQAnWUXb6o5Sy8ahLf6HT0j6ylD+acncDk88hz0wCBeBOwxKB0N4kqwPQFJpMX PfqGBTNc+cXn4w3xzlB1WKJ4z2W6J+2Tl+U/Ivza6q8UP783UBrwIraAK2KlzMvOL6wB W2cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523169; x=1698127969; 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=Xd5Svu0+B7OGG++QiM45a02WgNYRHjpbrT0y5ShkAgs=; b=hHJMrGKKgHzxt9EO+viNYkMyQtPBQbHBwB01VuVn9FFbA4b07k+Dn4+NAHCs8GOu0L 4D7vo7teYjLlW9FqSHgiwI2g+bC0tsaHC7lAta2H/3IDPmdocLZYRKjzQ7dCr6BhyECr 1iJIVSxmx2yBLgwLRJuWgvlzsEy0piytXX9UOLUtvLigSPFA7BnDLrL1eGHkTzunbg8Q ikP0kLdetBl+i1+EoWPitf76x0OEPiKNS2RukAq/m0Kwgb/gxtHya0CEsdclQ9kM2Bfc bh09m5P9U1uX3r8YscdorLl6Ug1ePkomFjm4MOYyqfQvQPQhW0xL86ivhdrIo7K4I26C +b7Q== X-Gm-Message-State: AOJu0Ywg+jmtZzhEYr13mM1393gKz+eIrwauGJrTSty3IElu7Lv+0TAi JQvyRhMyKuLnARhxloWZIKBSHYXC5RA+ztoICek= X-Received: by 2002:a05:6300:8086:b0:17a:de5d:1d7e with SMTP id ap6-20020a056300808600b0017ade5d1d7emr1201543pzc.55.1697523169292; Mon, 16 Oct 2023 23:12:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 04/90] target/sparc: Set TCG_GUEST_DEFAULT_MO Date: Mon, 16 Oct 2023 23:11:18 -0700 Message-Id: <20231017061244.681584-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 Always use TSO, per the Oracle 2015 manual. This is slightly less restrictive than the TCG_MO_ALL default, and happens to match the i386 model, which will eliminate a few extra barriers on that host. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sparc/cpu.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index b3a98f1d74..9fc5c401d2 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -6,6 +6,29 @@ #include "exec/cpu-defs.h" #include "qemu/cpu-float.h" +/* + * From Oracle SPARC Architecture 2015: + * + * Compatibility notes: The PSO memory model described in SPARC V8 and + * SPARC V9 compatibility architecture specifications was never implemented + * in a SPARC V9 implementation and is not included in the Oracle SPARC + * Architecture specification. + * + * The RMO memory model described in the SPARC V9 specification was + * implemented in some non-Sun SPARC V9 implementations, but is not + * directly supported in Oracle SPARC Architecture 2015 implementations. + * + * Therefore always use TSO in QEMU. + * + * D.5 Specification of Partial Store Order (PSO) + * ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. + * + * D.6 Specification of Total Store Order (TSO) + * ... PSO with the additional requirement that all [stores] are followed + * by an implied MEMBAR #StoreStore. + */ +#define TCG_GUEST_DEFAULT_MO (TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST) + #if !defined(TARGET_SPARC64) #define TARGET_DPREGS 16 #else From patchwork Tue Oct 17 06:11:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734288 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324281wro; Mon, 16 Oct 2023 23:21:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlll0FNUGV2HlGIiH20Mb0bbBt6wZpv42aPy0yyzezTEJHSvY7k5AuI7cWaaSRKzJgCt8s X-Received: by 2002:a05:622a:1a11:b0:412:2513:fb6 with SMTP id f17-20020a05622a1a1100b0041225130fb6mr1829779qtb.5.1697523670003; Mon, 16 Oct 2023 23:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523669; cv=none; d=google.com; s=arc-20160816; b=S2uEACbciztPH+erbRP2yKNQ/LPFuoQvT6+fmVyYSA2xwKYL9ayj1PaNLDmPAmRv9w n87Wal6Hto2vVX4Fb1baSrwoMfXQHXiF+z3ugx1B1olHNfgtP/9oZsK3TYm9giaQNHu1 rDb7OhHvHpnzP3JZHpuUedIQY6IX2Sy/P+NJ2tUR4EPuhtKOLqMxyJppaXxHg4d2TPYp 8/obdluxD82y4rT2HZa1LSGPPKjv49JnaB45ooOeGKTBlQiDfDDThY7oWOsDy5vpV4WY /4wA5tnjQ+wDjEDY26Yw/sydE9yQoIs979mOJAS9pbFyvPNJALcjG0bW/2GrbpsiLay9 XvbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=jct63rFb48sV+5hvOO6V2h6GbxQHLHhpSIfreHhtJXo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=DsnWnUIIbFHz+UZ5L64+uUDMPX2DstPwQu6bo3a5svBeeO+MwBcQEBiq5KAUtRRTid GcOBirWFk4maobtLQo/kBoFWGliY78HkrQW4v3p6TrOLIMwFbJDzp5V8EYTYl9gzVNQS qSEgBTw/Yep5Y2skPdKgDH6onwoSvyW/bWEsyne5Ulfh2W3ATsTqCYzvlioIEAokJ9m4 6ANYlUeVaFMIh+6xf6eUA3fF0OzdrircSLUIZlTZrrZYxTjUZ3Z15KMTe5iJwk49UfKL dvSFYbRC/9g8DKCLRD2IdqboobXvQDnc5PCCI47L0ix0ewyWIRSuvAvQQoMepvMd3UUu s9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sYxnQ3Sw; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b10-20020a05622a020a00b00417fa4d4ffcsi675029qtx.104.2023.10.16.23.21.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:09 -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=sYxnQ3Sw; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK2-0008PA-U6; Tue, 17 Oct 2023 02:12:54 -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 1qsdK1-0008Ng-81 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:53 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdJz-0003pT-O4 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:52 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c9b1e3a809so33952235ad.2 for ; Mon, 16 Oct 2023 23:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523170; x=1698127970; 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=jct63rFb48sV+5hvOO6V2h6GbxQHLHhpSIfreHhtJXo=; b=sYxnQ3Swtie9lwFepnhRwSJapnKVcN1tM/GtQFMVuxxt7Cvb/x4/8+TBtzMCMUvDGV Omr6EAeAQsu1VV8NMD+b+J9eI2Z0M9pqou/wvbnbsA1nRArd8D7wLcT19FMyUjBgnpm8 QD6fUeBDeqyEU15qH7eNsIX1Gzbia1yekZyKG9RGYIyrBX8buvdyQNPzTjRm8DRFCjRX XrQSX58yXv8k9/JPojHIht6F/F7ycCokUyHrR3bqaseq5e6g1bXrSfMNyzcRu92zHg/o FO8qh+oItG9CRy4g8ucTIptUfmXKHhOh0RLNrJVk5D49hOsN1iseNBO0ZwfTsCLKyCa4 Xbnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523170; x=1698127970; 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=jct63rFb48sV+5hvOO6V2h6GbxQHLHhpSIfreHhtJXo=; b=vwEwet4774Hd6Xyn1XTTUNJbOOaU5mjGs+CfTHQmdlrAx1uZK0VVHK/mkZHkl3aF2D v1NIaYYHqKb7jSVI4jB9vxXfxyP84/AYe/YuppTlXTEHWKmSnIzXfqwnkmK1lGtaW+nK CCCTqSd2fSeabqxEUlDoF6jeYhsk1wEDx8ucwv9coLH5ZmuHJIOy5CXvR6c6hvpDSb2/ ZphxwIvvHojWRUR5qkayBxbi9MMAVKicDS3UzxWNmRoLucvZPMIP7DzOX5JDWBMlvHIJ Bzkzdk5Rd31nV3ZfuEJxVwrzOLtjbUAz7uhI4xZHlgF/Tvk2Dw5LXqKuN0udCTslXSY+ g3fg== X-Gm-Message-State: AOJu0YxwHlAfqCapxc1MzlYf59YuVGxO0MZy9CKwO6eEpU/ykEMDbTKj LuvR7tCOTHqXBlWa87q6woSIJv6sSUindrH/UNk= X-Received: by 2002:a17:903:138f:b0:1ca:18b3:3599 with SMTP id jx15-20020a170903138f00b001ca18b33599mr1124305plb.68.1697523169971; Mon, 16 Oct 2023 23:12:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 05/90] configs: Enable MTTCG for sparc, sparc64 Date: Mon, 16 Oct 2023 23:11:19 -0700 Message-Id: <20231017061244.681584-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 This will be of small comfort to sparc64, because both sun4u and sun4v board models force max_cpus = 1. But it does enable actual smp for sparc32 sun4m. Signed-off-by: Richard Henderson --- configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/targets/sparc-softmmu.mak b/configs/targets/sparc-softmmu.mak index 454eb35499..a5d9200382 100644 --- a/configs/targets/sparc-softmmu.mak +++ b/configs/targets/sparc-softmmu.mak @@ -1,2 +1,3 @@ TARGET_ARCH=sparc TARGET_BIG_ENDIAN=y +TARGET_SUPPORTS_MTTCG=y diff --git a/configs/targets/sparc64-softmmu.mak b/configs/targets/sparc64-softmmu.mak index d3f8a3b710..36ca64ec41 100644 --- a/configs/targets/sparc64-softmmu.mak +++ b/configs/targets/sparc64-softmmu.mak @@ -1,3 +1,4 @@ TARGET_ARCH=sparc64 TARGET_BASE_ARCH=sparc TARGET_BIG_ENDIAN=y +TARGET_SUPPORTS_MTTCG=y From patchwork Tue Oct 17 06:11:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734302 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324648wro; Mon, 16 Oct 2023 23:22:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5L076kXdSVkUBtuF7T2fjVXBd3xdNtnoldZvesP47yOOub8nH89Hh6Wd9Iy5/WbmIhxQP X-Received: by 2002:a05:620a:400a:b0:773:ca55:e833 with SMTP id h10-20020a05620a400a00b00773ca55e833mr1574083qko.12.1697523747248; Mon, 16 Oct 2023 23:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523747; cv=none; d=google.com; s=arc-20160816; b=xb8Uo72d5jl7T2syIPrHxveB61JJ3uBFFDnAAxMy/mbHUJu/4BZArlXybJgk7mnXHw 0HwIxXJyhy020SB9VC1pk6QXiZFHBBaNepQz8eAkW2w9XCVycZlcTI1fMWGUlWz2YTSk fb+zm9UvoOVP5+l7Lw6mgTubfN2yTOuaGBAjP9Qazm7UlTLtJ6ULKbCbW6sE46welExj H+kzgMHN0wQuCMVwCJS3CiF/Xo7Xw/gaoKORnMURN6jr4JTuHKo1SaUUce1d70+5RsZ0 hdtDs7g8XT1nlLjS2NiG8W7BUtUvx5FZzyEfC+VBwVFonByjEr+QZ5Pbxp+KQqsw/bKh vVWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=tQ1zFkOdaQ00+kG6T0oOcQWDrsqZkAPXDw5MzbWcocE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=SUiOLII/tGgeROoSjI/A7JqNaLqoV8S8QDVcnuSJhDyX0T8iyhwUG2d0KrAb2HWX5h TjiLNUh1Z80sexMtBcmmmT+iwgw1lTSkp0QQRKgucgrfrQL3GGCq/jTI92ekE12ErWD0 sDsephNZ3ProgpiAgj0G/pgsGsto/VPCPbehqLSNBO8zHs7MPDOangz0IxaF9fM1tNqj fNDS2u1BVMH5hutJe8b8pOi1FWfsJmwMfVU5Razj3EuUcFF7t1ZlmssSUnknZho+lDQ6 hb9LdtsOXiHtul1l4WGesyJmmfb0USmbSxRA9MqeQEGUyf4Zytz43d6f+oUN0fLo6E0i mPcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iCmgv6Hl; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bk23-20020a05620a1a1700b0076d990f8864si630991qkb.259.2023.10.16.23.22.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22:27 -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=iCmgv6Hl; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK3-0008Pl-K9; Tue, 17 Oct 2023 02:12:55 -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 1qsdK1-0008OR-To for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:53 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK0-0003pd-55 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:53 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-564af0ac494so3493991a12.0 for ; Mon, 16 Oct 2023 23:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523171; x=1698127971; 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=tQ1zFkOdaQ00+kG6T0oOcQWDrsqZkAPXDw5MzbWcocE=; b=iCmgv6Hlx/rSWoKvz4LywCJ44ZlF/zYmmf5Y9KT6+rvgekTjhptCF+em2iQqq+Ewj/ Tjmlpzp/eTOGrAIlk4u/52QO1FzeM8w2uv5ZxNsES7qC2OnCtijs9VhGRtFZRUVY0CvV IXGdPdusjuqo2R8z3Be/bGMKcEqnF9xfrmS0kZgI7S2SwlsjRKZKclCiSbng9WODcG8O N4S67bKAP6ktFQL2lYsBLT+OTC0jVnlRbuqiem1ZTi+FVicC9Zn5H6int6gHpiMuqvB2 kUppoQohGBlcewIIRlQyCRsHUMMIJiUXx9KFkDDR0GTuOU+CbhOHdZd4wKACkevhi1p0 jG6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523171; x=1698127971; 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=tQ1zFkOdaQ00+kG6T0oOcQWDrsqZkAPXDw5MzbWcocE=; b=M1E7uAQhWXSAj8UuXFxfAOTh1eOUK8lhyuYyDHH/48CTVUbg+n7zNq9r7VITtrWlG0 6WHVEcPH893nEWOxXZl3Z/DxYWHSz8JJOzaKXZu1TDrCL1YBfM/JRtS2cFPh6xL2e4oP +pt0dneDJqanuBFAm80vQ1/UfTzJN9rHf/udsoxPPGshhVcHbtPbd1mZg+QWsNmKe3Py VZYP+4BWrbK5/LZUCum85OvZUc0NUHaYWTWFVJQMEZoOMlB22lxwdVyfTQViUSRdjLlH 7XUg9a73iMXuMnILEmOzDQqORn3XI40dfrAd/mdRXpYfzZb2gtEwls/dbA6UIbw6r5bC eDtg== X-Gm-Message-State: AOJu0Yz8x8/V5T3cAsaBv/bbSB0Kh4jBrP7v5gvjDm77t3CUB5AdKs3n OXtNoAZbYTpmNxetqfcODFSDWbPuK8RNjon33MU= X-Received: by 2002:a05:6a20:1448:b0:16c:b514:a4c2 with SMTP id a8-20020a056a20144800b0016cb514a4c2mr1431254pzi.16.1697523170789; Mon, 16 Oct 2023 23:12:50 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 06/90] target/sparc: Define features via cpu-feature.h.inc Date: Mon, 16 Oct 2023 23:11:20 -0700 Message-Id: <20231017061244.681584-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 Manage feature bits automatically. Signed-off-by: Richard Henderson --- target/sparc/cpu.h | 32 +++++++++++++------------------- target/sparc/cpu-feature.h.inc | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 target/sparc/cpu-feature.h.inc diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 9fc5c401d2..aaecbf0876 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -291,25 +291,19 @@ struct sparc_def_t { uint32_t maxtl; }; -#define CPU_FEATURE_FLOAT (1 << 0) -#define CPU_FEATURE_FLOAT128 (1 << 1) -#define CPU_FEATURE_SWAP (1 << 2) -#define CPU_FEATURE_MUL (1 << 3) -#define CPU_FEATURE_DIV (1 << 4) -#define CPU_FEATURE_FLUSH (1 << 5) -#define CPU_FEATURE_FSQRT (1 << 6) -#define CPU_FEATURE_FMUL (1 << 7) -#define CPU_FEATURE_VIS1 (1 << 8) -#define CPU_FEATURE_VIS2 (1 << 9) -#define CPU_FEATURE_FSMULD (1 << 10) -#define CPU_FEATURE_HYPV (1 << 11) -#define CPU_FEATURE_CMT (1 << 12) -#define CPU_FEATURE_GL (1 << 13) -#define CPU_FEATURE_TA0_SHUTDOWN (1 << 14) /* Shutdown on "ta 0x0" */ -#define CPU_FEATURE_ASR17 (1 << 15) -#define CPU_FEATURE_CACHE_CTRL (1 << 16) -#define CPU_FEATURE_POWERDOWN (1 << 17) -#define CPU_FEATURE_CASA (1 << 18) +#define FEATURE(X) CPU_FEATURE_BIT_##X, +enum { +#include "cpu-feature.h.inc" +}; + +#undef FEATURE +#define FEATURE(X) CPU_FEATURE_##X = 1u << CPU_FEATURE_BIT_##X, + +enum { +#include "cpu-feature.h.inc" +}; + +#undef FEATURE #ifndef TARGET_SPARC64 #define CPU_DEFAULT_FEATURES (CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | \ diff --git a/target/sparc/cpu-feature.h.inc b/target/sparc/cpu-feature.h.inc new file mode 100644 index 0000000000..d35fe90c92 --- /dev/null +++ b/target/sparc/cpu-feature.h.inc @@ -0,0 +1,19 @@ +FEATURE(FLOAT) +FEATURE(FLOAT128) +FEATURE(SWAP) +FEATURE(MUL) +FEATURE(DIV) +FEATURE(FLUSH) +FEATURE(FSQRT) +FEATURE(FMUL) +FEATURE(VIS1) +FEATURE(VIS2) +FEATURE(FSMULD) +FEATURE(HYPV) +FEATURE(CMT) +FEATURE(GL) +FEATURE(TA0_SHUTDOWN) /* Shutdown on "ta 0x0" */ +FEATURE(ASR17) +FEATURE(CACHE_CTRL) +FEATURE(POWERDOWN) +FEATURE(CASA) From patchwork Tue Oct 17 06:11:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734274 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323465wro; Mon, 16 Oct 2023 23:18:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEiszST0WOZQ7yrk/D08tCBGhL2NIlKyaYGDkfdqmh7EVNxxuCSQNuadbMkEJYxlwqBB2o X-Received: by 2002:a05:622a:301:b0:419:4f1e:7ea9 with SMTP id q1-20020a05622a030100b004194f1e7ea9mr1732321qtw.3.1697523490930; Mon, 16 Oct 2023 23:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523490; cv=none; d=google.com; s=arc-20160816; b=Ng9jxn2GXAcuacJtW4jvfBJpFKsqudZYg9TnD49otHhmhCZb4ysjJa922LRx+wNkj9 RsXLSGSXx7GrGOI5/we/rkrMeADVM2d5pbY9cyVOigfDxGwaPxNhSxKQOmr5VAvUxDb3 ZKJ4NvojvHXpM2mSvIPdw73d1QKZXYC09ngRzvn+2HWnZF0RxXRC5AhLiV7pLSnIYYAv IT68mo6axon2VZd41dIDTOpL2S8cINvZoH7bPNzgABoMpsq6mvO4OO0hF9p08V6ruUYu P3mHGUDvCjqW9t6CjiY6G2Cki9syGtuGbUbQjEE1KCBGv/jn91tmR5jOs+LntxRips7l M+dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=ZH3dMD/AA/crmsUs16Itr1WvEaqL+uLcI9qPlF9Ii5g=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=FvrGoqJdvr39eQeN1dOxQxBscurAN5bvfPPhtZrDRvViKX6T8WiYT+RIEDaZLgGjur TyxbiNWATBHcZ7a3R/TgQ+6QAeyxbcPPsmJzKjeAUaxJOJm9TZL4izG7wdOgtr4F3xEr 08kS5zwKypvJZCxKaVZgssqGe5Dz0ba5hXQLcLFI1qi+31+v+PekXbFBuYqDjALezqha IkQlQhOFuAfx3asjNU6kLF7PRQNpU0qwRqQPPSGgsLUWGcA7X6+1yKvZWd+CvJp/wK89 uSw9JhA5zE4wVUlJBxRldnqfqo+fkToLsoR1qDIQ+xhC8gmyCyX3kSAh6K72FyiHzVJn iyfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="h3F/g/Ij"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p15-20020a05622a13cf00b004198fbc2a07si655283qtk.344.2023.10.16.23.18.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:10 -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="h3F/g/Ij"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK4-0008Q8-Qc; Tue, 17 Oct 2023 02:12:56 -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 1qsdK2-0008Ow-QL for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:54 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK1-0003pw-2C for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:54 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9d407bb15so44465445ad.0 for ; Mon, 16 Oct 2023 23:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523172; x=1698127972; 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=ZH3dMD/AA/crmsUs16Itr1WvEaqL+uLcI9qPlF9Ii5g=; b=h3F/g/IjaouhrCGzes/366bxwA25se4/Ae7ymFMAtV7TtcRXYsAb9NadZvi0cQgqNL 8hM+mY47rWX/T9V9BWpIcg2HjrpGriQCHnJYyudswiAHhqc8z/tLIjcDMZFsAzsuga0Z OALI/w+XNUNoHgy/qD7tWyrk7DPnubf2ygBGAGEWZn/cwV2MAwsZ20cJZJhvtV+9Rn+3 Zi+So98j2+4KpHMjkOpUZk4zhV0VhNiLRGkYC4c1OjWIGdI+29dXOS/0zCfOKdkooq3f mXVY75cXDfpcS6BOckidy+TtQrVS6jIuRDuFzI9P0Ja6B7KrZ+lV9W8aZ8LTDp8g+rVT zq1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523172; x=1698127972; 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=ZH3dMD/AA/crmsUs16Itr1WvEaqL+uLcI9qPlF9Ii5g=; b=oIdwk57fnxBv8o5OeRAL3M73V2kbYIB7YcxTgm12UtqCfkbztlOA2jJpLN+QrknUSc Jv+BdBJMJuTHzVwMQbkndu2uI6azxBebPTl1iDVUTx5vNuLMT/3Tqe5uYVYeTFiRaL/r flfBlZ0EfEDWO9skqX9UHFRGlaRY4qvzo+0Oxp5QIm2eC/V/T80tXU1s7kGRQ8ZRMHtL pl14yGYKKbu+K8/bAALZ5BHjX9iHvxKrKIYuouxFVTvdudfP5pHkGHodanwqumiZ06TR 3OGaD7gvQpQi2kum3nYNQn9bhPprPYpbEVFjxFDITxda4BZHk445iBHq4gn9BirWzK+o RgZQ== X-Gm-Message-State: AOJu0YyBX6Pc6p3ESnbXZfBRJXegWbiUTEK6Ws75XUZTi52LFoU/DS94 T2KketspxooPU93syqeEV2gLEzzsKUTNfKwHOmE= X-Received: by 2002:a17:902:f0d2:b0:1c9:e508:ad3b with SMTP id v18-20020a170902f0d200b001c9e508ad3bmr1280260pla.14.1697523171738; Mon, 16 Oct 2023 23:12:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 07/90] target/sparc: Use CPU_FEATURE_BIT_* for cpu properties Date: Mon, 16 Oct 2023 23:11:21 -0700 Message-Id: <20231017061244.681584-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Use symbols not integer constants for the bit positions. Signed-off-by: Richard Henderson --- target/sparc/cpu.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 8ba96ae225..e4d1c552e5 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -836,20 +836,34 @@ static PropertyInfo qdev_prop_nwindows = { }; static Property sparc_cpu_properties[] = { - DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, 0, false), - DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, 1, false), - DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, 2, false), - DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, 3, false), - DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, 4, false), - DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, 5, false), - DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, 6, false), - DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, 7, false), - DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, 8, false), - DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, 9, false), - DEFINE_PROP_BIT("fsmuld", SPARCCPU, env.def.features, 10, false), - DEFINE_PROP_BIT("hypv", SPARCCPU, env.def.features, 11, false), - DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, 12, false), - DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, 13, false), + DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLOAT, false), + DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLOAT128, false), + DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_SWAP, false), + DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_MUL, false), + DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_DIV, false), + DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLUSH, false), + DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FSQRT, false), + DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FMUL, false), + DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_VIS1, false), + DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_VIS2, false), + DEFINE_PROP_BIT("fsmuld", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FSMULD, false), + DEFINE_PROP_BIT("hypv", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_HYPV, false), + DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_CMT, false), + DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_GL, false), DEFINE_PROP_UNSIGNED("iu-version", SPARCCPU, env.def.iu_version, 0, qdev_prop_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0), From patchwork Tue Oct 17 06:11:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734275 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323470wro; Mon, 16 Oct 2023 23:18:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9B26QRkHw0gN4VGnbr6UxrlUBGtCgp2ORLRXFFtmWzcYaCxWn2jH8158KEEvOgbSIqiM/ X-Received: by 2002:a05:622a:91:b0:418:804:3406 with SMTP id o17-20020a05622a009100b0041808043406mr1792224qtw.39.1697523491864; Mon, 16 Oct 2023 23:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523491; cv=none; d=google.com; s=arc-20160816; b=0bUz07huuDuFU5lIsx3aMzgopF3cUb0w6ARa2Xv91gxRsH2MUx9bszaR8w2yHwQSYR USa5kLHlf9K8txNiwUcqfAoBX/JfEDXXHhZR9260YLwwE0OcZZgYc5d+FBkuphg/f4EM JHHQaNVL3Na8WMibE8n4uY9Ka3/LGxWgMvNJMxdKwf88k79/9M2OKrMl0aEriQU55n8M Wt9MIEoTkatVBv8EroF+huOUWFjxJWFYenMqNTbisUGblqF3P2FeSkBTV4PPxSOx+Pd6 PHi0mKI1qbwmzTNgIn01IZH97qbjeTb0rb6sw2pp37K7g+AGhTcUHx2dKJAYAIreveZ4 x7EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=v+wpTJ/UmKvrUO2dhPZ2tX5kAAWYozv+5cgy4f/b128=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=PipIdfPb3NlPKDM9FYoYlL5bwN1HeZTQJUWpFa4W2VvHCNrgQUuuxNiml5atFx79vK Uh9K6naN73vPGX4OVIrDEZrva1v8iXXATTCMJWmPkVX6zypSgKh9wCHOis19ND4m7Pqi 5ylyPqupNISVYTXFDyrXWbJvGsRq9aHrsUfWZR9X7xpEK1rmQoVfKUHUpuJfujoHZ7VH 09VfOcd5cdyNbVe0IVPyBeI76PC0yWVECffpthKvjBcEwmSLZ1xQVXkalJya9LnJcScI H1N7YxuPp0QpkhM5XXQMl9qQRkbO1YdIrd9aW4nHVamr8u4LCu+XRjzFSJCSJjDu0mwl g1Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Uv/ej4sF"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r16-20020a05622a035000b0041986d97925si670337qtw.299.2023.10.16.23.18.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:11 -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="Uv/ej4sF"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKH-0000Tu-BZ; Tue, 17 Oct 2023 02:13:09 -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 1qsdKF-0000ON-Ml for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:07 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK2-0003qD-Cl for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:07 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c0ecb9a075so34900195ad.2 for ; Mon, 16 Oct 2023 23:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523172; x=1698127972; 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=v+wpTJ/UmKvrUO2dhPZ2tX5kAAWYozv+5cgy4f/b128=; b=Uv/ej4sFM7CCfOHKz7NObGh7iHPQcj53rChDgXe7SMGL151H56LnZ8DiCSUbrAs1Bu kf1QKxAgz6WS0y85Y85j6X4TJGgWhOkedANFqwqoDEgzeiWhzsLuU8BocI6QXoEyCtvc Vg6gTUwquyOiBeQc3VLnM3c8Bgd43EOQ2jFER3o17KgR8aN9ec6Md1r1MFe2GrX47JZW 0xnBgwH3+15HYE7jSaP51GFvvyLdsTb4fFaNP+vMah2KEobmJiGeAtghf8SGJbv5afym 3moCg3zlOAhkn9W8frri9X+/GwMNhVtwZO5Gdi5r4mGU1JnSY6RnEOvizUMFKeiQn92d hYog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523173; x=1698127973; 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=v+wpTJ/UmKvrUO2dhPZ2tX5kAAWYozv+5cgy4f/b128=; b=Qx+LJX6PzDU2lbN3n1vQEVqVuVrpnoRRlC4LfMgBc0VPYLwogaO13aT8NclgkcaZSA e66LThY2xBfUv+3WlsaSoDYv/1plfptvc5+v9bQGLDM15s7GwU8GXnsEWYg8O9TiKaPV OH7oiwtAi0bIiFHDNolK/Jt/bGHHthzCjM22JQIhaiNpmFl+CSPITNDII27Sqb87iPEC iDHp/2clkDtcX2AhCdhE1ndLdXU68lfS4h89GbUExoGC49HDcO0K1YctEps+Cv10lz78 Z5WYmUJEPFO1VVUoMi9cHVEgNPS2xPJCZ8rNhGordXlDwJlSzSBLQE5tNQVUBl/Hj7H3 tWbw== X-Gm-Message-State: AOJu0YxMW03dPC9psTLCbr4TuShCuJ5amWV/sjNabtIVReRns5rYbYa0 0YSif/7pBoEYN14lwPQiSrMzQibDSQQR1FLCnZU= X-Received: by 2002:a17:902:7609:b0:1c9:dff1:6ded with SMTP id k9-20020a170902760900b001c9dff16dedmr1460434pll.1.1697523172588; Mon, 16 Oct 2023 23:12:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 08/90] target/sparc: Remove sparcv7 cpu features Date: Mon, 16 Oct 2023 23:11:22 -0700 Message-Id: <20231017061244.681584-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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, 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 oldest supported cpu is the microsparc 1; all other cpus use CPU_DEFAULT_FEATURES. Remove the features that must always be present for sparcv7: FLOAT, SWAP, FLUSH, FSQRT, FMUL. Signed-off-by: Richard Henderson --- linux-user/sparc/target_syscall.h | 6 +----- target/sparc/cpu.h | 21 +++++++-------------- target/sparc/cpu-feature.h.inc | 5 ----- target/sparc/cpu.c | 19 +++---------------- target/sparc/translate.c | 12 ------------ 5 files changed, 11 insertions(+), 52 deletions(-) diff --git a/linux-user/sparc/target_syscall.h b/linux-user/sparc/target_syscall.h index be77e44eb8..e421165357 100644 --- a/linux-user/sparc/target_syscall.h +++ b/linux-user/sparc/target_syscall.h @@ -50,11 +50,7 @@ static inline abi_ulong target_shmlba(CPUSPARCState *env) #ifdef TARGET_SPARC64 return MAX(TARGET_PAGE_SIZE, 16 * 1024); #else - if (!(env->def.features & CPU_FEATURE_FLUSH)) { - return 64 * 1024; - } else { - return 256 * 1024; - } + return 256 * 1024; #endif } diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index aaecbf0876..758a4e8aaa 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -306,17 +306,12 @@ enum { #undef FEATURE #ifndef TARGET_SPARC64 -#define CPU_DEFAULT_FEATURES (CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | \ - CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ - CPU_FEATURE_FLUSH | CPU_FEATURE_FSQRT | \ - CPU_FEATURE_FMUL | CPU_FEATURE_FSMULD) +#define CPU_DEFAULT_FEATURES (CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ + CPU_FEATURE_FSMULD) #else -#define CPU_DEFAULT_FEATURES (CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | \ - CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ - CPU_FEATURE_FLUSH | CPU_FEATURE_FSQRT | \ - CPU_FEATURE_FMUL | CPU_FEATURE_VIS1 | \ - CPU_FEATURE_VIS2 | CPU_FEATURE_FSMULD | \ - CPU_FEATURE_CASA) +#define CPU_DEFAULT_FEATURES (CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ + CPU_FEATURE_FSMULD | CPU_FEATURE_CASA | \ + CPU_FEATURE_VIS1 | CPU_FEATURE_VIS2) enum { mmu_us_12, // Ultrasparc < III (64 entry TLB) mmu_us_3, // Ultrasparc III (512 entry TLB) @@ -799,14 +794,12 @@ static inline void cpu_get_tb_cpu_state(CPUSPARCState *env, vaddr *pc, if (env->pstate & PS_AM) { flags |= TB_FLAG_AM_ENABLED; } - if ((env->def.features & CPU_FEATURE_FLOAT) - && (env->pstate & PS_PEF) - && (env->fprs & FPRS_FEF)) { + if ((env->pstate & PS_PEF) && (env->fprs & FPRS_FEF)) { flags |= TB_FLAG_FPU_ENABLED; } flags |= env->asi << TB_FLAG_ASI_SHIFT; #else - if ((env->def.features & CPU_FEATURE_FLOAT) && env->psref) { + if (env->psref) { flags |= TB_FLAG_FPU_ENABLED; } #endif diff --git a/target/sparc/cpu-feature.h.inc b/target/sparc/cpu-feature.h.inc index d35fe90c92..d800f18c4e 100644 --- a/target/sparc/cpu-feature.h.inc +++ b/target/sparc/cpu-feature.h.inc @@ -1,11 +1,6 @@ -FEATURE(FLOAT) FEATURE(FLOAT128) -FEATURE(SWAP) FEATURE(MUL) FEATURE(DIV) -FEATURE(FLUSH) -FEATURE(FSQRT) -FEATURE(FMUL) FEATURE(VIS1) FEATURE(VIS2) FEATURE(FSMULD) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index e4d1c552e5..0a3882653c 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -403,9 +403,7 @@ static const sparc_def_t sparc_defs[] = { .mmu_sfsr_mask = 0x00016fff, .mmu_trcr_mask = 0x0000003f, .nwindows = 7, - .features = CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | CPU_FEATURE_MUL | - CPU_FEATURE_DIV | CPU_FEATURE_FLUSH | CPU_FEATURE_FSQRT | - CPU_FEATURE_FMUL, + .features = CPU_FEATURE_MUL | CPU_FEATURE_DIV, }, { .name = "TI MicroSparc II", @@ -757,9 +755,8 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) CPUSPARCState *env = &cpu->env; #if defined(CONFIG_USER_ONLY) - if ((env->def.features & CPU_FEATURE_FLOAT)) { - env->def.features |= CPU_FEATURE_FLOAT128; - } + /* We are emulating the kernel, which will trap and emulate float128. */ + env->def.features |= CPU_FEATURE_FLOAT128; #endif env->version = env->def.iu_version; @@ -836,22 +833,12 @@ static PropertyInfo qdev_prop_nwindows = { }; static Property sparc_cpu_properties[] = { - DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FLOAT, false), DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, CPU_FEATURE_BIT_FLOAT128, false), - DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_SWAP, false), DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, CPU_FEATURE_BIT_MUL, false), DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, CPU_FEATURE_BIT_DIV, false), - DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FLUSH, false), - DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FSQRT, false), - DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FMUL, false), DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, CPU_FEATURE_BIT_VIS1, false), DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 8f6fd453e7..cab9f13421 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3527,11 +3527,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) gen_ne_fop_FF(dc, rd, rs2, gen_helper_fabss); break; case 0x29: /* fsqrts */ - CHECK_FPU_FEATURE(dc, FSQRT); gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); break; case 0x2a: /* fsqrtd */ - CHECK_FPU_FEATURE(dc, FSQRT); gen_fop_DD(dc, rd, rs2, gen_helper_fsqrtd); break; case 0x2b: /* fsqrtq */ @@ -3559,16 +3557,13 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); break; case 0x49: /* fmuls */ - CHECK_FPU_FEATURE(dc, FMUL); gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fmuls); break; case 0x4a: /* fmuld */ - CHECK_FPU_FEATURE(dc, FMUL); gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld); break; case 0x4b: /* fmulq */ CHECK_FPU_FEATURE(dc, FLOAT128); - CHECK_FPU_FEATURE(dc, FMUL); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); break; case 0x4d: /* fdivs */ @@ -5105,8 +5100,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) goto jmp_insn; #endif case 0x3b: /* flush */ - if (!((dc)->def->features & CPU_FEATURE_FLUSH)) - goto unimp_flush; /* nop */ break; case 0x3c: /* save */ @@ -5224,7 +5217,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) break; case 0x0f: /* swap, swap register with memory. Also atomically */ - CHECK_IU_FEATURE(dc, SWAP); cpu_src1 = gen_load_gpr(dc, rd); gen_swap(dc, cpu_val, cpu_src1, cpu_addr, dc->mem_idx, MO_TEUL); @@ -5256,7 +5248,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) break; case 0x1f: /* swapa, swap reg with alt. memory. Also atomically */ - CHECK_IU_FEATURE(dc, SWAP); cpu_src1 = gen_load_gpr(dc, rd); gen_swap_asi(dc, cpu_val, cpu_src1, cpu_addr, insn); break; @@ -5578,9 +5569,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; - unimp_flush: - gen_exception(dc, TT_UNIMP_FLUSH); - return; #if !defined(CONFIG_USER_ONLY) priv_insn: gen_exception(dc, TT_PRIV_INSN); From patchwork Tue Oct 17 06:11:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734317 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp325681wro; Mon, 16 Oct 2023 23:25:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9HK7nFc4pITBUIdwdfW8+u8l+qztT4no3wIrc2yHw+n1dcm4Y7dqezwxsxZL+CFPxnxFL X-Received: by 2002:ac8:5c07:0:b0:40d:7ffd:fc61 with SMTP id i7-20020ac85c07000000b0040d7ffdfc61mr1407639qti.23.1697523930881; Mon, 16 Oct 2023 23:25:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523930; cv=none; d=google.com; s=arc-20160816; b=JligwyT5vgMKKXy0NNjTpA4T7noaP4fHhORUOJYMTbi3Q5wPLMj4P9CvMHvBRSgR9W 36cHfNrJ9vlJs8LZcAmcW1iHLbPTRfe5n7WpLKR5cLv9X6pCfeKiuTNPf0lvPqa0zls3 BjfaaPfzfrFliHdZuYB16OhOMbVWixswh4YCFv37vnWixqeZevyc+h0Ra7XweB0zmTyb y38z3M8X92Udq+5UmSQu/776KH9A2e2Gm+NH1pZZiBmCAnTBNnmTeoSent56wxqmqKtb oqVEui3Kvqk+C6kG81v9TWVqs2jBMydGgd5FWOEx88JuRhKH/xYLxhKXgySKeAFOOdiO NsEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=yCQ11G4CDtK3oW1LuqfPuIgRALcswxq9MCt2fHEKN58=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=tmcvrq/V7u2IMJ6ClkrD9awMNdgu+yYty2u/Ic21oS0XmULJmwlmW+2w5YxuytERyv 8r2BT9JyGfhSn4UJSpuWR5rmch0BUmyqLYQbARPZgZs0YHSOgx5j2ocykkN6iHn4htrF KWvUAgQHI25bkMOmtrg3aws0XRTzVtFoMiKn3x0HUXh95tPwpcB6tt9lvxBWjfjwu/Bw MA2jkYf/OBArEL+ZSEgk/JGbANrmSLT47/iFr2Dxwf3oaE8Z04Q2rQiuBhdxSyi7Wt38 L4a1gIHFhOvaGY9NWt3Vj45giOrSIqYuIkqsBLNXe5kbcL40dW5c79a/esKMvDoXH2tB glkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bt0lz6Xk; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v1-20020a05622a014100b0040fd25c76e5si633983qtw.586.2023.10.16.23.25.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:25:30 -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=Bt0lz6Xk; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK8-00008z-7A; Tue, 17 Oct 2023 02:13:00 -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 1qsdK6-0008UA-QU for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:58 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK3-0003qX-VO for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:58 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c0ecb9a075so34900235ad.2 for ; Mon, 16 Oct 2023 23:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523173; x=1698127973; 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=yCQ11G4CDtK3oW1LuqfPuIgRALcswxq9MCt2fHEKN58=; b=Bt0lz6Xk7g5P705ut/0iztLw9zoT8JKvoI2iarXkcoebjxNFpcBvHMVp47y1hVPg25 ipO9nq5HFhyOTcHN2k51ly3JQzkUIfwcDoMqrQRVdK95Jv+2Pmg36YK37DLyI+OL7fbx 8bXbR0fIgm4nbLme1koM+QDSRDVHoSNhnbnHZT9ums8m7MnBp25EyDyPpbCeMcKmR6Oy wrkOe+CViiIO5/6yxFyVkygHreBVJvGfSR4dh4rc7oXKCyE105cU47Kfn16WWuNGqw+/ ChMfEKLEbYglOGWaMnXa4DbtzjuctcPvBjfyzjoa2hexUA/kqlViHWwDcS3fgGLinlfl MSlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523173; x=1698127973; 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=yCQ11G4CDtK3oW1LuqfPuIgRALcswxq9MCt2fHEKN58=; b=DOom3hdfAZSpj+kEF7sokIUI7ly7RdaQNKK3U4NPckQU2kiaSiZeSk/I1ZOb/Iy8MF qFaheVmsy2bPQOBIeiPpF1z0pjs3VCdN4t7IEH0w0lEdULLR6BEbvPdB4+75yFNlPpkg cslnfPIZIVLPYQyfIyRt3ip6vw8/Gfcpd+5pwesA1PEiE20LeciKrbGe1jO3tpEX8o0X SbIfAtpdDxG06GGcAlmKjtlHKQPlfTSb114TOwlgNkNJ41fHuEMunQlIG89+Y53UM86E NaxeVDG0joRcyl0T5aqQIh6oZ1Jc3gZUInEBwDtHQggfdVBtVmOTrLrG6U2Eytu2YwQl BF2g== X-Gm-Message-State: AOJu0Yya7RxUFNWoCsLO9/vhh5M1rK9RdqWv7POodYwzD0LyS+trtM0i Kebg/B28DL0h8gv5DS3tYIavaqTO8CXdEVM0oUE= X-Received: by 2002:a17:902:bd07:b0:1c9:c951:57f9 with SMTP id p7-20020a170902bd0700b001c9c95157f9mr1164567pls.68.1697523173446; Mon, 16 Oct 2023 23:12:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 09/90] target/sparc: Add decodetree infrastructure Date: Mon, 16 Oct 2023 23:11:23 -0700 Message-Id: <20231017061244.681584-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 5 +++ target/sparc/translate.c | 69 ++++++++++++++++++++++++++------------- target/sparc/meson.build | 3 ++ 3 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 target/sparc/insns.decode diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode new file mode 100644 index 0000000000..5811a679db --- /dev/null +++ b/target/sparc/insns.decode @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.0+ +# +# Sparc instruction decode definitions. +# Copyright (c) 2023 Richard Henderson + diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cab9f13421..080bc5f8a2 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3003,6 +3003,47 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) } #endif +/* Include the auto-generated decoder. */ +#include "decode-insns.c.inc" + +#define TRANS(NAME, AVAIL, FUNC, ...) \ + static bool trans_##NAME(DisasContext *dc, arg_##NAME *a) \ + { return avail_##AVAIL(dc) && FUNC(dc, __VA_ARGS__); } + +#define avail_ALL(C) true +#ifdef TARGET_SPARC64 +# define avail_32(C) false +# define avail_64(C) true +#else +# define avail_32(C) true +# define avail_64(C) false +#endif + +/* Default case for non jump instructions. */ +static bool advance_pc(DisasContext *dc) +{ + if (dc->npc & 3) { + switch (dc->npc) { + case DYNAMIC_PC: + case DYNAMIC_PC_LOOKUP: + dc->pc = dc->npc; + gen_op_next_insn(); + break; + case JUMP_PC: + /* we can do a static jump */ + gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond); + dc->base.is_jmp = DISAS_NORETURN; + break; + default: + g_assert_not_reached(); + } + } else { + dc->pc = dc->npc; + dc->npc = dc->npc + 4; + } + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3011,7 +3052,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) goto nfpu_insn; /* before an instruction, dc->pc must be static */ -static void disas_sparc_insn(DisasContext * dc, unsigned int insn) +static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; TCGv cpu_src1, cpu_src2; @@ -5544,26 +5585,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) } break; } - /* default case for non jump instructions */ - if (dc->npc & 3) { - switch (dc->npc) { - case DYNAMIC_PC: - case DYNAMIC_PC_LOOKUP: - dc->pc = dc->npc; - gen_op_next_insn(); - break; - case JUMP_PC: - /* we can do a static jump */ - gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond); - dc->base.is_jmp = DISAS_NORETURN; - break; - default: - g_assert_not_reached(); - } - } else { - dc->pc = dc->npc; - dc->npc = dc->npc + 4; - } + advance_pc(dc); jmp_insn: return; illegal_insn: @@ -5654,7 +5676,10 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) insn = translator_ldl(env, &dc->base, dc->pc); dc->base.pc_next += 4; - disas_sparc_insn(dc, insn); + + if (!decode(dc, insn)) { + disas_sparc_legacy(dc, insn); + } if (dc->base.is_jmp == DISAS_NORETURN) { return; diff --git a/target/sparc/meson.build b/target/sparc/meson.build index 48025cce76..c316773db6 100644 --- a/target/sparc/meson.build +++ b/target/sparc/meson.build @@ -1,4 +1,7 @@ +gen = decodetree.process('insns.decode') + sparc_ss = ss.source_set() +sparc_ss.add(gen) sparc_ss.add(files( 'cc_helper.c', 'cpu.c', From patchwork Tue Oct 17 06:11:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734266 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322515wro; Mon, 16 Oct 2023 23:14:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCfzm/9IBOh/eQoxwTyIrZO8FUf4oZlAP8z/Rmi3FjeOJ8FhvB0rKAQta/E4Co+nhkxSny X-Received: by 2002:a05:622a:13d4:b0:417:de7d:f64e with SMTP id p20-20020a05622a13d400b00417de7df64emr1804629qtk.62.1697523299084; Mon, 16 Oct 2023 23:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523299; cv=none; d=google.com; s=arc-20160816; b=x3DRZx57+R52XACDIQNSKbbLCyhLOpyBz0n4QuoVKvCw0QW8nqPjssxQrg97dQD8qL g1IsgwTgOJHYAOAVPbLbxDEFBHvIV5/cCCQLw3ohV+KNxqqABDZelnwYVfNKmJsAxq5L DZ+nbWrMvivjsNJuxVG7YjIxJi37n1ETYv3WDIN3X5vQ0vAPzG8BTDE4zss5EGuNuuDI 8azKT1ebploCg/c/nbhuG5r0mguUQA9IdPUXavmC2xv7O1nTrJ1gS6Eyf2W8ESufZ6ZI f4RjjWCz4thuVYLd2XMH22KRPDpe7SHw55dbbq/e/bYa2NyZQOYNbESVCvDObs+kcEqh 6vDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=vNn7jVogYLYvnKzq1R44V4cOiOcSGXgz1/4pjUiWR3E=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=jmUUBqP5+pnmLSP3CauZ71OJPPIV+IYl5wnYRAQV9gB8a/PmaRjeO/x2n3O/RKG/ca WC7d+k/RdXIXxX5A1UDlDVQDScnI6uDF1O/yU2ATciP/2nPjG1maSHmSVd/D5TOXTdwd 7+8lMmOxSW+RPQ4N/R8Cf8jbYuz1H/SWCAH/9lKMIXLTtTKdcV28TwlWnO0W6UTDyFFh XhC4wlGsjPNnXzPIAUj5NZ1Jidwehpq0+D3ZEnPjpzb3dIPq/J56ZtjMmPf+FqhtQ1dT 6v8t8RQePy0VuEYCgkzf2+iTDiSQ6LqfmZXDsQHiVxaxdroiurJEecPoAf6W27TAqhAN ayOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gL3JXWF1; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c10-20020ac85a8a000000b0041993fce7aasi679612qtc.94.2023.10.16.23.14.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:59 -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=gL3JXWF1; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK7-00006P-Go; Tue, 17 Oct 2023 02:12:59 -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 1qsdK5-0008QI-90 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:57 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK3-0003qj-IK for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:56 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5aaebfac4b0so2199007a12.2 for ; Mon, 16 Oct 2023 23:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523174; x=1698127974; 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=vNn7jVogYLYvnKzq1R44V4cOiOcSGXgz1/4pjUiWR3E=; b=gL3JXWF1uV1wWdKFi1UVNfDTgvgticQm+4TDpZjBoHgBK2qhYMQNDhT0w5DTjNAADs 7sz5nPdnjty1KlgZsexwzoa+XpTe0FQQTfv8MGqt4dNnAVD5BJnHy5JD8vuQdX+IR/P7 t5kjOWvua0xytE3qWPFh4FjOVWA4K0on1Y5IcizGzU0KQ4aRxs7lnDnfSzSHDj7TvPRk kIMrInKISDfGsIoOPitVp2yEzvkKClM/7dAnTmMbKFitiwcLp4bGucaUuFfj5wQotGcX oHunYJsJ7EgdKG2/43oM3RKoarDbwyMfLoQqDIQrOoeSvo9T9YWm0e45NHpCkKRW1jmr auVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523174; x=1698127974; 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=vNn7jVogYLYvnKzq1R44V4cOiOcSGXgz1/4pjUiWR3E=; b=ZssrrJDTx6dtZ5FuCiQEEL938iBTBz6noPNFaAtezRGHGLTPWCp6GHqHSotqM5zOFW M+lJM2y7Jx6nr0dek91QYcRXYPquZ07KR2lS3rr98TKSaP2/kIOa8jq5hTjP5TczSE2Y zG44JOGnigQCs1pT401wm2078PlEyl9U+zGGyjoCpfJ1F5ReHgUvtFvefqHwRFN7JceU PmzQXuc2gMm7ZH2JJ51odORXl9KyscjGz0Dl5gv3BYFxQgWuWZR5gmneo19CVekjrFT/ ijDijqUAN+JQjiIu+S2KvLZfXkw0uO3pwz7prAIQrJR1LZccWtMFgsuZlK1IslhBwwR5 Thmg== X-Gm-Message-State: AOJu0YzdXnXYMGQdhOJs8VM8W174EDBEe1qyumRV1Vew8hw4gazg3a1W u11GxgiCHwtga6ENqkHY6pv/hSmUsqq9IyEEZdg= X-Received: by 2002:a05:6a21:7802:b0:16b:f3b1:c045 with SMTP id be2-20020a056a21780200b0016bf3b1c045mr1134522pzc.23.1697523174274; Mon, 16 Oct 2023 23:12:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 10/90] target/sparc: Define AM_CHECK for sparc32 Date: Mon, 16 Oct 2023 23:11:24 -0700 Message-Id: <20231017061244.681584-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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 Define as false, which allows some ifdef removal. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 080bc5f8a2..9eb2b7e52f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -268,20 +268,21 @@ static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) #endif #endif -#ifdef TARGET_SPARC64 -#ifndef TARGET_ABI32 -#define AM_CHECK(dc) ((dc)->address_mask_32bit) +#if !defined(TARGET_SPARC64) +# define AM_CHECK(dc) false +#elif defined(TARGET_ABI32) +# define AM_CHECK(dc) true +#elif defined(CONFIG_USER_ONLY) +# define AM_CHECK(dc) false #else -#define AM_CHECK(dc) (1) -#endif +# define AM_CHECK(dc) ((dc)->address_mask_32bit) #endif static void gen_address_mask(DisasContext *dc, TCGv addr) { -#ifdef TARGET_SPARC64 - if (AM_CHECK(dc)) + if (AM_CHECK(dc)) { tcg_gen_andi_tl(addr, addr, 0xffffffffULL); -#endif + } } static TCGv gen_load_gpr(DisasContext *dc, int reg) @@ -1366,11 +1367,9 @@ static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); target_ulong target = dc->pc + offset; -#ifdef TARGET_SPARC64 if (unlikely(AM_CHECK(dc))) { target &= 0xffffffffULL; } -#endif if (cond == 0x0) { /* unconditional not taken */ if (a) { @@ -1406,11 +1405,9 @@ static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); target_ulong target = dc->pc + offset; -#ifdef TARGET_SPARC64 if (unlikely(AM_CHECK(dc))) { target &= 0xffffffffULL; } -#endif if (cond == 0x0) { /* unconditional not taken */ if (a) { From patchwork Tue Oct 17 06:11:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734323 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326150wro; Mon, 16 Oct 2023 23:27:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJteT8tWz6u5G/w0M90TUF75zAj2E9gscoXpYT6kjUk0Me22RgX7VxoBuCeo6s1kR6uOA4 X-Received: by 2002:a05:6214:21ea:b0:66d:3433:d145 with SMTP id p10-20020a05621421ea00b0066d3433d145mr1740243qvj.47.1697524022878; Mon, 16 Oct 2023 23:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524022; cv=none; d=google.com; s=arc-20160816; b=EdLJNBqdrhbG7l6YzYhPy5SsGN4WFaxVNyaKStcE7RNbfr8grbVoYny8Cu8CeXx7Zg +38qYddC3ZLlBdUfMXOPQ+Iz3Ev6Ms6ROAzN83MnAekMF7waYldXMxJNioAu9oNw2cIc GQlvWXd+s5xJ8BR4c+mDqlLEmJxLQCM6llT+TlTd26oXqs7gtF5Srw0zkTAjMmHTAp9O 1GlmxopEgDd8da4P3Ql2/LDRjiJr8au0ZYPrrDHFi5nZcnpOH7AfBI1VaV96qrHwPq5g JzaJ19XOvMC6xdIS1Q3Up8GIJzTNodnc9cTneIAZZtE2bTFWR4l+PihNWYtT6UpA//57 gOhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=yW51VE5CRrwGfkK0WrmE1TMHk4AA7avR7njSl04uAkA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=nNELnXQqYDcXeHPKwG8sMYLCAdpmiOslVtLJYBWum14QJys5KQxRduopF4RzTHM6Za 2Xzi51DF2730VwVcO1b7n8lfgvRn4/Wvx9xkt52437rmgDNzr77reln50NJvCBbsz8Aw 5PmCZUuuVpuy+BmjGZL5wsG0bQ+Q1JEM9tAuyDhWxza/UF/qFMBjDHC2KHpYMKV13krO 7GlVz+oRYlrli0sPEOUUCStK3OrjVaMnSsnnQbsdg0+IBt9HAm4aOT4GpQOFbK2Rjg0e kemg1jP8xnEE8wiBMDoDLH02g1p7di+yWg87141vxCGnUYoRPt5xeNyS2JHfRgIJGCeu Fp+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OFoVZe/b"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k18-20020a05621414f200b0065824f06db4si534854qvw.204.2023.10.16.23.27.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:27: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="OFoVZe/b"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK8-00009E-9c; Tue, 17 Oct 2023 02:13:00 -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 1qsdK6-0008U9-Oh for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:58 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK4-0003qq-C1 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:58 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-68fb85afef4so4225574b3a.1 for ; Mon, 16 Oct 2023 23:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523175; x=1698127975; 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=yW51VE5CRrwGfkK0WrmE1TMHk4AA7avR7njSl04uAkA=; b=OFoVZe/b/JJwufABKikW0yx9O84zJa6AxWSgK7oeoqVVr+VhrdMUHzG8wHC+JvB80G vNS7haDrMf4a0Q/CXRElzi99obfQ7CprpgpdOYRRFHJQaDoJEkGgrBwUtK2yhbCQRxNf Xd2ud17h/XoFeTt2g9FJNUW569lDo4lmOlefaUul00eZacHb9lMhFdC1Lp7tJQOkMVt1 uHXaBmdRX2lir9OEoFihlGhzJmqeja1+ZNdvkKiiHMLRte8A7pfmGnJzMoaIRtBG3xGx dC82zGkRYqOTPNVA5jfc8k6HNqCP8487pEkATPoPH+EqjSy9nkvmyuDq8mlcgLtP89Fa dNHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523175; x=1698127975; 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=yW51VE5CRrwGfkK0WrmE1TMHk4AA7avR7njSl04uAkA=; b=uHqW8G8e0y5iGWYZ89+vOY/5WtYDNW6hg0MZe1tbN145mbOjR86cuyaGu3CCYY29qM +y/OtVX654g2VkCnmjTy3JvPV6F7HXA34pgUFzmcfB6i37ndgITNg8BbFoJaXyDa9rsE rWvEfjmR2bZm5Mr8weXptJj8TbK+gq92d8OpjQstXcdH4KYlPwpYslhgYRniudbVZnj0 Dtd4cjH+arVwZRJBArxfP1IPHTW1ztTgDfsCDz/67MaQsjqrp1Kb7ShC1NtLtbF/WFDf FZ7RgPf7BWt+9tqpbO2X9LKq2UV/CfRcpw8RBHdvkDBZwEZSdNLGU7a8KbLUvOwc4RE3 S8VQ== X-Gm-Message-State: AOJu0YxuFTinOCLkgw6aNQRuZ3ifTpmemvCzihoM6CsfBd+NcqIbyECD BE3IViUdZaaoT7iQYx0/5DsAMzuyULXeTSJ3VwY= X-Received: by 2002:a05:6a21:a582:b0:173:3ef3:236a with SMTP id gd2-20020a056a21a58200b001733ef3236amr1366629pzc.21.1697523174972; Mon, 16 Oct 2023 23:12:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 11/90] target/sparc: Move CALL to decodetree Date: Mon, 16 Oct 2023 23:11:25 -0700 Message-Id: <20231017061244.681584-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 5811a679db..a5f5d2681e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -3,3 +3,4 @@ # Sparc instruction decode definitions. # Copyright (c) 2023 Richard Henderson +CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9eb2b7e52f..377f133595 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3041,6 +3041,20 @@ static bool advance_pc(DisasContext *dc) return true; } +static bool trans_CALL(DisasContext *dc, arg_CALL *a) +{ + target_long target = dc->pc + a->i * 4; + + gen_store_gpr(dc, 15, tcg_constant_tl(dc->pc)); + gen_mov_pc_npc(dc); + + if (unlikely(AM_CHECK(dc))) { + target &= 0xffffffffULL; + } + dc->npc = target; + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3146,23 +3160,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; } break; - case 1: /*CALL*/ - { - target_long target = GET_FIELDs(insn, 2, 31) << 2; - TCGv o7 = gen_dest_gpr(dc, 15); - - tcg_gen_movi_tl(o7, dc->pc); - gen_store_gpr(dc, 15, o7); - target += dc->pc; - gen_mov_pc_npc(dc); -#ifdef TARGET_SPARC64 - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } -#endif - dc->npc = target; - } - goto jmp_insn; + case 1: + g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ { unsigned int xop = GET_FIELD(insn, 7, 12); From patchwork Tue Oct 17 06:11:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734260 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322342wro; Mon, 16 Oct 2023 23:14:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGakux7y8nvwoG0gEpv5Qom4/kb2ef9tSkLvGOSmAUy+vtbdwp5I5vcYRmsVABrMJAFWrKA X-Received: by 2002:a05:622a:d5:b0:413:5f30:9995 with SMTP id p21-20020a05622a00d500b004135f309995mr1772649qtw.36.1697523262619; Mon, 16 Oct 2023 23:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523262; cv=none; d=google.com; s=arc-20160816; b=tOBy7es7FpR9cC8NYukc6tSoY/Z0yScbXqKKaPWh0BhvAXo5sLKo3ZYLRwKe1Crzig AT7yMiruc5FI9YXuM8+796HUXat3L/p/LRJK6Ks5OqAK+QKZTq3YVgSsFej27WClujOX deu20k/yzMunsKD9r1H+Y/R02DBVh50tf4VovEN28fDQfvXdnqxxTzKD0M4XPBiWmhX+ a2iD2wC2cmd9oadi+5VKvx26T0heB6X5HRHnZMDOOsn5iBQEJMcs5KGSjSsnvqR6EfUE OeugGbi5jo7oRPpxzWIgcNNKMn1m7T3i8ok5iIM7sjuRAhtVi/Ztm18V5/WWk9uI2zYF oXlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=1prS6C+FwhKZyo+0txaEJWslfWJXoN0Tl5LZOeNLIlE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=rABWPCsFGVbUogKJW6HL/6f02ZX/VyOGKXzj1YaX+RgfWMvugngoU5A1R899ATEyaD VmdI2oTVclrbNnydn9p0rg0bRv350Bu821A/Nlg7YcJJ/YC+pM3Dqf3KjhxO4y8rFWvF AEn0C7IorTkvNuO90a/GP0uOcrcwZB/HeH5DZGnaIYVkhVcBQcokrm56KhXiv60rN26J BX9MUCiOk++ntE5xYlTWsno+vCEB9bTZIaBhnErHXN44G6y9TWche+lOcyXphHg3LYBd HBSkx+sHJfmlzPpiXtA5InXUrbTqEUu7Z834IWu0rmmcrglxsl0aq7gp2seQn5y6yXf4 Zfpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uPV9cOtZ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c7-20020ac85a87000000b004127ba9c7efsi654359qtc.603.2023.10.16.23.14.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:22 -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=uPV9cOtZ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK9-0000B7-0P; Tue, 17 Oct 2023 02:13:01 -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 1qsdK6-0008UH-TC for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:58 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK4-0003r4-SC for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:12:58 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1ca72f8ff3aso11615905ad.0 for ; Mon, 16 Oct 2023 23:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523175; x=1698127975; 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=1prS6C+FwhKZyo+0txaEJWslfWJXoN0Tl5LZOeNLIlE=; b=uPV9cOtZFaXDkkW3J3qXNR4Q6yYRaYLKvSuajjKc2OTwNVC/sjaqTcNqkEo9CjLpiX tbIVlP51pRtHVvFFIXmcLOfwtUY4TrmG/b4kbaht1IWnTfSP+Y5v+vQJDPveFLQVzM5a rSkYxPpBG1fuHWYwuYPgZ2cOiVXqjNNjuekF7Nk4fVHc3hFAKZCsizvgiQsU8mwgPha0 RQ1Z74n/hIRDd9IxVZ6rBJmsQbOzTrxwNREDRTW69g7VgjJypHvAXnBNJCe+B2Yhkj7A cK7Hr/blVEcUYoo/67gYU3CA1mXLQFpzCOgHdrbBqZ7khu3fAi4ML/TPBTZATUTKk2dw 5aWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523175; x=1698127975; 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=1prS6C+FwhKZyo+0txaEJWslfWJXoN0Tl5LZOeNLIlE=; b=XUv+s0nIKHnhW7e0kR3UsF8cy00EGFomaWFDvQiJ/UvKuV5j9oMMbnrcDQicU0RX8v E+bhllIuBniL7Pi4aWoY7KUU2dn/L67tPZ5KEjZ2p8/jc2K+UjftUwMBPye9nnIZmICk lC1UoRS7Q86SsPmNb+y3GDGYcqBpoZKX4oABVQATMaXxQYRpvcQhN/vADjZt/iNf4Pi8 YICRjSoM1GqziTS/xLVnuLndqzfck1AniMuVCcFjANTKB8L6IwfcqQRDLVX+ICcT532M K0SMZi6VnfyMQ/8d4BA9/ykVvQozHUYCPzXUivHOYFxRG1c651eVPYcXrW2ItUA5FmJA 6J9Q== X-Gm-Message-State: AOJu0YyAz009LYcfeuSaxMXkdrcDkkhtwjNe4eJSXX5i/k01gq+TGcK5 lsLk4e36fyfpKrOlNklsWZ1v48hs+0uDQNJJS68= X-Received: by 2002:a17:902:ce8d:b0:1c8:9a60:387f with SMTP id f13-20020a170902ce8d00b001c89a60387fmr1669404plg.56.1697523175647; Mon, 16 Oct 2023 23:12:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 12/90] target/sparc: Move BPcc and Bicc to decodetree Date: Mon, 16 Oct 2023 23:11:26 -0700 Message-Id: <20231017061244.681584-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++ target/sparc/translate.c | 120 +++++++++++++++++++------------------- 2 files changed, 64 insertions(+), 60 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a5f5d2681e..15cd975f4e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -3,4 +3,8 @@ # Sparc instruction decode definitions. # Copyright (c) 2023 Richard Henderson +&bcc i a cond cc +BPcc 00 a:1 cond:4 001 cc:1 0 - i:s19 &bcc +Bicc 00 a:1 cond:4 010 i:s22 &bcc cc=0 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 377f133595..7e14070322 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1362,44 +1362,6 @@ static void gen_cond_reg(TCGv r_dst, int cond, TCGv r_src) } #endif -static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) -{ - unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); - target_ulong target = dc->pc + offset; - - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } - if (cond == 0x0) { - /* unconditional not taken */ - if (a) { - dc->pc = dc->npc + 4; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = dc->pc + 4; - } - } else if (cond == 0x8) { - /* unconditional taken */ - if (a) { - dc->pc = target; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = target; - tcg_gen_mov_tl(cpu_pc, cpu_npc); - } - } else { - flush_cond(dc); - gen_cond(cpu_cond, cc, cond, dc); - if (a) { - gen_branch_a(dc, target); - } else { - gen_branch_n(dc, target); - } - } -} - static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) { unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); @@ -3041,6 +3003,64 @@ static bool advance_pc(DisasContext *dc) return true; } +static bool advance_jump_uncond_never(DisasContext *dc, bool annul) +{ + if (annul) { + dc->pc = dc->npc + 4; + dc->npc = dc->pc + 4; + } else { + dc->pc = dc->npc; + dc->npc = dc->pc + 4; + } + return true; +} + +static bool advance_jump_uncond_always(DisasContext *dc, bool annul, + target_ulong dest) +{ + if (annul) { + dc->pc = dest; + dc->npc = dest + 4; + } else { + dc->pc = dc->npc; + dc->npc = dest; + tcg_gen_mov_tl(cpu_pc, cpu_npc); + } + return true; +} + +static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) +{ + if (annul) { + gen_branch_a(dc, dest); + } else { + gen_branch_n(dc, dest); + } + return true; +} + +static bool do_bpcc(DisasContext *dc, arg_bcc *a) +{ + target_long target = dc->pc + a->i * 4; + + if (unlikely(AM_CHECK(dc))) { + target &= 0xffffffffULL; + } + switch (a->cond) { + case 0x0: + return advance_jump_uncond_never(dc, a->a); + case 0x8: + return advance_jump_uncond_always(dc, a->a, target); + default: + flush_cond(dc); + gen_cond(cpu_cond, a->cc, a->cond, dc); + return advance_jump_cond(dc, a->a, target); + } +} + +TRANS(BPcc, 64, do_bpcc, a) +TRANS(Bicc, ALL, do_bpcc, a) + static bool trans_CALL(DisasContext *dc, arg_CALL *a) { target_long target = dc->pc + a->i * 4; @@ -3082,21 +3102,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { #ifdef TARGET_SPARC64 case 0x1: /* V9 BPcc */ - { - int cc; - - target = GET_FIELD_SP(insn, 0, 18); - target = sign_extend(target, 19); - target <<= 2; - cc = GET_FIELD_SP(insn, 20, 21); - if (cc == 0) - do_branch(dc, target, insn, 0); - else if (cc == 2) - do_branch(dc, target, insn, 1); - else - goto illegal_insn; - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x3: /* V9 BPr */ { target = GET_FIELD_SP(insn, 0, 13) | @@ -3126,13 +3132,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } #endif case 0x2: /* BN+x */ - { - target = GET_FIELD(insn, 10, 31); - target = sign_extend(target, 22); - target <<= 2; - do_branch(dc, target, insn, 0); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x6: /* FBN+x */ { if (gen_trap_ifnofpu(dc)) { From patchwork Tue Oct 17 06:11:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734255 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322132wro; Mon, 16 Oct 2023 23:13:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhxsc7dUOaRjcyGErAdkRKu720X0MlxNgBnJ6HPlR5IdC6N3fnmGhN5uEzdWlRz5JM5vgB X-Received: by 2002:a05:620a:448b:b0:773:c0d7:4ecc with SMTP id x11-20020a05620a448b00b00773c0d74eccmr1483175qkp.12.1697523222660; Mon, 16 Oct 2023 23:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523222; cv=none; d=google.com; s=arc-20160816; b=lLJ5vqbTGK23X+lZJTjwdmyRaSxBcf3TKhl+diIwFE0JEhHJKLLIJUO/t591EAcp5l LC6dvVcMri5OAY5x9mGtMz3dCS+donYRWAd6uehwujUX+Ypci0vYry+/VpEuZJC/mmGY 17zIElqVnh44//1kcYmUl5wsX+7vfCOc4pHVHCMbabPZwIzmAoDcgk02bvr6Q1SBC3DR h23uCOlX2NuxK7xv0hTY+o5uzs5uE6BuTdjkrFoXB5iS+9wxpgAzCZ3E61PLs7FiKX/0 yyjCVCXUjHnemUTrRz/DbNygxVrscZ5sEw0G8I6oVRyk9GYhdP3dcYg45dsF0tB5I3t+ TH/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=aScXEhTMvdzDj5fSq3h8j0/JjPyqPLvXUvhxDxk8h58=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=yCS3fVkXD4MNXs3WysH2+WpeOx80PNT5EX4cX6UxSry/lvxO5gL4DHNmm98e7GhusH 8kUfOEZWUVvxvkkVxwEQcVH9iQ58yWhGbbSNuYh0GinI6PESaIoJOaE+mXkq+xwRBX/j 4pJZb+MbieS/tXmtDmOuXRVs2iYn4UX/PJCXOyvT+nw+NeebNMyT+6rg18aNLq+3GKzT QHeuy8TwCiiJOcs4rakV2f3cbhi/GAlM7glDOoVxukmeZV1hPyoS0DYI30+ahFtq13xn Fn9gFaeqZRYMtDZcrwMko2oA8tG8bW/18oyQ23OkkJl3xVsKMeAp9xGnvWYCVmRc9mkN 0ccA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NnoT5UFb; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ts12-20020a05620a3d8c00b0076f03e58b62si579642qkn.147.2023.10.16.23.13.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:13: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=NnoT5UFb; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdK9-0000C4-RN; Tue, 17 Oct 2023 02:13:01 -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 1qsdK8-00009M-9Y for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:00 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK6-0003rc-GA for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:00 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b497c8575aso3474861b3a.1 for ; Mon, 16 Oct 2023 23:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523177; x=1698127977; 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=aScXEhTMvdzDj5fSq3h8j0/JjPyqPLvXUvhxDxk8h58=; b=NnoT5UFbuOx/ri2sBnxAfj4C0mI1Ci09x7gdBaiJQEknucpq8FDc1F+IGABd0UBJPO sVY2qrColDs7qmgxLKPi7VWuL9CzV/ToTlkHm5juONUf+ogmChkGzVu2ha5xMWrD4xdA WhoNjmAfhJK3EYvLJNS38dv3CewXYGZKeRuzFnOso1K9Xdnbo9v0vBBW22+dW7nTCJic 1pVaEAM1Ta/LpGJVNXgG+FLO1ELOV99iQSZM6ydlScisgVYS7kE88wbb2jEpwj8XaiII EQS9rM90++Pl+9utjWG9KpmXXq5G+HGfjKmWfTCXiumTt9rh17l09SGk3pQYQn6F5rgS KfUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523177; x=1698127977; 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=aScXEhTMvdzDj5fSq3h8j0/JjPyqPLvXUvhxDxk8h58=; b=pyYf3yTn1h2qw4elXDGPeetNhTONJLPmf0+PVsV7mTf81lj3nzi3qkfT4ajDz5q//d BiWIe45FliU8LHMcM0CDaRItlH8ACVe9kd8WT6Ty06+l7GxtkCPynhqkmvKKpNqme6e+ YozlVdkz7/Gu+u/g05VCmSDA7dVvqBp3XMdcaPcmsO17CepW0iYoZuIAfw4eJrz6TAHy B1kDSGL0SFttccyml6vU6u50FDnk9QL67edQjXYCFB7s47xv1Cnd1H6cTFY3XTjwzVgY +AErZEWaQ9o1+BgqJFsotVY3nu6C3F0WHoWhD1OrU90WfI0L+zGrwOfnVqKZApSc9n+t CGuw== X-Gm-Message-State: AOJu0YxmqhjWKqLVdY5wQYvcK898mijyt2OFoZOHb1ZPfAz3Pu0cJbcY f5fAVrcZE1SWMjKzg9I5YQgITc3HgPP5ronBxRk= X-Received: by 2002:a05:6a20:914e:b0:160:83e1:712f with SMTP id x14-20020a056a20914e00b0016083e1712fmr1318902pzc.23.1697523177282; Mon, 16 Oct 2023 23:12:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 13/90] target/sparc: Move BPr to decodetree Date: Mon, 16 Oct 2023 23:11:27 -0700 Message-Id: <20231017061244.681584-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 70 ++++++++++++++++----------------------- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 15cd975f4e..838f4cdb1d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -7,4 +7,7 @@ BPcc 00 a:1 cond:4 001 cc:1 0 - i:s19 &bcc Bicc 00 a:1 cond:4 010 i:s22 &bcc cc=0 +%d16 20:s2 0:14 +BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7e14070322..a3c86b22d1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1331,14 +1331,13 @@ static void gen_fcond(TCGv r_dst, unsigned int cc, unsigned int cond) } } -#ifdef TARGET_SPARC64 // Inverted logic -static const int gen_tcg_cond_reg[8] = { - -1, +static const TCGCond gen_tcg_cond_reg[8] = { + TCG_COND_NEVER, /* reserved */ TCG_COND_NE, TCG_COND_GT, TCG_COND_GE, - -1, + TCG_COND_NEVER, /* reserved */ TCG_COND_EQ, TCG_COND_LE, TCG_COND_LT, @@ -1352,16 +1351,6 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) cmp->c2 = tcg_constant_tl(0); } -static void gen_cond_reg(TCGv r_dst, int cond, TCGv r_src) -{ - DisasCompare cmp; - gen_compare_reg(&cmp, cond, r_src); - - /* The interface is to return a boolean in r_dst. */ - tcg_gen_setcond_tl(cmp.cond, r_dst, cmp.c1, cmp.c2); -} -#endif - static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) { unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); @@ -1401,24 +1390,6 @@ static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) } #ifdef TARGET_SPARC64 -static void do_branch_reg(DisasContext *dc, int32_t offset, uint32_t insn, - TCGv r_reg) -{ - unsigned int cond = GET_FIELD_SP(insn, 25, 27), a = (insn & (1 << 29)); - target_ulong target = dc->pc + offset; - - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } - flush_cond(dc); - gen_cond_reg(cpu_cond, cond, r_reg); - if (a) { - gen_branch_a(dc, target); - } else { - gen_branch_n(dc, target); - } -} - static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { switch (fccno) { @@ -3061,6 +3032,31 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) TRANS(BPcc, 64, do_bpcc, a) TRANS(Bicc, ALL, do_bpcc, a) +static bool trans_BPr(DisasContext *dc, arg_BPr *a) +{ + target_long target; + DisasCompare cmp; + + if (!avail_64(dc)) { + return false; + } + if (gen_tcg_cond_reg[a->cond] == TCG_COND_NEVER) { + return false; + } + + target = dc->pc + a->i * 4; + if (unlikely(AM_CHECK(dc))) { + target &= 0xffffffffULL; + } + + flush_cond(dc); + + gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); + tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); + + return advance_jump_cond(dc, a->a, target); +} + static bool trans_CALL(DisasContext *dc, arg_CALL *a) { target_long target = dc->pc + a->i * 4; @@ -3104,15 +3100,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x1: /* V9 BPcc */ g_assert_not_reached(); /* in decodetree */ case 0x3: /* V9 BPr */ - { - target = GET_FIELD_SP(insn, 0, 13) | - (GET_FIELD_SP(insn, 20, 21) << 14); - target = sign_extend(target, 16); - target <<= 2; - cpu_src1 = get_src1(dc, insn); - do_branch_reg(dc, target, insn, cpu_src1); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x5: /* V9 FBPcc */ { int cc = GET_FIELD_SP(insn, 20, 21); From patchwork Tue Oct 17 06:11:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734332 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326560wro; Mon, 16 Oct 2023 23:28:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBb8FFaV6maGjSy+bZREfuhOIq4QXgntPwCU3hOlE/pHVmvpTLt5Y0u5UfpjuskizmkPk1 X-Received: by 2002:ac8:4e45:0:b0:414:ed76:bea1 with SMTP id e5-20020ac84e45000000b00414ed76bea1mr1517804qtw.67.1697524115325; Mon, 16 Oct 2023 23:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524115; cv=none; d=google.com; s=arc-20160816; b=sgZkALv0/5yR5gQYkL4UQZCZNbYCoZQmjogbtXd3K66I/Y/1iftOFsDW/qLrzorDid ffAdMNBz+HIgJYEIqr74DoUVMUOqXFXFm85J0985EeJ4QkZnImsMnJDCCMvideSaOL5g nOExVRtGKZNB9JnDtk8/CvjkRQBQAKd3k+B78100C0u3hNcHYoqH9YO5sO0nM2/p00hP a2zHq8CtTmdvs8TQsJMFdkpTixcGZuXX1n8MyIbliQihdDN0Yy0HuI/J4gBUJKenIlAW qfovmXOaKKYExMlPAiMztBj7JfkqRlIMwpciInpYIIQgz8qsV6pk7tPhKuh2FuP5a89W Uedg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=BnBhp2EHdsMRCinu+kNLsNQ6f4/PHvr+hlBeFIVzmDs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=JNoGO5qBUMwTRsRBmMhyHGQLHYbg80qHf90IPvZdyWePUza+BNtBto+z9Xeqkilc8p Bpq/KHrpnrPeN/XfWUMIOAheMjs8TLEFjzmwDvyXKdO7z1XfH5svT0II4Wu9pG0R1YmM fOUEgJ3bAgum4Q7BoRInA0clRMLBZbQp+blbFsXRsdZ2XGBCKkmFYgInYNWQ3737nPNR e0qKYF/HW47P56bKjvybPF1UFoe6MeDlNAhoHso2HzN7nQy2cD+Dvkf8WU/d01L5iWeh 7GeNpZgRuFk38q3S5mnUut6PDHRn1k8ZiIllRWFhR4xWnfU582opr4MCLBBbSNWSf3pB hFEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zTKi3F3+; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s6-20020ac85cc6000000b00418146437b3si641319qta.780.2023.10.16.23.28.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:35 -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=zTKi3F3+; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKA-0000CR-Dl; Tue, 17 Oct 2023 02:13:02 -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 1qsdK9-0000BE-3n for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:01 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK7-0003rn-BR for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:00 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c9bf22fe05so32695985ad.2 for ; Mon, 16 Oct 2023 23:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523178; x=1698127978; 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=BnBhp2EHdsMRCinu+kNLsNQ6f4/PHvr+hlBeFIVzmDs=; b=zTKi3F3+LnlaVVvfRb33PdpHqqF0mm2yZe1xJeP1WWZh66UIPlohSUAG7AY6rOUZtf 053srNQYPOmrQ9Qk7fRIU09b7m2s+CCAef3nb++Kjqjf5+aii2FHLV0yF7RkaQ/7h8Vb nI9S4D4FSXllHLyS0kmA8UD3xMrU59JxlzjRuEHwiBX08At/DBwyBZANnkuZmFOudBBJ I7l79fjdPEVhraea9zBt32DVq9y5rlQpZxKOpUXhYzZRYSfAFAbeNlz2BRIBjYAoBtHr jL2d4VHeY81AqY1AA6P6J7N3M7rDDBNaMWJ7YOt7xvEaMFuUN9KjPLvwuexPLEoAu/3/ GyFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523178; x=1698127978; 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=BnBhp2EHdsMRCinu+kNLsNQ6f4/PHvr+hlBeFIVzmDs=; b=g0vLxndZawUYnt4AGxlP8BDvDYnKuxoKSvJCKl0aTFavCqRJd0JPhceiNAsXZSh2QY NmPUcDOnb4a0PXVX6wByknM6KrGx65GVeZYtXs/CYn1HfnDrsXifKzpRjrWB+mrIn4Kn RNNycHsHP15CNx7iL2Duj/3xDhdUI9A9U056MLMIQNxcX6JcF+F4A90mAgbHVQmoXSrE K3RZZ5Gs7gkvs/8j4WjHCUE+RfXVZZ7/llNeM1hkKME1nmnthcN0mO6fh4Bp7oFU3dBX 7bUnmYK+dSCm+yrhGsUhWaoGwZ2tVxqC2bulgKsKvmijKNeTpVDfXoImhKT0luQaMYZR JPjA== X-Gm-Message-State: AOJu0YwBUx8fojl+DiA4b6c7E+tUc40qrMVcp6VChtFmMYGAgOzuPWOb HgJKeluXo2G/SRv9gbnbxq5g17NjBADQB/38+Ag= X-Received: by 2002:a17:902:f945:b0:1c0:bcbc:d5d with SMTP id kx5-20020a170902f94500b001c0bcbc0d5dmr1191053plb.61.1697523177996; Mon, 16 Oct 2023 23:12:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 14/90] target/sparc: Move FBPfcc and FBfcc to decodetree Date: Mon, 16 Oct 2023 23:11:28 -0700 Message-Id: <20231017061244.681584-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++ target/sparc/translate.c | 105 +++++++++++++++----------------------- 2 files changed, 46 insertions(+), 63 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 838f4cdb1d..9ab3f2eb82 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -6,8 +6,12 @@ &bcc i a cond cc BPcc 00 a:1 cond:4 001 cc:1 0 - i:s19 &bcc Bicc 00 a:1 cond:4 010 i:s22 &bcc cc=0 +FBPfcc 00 a:1 cond:4 101 cc:2 - i:s19 &bcc +FBfcc 00 a:1 cond:4 110 i:s22 &bcc cc=0 %d16 20:s2 0:14 BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 +NCP 00 - ---- 111 ---------------------- # CBcc + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a3c86b22d1..a05cb59cd6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1351,44 +1351,6 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) cmp->c2 = tcg_constant_tl(0); } -static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) -{ - unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); - target_ulong target = dc->pc + offset; - - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } - if (cond == 0x0) { - /* unconditional not taken */ - if (a) { - dc->pc = dc->npc + 4; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = dc->pc + 4; - } - } else if (cond == 0x8) { - /* unconditional taken */ - if (a) { - dc->pc = target; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = target; - tcg_gen_mov_tl(cpu_pc, cpu_npc); - } - } else { - flush_cond(dc); - gen_fcond(cpu_cond, cc, cond); - if (a) { - gen_branch_a(dc, target); - } else { - gen_branch_n(dc, target); - } - } -} - #ifdef TARGET_SPARC64 static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { @@ -3032,6 +2994,31 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) TRANS(BPcc, 64, do_bpcc, a) TRANS(Bicc, ALL, do_bpcc, a) +static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) +{ + target_long target = dc->pc + a->i * 4; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (unlikely(AM_CHECK(dc))) { + target &= 0xffffffffULL; + } + switch (a->cond) { + case 0x0: + return advance_jump_uncond_never(dc, a->a); + case 0x8: + return advance_jump_uncond_always(dc, a->a, target); + default: + flush_cond(dc); + gen_fcond(cpu_cond, a->cc, a->cond); + return advance_jump_cond(dc, a->a, target); + } +} + +TRANS(FBPfcc, 64, do_fbpfcc, a) +TRANS(FBfcc, ALL, do_fbpfcc, a) + static bool trans_BPr(DisasContext *dc, arg_BPr *a) { target_long target; @@ -3071,6 +3058,20 @@ static bool trans_CALL(DisasContext *dc, arg_CALL *a) return true; } +static bool trans_NCP(DisasContext *dc, arg_NCP *a) +{ + /* + * For sparc32, always generate the no-coprocessor exception. + * For sparc64, always generate illegal instruction. + */ +#ifdef TARGET_SPARC64 + return false; +#else + gen_exception(dc, TT_NCP_INSN); + return true; +#endif +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3094,7 +3095,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0: /* branches/sethi */ { unsigned int xop = GET_FIELD(insn, 7, 9); - int32_t target; switch (xop) { #ifdef TARGET_SPARC64 case 0x1: /* V9 BPcc */ @@ -3102,36 +3102,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x3: /* V9 BPr */ g_assert_not_reached(); /* in decodetree */ case 0x5: /* V9 FBPcc */ - { - int cc = GET_FIELD_SP(insn, 20, 21); - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - target = GET_FIELD_SP(insn, 0, 18); - target = sign_extend(target, 19); - target <<= 2; - do_fbranch(dc, target, insn, cc); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ #else case 0x7: /* CBN+x */ - { - goto ncp_insn; - } + g_assert_not_reached(); /* in decodetree */ #endif case 0x2: /* BN+x */ g_assert_not_reached(); /* in decodetree */ case 0x6: /* FBN+x */ - { - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - target = GET_FIELD(insn, 10, 31); - target = sign_extend(target, 22); - target <<= 2; - do_fbranch(dc, target, insn, 0); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x4: /* SETHI */ /* Special-case %g0 because that's the canonical nop. */ if (rd) { From patchwork Tue Oct 17 06:11:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734253 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322129wro; Mon, 16 Oct 2023 23:13:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpTYZyUxwxoOUFFvdnaWtEXcDrSoeae3q3D/zjwQ6Z5P5F6rfdm9WLS1cx+y8u98J/jQZw X-Received: by 2002:a05:622a:152:b0:418:2cb:f953 with SMTP id v18-20020a05622a015200b0041802cbf953mr1853007qtw.17.1697523222361; Mon, 16 Oct 2023 23:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523222; cv=none; d=google.com; s=arc-20160816; b=AkAhaYILyUeKWm/j8yoVouXnvJPDJmvEIxyQTeP6zN/H3BNf6/56TJyu31lb6/3R8O DBwfMKL3dLsJqakeO2dZbDnoh9glxCbosR8jjbwLlSeLpa4TUGRDbNned2ogO/qA1icn /BNXiIpGQDZa0+l6xAq+zZHNl54RzgmIziiA/wCxbfxlUNb4mUV3DF3B5+igZjCTP3BQ 6GO1h/h95nlSv2V7W3LNFIjXkacmf76w83oBwvByIUxY5gy1tiaL9GSl4SK1L9LK+t4Y jua73PXsoiSlzkp3C3VeuVf/vCUDX+cZRp8BLvvfteQR6TlxxU+xZrmNgNZyTgs7t61i PG8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=RafFmEyJOAItMlOtA/gMolHSxQeU0aHLQzOGBDw+LBY=; fh=GkmytpQ/aBK+SnhsUxtqa1dYh9qnVue5D4c8ejqHfb0=; b=FCJhw2qVyDmLZ6CQXry4vFf2wWyDIrholFMOOPDECeCgOs4hIfXLa4QKQhbbfdDvnu fqZjQ1RjCxKorxTFCFyq9sGNEoNhoK5Zr9lHEXs4mxqMTHHZkUnhO5t2iClDnTuraWcE 7us4SdPSRNNED4vT9qXO7KJpti6k9uX/TTIlCyXMAEEzgySI+l1ig/7Lm+aNlKwIK/S9 fp90q4bHwxj11j8ZfRbdbj1+lOP/1sWSLdC7JYcFXvzUjwSWk4ki1c4fiQwyk4wUz97V mMRRJbJXVUzYg7y8kaFDFUtzrOa/FEf+tvnd5kyVlVodlQ7ghL5uOaqPMBoWOZxTHgmO z6Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dRwikxqq; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pz4-20020ad45504000000b0064f6ab4d034si524482qvb.512.2023.10.16.23.13.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:13: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=dRwikxqq; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKB-0000Da-OR; Tue, 17 Oct 2023 02:13:03 -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 1qsdK9-0000C5-Rp for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:01 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK8-0003sH-8L for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:01 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1ca816f868fso10897855ad.1 for ; Mon, 16 Oct 2023 23:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523179; x=1698127979; 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=RafFmEyJOAItMlOtA/gMolHSxQeU0aHLQzOGBDw+LBY=; b=dRwikxqqsX/AslnRh89hbEV2SXlvNm3B6L18ka5+8juQYUj0kFUpSBs+Wx9hg+nbOo T0Yeowdd/Pp6xJgnE8toWJ8FODm9qLzH9e8exbvU6j47Kd4MjkyzBEJYm7vZBVShhY0h LlrmLStCJ2tXGw6fpO10NMoAti3QdXIPhJx4GGIlyzF/9aI3k52TNASp4WvHjdpv+UjC Z3XCEGXOC0pOcWWRflL+LFNc4kMUewdUPr96j4sy9pzesmq41Ei3DxtAAifwBzYk1A5O z0sV9egeAuCwVopRkHaA3dLQ1twZtygWwdFbVqRAA88b9RnVTP+B0Awv/CTyBdkw7ChF o9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523179; x=1698127979; 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=RafFmEyJOAItMlOtA/gMolHSxQeU0aHLQzOGBDw+LBY=; b=S0RB3mWfRPbZII9jNg4wR9Q09B7oBytpg31ED2dtPkpeRW5YXCFlfwd0+PeT6CnA3M l1F3FhIHqzzorvHCXMotIuIEnpXg8O8iqpzEYFgjAXY0FVO5/WEYInPpwo6TCVe0cUMB taR+zvH9+r9fb7HFy56RWcOu+0NqDR1HkQUYzmb72AWXMN90yNywUy9eTHO5mOrOUCNF h+w/fELAg99Dw21XQSlC5s6Qo7osEnJp8jwFKUc4jc8HWZWTJ/0zjxGncsslFdIVoTk1 KUksNHE2STKNvUoWtnT+Z5lVO7NYwkLeBazRwl2j3szhiyIVfo63OHr4tmaF+REyTaGj 5dIA== X-Gm-Message-State: AOJu0Yw2cMVdDS8jxDVBUcsnNXQndoOZ8NCRvzPZ099Is9e83YHKDk9b inoA2wFCKx2CwR0i1u79FtzGpNva9EEBXc8y1d4= X-Received: by 2002:a17:902:d502:b0:1c7:4a8a:32d1 with SMTP id b2-20020a170902d50200b001c74a8a32d1mr1627053plg.28.1697523178797; Mon, 16 Oct 2023 23:12:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 15/90] target/sparc: Merge gen_cond with only caller Date: Mon, 16 Oct 2023 23:11:29 -0700 Message-Id: <20231017061244.681584-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sparc/translate.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a05cb59cd6..61a75b5fab 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1304,20 +1304,6 @@ static void gen_fcompare(DisasCompare *cmp, unsigned int cc, unsigned int cond) } } -static void gen_cond(TCGv r_dst, unsigned int cc, unsigned int cond, - DisasContext *dc) -{ - DisasCompare cmp; - gen_compare(&cmp, cc, cond, dc); - - /* The interface is to return a boolean in r_dst. */ - if (cmp.is_bool) { - tcg_gen_mov_tl(r_dst, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, r_dst, cmp.c1, cmp.c2); - } -} - static void gen_fcond(TCGv r_dst, unsigned int cc, unsigned int cond) { DisasCompare cmp; @@ -2975,6 +2961,7 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) static bool do_bpcc(DisasContext *dc, arg_bcc *a) { target_long target = dc->pc + a->i * 4; + DisasCompare cmp; if (unlikely(AM_CHECK(dc))) { target &= 0xffffffffULL; @@ -2986,7 +2973,13 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) return advance_jump_uncond_always(dc, a->a, target); default: flush_cond(dc); - gen_cond(cpu_cond, a->cc, a->cond, dc); + + gen_compare(&cmp, a->cc, a->cond, dc); + if (cmp.is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp.c1); + } else { + tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); + } return advance_jump_cond(dc, a->a, target); } } From patchwork Tue Oct 17 06:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734254 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322130wro; Mon, 16 Oct 2023 23:13:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlgDEF2OERQ4rBhwETi3I2PnOd810XfRkp1erxpE8qOp+ppw/UWTycJr5xA18npZF4j928 X-Received: by 2002:a05:620a:3950:b0:777:f6ad:783e with SMTP id qs16-20020a05620a395000b00777f6ad783emr593118qkn.20.1697523222593; Mon, 16 Oct 2023 23:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523222; cv=none; d=google.com; s=arc-20160816; b=eOLou1+x08AvC9aYvVBAgaRr4kxasdiKSi/ftVmrIGUm391PxREZ0y7sKs43mKJ+BK 4CtzwqHEIwXfJff/McBVvnhpRtJ9Nui/CPKY9NbX8jJ+ECeT9u7Ir5OjUBrHiI6Cz6Ht sAj7ySDrNUgBgQAVq4K9MjCS+G0hgZKb/JfrSIOlV+4YnXtxhvHtU89jRlVWm8TzyAFV ZtiTr6VUc66RRMncepC/IQpzU5gufregIju7FgQ5dU66RXwPmXNQWdJDEeGFUw3Iq/Eo 6xTAFQwg+qMTLL2o9TAlN8RJ2jRafvW6xyOqmmr6hYTXbNh9AT4IYyn/k9aT0Q4N5J9W OZaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=LRsXuHDffyQpwn6iwozzaEFt19iWrF0/6hbYZNaItec=; fh=GkmytpQ/aBK+SnhsUxtqa1dYh9qnVue5D4c8ejqHfb0=; b=bALxvjAh+M8X37QVJa5hprYoYJhKTOkQSo0Hu/+yEKtmwXzznOuXnS39C7rkTMMw+v XUnTbGgq6BJg+m8D8wJ5xPW537BqRYpnnueLtuOfu5CK1debUO0K/y7QyjzPtCdQnU38 +MUX5MZpyWJqqcv6xyBiVSMXnNwe0d3vLdwht9B1PkYR/p6Ct6qeLtWbbgjSSEHx0Ulw 8Mqk5/3bIQXT+Zf9IAOrZMAv6AZDwat3IjtIOSYa8anJGAZlqHiLLa4fgaM+AUJfmKpQ 0xj61sxucTeV2sMqsmcgzfXkNi8FuWPCQJpPigfWe4Z92D2XBdigxVxcrz86N+xtnYxt BbdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ggdi0o94; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y12-20020a05620a44cc00b007759f9416easi600840qkp.635.2023.10.16.23.13.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:13: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=ggdi0o94; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKC-0000Dp-7Y; Tue, 17 Oct 2023 02:13: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 1qsdKA-0000Ca-JJ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:02 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK8-0003sN-Vp for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:02 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c9e06f058bso35619145ad.0 for ; Mon, 16 Oct 2023 23:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523179; x=1698127979; 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=LRsXuHDffyQpwn6iwozzaEFt19iWrF0/6hbYZNaItec=; b=ggdi0o949RNen9dKjvI4D3PY6M5SwI6LencNnYWbShsr+l1KKX4ARr0reUIPB5XmdT 6CjAOKLihF2ZRuP1vyuFOov6f/QYzhAScd43a5I7gZGjZmmbIvvAnJlWi56Vbedi1UVH M/pKSJBgZPpK7ceKylkAF60NaXo5equzICdSA6S9Tkm/hsn+Rqx8isdLKT4MGgzQkJBR M862+rXWfp1jalrtHyiLaCREeATF6/h+VxD0K0/L7XI1RRX0jrtXTWwQlxQMSs96/BdB 1zze5mqoP19LhTd7EoFbxJ0BLhAq7aVj8sFLyJm1Iv6HebY+Hy1bgcpJpYNHzei9gQhM 0Oig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523179; x=1698127979; 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=LRsXuHDffyQpwn6iwozzaEFt19iWrF0/6hbYZNaItec=; b=MwhpmQjwqzbju4JJBqbAovvQ+uN6h5urTgn8TJrhqYRUbFpoVZDGLeRG99c5aVo92z +0pab4dZuCbpH49XkS+oewq855x2zgX7tTgldP1Y6iKPKLago7k+C79O+pbKuvrX1mud vU+EvtW/qzzfJ5YTOyStQ34X/+ihc+g9qvK0OK4Y3sYJjsnaWIHL9B6A3Zr9r1TRv5A8 vYU/26ShWHxPsZbxju0E8+6md0LB8DKmZ8F8VB0Rp9q3S3e6Vi3Y9MjTpTvI/+1C6btd DBBWNa93WocYxWn3i+nzmrku1B8WDMYsdkrhTbzoQVjj1NYrsJUWpxBdI5axBzxaDa+D J5vw== X-Gm-Message-State: AOJu0YyN76Vjqz0bXbuKox7Jv2uwzeqszUSsH1zFJ8+1lOEWt8fgIba0 xwJygIo+oPpBuKh02G8vl50Z/UOuaDBD54Prhmw= X-Received: by 2002:a17:903:4346:b0:1c9:d358:b3d9 with SMTP id lo6-20020a170903434600b001c9d358b3d9mr1329367plb.18.1697523179553; Mon, 16 Oct 2023 23:12:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 16/90] target/sparc: Merge gen_fcond with only caller Date: Mon, 16 Oct 2023 23:11:30 -0700 Message-Id: <20231017061244.681584-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sparc/translate.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 61a75b5fab..cc19f0606e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1304,19 +1304,6 @@ static void gen_fcompare(DisasCompare *cmp, unsigned int cc, unsigned int cond) } } -static void gen_fcond(TCGv r_dst, unsigned int cc, unsigned int cond) -{ - DisasCompare cmp; - gen_fcompare(&cmp, cc, cond); - - /* The interface is to return a boolean in r_dst. */ - if (cmp.is_bool) { - tcg_gen_mov_tl(r_dst, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, r_dst, cmp.c1, cmp.c2); - } -} - // Inverted logic static const TCGCond gen_tcg_cond_reg[8] = { TCG_COND_NEVER, /* reserved */ @@ -2990,6 +2977,7 @@ TRANS(Bicc, ALL, do_bpcc, a) static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) { target_long target = dc->pc + a->i * 4; + DisasCompare cmp; if (gen_trap_ifnofpu(dc)) { return true; @@ -3004,7 +2992,13 @@ static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) return advance_jump_uncond_always(dc, a->a, target); default: flush_cond(dc); - gen_fcond(cpu_cond, a->cc, a->cond); + + gen_fcompare(&cmp, a->cc, a->cond); + if (cmp.is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp.c1); + } else { + tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); + } return advance_jump_cond(dc, a->a, target); } } From patchwork Tue Oct 17 06:11:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734265 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322507wro; Mon, 16 Oct 2023 23:14:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAfoFwaVn3N93sb08I3448p9GpcSuEcrXF46TWCVhm0yBToQdXW4MoytZDWd6aSMxt/ebV X-Received: by 2002:a0c:e7ca:0:b0:66c:fa89:a894 with SMTP id c10-20020a0ce7ca000000b0066cfa89a894mr1212980qvo.10.1697523297485; Mon, 16 Oct 2023 23:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523297; cv=none; d=google.com; s=arc-20160816; b=oDQJU5YC0Ozl3sGyeGJGhnI2g1C5IjPTwNDjNqRd1QrQO1wqFzaANUthIeDrCo7E7l 0vExSL4YVp6CBJX6R6GfL0cBdC4mXyos1goiANVgMVd3bBydsLCkNnCer8eYsL2Ihq71 G4cp4fYkvO1fwWWBcxZ6DMSAbj4KI78vNSJKGvNG9xapFGZKX3f8RaUKAOieDiVTcvC1 1iltQMll8+qDjeFOM4Nzuzz7cadTruRfD9BS/8GZs/ufLNauBWTBTYPppo1WBGHh4lpq NmO5RL3kazvl4xF9kraR68jIrFgk5pG1/ZODYuq/qzKOCWUbEl5sUQsbyhnUpevJ7++d A3rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=hORCZe2HkkMW2bK+KJWMNA6VHjazi7PbrlTmz+O48ZA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=e3hRGj8VTtFEFjO0iW+BRAx+8PE0D/ppk4YV9BGkra8XeGoOmIYt5FK8jgWMDAqWDH oduTf9+4JHkk5pA9AQXioZsCCGAraYQsK5KlyI5fPmzhd7ZibtQ1Y4M9AUIprasNl6Ri 5OVbmrkTQgIBKCSNqYEdt0G3TovcWa9H/Je9ggkHT6ESQkH2nNYW5j8JcAEtD5s7xV3d OZ+AqnwNNKW/MoRJa4LihakBQvZhuGwNEt3ZslRIV1BqEcFH8eJ2xP4VGH2k+0qu4Vop u20uZ1ZLY2nOJzzgfkfrfcjs0dlMKSjursKkh58m6IR/PPl8+LKFBER87tV8oGZbfrni 6WAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="P/nzQ5XA"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ts12-20020a05620a3d8c00b0076f03e58b62si580599qkn.147.2023.10.16.23.14.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:57 -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="P/nzQ5XA"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKH-0000SN-3T; Tue, 17 Oct 2023 02:13:09 -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 1qsdKE-0000Lu-Uy for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:06 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdK9-0003sh-Ja for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:06 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c9e06f058bso35619305ad.0 for ; Mon, 16 Oct 2023 23:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523180; x=1698127980; 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=hORCZe2HkkMW2bK+KJWMNA6VHjazi7PbrlTmz+O48ZA=; b=P/nzQ5XA9RHvbHfrx0qjKgHS0wdq0/6Tp8/L1xTAMFktcdAJR9VXe/9OUk6hUHElJh db4DCXQ7bO7ir35SUyhLqd0U6ad1ybYcllzJqdloVIONPBrWjyK4HoCLYVwcVi4q9sN5 fRlFMnJEkGXMf759whPbwt2hD90uDBNT+F55voyt89eCogJr+JuSiWu2LA4n7pMaoK4A ypBgNVQg9TtIzC4c7wjzqKdW4M15g/BZ6HEDx8ounTRnltOe5VLowai3kQJjs2fahnTy kc/nUDZY2zJwlZihEVjquyF7kOE4NDnaLfS/trijo//LEnn21qXblAK1dKTyCmJkL3AN ypUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523180; x=1698127980; 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=hORCZe2HkkMW2bK+KJWMNA6VHjazi7PbrlTmz+O48ZA=; b=rCzjt3cSpfk34U3IIrcn19kZbpLadHs021/wPye91yjvlbbICexqxJNwnjbtMHBl64 kuBep6qevk9S6F9QgNPRjfrP61ooQ9KeaN4cLVpMBXpIaBO4HbKsAac9MIp5t3isKlFe 9VFsciFkvdWEnCacgWoXJs/zm7FTbUQ63jAqwHgr08SUm7sfUOkXrK5TVxZx6iM9qmUx SdWD21DjUDtkV9XT4Y8zOUxDTyrJXzqBOs7Vo3rWF2NHshpRAh/4FqyznUkvnoC0aYdp YU/V7mKffBFAY+1GwX+GWgRwuAckPxOqhM4vX2CyVZmaXlDokK2/xLxPjPG43CZfuWMy Ga4Q== X-Gm-Message-State: AOJu0YzzjY46iuIFWp9m3isSVL04+0Vy/pMbWVBONSmtGK3kT0oI2f8l NlIfQP5NDtFQeipDmQsE3z87X8OySo2m5XzsWJo= X-Received: by 2002:a17:903:22c2:b0:1c5:9d00:be84 with SMTP id y2-20020a17090322c200b001c59d00be84mr1415536plg.33.1697523180359; Mon, 16 Oct 2023 23:13:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:12:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 17/90] target/sparc: Merge gen_branch_[an] with only caller Date: Mon, 16 Oct 2023 23:11:31 -0700 Message-Id: <20231017061244.681584-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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 Signed-off-by: Richard Henderson --- target/sparc/translate.c | 73 +++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cc19f0606e..9188196657 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -895,47 +895,6 @@ static void gen_branch2(DisasContext *dc, target_ulong pc1, gen_goto_tb(dc, 1, pc2, pc2 + 4); } -static void gen_branch_a(DisasContext *dc, target_ulong pc1) -{ - TCGLabel *l1 = gen_new_label(); - target_ulong npc = dc->npc; - - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); - - gen_goto_tb(dc, 0, npc, pc1); - - gen_set_label(l1); - gen_goto_tb(dc, 1, npc + 4, npc + 8); - - dc->base.is_jmp = DISAS_NORETURN; -} - -static void gen_branch_n(DisasContext *dc, target_ulong pc1) -{ - target_ulong npc = dc->npc; - - if (npc & 3) { - switch (npc) { - case DYNAMIC_PC: - case DYNAMIC_PC_LOOKUP: - tcg_gen_mov_tl(cpu_pc, cpu_npc); - tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, - cpu_cond, tcg_constant_tl(0), - tcg_constant_tl(pc1), cpu_npc); - dc->pc = npc; - break; - default: - g_assert_not_reached(); - } - } else { - dc->pc = npc; - dc->jump_pc[0] = pc1; - dc->jump_pc[1] = npc + 4; - dc->npc = JUMP_PC; - } -} - static void gen_generic_branch(DisasContext *dc) { TCGv npc0 = tcg_constant_tl(dc->jump_pc[0]); @@ -2937,10 +2896,38 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul, static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) { + target_ulong npc = dc->npc; + if (annul) { - gen_branch_a(dc, dest); + TCGLabel *l1 = gen_new_label(); + + tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); + gen_goto_tb(dc, 0, npc, dest); + gen_set_label(l1); + gen_goto_tb(dc, 1, npc + 4, npc + 8); + + dc->base.is_jmp = DISAS_NORETURN; } else { - gen_branch_n(dc, dest); + if (npc & 3) { + switch (npc) { + case DYNAMIC_PC: + case DYNAMIC_PC_LOOKUP: + tcg_gen_mov_tl(cpu_pc, cpu_npc); + tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); + tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, + cpu_cond, tcg_constant_tl(0), + tcg_constant_tl(dest), cpu_npc); + dc->pc = npc; + break; + default: + g_assert_not_reached(); + } + } else { + dc->pc = npc; + dc->jump_pc[0] = dest; + dc->jump_pc[1] = npc + 4; + dc->npc = JUMP_PC; + } } return true; } From patchwork Tue Oct 17 06:11:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734259 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322345wro; Mon, 16 Oct 2023 23:14:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/2cCPuvGWEhId3WlCSaOXGiQ2rRHV57xGTgKXyqtEDbokhVX1N1l5eDuMnfT2BmbiYCOO X-Received: by 2002:a05:6214:1c0f:b0:66d:627e:24c0 with SMTP id u15-20020a0562141c0f00b0066d627e24c0mr2084140qvc.38.1697523262990; Mon, 16 Oct 2023 23:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523262; cv=none; d=google.com; s=arc-20160816; b=poHbkZEB1WOA3BQUC3h08cGTw6kjeraZVfDzDLS/3HV58gW95ZO7KaSjEv9UML1hTt MxK63wLu/PcP1WZDQCtt7BIOpgr4e8c/JnQxX+l7YnwdWSnobRebmx6mdIqmbk20SmyR 5MP4udbrvFqmsj9/ReuxRs/WxdUhSc7PlPeYP829GiPK90LDRudq6hGSBo/HA1RUOucr tpc3N+iomzgpBxAvb7ulBT4t/9nRiBCwDBw7IQMUkesJZtzs2HeIPksjad1ngLRfWoJc jeqQphsImWtFyxTPYKrYzHxOIoK5AYW1YfiO/f0qMtHR8Si9TP5f/bpoURxY79pdbtc+ hK1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=OvY88bgh70CnfBtV0mfKDRwJvl7SdeYowQVqeWU69q0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=HpYZgljtsHTbPcQQHJ0onj6Hv57s5JfDn8X8wuqbB87J7ei8QaymnErYy+R1+TOtyv FDTVFpInSMgfyh8cdB+Cw+1/orqk71xzS9oAFgycP4J9/A7fCCe1UJ1gYr+2VeqGn0aV Es/RZje9+PGV2sJhPPSj4IP9Nz9IAXaCXr0aD5sgBue9C0LTds3340G8O4sEroO0piIN CCaOGc9ML2ICV3XOvqj14JcpyzVqRjx35GefyaiUUN7zwQMaCrzEZYgdSDw4vABe4fup dGsKneKzJvjJ/qSDN+ehbCGC5obliZrsJs9PbscT9b7zecss5mKfx1WSvSa+dBA/7N16 IPQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eOvzWpv5; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id qh28-20020a0562144c1c00b0066d0edaf8fasi513784qvb.235.2023.10.16.23.14.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:22 -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=eOvzWpv5; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKE-0000K7-GB; Tue, 17 Oct 2023 02:13:06 -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 1qsdKC-0000Dl-45 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:04 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKA-0003sy-FB for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:03 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c871a095ceso35915605ad.2 for ; Mon, 16 Oct 2023 23:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523181; x=1698127981; 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=OvY88bgh70CnfBtV0mfKDRwJvl7SdeYowQVqeWU69q0=; b=eOvzWpv5CrrEqV5HSV0M2c0LW8xaK/rc7KbHbICwcq7DShuCh+im1VNYBbP7cJ55So iCUvAqvegeT8h0XtnjqRt5meDytbiQvJLiIVDovmAUOQRX4avD5go7f/3WaHKbKW6xNT JLl1Z0iMI34+uCwvmlg6cS6rnEX8a3sHJYknBUam0AaZYEbm2eOiE9gSgIvMbJV6gHyR fLHHYawJxnQKMv+zySzjia9NZsyjgNDsryKNx7fAennFIK1JxCV+oVgbOj/RS4Zcls79 WB3sSOfdDOqDIazkRtyYD9Yp4lcKFEnISg7UMtKfZhIYg3pKeza4cDCrlbF8rq1sH7Jo LNrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523181; x=1698127981; 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=OvY88bgh70CnfBtV0mfKDRwJvl7SdeYowQVqeWU69q0=; b=WiZ7T6CFA772dTlS7UjUenWxNVugYut619cfc4e7vMz5p1a1jrs7ZvQZFwX7ZSRXnr pUFYaF+ta5gHVuRFgbD/gy+OZUo0UYayDiIXWlE9vd8lpYzLiU+JYn8iPmKv8+/BtL3C uN9Uy1ydEyUD/2vMutlMCZeE9HXqjkxr+khqTDShNl4rnXDUV0LwI9wY8lpw0Uw/cthJ R8J1v1uh3OInU9hxLg34xo+0HIOum/G4seajrEUKRXOhVtADYUOg5R3vHfC4/3xcqd/p UoHrsKBnLOPJfwtCnDiTRRQD4vwMn7nMwEQcXPzVoXupU+V9OonrVigtIHKRLZ5Bplfi zcXA== X-Gm-Message-State: AOJu0YxdglB+O0jBVgkZGts2OSa6FLK/R+C15d1gri0r2i84kb3XQlnY aikCrbWVzjk8QVXDLBMyXKYI9Xe3CuIN0xAX8No= X-Received: by 2002:a17:902:aa41:b0:1c9:d948:33ea with SMTP id c1-20020a170902aa4100b001c9d94833eamr1211984plr.21.1697523181327; Mon, 16 Oct 2023 23:13:01 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 18/90] target/sparc: Pass DisasCompare to advance_jump_cond Date: Mon, 16 Oct 2023 23:11:32 -0700 Message-Id: <20231017061244.681584-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 Fold the condition into the branch or movcond when possible. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9188196657..70bfbb41e9 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2894,14 +2894,15 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul, return true; } -static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) +static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, + bool annul, target_ulong dest) { target_ulong npc = dc->npc; if (annul) { TCGLabel *l1 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); + tcg_gen_brcond_tl(tcg_invert_cond(cmp->cond), cmp->c1, cmp->c2, l1); gen_goto_tb(dc, 0, npc, dest); gen_set_label(l1); gen_goto_tb(dc, 1, npc + 4, npc + 8); @@ -2914,8 +2915,8 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) case DYNAMIC_PC_LOOKUP: tcg_gen_mov_tl(cpu_pc, cpu_npc); tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, - cpu_cond, tcg_constant_tl(0), + tcg_gen_movcond_tl(cmp->cond, cpu_npc, + cmp->c1, cmp->c2, tcg_constant_tl(dest), cpu_npc); dc->pc = npc; break; @@ -2927,6 +2928,11 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) dc->jump_pc[0] = dest; dc->jump_pc[1] = npc + 4; dc->npc = JUMP_PC; + if (cmp->is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp->c1); + } else { + tcg_gen_setcond_tl(cmp->cond, cpu_cond, cmp->c1, cmp->c2); + } } } return true; @@ -2949,12 +2955,7 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_compare(&cmp, a->cc, a->cond, dc); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -2981,12 +2982,7 @@ static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_fcompare(&cmp, a->cc, a->cond); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -3013,9 +3009,7 @@ static bool trans_BPr(DisasContext *dc, arg_BPr *a) flush_cond(dc); gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } static bool trans_CALL(DisasContext *dc, arg_CALL *a) From patchwork Tue Oct 17 06:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734262 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322411wro; Mon, 16 Oct 2023 23:14:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqiWa/sHeSeEg40YcRBEqBjjviyjElWLSkj8aRJg3RiOot1yze4ViKeT71JfCG3czrzV8Z X-Received: by 2002:ac8:58d5:0:b0:415:1752:1be5 with SMTP id u21-20020ac858d5000000b0041517521be5mr1484455qta.31.1697523279271; Mon, 16 Oct 2023 23:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523279; cv=none; d=google.com; s=arc-20160816; b=Vt2c4tgH4IXDqL98YK2FjMnziIYdJmoNO+wyQahOna+DPs68HpL5mNEOEaQ7OGhZh0 DoL+Lqla6Sm984jQhQ8uMK/uwdxwi+r6SQaZQTakB4p7ZD8ooC6u6F6UAiNn8KRznK1Q dpL86yPAs57n/0Pt50cz4ATJf39L/kg9Bav7TIlhRbwqpCatRGI6YptyPxaxkGqZSDad czwo9Hjgd5ay8A3yZbp6de4cm7WMCSLxuPf4+kqhA9l/YjDtEbnIplPCV5WREgNE00K5 SdvVO9iX/Xio706y7MPUz0SuM4WSwa918iNlkoGVNnK0nojWER3kwEkyzOe1Y2qxD0LR /Uww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=6Ww/eIka2fIiuMHxW6vTYf2n2OXLN4aKw8vXIwfDBzM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=uTaIcSJaCQ3+8a3bmwW93BtcRONdn9t7OoXrxx3iMhXhoyzcIH9viEbsGYMX/fqEgF 4ky3McVQCAbEHHiQuNC/Nc+ByREeOTsOJ4W6TRxU7q8+z4SqydeC6RQg54rQ3oENAp2X n8xxvNE9jYtgp4avIgmaIpsl+icFpFUAoD9nbfa6yUWEhTQwS8/nWUqUj76rMOUo76AZ OZrMpRldq/Pfln0Ign7QWmaRDIOLdtZb+kvfTEVRxdcRwzUwbaGhJXcuwZpoaauEeYbz impXPEItzdQET83S2S4yiXflS7m3LKVDAdGvQbdofh97FWUddWaUGjm2HlvOSsMzqYl2 Bfeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f3ymxVJx; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j17-20020a05622a039100b004196484117esi660938qtx.73.2023.10.16.23.14.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:39 -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=f3ymxVJx; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKF-0000Lm-3X; Tue, 17 Oct 2023 02:13:07 -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 1qsdKD-0000FV-7b for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:05 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKB-0003tC-IU for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:04 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1ca052ec63bso31300585ad.1 for ; Mon, 16 Oct 2023 23:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523182; x=1698127982; 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=6Ww/eIka2fIiuMHxW6vTYf2n2OXLN4aKw8vXIwfDBzM=; b=f3ymxVJxjLmyii4XZrNIBBQzUe9WEGFLmso1yT1Xzn3tUZ79dDVnanCXUJLTadJJYA SxkinAmAgX2EMn/Hzj4v7nE7dcILidXMIkp63VdT82JNVP1Ce9nzTYL7lPbn49G3hB2U wc0dl2CbwOElKNT8bBqEB9f9OkjhAn/8qKhpaI2nnBOaV6xsfUhtxwizKmSTe8Uf9jDm Uy+seZM1oLMmk4N+GIdF6/OCC0dxpqphbR3xYrqhkHjid5kkmOa5vxDMRdGPlGqtPWRP JORR6Ts6hu2sSRlFyD40XP7rWAWBKTy+/zZEbQg6gzyglsUNaTeGLtiTKyOc3mJQJDNj KGuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523182; x=1698127982; 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=6Ww/eIka2fIiuMHxW6vTYf2n2OXLN4aKw8vXIwfDBzM=; b=QMALcQhJKbWfsCJYcqqZ3gPfPqn6XAjcGsVvT3iQtXHaVlAyzbR6nx3BuEqw+/5Ddb YJ0YSS8rZYmdn7CuGjAF9EcrrwPFd7oO70Ia77GwWCOnm65rn2jstz1vEPwAr3REPnYv UPQkYxdUImFMEyBwwgoApQQ++2vKhSkIcB9CYIVedFsYRclgku5w5vaBa0xwgugldxIZ x3e/tgHgO8qJEJVA9RyoSYBT2v9++kzZFmavdxZaDjsfjW4jgkjwKGjs9QaueyfnMjnd 9IFGXpW4AGpIZtcEW4xRwyh2CQtTCRdWJbTDqhJJ/SSVZLfFOJOJf5UadggXG73HXxn/ ZZ+g== X-Gm-Message-State: AOJu0YzxBO/Dem7j4uGDWfyUEmp2IgZTipnZjKZ8H+b8PG7fJ2cnVlik drO32Xs7LWm9rhjPa+S61RXr5l0KeqbSGMr/JcQ= X-Received: by 2002:a17:902:e5c1:b0:1b9:e241:ad26 with SMTP id u1-20020a170902e5c100b001b9e241ad26mr1469930plf.9.1697523182048; Mon, 16 Oct 2023 23:13:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 19/90] target/sparc: Move SETHI to decodetree Date: Mon, 16 Oct 2023 23:11:33 -0700 Message-Id: <20231017061244.681584-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 6 +++++ target/sparc/translate.c | 50 ++++++++++++--------------------------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 9ab3f2eb82..f6f5401b10 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -3,6 +3,10 @@ # Sparc instruction decode definitions. # Copyright (c) 2023 Richard Henderson +## +## Major Opcodes 00 and 01 -- branches, call, and sethi. +## + &bcc i a cond cc BPcc 00 a:1 cond:4 001 cc:1 0 - i:s19 &bcc Bicc 00 a:1 cond:4 010 i:s22 &bcc cc=0 @@ -14,4 +18,6 @@ BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 NCP 00 - ---- 111 ---------------------- # CBcc +SETHI 00 rd:5 100 i:22 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 70bfbb41e9..b53127ecb7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2868,6 +2868,10 @@ static bool advance_pc(DisasContext *dc) return true; } +/* + * Major opcodes 00 and 01 -- branches, call, and sethi + */ + static bool advance_jump_uncond_never(DisasContext *dc, bool annul) { if (annul) { @@ -3040,6 +3044,15 @@ static bool trans_NCP(DisasContext *dc, arg_NCP *a) #endif } +static bool trans_SETHI(DisasContext *dc, arg_SETHI *a) +{ + /* Special-case %g0 because that's the canonical nop. */ + if (a->rd) { + gen_store_gpr(dc, a->rd, tcg_constant_tl((uint32_t)a->i << 10)); + } + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3060,41 +3073,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) rd = GET_FIELD(insn, 2, 6); switch (opc) { - case 0: /* branches/sethi */ - { - unsigned int xop = GET_FIELD(insn, 7, 9); - switch (xop) { -#ifdef TARGET_SPARC64 - case 0x1: /* V9 BPcc */ - g_assert_not_reached(); /* in decodetree */ - case 0x3: /* V9 BPr */ - g_assert_not_reached(); /* in decodetree */ - case 0x5: /* V9 FBPcc */ - g_assert_not_reached(); /* in decodetree */ -#else - case 0x7: /* CBN+x */ - g_assert_not_reached(); /* in decodetree */ -#endif - case 0x2: /* BN+x */ - g_assert_not_reached(); /* in decodetree */ - case 0x6: /* FBN+x */ - g_assert_not_reached(); /* in decodetree */ - case 0x4: /* SETHI */ - /* Special-case %g0 because that's the canonical nop. */ - if (rd) { - uint32_t value = GET_FIELD(insn, 10, 31); - TCGv t = gen_dest_gpr(dc, rd); - tcg_gen_movi_tl(t, value << 10); - gen_store_gpr(dc, rd, t); - } - break; - case 0x0: /* UNIMPL */ - default: - goto illegal_insn; - } - break; - } - break; + case 0: + goto illegal_insn; /* in decodetree */ case 1: g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ From patchwork Tue Oct 17 06:11:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734273 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323460wro; Mon, 16 Oct 2023 23:18:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEF45ig8TRNe0Eh2b0JYOmgL9Eccxx7loLj8cJk86MJblmZUVp6PfVoNpJb9X0lr/B7H4G X-Received: by 2002:a05:622a:113:b0:41b:b7ff:2342 with SMTP id u19-20020a05622a011300b0041bb7ff2342mr682867qtw.44.1697523490389; Mon, 16 Oct 2023 23:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523490; cv=none; d=google.com; s=arc-20160816; b=F2C9mRPTs+5idF+7a3tTrvAqGEwxmQRMU95Zcc6TC271g/LGXh/NPunmY8aGGCU6fg dYi70YOP3YeweE2bMYdG2otZoDI/PIs3lVGnlfMnP+pqq0mE2OmCu7bScaIQMRJJ4qGD oJx/iFNFZmRhcC3PIqgQM2mWQAjmkDXoLM+orkEKc9lcW99bLYgRoCDhCw21XdAoDPL+ wb2Bs4drn+50QYETrxM5xDRAKOxMI5IzIDTf8ZzV2n5DsPBpmGNruirQCY1Ll63iBJD9 uTvN8+5tlgvXlOmnTDm7FduK64tFDikgbUlfi3kf7HBFT3c+b9e+lau9oDUC3hiRrSnH J1pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=/mTYxiPdr4Iee3Vw86SKy2D5EJuAnTIUSO2hmcgcVG4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Q8Y8rOiM4jEG7xuLO/jjaLCxewHkJilQN3qYMj6aFZMniXCTH6GPnxF0Csu7UjzImt 4h8j9iIsc7n5y6Vnwut/tzYl1cYkKDr7ZUXQt649v++vlPN3U1jOoqQEFGlujQx6oRT3 8CJR+gB4djdXXPbZtoX+AgerJgQF0iQWozjQZc2cx+G+XqTxbupFBzJjjvqiZ+QR4WsN famkcc72154Odvv0zf2apIP1CIeNAbVoNnqAKiAmG8pCwX8QgP3sLO7FNUz5nhkeyF7f AOacSbd/U/7bMVf9WxVOkH/f22w+APOU9+yDWNWFZg9MRcBU9c80D7I+651946Wjgoyc fR4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x/kvGT1G"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k9-20020a05622a03c900b0041816224c33si630691qtx.384.2023.10.16.23.18.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:10 -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="x/kvGT1G"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKG-0000Pn-8s; Tue, 17 Oct 2023 02:13:08 -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 1qsdKE-0000Jt-CK for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:06 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKC-0003tI-BQ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:06 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c5cd27b1acso44358455ad.2 for ; Mon, 16 Oct 2023 23:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523183; x=1698127983; 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=/mTYxiPdr4Iee3Vw86SKy2D5EJuAnTIUSO2hmcgcVG4=; b=x/kvGT1G5ngVH/RjLU3yQmK9MHn4WWynOM+dKlj/YlAT4MAESJFvCVAySs0Ql+Mw4O RVhrTDCPjhWSnwIJX5VToeAn8nPkaSkEtjGeYBigYjRdRIi4xA3CM2Esd2pC9l2+PtfU lHsguG7QscWv5xVG6hS8jK0kf6JVd0gzrIz51c8Qh06rXmuBwR7V/IDB0M0ZnU/vMlGo E+LEFWsFKhlC2H2J9FfgVrAM2vG51nKKtDXP9CXdgFhqkTNW7K/xgp9CJwQvAF3VCvpB U6V80PdSRJ5FCIk3ovhQnEP1rz32bIvxIb0B+sG1DeUbE+xrr8kpw0lF+ovjVdWNzXVx AIeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523183; x=1698127983; 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=/mTYxiPdr4Iee3Vw86SKy2D5EJuAnTIUSO2hmcgcVG4=; b=C0y6Kpz0hVf+OFtXQRnmOlazsfmIBpfeHZMmNGCuCiQOukGV7f+ykV4dgEfu5H9ti8 FTrXEo3nGjmrUHRfY0FbsdwVhSwF1lIo3hsqVDCYqA7jYLeksSWv8Sw5tVX07sKArsCH Wq0BZMud5UCYrEGmW43H321jzmSe5McVjHfRQ23764iNHU6m2tavhdR/UJ5h+D8OWuEg yYtTLOiHp0ClvcJ1erLi1q+vKwmOowTMrptVor9N5XBA5CPevzj1KbuZcMCmu4HGzv+q AzUpbpgnXjkbkpfGvEQVZYMJM6z4zCnrvOaHb6DMtfhRpNmWNHZoiTKcoF8uJ53y7PnI kmzQ== X-Gm-Message-State: AOJu0YyjpVg9s30m8GQDT7gAJO0M34MZKxa+8OISDD1vbGCSwgKv+n7n dgchboO3oyO1fyWkjfD38Sn74ZsSFNBh3zbqlc4= X-Received: by 2002:a17:903:248:b0:1c3:6d97:e89e with SMTP id j8-20020a170903024800b001c36d97e89emr1517318plh.58.1697523182790; Mon, 16 Oct 2023 23:13:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 20/90] target/sparc: Move Tcc to decodetree Date: Mon, 16 Oct 2023 23:11:34 -0700 Message-Id: <20231017061244.681584-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 Use the new delay_exceptionv function in the implementation. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 + target/sparc/translate.c | 143 +++++++++++++++++--------------------- 2 files changed, 66 insertions(+), 79 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f6f5401b10..4d09c102f1 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -21,3 +21,5 @@ NCP 00 - ---- 111 ---------------------- # CBcc SETHI 00 rd:5 100 i:22 CALL 01 i:s30 + +Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b53127ecb7..4a4aab81cd 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3053,6 +3053,69 @@ static bool trans_SETHI(DisasContext *dc, arg_SETHI *a) return advance_pc(dc); } +static bool trans_Tcc(DisasContext *dc, arg_Tcc *a) +{ + DisasCompare cmp; + TCGLabel *lab; + TCGv_i32 trap; + int mask; + + /* Reject %xcc for sparc32. */ + if (avail_32(dc) && a->cc) { + return false; + } + + /* For simplicity, we underdecoded the rs2/imm7 field. */ + if (!a->imm && (a->rs2_or_imm & ~0x1f)) { + return false; + } + + /* Trap never. */ + if (a->cond == 0) { + return advance_pc(dc); + } + + mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc) + ? UA2005_HTRAP_MASK : V8_TRAP_MASK); + + if (a->rs2_or_imm == 0) { + a->imm = true; + } + if (a->rs1 == 0 && a->imm) { + trap = tcg_constant_i32((a->rs2_or_imm & mask) + TT_TRAP); + } else { + TCGv src1 = gen_load_gpr(dc, a->rs1); + TCGv sum = tcg_temp_new(); + + if (a->imm) { + tcg_gen_addi_tl(sum, src1, a->rs2_or_imm); + } else { + tcg_gen_add_tl(sum, src1, gen_load_gpr(dc, a->rs2_or_imm)); + } + + trap = tcg_temp_new_i32(); + tcg_gen_trunc_tl_i32(trap, sum); + tcg_gen_andi_i32(trap, trap, mask); + tcg_gen_addi_i32(trap, trap, TT_TRAP); + } + + /* Trap always. */ + if (a->cond == 8) { + save_state(dc); + gen_helper_raise_exception(tcg_env, trap); + dc->base.is_jmp = DISAS_NORETURN; + return true; + } + + /* Conditional trap. */ + flush_cond(dc); + lab = delay_exceptionv(dc, trap); + gen_compare(&cmp, a->cc, a->cond, dc); + tcg_gen_brcond_tl(cmp.cond, cmp.c1, cmp.c2, lab); + + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3083,85 +3146,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst = tcg_temp_new(); TCGv cpu_tmp0; - if (xop == 0x3a) { /* generate trap */ - int cond = GET_FIELD(insn, 3, 6); - TCGv_i32 trap; - TCGLabel *l1 = NULL; - int mask; - - if (cond == 0) { - /* Trap never. */ - break; - } - - save_state(dc); - - if (cond != 8) { - /* Conditional trap. */ - DisasCompare cmp; -#ifdef TARGET_SPARC64 - /* V9 icc/xcc */ - int cc = GET_FIELD_SP(insn, 11, 12); - if (cc == 0) { - gen_compare(&cmp, 0, cond, dc); - } else if (cc == 2) { - gen_compare(&cmp, 1, cond, dc); - } else { - goto illegal_insn; - } -#else - gen_compare(&cmp, 0, cond, dc); -#endif - l1 = gen_new_label(); - tcg_gen_brcond_tl(tcg_invert_cond(cmp.cond), - cmp.c1, cmp.c2, l1); - } - - mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc) - ? UA2005_HTRAP_MASK : V8_TRAP_MASK); - - /* Don't use the normal temporaries, as they may well have - gone out of scope with the branch above. While we're - doing that we might as well pre-truncate to 32-bit. */ - trap = tcg_temp_new_i32(); - - rs1 = GET_FIELD_SP(insn, 14, 18); - if (IS_IMM) { - rs2 = GET_FIELD_SP(insn, 0, 7); - if (rs1 == 0) { - tcg_gen_movi_i32(trap, (rs2 & mask) + TT_TRAP); - /* Signal that the trap value is fully constant. */ - mask = 0; - } else { - TCGv t1 = gen_load_gpr(dc, rs1); - tcg_gen_trunc_tl_i32(trap, t1); - tcg_gen_addi_i32(trap, trap, rs2); - } - } else { - TCGv t1, t2; - rs2 = GET_FIELD_SP(insn, 0, 4); - t1 = gen_load_gpr(dc, rs1); - t2 = gen_load_gpr(dc, rs2); - tcg_gen_add_tl(t1, t1, t2); - tcg_gen_trunc_tl_i32(trap, t1); - } - if (mask != 0) { - tcg_gen_andi_i32(trap, trap, mask); - tcg_gen_addi_i32(trap, trap, TT_TRAP); - } - - gen_helper_raise_exception(tcg_env, trap); - - if (cond == 8) { - /* An unconditional trap ends the TB. */ - dc->base.is_jmp = DISAS_NORETURN; - goto jmp_insn; - } else { - /* A conditional trap falls through to the next insn. */ - gen_set_label(l1); - break; - } - } else if (xop == 0x28) { + if (xop == 0x28) { rs1 = GET_FIELD(insn, 13, 17); switch(rs1) { case 0: /* rdy */ From patchwork Tue Oct 17 06:11:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734268 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322909wro; Mon, 16 Oct 2023 23:16:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG15legFsbMwiJG2lMpfkMfbfJUtm3dpKGbP3XctcQbYejYfrxI7BNFO2qIDTyP4jO2pydq X-Received: by 2002:a05:622a:304:b0:41b:8416:ea2a with SMTP id q4-20020a05622a030400b0041b8416ea2amr832706qtw.40.1697523383087; Mon, 16 Oct 2023 23:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523383; cv=none; d=google.com; s=arc-20160816; b=ouZbduT2t+NfxAYdVxJFynZ7RQ6VZIkbcdb23kq7BxXUQBdP4rQ0RUqkUDlBcx78Bb 9HweiuON15ucsSJIuzN5GmM/fo2XiiEszN49LJGMX6K9EKr/c9u0Na89Qw3sVkK5P/4y Ggb2yJaRUAomN3FIOQ6wWCvWN8z1BxdMOA4zneDW+arqyX9RoiGKi4w7OzGl7URubjHv TF6t2MCiIOtFlv4VBkeDpWhSBkKIRYuHkJMuOygM7tQ2Ava0mysXf01/BI5/pOkpGPbr FEo2GSEMAolTBYFpkWklt9Or/jdSCHGKFKhseD71ES6wCfMfb0pKMHEJVaZvbj7KVvnS 7lUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=UnyPKinu2Q/ZcA9fCkdu/2YCziYM96i43xVaGLz1NqA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Tr+jBdZRSv1L7H0r36tnw+YMmNp0Ldgs2BHHZlJhoPYl79u+0WiieXkNW1EdMsNwgx aB9UhLnGfTfiJVwS7R4NOW/Dea+MWE587gEtg/77AGKDml33JkLLfeadaUlXsoRf0U62 e//mea78dYG2YbmyzFywasySeMdavn+tnDtk4P0t3EQarHiWAvZM31/EpYuzlZow0RFR 6rGDNtOjlzAm3IdMPe4l80oNt5jfHuJMfIjbmzkYH68HoF6zIi3sj5c+UqeqNQQUrgTQ jXvjpuEb/t6NwPLiMa5FzDzPHeFgp0uKMqoQEvul8ivz+vnOSQTP+rZSIIib15U7ozna t5aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C4l9lEqG; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iy10-20020a05622a700a00b0041b82756409si531579qtb.491.2023.10.16.23.16.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:16: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=C4l9lEqG; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKI-0000WD-6v; Tue, 17 Oct 2023 02:13:10 -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 1qsdKF-0000On-QA for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:07 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKD-0003tZ-5Q for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:07 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5ad5178d1bfso2614608a12.2 for ; Mon, 16 Oct 2023 23:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523184; x=1698127984; 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=UnyPKinu2Q/ZcA9fCkdu/2YCziYM96i43xVaGLz1NqA=; b=C4l9lEqGoNh1GbpckgLdcjg/CaZCPXuz8j/dWF15ZLlPVxOjjYjBgA8xs3gltq68Cd RUtWsXGHyVQM5RHfKxX33qR6Ol3ja3bmpvasurwS1uu8Om/n5lkwFwIrOGv7Oeb1qXSp JyBYl+YaXN32n+PTYaQGZrFRJxVgnK3DS8pIwoLbtF13cBsHIdiCKi5AUVOyLe3qaKPp niCYmUdWfc4mlBugyBe+YsFkGJzffdu23tDtpdxuzppfv/V5pw6Jm5gN6jUPgRW5n2R8 ccbx6Q8MrbXzm8hSYPLl1G0C5qRcNxXsMOnexE+VbkM1e8RdTWKH3fa7ryPgm5GBWQJl R+Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523184; x=1698127984; 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=UnyPKinu2Q/ZcA9fCkdu/2YCziYM96i43xVaGLz1NqA=; b=fUy+fhou9gFxb8464LFiN9c2OY54tKfT1/eNyKnQgMrM35g/Lg1hI1JVYSd0ncDVtt xv0/k/T2sYVMjh0FNF0pF/iV06cZrTBLsLvLpnGsXLBkh4lZ4/7gnU1Bu3qj2NAJFU7/ c3PD0tUTxWbiyiBKVXXSNk4FpeUVe9eu3Uh6yi0TA6/ynJExDgDs56xw8/xyybaqOKWm IznlKgQLsLM46IkeJDPykA1sdsVcRcyq/34SwaGQCOP0x+1YDxp4njgFKM0cwytD4g13 vb57z1//y0iHHh0h9m4HUWrK83ynj01cztCn1JHCB+oX3uEF7v+/pNBZsIiU+eWbtVBc /yjQ== X-Gm-Message-State: AOJu0YxM+oBVjXErno6Ntuh5WV/z1aZLbmjN45rmLcqZUf8JhuxoZ3X4 naplFMUJZ/upi3DuPA2bH92dYGCR3vwMEFYxOzg= X-Received: by 2002:a05:6a20:72ab:b0:15e:bb88:b76e with SMTP id o43-20020a056a2072ab00b0015ebb88b76emr1322815pzk.14.1697523183717; Mon, 16 Oct 2023 23:13:03 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 21/90] target/sparc: Move RDASR, STBAR, MEMBAR to decodetree Date: Mon, 16 Oct 2023 23:11:35 -0700 Message-Id: <20231017061244.681584-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++ target/sparc/translate.c | 360 ++++++++++++++++++++++++-------------- 2 files changed, 253 insertions(+), 129 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4d09c102f1..b3291ea771 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -23,3 +23,25 @@ SETHI 00 rd:5 100 i:22 CALL 01 i:s30 Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 + +{ + [ + STBAR 10 00000 101000 01111 0 0000000000000 + MEMBAR 10 00000 101000 01111 1 000000 cmask:3 mmask:4 + + RDCCR 10 rd:5 101000 00010 0 0000000000000 + RDASI 10 rd:5 101000 00011 0 0000000000000 + RDTICK 10 rd:5 101000 00100 0 0000000000000 + RDPC 10 rd:5 101000 00101 0 0000000000000 + RDFPRS 10 rd:5 101000 00110 0 0000000000000 + RDASR17 10 rd:5 101000 10001 0 0000000000000 + RDGSR 10 rd:5 101000 10011 0 0000000000000 + RDSOFTINT 10 rd:5 101000 10110 0 0000000000000 + RDTICK_CMPR 10 rd:5 101000 10111 0 0000000000000 + RDSTICK 10 rd:5 101000 11000 0 0000000000000 + RDSTICK_CMPR 10 rd:5 101000 11001 0 0000000000000 + RDSTRAND_STATUS 10 rd:5 101000 11010 0 0000000000000 + ] + # Before v8, all rs1 accepted; otherwise rs1==0. + RDY 10 rd:5 101000 rs1:5 0 0000000000000 +} diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 4a4aab81cd..0fd454c635 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -36,6 +36,10 @@ #include "exec/helper-info.c.inc" #undef HELPER_H +#ifndef TARGET_SPARC64 +#define gen_helper_rdccr(D, E) qemu_build_not_reached() +#endif + /* Dynamic PC, must exit to main loop. */ #define DYNAMIC_PC 1 /* Dynamic PC, one of two values according to jump_pc[T2]. */ @@ -2842,6 +2846,8 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_32(C) true # define avail_64(C) false #endif +#define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) /* Default case for non jump instructions. */ static bool advance_pc(DisasContext *dc) @@ -2942,6 +2948,12 @@ static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, return true; } +static bool raise_priv(DisasContext *dc) +{ + gen_exception(dc, TT_PRIV_INSN); + return true; +} + static bool do_bpcc(DisasContext *dc, arg_bcc *a) { target_long target = dc->pc + a->i * 4; @@ -3116,6 +3128,215 @@ static bool trans_Tcc(DisasContext *dc, arg_Tcc *a) return advance_pc(dc); } +static bool trans_STBAR(DisasContext *dc, arg_STBAR *a) +{ + tcg_gen_mb(TCG_MO_ST_ST | TCG_BAR_SC); + return advance_pc(dc); +} + +static bool trans_MEMBAR(DisasContext *dc, arg_MEMBAR *a) +{ + if (avail_32(dc)) { + return false; + } + if (a->mmask) { + /* Note TCG_MO_* was modeled on sparc64, so mmask matches. */ + tcg_gen_mb(a->mmask | TCG_BAR_SC); + } + if (a->cmask) { + /* For #Sync, etc, end the TB to recognize interrupts. */ + dc->base.is_jmp = DISAS_EXIT; + } + return advance_pc(dc); +} + +static bool do_rd_special(DisasContext *dc, bool priv, int rd, + TCGv (*func)(DisasContext *, TCGv)) +{ + if (!priv) { + return raise_priv(dc); + } + gen_store_gpr(dc, rd, func(dc, gen_dest_gpr(dc, rd))); + return advance_pc(dc); +} + +static TCGv do_rdy(DisasContext *dc, TCGv dst) +{ + return cpu_y; +} + +static bool trans_RDY(DisasContext *dc, arg_RDY *a) +{ + /* + * TODO: Need a feature bit for sparcv8. In the meantime, treat all + * 32-bit cpus like sparcv7, which ignores the rs1 field. + * This matches after all other ASR, so Leon3 Asr17 is handled first. + */ + if (avail_64(dc) && a->rs1 != 0) { + return false; + } + return do_rd_special(dc, true, a->rd, do_rdy); +} + +static TCGv do_rd_leon3_config(DisasContext *dc, TCGv dst) +{ + uint32_t val; + + /* + * TODO: There are many more fields to be filled, + * some of which are writable. + */ + val = dc->def->nwindows - 1; /* [4:0] NWIN */ + val |= 1 << 8; /* [8] V8 */ + + return tcg_constant_tl(val); +} + +TRANS(RDASR17, ASR17, do_rd_special, true, a->rd, do_rd_leon3_config) + +static TCGv do_rdccr(DisasContext *dc, TCGv dst) +{ + update_psr(dc); + gen_helper_rdccr(dst, tcg_env); + return dst; +} + +TRANS(RDCCR, 64, do_rd_special, true, a->rd, do_rdccr) + +static TCGv do_rdasi(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return tcg_constant_tl(dc->asi); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDASI, 64, do_rd_special, true, a->rd, do_rdasi) + +static TCGv do_rdtick(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + TCGv_i32 r_const = tcg_constant_i32(dc->mem_idx); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, tick)); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_tick_get_count(dst, tcg_env, r_tickptr, r_const); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: non-priv access only allowed when enabled. */ +TRANS(RDTICK, 64, do_rd_special, true, a->rd, do_rdtick) + +static TCGv do_rdpc(DisasContext *dc, TCGv dst) +{ + target_ulong val = dc->pc; + if (AM_CHECK(dc)) { + val &= 0xffffffffULL; + } + return tcg_constant_tl(val); +} + +TRANS(RDPC, 64, do_rd_special, true, a->rd, do_rdpc) + +static TCGv do_rdfprs(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ext_i32_tl(dst, cpu_fprs); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDFPRS, 64, do_rd_special, true, a->rd, do_rdfprs) + +static TCGv do_rdgsr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + gen_trap_ifnofpu(dc); + return cpu_gsr; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDGSR, 64, do_rd_special, true, a->rd, do_rdgsr) + +static TCGv do_rdsoftint(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, softint)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDSOFTINT, 64, do_rd_special, supervisor(dc), a->rd, do_rdsoftint) + +static TCGv do_rdtick_cmpr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_tick_cmpr; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: non-priv access only allowed when enabled. */ +TRANS(RDTICK_CMPR, 64, do_rd_special, true, a->rd, do_rdtick_cmpr) + +static TCGv do_rdstick(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + TCGv_i32 r_const = tcg_constant_i32(dc->mem_idx); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, stick)); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_tick_get_count(dst, tcg_env, r_tickptr, r_const); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: non-priv access only allowed when enabled. */ +TRANS(RDSTICK, 64, do_rd_special, true, a->rd, do_rdstick) + +static TCGv do_rdstick_cmpr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_stick_cmpr; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: supervisor access only allowed when enabled by hypervisor. */ +TRANS(RDSTICK_CMPR, 64, do_rd_special, supervisor(dc), a->rd, do_rdstick_cmpr) + +/* + * UltraSPARC-T1 Strand status. + * HYPV check maybe not enough, UA2005 & UA2007 describe + * this ASR as impl. dep + */ +static TCGv do_rdstrand_status(DisasContext *dc, TCGv dst) +{ + return tcg_constant_tl(1); +} + +TRANS(RDSTRAND_STATUS, HYPV, do_rd_special, true, a->rd, do_rdstrand_status) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3142,134 +3363,12 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ { - unsigned int xop = GET_FIELD(insn, 7, 12); - TCGv cpu_dst = tcg_temp_new(); - TCGv cpu_tmp0; + unsigned int xop __attribute__((unused)) = GET_FIELD(insn, 7, 12); + TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); + TCGv cpu_tmp0 __attribute__((unused)); - if (xop == 0x28) { - rs1 = GET_FIELD(insn, 13, 17); - switch(rs1) { - case 0: /* rdy */ -#ifndef TARGET_SPARC64 - case 0x01 ... 0x0e: /* undefined in the SPARCv8 - manual, rdy on the microSPARC - II */ - case 0x0f: /* stbar in the SPARCv8 manual, - rdy on the microSPARC II */ - case 0x10 ... 0x1f: /* implementation-dependent in the - SPARCv8 manual, rdy on the - microSPARC II */ - /* Read Asr17 */ - if (rs1 == 0x11 && dc->def->features & CPU_FEATURE_ASR17) { - TCGv t = gen_dest_gpr(dc, rd); - /* Read Asr17 for a Leon3 monoprocessor */ - tcg_gen_movi_tl(t, (1 << 8) | (dc->def->nwindows - 1)); - gen_store_gpr(dc, rd, t); - break; - } -#endif - gen_store_gpr(dc, rd, cpu_y); - break; -#ifdef TARGET_SPARC64 - case 0x2: /* V9 rdccr */ - update_psr(dc); - gen_helper_rdccr(cpu_dst, tcg_env); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0x3: /* V9 rdasi */ - tcg_gen_movi_tl(cpu_dst, dc->asi); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0x4: /* V9 rdtick */ - { - TCGv_ptr r_tickptr; - TCGv_i32 r_const; - - r_tickptr = tcg_temp_new_ptr(); - r_const = tcg_constant_i32(dc->mem_idx); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_tick_get_count(cpu_dst, tcg_env, r_tickptr, - r_const); - gen_store_gpr(dc, rd, cpu_dst); - } - break; - case 0x5: /* V9 rdpc */ - { - TCGv t = gen_dest_gpr(dc, rd); - if (unlikely(AM_CHECK(dc))) { - tcg_gen_movi_tl(t, dc->pc & 0xffffffffULL); - } else { - tcg_gen_movi_tl(t, dc->pc); - } - gen_store_gpr(dc, rd, t); - } - break; - case 0x6: /* V9 rdfprs */ - tcg_gen_ext_i32_tl(cpu_dst, cpu_fprs); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0xf: /* V9 membar */ - break; /* no effect */ - case 0x13: /* Graphics Status */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_store_gpr(dc, rd, cpu_gsr); - break; - case 0x16: /* Softint */ - tcg_gen_ld32s_tl(cpu_dst, tcg_env, - offsetof(CPUSPARCState, softint)); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0x17: /* Tick compare */ - gen_store_gpr(dc, rd, cpu_tick_cmpr); - break; - case 0x18: /* System tick */ - { - TCGv_ptr r_tickptr; - TCGv_i32 r_const; - - r_tickptr = tcg_temp_new_ptr(); - r_const = tcg_constant_i32(dc->mem_idx); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, stick)); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_tick_get_count(cpu_dst, tcg_env, r_tickptr, - r_const); - gen_store_gpr(dc, rd, cpu_dst); - } - break; - case 0x19: /* System tick compare */ - gen_store_gpr(dc, rd, cpu_stick_cmpr); - break; - case 0x1a: /* UltraSPARC-T1 Strand status */ - /* XXX HYPV check maybe not enough, UA2005 & UA2007 describe - * this ASR as impl. dep - */ - CHECK_IU_FEATURE(dc, HYPV); - { - TCGv t = gen_dest_gpr(dc, rd); - tcg_gen_movi_tl(t, 1UL); - gen_store_gpr(dc, rd, t); - } - break; - case 0x10: /* Performance Control */ - case 0x11: /* Performance Instrumentation Counter */ - case 0x12: /* Dispatch Control */ - case 0x14: /* Softint set, WO */ - case 0x15: /* Softint clear, WO */ -#endif - default: - goto illegal_insn; - } #if !defined(CONFIG_USER_ONLY) - } else if (xop == 0x29) { /* rdpsr / UA2005 rdhpr */ + if (xop == 0x29) { /* rdpsr / UA2005 rdhpr */ #ifndef TARGET_SPARC64 if (!supervisor(dc)) { goto priv_insn; @@ -3307,7 +3406,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif gen_store_gpr(dc, rd, cpu_dst); break; - } else if (xop == 0x2a) { /* rdwim / V9 rdpr */ + } + if (xop == 0x2a) { /* rdwim / V9 rdpr */ if (!supervisor(dc)) { goto priv_insn; } @@ -3431,9 +3531,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif gen_store_gpr(dc, rd, cpu_tmp0); break; + } #endif #if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) - } else if (xop == 0x2b) { /* rdtbr / V9 flushw */ + if (xop == 0x2b) { /* rdtbr / V9 flushw */ #ifdef TARGET_SPARC64 gen_helper_flushw(tcg_env); #else @@ -3442,8 +3543,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_store_gpr(dc, rd, cpu_tbr); #endif break; + } #endif - } else if (xop == 0x34) { /* FPU Operations */ + if (xop == 0x34) { /* FPU Operations */ if (gen_trap_ifnofpu(dc)) { goto jmp_insn; } From patchwork Tue Oct 17 06:11:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734270 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322993wro; Mon, 16 Oct 2023 23:16:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRGHe7pReINqTVanh70Hfin2nGjTAuG/J313dcBAqo1s1M+2qg2VtVG48Yt7ry48TNshnd X-Received: by 2002:a05:6214:c65:b0:66d:3abc:4ff2 with SMTP id t5-20020a0562140c6500b0066d3abc4ff2mr1575467qvj.63.1697523397075; Mon, 16 Oct 2023 23:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523397; cv=none; d=google.com; s=arc-20160816; b=J9heB1iuE455kQaadeIttiwZbMoYXIESSEXzisVMBC4tvoiZyDZsthjqjrxZn1yd05 yabYl+b3yggyLiUOQ/+Fi5SHEMcRCZy1XP/j7PsbbMpLAYSEX9C0EyGwGYvotXA9HHrv HeZs5s5wAWgFf9rSNkYbDlRWx4RedmG9+TyIJx+6iJzB7aOlj8hYVI7f9eHt8fxGg9ls pZNrAdV7y4873O2OYHAXWfZSe4G1j3tNdlvZ32TJESLhr9dZjHJE8ei1ZCLKxj8kbg+9 h5Hd93SibS/DiDl4IjFvrAkqgcnzGI/jYTlzHJ+5kHkW0wNH1cncnCzXuqyakYWbFUFj KxLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=wHyb+yTWTZ+oy0MAnuQnnj1Y8pCLIHb/0+zWR2D9dU8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=pCncBecOxgPaF1AAdowpiSQ5GrzhViZ8eFb4t7zoVTAYSnv8HGieShSG742oQ+m/a4 8QQ1ghxQxyQxNT80H646ivnmf6Ja2SEe2hZcyBm93Pl+2SiveOVDOFP5KsZ+wgP6/h1X WC9auUR1HZew/AlU6MfrFOpdf6gVN0Jk0LCPWw10g/nGvr0NoMG5wB1s8aedsI7X290N BuDnEHdwjBLsaBiaFvUxQx5jcNl64NHJA9mLaaxK5Nt9LTg/5IeuhaTIixQnDUWTISMI IACIFhC9uCoRUEF+Fc1wZtopUEOYJAdfmvyiLOu5B5M7REda42k/kBBFOA+0o3KGmVKE djHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wu4EuWG1; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e25-20020a05620a209900b00767d57590f5si629836qka.455.2023.10.16.23.16.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:16:37 -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=wu4EuWG1; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKI-0000XA-T3; Tue, 17 Oct 2023 02:13:10 -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 1qsdKF-0000Ox-S9 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:07 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKD-0003tf-Qy for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:07 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1bf55a81eeaso34706385ad.0 for ; Mon, 16 Oct 2023 23:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523184; x=1698127984; 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=wHyb+yTWTZ+oy0MAnuQnnj1Y8pCLIHb/0+zWR2D9dU8=; b=wu4EuWG1mu9easul8wW6D9Tzr+6Eu5PdzU9YiM/GEEP3WVtwj0ouQKcmVzNaUzadKu w5uTW+fSet8ovDzB3XOAWfyMNdsHi6f2oCSu7jsbLMPaJgDVonePGziMI0kzO7pWFkRH cl7yp0OMZd2KYL26LV1VLP6rZcGdL3qa8+l0rLQ/V8l7C6iaCimbPAqopxJfQrkVzeKl uLQYeac0hGI4aruzmtk0QP55T52zL11xnnsQyEPLM5u6utR4Ju2fINguTDdhs7mCpaXh ZAoDHXHRmSZJENZqvJCOKCGTsQSl7tn7G/9sXwpeaUDfeZPZj9obXCUqdAXoxrxBYlCB y3JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523184; x=1698127984; 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=wHyb+yTWTZ+oy0MAnuQnnj1Y8pCLIHb/0+zWR2D9dU8=; b=WvqUGKWqcFxQLqNNbHYKqXKtdWtvpWb4YlQ/IfjnfQx01HbLZCiXaeSJwmtJ8iTQIF ZAnAe7h71QG7cqM3C9Pdzu+eFN+06qdtRsZ1uT/rNQMV9nQYUH6JfNPh+Kas1CGkfcqX Yqml+MHsa51wuodzF+DqY+TqsTX+/LSrH8a5flGqJOvLnuGqpT2t5xBmCPPZelwaXGz8 CddXtzu033rVIIGO/TIk54duMW9lpZTbbl5H2c7+JcT+CxHb8vtxQoUXtazK1qaxmJ85 TOydulftBBJEWzml4gmgYCiUZZvxhO5uSSvXK91XBWC/zn69MoauDrotU4m00VQlTvu3 +ImQ== X-Gm-Message-State: AOJu0YyJ6vyqNBlqBVEigzEbjFXeHcNSXe0HrJ1tfDSPIW+urQYp+qdR X0OUX4+21l8ZN0drJcQ90X0kMqjq0gLwghXaEfc= X-Received: by 2002:a17:903:78f:b0:1ca:86db:1d31 with SMTP id kn15-20020a170903078f00b001ca86db1d31mr1067709plb.7.1697523184516; Mon, 16 Oct 2023 23:13:04 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 22/90] target/sparc: Move RDPSR, RDHPR to decodetree Date: Mon, 16 Oct 2023 23:11:36 -0700 Message-Id: <20231017061244.681584-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 10 ++++ target/sparc/translate.c | 112 ++++++++++++++++++++++++-------------- 2 files changed, 80 insertions(+), 42 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index b3291ea771..8b05b9d8f1 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -45,3 +45,13 @@ Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 # Before v8, all rs1 accepted; otherwise rs1==0. RDY 10 rd:5 101000 rs1:5 0 0000000000000 } + +{ + RDPSR 10 rd:5 101001 00000 0 0000000000000 + RDHPR_hpstate 10 rd:5 101001 00000 0 0000000000000 +} +# RDHPR_tstate +RDHPR_hintp 10 rd:5 101001 00011 0 0000000000000 +RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 +RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 +RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 0fd454c635..cdfe353596 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -36,7 +36,9 @@ #include "exec/helper-info.c.inc" #undef HELPER_H -#ifndef TARGET_SPARC64 +#ifdef TARGET_SPARC64 +#define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#else #define gen_helper_rdccr(D, E) qemu_build_not_reached() #endif @@ -260,15 +262,14 @@ static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) /* moves */ #ifdef CONFIG_USER_ONLY #define supervisor(dc) 0 -#ifdef TARGET_SPARC64 #define hypervisor(dc) 0 -#endif #else #ifdef TARGET_SPARC64 #define hypervisor(dc) (dc->hypervisor) #define supervisor(dc) (dc->supervisor | dc->hypervisor) #else #define supervisor(dc) (dc->supervisor) +#define hypervisor(dc) 0 #endif #endif @@ -3337,6 +3338,72 @@ static TCGv do_rdstrand_status(DisasContext *dc, TCGv dst) TRANS(RDSTRAND_STATUS, HYPV, do_rd_special, true, a->rd, do_rdstrand_status) +static TCGv do_rdpsr(DisasContext *dc, TCGv dst) +{ + update_psr(dc); + gen_helper_rdpsr(dst, tcg_env); + return dst; +} + +TRANS(RDPSR, 32, do_rd_special, supervisor(dc), a->rd, do_rdpsr) + +static TCGv do_rdhpstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld_i64(dst, tcg_env, offsetof(CPUSPARCState, hpstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hpstate, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhpstate) + +static TCGv do_rdhintp(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_hintp; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hintp, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhintp) + +static TCGv do_rdhtba(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_htba; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_htba, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhtba) + +static TCGv do_rdhver(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_hver; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hver, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhver) + +static TCGv do_rdhstick_cmpr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_hstick_cmpr; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hstick_cmpr, HYPV, do_rd_special, hypervisor(dc), a->rd, + do_rdhstick_cmpr) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3368,45 +3435,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_tmp0 __attribute__((unused)); #if !defined(CONFIG_USER_ONLY) - if (xop == 0x29) { /* rdpsr / UA2005 rdhpr */ -#ifndef TARGET_SPARC64 - if (!supervisor(dc)) { - goto priv_insn; - } - update_psr(dc); - gen_helper_rdpsr(cpu_dst, tcg_env); -#else - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - rs1 = GET_FIELD(insn, 13, 17); - switch (rs1) { - case 0: // hpstate - tcg_gen_ld_i64(cpu_dst, tcg_env, - offsetof(CPUSPARCState, hpstate)); - break; - case 1: // htstate - // gen_op_rdhtstate(); - break; - case 3: // hintp - tcg_gen_mov_tl(cpu_dst, cpu_hintp); - break; - case 5: // htba - tcg_gen_mov_tl(cpu_dst, cpu_htba); - break; - case 6: // hver - tcg_gen_mov_tl(cpu_dst, cpu_hver); - break; - case 31: // hstick_cmpr - tcg_gen_mov_tl(cpu_dst, cpu_hstick_cmpr); - break; - default: - goto illegal_insn; - } -#endif - gen_store_gpr(dc, rd, cpu_dst); - break; - } if (xop == 0x2a) { /* rdwim / V9 rdpr */ if (!supervisor(dc)) { goto priv_insn; From patchwork Tue Oct 17 06:11:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734279 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323601wro; Mon, 16 Oct 2023 23:18:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4boOj2/W5AO2v+po4pOVo9VN8c3ag2zPoDQd2HH9QKLtaqzK2QeWmzTPAHbcho4pFjSPW X-Received: by 2002:a05:6214:f0e:b0:655:e12d:d42d with SMTP id gw14-20020a0562140f0e00b00655e12dd42dmr1820149qvb.28.1697523521934; Mon, 16 Oct 2023 23:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523521; cv=none; d=google.com; s=arc-20160816; b=dOYkdIwf73/Hu+XHyhx2t6pTH5IUVz+gTHX5cfOPu+RTAVkgqQmOe1BoyfE0r9HvVY OLL+nWcEKzsEzsZqCbD8ist3+Akd8+oo3UWg+KrWBAUD/tDVAnKnQL8DFws0EmmB79ba XVDVtsHaOX5O6lywi8mnvlplbFhT6V5Sutzh/GSnzhHgR+ylsw3gUkJ0eEgCbyoPXlyP KeRdN93aol5BRuOa7sgI6kNV5hLvQnFMym7PsggPMr8VcwYr8OSsVGr2whlKo32EgfKe ktzYj5uHKfcNxJzKP1J2obFiTGPZgb9LRMJPLzbzVruA1AMg1AhNsAa6WP6BXXOd8uKJ aWdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=rNFFeSwgL0mBbKArIbcpwqvzDJa/OzeCcibZ2wQczXk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=S8KvHquc7l9SHrbP7OifWKZI/NMH105s52pT4l4LeoHwhJGAYjMlKLKqTBxttaQ+nM jcYVhfygnB9qdPsp2kw/Xz3Gamf+r+d6g/kNr/avl5XlSYzIN7KIcn0yK/qFEMbYAoj8 F6M0H8+oQvZ7LqiVf1jteLmLRgpjA1cPeautHVMsyxIoIou1A6Cw9eIPkxdVhLVMMnVo m1PbxL64xl76L5mq10hPppQTaMgfcWvUkJjKq0yGBtJAd6qE+U6r2rQRFZp9Jm3OP7Y2 0vbVScb+qnsZzhGqgQIg2bWouql6qvsVhmkuTLZeU09F802mlIYntQJYGj51vqIOgrjo sxfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f+wSTbyb; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kc16-20020a056214411000b0066d0289954dsi548214qvb.66.2023.10.16.23.18.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18: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=f+wSTbyb; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKL-0000cc-2I; Tue, 17 Oct 2023 02:13:14 -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 1qsdKH-0000V8-FL for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:09 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKE-0003tu-SX for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:09 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6bce254ba56so1746874b3a.1 for ; Mon, 16 Oct 2023 23:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523185; x=1698127985; 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=rNFFeSwgL0mBbKArIbcpwqvzDJa/OzeCcibZ2wQczXk=; b=f+wSTbyb9K51x8VTV8H90BY63G9Lgrg7i52cOTqqX5As3Q3Y8eCxOaqMcE+B8e3sm2 7Ggq9JcxGM+JpeDX5YtC9NKAyYhBYLzqzYp7+wgz50PRDXU0CWfoOfCfA30Ss1iCyeDi v/Oc6oJ7PKNBURaYfUDFdZlz1fDJIqvX4CysxQUwa82YpBVHS5ivFDnmH47EkVG/a9DT HmZxvym65TpT4ERhu0RwmJh7VDbM94yhvNeRU7YQYy+30SwFAi8/2zZhXKj+kwZURhu2 iYYUFG3/XKOEwHnoUBm3z3RrCVgO9//rFW45zV0VE56w78+tcgJk07ZRX+egt5saLfVY 1QQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523185; x=1698127985; 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=rNFFeSwgL0mBbKArIbcpwqvzDJa/OzeCcibZ2wQczXk=; b=hax0+mgnn25l2uVMc/aRmZeIE8FcZjYE5x9szdpUYdDKQPxO992S2qZxdugRqQR8LS BU7A96abPUVAaSxEnR/vvdDdVpIhbbgdcVjDrAgftWjTNZZwDXEWmpUx59a6jUlrq2kX 0BYbwIg9Abh+WTg2PjY2wxK/CnxA+lrp5+IIVb5xoJht+OCoVi//1JM7CN1ofepJjL4O GDYwYTqpLcaWJYFW34ys6xg1aUTciIg7PwgiLINN1cVsncj78pe+vOJNurUzTHHWAlRM BV7+r288jyVJ+vOcmBNCV4Jx9Zs7v2crWUgG/nfd5p2uS9EmSlyVm4mtSf3e6axvnk// AfuQ== X-Gm-Message-State: AOJu0Ywkm3DvEuLbKlhUa3k6rcVHNgxo/dnQZei6I2T68XLq85nn1fkb C8cQgJQ2vloWw/DoBW98/v+4T/wjhSMzOcO/McI= X-Received: by 2002:a05:6a21:4842:b0:17a:cfce:5a30 with SMTP id au2-20020a056a21484200b0017acfce5a30mr1027730pzc.16.1697523185353; Mon, 16 Oct 2023 23:13:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 23/90] target/sparc: Move RDWIM, RDPR to decodetree Date: Mon, 16 Oct 2023 23:11:37 -0700 Message-Id: <20231017061244.681584-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++ target/sparc/translate.c | 360 +++++++++++++++++++++++--------------- 2 files changed, 244 insertions(+), 138 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 8b05b9d8f1..bab80514ba 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -55,3 +55,25 @@ RDHPR_hintp 10 rd:5 101001 00011 0 0000000000000 RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 + +{ + RDWIM 10 rd:5 101010 00000 0 0000000000000 + RDPR_tpc 10 rd:5 101010 00000 0 0000000000000 +} +RDPR_tnpc 10 rd:5 101010 00001 0 0000000000000 +RDPR_tstate 10 rd:5 101010 00010 0 0000000000000 +RDPR_tt 10 rd:5 101010 00011 0 0000000000000 +RDPR_tick 10 rd:5 101010 00100 0 0000000000000 +RDPR_tba 10 rd:5 101010 00101 0 0000000000000 +RDPR_pstate 10 rd:5 101010 00110 0 0000000000000 +RDPR_tl 10 rd:5 101010 00111 0 0000000000000 +RDPR_pil 10 rd:5 101010 01000 0 0000000000000 +RDPR_cwp 10 rd:5 101010 01001 0 0000000000000 +RDPR_cansave 10 rd:5 101010 01010 0 0000000000000 +RDPR_canrestore 10 rd:5 101010 01011 0 0000000000000 +RDPR_cleanwin 10 rd:5 101010 01100 0 0000000000000 +RDPR_otherwin 10 rd:5 101010 01101 0 0000000000000 +RDPR_wstate 10 rd:5 101010 01110 0 0000000000000 +RDPR_gl 10 rd:5 101010 10000 0 0000000000000 +RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 +RDPR_ver 10 rd:5 101010 11111 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cdfe353596..9d01c53791 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -40,6 +40,7 @@ #define gen_helper_rdpsr(D, E) qemu_build_not_reached() #else #define gen_helper_rdccr(D, E) qemu_build_not_reached() +#define gen_helper_rdcwp(D, E) qemu_build_not_reached() #endif /* Dynamic PC, must exit to main loop. */ @@ -59,9 +60,7 @@ static TCGv_i32 cpu_psr; static TCGv cpu_fsr, cpu_pc, cpu_npc; static TCGv cpu_regs[32]; static TCGv cpu_y; -#ifndef CONFIG_USER_ONLY static TCGv cpu_tbr; -#endif static TCGv cpu_cond; #ifdef TARGET_SPARC64 static TCGv_i32 cpu_xcc, cpu_fprs; @@ -2687,8 +2686,7 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) gen_update_fprs_dirty(dc, qd); } -#ifndef CONFIG_USER_ONLY -static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_env tcg_env) +static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) { TCGv_i32 r_tl = tcg_temp_new_i32(); @@ -2709,7 +2707,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_env tcg_env) tcg_gen_add_ptr(r_tsptr, r_tsptr, r_tl_tmp); } } -#endif static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1, TCGv s2, int width, bool cc, bool left) @@ -2848,6 +2845,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_64(C) false #endif #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) /* Default case for non jump instructions. */ @@ -3404,6 +3402,221 @@ static TCGv do_rdhstick_cmpr(DisasContext *dc, TCGv dst) TRANS(RDHPR_hstick_cmpr, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhstick_cmpr) +static TCGv do_rdwim(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + qemu_build_not_reached(); +#else + return cpu_wim; +#endif +} + +TRANS(RDWIM, 32, do_rd_special, supervisor(dc), a->rd, do_rdwim) + +static TCGv do_rdtpc(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld_tl(dst, r_tsptr, offsetof(trap_state, tpc)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tpc, 64, do_rd_special, supervisor(dc), a->rd, do_rdtpc) + +static TCGv do_rdtnpc(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld_tl(dst, r_tsptr, offsetof(trap_state, tnpc)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tnpc, 64, do_rd_special, supervisor(dc), a->rd, do_rdtnpc) + +static TCGv do_rdtstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld_tl(dst, r_tsptr, offsetof(trap_state, tstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdtstate) + +static TCGv do_rdtt(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld32s_tl(dst, r_tsptr, offsetof(trap_state, tt)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tt, 64, do_rd_special, supervisor(dc), a->rd, do_rdtt) +TRANS(RDPR_tick, 64, do_rd_special, supervisor(dc), a->rd, do_rdtick) + +static TCGv do_rdtba(DisasContext *dc, TCGv dst) +{ + return cpu_tbr; +} + +TRANS(RDPR_tba, 64, do_rd_special, supervisor(dc), a->rd, do_rdtba) + +static TCGv do_rdpstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, pstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_pstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdpstate) + +static TCGv do_rdtl(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, tl)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tl, 64, do_rd_special, supervisor(dc), a->rd, do_rdtl) + +static TCGv do_rdpil(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, psrpil)); + return dst; +} + +TRANS(RDPR_pil, 64, do_rd_special, supervisor(dc), a->rd, do_rdpil) + +static TCGv do_rdcwp(DisasContext *dc, TCGv dst) +{ + gen_helper_rdcwp(dst, tcg_env); + return dst; +} + +TRANS(RDPR_cwp, 64, do_rd_special, supervisor(dc), a->rd, do_rdcwp) + +static TCGv do_rdcansave(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, cansave)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_cansave, 64, do_rd_special, supervisor(dc), a->rd, do_rdcansave) + +static TCGv do_rdcanrestore(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, canrestore)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_canrestore, 64, do_rd_special, supervisor(dc), a->rd, + do_rdcanrestore) + +static TCGv do_rdcleanwin(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, cleanwin)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_cleanwin, 64, do_rd_special, supervisor(dc), a->rd, do_rdcleanwin) + +static TCGv do_rdotherwin(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, otherwin)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_otherwin, 64, do_rd_special, supervisor(dc), a->rd, do_rdotherwin) + +static TCGv do_rdwstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, wstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_wstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdwstate) + +static TCGv do_rdgl(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, gl)); + return dst; +#else + g_assert_not_reached(); +#endif +} + +TRANS(RDPR_gl, GL, do_rd_special, supervisor(dc), a->rd, do_rdgl) + +/* UA2005 strand status */ +static TCGv do_rdssr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_ssr; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_strand_status, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdssr) + +static TCGv do_rdver(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_ver; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_ver, 64, do_rd_special, supervisor(dc), a->rd, do_rdver) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3434,133 +3647,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); TCGv cpu_tmp0 __attribute__((unused)); -#if !defined(CONFIG_USER_ONLY) - if (xop == 0x2a) { /* rdwim / V9 rdpr */ - if (!supervisor(dc)) { - goto priv_insn; - } - cpu_tmp0 = tcg_temp_new(); -#ifdef TARGET_SPARC64 - rs1 = GET_FIELD(insn, 13, 17); - switch (rs1) { - case 0: // tpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tpc)); - } - break; - case 1: // tnpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tnpc)); - } - break; - case 2: // tstate - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tstate)); - } - break; - case 3: // tt - { - TCGv_ptr r_tsptr = tcg_temp_new_ptr(); - - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld32s_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tt)); - } - break; - case 4: // tick - { - TCGv_ptr r_tickptr; - TCGv_i32 r_const; - - r_tickptr = tcg_temp_new_ptr(); - r_const = tcg_constant_i32(dc->mem_idx); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_tick_get_count(cpu_tmp0, tcg_env, - r_tickptr, r_const); - } - break; - case 5: // tba - tcg_gen_mov_tl(cpu_tmp0, cpu_tbr); - break; - case 6: // pstate - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, pstate)); - break; - case 7: // tl - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, tl)); - break; - case 8: // pil - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, psrpil)); - break; - case 9: // cwp - gen_helper_rdcwp(cpu_tmp0, tcg_env); - break; - case 10: // cansave - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, cansave)); - break; - case 11: // canrestore - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, canrestore)); - break; - case 12: // cleanwin - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, cleanwin)); - break; - case 13: // otherwin - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, otherwin)); - break; - case 14: // wstate - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, wstate)); - break; - case 16: // UA2005 gl - CHECK_IU_FEATURE(dc, GL); - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, gl)); - break; - case 26: // UA2005 strand status - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - tcg_gen_mov_tl(cpu_tmp0, cpu_ssr); - break; - case 31: // ver - tcg_gen_mov_tl(cpu_tmp0, cpu_ver); - break; - case 15: // fq - default: - goto illegal_insn; - } -#else - tcg_gen_ext_i32_tl(cpu_tmp0, cpu_wim); -#endif - gen_store_gpr(dc, rd, cpu_tmp0); - break; - } -#endif #if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) if (xop == 0x2b) { /* rdtbr / V9 flushw */ #ifdef TARGET_SPARC64 @@ -4406,7 +4492,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tpc)); } @@ -4416,7 +4502,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tnpc)); } @@ -4426,7 +4512,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tstate)); @@ -4437,7 +4523,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st32_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tt)); } @@ -5866,9 +5952,7 @@ void sparc_tcg_init(void) { &cpu_pc, offsetof(CPUSPARCState, pc), "pc" }, { &cpu_npc, offsetof(CPUSPARCState, npc), "npc" }, { &cpu_y, offsetof(CPUSPARCState, y), "y" }, -#ifndef CONFIG_USER_ONLY { &cpu_tbr, offsetof(CPUSPARCState, tbr), "tbr" }, -#endif }; unsigned int i; From patchwork Tue Oct 17 06:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734325 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326196wro; Mon, 16 Oct 2023 23:27:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrJZaifFMfJnh/rxjuaFmtSFKQ7B3fw+y+8fBVYdOlKLtuVNjWVjewFPi2owyXmCzQpkP3 X-Received: by 2002:a05:620a:4146:b0:775:9f94:16f1 with SMTP id k6-20020a05620a414600b007759f9416f1mr1149966qko.22.1697524034303; Mon, 16 Oct 2023 23:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524034; cv=none; d=google.com; s=arc-20160816; b=hFd5nu8ZwLCh1OyPSaD4y77mw89oigT5d14EKTT8FBGf711Rg2suarhxHiBcgPLM0a iHtyEAV2buTrXcLBxkijW5t2A6I+y4Tix2vvaGWe4/VuetUDtBqto4uHu0879HpgLUa0 dSq9D89OOeB8iuQkWMdFhoyixNkAycv4q5Fe1YA5u72moN+fBR6JZBddOSg8n0kKzYCd eobekytIiNjIUihFsZ1LYQZ1fezYeX820S6e6szo2n4abor/LKn2UGW0A5lVQYhutS4R aCF43GQkxs90I1Nyo8oV556x77bftNF/VwEKpglaFp5TOhqbBxMwcuZ4Df+M0erxfrvV WOJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=0V5M82NG7JGYdCRA+WhlsKSM/qMjWgqbad3PPOsTsuY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ZyIQuHcMwvdIyS+kOIQboSw8M1Huijy8F75kMjm0+i0rc9ypRrESp2/cEgqaxoLCps 9OX6grxxxJfTB7lx4ntwqnldZZIIfkoHMnBIlMUXuvML8YH5fVsFSUhN7QnxxA8q+Vzr EBRF2KqHwl67wWeUd49hGmidX6S7624EZi/mmNOZAevnR8a287CacYjMfR9dQ7pxqrzO /e53LkGDc4Sia1j2EE+6VgdIwT0Fx+z8EQIt9dKaSLM4y6Ss2bdOXEPmUPhi7LRqNRev 6+PjTgpdpjSL3B+MVIs40Hn+RbN/mHbE5zyaO4DAz4bqlWcShOD2JH+ytx2B0QgC46EW TLKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yiUe+jJs; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ay20-20020a05620a179400b0077176987c4csi606908qkb.313.2023.10.16.23.27.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:27:14 -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=yiUe+jJs; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKN-0000gB-3V; Tue, 17 Oct 2023 02:13:15 -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 1qsdKK-0000Zo-4X for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:12 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKF-0003u5-Dd for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:11 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c9e95aa02dso33426165ad.0 for ; Mon, 16 Oct 2023 23:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523186; x=1698127986; 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=0V5M82NG7JGYdCRA+WhlsKSM/qMjWgqbad3PPOsTsuY=; b=yiUe+jJsI0QEZTGyOC3aksACCTszhsMl2s2lPKeziP7W0RH6BllZ4HorebgxzRLtRa yaqwui/sajAJqn2ozLmbQwd/5EErAjvBQibkeozdmOvPqw96pk+RTtuwB5kWUPvORXDV V6DHduHkGZ9h3J3VfBnX5AolpwL+4pyz6EKgbKHvqd7Rm2B1QKtr7rYt13Gzy7jiD++X MvXn0addp+FAdHDNjZaAHhLjcp1RvbVVBdk5V35RiN4dCONR2rnOnL2vVH/uvjrkiw6Y tIQTPoNQdscxls1ktwhMq1zrQrVORCueriCOdZSxVV+dQyh0W4stjkkXeVAhU46rAi3z hBcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523186; x=1698127986; 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=0V5M82NG7JGYdCRA+WhlsKSM/qMjWgqbad3PPOsTsuY=; b=e+pCSIPy7Vzz2SzGtHkYOv7fvqT9UsYvtLEIszT5ohqJjSpnAScwPHOEmcmd/yzBG7 0e5cRDl+FwlRmymlG7lNCjEn7fo3ZB1N2Uh+11XPlDGqyskoFm7wsP2T7XYqLD7wqLyq 0CYKzn6nsI2v8hZj9bR/lNEDIQXZZUAnwf9SUfi7FIFqR0fltHI20kGman+fBh6GZ6J1 DPOoL5znmUPyifcxQSHDw4n/vqlW8oGmQaLika/MDVfpJSetS0ky6+M05rlk16Emu4fJ XHXipGJspsAspN4TF5Sj0YI5ylWCjg1LnsiOS5okj+z2Mc/XN5U6CLAmcGHLTwROZN9D mDKA== X-Gm-Message-State: AOJu0YySMmN5VkhPGdwyN7Vc9hPh75pft+eR7O69XmNRo+fQ6zlsX0AQ TMwnDYq4+31xmzWhNtSwj5tPgOm0RJIppuw+gjM= X-Received: by 2002:a17:903:41cc:b0:1b8:8682:62fb with SMTP id u12-20020a17090341cc00b001b8868262fbmr1660734ple.4.1697523186144; Mon, 16 Oct 2023 23:13:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 24/90] target/sparc: Move RDTBR, FLUSHW to decodetree Date: Mon, 16 Oct 2023 23:11:38 -0700 Message-Id: <20231017061244.681584-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 5 +++++ target/sparc/translate.c | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index bab80514ba..c2d8b0dbbe 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -77,3 +77,8 @@ RDPR_wstate 10 rd:5 101010 01110 0 0000000000000 RDPR_gl 10 rd:5 101010 10000 0 0000000000000 RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 RDPR_ver 10 rd:5 101010 11111 0 0000000000000 + +{ + FLUSHW 10 00000 101011 00000 0 0000000000000 + RDTBR 10 rd:5 101011 00000 0 0000000000000 +} diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9d01c53791..c6f64e7fbb 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3479,6 +3479,7 @@ static TCGv do_rdtba(DisasContext *dc, TCGv dst) return cpu_tbr; } +TRANS(RDTBR, 32, do_rd_special, supervisor(dc), a->rd, do_rdtba) TRANS(RDPR_tba, 64, do_rd_special, supervisor(dc), a->rd, do_rdtba) static TCGv do_rdpstate(DisasContext *dc, TCGv dst) @@ -3617,6 +3618,16 @@ static TCGv do_rdver(DisasContext *dc, TCGv dst) TRANS(RDPR_ver, 64, do_rd_special, supervisor(dc), a->rd, do_rdver) +static bool trans_FLUSHW(DisasContext *dc, arg_FLUSHW *a) +{ +#ifdef TARGET_SPARC64 + gen_helper_flushw(tcg_env); + return advance_pc(dc); +#else + return false; +#endif +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3647,18 +3658,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); TCGv cpu_tmp0 __attribute__((unused)); -#if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) - if (xop == 0x2b) { /* rdtbr / V9 flushw */ -#ifdef TARGET_SPARC64 - gen_helper_flushw(tcg_env); -#else - if (!supervisor(dc)) - goto priv_insn; - gen_store_gpr(dc, rd, cpu_tbr); -#endif - break; - } -#endif if (xop == 0x34) { /* FPU Operations */ if (gen_trap_ifnofpu(dc)) { goto jmp_insn; From patchwork Tue Oct 17 06:11:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734318 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp325937wro; Mon, 16 Oct 2023 23:26:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1uQqVFcqMJzYMPDbXLEeSzmTswxIrPRZ02AC6WFQCLLVeLeCeJ84bJiJdog3wMdPO86aw X-Received: by 2002:a05:622a:1aa5:b0:419:798d:490a with SMTP id s37-20020a05622a1aa500b00419798d490amr1566793qtc.42.1697523977740; Mon, 16 Oct 2023 23:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523977; cv=none; d=google.com; s=arc-20160816; b=Da/GPU48+n3qDjiaX7Zh5y0vWqwYgbCc7iaXBT8+wpI8L641Epjzf9wR+cKCGIrVWg hcLLujiCKFXjNBRlaQfs2beiBiPLSLUOFaNnt0gaF8IqTq/oU+HNHpyXWJIN1SE31HIl Wg2zbm0/wkfRDjBap34kSCKrtyoWmXqK86snrH0C+l3NqWlXu9GCT8eptCcOU6gJCcTE hyaeOmqD8ymocOZIli8DQfkDGnq+zdF2i4UHy0fHvwF1wh9OYAe6V1RcxLY99gRa/9AJ rnvZTCj67ERQ/mXUuP1MxjE0jp6tL4TEVuzVOFxWXtvGXS/1YH1wCh008YyYD65a07MP A6qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Q/fnBj1oK6+/voaexvf52vnrVBh/wwvBCUIx3Luw4kc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=cUA01hPJeEXBpujN/DkKUOEx9SIWGaAmLB/gM4Hu7AvD6kgerO0eECvhSOtP62tmdU VYhrZ/Bm5cN9vjMHoiLoZNzXPpkGF8qE4wc+tDjbLYQVAdlZjiCqCocYCGsGbvpOrISC rRhnHMavOFq3GMFlO+ajfWpKkLWabBiEkzv2ZLRZ4Uku4Gw2UBmm1GR1RlrBSdIfMUFV 0mdi/1q9QRUDDKIE2yAwCsEyFRMAHvQA7lEhSl+fOtyrUQjfLFhq5fxHLC6oKHYN3lo7 c/0RhYpJ7+Xkm7PEy/TeyLNGp0JpT6i8IQu7Th0pb031dJK8nBThjvoUs8y68bsspI3a S8AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="b23/Q2HK"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j3-20020ac85f83000000b004055a8c7903si691330qta.211.2023.10.16.23.26.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:26:17 -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="b23/Q2HK"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKP-0000iS-E7; Tue, 17 Oct 2023 02:13:17 -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 1qsdKJ-0000Z2-Qs for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:11 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKH-0003uN-A3 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:11 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6b9af7d41d2so2139016b3a.0 for ; Mon, 16 Oct 2023 23:13:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523187; x=1698127987; 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=Q/fnBj1oK6+/voaexvf52vnrVBh/wwvBCUIx3Luw4kc=; b=b23/Q2HKYnaHeDP37YO3hQzUZtzhNuqOulOPMQ1bTYJEdtfKQmywmHO5vv5w3QX4R8 ReP7h1bSc1kGtE5riTG4F51YWeTqxnxQoN+oxzv7BQIeYDVgCKXMH1OJpQ3KidDhfdDG /2giJ8aYSZ+4BC8c93JBHgKbZWNlATTvQC8ZsHkbnYwEIyzObRkmJ5HUb2RgDNEp4f+d oaNCvFRQjxxfV38kKwYSy+RLTj3EZFFJiJbOrXv+ihtDD94ofeIQzde+ICpjalYDvypa VqLJQQ1wemfsNP5q+AZ+7UXGqdV2QUP5c9sT/9SpAR64GOLJLiqE2S5g3MUVfZO+HGl7 +PAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523187; x=1698127987; 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=Q/fnBj1oK6+/voaexvf52vnrVBh/wwvBCUIx3Luw4kc=; b=qcw7Z3NgqR2AlW5J1Cdku+ot5Qg88q6xcWh84NVPb245KHkpFVX+mBBlu66dhyntXz RJTdXfC+HneQAN9q5rjD9mcDYuBTf/NMMIpM2fh43XUCWZTIe4IpXtgqNeLaq2wdmY+8 sH9uID6SZ9iZQkTXsLnYr71kNdpKIQakU2f4cga8kxocAz2ZxRzZzX9bzEhtD0TSRb5h QuFWNIqNz35aMSjvqkdyjM/NX4rW3lyYWdh24ZNU77QUoPtIS45cPGyJQEKWV6JgnjEf 8UxiPJVNuGdsyvO/RpTvCSlmyJiZQvsiovEUkmmX0FS7VTsdSUeT40a6qhV5c0Uwydse FFsA== X-Gm-Message-State: AOJu0YwoLpd3RvI6B/b0tCrZtGsgt6MIwIoOTNeu2mAYABpuT017GSlO mnp9ZEFVoYr5Ef3+H1tPxIXtBkr8wBP+J79sLhc= X-Received: by 2002:a05:6a21:47c1:b0:15e:b8a1:57b9 with SMTP id as1-20020a056a2147c100b0015eb8a157b9mr1098066pzc.24.1697523186978; Mon, 16 Oct 2023 23:13:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 25/90] target/sparc: Move WRASR to decodetree Date: Mon, 16 Oct 2023 23:11:39 -0700 Message-Id: <20231017061244.681584-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 33 +++- target/sparc/translate.c | 353 +++++++++++++++++++++----------------- 2 files changed, 226 insertions(+), 160 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index c2d8b0dbbe..6acf0f9403 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -22,7 +22,12 @@ SETHI 00 rd:5 100 i:22 CALL 01 i:s30 -Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 +## +## Major Opcode 10 -- integer, floating-point, vis, and system insns. +## + +&r_r_ri rd rs1 rs2_or_imm imm:bool +@n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 { [ @@ -46,6 +51,30 @@ Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 RDY 10 rd:5 101000 rs1:5 0 0000000000000 } +{ + [ + WRY 10 00000 110000 ..... . ............. @n_r_ri + WRCCR 10 00010 110000 ..... . ............. @n_r_ri + WRASI 10 00011 110000 ..... . ............. @n_r_ri + WRFPRS 10 00110 110000 ..... . ............. @n_r_ri + { + WRGSR 10 10011 110000 ..... . ............. @n_r_ri + WRPOWERDOWN 10 10011 110000 ..... . ............. @n_r_ri + } + WRSOFTINT_SET 10 10100 110000 ..... . ............. @n_r_ri + WRSOFTINT_CLR 10 10101 110000 ..... . ............. @n_r_ri + WRSOFTINT 10 10110 110000 ..... . ............. @n_r_ri + WRTICK_CMPR 10 10111 110000 ..... . ............. @n_r_ri + WRSTICK 10 11000 110000 ..... . ............. @n_r_ri + WRSTICK_CMPR 10 11001 110000 ..... . ............. @n_r_ri + ] + # Before v8, rs1==0 was WRY, and the rest executed as nop. + [ + NOP_v7 10 ----- 110000 ----- 0 00000000 ----- + NOP_v7 10 ----- 110000 ----- 1 -------- ----- + ] +} + { RDPSR 10 rd:5 101001 00000 0 0000000000000 RDHPR_hpstate 10 rd:5 101001 00000 0 0000000000000 @@ -82,3 +111,5 @@ RDPR_ver 10 rd:5 101010 11111 0 0000000000000 FLUSHW 10 00000 101011 00000 0 0000000000000 RDTBR 10 rd:5 101011 00000 0 0000000000000 } + +Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index c6f64e7fbb..59931c053f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -37,10 +37,15 @@ #undef HELPER_H #ifdef TARGET_SPARC64 -#define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#define gen_helper_power_down(E) g_assert_not_reached() #else -#define gen_helper_rdccr(D, E) qemu_build_not_reached() -#define gen_helper_rdcwp(D, E) qemu_build_not_reached() +#define gen_helper_rdccr(D, E) qemu_build_not_reached() +#define gen_helper_rdcwp(D, E) qemu_build_not_reached() +#define gen_helper_wrccr(E, S) qemu_build_not_reached() +#define gen_helper_set_softint(E, S) qemu_build_not_reached() +#define gen_helper_clear_softint(E, S) qemu_build_not_reached() +#define gen_helper_write_softint(E, S) qemu_build_not_reached() #endif /* Dynamic PC, must exit to main loop. */ @@ -2847,6 +2852,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) +#define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) /* Default case for non jump instructions. */ static bool advance_pc(DisasContext *dc) @@ -3064,6 +3070,10 @@ static bool trans_SETHI(DisasContext *dc, arg_SETHI *a) return advance_pc(dc); } +/* + * Major Opcode 10 -- integer, floating-point, vis, and system insns. + */ + static bool trans_Tcc(DisasContext *dc, arg_Tcc *a) { DisasCompare cmp; @@ -3628,6 +3638,186 @@ static bool trans_FLUSHW(DisasContext *dc, arg_FLUSHW *a) #endif } +static bool do_wr_special(DisasContext *dc, arg_r_r_ri *a, bool priv, + void (*func)(DisasContext *, TCGv)) +{ + TCGv src; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!a->imm && (a->rs2_or_imm & ~0x1f)) { + return false; + } + if (!priv) { + return raise_priv(dc); + } + + if (a->rs1 == 0 && (a->imm || a->rs2_or_imm == 0)) { + src = tcg_constant_tl(a->rs2_or_imm); + } else { + TCGv src1 = gen_load_gpr(dc, a->rs1); + if (a->rs2_or_imm == 0) { + src = src1; + } else { + src = tcg_temp_new(); + if (a->imm) { + tcg_gen_xori_tl(src, src1, a->rs2_or_imm); + } else { + tcg_gen_xor_tl(src, src1, gen_load_gpr(dc, a->rs2_or_imm)); + } + } + } + func(dc, src); + return advance_pc(dc); +} + +static void do_wry(DisasContext *dc, TCGv src) +{ + tcg_gen_ext32u_tl(cpu_y, src); +} + +TRANS(WRY, ALL, do_wr_special, a, true, do_wry) + +static void do_wrccr(DisasContext *dc, TCGv src) +{ + gen_helper_wrccr(tcg_env, src); +} + +TRANS(WRCCR, 64, do_wr_special, a, true, do_wrccr) + +static void do_wrasi(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv tmp = tcg_temp_new(); + tcg_gen_andi_tl(tmp, src, 0xff); + tcg_gen_st32_tl(tmp, tcg_env, offsetof(CPUSPARCState, asi)); + /* End TB to notice changed ASI. */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRASI, 64, do_wr_special, a, true, do_wrasi) + +static void do_wrfprs(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_trunc_tl_i32(cpu_fprs, src); + dc->fprs_dirty = 0; + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRFPRS, 64, do_wr_special, a, true, do_wrfprs) + +static void do_wrgsr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + gen_trap_ifnofpu(dc); + tcg_gen_mov_tl(cpu_gsr, src); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRGSR, 64, do_wr_special, a, true, do_wrgsr) + +static void do_wrsoftint_set(DisasContext *dc, TCGv src) +{ + gen_helper_set_softint(tcg_env, src); +} + +TRANS(WRSOFTINT_SET, 64, do_wr_special, a, supervisor(dc), do_wrsoftint_set) + +static void do_wrsoftint_clr(DisasContext *dc, TCGv src) +{ + gen_helper_clear_softint(tcg_env, src); +} + +TRANS(WRSOFTINT_CLR, 64, do_wr_special, a, supervisor(dc), do_wrsoftint_clr) + +static void do_wrsoftint(DisasContext *dc, TCGv src) +{ + gen_helper_write_softint(tcg_env, src); +} + +TRANS(WRSOFTINT, 64, do_wr_special, a, supervisor(dc), do_wrsoftint) + +static void do_wrtick_cmpr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_mov_tl(cpu_tick_cmpr, src); + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, tick)); + translator_io_start(&dc->base); + gen_helper_tick_set_limit(r_tickptr, cpu_tick_cmpr); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRTICK_CMPR, 64, do_wr_special, a, supervisor(dc), do_wrtick_cmpr) + +static void do_wrstick(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, stick)); + translator_io_start(&dc->base); + gen_helper_tick_set_count(r_tickptr, src); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRSTICK, 64, do_wr_special, a, supervisor(dc), do_wrstick) + +static void do_wrstick_cmpr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_mov_tl(cpu_stick_cmpr, src); + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, stick)); + translator_io_start(&dc->base); + gen_helper_tick_set_limit(r_tickptr, cpu_stick_cmpr); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRSTICK_CMPR, 64, do_wr_special, a, supervisor(dc), do_wrstick_cmpr) + +static void do_wrpowerdown(DisasContext *dc, TCGv src) +{ + save_state(dc); + gen_helper_power_down(tcg_env); +} + +TRANS(WRPOWERDOWN, POWERDOWN, do_wr_special, a, supervisor(dc), do_wrpowerdown) + +static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) +{ + /* + * TODO: Need a feature bit for sparcv8. + * In the meantime, treat all 32-bit cpus like sparcv7. + */ + if (avail_32(dc)) { + return advance_pc(dc); + } + return false; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4288,162 +4478,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif case 0x30: - { - cpu_tmp0 = tcg_temp_new(); - switch(rd) { - case 0: /* wry */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - tcg_gen_andi_tl(cpu_y, cpu_tmp0, 0xffffffff); - break; -#ifndef TARGET_SPARC64 - case 0x01 ... 0x0f: /* undefined in the - SPARCv8 manual, nop - on the microSPARC - II */ - case 0x10 ... 0x1f: /* implementation-dependent - in the SPARCv8 - manual, nop on the - microSPARC II */ - if ((rd == 0x13) && (dc->def->features & - CPU_FEATURE_POWERDOWN)) { - /* LEON3 power-down */ - save_state(dc); - gen_helper_power_down(tcg_env); - } - break; -#else - case 0x2: /* V9 wrccr */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_wrccr(tcg_env, cpu_tmp0); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); - dc->cc_op = CC_OP_FLAGS; - break; - case 0x3: /* V9 wrasi */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0xff); - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, asi)); - /* - * End TB to notice changed ASI. - * TODO: Could notice src1 = %g0 and IS_IMM, - * update DisasContext and not exit the TB. - */ - save_state(dc); - gen_op_next_insn(); - tcg_gen_lookup_and_goto_ptr(); - dc->base.is_jmp = DISAS_NORETURN; - break; - case 0x6: /* V9 wrfprs */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - tcg_gen_trunc_tl_i32(cpu_fprs, cpu_tmp0); - dc->fprs_dirty = 0; - save_state(dc); - gen_op_next_insn(); - tcg_gen_exit_tb(NULL, 0); - dc->base.is_jmp = DISAS_NORETURN; - break; - case 0xf: /* V9 sir, nop if user */ -#if !defined(CONFIG_USER_ONLY) - if (supervisor(dc)) { - ; // XXX - } -#endif - break; - case 0x13: /* Graphics Status */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - tcg_gen_xor_tl(cpu_gsr, cpu_src1, cpu_src2); - break; - case 0x14: /* Softint set */ - if (!supervisor(dc)) - goto illegal_insn; - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_set_softint(tcg_env, cpu_tmp0); - break; - case 0x15: /* Softint clear */ - if (!supervisor(dc)) - goto illegal_insn; - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_clear_softint(tcg_env, cpu_tmp0); - break; - case 0x16: /* Softint write */ - if (!supervisor(dc)) - goto illegal_insn; - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_write_softint(tcg_env, cpu_tmp0); - break; - case 0x17: /* Tick compare */ -#if !defined(CONFIG_USER_ONLY) - if (!supervisor(dc)) - goto illegal_insn; -#endif - { - TCGv_ptr r_tickptr; - - tcg_gen_xor_tl(cpu_tick_cmpr, cpu_src1, - cpu_src2); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, - cpu_tick_cmpr); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 0x18: /* System tick */ -#if !defined(CONFIG_USER_ONLY) - if (!supervisor(dc)) - goto illegal_insn; -#endif - { - TCGv_ptr r_tickptr; - - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, - cpu_src2); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, stick)); - translator_io_start(&dc->base); - gen_helper_tick_set_count(r_tickptr, - cpu_tmp0); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 0x19: /* System tick compare */ -#if !defined(CONFIG_USER_ONLY) - if (!supervisor(dc)) - goto illegal_insn; -#endif - { - TCGv_ptr r_tickptr; - - tcg_gen_xor_tl(cpu_stick_cmpr, cpu_src1, - cpu_src2); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, stick)); - translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, - cpu_stick_cmpr); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - - case 0x10: /* Performance Control */ - case 0x11: /* Performance Instrumentation - Counter */ - case 0x12: /* Dispatch Control */ -#endif - default: - goto illegal_insn; - } - } - break; + goto illegal_insn; /* WRASR in decodetree */ #if !defined(CONFIG_USER_ONLY) case 0x31: /* wrpsr, V9 saved, restored */ { From patchwork Tue Oct 17 06:11:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734264 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322467wro; Mon, 16 Oct 2023 23:14:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWQOyAVWSAMh02FDAoiwfPErTLvnTxgcFlA//Wo/qT8c5RGdw2AIyT3Ckzedsym6qLUUpF X-Received: by 2002:a05:620a:2452:b0:76e:f496:1930 with SMTP id h18-20020a05620a245200b0076ef4961930mr1527292qkn.43.1697523291488; Mon, 16 Oct 2023 23:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523291; cv=none; d=google.com; s=arc-20160816; b=pCy7edBQs+7JYsy9Lw9/Fr3zDKhgOgS5xHwxC4WGj1PpPof4yzF1VVqnBl7l12PB2S cytYx2c+eb7aSrnSwQ3zhqN2RkasHwVa4l2dfeSBZoesaJQdYc1D6LzxEk7bQt+/hNu9 6LCmb2/exkxTm6e7S6kxQaOU0dAZHZGA0S4FneTZ8NNd+LSkxLbkZl+D71qCfiPwHebK ak22dWOiJxIH5CHylu7kqlYNNrC2Kc0GsGiYRO5rRqk2S+VjcH15cUFuG5btVEjWtPoD ZuUc1+EZO1N0H0SUnkv+T6JalEm9RcTvwXwVeceCoDtYLWam63lxb/dKzvYY5aUz9YTn 4Hyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=oQP6a6MxMoaNROE6UWCMRh+qyHbWDId1yiJtSMIXUyE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=VRkpLsmbSIst8t5Ja4R4UfOIfDCwBeCwpEzxJ4eOqRJHNberfodZSDvmbsLmX4QXl6 JplPoXYb/WgCLl/YJrlVPRaPaCiYEGUPkX3LezClO9jldP5LTp6aAnKWUI7zaZgFRHtv hgGx9OOFIDAHfvlydXYMrxZWloO6OdaSt7zw4lTkUMQZreqzrCxNK2GhA5qIW160IXs4 qDCvaGHPOEgkcB6uR4FEUTtlb6tk9L8MY3vlFlb+qDbGTrRX4BbbMWYdvdF7NttH3W0z MA0/mkeI1kFEhAV+SjIX5FFlamg3l6uSoHPmqx3vnxXZDsEk9dT3TJoPmWnd8Q8w1yZz C8zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BLWVTNbv; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q8-20020a05620a024800b007788bb3ee9esi63276qkn.554.2023.10.16.23.14.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:51 -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=BLWVTNbv; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKM-0000e9-DT; Tue, 17 Oct 2023 02:13:14 -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 1qsdKK-0000aK-At for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:12 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKI-0003ug-CB for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:12 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1bdf4752c3cso31197325ad.2 for ; Mon, 16 Oct 2023 23:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523187; x=1698127987; 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=oQP6a6MxMoaNROE6UWCMRh+qyHbWDId1yiJtSMIXUyE=; b=BLWVTNbv3B7o/3PUIbpXDimLSYS5IayzhWr+IxESXaswlgCLYc1dIJgQstlJkNLNyq nW7cVnUEedss44W8+1btwD5SHG0iLACaPXdCD6nKYMO2LA5ic10PVurYy8foOZtlgocH gvaFlhO+54sUlrq5Wrfy/kCqnteziYOXVdFLB+SIII+XdElUwXWVj2A6KgQNpfvGIUPe 81sWbbv40mctpV+02dWbTxrarTnJpaPDaiCAOkEcqF8XcKRIMRgQB2s1khrPLRh/tPRc S8mIV5/aNxtegP8W5kX4cTjVY0WcTg2LL1mPDIvxwk8uPH75COV2Wjfjmw5n4xeUnHU/ MEdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523187; x=1698127987; 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=oQP6a6MxMoaNROE6UWCMRh+qyHbWDId1yiJtSMIXUyE=; b=o9Zjqz0j63j95a7gxyF54bqopqen9Sml5huJ7+NMr4JBDv0soIN5P0sfKpftRX5HSp utGZwU6YnASwWNt/Iy0ZPiP12uyGIL8tqW9Fb8B/et9+aGPVuaqUk1qZRVYH1pkv0FFv h7aToBl+9CTtcQEBifqkqILF3E/xgSs392h1u7PHBka/e5rNDWP0fSX8xoRPhj1OStp8 rtPmoDck74fyaLLyvLwu0Ux0iD2mb+vFU3Mkf7YuxQJVK3Hnm2ttfrVHQd4RpZogcBSV dVJPtj1hapkTchbbSb6yrdohr0gDfV7hnyMnhU9P5LfRXlMFdsMGD0TVjF8aFpx+COIg FL2w== X-Gm-Message-State: AOJu0YzB23eM6JUyIz44PVQF0NDB4BexILPCW2R1ABuIrJzltLf3l6TX 6azNwA0LXzT0ef/KQQB+xzlIzFB4KnKVqWFgj9E= X-Received: by 2002:a17:902:f543:b0:1ca:9934:d014 with SMTP id h3-20020a170902f54300b001ca9934d014mr557655plf.10.1697523187680; Mon, 16 Oct 2023 23:13:07 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 26/90] target/sparc: Move WRPSR, SAVED, RESTORED to decodetree Date: Mon, 16 Oct 2023 23:11:40 -0700 Message-Id: <20231017061244.681584-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 10 +++++++ target/sparc/translate.c | 61 ++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 6acf0f9403..850b5d58d0 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -85,6 +85,16 @@ RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 +{ + WRPSR 10 00000 110001 ..... . ............. @n_r_ri + SAVED 10 00000 110001 00000 0 0000000000000 +} +RESTORED 10 00001 110001 00000 0 0000000000000 +# UA2005 ALLCLEAN +# UA2005 OTHERW +# UA2005 NORMALW +# UA2005 INVALW + { RDWIM 10 rd:5 101010 00000 0 0000000000000 RDPR_tpc 10 rd:5 101010 00000 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 59931c053f..a5058b5931 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -38,6 +38,7 @@ #ifdef TARGET_SPARC64 #define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#define gen_helper_wrpsr(E, S) qemu_build_not_reached() #define gen_helper_power_down(E) g_assert_not_reached() #else #define gen_helper_rdccr(D, E) qemu_build_not_reached() @@ -46,6 +47,8 @@ #define gen_helper_set_softint(E, S) qemu_build_not_reached() #define gen_helper_clear_softint(E, S) qemu_build_not_reached() #define gen_helper_write_softint(E, S) qemu_build_not_reached() +#define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #endif /* Dynamic PC, must exit to main loop. */ @@ -3806,6 +3809,31 @@ static void do_wrpowerdown(DisasContext *dc, TCGv src) TRANS(WRPOWERDOWN, POWERDOWN, do_wr_special, a, supervisor(dc), do_wrpowerdown) +static void do_wrpsr(DisasContext *dc, TCGv src) +{ + gen_helper_wrpsr(tcg_env, src); + tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); + dc->cc_op = CC_OP_FLAGS; + save_state(dc); + gen_op_next_insn(); + tcg_gen_exit_tb(NULL, 0); + dc->base.is_jmp = DISAS_NORETURN; +} + +TRANS(WRPSR, 32, do_wr_special, a, supervisor(dc), do_wrpsr) + +static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) +{ + if (!supervisor(dc)) { + return raise_priv(dc); + } + func(tcg_env); + return advance_pc(dc); +} + +TRANS(SAVED, 64, do_saved_restored, gen_helper_saved) +TRANS(RESTORED, 64, do_saved_restored, gen_helper_restored) + static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) { /* @@ -4480,39 +4508,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x30: goto illegal_insn; /* WRASR in decodetree */ #if !defined(CONFIG_USER_ONLY) - case 0x31: /* wrpsr, V9 saved, restored */ - { - if (!supervisor(dc)) - goto priv_insn; -#ifdef TARGET_SPARC64 - switch (rd) { - case 0: - gen_helper_saved(tcg_env); - break; - case 1: - gen_helper_restored(tcg_env); - break; - case 2: /* UA2005 allclean */ - case 3: /* UA2005 otherw */ - case 4: /* UA2005 normalw */ - case 5: /* UA2005 invalw */ - // XXX - default: - goto illegal_insn; - } -#else - cpu_tmp0 = tcg_temp_new(); - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_wrpsr(tcg_env, cpu_tmp0); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); - dc->cc_op = CC_OP_FLAGS; - save_state(dc); - gen_op_next_insn(); - tcg_gen_exit_tb(NULL, 0); - dc->base.is_jmp = DISAS_NORETURN; -#endif - } - break; case 0x32: /* wrwim, V9 wrpr */ { if (!supervisor(dc)) From patchwork Tue Oct 17 06:11:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734277 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323532wro; Mon, 16 Oct 2023 23:18:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgYch3G2opEwlPF7puiBAab1OTi0XdEW3UzcI9pYqWA65upclFBHbzdYYkBMlfiKoN1xoD X-Received: by 2002:a05:620a:5203:b0:777:715a:e9c6 with SMTP id dc3-20020a05620a520300b00777715ae9c6mr1248373qkb.22.1697523506121; Mon, 16 Oct 2023 23:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523506; cv=none; d=google.com; s=arc-20160816; b=s7n/ZVSdqyugZ5cQl2E3cnP8Hzd+9b9Pyk0bRbCzq8/nqMj1p68If3QPr6o5Q8K/O5 6kHpf/mstD4JZKmj7zd5Lsylx0DA8UxWok5z4xPu9BnMovFsZLC7vkHPtTJBpMsAPt5n 8YUgmgz2lVegvqyHwQ3wo1AkG23gKSCiXF3pm7mML6Vklph+mrq5HSASmmdSJcVaqXRK IcaTr1ClrAcY19El2R7Yi6035fb0+3Z5bH0rKXBsqPGXhi4aAMBcv6CIksVVW6/odRsj DKHWr3PjIKlxyGKMnZx/mgUqwFRZTkSZP4MzZdjvu5qBY7qTMPexWzGYKnJCs8qPlKYy Q+6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=B0oexih9JF9KJvNRfgtVbIFxrwccwBAAHIEbQwnrscQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=uNFyNRPqCfm6LBIpwLDMl4rvWyQ/KlLiFTES5xETilpOI5vxDoOkovePCgFccq1t8g YbvgvAXwJpEZDcgAUljMMcffudb0pNV/thLhfgn+ayI+MqYs+79AuGFz3oK48edd0fIu Zghbx1xHrfP/Su+8IyXbZHpcfwEOMeBkb1LWJfyB2Q5cdT2g3c/C/BKvkaPsLSx35Xkr D1Y1NbQnOi5jJZNTIUbgAzTUWzBGPDdtZN91d14bQ+lO/trxX9VKwrNh02tCb+9YSPwj +Ko31H5n7Ot0mio4xTBZp4MvGe5SkTSaa9+icGNJhfvFcImTX1tqknpx9g8En2K+/Zph 0DHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ArZG68OP; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b12-20020ac85bcc000000b004196d75a4e6si676292qtb.296.2023.10.16.23.18.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:26 -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=ArZG68OP; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKO-0000h2-Mn; Tue, 17 Oct 2023 02:13:16 -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 1qsdKL-0000dv-TU for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:14 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKI-0003uz-Dt for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:13 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5a1d89ff4b9so2949942a12.0 for ; Mon, 16 Oct 2023 23:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523189; x=1698127989; 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=B0oexih9JF9KJvNRfgtVbIFxrwccwBAAHIEbQwnrscQ=; b=ArZG68OPBMVC/SZALRwYW2u3FUqPp3O2fG1hdcJGgcibbvhEee+xHiF7rwB+R2itrG usIJa5TKLJvquGK3tJMC6DLlRMmH/1CxOsNCLiixiOKxM+wvNP1uToilvR473hO1skyU 67p0nh5HR/fj1YUDDqzW3f/aWtw24kMRyyoqG8V1l4bwh9ow3QBQ3HCh2ZmXogTH9WTs pLoPlNJBf/PZYgT0xf6YuduAGCUyECIjBTEgOayt3HteYUfBvcNrCLDmZMh1hpXPmyL+ 1fe5UJ6GhF2yBGi2OfGnF5rVVvv3uPoCT2sagRyjNxOkF4+r0zyH+P7AJ10mFuRg/F8g Tk/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523189; x=1698127989; 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=B0oexih9JF9KJvNRfgtVbIFxrwccwBAAHIEbQwnrscQ=; b=wpKsChpr2C/kOdydUpv1McqV10YPzNixQX4y1RP/uRnbVJ1dUf3MxkKJfHWVuuHrwM j976KjcyjPOb/FNnYG/MIYm2ztw5WNElDOGqE5u1S4rVOYRr7rmEoDb+884nf+DTt/iw z8mpleymotpVdvbsZB/MVLygJTa+nHPjrQW38W0PPl51QmiqFM/8P5q/jSH6kILjuTK7 Zrff1doO3emUWg/cJq6yK3VK5a3FQU7G1PBhpeKYpdwla5gP4+BdnTnEHINhCXk2Tr6g 7iFgJjrQdBMn8qSaV/gvaouOk8y6ig1OTQaqtXeZJ6qtQSPRV1igqnZBpo3JNqeOZUTd e9ww== X-Gm-Message-State: AOJu0YxAHaeE55v9BwcBAkPUGJZiCrJXLDjVX36RgRPvAx0KKRz1JCNw 60hybT9q2KnsNUBPAntZXmA1J1tVyrBvgOi+S7w= X-Received: by 2002:a05:6a20:748d:b0:13f:1622:29de with SMTP id p13-20020a056a20748d00b0013f162229demr1243607pzd.7.1697523188732; Mon, 16 Oct 2023 23:13:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 27/90] target/sparc: Move WRWIM, WRPR to decodetree Date: Mon, 16 Oct 2023 23:11:41 -0700 Message-Id: <20231017061244.681584-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 21 +++ target/sparc/translate.c | 350 +++++++++++++++++++++++--------------- 2 files changed, 235 insertions(+), 136 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 850b5d58d0..56c04f01a5 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -117,6 +117,27 @@ RDPR_gl 10 rd:5 101010 10000 0 0000000000000 RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 RDPR_ver 10 rd:5 101010 11111 0 0000000000000 +{ + WRWIM 10 00000 110010 ..... . ............. @n_r_ri + WRPR_tpc 10 00000 110010 ..... . ............. @n_r_ri +} +WRPR_tnpc 10 00001 110010 ..... . ............. @n_r_ri +WRPR_tstate 10 00010 110010 ..... . ............. @n_r_ri +WRPR_tt 10 00011 110010 ..... . ............. @n_r_ri +WRPR_tick 10 00100 110010 ..... . ............. @n_r_ri +WRPR_tba 10 00101 110010 ..... . ............. @n_r_ri +WRPR_pstate 10 00110 110010 ..... . ............. @n_r_ri +WRPR_tl 10 00111 110010 ..... . ............. @n_r_ri +WRPR_pil 10 01000 110010 ..... . ............. @n_r_ri +WRPR_cwp 10 01001 110010 ..... . ............. @n_r_ri +WRPR_cansave 10 01010 110010 ..... . ............. @n_r_ri +WRPR_canrestore 10 01011 110010 ..... . ............. @n_r_ri +WRPR_cleanwin 10 01100 110010 ..... . ............. @n_r_ri +WRPR_otherwin 10 01101 110010 ..... . ............. @n_r_ri +WRPR_wstate 10 01110 110010 ..... . ............. @n_r_ri +WRPR_gl 10 10000 110010 ..... . ............. @n_r_ri +WRPR_strand_status 10 11010 110010 ..... . ............. @n_r_ri + { FLUSHW 10 00000 101011 00000 0 0000000000000 RDTBR 10 rd:5 101011 00000 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a5058b5931..6b8dfa7830 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -44,6 +44,10 @@ #define gen_helper_rdccr(D, E) qemu_build_not_reached() #define gen_helper_rdcwp(D, E) qemu_build_not_reached() #define gen_helper_wrccr(E, S) qemu_build_not_reached() +#define gen_helper_wrcwp(E, S) qemu_build_not_reached() +#define gen_helper_wrgl(E, S) g_assert_not_reached() +#define gen_helper_wrpil(E, S) qemu_build_not_reached() +#define gen_helper_wrpstate(E, S) qemu_build_not_reached() #define gen_helper_set_softint(E, S) qemu_build_not_reached() #define gen_helper_clear_softint(E, S) qemu_build_not_reached() #define gen_helper_write_softint(E, S) qemu_build_not_reached() @@ -3822,6 +3826,214 @@ static void do_wrpsr(DisasContext *dc, TCGv src) TRANS(WRPSR, 32, do_wr_special, a, supervisor(dc), do_wrpsr) +static void do_wrwim(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + qemu_build_not_reached(); +#else + target_ulong mask = MAKE_64BIT_MASK(0, dc->def->nwindows); + tcg_gen_andi_tl(cpu_wim, src, mask); +#endif +} + +TRANS(WRWIM, 32, do_wr_special, a, supervisor(dc), do_wrwim) + +static void do_wrtpc(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st_tl(src, r_tsptr, offsetof(trap_state, tpc)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tpc, 64, do_wr_special, a, supervisor(dc), do_wrtpc) + +static void do_wrtnpc(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st_tl(src, r_tsptr, offsetof(trap_state, tnpc)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tnpc, 64, do_wr_special, a, supervisor(dc), do_wrtnpc) + +static void do_wrtstate(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st_tl(src, r_tsptr, offsetof(trap_state, tstate)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tstate, 64, do_wr_special, a, supervisor(dc), do_wrtstate) + +static void do_wrtt(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st32_tl(src, r_tsptr, offsetof(trap_state, tt)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tt, 64, do_wr_special, a, supervisor(dc), do_wrtt) + +static void do_wrtick(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, tick)); + translator_io_start(&dc->base); + gen_helper_tick_set_count(r_tickptr, src); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tick, 64, do_wr_special, a, supervisor(dc), do_wrtick) + +static void do_wrtba(DisasContext *dc, TCGv src) +{ + tcg_gen_mov_tl(cpu_tbr, src); +} + +TRANS(WRPR_tba, 64, do_wr_special, a, supervisor(dc), do_wrtba) + +static void do_wrpstate(DisasContext *dc, TCGv src) +{ + save_state(dc); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_wrpstate(tcg_env, src); + dc->npc = DYNAMIC_PC; +} + +TRANS(WRPR_pstate, 64, do_wr_special, a, supervisor(dc), do_wrpstate) + +static void do_wrtl(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + save_state(dc); + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, tl)); + dc->npc = DYNAMIC_PC; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tl, 64, do_wr_special, a, supervisor(dc), do_wrtl) + +static void do_wrpil(DisasContext *dc, TCGv src) +{ + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_wrpil(tcg_env, src); +} + +TRANS(WRPR_pil, 64, do_wr_special, a, supervisor(dc), do_wrpil) + +static void do_wrcwp(DisasContext *dc, TCGv src) +{ + gen_helper_wrcwp(tcg_env, src); +} + +TRANS(WRPR_cwp, 64, do_wr_special, a, supervisor(dc), do_wrcwp) + +static void do_wrcansave(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, cansave)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_cansave, 64, do_wr_special, a, supervisor(dc), do_wrcansave) + +static void do_wrcanrestore(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, canrestore)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_canrestore, 64, do_wr_special, a, supervisor(dc), do_wrcanrestore) + +static void do_wrcleanwin(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, cleanwin)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_cleanwin, 64, do_wr_special, a, supervisor(dc), do_wrcleanwin) + +static void do_wrotherwin(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, otherwin)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_otherwin, 64, do_wr_special, a, supervisor(dc), do_wrotherwin) + +static void do_wrwstate(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, wstate)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_wstate, 64, do_wr_special, a, supervisor(dc), do_wrwstate) + +static void do_wrgl(DisasContext *dc, TCGv src) +{ + gen_helper_wrgl(tcg_env, src); +} + +TRANS(WRPR_gl, GL, do_wr_special, a, supervisor(dc), do_wrgl) + +/* UA2005 strand status */ +static void do_wrssr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_mov_tl(cpu_ssr, src); +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRPR_strand_status, HYPV, do_wr_special, a, hypervisor(dc), do_wrssr) + static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) { if (!supervisor(dc)) { @@ -4508,142 +4720,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x30: goto illegal_insn; /* WRASR in decodetree */ #if !defined(CONFIG_USER_ONLY) - case 0x32: /* wrwim, V9 wrpr */ - { - if (!supervisor(dc)) - goto priv_insn; - cpu_tmp0 = tcg_temp_new(); - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); -#ifdef TARGET_SPARC64 - switch (rd) { - case 0: // tpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tpc)); - } - break; - case 1: // tnpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tnpc)); - } - break; - case 2: // tstate - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, - tstate)); - } - break; - case 3: // tt - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st32_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tt)); - } - break; - case 4: // tick - { - TCGv_ptr r_tickptr; - - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - translator_io_start(&dc->base); - gen_helper_tick_set_count(r_tickptr, - cpu_tmp0); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 5: // tba - tcg_gen_mov_tl(cpu_tbr, cpu_tmp0); - break; - case 6: // pstate - save_state(dc); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_wrpstate(tcg_env, cpu_tmp0); - dc->npc = DYNAMIC_PC; - break; - case 7: // tl - save_state(dc); - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, tl)); - dc->npc = DYNAMIC_PC; - break; - case 8: // pil - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_wrpil(tcg_env, cpu_tmp0); - break; - case 9: // cwp - gen_helper_wrcwp(tcg_env, cpu_tmp0); - break; - case 10: // cansave - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - cansave)); - break; - case 11: // canrestore - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - canrestore)); - break; - case 12: // cleanwin - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - cleanwin)); - break; - case 13: // otherwin - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - otherwin)); - break; - case 14: // wstate - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - wstate)); - break; - case 16: // UA2005 gl - CHECK_IU_FEATURE(dc, GL); - gen_helper_wrgl(tcg_env, cpu_tmp0); - break; - case 26: // UA2005 strand status - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - tcg_gen_mov_tl(cpu_ssr, cpu_tmp0); - break; - default: - goto illegal_insn; - } -#else - tcg_gen_trunc_tl_i32(cpu_wim, cpu_tmp0); - if (dc->def->nwindows != 32) { - tcg_gen_andi_tl(cpu_wim, cpu_wim, - (1 << dc->def->nwindows) - 1); - } -#endif - } - break; + case 0x32: + goto illegal_insn; /* WRPR in decodetree */ case 0x33: /* wrtbr, UA2005 wrhpr */ { #ifndef TARGET_SPARC64 From patchwork Tue Oct 17 06:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734272 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323428wro; Mon, 16 Oct 2023 23:18:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExJqHuoWDKKL1BV2/I3ErbSANnOpazjEuAEiLzviVRH7TjDZV9bbAcfuy7S11Ty0H+VLG3 X-Received: by 2002:a05:622a:1a9e:b0:418:116b:4c63 with SMTP id s30-20020a05622a1a9e00b00418116b4c63mr1755053qtc.44.1697523484815; Mon, 16 Oct 2023 23:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523484; cv=none; d=google.com; s=arc-20160816; b=VSCTqusGGIFxOcmDx3edyMEiFFtgnGm/hg9jOAV4Bje5jqK6NOFFvpTgG/A8ue0kdo ly7J2Me0biQhS5Grnc6JfBiP1TFy6NRrvOEZHLt50oHI3BvjgTPmMKeYW1ZqAOEbYuVh fvLiv+lzamFSg5fP6Hh2DPepyU364w2w1LimkzJYf7EJ1MmNQHEEPU5AEFLwqnBVI64z W70SF6wgxuNhM3m2FKOZSf9kwm2HrYTqxyT2tmWrAd9y604xLO3NY+M877t8HViRucke 0rIRdzROzgMiSrLemqK29Uvww9n9elJLPdgq7bVCPwXHJNFQavilc8N1VVg0D2U4XIH/ bzUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=b5xRIoXwj5L41AAGrxfgbJ5f8TaaBeUG0cYd5payo2w=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=m1UXa7IBM3WHydyGYrqamCGe874Uk6NkxN3zuluZF1gH0myxixGXiHWURBy9oOsAPm mbuLvtWofmzoxDTPtDTud1A4Tw4lXlASOlsch7MQRr1JW9uJX1lm1JqdnKpn+Md2erlj 7EJapAzvZnC3BwcJ7YTmMlPnQ+zybR0xpcdmZGzRZlJygnjBdAu9uIafKfGlV7hepjyy t82QmP7MOxP7sqLurEwG+om5lqeHfUhvjKmN8LY8co9aYy11Aq3ilw3uqshOQ29y17Tj A492dLKTKsKHRmEPESETzBFGiUmx9nxDzWvtXGoFev6LWTBTGW62zfrjNAxrJG6/qoFd ACvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zUUi25c2; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o18-20020ac87c52000000b0041b6b847b6esi661845qtv.771.2023.10.16.23.18.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:04 -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=zUUi25c2; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKO-0000gy-MX; Tue, 17 Oct 2023 02:13:16 -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 1qsdKM-0000fX-J9 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:14 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKI-0003vm-SH for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:14 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c888b3a25aso32853095ad.0 for ; Mon, 16 Oct 2023 23:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523189; x=1698127989; 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=b5xRIoXwj5L41AAGrxfgbJ5f8TaaBeUG0cYd5payo2w=; b=zUUi25c2myZKhIuYkSbTXS/NHtG7sp9eZaLyfvpdPktQTCGOlQ+7fRmtHQa/RRdGi9 mvGinftE3O7xucZMpvEQExHve350sXMnQskSfMU3Cw9j6V/1wmP3ValPwtA33wXg45jW YcIzrWyNuWtF5pbZ6roxnZ6jz+DUMf5MxxrvxPG1fdb2MYZy0vo6tzQYTPEIXsKrHrxJ EW0meWlnLbVfIJNow4TX7+eis115GG9tQ4KoVGVpd4anBF86vBewm1nm8fSRiUeEcvHk dQP2/2VRecDLDykaEOBl6spJwMWDD8sQpuuNieoHsECHD2KwZveAhNWV87Q+W+RdV0Q6 9lVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523189; x=1698127989; 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=b5xRIoXwj5L41AAGrxfgbJ5f8TaaBeUG0cYd5payo2w=; b=rHiJT2CtwAm6RiEDBpFPXJIwXJiLztmm8brjzRiTfI2reqSgvCz+p8pWZZEB18nEvB F8om6QSG5c44vqCsNiTQgF4Vs4uGsOT2SIvlt74ivx9dj4pho+17ReXJtdHrsostDSVG h0JzZMdAj4sdbt3iMrdG7WYUUiz1Tnmee8HdHgUtkAHVG1EiHhcThHOLmtwkUUacn6kz 7gkY5DZdrPzo0FIs3viwEv/Auv3AjdHhvuTdwAbzG4JC3VoBYWl0G5AzUNaOOKkJUiMW sroXUrvrFdoj+Ig+QVOoztGkHucwTMmNxieGCy77soAxRgkiaUveDWm8r2ovtw9swACf PMdA== X-Gm-Message-State: AOJu0YyGYqFvE42VNBOls6zW3mYTdTFCtHTUsliHm3bu8hppxW0U5Cxo iztW6j1VZmuxl17VReKEgXtoAEkpZOZT9Ywkvwo= X-Received: by 2002:a17:902:c407:b0:1bc:6861:d746 with SMTP id k7-20020a170902c40700b001bc6861d746mr1594158plk.58.1697523189550; Mon, 16 Oct 2023 23:13:09 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 28/90] target/sparc: Move WRTBR, WRHPR to decodetree Date: Mon, 16 Oct 2023 23:11:42 -0700 Message-Id: <20231017061244.681584-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 9 ++++ target/sparc/translate.c | 110 +++++++++++++++++++------------------- 2 files changed, 65 insertions(+), 54 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 56c04f01a5..49270705c7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -143,4 +143,13 @@ WRPR_strand_status 10 11010 110010 ..... . ............. @n_r_ri RDTBR 10 rd:5 101011 00000 0 0000000000000 } +{ + WRTBR 10 00000 110011 ..... . ............. @n_r_ri + WRHPR_hpstate 10 00000 110011 ..... . ............. @n_r_ri +} +# WRHPR_htstate +WRHPR_hintp 10 00011 110011 ..... . ............. @n_r_ri +WRHPR_htba 10 00101 110011 ..... . ............. @n_r_ri +WRHPR_hstick_cmpr 10 11111 110011 ..... . ............. @n_r_ri + Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6b8dfa7830..428fbb49bd 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4034,6 +4034,61 @@ static void do_wrssr(DisasContext *dc, TCGv src) TRANS(WRPR_strand_status, HYPV, do_wr_special, a, hypervisor(dc), do_wrssr) +TRANS(WRTBR, 32, do_wr_special, a, supervisor(dc), do_wrtba) + +static void do_wrhpstate(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st_i64(src, tcg_env, offsetof(CPUSPARCState, hpstate)); + dc->base.is_jmp = DISAS_EXIT; +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_hpstate, HYPV, do_wr_special, a, hypervisor(dc), do_wrhpstate) + +static void do_wrhintp(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_mov_tl(cpu_hintp, src); +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_hintp, HYPV, do_wr_special, a, hypervisor(dc), do_wrhintp) + +static void do_wrhtba(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_mov_tl(cpu_htba, src); +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_htba, HYPV, do_wr_special, a, hypervisor(dc), do_wrhtba) + +static void do_wrhstick_cmpr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_mov_tl(cpu_hstick_cmpr, src); + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, hstick)); + translator_io_start(&dc->base); + gen_helper_tick_set_limit(r_tickptr, cpu_hstick_cmpr); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_hstick_cmpr, HYPV, do_wr_special, a, hypervisor(dc), + do_wrhstick_cmpr) + static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) { if (!supervisor(dc)) { @@ -4719,63 +4774,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif case 0x30: goto illegal_insn; /* WRASR in decodetree */ -#if !defined(CONFIG_USER_ONLY) case 0x32: goto illegal_insn; /* WRPR in decodetree */ case 0x33: /* wrtbr, UA2005 wrhpr */ - { -#ifndef TARGET_SPARC64 - if (!supervisor(dc)) - goto priv_insn; - tcg_gen_xor_tl(cpu_tbr, cpu_src1, cpu_src2); -#else - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - cpu_tmp0 = tcg_temp_new(); - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - switch (rd) { - case 0: // hpstate - tcg_gen_st_i64(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - hpstate)); - save_state(dc); - gen_op_next_insn(); - tcg_gen_exit_tb(NULL, 0); - dc->base.is_jmp = DISAS_NORETURN; - break; - case 1: // htstate - // XXX gen_op_wrhtstate(); - break; - case 3: // hintp - tcg_gen_mov_tl(cpu_hintp, cpu_tmp0); - break; - case 5: // htba - tcg_gen_mov_tl(cpu_htba, cpu_tmp0); - break; - case 31: // hstick_cmpr - { - TCGv_ptr r_tickptr; - - tcg_gen_mov_tl(cpu_hstick_cmpr, cpu_tmp0); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, hstick)); - translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, - cpu_hstick_cmpr); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 6: // hver readonly - default: - goto illegal_insn; - } -#endif - } - break; -#endif + goto illegal_insn; /* WRTBR, WRHPR in decodetree */ #ifdef TARGET_SPARC64 case 0x2c: /* V9 movcc */ { From patchwork Tue Oct 17 06:11:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734337 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326694wro; Mon, 16 Oct 2023 23:28:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGK+Rqw7SVp0jo1sVpHuJWE1gHhWU/EiERFxABAKtfgWvwPKtOAQicszK0LqXHW1vPyvUJx X-Received: by 2002:a05:6214:f0c:b0:655:d6af:1c32 with SMTP id gw12-20020a0562140f0c00b00655d6af1c32mr1928678qvb.15.1697524139734; Mon, 16 Oct 2023 23:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524139; cv=none; d=google.com; s=arc-20160816; b=cS09pYSt3HRa/QO4cysknYFP2CbZBhbJHk3XgW56BIUAaL5pJXHyxueDj/PO1wkob0 XyWUxJODASXjnt0VLSRfbztIeLllDzhYf0jdTU+vnvULcavyhkkdwJ98FbogqrQbN7s0 Jt1MkPc1Fv2jtU9fnFFS6kRhXMJxanzS2F1W0AL1JEbCQwt6mR5C2jz9fQSoul9efiMi 0Sxh8F8jKItyY6m8SimL6RZQTnRkXtUTbDgnounh6sNax8c5oreKueRFMkaHbeVezC9m +R74NOMcQItaBJrfL+pUIXYyuyLIM5k/2QuQcF0+6BJmUJJL2YURUOJkg98OmJapcYGw 2jkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=h56o6ZbhIH4yDT9EeLuzopOeYzQ+sNlxchAEBI79PHs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ZJc1tJgPo3FpwkLHCXoNymaRtpeIhxPEL16QmYkdYzdF2LG6PyoYPNncz1RzBzq8g6 ZC4vplBW69HgDG+4PjYqOMkiacBTccSoStUy+DMhjaE+KntSJpLToqhUOIAFAAulyXBV TWwHy9+njteUhxbt8NQQ9sxDRFfxR+1vjNf9fRNL7nNEY5mNYUCivMYQhGgWVwtkHonN srgMpRDQFPCwPuAPpmdVAu5H+K6Qxm6f0xcNF+6iUYQyCZd41Aor+DId7Ed+kVo+j/MW lIoJ1faPqVG7gaAMsoU1jw7K8sHZRaTv1lfPblAUGriZK8sH1FrcqqJriVER2nvcZonc dkAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KnRuTqw3; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y17-20020a05620a44d100b007758e5dba52si620459qkp.307.2023.10.16.23.28.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:59 -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=KnRuTqw3; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKQ-0000ji-4L; Tue, 17 Oct 2023 02:13:18 -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 1qsdKM-0000eX-2V for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:14 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKJ-0003w6-St for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:13 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c9b1e3a809so33953895ad.2 for ; Mon, 16 Oct 2023 23:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523190; x=1698127990; 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=h56o6ZbhIH4yDT9EeLuzopOeYzQ+sNlxchAEBI79PHs=; b=KnRuTqw3BUH/p/BF8X4F6EdJ1oUQ3vno1yBLVQn97TabVIO9GXSVsQ9bkldg7TkNV3 Zg5QU5wn5MYL92BPKHT2Mee/eAZzNheY6o+EXgyVkXu++YknPOQOUUCPpxpI0VYWPJqu LQg/U1xhLVtkLdXSa9etp28vltdbffoUWpueOLVQotcx8x46oBl48CNuLp1/M8mAPPHZ k1AaNd2WRpNw0zf1DB/XVItlcQILghNuE0m8BkjNjMUUrEifUo23Pn+KbDOT+yCblLnT p+vLVk66cfPUvtNZwJFzZa3JI+SMJybjmwnxqbcG2Z5qrwhSVrf29vEUzM0lQmh6ua0O ITEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523190; x=1698127990; 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=h56o6ZbhIH4yDT9EeLuzopOeYzQ+sNlxchAEBI79PHs=; b=MoMKsw/32TcEHV7X/gqdIKNRyngEbpBH/Kl5qz6VgT0HZJq2pwS83UXsi00q9iGMS9 Cz/prW+kc8vJpgQCvnkgX0zbGjgjFco1EJtzjAAoSMrFwBbk9lWkdy+bBJRs7glZKXW1 5i3mdED7z4RyH1clcOvfoHnpC0ZGhE3Fdns+R/qrEOtzSIy7Rgll0RDocOQbxkW7/DBk XjHGxUttXvejHEk8NJgSi+KDy8jv72i+iFPAahdrV6Hn89G78SsGGW5u8PbM64NBrdN9 6z6YjA2PkZUXesREXMzBtBV1zrzsGLrMwomowENJezzwxenQWD+OksCW0KN/J2mmQ64Q 4rlA== X-Gm-Message-State: AOJu0YyIZ3IFAsNAumQRGUmTs2VJqF1yoEe4wgwHMyLo18S0kgbWwacc RZDIX+H1R8McaAebU4kKWbfjSQ0VTgdLp2lz2EA= X-Received: by 2002:a17:902:c40e:b0:1b8:b382:f6c3 with SMTP id k14-20020a170902c40e00b001b8b382f6c3mr1733190plk.13.1697523190408; Mon, 16 Oct 2023 23:13:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 29/90] target/sparc: Move basic arithmetic to decodetree Date: Mon, 16 Oct 2023 23:11:43 -0700 Message-Id: <20231017061244.681584-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 Move ADD, AND, OR, XOR, SUB, ANDN, ORN, XORN. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 20 ++++- target/sparc/translate.c | 183 +++++++++++++++++--------------------- 2 files changed, 99 insertions(+), 104 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 49270705c7..4005ce3df7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -28,6 +28,7 @@ CALL 01 i:s30 &r_r_ri rd rs1 rs2_or_imm imm:bool @n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 +@r_r_ri .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri { [ @@ -152,4 +153,21 @@ WRHPR_hintp 10 00011 110011 ..... . ............. @n_r_ri WRHPR_htba 10 00101 110011 ..... . ............. @n_r_ri WRHPR_hstick_cmpr 10 11111 110011 ..... . ............. @n_r_ri -Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 +ADD 10 ..... 000000 ..... . ............. @r_r_ri +ADDcc 10 ..... 010000 ..... . ............. @r_r_ri +AND 10 ..... 000001 ..... . ............. @r_r_ri +ANDcc 10 ..... 010001 ..... . ............. @r_r_ri +OR 10 ..... 000010 ..... . ............. @r_r_ri +ORcc 10 ..... 010010 ..... . ............. @r_r_ri +XOR 10 ..... 000011 ..... . ............. @r_r_ri +XORcc 10 ..... 010011 ..... . ............. @r_r_ri +SUB 10 ..... 000100 ..... . ............. @r_r_ri +SUBcc 10 ..... 010100 ..... . ............. @r_r_ri +ANDN 10 ..... 000101 ..... . ............. @r_r_ri +ANDNcc 10 ..... 010101 ..... . ............. @r_r_ri +ORN 10 ..... 000110 ..... . ............. @r_r_ri +ORNcc 10 ..... 010110 ..... . ............. @r_r_ri +XORN 10 ..... 000111 ..... . ............. @r_r_ri +XORNcc 10 ..... 010111 ..... . ............. @r_r_ri + +Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 428fbb49bd..368bafc99a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4113,6 +4113,86 @@ static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) return false; } +static bool do_cc_arith(DisasContext *dc, arg_r_r_ri *a, int cc_op, + void (*func)(TCGv, TCGv, TCGv), + void (*funci)(TCGv, TCGv, target_long)) +{ + TCGv dst, src1; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!a->imm && a->rs2_or_imm & ~0x1f) { + return false; + } + + if (cc_op < 0) { + dst = gen_dest_gpr(dc, a->rd); + } else { + dst = cpu_cc_dst; + tcg_gen_movi_i32(cpu_cc_op, cc_op); + dc->cc_op = cc_op; + } + src1 = gen_load_gpr(dc, a->rs1); + + if (a->imm || a->rs2_or_imm == 0) { + if (funci) { + funci(dst, src1, a->rs2_or_imm); + } else { + func(dst, src1, tcg_constant_tl(a->rs2_or_imm)); + } + } else { + func(dst, src1, cpu_regs[a->rs2_or_imm]); + } + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +static bool do_arith(DisasContext *dc, arg_r_r_ri *a, + void (*func)(TCGv, TCGv, TCGv), + void (*funci)(TCGv, TCGv, target_long)) +{ + return do_cc_arith(dc, a, -1, func, funci); +} + +static bool trans_OR(DisasContext *dc, arg_r_r_ri *a) +{ + /* For simplicity, we under-decoded the rs2 form. */ + if (!a->imm && a->rs2_or_imm & ~0x1f) { + return false; + } + + /* OR with %g0 is the canonical alias for MOV. */ + if (a->rs1 == 0) { + TCGv src2; + + if (a->imm || a->rs2_or_imm == 0) { + src2 = tcg_constant_tl(a->rs2_or_imm); + } else { + src2 = cpu_regs[a->rs2_or_imm]; + } + gen_store_gpr(dc, a->rd, src2); + return advance_pc(dc); + } + + return do_arith(dc, a, tcg_gen_or_tl, tcg_gen_ori_tl); +} + +TRANS(ADD, ALL, do_arith, a, tcg_gen_add_tl, tcg_gen_addi_tl) +TRANS(AND, ALL, do_arith, a, tcg_gen_and_tl, tcg_gen_andi_tl) +TRANS(XOR, ALL, do_arith, a, tcg_gen_xor_tl, tcg_gen_xori_tl) +TRANS(SUB, ALL, do_arith, a, tcg_gen_sub_tl, tcg_gen_subi_tl) +TRANS(ANDN, ALL, do_arith, a, tcg_gen_andc_tl, NULL) +TRANS(ORN, ALL, do_arith, a, tcg_gen_orc_tl, NULL) +TRANS(XORN, ALL, do_arith, a, tcg_gen_eqv_tl, NULL) + +TRANS(ADDcc, ALL, do_cc_arith, a, CC_OP_ADD, gen_op_add_cc, NULL) +TRANS(ANDcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) +TRANS(ORcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_or_tl, tcg_gen_ori_tl) +TRANS(XORcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_xor_tl, tcg_gen_xori_tl) +TRANS(SUBcc, ALL, do_cc_arith, a, CC_OP_SUB, gen_op_sub_cc, NULL) +TRANS(ANDNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_andc_tl, NULL) +TRANS(ORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_orc_tl, NULL) +TRANS(XORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4461,43 +4541,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } - } else if (xop == 0x2) { - TCGv dst = gen_dest_gpr(dc, rd); - rs1 = GET_FIELD(insn, 13, 17); - if (rs1 == 0) { - /* clr/mov shortcut : or %g0, x, y -> mov x, y */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - tcg_gen_movi_tl(dst, simm); - gen_store_gpr(dc, rd, dst); - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2 == 0) { - tcg_gen_movi_tl(dst, 0); - gen_store_gpr(dc, rd, dst); - } else { - cpu_src2 = gen_load_gpr(dc, rs2); - gen_store_gpr(dc, rd, cpu_src2); - } - } - } else { - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - tcg_gen_ori_tl(dst, cpu_src1, simm); - gen_store_gpr(dc, rd, dst); - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2 == 0) { - /* mov shortcut: or x, %g0, y -> mov x, y */ - gen_store_gpr(dc, rd, cpu_src1); - } else { - cpu_src2 = gen_load_gpr(dc, rs2); - tcg_gen_or_tl(dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, dst); - } - } - } #ifdef TARGET_SPARC64 } else if (xop == 0x25) { /* sll, V9 sllx */ cpu_src1 = get_src1(dc, insn); @@ -4574,72 +4617,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0x0: /* add */ - if (xop & 0x10) { - gen_op_add_cc(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD); - dc->cc_op = CC_OP_ADD; - } else { - tcg_gen_add_tl(cpu_dst, cpu_src1, cpu_src2); - } - break; - case 0x1: /* and */ - tcg_gen_and_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x2: /* or */ - tcg_gen_or_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x3: /* xor */ - tcg_gen_xor_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x4: /* sub */ - if (xop & 0x10) { - gen_op_sub_cc(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB); - dc->cc_op = CC_OP_SUB; - } else { - tcg_gen_sub_tl(cpu_dst, cpu_src1, cpu_src2); - } - break; - case 0x5: /* andn */ - tcg_gen_andc_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x6: /* orn */ - tcg_gen_orc_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x7: /* xorn */ - tcg_gen_eqv_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; case 0x8: /* addx, V9 addc */ gen_op_addx_int(dc, cpu_dst, cpu_src1, cpu_src2, (xop & 0x10)); From patchwork Tue Oct 17 06:11:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734335 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326686wro; Mon, 16 Oct 2023 23:28:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG41ANT/ScSkZOnGWssYve888F5EFtnV772URr6Rvs4s6QTG/1PlsM+ckoE4kUYUqnBC2L6 X-Received: by 2002:ac8:7f02:0:b0:403:ac95:c6a9 with SMTP id f2-20020ac87f02000000b00403ac95c6a9mr1456909qtk.30.1697524139104; Mon, 16 Oct 2023 23:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524139; cv=none; d=google.com; s=arc-20160816; b=NQw01374TcEfw3MHYWuFBF+blhFqbmfpojuDBMAxb+Lu+VwAtPURJVkPRIpCDonh/X NYe8jys515wQP6fRmgL2s4jJTpIgisWRfUl15eZYbUevwaKJEzGbRusmZ7+s+X+Uje60 PdMfg8zQ8SUYV1xb7RotVT6pdvyqrrcH9cbJGN5k5rMbKnc2ptZh+AsBQ4l4rsyRyjYS WCCZI20/A/CjaZ+3qa5aTly07lC4b0meSfpW+8PoZ9IFEfYBq3dBnOWb5+r3IMLldqAm FrJ1JhA2+9bRq6i/+YPb6kZiuE+8H8coyOIAFoTKRbXoDPxYXllhcE1p+H8Dy2i3f8Ds xqIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=ONi4sz4FYrpfXMHk9bqTEXz7CTlBpGmmezfxI4F92Y8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=pDtAaTTn58lDNvp+ubSNUxWhw79mPMWWVS++K0kXqaVdKWdAFKn2ryK3vQJbqCMjh7 ENrp/T0I9bO94knhs/wnoBb4SjxGaTBcln8BwowdAcdEMFIglrM+Cy8dyoLUA51eP+qp kXT+4LI2JS/1S7+oh6rTtkBF6kovQzXbRF2YIvRJBAUxR7Gw1XCMXjKdrls45pgzUzyx wIo3iqpwESUUvH9LeJwHYUl7Mfp4grPH98Vj+oaQ189b0Z5t49jpm+6sTm4V1YHZcIo6 uj4U+Y2GF7XvkVTcEPHBldT9dGe3ZN3PrRdF5Z0h5J3jYT180C6ic6nbqjrpt4g/dU5o W8Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DMq9Y7B8; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y13-20020a05622a164d00b0040f854a0f5esi634069qtj.646.2023.10.16.23.28.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:59 -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=DMq9Y7B8; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKQ-0000kR-Va; Tue, 17 Oct 2023 02:13:18 -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 1qsdKN-0000gQ-CE for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:15 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKL-0003wA-MR for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:15 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5859a7d6556so3978351a12.0 for ; Mon, 16 Oct 2023 23:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523191; x=1698127991; 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=ONi4sz4FYrpfXMHk9bqTEXz7CTlBpGmmezfxI4F92Y8=; b=DMq9Y7B8OEkm5tlbIUmiBTbGML+2yiWriQrU0EE2OFbQcdnqjDar0kJpuAuqFdAy4p UpeBDGNODdk/msnaLCujrpT/H4pR1ok0CK8oKHEeeSoM7IKweabZDzAM5u9hgDIdfhL5 twZ5rMZho71QuwBMqDB9t7Z++Ywmknh2wYNi0r8nv80tTKafgkzUANyPrSgkkFTaSABy lIqMdlGd73b/CkZ7vx3L97Njq0rfPbQOX+CxMlWA+PDnRkE8DLhfQk52dwSiqDXK2QvS SQxW3HjYimRfQ5HkyETtRTVZZDurFMowm3+e447PKPUmLotc1dhh/a7EjPmY5HwM5y8b NPQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523191; x=1698127991; 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=ONi4sz4FYrpfXMHk9bqTEXz7CTlBpGmmezfxI4F92Y8=; b=E0x0LotgZAGqg7zVu2dU1WjQacK574FgVUVtvX3kcffH6QlTMwyyqKCkuCjoTI3Vet IlKyxuitq9zWM25+VKOLG4Lez8+wTTllAmwnH2POBeOH15/ecA6l0/XnUN8LNXQ5CMCj AcBqDLVwGQjYpcf950UDbTI8EwlykEpSHd2Z3EzOHUDMKqo1iLUitJMIisRZPvcsstCd blDXfPBs5Lit15276M63gXXMePtAwBvF3MylNIrjn5uDP5vmA7VHUsO8mMLwQ0GCrZsr 5jlOIthya7ezteHxb3MOKfoN4GfJzH6eHNA6wI0gwGRW7GCIHiQ9eLmtLbT8rTd5u00a tA2Q== X-Gm-Message-State: AOJu0YxwzCvDOZXYdNjy+8EUwRcByYelJybOpncfzRCo0Mg5/RKSmE/Y vfW3Iw+IMQaRq2j6wYKoBNnlSYb/4rFfk52cXUk= X-Received: by 2002:a05:6a21:71c7:b0:16b:afc2:3b68 with SMTP id ay7-20020a056a2171c700b0016bafc23b68mr1174341pzc.25.1697523191165; Mon, 16 Oct 2023 23:13:11 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 30/90] target/sparc: Move ADDC to decodetree Date: Mon, 16 Oct 2023 23:11:44 -0700 Message-Id: <20231017061244.681584-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 41 +++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4005ce3df7..abcee27fd4 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -169,5 +169,7 @@ ORN 10 ..... 000110 ..... . ............. @r_r_ri ORNcc 10 ..... 010110 ..... . ............. @r_r_ri XORN 10 ..... 000111 ..... . ............. @r_r_ri XORNcc 10 ..... 010111 ..... . ............. @r_r_ri +ADDC 10 ..... 001000 ..... . ............. @r_r_ri +ADDCcc 10 ..... 011000 ..... . ............. @r_r_ri Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 368bafc99a..27375c74ec 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4193,6 +4193,43 @@ TRANS(ANDNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_andc_tl, NULL) TRANS(ORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_orc_tl, NULL) TRANS(XORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) +static TCGv gen_rs2_or_imm(DisasContext *dc, bool imm, int rs2_or_imm) +{ + /* For simplicity, we under-decoded the rs2 form. */ + if (!imm && rs2_or_imm & ~0x1f) { + return NULL; + } + if (imm || rs2_or_imm == 0) { + return tcg_constant_tl(rs2_or_imm); + } else { + return cpu_regs[rs2_or_imm]; + } +} + +static bool trans_ADDC(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + + if (src2 == NULL) { + return false; + } + gen_op_addx_int(dc, gen_dest_gpr(dc, a->rd), + gen_load_gpr(dc, a->rs1), src2, false); + return advance_pc(dc); +} + +static bool trans_ADDCcc(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + + if (src2 == NULL) { + return false; + } + gen_op_addx_int(dc, gen_dest_gpr(dc, a->rd), + gen_load_gpr(dc, a->rs1), src2, true); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4617,10 +4654,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0x8: /* addx, V9 addc */ - gen_op_addx_int(dc, cpu_dst, cpu_src1, cpu_src2, - (xop & 0x10)); - break; #ifdef TARGET_SPARC64 case 0x9: /* V9 mulx */ tcg_gen_mul_i64(cpu_dst, cpu_src1, cpu_src2); From patchwork Tue Oct 17 06:11:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734267 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322540wro; Mon, 16 Oct 2023 23:15:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFa7yGsOXTSSAhkpRRGP4riBaZlRyL/NJF07iZvoXbsegw1lrKw8G/eHusf0CI1Sz7OyGEY X-Received: by 2002:a05:620a:12f4:b0:778:8b91:2c88 with SMTP id f20-20020a05620a12f400b007788b912c88mr169911qkl.66.1697523306702; Mon, 16 Oct 2023 23:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523306; cv=none; d=google.com; s=arc-20160816; b=tP9Fi5jhJfSKWXx37wS5mQXSpEVvOxw17TvXnIApZWZQZgytL5vMdPg6gttxYrgVWI s3DZkE2n6mbTEkuHe0lr8AnH+2Y2NksHHaZmG0kJ16tmfI/F59KbLoswN/hLffpKOtlc Hm1gMRVhjDnX6NnDugKwXylTVBo1oXhq68+CgJyBLhwKfZDuyl6ZHJBGyUHFzqSTFez9 TkaBQatrWjuTze0RnvoxcpCtZtwBOivwWC+V62tRXtXcYtPrkjLJgAEfFgO/NSLx3Tnf p0AQDupds1JoAUXgPZL0S0VrnvdnE4yjxM4dwmTeWemY24FkzOi2L8dFcQ1hmgFSoSt2 cFyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=2cyZhTWXD8uswH5UFBIgKC9QPemzvcbCKADxfMZxTEk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=x0LbuNmwiM6lKQZdcNiXUnYQ4/3bMn9a2jBCj5tjUCrPYVmRHsJ/6V3X44wXupm8Dd /omITuy/geSTs06QqgUupuQTwBRlanlt9Za35UGAcAO3BIbQfUVMfqchAJ0uCOe1Btgf DsG0mRl8nbBdQeLbdOx+eSzXZGnAQugKKoUtemN7JWqjlCNl7EOUoqt90XjJjoa3Jv0R HMjs/FCsoENRVA9GpRBDaxr5PKBVgOWhcxXeDUP3qQ02BmXS6A2vZEShiunJDz/uoOqp 6q4HiSJo0M6/6341U1Yml12ulmt+YDRZMX2sEQWNxj0/55Mfy7zLJgC0XDOO7a1XIDIp y7yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TqwhjCb/"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e10-20020a37ac0a000000b0077414e33976si630325qkm.58.2023.10.16.23.15.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:15: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="TqwhjCb/"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKV-0000mu-B2; Tue, 17 Oct 2023 02:13:24 -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 1qsdKR-0000lN-Ch for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:19 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKM-0003wd-Eg for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:19 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c8a1541232so45565975ad.0 for ; Mon, 16 Oct 2023 23:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523192; x=1698127992; 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=2cyZhTWXD8uswH5UFBIgKC9QPemzvcbCKADxfMZxTEk=; b=TqwhjCb/9Oy+I88WHV8ciEap2JG1H1OAyoo8eqXjSnHWdtqqTDVGL0YdbpAxPb6kWF RNcHi5VNNSdKddAQLl8Ixwprc6FQWqiKE4rQCnYQ6Lgdie64jlVHKbjVXdRJ5WckGexw 9SpabrSc5oH4LEqfzhJBhcGPnUqWLoI2cOIo4lnn4LkoXg9y60uv7FGZlEK5Floh7ivp 4v5O/6ipAkTGRAAahmclVWAbyr8jUiqWr5RvG0EqsXmZX06uGUQnqOD7wDmwLzPYIgP0 e77AU09g1UR72zKfkVIWmoRIH6Iuclarly7rxKdnHh91wf1WW5402BAxaAjRGwDiwrE1 pbWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523192; x=1698127992; 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=2cyZhTWXD8uswH5UFBIgKC9QPemzvcbCKADxfMZxTEk=; b=nIcfYmiQk5sHzLoERsRsERN2220uM4bfchdL6DusK5TEGUGYyJTxecDQLM/imipf6j Bo9M0wN6eObDukgo3Zo5t3SXwFB0WRiye+m5bobklN+LTBXs+4FnY8p3/TcOex6diQJh llm659sNf7WKp9wO4lJy5Wx3FxX6uau4Z70JeITDmpNi1sXzepkXehHUpAob3K0g/7IU aiorklWIDMIks6rJNlmmbm2dM4Pgcp3QNgrF4W/Z1O0gmQwegbkLzM10vqeWY4ASujab HUKhlN9JJmp5BE1hegAovvgc3YFyPoxCCBHqE/V0YtrjCMf40sSSHpSovkzfqJKldrn9 pTGA== X-Gm-Message-State: AOJu0YzSDKh1n0lku1x+6MRXr5cX8bnFF6r0HTvj7HmdkaQLp8WXImuV aT9uJB3AOLWq+BZ2vKgP9xB3OTfUswosIeafB/w= X-Received: by 2002:a17:902:f98f:b0:1c8:7822:e5c3 with SMTP id ky15-20020a170902f98f00b001c87822e5c3mr1140173plb.47.1697523192223; Mon, 16 Oct 2023 23:13:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 31/90] target/sparc: Move MULX to decodetree Date: Mon, 16 Oct 2023 23:11:45 -0700 Message-Id: <20231017061244.681584-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index abcee27fd4..d9474d2a20 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -171,5 +171,6 @@ XORN 10 ..... 000111 ..... . ............. @r_r_ri XORNcc 10 ..... 010111 ..... . ............. @r_r_ri ADDC 10 ..... 001000 ..... . ............. @r_r_ri ADDCcc 10 ..... 011000 ..... . ............. @r_r_ri +MULX 10 ..... 001001 ..... . ............. @r_r_ri Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 27375c74ec..b3ce3947f3 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4183,6 +4183,7 @@ TRANS(SUB, ALL, do_arith, a, tcg_gen_sub_tl, tcg_gen_subi_tl) TRANS(ANDN, ALL, do_arith, a, tcg_gen_andc_tl, NULL) TRANS(ORN, ALL, do_arith, a, tcg_gen_orc_tl, NULL) TRANS(XORN, ALL, do_arith, a, tcg_gen_eqv_tl, NULL) +TRANS(MULX, 64, do_arith, a, tcg_gen_mul_tl, tcg_gen_muli_tl) TRANS(ADDcc, ALL, do_cc_arith, a, CC_OP_ADD, gen_op_add_cc, NULL) TRANS(ANDcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) @@ -4654,11 +4655,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { -#ifdef TARGET_SPARC64 - case 0x9: /* V9 mulx */ - tcg_gen_mul_i64(cpu_dst, cpu_src1, cpu_src2); - break; -#endif case 0xa: /* umul */ CHECK_IU_FEATURE(dc, MUL); gen_op_umul(cpu_dst, cpu_src1, cpu_src2); From patchwork Tue Oct 17 06:11:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734331 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326555wro; Mon, 16 Oct 2023 23:28:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5Y+PhGIbJTa8S/Aa3qQPMysbpLbfWlLmht3V3QpXvo3ss/eATm8sksuf8CfR+Y/gQs9SB X-Received: by 2002:ad4:5cce:0:b0:630:7d0:56f4 with SMTP id iu14-20020ad45cce000000b0063007d056f4mr2179228qvb.49.1697524114528; Mon, 16 Oct 2023 23:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524114; cv=none; d=google.com; s=arc-20160816; b=uRSY+PnhR8d3bIE3gKd1SUrp5NHh3swthVfw3AJn5drxGeVBDo8F1pmXdJi7rOUVrL iCfOZNyMS4LlxnF+GTFAbVf+//LX6jLr9a6fdMDy52Qd6z23VJt1F2jrxG0WLWGZlou2 PoVUGADyuihm2p1sG4GZSoGg/ynO33VL9gmS3Y5DxlIHuQYFDsDzbrxcH4bWBnCQ4rWh uDS3G/fElfKt0jfa8Vg+l6zU4HD6OC2xLX5x9ratO28x6/bpS9yS+EshYPMuTpQi2isB g8lEjqZtdnkjAOqQHQ1ejWcpvmy7K3IBH0mN2WHZhl5JqoIJc1s1jrzPLa9uTsW5koed cAuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=JRi9/WS5MlVCFY4u9HII56g4/6G8PX4/Vkrfldrh7Jk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=nIjbDXJQQx0sSskBCSPRn4cbrpYk6WMzH2LoqBGOWYiNOYbVe/LDW+nCygOfWlemYq NztpimC9cUFhGxtZvjDzFItJU1P7+7OmCMFGMqfgk62W5oOW+VZMF0IwjgPntpQfmrLh A+drQkLf+Q8E+6oBa9EPA8R/HLVKwOcvJCgedIVz+nbqJzIyUMzyq4UGDgQYEhLORH45 WPCGM9EObUOvfet1zia5Yb48VF/DVgDZ9l9RGazgbwgXwGaEYXbCJVF0ZRTHF20w3FDb M+RM4IDx1axgSeYhTG7IyfI2F5+bxk0TgvEjy1XkrdttjD9Fp9Uwt2vGmpV/lQ8S8buv XCdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wmcRI5H+; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id mz7-20020a0562142d0700b0065cfed59386si519069qvb.338.2023.10.16.23.28.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:34 -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=wmcRI5H+; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKQ-0000jy-FQ; Tue, 17 Oct 2023 02:13:18 -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 1qsdKO-0000hb-QJ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:16 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKM-0003wk-5U for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:15 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c9d922c039so42633395ad.3 for ; Mon, 16 Oct 2023 23:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523193; x=1698127993; 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=JRi9/WS5MlVCFY4u9HII56g4/6G8PX4/Vkrfldrh7Jk=; b=wmcRI5H+8te1glQ2J6MecziQTwbnYHGkPabWVhU/QwPKFDqy4MR7oZzYBjG+GQIKq3 RhiFpGFzOlYIi7V2d/Q9q+hzah60iPEiNH3DrKkQNei/XnM/s1AtHS+i3eJnIYbgOcJ9 6pqaoMY1msL+BgJd/1ViAFRLB94JGsm+ZyuzH0YleJ4SscqjlKIdojEPpw4H/qAn60o3 CSOu9ZhFgqldg8RR+Uy5BWXK8RGJINu5JdEs1d5ORgtBLAWeSndCt0bBijcPvwAI/zrp xinW1/K6x84HAM/C1oHLfS8rgmDSFW+MNoXg4uLQaDS4uMANoyDYI1yVxtEH0mH06l+5 90Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523193; x=1698127993; 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=JRi9/WS5MlVCFY4u9HII56g4/6G8PX4/Vkrfldrh7Jk=; b=Kgk85hsz3IKpzF5HXtfMwe9zrMe1hdG3TlhUA95j0JPcv0Tyxd5H2a5F/9DC/m1SYn gGhYcJPkPID6558OqTZgaq25KuyCCBDOtrrC7SkhVrP3EHy3UnIWcnkw0l08STsJ+kwo WCAA9mYIi6/dian71ZtM0D6PqCEoE8kRt91NqT2BdopzNhGRpbj+3v34Ls/N1zckwUI3 1zAiYxWzMjM1OXmQ7ZEFQwplcfFCS8W2LYTsuNukRpAiyr0mn9ohfmi13ggbESy+YXy1 K+rwQ2RTh5OgthXd3umUymqZO9bPbUHIwruyoTGGLP5q64jgtWhTXvgGfHaX063tyKt7 1D/A== X-Gm-Message-State: AOJu0YyGxIv+jXm7L9jyAOK5y2XuGKWS8PJN9pGuFsVh+RJkDzNQNfI7 ZcnPOkwEIPbuintzrwGWdAXeBs2OBylYuHxLoIE= X-Received: by 2002:a17:902:f0cc:b0:1c6:1cd8:5b59 with SMTP id v12-20020a170902f0cc00b001c61cd85b59mr1445719pla.1.1697523192958; Mon, 16 Oct 2023 23:13:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 32/90] target/sparc: Move UMUL, SMUL to decodetree Date: Mon, 16 Oct 2023 23:11:46 -0700 Message-Id: <20231017061244.681584-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++++ target/sparc/translate.c | 23 +++++------------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d9474d2a20..c114a13f1d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -172,5 +172,9 @@ XORNcc 10 ..... 010111 ..... . ............. @r_r_ri ADDC 10 ..... 001000 ..... . ............. @r_r_ri ADDCcc 10 ..... 011000 ..... . ............. @r_r_ri MULX 10 ..... 001001 ..... . ............. @r_r_ri +UMUL 10 ..... 001010 ..... . ............. @r_r_ri +UMULcc 10 ..... 011010 ..... . ............. @r_r_ri +SMUL 10 ..... 001011 ..... . ............. @r_r_ri +SMULcc 10 ..... 011011 ..... . ............. @r_r_ri Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b3ce3947f3..b6ec7d5cfd 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2859,6 +2859,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) +#define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) #define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) /* Default case for non jump instructions. */ @@ -4184,6 +4185,8 @@ TRANS(ANDN, ALL, do_arith, a, tcg_gen_andc_tl, NULL) TRANS(ORN, ALL, do_arith, a, tcg_gen_orc_tl, NULL) TRANS(XORN, ALL, do_arith, a, tcg_gen_eqv_tl, NULL) TRANS(MULX, 64, do_arith, a, tcg_gen_mul_tl, tcg_gen_muli_tl) +TRANS(UMUL, MUL, do_arith, a, gen_op_umul, NULL) +TRANS(SMUL, MUL, do_arith, a, gen_op_smul, NULL) TRANS(ADDcc, ALL, do_cc_arith, a, CC_OP_ADD, gen_op_add_cc, NULL) TRANS(ANDcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) @@ -4193,6 +4196,8 @@ TRANS(SUBcc, ALL, do_cc_arith, a, CC_OP_SUB, gen_op_sub_cc, NULL) TRANS(ANDNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_andc_tl, NULL) TRANS(ORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_orc_tl, NULL) TRANS(XORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) +TRANS(UMULcc, MUL, do_cc_arith, a, CC_OP_LOGIC, gen_op_umul, NULL) +TRANS(SMULcc, MUL, do_cc_arith, a, CC_OP_LOGIC, gen_op_smul, NULL) static TCGv gen_rs2_or_imm(DisasContext *dc, bool imm, int rs2_or_imm) { @@ -4655,24 +4660,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0xa: /* umul */ - CHECK_IU_FEATURE(dc, MUL); - gen_op_umul(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0xb: /* smul */ - CHECK_IU_FEATURE(dc, MUL); - gen_op_smul(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; case 0xc: /* subx, V9 subc */ gen_op_subx_int(dc, cpu_dst, cpu_src1, cpu_src2, (xop & 0x10)); From patchwork Tue Oct 17 06:11:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734285 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323693wro; Mon, 16 Oct 2023 23:19:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFj4E68+F+Pe2QJMPMAuVlsBqdVwqE8LOUtqj5VDgF+8+lEfbIQQreGUNN1EaJ7oNf7/APY X-Received: by 2002:a05:6102:2052:b0:457:c23a:b71c with SMTP id q18-20020a056102205200b00457c23ab71cmr1435079vsr.5.1697523540157; Mon, 16 Oct 2023 23:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523540; cv=none; d=google.com; s=arc-20160816; b=YwBjX0IzT598+jK5DkPjtx9cJvjOFAKbBO/+GGu/gkjmJpMWy4Lkuwj1SzylLBU/C9 oGGmMd4cvCW8pvlAoQiLaxysoXhzor95CWU7PeFzW1zAE0cg5oOKrPR2X6/oDST5PMs4 K/T8qqXECnnILN44XjGyLbFaBPSETLUC7G9jUfERKwN2laXB/MsyjYxV4oDbbmN1zL1A LGVNBVjx8PQpDZLmtyU2OI84qBCR/sOHluDwRKCvdZM7M4FNRtD1LqG4hyc0LvF/XdRY fDSViYIrwaz2kvr6Onm4TX/Vku34jygdfe5mV6/VV+YFGiiF96XbwBQEx6uJe/h0Ozgp OQNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Ff/T6JqgX72ZlfkHP0G9H5xez7GKCi6wISPu3JqSWUY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Eya1KtGzfneZU/JtE+om8iB6M3JgIToMgMiczNNnt6I2kpExplKFK+QFesO9F3iJqK 9lc38HcmKVKOWh5JU3xzzMR81q6gM3iQdLyJcY21roONrBz8by70NoNgEpy8BY3dtcOL TySatFS02UmM+tW7xMvWZ5sxGeOgCmEj464wOOz0QL1x6NhcSyvJ9SptzkRWpEwbWD4C Oh+rklo+9JrbRCNf5MxX65OKC5gWU+RqFJCvgwl8+VumR//JhgmXE50eHUM/z5Z+Srkz Vd7JoikCrPLA104KJY9hO1+WbR/47DE7S/AlQMeYcZG9gnZHRua6HtzI6g/ROXdPSc1P lajQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PNC8/B5Z"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c4-20020a0ce7c4000000b0065b081ea06bsi527975qvo.22.2023.10.16.23.18.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:19: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="PNC8/B5Z"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKc-0000rk-DW; Tue, 17 Oct 2023 02:13:30 -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 1qsdKQ-0000k0-EK for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:18 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKO-0003x7-IP for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:18 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b5e6301a19so3139945b3a.0 for ; Mon, 16 Oct 2023 23:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523194; x=1698127994; 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=Ff/T6JqgX72ZlfkHP0G9H5xez7GKCi6wISPu3JqSWUY=; b=PNC8/B5ZlktFPG5QvRHvHpGCms4TP2Nl1f6YwVDaL3HfujVvDqBwsi/8/eIYrxkB0y Vzl1Aolfpr8gSzucXtqs7JsZsbDsQyt/HDAYEVnNqH2uZWCPID/z+8qfHGKaXxXCqFSF 1Zfv1AmhWvsQha1w1Ft8AE3reAessH0rsodHlNtagS4seyNGjxkWw2mNt1sIR0XstGut DvFnFjxp5GLqeSSYMFHqmJCrMl8VHt91m95EPvn5IO3w/S62VLxHzQ6aoQUYiCXjqGaE Q4xjxtULhZlfUd/aKUNxM0thgUJ0VGAmPNk7cqGb4pV/M8ATf/UOjJi09cjDoVXZ3CwE tcPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523194; x=1698127994; 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=Ff/T6JqgX72ZlfkHP0G9H5xez7GKCi6wISPu3JqSWUY=; b=TpbM6eIgBa1JVl2B2Llig9X1Ty0Tpg4oQGTiLksTJK9bedHET88Hl/WHOGLhqimZP9 yDkvfsPHbrl4uORwIS9IVLOWJVdjl2kkYOkZtME+QbeFil6mkcWtoFKyh7C4ar3vHgyg hr7HhU5HwG0KLOkKXFFztQQuUf1iqK4gCx4h1/G7hFYZfmvTAleuSdXxhtOuSb0mej91 dCeHA8sgKGwS6blwus4SsxnnEstZbF+k9Ae0kFfONRCasD1srW5/Tw0JMBK0pjdSg/V+ yCe1tNtTLqcJ9Ykcbk/PDXHiu/3ZmlxMLsHVnJAu8GZ+K8MEEW8Zr19BkOOyZo8y9zo2 JB+g== X-Gm-Message-State: AOJu0YxtsaDR7aOyb7cvzBW05xbMD/o51bEf3drAz4as2QQMc1YKhxwQ lqRaeFut6M2IsBlotY6Bv/ZEizw2c6w475NSAHQ= X-Received: by 2002:a05:6a21:71ca:b0:169:cd02:65e9 with SMTP id ay10-20020a056a2171ca00b00169cd0265e9mr1292003pzc.33.1697523193721; Mon, 16 Oct 2023 23:13:13 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 33/90] target/sparc: Move SUBC to decodetree Date: Mon, 16 Oct 2023 23:11:47 -0700 Message-Id: <20231017061244.681584-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 28 ++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index c114a13f1d..64f5885e67 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -176,5 +176,7 @@ UMUL 10 ..... 001010 ..... . ............. @r_r_ri UMULcc 10 ..... 011010 ..... . ............. @r_r_ri SMUL 10 ..... 001011 ..... . ............. @r_r_ri SMULcc 10 ..... 011011 ..... . ............. @r_r_ri +SUBC 10 ..... 001100 ..... . ............. @r_r_ri +SUBCcc 10 ..... 011100 ..... . ............. @r_r_ri Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b6ec7d5cfd..30eb9bf94b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4236,6 +4236,30 @@ static bool trans_ADDCcc(DisasContext *dc, arg_r_r_ri *a) return advance_pc(dc); } +static bool trans_SUBC(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + + if (src2 == NULL) { + return false; + } + gen_op_subx_int(dc, gen_dest_gpr(dc, a->rd), + gen_load_gpr(dc, a->rs1), src2, false); + return advance_pc(dc); +} + +static bool trans_SUBCcc(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + + if (src2 == NULL) { + return false; + } + gen_op_subx_int(dc, gen_dest_gpr(dc, a->rd), + gen_load_gpr(dc, a->rs1), src2, true); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4660,10 +4684,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0xc: /* subx, V9 subc */ - gen_op_subx_int(dc, cpu_dst, cpu_src1, cpu_src2, - (xop & 0x10)); - break; #ifdef TARGET_SPARC64 case 0xd: /* V9 udivx */ gen_helper_udivx(cpu_dst, tcg_env, cpu_src1, cpu_src2); From patchwork Tue Oct 17 06:11:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734261 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322410wro; Mon, 16 Oct 2023 23:14:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlBoCMhBKfbEUgdAO8Y/N0eUuudzl9j9ioqW/72aP/VEk0CNRejNz3pN0UFJuzRT9Qk1Ad X-Received: by 2002:a05:620a:1726:b0:775:93aa:cb91 with SMTP id az38-20020a05620a172600b0077593aacb91mr1427168qkb.35.1697523279405; Mon, 16 Oct 2023 23:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523279; cv=none; d=google.com; s=arc-20160816; b=Lui7g0hXwxQNepdazA0qc9Xoh/w4rJzC7re+Qp8fWMSjZVUotc0ziwbXmaUhLqEztj x0DAZwAvnv45Jhmj90V0cxa8hsqpndldk/KnKB5P1p8oIPp7QaKtszHKsJjbjKMu2AG1 vxEt4gTM6a2CXkfEXMzQRdVmYwy9nAYTl8zmnL7/4rePuQ6wauHf5T8DwRoC+CYkGVya HqTI/hlrpLVA98HOcwPzzMQf4+zcVHzZh5k0mvj9Y4eW0ze0WcYszE0IQqqwyt0bAX7C XggDTPyjmLXroCfezUlpN06TKLbc3OfgbpW/LDr16iDyvN/7xkBVFoM2oUp0jZTrUr3q IjGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=uzIa5jkYKCXFsh4/+t2Ms/3odGLvuW7jHRTPUrJvLMI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=U2FoeVZqWFhHTWump2n0dphKtO9XIm5w8CTbr45vx65Z7/z6T5REn+K6yNk3yabQ9K ocNUjign1hb9haDK2awWDKn4Py/eec65roJJKU+bQrEyz+qYs5j1DLv3qEi0ReGjYRup /Ivtb4ybIn2UcWz82eKrnpoe4fH0stu9hPpOmjA+7S7f+kWEXB164pVwEHyV0rM3uubz 2ZUUU5ol5qWqv8qCSr9VjGmHZW6p74XUdLJguBjFMm3p2eqJHFWEqnJ1WA7Mel5r7+Fc iLSNy2lNPE/xXCZEjPYLSFwXXr4FjnFaBLhKA4nVRYhQEDS7N7SvuZiyssYnPN7UuEjU 0xEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ygQJw8fW; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ee1-20020a05620a800100b00776fad0cc1fsi148881qkb.253.2023.10.16.23.14.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:39 -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=ygQJw8fW; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKY-0000oa-Na; Tue, 17 Oct 2023 02:13:26 -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 1qsdKQ-0000jo-5f for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:18 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKO-0003xM-ET for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:17 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c9a1762b43so42723305ad.1 for ; Mon, 16 Oct 2023 23:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523194; x=1698127994; 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=uzIa5jkYKCXFsh4/+t2Ms/3odGLvuW7jHRTPUrJvLMI=; b=ygQJw8fWLdrTmYGHrgb4KlsDPM1Dw6pFdTegNbVbvSYoyugItmVFgyDERx1O+Wf4pk eUJbKQMaKHmzQscCMzi+0K+fB2X1sRZxBhTeUVPvrDz443KMUuTGssuRvgNCREJe6pvP fOkG7dOGDsWn0lHaFrjL6S9lTjgjAgBlZcZqX3R9rBkT7UcNWvHhZUeRO82PJEr4Cazx FgJUXUaeqgld0FmfN/7LeT2OBkcYvZ/vIaoTCPfDAElbnrx1BrnX8YN3ECkF+UGTP07K cJC/S7aAFGkC4RZeMuMQjzDS2roDoPuBbRolWjTr132C+gYQw/xMV0TK/8pOyHTRoFMj Aaxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523194; x=1698127994; 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=uzIa5jkYKCXFsh4/+t2Ms/3odGLvuW7jHRTPUrJvLMI=; b=W2EWPy8cc86pzSFx+F2k7pUfhHe7TONS8NlnSOmSz9y4kZlZTZcOZTZMQyPQB4pdbw XxsTWhrnL7+aQWcJomXxvaC0PxuvXl9v/PrAv0U/Y3DqRkBL1oH0nJot0tfmBoJZ7Brd Cq6vAFofgtb05jZOD1U6zA4HX9Jeb7pzC64URQHlDU+ExDshEFdv38sp28PcXItN+QH6 b0HseYcP3UngiK87zy1UHJ5uuQ+ESHz5dlc/HFnT4/1m+umh01YDZypIwf3CudTQlYpd PYtPB6EkNQUr2n00SE9WO0j3og1oOElTI2MoF+zVrINmwQdBmNshu8NVzaLQI89f4fsO GdPA== X-Gm-Message-State: AOJu0YyrNGS32vxE8YOrjH0/E7IeWrODGCkrgQzHAJazAGSD9u7fzGol HorPf4DgKdCm8MpUjqoMCZxpfaUuAvELUMC9beE= X-Received: by 2002:a17:902:d48f:b0:1c9:f780:8070 with SMTP id c15-20020a170902d48f00b001c9f7808070mr1448922plg.19.1697523194447; Mon, 16 Oct 2023 23:13:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 34/90] target/sparc: Move UDIVX, SDIVX to decodetree Date: Mon, 16 Oct 2023 23:11:48 -0700 Message-Id: <20231017061244.681584-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 64f5885e67..a2512d8d47 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -178,5 +178,7 @@ SMUL 10 ..... 001011 ..... . ............. @r_r_ri SMULcc 10 ..... 011011 ..... . ............. @r_r_ri SUBC 10 ..... 001100 ..... . ............. @r_r_ri SUBCcc 10 ..... 011100 ..... . ............. @r_r_ri +UDIVX 10 ..... 001101 ..... . ............. @r_r_ri +SDIVX 10 ..... 101101 ..... . ............. @r_r_ri Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 30eb9bf94b..c2e4172872 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -53,6 +53,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() +#define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() #endif /* Dynamic PC, must exit to main loop. */ @@ -643,6 +645,16 @@ static void gen_op_smul(TCGv dst, TCGv src1, TCGv src2) gen_op_multiply(dst, src1, src2, 1); } +static void gen_op_udivx(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udivx(dst, tcg_env, src1, src2); +} + +static void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdivx(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -4187,6 +4199,8 @@ TRANS(XORN, ALL, do_arith, a, tcg_gen_eqv_tl, NULL) TRANS(MULX, 64, do_arith, a, tcg_gen_mul_tl, tcg_gen_muli_tl) TRANS(UMUL, MUL, do_arith, a, gen_op_umul, NULL) TRANS(SMUL, MUL, do_arith, a, gen_op_smul, NULL) +TRANS(UDIVX, 64, do_arith, a, gen_op_udivx, NULL) +TRANS(SDIVX, 64, do_arith, a, gen_op_sdivx, NULL) TRANS(ADDcc, ALL, do_cc_arith, a, CC_OP_ADD, gen_op_add_cc, NULL) TRANS(ANDcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) @@ -4684,11 +4698,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { -#ifdef TARGET_SPARC64 - case 0xd: /* V9 udivx */ - gen_helper_udivx(cpu_dst, tcg_env, cpu_src1, cpu_src2); - break; -#endif case 0xe: /* udiv */ CHECK_IU_FEATURE(dc, DIV); if (xop & 0x10) { @@ -4826,10 +4835,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_store_gpr(dc, rd, dst); break; } - case 0x2d: /* V9 sdivx */ - gen_helper_sdivx(cpu_dst, tcg_env, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x2e: /* V9 popc */ tcg_gen_ctpop_tl(cpu_dst, cpu_src2); gen_store_gpr(dc, rd, cpu_dst); From patchwork Tue Oct 17 06:11:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734282 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323674wro; Mon, 16 Oct 2023 23:18:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqCso/xelkYlQpNEpX3wQrGCKVNvIW/7eFkRs+/HYYzif7VHrMYRQLK82iqEFh3rhq08aX X-Received: by 2002:a05:620a:44d0:b0:777:784:3458 with SMTP id y16-20020a05620a44d000b0077707843458mr1857993qkp.64.1697523537004; Mon, 16 Oct 2023 23:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523536; cv=none; d=google.com; s=arc-20160816; b=zVILLcaiCoJ05BgJqA+tD/YFAPwtDm6LbZoI2H6sl2sCpdGP8blFK67fsHx7uGJJLC psv6KtEq4BSh+GqaIcI+yGPPNp+svgVXxcA8PIYpz0BKFpRZicsTW62V3O/l/LsxtH7M 2s9/5FXsAJ9qzjSL/LQeKoDu42hVrPXwWimVBhYv43ZmD48K5vnzPych7PLwHT0GcEWO KJLTftYgY0s44QGoBSEbIzkuOEOH6+bpVFsI1Yd8ms4r02VO3prd5n72l0/Z+mgWRnEL Mi/ChvR28UNbH1KKRSXUYlW+BifgAn+PCHrvSGbBYcYTNjBMPTynuRHMk3AEeQVHHRp3 lB2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=yOvQ9vN+isuXim3kJTjKf4QoMsy15rCiHw37mEg1HDQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=OBT2eCw6V2+qBDbT3BIFQutD741WB6D/7f3LS5HepoAAfEla1yIei9kVLrxnvWTh3i 05rN8W0aIiFo+NBxARmR5wL3rX4+P82FWx4R7w3gSlpqXWPB/xGPLiIK6Vz3dOmJQe0s W/UABrhuOEOvjLWBvK4J/d/3PCmuYlR876z0QbVhFE1N3OfzLBOcMLyiCiJfvwRenu/j 6ntqKPRhITUb3PZwOcGtlGaMbNI9/T3pc22NWCwaNzQ5gT0s0LOMtz/TvhlvZIHAadGd B1zojReWN6OtDsxBekC6wqra6mAjbGSQpJSv7SUvY39i1CpTfcbgcC5h4Nji6RM1AI5g 7M6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FSaWoelQ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p5-20020a05620a056500b007749dc7ce32si610478qkp.123.2023.10.16.23.18.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18: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=FSaWoelQ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKZ-0000pY-1z; Tue, 17 Oct 2023 02:13: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 1qsdKQ-0000kH-Q4 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:18 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKO-0003xf-Mh for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:18 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c9d3a21f7aso42644095ad.2 for ; Mon, 16 Oct 2023 23:13:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523195; x=1698127995; 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=yOvQ9vN+isuXim3kJTjKf4QoMsy15rCiHw37mEg1HDQ=; b=FSaWoelQyyBU10HO5fxO82vFt0bxwOFa5RYXmfEwqWYYzGUafH8/Tge5Zt84OcJ+db 5gzeD3y8uzZjLuFbwD/WzFrzPo0RD6P02VkyS0kK9Yu9r8NqlKrqyN58eq/u7AKWHCwN 7g5pJ/SSm3wv1EHe/PZOc/QTB4b95SFWDwbZabACamGWXeJ3vJjHKhoPVXaxW7gzhnuE wwuJRdlXrxfuu5KAu/oDfmnEhcLSv4F0zhAibzYBsr1ZIxX8yUd2DC/HXaxkAp9tbZ/y ohUGrUgIlIRk6NA1g8cZ3MMiqo06EpXmYfDfZz1nsM3GGAZvahsaIvhWDKIJ+oY7Kpsl mtAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523195; x=1698127995; 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=yOvQ9vN+isuXim3kJTjKf4QoMsy15rCiHw37mEg1HDQ=; b=n+mMWThZOD3jMDPD4fnNYp7PiSU5TfRE9LMbr6NQdpEPLMQuxtJB+0hm2XojQ2COET sFk6dlBpQ/bw+m3z92lRdZL8XX/9MeXvYDO6EdgfGHl1ma2i+Y3zf2PbqI5KDMmtBWGq 1pYga9vLC5a8Gjn1/l1CPGFWvWEEkBTurnD3Vz+iIfaKiX6SYkj+Dtgp4ZMwmWnHyKDy OhugQL0Q5sa1AhmNogy+mf/FtYdnkALrfsMZKX9eYypHe41nwUa1dz4tR3QrlUeMOABD Uyp6dYgQWfdQlfhn7yabUTkmwwGiOgolgc9QfNf3SccHVgfQNNgloIlP0oIFv68urOmU cIoA== X-Gm-Message-State: AOJu0Yzw6quc35iT1ka/E/KWRcLsdcntKZGY22VJKdWFSH91Sw+gZwpX Xaz2Q9OYeq8u8oB4r1GcU5r7H+YwuRqjQ81T8vM= X-Received: by 2002:a17:902:c382:b0:1c9:c0fa:dfb7 with SMTP id g2-20020a170902c38200b001c9c0fadfb7mr1491366plg.57.1697523195267; Mon, 16 Oct 2023 23:13:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 35/90] target/sparc: Move UDIV, SDIV to decodetree Date: Mon, 16 Oct 2023 23:11:49 -0700 Message-Id: <20231017061244.681584-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 66 ++++++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a2512d8d47..7d1afb2a87 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -180,5 +180,9 @@ SUBC 10 ..... 001100 ..... . ............. @r_r_ri SUBCcc 10 ..... 011100 ..... . ............. @r_r_ri UDIVX 10 ..... 001101 ..... . ............. @r_r_ri SDIVX 10 ..... 101101 ..... . ............. @r_r_ri +UDIV 10 ..... 001110 ..... . ............. @r_r_ri +UDIVcc 10 ..... 011110 ..... . ............. @r_r_ri +SDIV 10 ..... 001111 ..... . ............. @r_r_ri +SDIVcc 10 ..... 011111 ..... . ............. @r_r_ri Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index c2e4172872..d57df60170 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -655,6 +655,26 @@ static void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2) gen_helper_sdivx(dst, tcg_env, src1, src2); } +static void gen_op_udiv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udiv(dst, tcg_env, src1, src2); +} + +static void gen_op_sdiv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdiv(dst, tcg_env, src1, src2); +} + +static void gen_op_udivcc(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udiv_cc(dst, tcg_env, src1, src2); +} + +static void gen_op_sdivcc(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdiv_cc(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -2869,6 +2889,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_64(C) false #endif #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_DIV(C) ((C)->def->features & CPU_FEATURE_DIV) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) #define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) @@ -4166,6 +4187,17 @@ static bool do_arith(DisasContext *dc, arg_r_r_ri *a, return do_cc_arith(dc, a, -1, func, funci); } +static bool do_flags_arith(DisasContext *dc, arg_r_r_ri *a, int cc_op, + void (*func)(TCGv, TCGv, TCGv)) +{ + if (do_arith(dc, a, func, NULL)) { + /* Assume FUNC has set env->cc_op and all cc_foo variables. */ + dc->cc_op = cc_op; + return true; + } + return false; +} + static bool trans_OR(DisasContext *dc, arg_r_r_ri *a) { /* For simplicity, we under-decoded the rs2 form. */ @@ -4201,6 +4233,8 @@ TRANS(UMUL, MUL, do_arith, a, gen_op_umul, NULL) TRANS(SMUL, MUL, do_arith, a, gen_op_smul, NULL) TRANS(UDIVX, 64, do_arith, a, gen_op_udivx, NULL) TRANS(SDIVX, 64, do_arith, a, gen_op_sdivx, NULL) +TRANS(UDIV, DIV, do_arith, a, gen_op_udiv, NULL) +TRANS(SDIV, DIV, do_arith, a, gen_op_sdiv, NULL) TRANS(ADDcc, ALL, do_cc_arith, a, CC_OP_ADD, gen_op_add_cc, NULL) TRANS(ANDcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) @@ -4212,6 +4246,8 @@ TRANS(ORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_orc_tl, NULL) TRANS(XORNcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) TRANS(UMULcc, MUL, do_cc_arith, a, CC_OP_LOGIC, gen_op_umul, NULL) TRANS(SMULcc, MUL, do_cc_arith, a, CC_OP_LOGIC, gen_op_smul, NULL) +TRANS(UDIVcc, DIV, do_flags_arith, a, CC_OP_DIV, gen_op_udivcc) +TRANS(SDIVcc, DIV, do_flags_arith, a, CC_OP_DIV, gen_op_sdivcc) static TCGv gen_rs2_or_imm(DisasContext *dc, bool imm, int rs2_or_imm) { @@ -4695,35 +4731,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif } else if (xop < 0x36) { if (xop < 0x20) { - cpu_src1 = get_src1(dc, insn); - cpu_src2 = get_src2(dc, insn); - switch (xop & ~0x10) { - case 0xe: /* udiv */ - CHECK_IU_FEATURE(dc, DIV); - if (xop & 0x10) { - gen_helper_udiv_cc(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - dc->cc_op = CC_OP_DIV; - } else { - gen_helper_udiv(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - } - break; - case 0xf: /* sdiv */ - CHECK_IU_FEATURE(dc, DIV); - if (xop & 0x10) { - gen_helper_sdiv_cc(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - dc->cc_op = CC_OP_DIV; - } else { - gen_helper_sdiv(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - } - break; - default: - goto illegal_insn; - } - gen_store_gpr(dc, rd, cpu_dst); + goto illegal_insn; } else { cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); From patchwork Tue Oct 17 06:11:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734300 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324634wro; Mon, 16 Oct 2023 23:22:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwXUCYuKq0k802XseX057o0j9ACqQ/SDxJd3DCF4dU1WNXO0+hQK9SYesPTDBXBuA1JIOP X-Received: by 2002:a67:b705:0:b0:457:c89a:fd6a with SMTP id h5-20020a67b705000000b00457c89afd6amr1391669vsf.16.1697523742127; Mon, 16 Oct 2023 23:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523742; cv=none; d=google.com; s=arc-20160816; b=pg2rKv81qpdnRPZR1erRjeME/iXnfSsk+AdN81ICm6fT1+EURGz095oXZjfXd3TZZm fPH0B3UbTDweejyKXDXam70YpDnUW+Z+y/lh5OJys8ZPCk+kQLdx1/1XVlMImWEUO17O inUuCKTdiizvFHIRomrvOlW4fKoaSaximgEgJv+loT6nSZgOIr4i96aTFju0BgoJV/aP C28j2xJetfeBj6unbSFQymU+I7HpfuqtdI+20+GVcPwlcVatD8oqFRAsnuGZ/1iwy98d aZ8HgPq5VThiaiKBOxNdgxaO96O5lHMqVaeOQa9MTdzJr4P/Fp5VLrz4TpuzlpPNm/zg fqhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=M/Kdhx62080PZQNabIW6Asll4+EMMOl7ER0zDU4Whso=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=q/YdMCHHkGvub+Pu5xucl2CBainBs1X2DOc6TRaaf6bAIvO99IOBeuZyMckY2C5s3C 4GuzMjtcuiazsl1MZIVjQrkpgQD5wKPR30ZnUD3OauWgHqKX4+5Uav7fbHIRmY7+AVKu sgCGjKdG9A+/kG9jj86A0Amy0MJaV6I94Ak6VIHYzAkaUryzUgFONZfqhI1xj8xgGJ+5 XilkwhufEflU8CRSJiF693ogE0Sp9pLsBaDJG19BB5yP5G7gHu/gIQ+ekMeaJYAfZ5T9 O2CPrTPqgs6SYvIXuDmaWTO58FMCwGXWkuQgMZ75HYV/T+efNM7062RwKUi48ytR14wo qxPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jIFTF2vO; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o14-20020a0cfa8e000000b0066d1eae483asi537154qvn.297.2023.10.16.23.22.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22:22 -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=jIFTF2vO; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKa-0000qY-OF; Tue, 17 Oct 2023 02:13:28 -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 1qsdKT-0000md-JP for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:21 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKQ-0003xn-4m for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:19 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c9e072472bso31802815ad.2 for ; Mon, 16 Oct 2023 23:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523196; x=1698127996; 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=M/Kdhx62080PZQNabIW6Asll4+EMMOl7ER0zDU4Whso=; b=jIFTF2vOGjD7Dn1qETrwBqHd24Y2VIhOYNF+jUvVbomC97aIG4JqaLb/ODMyjCPPbt 1yPwvNlMygtNJKiLxdO/fI1fxgBZ4CLddclOE4P86WP8M9Q2KGFNr7Ton3bGTh82EA3Y Ew0SrYKD6oC6uaQBm7JCkiFrVRv+svxopeXc8BFZ5N+0fCf/s3qGAQtCFL9tA72nwv+X QVXw5cUT1nlLhDWXWflN5K2HDxeDQXFtvFiHlPfJKU7XWQYsuB1ntgxVsewvDE+ANdnB k4PESqXafNHxIIQ03FScJHkFdsjZLupxACF8+h3UzNRxw0vqzfVmKbk1FGPeE19h1/ny 81rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523196; x=1698127996; 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=M/Kdhx62080PZQNabIW6Asll4+EMMOl7ER0zDU4Whso=; b=erVyQXJIHgmp/MHu4adP9dIUY2lhIxi++MRQ6RI8hr8XqRn/ffMny658knfzoEd20D lqB3aXg+aoTHe+cIAJHKZNd9ortcspk5VtJesr0CuBsO/KuWCAtoUr7wDGgOmq2roC7c l+0a7SeKuYRMK4pzygv+P07Wl/c9TowsNroJsvBuMuTyuXHBu+LMZSc1f/JIwsQCIH9B OLoF2GGS2tHk27aN3CpD5Ob88QjSTBZLit645rdjYilJlctbe82g29H98FsxEo+F+Zlj IqbS5a+lQfGCJvmsI2tvVfece0OpoY2tFN/T4v7MJJLckng5f33jPkzpBVQCB5dk5oXj TqeQ== X-Gm-Message-State: AOJu0YyeHUVMAAqDLGdIgfIpmzVGlCniwzEY7L0AGQgZiIW+TdXpIoza vfRXsGB2bsUxX59Eh9uu4Suljg9mHlUPXwQBQ18= X-Received: by 2002:a17:903:24d:b0:1c5:de06:9e5a with SMTP id j13-20020a170903024d00b001c5de069e5amr1593570plh.21.1697523195960; Mon, 16 Oct 2023 23:13:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 36/90] target/sparc: Move TADD, TSUB, MULS to decodetree Date: Mon, 16 Oct 2023 23:11:50 -0700 Message-Id: <20231017061244.681584-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 5 +++++ target/sparc/translate.c | 47 +++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 7d1afb2a87..18e2372928 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -184,5 +184,10 @@ UDIV 10 ..... 001110 ..... . ............. @r_r_ri UDIVcc 10 ..... 011110 ..... . ............. @r_r_ri SDIV 10 ..... 001111 ..... . ............. @r_r_ri SDIVcc 10 ..... 011111 ..... . ............. @r_r_ri +TADDcc 10 ..... 100000 ..... . ............. @r_r_ri +TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri +TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri +TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri +MULScc 10 ..... 100100 ..... . ............. @r_r_ri Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index d57df60170..4adf2cc3ae 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -675,6 +675,16 @@ static void gen_op_sdivcc(TCGv dst, TCGv src1, TCGv src2) gen_helper_sdiv_cc(dst, tcg_env, src1, src2); } +static void gen_op_taddcctv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_taddcctv(dst, tcg_env, src1, src2); +} + +static void gen_op_tsubcctv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_tsubcctv(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -4248,6 +4258,10 @@ TRANS(UMULcc, MUL, do_cc_arith, a, CC_OP_LOGIC, gen_op_umul, NULL) TRANS(SMULcc, MUL, do_cc_arith, a, CC_OP_LOGIC, gen_op_smul, NULL) TRANS(UDIVcc, DIV, do_flags_arith, a, CC_OP_DIV, gen_op_udivcc) TRANS(SDIVcc, DIV, do_flags_arith, a, CC_OP_DIV, gen_op_sdivcc) +TRANS(TADDcc, ALL, do_cc_arith, a, CC_OP_TADD, gen_op_add_cc, NULL) +TRANS(TSUBcc, ALL, do_cc_arith, a, CC_OP_TSUB, gen_op_sub_cc, NULL) +TRANS(TADDccTV, ALL, do_flags_arith, a, CC_OP_TADDTV, gen_op_taddcctv) +TRANS(TSUBccTV, ALL, do_flags_arith, a, CC_OP_TSUBTV, gen_op_tsubcctv) static TCGv gen_rs2_or_imm(DisasContext *dc, bool imm, int rs2_or_imm) { @@ -4310,6 +4324,12 @@ static bool trans_SUBCcc(DisasContext *dc, arg_r_r_ri *a) return advance_pc(dc); } +static bool trans_MULScc(DisasContext *dc, arg_r_r_ri *a) +{ + update_psr(dc); + return do_cc_arith(dc, a, CC_OP_ADD, gen_op_mulscc, NULL); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4737,36 +4757,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src2 = get_src2(dc, insn); switch (xop) { case 0x20: /* taddcc */ - gen_op_add_cc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_TADD); - dc->cc_op = CC_OP_TADD; - break; case 0x21: /* tsubcc */ - gen_op_sub_cc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_TSUB); - dc->cc_op = CC_OP_TSUB; - break; case 0x22: /* taddcctv */ - gen_helper_taddcctv(cpu_dst, tcg_env, - cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - dc->cc_op = CC_OP_TADDTV; - break; case 0x23: /* tsubcctv */ - gen_helper_tsubcctv(cpu_dst, tcg_env, - cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - dc->cc_op = CC_OP_TSUBTV; - break; case 0x24: /* mulscc */ - update_psr(dc); - gen_op_mulscc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD); - dc->cc_op = CC_OP_ADD; - break; + goto illegal_insn; /* in decodetree */ #ifndef TARGET_SPARC64 case 0x25: /* sll */ if (IS_IMM) { /* immediate */ From patchwork Tue Oct 17 06:11:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734278 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323595wro; Mon, 16 Oct 2023 23:18:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeAIZ/5ZutTRSCofzK38m70btT4xh6motC2OihkQ3uL74lhghXiqcenvdYM2/lM2QawZ9M X-Received: by 2002:ad4:5d6e:0:b0:66d:96d:3be0 with SMTP id fn14-20020ad45d6e000000b0066d096d3be0mr1831869qvb.13.1697523520954; Mon, 16 Oct 2023 23:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523520; cv=none; d=google.com; s=arc-20160816; b=MIzvHCCN3NabRjGwpPvpRE4bOofvMuk3QrxgJ2ISQn8Tx09BRyNSnV1D8REPhnwb9x Erb9/sYLLdbrzPLVPP/MsidTQOwO2B1bv/ryKBrRPSP240W8CIrVtIHwEStveOWk/Uy5 YtOzbsMwQ9I6zAnhsk7R6KPnCHf2EpeFn5dBondK+rrY0hEV/+YTB7SfX0wjyE9cQdq7 CrIPaUuEUENPIbD4GKV6Dn40j231tPt2rm59JEoU5xJsABJ/bkH/6E0n5LwMPV2FCW9r YaJeCYLGLHVf3hAI4+bPjtaf+2KhakXOxszJaaQ3wQZ9jKtrpG/aGs2Q1X6f9CoykoyY Qc9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=UCOIS4gOpVGHgOirABjKO6Yw+e6lmcWihb6phG5srXA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=qxAyl1ZSHnmWBK4/D2u07UA4HHwAkxOfSJokJCtxKF+DeymrxnIl8QLqEnhg35Ciw2 y8X1aP7wbd7oN7zYrS7I6utLKWe6JPSSNvGyGTMmUhzzr1DW2iHhgwQG8Da8+cTju9jV JD9Bk74XfCSBv4YHSBoTvpsxtAGacogzX5du2tvAsZ5GFSCuqgU9Ydfqs5DDGD2LpH0p jBR4CzrjJSRZ1HCNr0nKvZwCes3eAbju6/0+iYShM8VVVAljGgKZA6pXvGeWcbYsu6cc M44jQmwu/2y3Ni0VSFFk7P6T8eOpr6kzzG7keRG5LECXrnHfFEyiDonjupHVJpJToU9h V26w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PVWfjuws; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j4-20020a0cc344000000b0066d0869c6absi516308qvi.550.2023.10.16.23.18.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:40 -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=PVWfjuws; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKb-0000rE-P8; Tue, 17 Oct 2023 02:13:29 -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 1qsdKT-0000mi-NQ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:21 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKQ-0003y1-B1 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:21 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c87a85332bso45340555ad.2 for ; Mon, 16 Oct 2023 23:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523196; x=1698127996; 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=UCOIS4gOpVGHgOirABjKO6Yw+e6lmcWihb6phG5srXA=; b=PVWfjuws0CSz8FmGQmOtNmQ/uPlb53I8Y2D2jJ79EYnLSlUPOHqyK4gmoZWos9bq+i 5ErTiIo1MSbwOuM+8/ctsoWNvGwhjIzgc6YpnPXYKtnfTnzDTtS1V3cJAlzK21l95dct 7PWtMd3bFacBkRcBno4hiidXV+g2QWDwrD6ck0y/MFyAe2YGei4OUM9g++OpQdeKcFwj vNZpiu78bV9dk2u9TMZ/EWKiiC5j1RuD+V9Z+qHEwoGjmozP6aWhAgPZSyVzmcRQ/qGb NQKhSLfry3JkwA3VBYJ2J53tQRPMt0tSn/2XRntfed9N47CAy2c96MkMHC3YWEMowZcX FUdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523196; x=1698127996; 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=UCOIS4gOpVGHgOirABjKO6Yw+e6lmcWihb6phG5srXA=; b=wgyYxRC6AogV+L7cRCBTpWGPyppQbvr1vQKZUovHB7+4KOD+1n6xl02htNl1HOvLdT oDKcG7HrPudFnEWawWMqOemY39NojlOGPCsXNgsY3OWgLT5fhqDLqjoWZxvfFwXuqiMp SFre6ddFLWyOyiacnjoSOesITPCBGUukDHzfG+aVa+K00THLr6izVzV4TfcozmXi9ALt JLaMXPCpApo8BH+ehM4X2ENIseX0sicLrMcAnrSSQnsLlM3/HW06+zcIuXoFp+HGdupj EQkdCrwqfrb7kTfAl5bzoX+OgnqPPPX0mTsKAXVvJEUJQoIhiLjXTVEe/cDVVc79VXUO Ycqg== X-Gm-Message-State: AOJu0YwYg7SnvrHTMJ9AssyYx6Z22hfmaqaMYoRJwuwxYqiCvUTVBm5y Hu5irmGjnZAGYHJLIgFZ0vy2NficjuwcjNVuSm0= X-Received: by 2002:a17:903:2348:b0:1ca:8e79:538f with SMTP id c8-20020a170903234800b001ca8e79538fmr1561753plh.25.1697523196696; Mon, 16 Oct 2023 23:13:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 37/90] target/sparc: Move SLL, SRL, SRA to decodetree Date: Mon, 16 Oct 2023 23:11:51 -0700 Message-Id: <20231017061244.681584-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 14 +++ target/sparc/translate.c | 182 ++++++++++++++++---------------------- 2 files changed, 92 insertions(+), 104 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 18e2372928..fe0eacd779 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -190,4 +190,18 @@ TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri MULScc 10 ..... 100100 ..... . ............. @r_r_ri +&shiftr rd rs1 rs2 x:bool +@shiftr .. rd:5 ...... rs1:5 . x:1 ....... rs2:5 &shiftr + +SLL_r 10 ..... 100101 ..... 0 . 0000000 ..... @shiftr +SRL_r 10 ..... 100110 ..... 0 . 0000000 ..... @shiftr +SRA_r 10 ..... 100111 ..... 0 . 0000000 ..... @shiftr + +&shifti rd rs1 i x:bool +@shifti .. rd:5 ...... rs1:5 . x:1 ...... i:6 &shifti + +SLL_i 10 ..... 100101 ..... 1 . 000000 ...... @shifti +SRL_i 10 ..... 100110 ..... 1 . 000000 ...... @shifti +SRA_i 10 ..... 100111 ..... 1 . 000000 ...... @shifti + Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 4adf2cc3ae..deea3015b1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4330,6 +4330,83 @@ static bool trans_MULScc(DisasContext *dc, arg_r_r_ri *a) return do_cc_arith(dc, a, CC_OP_ADD, gen_op_mulscc, NULL); } +static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) +{ + TCGv dst, src1, src2; + + /* Reject 64-bit shifts for sparc32. */ + if (avail_32(dc) && a->x) { + return false; + } + + src2 = tcg_temp_new(); + tcg_gen_andi_tl(src2, gen_load_gpr(dc, a->rs2), a->x ? 63 : 31); + src1 = gen_load_gpr(dc, a->rs1); + dst = gen_dest_gpr(dc, a->rd); + + if (l) { + tcg_gen_shl_tl(dst, src1, src2); + if (!a->x) { + tcg_gen_ext32u_tl(dst, dst); + } + } else if (u) { + if (!a->x) { + tcg_gen_ext32u_tl(dst, src1); + src1 = dst; + } + tcg_gen_shr_tl(dst, src1, src2); + } else { + if (!a->x) { + tcg_gen_ext32s_tl(dst, src1); + src1 = dst; + } + tcg_gen_sar_tl(dst, src1, src2); + } + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(SLL_r, ALL, do_shift_r, a, true, true) +TRANS(SRL_r, ALL, do_shift_r, a, false, true) +TRANS(SRA_r, ALL, do_shift_r, a, false, false) + +static bool do_shift_i(DisasContext *dc, arg_shifti *a, bool l, bool u) +{ + TCGv dst, src1; + + /* Reject 64-bit shifts for sparc32. */ + if (avail_32(dc) && (a->x || a->i >= 32)) { + return false; + } + + src1 = gen_load_gpr(dc, a->rs1); + dst = gen_dest_gpr(dc, a->rd); + + if (avail_32(dc) || a->x) { + if (l) { + tcg_gen_shli_tl(dst, src1, a->i); + } else if (u) { + tcg_gen_shri_tl(dst, src1, a->i); + } else { + tcg_gen_sari_tl(dst, src1, a->i); + } + } else { + if (l) { + tcg_gen_deposit_z_tl(dst, src1, a->i, 32 - a->i); + } else if (u) { + tcg_gen_extract_tl(dst, src1, a->i, 32 - a->i); + } else { + tcg_gen_sextract_tl(dst, src1, a->i, 32 - a->i); + } + } + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(SLL_i, ALL, do_shift_i, a, true, true) +TRANS(SRL_i, ALL, do_shift_i, a, false, true) +TRANS(SRA_i, ALL, do_shift_i, a, false, false) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4678,77 +4755,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } -#ifdef TARGET_SPARC64 - } else if (xop == 0x25) { /* sll, V9 sllx */ - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - if (insn & (1 << 12)) { - tcg_gen_shli_i64(cpu_dst, cpu_src1, simm & 0x3f); - } else { - tcg_gen_shli_i64(cpu_dst, cpu_src1, simm & 0x1f); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - cpu_tmp0 = tcg_temp_new(); - if (insn & (1 << 12)) { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); - } else { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); - } - tcg_gen_shl_i64(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - } else if (xop == 0x26) { /* srl, V9 srlx */ - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - if (insn & (1 << 12)) { - tcg_gen_shri_i64(cpu_dst, cpu_src1, simm & 0x3f); - } else { - tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); - tcg_gen_shri_i64(cpu_dst, cpu_dst, simm & 0x1f); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - cpu_tmp0 = tcg_temp_new(); - if (insn & (1 << 12)) { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); - tcg_gen_shr_i64(cpu_dst, cpu_src1, cpu_tmp0); - } else { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); - tcg_gen_shr_i64(cpu_dst, cpu_dst, cpu_tmp0); - } - } - gen_store_gpr(dc, rd, cpu_dst); - } else if (xop == 0x27) { /* sra, V9 srax */ - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - if (insn & (1 << 12)) { - tcg_gen_sari_i64(cpu_dst, cpu_src1, simm & 0x3f); - } else { - tcg_gen_ext32s_i64(cpu_dst, cpu_src1); - tcg_gen_sari_i64(cpu_dst, cpu_dst, simm & 0x1f); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - cpu_tmp0 = tcg_temp_new(); - if (insn & (1 << 12)) { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); - tcg_gen_sar_i64(cpu_dst, cpu_src1, cpu_tmp0); - } else { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_ext32s_i64(cpu_dst, cpu_src1); - tcg_gen_sar_i64(cpu_dst, cpu_dst, cpu_tmp0); - } - } - gen_store_gpr(dc, rd, cpu_dst); -#endif } else if (xop < 0x36) { if (xop < 0x20) { goto illegal_insn; @@ -4761,42 +4767,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x22: /* taddcctv */ case 0x23: /* tsubcctv */ case 0x24: /* mulscc */ - goto illegal_insn; /* in decodetree */ -#ifndef TARGET_SPARC64 case 0x25: /* sll */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - tcg_gen_shli_tl(cpu_dst, cpu_src1, simm & 0x1f); - } else { /* register */ - cpu_tmp0 = tcg_temp_new(); - tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_shl_tl(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x26: /* srl */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - tcg_gen_shri_tl(cpu_dst, cpu_src1, simm & 0x1f); - } else { /* register */ - cpu_tmp0 = tcg_temp_new(); - tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_shr_tl(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x27: /* sra */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - tcg_gen_sari_tl(cpu_dst, cpu_src1, simm & 0x1f); - } else { /* register */ - cpu_tmp0 = tcg_temp_new(); - tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_sar_tl(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - break; -#endif + goto illegal_insn; /* in decodetree */ case 0x30: goto illegal_insn; /* WRASR in decodetree */ case 0x32: From patchwork Tue Oct 17 06:11:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734263 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322429wro; Mon, 16 Oct 2023 23:14:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9yOrhbs/CBcpHPKB0eJXfKDpdeyWayOkqOpjl1vG4CbTw/tgYsQwgOLf4aFA+udQSLLv7 X-Received: by 2002:a05:622a:148b:b0:410:9668:530a with SMTP id t11-20020a05622a148b00b004109668530amr1078395qtx.21.1697523283082; Mon, 16 Oct 2023 23:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523283; cv=none; d=google.com; s=arc-20160816; b=beYwUAyz1oRAgOsZuaJU4vAehzdV3g/FvieMAh/4giqQ8Rt8Jl4c0eGM7xPyeGN1e7 DDSWfuNYh3IqzZcqKHTlS+y49sPUAHNGLRtME1m21NVjkXnHYBhtc3eSc/DTvaZ5ngqC VuSIzQs91aSch58293HRUc2lAJj7W7WLzIAW+/9hco4jmwMDzNIPk4hah+6CwFPkNF9k jO62IbJSTHibQaCIQnsv1r3+zB2fVfDAovZruuEitQ9fCByfK75BbSi2Drioc7hZ1/2j 9QZeKajBc4BEBEXsSaK+pxC69+z9a3EEQgoma/K795jUdLXObNbggiOnX+cfaLaXbkfl H7qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=eSGLwNkfnTjcUB7m1SPZtJgpMDDDcjvL4Bd28I/2We4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=GsX4tetW4mf5sr1tgzVC2terf5LkCCcjVm6cg/ujv69QEb4oR3+Wbc/VUujqv+eY7x R35U9i+6hA6IxozxyY6yw2i51DkeBWzBdoZJb2dOC5v06LQqzRxDScjaC5jPYvvH3xxD hGYpQTZtSVdUU2SRVlPWH/gncWWRs2nDslJUUKqwCQHZqmW7SqTW+9mntNmqKruJrqoV 2EqD89ug8EzC0JrkY33LiOh2bF7arn4A6RccRqnY5CS7AI+PfTHRfXCR/ZRkFnQPD5H2 foPyaoKdV8mm5PHaEFYcAQRX8jX0BsVUBMj84qNnM54tuUYwzoUPokf+vcGgcb8wcGsd yjOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z6EbMx1W; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o16-20020ac87c50000000b004198f554d04si629444qtv.746.2023.10.16.23.14.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:43 -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=Z6EbMx1W; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKa-0000q4-6L; Tue, 17 Oct 2023 02:13:28 -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 1qsdKT-0000mh-MV for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:22 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKQ-0003yP-Rs for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:21 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c9e06f058bso35620895ad.0 for ; Mon, 16 Oct 2023 23:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523197; x=1698127997; 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=eSGLwNkfnTjcUB7m1SPZtJgpMDDDcjvL4Bd28I/2We4=; b=Z6EbMx1W+y5tAGXiXCWqQnm1Cq9z0CHaET0VxlbB9YLgncoa/3YX6vglIAkfFNQdz6 1zociU9XqmcOlI6ry0SQx/J6VvmWxlRKYDWVCgbu5gvgYmoRTGtwyUbltZI9xsjJB+Pu L5lZm060AIT8wWnWs1elIH2mRtFXhoEPU2TjZTCpbQq8j8PZMS94xPaR5TETiQZbwTLS 7+92obU9cS3Lw1R6M915evioGbN1+KFAq2s3b5lQkcy5OkryzX/6oC9q6Q+3xavhg0od acsugFslJUO39Ti7zocdZT5mma6yYgVhMaVUchpG/mnKtDO770cYAwo8xKNwcw4DX53L LS0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523197; x=1698127997; 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=eSGLwNkfnTjcUB7m1SPZtJgpMDDDcjvL4Bd28I/2We4=; b=Fvb76faB+lciBgNTu3U8po1HLCjvOXTuWx4wgOCtejtUK3Rnc8R3lvXxUc59bgoGLe DxsIjBR50ZBNIZn24MFAvJrV5MK8NZVw1/X6AVehEKsjF/zIfKj5ta476Lj8xheXzOn5 G6dkShY02kOOCL6un3BoEVLdezw+K0qJhZ/8xT0Hg0g4OLryYvUmWQgopK3K9GPyCUM2 x55GF2xQ3Y0LdErOPjtd1b3NV6vw44ePUNoLx2Rmv7jl3g03dHCno6AK2rCo/xtg3h/6 1yOBHSq2iDHbSp9QmOQNX+64dfxbCs+GFqOuXeo2NCGXxY9PZI5ZD3uWIKie2bTHffa8 iN+A== X-Gm-Message-State: AOJu0YyUvuVVTzAKPHpUvpN5/z9IZqcElZQj4i2RvX7YvzbV8JnF1TS7 fQnMvTe8pAUWujh6aP000aHrtCLb/DIK9jLnmks= X-Received: by 2002:a17:903:5cf:b0:1b5:674d:2aa5 with SMTP id kf15-20020a17090305cf00b001b5674d2aa5mr1155153plb.13.1697523197538; Mon, 16 Oct 2023 23:13:17 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 38/90] target/sparc: Move MOVcc, MOVR to decodetree Date: Mon, 16 Oct 2023 23:11:52 -0700 Message-Id: <20231017061244.681584-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++ target/sparc/translate.c | 103 +++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 56 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index fe0eacd779..a61d10be5a 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -205,3 +205,7 @@ SRL_i 10 ..... 100110 ..... 1 . 000000 ...... @shifti SRA_i 10 ..... 100111 ..... 1 . 000000 ...... @shifti Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 + +MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 +MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 +MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index deea3015b1..0b0b9aa8d3 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4407,6 +4407,51 @@ TRANS(SLL_i, ALL, do_shift_i, a, true, true) TRANS(SRL_i, ALL, do_shift_i, a, false, true) TRANS(SRA_i, ALL, do_shift_i, a, false, false) +static bool do_mov_cond(DisasContext *dc, DisasCompare *cmp, int rd, TCGv src2) +{ + TCGv dst = gen_load_gpr(dc, rd); + + tcg_gen_movcond_tl(cmp->cond, dst, cmp->c1, cmp->c2, src2, dst); + gen_store_gpr(dc, rd, dst); + return advance_pc(dc); +} + +static bool trans_MOVcc(DisasContext *dc, arg_MOVcc *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + DisasCompare cmp; + + if (src2 == NULL) { + return false; + } + gen_compare(&cmp, a->cc, a->cond, dc); + return do_mov_cond(dc, &cmp, a->rd, src2); +} + +static bool trans_MOVfcc(DisasContext *dc, arg_MOVfcc *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + DisasCompare cmp; + + if (src2 == NULL) { + return false; + } + gen_fcompare(&cmp, a->cc, a->cond); + return do_mov_cond(dc, &cmp, a->rd, src2); +} + +static bool trans_MOVR(DisasContext *dc, arg_MOVR *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + DisasCompare cmp; + + if (src2 == NULL) { + return false; + } + gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); + return do_mov_cond(dc, &cmp, a->rd, src2); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4779,66 +4824,12 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; /* WRTBR, WRHPR in decodetree */ #ifdef TARGET_SPARC64 case 0x2c: /* V9 movcc */ - { - int cc = GET_FIELD_SP(insn, 11, 12); - int cond = GET_FIELD_SP(insn, 14, 17); - DisasCompare cmp; - TCGv dst; - - if (insn & (1 << 18)) { - if (cc == 0) { - gen_compare(&cmp, 0, cond, dc); - } else if (cc == 2) { - gen_compare(&cmp, 1, cond, dc); - } else { - goto illegal_insn; - } - } else { - gen_fcompare(&cmp, cc, cond); - } - - /* The get_src2 above loaded the normal 13-bit - immediate field, not the 11-bit field we have - in movcc. But it did handle the reg case. */ - if (IS_IMM) { - simm = GET_FIELD_SPs(insn, 0, 10); - tcg_gen_movi_tl(cpu_src2, simm); - } - - dst = gen_load_gpr(dc, rd); - tcg_gen_movcond_tl(cmp.cond, dst, - cmp.c1, cmp.c2, - cpu_src2, dst); - gen_store_gpr(dc, rd, dst); - break; - } + case 0x2f: /* V9 movr */ + goto illegal_insn; /* in decodetree */ case 0x2e: /* V9 popc */ tcg_gen_ctpop_tl(cpu_dst, cpu_src2); gen_store_gpr(dc, rd, cpu_dst); break; - case 0x2f: /* V9 movr */ - { - int cond = GET_FIELD_SP(insn, 10, 12); - DisasCompare cmp; - TCGv dst; - - gen_compare_reg(&cmp, cond, cpu_src1); - - /* The get_src2 above loaded the normal 13-bit - immediate field, not the 10-bit field we have - in movr. But it did handle the reg case. */ - if (IS_IMM) { - simm = GET_FIELD_SPs(insn, 0, 9); - tcg_gen_movi_tl(cpu_src2, simm); - } - - dst = gen_load_gpr(dc, rd); - tcg_gen_movcond_tl(cmp.cond, dst, - cmp.c1, cmp.c2, - cpu_src2, dst); - gen_store_gpr(dc, rd, dst); - break; - } #endif default: goto illegal_insn; From patchwork Tue Oct 17 06:11:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734281 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323639wro; Mon, 16 Oct 2023 23:18:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxddfm8bL6hge53+THhvNkKfqh7hrHVij6aBw3oMaMMq58wQbNp0ArBmRTui7bJtYA6jhb X-Received: by 2002:a05:620a:783:b0:777:18d4:818e with SMTP id 3-20020a05620a078300b0077718d4818emr1399355qka.72.1697523529578; Mon, 16 Oct 2023 23:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523529; cv=none; d=google.com; s=arc-20160816; b=js1osWPpwvbhqp7p/4IE0rzfJdyodwH6+67+OzbhMAKSphjmMTpksBnEQAG4cXVAAw ucBCxRa7X1LFOk1IRcLc+yYdva8wwTB0fSJId3x7idZ6Gj6GYbtoTpudpCAfPOcR3lIk qgIcLcBipayxtL8vFOeei6WfVLwl5QdoSVsSkNM4ZlaPt1+TJ9FYT0nKUuhsGnNMLiM9 2u90hWOAv8Un4futKLWO8nPnS41QJRqOHHH5cvdjU8qaf0CeDF6aVvc+bIPqsxYQ7tAD 5rwrsKjynyhqlJPMUv4jQ7CkXPEEgRaG4VWK8M4lFxqN6M26D90+xG/E5oDtFJSyCWQB V+pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=BpYlXrhETLxpDZghiwgxak1PUoYJ/Oh0DGQpkeamlnI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=eohXlK0uReyME3ryoJB0+bRVcRZh/hP0j+Jo2fiYI7tM4wy5PVCww3sk8c2LwSIPPk 7H6MOgnDQpbZiDb5jcsxHEOhHG8RV+uCh2VG1Q0xm8WgyMjITJbWW+UxfnY0ohdylQKI u3LFMx0L+43eiOV6rWUJJP9+nnExHT6+USBepnDJ9zwyySKvnLDYK1J50kxnjeZl7nV2 WAJM5rhdKX7papcHVsHDMUNLl7mdHt9z4mNtrkfu/D2qrSFOcIdQeGI41BN1Ra0m8Ssu EidLDYvzX52A9BeeYbaS3AU2yxH2HvNvD33bOva04jDWJOK5ohkSMznbSPhYne+VZAj7 pf/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ndF2eeuZ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dy3-20020a05620a60c300b00775d0d3bfa1si593718qkb.615.2023.10.16.23.18.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:49 -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=ndF2eeuZ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdKZ-0000pg-BT; Tue, 17 Oct 2023 02:13: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 1qsdKU-0000nA-TH for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:23 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKT-0003yo-3H for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:22 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1ca215cc713so15175185ad.3 for ; Mon, 16 Oct 2023 23:13:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523198; x=1698127998; 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=BpYlXrhETLxpDZghiwgxak1PUoYJ/Oh0DGQpkeamlnI=; b=ndF2eeuZNMDGTaTa8BGWJOiuVztmwQmms4ZqxeVWtCocM4W8Y+QcKP8QBx6gX7Xwvc Jrn6SDtDfTvDqfpQ2Yz/e4QlKOG+8klNWoaLMH851PLq9qRv+djUrha07xLHS30+SV2s MT7FX11bS7LpJ7w4Hb+1TzW7q5RA6S/5GnVXMooJHLw+rUO02ncT//EatE0k9VJfj+6o v41riZdz848jL0dbTS6TFAEfGijhS716hpgjYCW4rgVI9JTzR2tlHZu8Mvuw8/bV86zR cjoMWkg/nWTxiAJ5bh4bWRC2jPtCzAt9Sayw/GvHIcXf0lb2G2MbMxAaFOpw6OpPg1on 6wIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523198; x=1698127998; 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=BpYlXrhETLxpDZghiwgxak1PUoYJ/Oh0DGQpkeamlnI=; b=a5+TNZniywvA1sm5FdJGIpPn0MM2hYsGIE8URH5iSOUAwfq229G7Rk7AV/4Th0sKwF tSnHUR6DqlHBrGCiXL0drrcYVxq1sv3wudJ3rHHaJa/wBOnzyN3mREn+tDn4A8TNPg98 o2lE7w0rpqkc+yuzGsdvjQLCwSlSDRJyB2rYHae13DpKy+m1F5o0CyiZhsV10Xet13r1 cZz7tQoJevlFTg50zWz81Nas345JZZFeFcpwycxWXgUEEGcG4BUuhag/KNcPEjMM7tM4 PnS9Z0x7nwbWnWoxNCkpyeipMJWipHx1qjdN0vcR0gXjOBadE01qhY6LwwHcis0wmAAy 4GgA== X-Gm-Message-State: AOJu0YxXoQ/8DjxlLN1OE6wlG/nZS+LZvxGL5GLOLiC2+Kn8MKo+SDtp frzQnhBlRIZmx5x0nSlLdygYm2lBVkequvi7sVs= X-Received: by 2002:a17:902:f9cc:b0:1ca:25e:3c32 with SMTP id kz12-20020a170902f9cc00b001ca025e3c32mr1404245plb.19.1697523198225; Mon, 16 Oct 2023 23:13:18 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 39/90] target/sparc: Move POPC to decodetree Date: Mon, 16 Oct 2023 23:11:53 -0700 Message-Id: <20231017061244.681584-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 55 ++++++--------------------------------- 2 files changed, 9 insertions(+), 47 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a61d10be5a..0c1517f024 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -189,6 +189,7 @@ TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri MULScc 10 ..... 100100 ..... . ............. @r_r_ri +POPC 10 rd:5 101110 00000 imm:1 rs2_or_imm:s13 &r_r_ri rs1=0 &shiftr rd rs1 rs2 x:bool @shiftr .. rd:5 ...... rs1:5 . x:1 ....... rs2:5 &shiftr diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 0b0b9aa8d3..75a2de764e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -685,6 +685,11 @@ static void gen_op_tsubcctv(TCGv dst, TCGv src1, TCGv src2) gen_helper_tsubcctv(dst, tcg_env, src1, src2); } +static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2) +{ + tcg_gen_ctpop_tl(dst, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -2678,19 +2683,6 @@ static TCGv get_src1(DisasContext *dc, unsigned int insn) return gen_load_gpr(dc, rs1); } -static TCGv get_src2(DisasContext *dc, unsigned int insn) -{ - if (IS_IMM) { /* immediate */ - target_long simm = GET_FIELDs(insn, 19, 31); - TCGv t = tcg_temp_new(); - tcg_gen_movi_tl(t, simm); - return t; - } else { /* register */ - unsigned int rs2 = GET_FIELD(insn, 27, 31); - return gen_load_gpr(dc, rs2); - } -} - #ifdef TARGET_SPARC64 static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { @@ -4245,6 +4237,8 @@ TRANS(UDIVX, 64, do_arith, a, gen_op_udivx, NULL) TRANS(SDIVX, 64, do_arith, a, gen_op_sdivx, NULL) TRANS(UDIV, DIV, do_arith, a, gen_op_udiv, NULL) TRANS(SDIV, DIV, do_arith, a, gen_op_sdiv, NULL) +/* TODO: Should have feature bit -- comes in with UltraSparc T2. */ +TRANS(POPC, 64, do_arith, a, gen_op_popc, NULL) TRANS(ADDcc, ALL, do_cc_arith, a, CC_OP_ADD, gen_op_add_cc, NULL) TRANS(ANDcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) @@ -4801,40 +4795,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } } else if (xop < 0x36) { - if (xop < 0x20) { - goto illegal_insn; - } else { - cpu_src1 = get_src1(dc, insn); - cpu_src2 = get_src2(dc, insn); - switch (xop) { - case 0x20: /* taddcc */ - case 0x21: /* tsubcc */ - case 0x22: /* taddcctv */ - case 0x23: /* tsubcctv */ - case 0x24: /* mulscc */ - case 0x25: /* sll */ - case 0x26: /* srl */ - case 0x27: /* sra */ - goto illegal_insn; /* in decodetree */ - case 0x30: - goto illegal_insn; /* WRASR in decodetree */ - case 0x32: - goto illegal_insn; /* WRPR in decodetree */ - case 0x33: /* wrtbr, UA2005 wrhpr */ - goto illegal_insn; /* WRTBR, WRHPR in decodetree */ -#ifdef TARGET_SPARC64 - case 0x2c: /* V9 movcc */ - case 0x2f: /* V9 movr */ - goto illegal_insn; /* in decodetree */ - case 0x2e: /* V9 popc */ - tcg_gen_ctpop_tl(cpu_dst, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - break; -#endif - default: - goto illegal_insn; - } - } + goto illegal_insn; /* in decodetree */ } else if (xop == 0x36) { /* UltraSparc shutdown, VIS, V8 CPop1 */ #ifdef TARGET_SPARC64 int opf = GET_FIELD_SP(insn, 5, 13); From patchwork Tue Oct 17 06:11:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734276 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323485wro; Mon, 16 Oct 2023 23:18:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXYfkgI2DOvWp+xUFvVVuOtQa7jGbB7EPEkOAG4aa/lp1rRpLVHIKRvx9LRVR9AhwK53C2 X-Received: by 2002:a05:620a:3d85:b0:76d:bb77:b295 with SMTP id ts5-20020a05620a3d8500b0076dbb77b295mr1181614qkn.78.1697523495121; Mon, 16 Oct 2023 23:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523495; cv=none; d=google.com; s=arc-20160816; b=rS4L06GoKpdGYY3WluaM7umRGatxvnp6/BGovNVvQwjnLviMUKCaKIvYMSMgHd4+Km wlit7gYsfzKlNz1+WJ7XxAEaJnXROTTIDQEV7vyLYzYYB/z4Xu0x0okRw5dgStJ9tZPC k8JfzImvkAQIJnFuJb1hIOCcGQ9mecYi6OJbkeOTLQXJRUmu1OIX6d0jo/dhKrZPBl7l dQviH0QEEp5LfYr0JAyJkF7OfZbBYczk99xMHmbr71SQ/eD+rdMrIU8LoMj9YHvkqUKL 4LO21v3k7tM2cDVHLUcJIEkwT5QCC009dF9xCBG+t8EIkNfF7yJV3sFsRHIt1yDKoksq 2yNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=47sVqy5TWeEVQqufZm95EaXbPWX2ZZkUC/6NZvlFAeA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=wgqUN4qWQYDaSuVr2VaHkKrYNkjkQtmKN8uOupusSYo5Z3IUoPWbo8xYXUmN4iumTn uB5fo5QHH/j8l8gGYg6i6f8HPs3u2xyfP2ukOVZqTRxocvUR6+V1Iyq007tjX9sa10/k +n04D5cDZhLqw52p28qT+bNSM8QAgTmUXS8saXdWJTcpfeTjWMI2lCkjqGtwyCT7TZqK VU8qNuTDEiVdsTHWSI/fR1B5GO7RB8fAnd8+M8YOmSG9GLEsMwc/R5cWC9vX2QLQUkVj fSR1R4JkKbirRsoaNFcHCpSLht/OYhGjr8BBl9A8m2ZAgqnRNdbHs5pmZFJ4wno6UbYz cjLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gim1X7g1; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o15-20020a05620a2a0f00b00774182478b5si624004qkp.11.2023.10.16.23.18.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:15 -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=gim1X7g1; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNR-0002JS-2g; Tue, 17 Oct 2023 02:16: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 1qsdNP-000288-7b for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:23 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNN-0004ev-3m for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:22 -0400 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-6b9e478e122so3694075a34.1 for ; Mon, 16 Oct 2023 23:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523379; x=1698128179; 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=47sVqy5TWeEVQqufZm95EaXbPWX2ZZkUC/6NZvlFAeA=; b=gim1X7g1nEjfGrpGdeoid8c95atZFD55PCRlr7hKQBQyZusMn4KvM7aSe3zRUENMwY 6qtDwRB51yZnJPHaPYbbZv6TNyzOOCit62L3H/BHsD443vcOJpVvynIYKvWl/7zVEu7E 32CX6IP+S5xjtpsZMgxQIt2yJa8+K2u1IKTzRLovfKvzSkqLB0V8GR62qYODhRHTpcwR kM5CkDJXOJ1/Q5/Byy3GGA2vpes/L6i5w//xTHZ+BuoBz1SCYlKe0L4SrARsVMaeA7HI INttiVO6zoTExoqIa9aFSYVgy8XxIbv6U0xgam8ilVnoLp9UYmhegeBFTxr/HbYAKC4Q cqrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523379; x=1698128179; 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=47sVqy5TWeEVQqufZm95EaXbPWX2ZZkUC/6NZvlFAeA=; b=Vq1uBRcO8i0nGF7SCHFJJUbfPTebCv14NG0V93etbF7jAs+gGGcgUMlfOxyWW1Xvu8 9iET1z5Knn5rCIUVkN9Eyc8GdGT3WKn3r1KgRnAP2j2gCALS/KkdJOY5STKe+8AEcyIO g3ihLXx+thCU+jOkNv2iAgSfvNT2ea3FrNC9rug7EHdQJroZNalpZBm9YNxrQWATlJVz CI3rv9FBa2YsYfHelPpM/lBmf3Cfth7Kft86zATcEGb6VRY2c0yGzCyJQrsDw9NTlBcO p69FFXj1Irx54lmXCrq9uLQbtnzaevlapWydHIAyo0gcnqTz0lRvmOveJPINrMrJ52lM Txqg== X-Gm-Message-State: AOJu0Yy+UEAKryjD+VAQKQM5bkuWuctUuAxkm6+AZNA335jG3heOO0+G FYjEJtQ6zn4wVy3oikl2Q3Z9z4y5LhFwEVSrM1c= X-Received: by 2002:a9d:75d1:0:b0:6b9:b1b0:fcd1 with SMTP id c17-20020a9d75d1000000b006b9b1b0fcd1mr1159605otl.31.1697523379490; Mon, 16 Oct 2023 23:16:19 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 40/90] target/sparc: Convert remaining v8 coproc insns to decodetree Date: Mon, 16 Oct 2023 23:11:54 -0700 Message-Id: <20231017061244.681584-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 11 +++++++++++ target/sparc/translate.c | 32 ++++++-------------------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0c1517f024..bdbf6d987c 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -210,3 +210,14 @@ Tcc 10 0 cond:4 111010 rs1:5 imm:1 cc:1 00000 rs2_or_imm:7 MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 + +NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 + +NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR +NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC +NCP 11 ----- 110100 ----- --------- ----- # v8 STC +NCP 11 ----- 110101 ----- --------- ----- # v8 STCSR +NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ +NCP 11 ----- 110111 ----- --------- ----- # v8 STDC diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 75a2de764e..5af642a637 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4796,8 +4796,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } } else if (xop < 0x36) { goto illegal_insn; /* in decodetree */ - } else if (xop == 0x36) { /* UltraSparc shutdown, VIS, V8 CPop1 */ + } else if (xop == 0x36) { #ifdef TARGET_SPARC64 + /* VIS */ int opf = GET_FIELD_SP(insn, 5, 13); rs1 = GET_FIELD(insn, 13, 17); rs2 = GET_FIELD(insn, 27, 31); @@ -5237,14 +5238,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } #else - goto ncp_insn; -#endif - } else if (xop == 0x37) { /* V8 CPop2, V9 impdep2 */ -#ifdef TARGET_SPARC64 - goto illegal_insn; -#else - goto ncp_insn; + g_assert_not_reached(); /* in decodetree */ #endif + } else if (xop == 0x37) { + /* V8 CPop2, V9 impdep2 */ + goto illegal_insn; /* in decodetree */ #ifdef TARGET_SPARC64 } else if (xop == 0x39) { /* V9 return */ save_state(dc); @@ -5460,13 +5458,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = gen_load_gpr(dc, rd); gen_swap_asi(dc, cpu_val, cpu_src1, cpu_addr, insn); break; - -#ifndef TARGET_SPARC64 - case 0x30: /* ldc */ - case 0x31: /* ldcsr */ - case 0x33: /* lddc */ - goto ncp_insn; -#endif #endif #ifdef TARGET_SPARC64 case 0x08: /* V9 ldsw */ @@ -5727,12 +5718,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src2 = gen_load_gpr(dc, rs2); gen_casx_asi(dc, cpu_addr, cpu_src2, insn, rd); break; -#else - case 0x34: /* stc */ - case 0x35: /* stcsr */ - case 0x36: /* stdcq */ - case 0x37: /* stdc */ - goto ncp_insn; #endif #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x3c: /* V9 or LEON3 casa */ @@ -5772,11 +5757,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR); return; #endif -#ifndef TARGET_SPARC64 - ncp_insn: - gen_exception(dc, TT_NCP_INSN); - return; -#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Tue Oct 17 06:11:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734291 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324292wro; Mon, 16 Oct 2023 23:21:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAYCzGlqkqEH2WCHHgJezHaC8Rdw2kh3FFDTe1d+2yDK6qELdLqG9TaPuxaMb0gaJLNSTz X-Received: by 2002:a05:6214:1090:b0:66c:eef9:4154 with SMTP id o16-20020a056214109000b0066ceef94154mr1277168qvr.23.1697523671177; Mon, 16 Oct 2023 23:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523671; cv=none; d=google.com; s=arc-20160816; b=QF28YauLYYvDA06j0bfr/LDh3gUZlnIp495q5MnWFzg6AtYSUmInfXHqftEPMQDIaF TcA2ZGaXvPjAdrCBmj1UYClhi69TDvQZvv5wnc8Y1E3dlpSKN3UAri1lhCVtoGbc3Wip BCNsMvzbOgf3tvmBelbRujPR5naHy4NNlu2e/3kFubPMyEe5f03PD8FDdoS2VZAuUvfB MeJqKID+9Ez1fL/oY9uVsxUS9joYKHQQ3WcF5b9ZK0NKn5299rjkpnGWpIOK/1zKb/lk Hyy8QsJvsNTO14a80Sk7G/kKCk7bIS/Mwbhh+FH+Y8KCPw3PaxbHtBU0gRP47sYhEesc HChg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=tCaWSL3D8+ipKSjTkBG+OGzcsgjBm0vQFdSSgOXGgrI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=R+dRpjr8saQwvPLNnPxFeeaWnMrgJvj053WD15etAF9DKavs7ZtT+V4SwuYNNEvOGX 7jo9bdf5f5hTPQZH/skEksiiEC3oQ8PbecKERsGPiqlkTOX5SYkiDjniUXoPqc5ThNcZ 2yxnf7+ZeOR0cYfy2YXNM4hWcAF42A1aErI6oqQ6lkgTe48UIiUY1oiI0zXnzpv7Kh3E hQwiwKBkKIRIr1lw1ffwCmDOQM8xiUgugoPHuZbD2NJKK2GWXTobW9Wud6CpvAgclVWg HxuMljA7VOk16xxkyZ9pvwB80nC+R8sTXM6StM+q9xUJGs121QS4zlg3GSPwXzsFRyEB /stg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DS3ZBNB5; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l6-20020a0cc206000000b0066d08b5a900si521166qvh.557.2023.10.16.23.21.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:11 -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=DS3ZBNB5; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNj-00034N-Jn; Tue, 17 Oct 2023 02:16:43 -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 1qsdNQ-0002GZ-G3 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:24 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNN-0004ez-OE for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:24 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9daca2b85so39443545ad.1 for ; Mon, 16 Oct 2023 23:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523380; x=1698128180; 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=tCaWSL3D8+ipKSjTkBG+OGzcsgjBm0vQFdSSgOXGgrI=; b=DS3ZBNB5CeZWiwegJ5Ba9pMZVvL6BCPU4c7GctbqqaURe4qyPopGH5xbLdH2G+CP4W Bh6R3gx32axYhN+S4gAe3JsD8IDx+nmrwk1CLO4SQpxkluwBg3H2aukkOm9RaD2zccjP t3ylNqDM2XoSBqeV9Ol7lknLNwY40I8G3ewfVWmDFUnBjCKF26TnxMmTx+en/8dmNgA/ Goypj6Gu0zcWZz6Jn1AoGpD93+UsORpqpuFYZQ6NH5t0Hd85rHgyRpjnNz5x4QUqtsTy hpeKVX4OJu2edkLS8+B2IXCMHu9TZrnn6l3ve0F9pQG03fufWbfKCBCISoSkLBBc0CR8 2n7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523380; x=1698128180; 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=tCaWSL3D8+ipKSjTkBG+OGzcsgjBm0vQFdSSgOXGgrI=; b=uSUbAGlXDh0oJBRtw++jEkKkGttZumVtEaXprRquH7lyeVh5MgX50kffydtQXhi6hH p4gQUoyypbxBTKIUa3t9H6IcP/92k1vPXf2GC1v4EL4zq4r2ZaldqYUgfY3fMo31Q6pw ZIoIiYiFCyodmxjaNvOHqO+JsXK1eZ0jAshFEq8spbLbFdwrqpj+txtqYUlW0F3ZsY28 hoExOn6OqTt8n1FBOB8NPpqC905fiydqM+TERO3bFA/P0uP2QM1NEUZ/tqQqKRNgRMSt p9zaEOUvh1hFmxVJdCo8zFYrklhV+aGxGo+TtBD8ONrOK9xyYfrwJJhXDhpgPA/U/JhB 2PtA== X-Gm-Message-State: AOJu0Yy549erHZRbeshLxgtMLFgZBzFFNwXPgiGkoxV9YjT0OW9h4A/X CjgyMasEfyE+jwMxY2WLT5vAHRqF4iXijQTYE10= X-Received: by 2002:a17:902:c945:b0:1b6:a37a:65b7 with SMTP id i5-20020a170902c94500b001b6a37a65b7mr1422200pla.23.1697523380216; Mon, 16 Oct 2023 23:16:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 41/90] target/sparc: Move JMPL, RETT, RETURN to decodetree Date: Mon, 16 Oct 2023 23:11:55 -0700 Message-Id: <20231017061244.681584-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 6 ++ target/sparc/translate.c | 126 ++++++++++++++++++++++++-------------- 2 files changed, 87 insertions(+), 45 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index bdbf6d987c..060ee79db0 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -211,6 +211,12 @@ MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 +JMPL 10 ..... 111000 ..... . ............. @r_r_ri +{ + RETT 10 00000 111001 ..... . ............. @n_r_ri + RETURN 10 00000 111001 ..... . ............. @n_r_ri +} + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5af642a637..bf8d611942 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -40,6 +40,7 @@ #define gen_helper_rdpsr(D, E) qemu_build_not_reached() #define gen_helper_wrpsr(E, S) qemu_build_not_reached() #define gen_helper_power_down(E) g_assert_not_reached() +#define gen_helper_rett(E) qemu_build_not_reached() #else #define gen_helper_rdccr(D, E) qemu_build_not_reached() #define gen_helper_rdcwp(D, E) qemu_build_not_reached() @@ -4446,6 +4447,85 @@ static bool trans_MOVR(DisasContext *dc, arg_MOVR *a) return do_mov_cond(dc, &cmp, a->rd, src2); } +static bool do_add_special(DisasContext *dc, arg_r_r_ri *a, + bool (*func)(DisasContext *dc, int rd, TCGv src)) +{ + TCGv src1, sum; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!a->imm && a->rs2_or_imm & ~0x1f) { + return false; + } + + /* + * Always load the sum into a new temporary. + * This is required to capture the value across a window change, + * e.g. SAVE and RESTORE, and may be optimized away otherwise. + */ + sum = tcg_temp_new(); + src1 = gen_load_gpr(dc, a->rs1); + if (a->imm || a->rs2_or_imm == 0) { + tcg_gen_addi_tl(sum, src1, a->rs2_or_imm); + } else { + tcg_gen_add_tl(sum, src1, cpu_regs[a->rs2_or_imm]); + } + return func(dc, a->rd, sum); +} + +static bool do_jmpl(DisasContext *dc, int rd, TCGv src) +{ + /* + * Preserve pc across advance, so that we can delay + * the writeback to rd until after src is consumed. + */ + target_ulong cur_pc = dc->pc; + + gen_check_align(dc, src, 3); + + gen_mov_pc_npc(dc); + tcg_gen_mov_tl(cpu_npc, src); + gen_address_mask(dc, cpu_npc); + gen_store_gpr(dc, rd, tcg_constant_tl(cur_pc)); + + dc->npc = DYNAMIC_PC_LOOKUP; + return true; +} + +TRANS(JMPL, ALL, do_add_special, a, do_jmpl) + +static bool do_rett(DisasContext *dc, int rd, TCGv src) +{ + if (!supervisor(dc)) { + return raise_priv(dc); + } + + gen_check_align(dc, src, 3); + + gen_mov_pc_npc(dc); + tcg_gen_mov_tl(cpu_npc, src); + gen_helper_rett(tcg_env); + + dc->npc = DYNAMIC_PC; + return true; +} + +TRANS(RETT, 32, do_add_special, a, do_rett) + +static bool do_return(DisasContext *dc, int rd, TCGv src) +{ + gen_check_align(dc, src, 3); + + gen_mov_pc_npc(dc); + tcg_gen_mov_tl(cpu_npc, src); + gen_address_mask(dc, cpu_npc); + + gen_helper_restore(tcg_env); + dc->npc = DYNAMIC_PC_LOOKUP; + return true; +} + +TRANS(RETURN, 64, do_add_special, a, do_return) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5243,30 +5323,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x37) { /* V8 CPop2, V9 impdep2 */ goto illegal_insn; /* in decodetree */ -#ifdef TARGET_SPARC64 - } else if (xop == 0x39) { /* V9 return */ - save_state(dc); - cpu_src1 = get_src1(dc, insn); - cpu_tmp0 = tcg_temp_new(); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - tcg_gen_addi_tl(cpu_tmp0, cpu_src1, simm); - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2) { - cpu_src2 = gen_load_gpr(dc, rs2); - tcg_gen_add_tl(cpu_tmp0, cpu_src1, cpu_src2); - } else { - tcg_gen_mov_tl(cpu_tmp0, cpu_src1); - } - } - gen_check_align(dc, cpu_tmp0, 3); - gen_helper_restore(tcg_env); - gen_mov_pc_npc(dc); - tcg_gen_mov_tl(cpu_npc, cpu_tmp0); - dc->npc = DYNAMIC_PC_LOOKUP; - goto jmp_insn; -#endif } else { cpu_src1 = get_src1(dc, insn); cpu_tmp0 = tcg_temp_new(); @@ -5284,28 +5340,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } switch (xop) { case 0x38: /* jmpl */ - { - gen_check_align(dc, cpu_tmp0, 3); - gen_store_gpr(dc, rd, tcg_constant_tl(dc->pc)); - gen_mov_pc_npc(dc); - gen_address_mask(dc, cpu_tmp0); - tcg_gen_mov_tl(cpu_npc, cpu_tmp0); - dc->npc = DYNAMIC_PC_LOOKUP; - } - goto jmp_insn; -#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) case 0x39: /* rett, V9 return */ - { - if (!supervisor(dc)) - goto priv_insn; - gen_check_align(dc, cpu_tmp0, 3); - gen_mov_pc_npc(dc); - tcg_gen_mov_tl(cpu_npc, cpu_tmp0); - dc->npc = DYNAMIC_PC; - gen_helper_rett(tcg_env); - } - goto jmp_insn; -#endif + g_assert_not_reached(); /* in decode tree */ case 0x3b: /* flush */ /* nop */ break; From patchwork Tue Oct 17 06:11:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734284 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323691wro; Mon, 16 Oct 2023 23:18:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvnH5bQUc845EDK1xOOHaQ44J9dFqTUGWBSYo2+QKOj0cEyfv3p07Z9LQtlKug69OsenMl X-Received: by 2002:a05:620a:2947:b0:777:74c0:4f3b with SMTP id n7-20020a05620a294700b0077774c04f3bmr1116994qkp.76.1697523539668; Mon, 16 Oct 2023 23:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523539; cv=none; d=google.com; s=arc-20160816; b=SxM93fBhu9Vw6cfii/dLhqQa29Da3wGZsO1EFY2XMMsbwW/6KnMhEcSbYShLmKCntr eJfcfA0VkH/+lLy48e3DM2HoiVa+hKWliUCW7NwyxT4UafnlcUnx72LyHb1tVWghAz2j 7SQBneEx9r0J3vckxEoza3g6ZeHpKn1+oLSkTIpawFBC2obAmGtmMv0YSwizxNO4oQtd Mc4UOtozqUANCqHqjgcBPXyn6Z9PzPYSE8m17XQd1Z+/KE5keFjEWxqA93PibjWb8EtX jh7P/aEvfrGWipLhwACFYWioBLnErTXgR9dl2wILdWMgLzqHlKJNW4T1rZiDHwCjG0s+ Ihog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=ExtlfcmBRE2sB2/CWMkspqZTp25HPrR30GPM9tlU6fg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=pC28bYnCQlGzKmHsM6YuZKvGclK1eWhFKe1bPgt7nDMu4xAXEiGIkW8a+Jr5D8vnXZ C1NuwSzJ7yd7idEA62sjPnV8tqx4wXCLhhTM1uiFCuXhzK3kW5PxnkBbONEITdpLH6fc +c+Etu6JFpxXGk8lrTprap028Mn0RioAPC+9lYkJH9A/3HIyfuhOTjs86wTPcMOHsYBW blcnczZPqmUXGYLbLb4Rs6JLssUEgnAwU5fDV/yvBnE+slPC3MfZaD3b/H0I5alqeEe8 djMaMuIdgm8YrVz8BW2vMOy98+y9dftnNnTyL2miog/hvSP1TXsrDgN5u22pzSYL4k6P qK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ps5rbuSq; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id az17-20020a05620a171100b00775a6554b41si633305qkb.285.2023.10.16.23.18.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:59 -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=ps5rbuSq; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNU-0002eS-9I; Tue, 17 Oct 2023 02:16:28 -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 1qsdNQ-0002Hq-K4 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:24 -0400 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNO-0004f8-GZ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:24 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-57b8cebf57dso2797760eaf.0 for ; Mon, 16 Oct 2023 23:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523381; x=1698128181; 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=ExtlfcmBRE2sB2/CWMkspqZTp25HPrR30GPM9tlU6fg=; b=ps5rbuSqCxYnNhjFl3Ve5e0yP5c51DqgmMKVqqhAWm7gXOZemFVwdUb/b5Lc9qSV96 I7oe2KAIqofQUS8XbPa2gUn5m0YOI9ICBydhPssPgBShqCov77Udxv7/414LnJ5liuUO gfp/Pfv6RecSUrKSmrzJ1eC+0+QqlVUUi7d6R/38ZuLhWUr4CzcnfO/2afxk+CPxPRmP pPRxUUy8TCkB2qo8l9L5xEAL2dcftaULrH82jmzExJqUn/xO6iYXWDr/oXSh1xsHFHYq AB7ocQQkGmaBr6Rey+TDn9PUYjSqlnQnB0a8ghCWzrXJCw+5cxa8rawqY7laVs7T1Fxo xy4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523381; x=1698128181; 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=ExtlfcmBRE2sB2/CWMkspqZTp25HPrR30GPM9tlU6fg=; b=DcUXC455sD1DotbW/+adN2bBfJG5wKeBrep41K5cAOovY1yZ0sYiGfuDGOH901fi98 ruhYIWCSq/LmCk0jQYtQo6EayBgXSQ5fnGy0gfDIOtnVEZetis2iKArFprxFojJeNK5c dqLEq07j11xrS1ho6jVT/903psUijKBecw4DAfbP1mveCA8p4kG45V4Z02s0UvrIjvoQ 4SBnNtPaim6zpmYYg0+kFSak3c+vgcHMFzChMn56b/n7Pdr8uY4aVanuCW2kemIrydsr 8pOCn83ctLWOoqjc4CUNQkjVnCKJx1KS7o+I5icfTjcLoS2L+P+oiW3LqCOj9blNgAiF 9S+A== X-Gm-Message-State: AOJu0YxBWOYkYy3TADtxXBFPK7hn7/I7Ah2LiWQDiY0FUlw5Bi+5pG51 qj5I2y89dX0cOXofSmUdJWhe/MmMtwnhAkuw4LY= X-Received: by 2002:a05:6359:2f81:b0:164:8225:83a8 with SMTP id rs1-20020a0563592f8100b00164822583a8mr1629604rwb.0.1697523380925; Mon, 16 Oct 2023 23:16:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 42/90] target/sparc: Move FLUSH, SAVE, RESTORE to decodetree Date: Mon, 16 Oct 2023 23:11:56 -0700 Message-Id: <20231017061244.681584-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2d; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2d.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++++ target/sparc/translate.c | 35 +++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 060ee79db0..9c4c493630 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -216,6 +216,10 @@ JMPL 10 ..... 111000 ..... . ............. @r_r_ri RETT 10 00000 111001 ..... . ............. @n_r_ri RETURN 10 00000 111001 ..... . ............. @n_r_ri } +NOP 10 00000 111011 ----- 0 00000000----- # FLUSH reg+reg +NOP 10 00000 111011 ----- 1 ------------- # FLUSH reg+imm +SAVE 10 ..... 111100 ..... . ............. @r_r_ri +RESTORE 10 ..... 111101 ..... . ............. @r_r_ri NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index bf8d611942..5fc46d1b20 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4138,6 +4138,11 @@ static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) TRANS(SAVED, 64, do_saved_restored, gen_helper_saved) TRANS(RESTORED, 64, do_saved_restored, gen_helper_restored) +static bool trans_NOP(DisasContext *dc, arg_NOP *a) +{ + return advance_pc(dc); +} + static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) { /* @@ -4526,6 +4531,24 @@ static bool do_return(DisasContext *dc, int rd, TCGv src) TRANS(RETURN, 64, do_add_special, a, do_return) +static bool do_save(DisasContext *dc, int rd, TCGv src) +{ + gen_helper_save(tcg_env); + gen_store_gpr(dc, rd, src); + return advance_pc(dc); +} + +TRANS(SAVE, ALL, do_add_special, a, do_save) + +static bool do_restore(DisasContext *dc, int rd, TCGv src) +{ + gen_helper_restore(tcg_env); + gen_store_gpr(dc, rd, src); + return advance_pc(dc); +} + +TRANS(RESTORE, ALL, do_add_special, a, do_restore) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5341,18 +5364,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { case 0x38: /* jmpl */ case 0x39: /* rett, V9 return */ - g_assert_not_reached(); /* in decode tree */ - case 0x3b: /* flush */ - /* nop */ - break; + case 0x3b: /* flush */ case 0x3c: /* save */ - gen_helper_save(tcg_env); - gen_store_gpr(dc, rd, cpu_tmp0); - break; case 0x3d: /* restore */ - gen_helper_restore(tcg_env); - gen_store_gpr(dc, rd, cpu_tmp0); - break; + g_assert_not_reached(); /* in decode tree */ #if !defined(CONFIG_USER_ONLY) && defined(TARGET_SPARC64) case 0x3e: /* V9 done/retry */ { From patchwork Tue Oct 17 06:11:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734303 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324654wro; Mon, 16 Oct 2023 23:22:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH89F8pMgSN64jk+k7Dlgz7agRWLs58dCRztm3gJdgmKmCdsPTU/2gBPnkl1pnoBMuQTa+w X-Received: by 2002:a05:620a:2687:b0:76f:b00:4e66 with SMTP id c7-20020a05620a268700b0076f0b004e66mr1210157qkp.9.1697523747880; Mon, 16 Oct 2023 23:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523747; cv=none; d=google.com; s=arc-20160816; b=rAZS7dncGmWQXag8dwg+EO1L52m5RNzaCnk2az47TruDX4VZt0/MbQNPD9HeJY5hN2 JG8d79b43g531wk602CVZWt4bQrNYW1+wP5zNwkX8n4ZJkXHd2bOePrebw50ndUe+JHk iJIR5mQZY3BVbREaxY0pvT+1NIMLhxN450kxAmV+SrgxC7O5l+NHDVe/p107yJu3bRDZ jA4H/o8awu/soFocKORdms52hfLTGQobigPXvH+FfFROtG7OuWnljqX4F4hIk7FU8iz0 OCIEMWb7XE3vWUNmQaEIngdW9hNWAPQEdqu5qB67HOl8xFSEk+fqgDr9bYCI2E5DaTNz hIMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=bifKoxTReoGUtyt9dEyNfA9Pc21VjUiLamdfYMd5Ikg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=U+dfCdPrMOaz5wo72GrCa/RDo/QUse/a7GpNaIMy1MqXqq1+XIaPChO4mpFqsIwiLz EcMtgStM9txVbJ8MMl1B4WtPCxuHEKOvfBd9GYoLwhN+jGuGnhMcMizx5HyKWNs6ATmJ zeATYk9HhJjs4r66l5CccENl3/KWgEpJAjWU8oBD++n549Csnpf6VWNRe/+E14FMIMJ+ qZ24ZurGFDpwEjvXIbBMEP/xd1BXp9vSTY8ZEcnfo+YVT9rIb5x3eq8Db8BTYz1HHqDx qNU+mYy2nSLRptViwyk8NqnenjIH7aUl3j9WMfQwAoKQRgvTBVrglrNUHxnnD9Fsxjs8 uqWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NdGzT0aC; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x23-20020a05620a099700b007759f941a54si578089qkx.587.2023.10.16.23.22.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22:27 -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=NdGzT0aC; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNm-0003KY-V0; Tue, 17 Oct 2023 02:16:47 -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 1qsdNR-0002O6-Hj for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:25 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNP-0004fI-9K for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:25 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1640750b3a.0 for ; Mon, 16 Oct 2023 23:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523382; x=1698128182; 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=bifKoxTReoGUtyt9dEyNfA9Pc21VjUiLamdfYMd5Ikg=; b=NdGzT0aCFfN8YO7BUvMbPQfDRyk2mmOeF5Qakr1v/3xTLYdElxs8560befG4UKEy+V ZlZQplpBlLkZMSSqmPyAYMkLM0xTb2vSqR8+jfv4UvVcTQwB9UIwuw+2JPDMURvlEtL3 xkU+q8FC6DbN9ypTYstwlPX7DofTNjqOcAUMAvdwvH124h6TTUXCZOKT8Cp+WMOnQyw4 wdcrSsZCigh0JpPWeA/LlLnEDuZnb7HIZqEd9D7Es/DhS+iPTumpG6W2kR38HC0DfCxX ZpUXqOjryb5VN4DvofQO37mfeJSq6vn6fo7qeHngmV0vg32JEpP9alqHKCZLEGisiiFR TrKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523382; x=1698128182; 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=bifKoxTReoGUtyt9dEyNfA9Pc21VjUiLamdfYMd5Ikg=; b=FE2fwI1SAUK3YvR9Gb1oSRoNbfV+WFQou7A7xcWbweMwFfDR2EwLS6OzlqGBcJVwH7 qgNtF9kjXrbuvIk6YDeihxot15ZDkc+8xEM6AjKHFycFlbdPsXp/XCWr3wvqMbnXj4yH mtAPKqJHobk26LJC7LkcNwX1HLBoxDWa5Dzb7D+EZhMgDQizJbSMTgHdF3HptS1IJYey 9Ikg1ej+JE1mGbhNRn2C3NzUjL0fRXKsEYlgjP8XDIpUsTIzN0LveB4/9fxOhRjw909Q Rsit7oXBneLICZPWP8+Fuxv0IAtRNuBsqR8zqFlWDqxQptICfgH/JgOplhkXfAa+Ec80 3vUw== X-Gm-Message-State: AOJu0YyG2HLFzv2ol9R9y+JPJdRtr48ChvpaBiTDdF8ZqKy/Jr7D7l80 8+fryCt3qA2Ch+k9mY5aZ22Dzxyv5lRrL7tGTkc= X-Received: by 2002:a05:6a00:b46:b0:690:f877:aa1e with SMTP id p6-20020a056a000b4600b00690f877aa1emr1436532pfo.12.1697523381733; Mon, 16 Oct 2023 23:16:21 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 43/90] target/sparc: Move DONE, RETRY to decodetree Date: Mon, 16 Oct 2023 23:11:57 -0700 Message-Id: <20231017061244.681584-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 99 +++++++++++++++------------------------ 2 files changed, 40 insertions(+), 62 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 9c4c493630..dface4a9dd 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -221,6 +221,9 @@ NOP 10 00000 111011 ----- 1 ------------- # FLUSH reg+imm SAVE 10 ..... 111100 ..... . ............. @r_r_ri RESTORE 10 ..... 111101 ..... . ............. @r_r_ri +DONE 10 00000 111110 00000 0 0000000000000 +RETRY 10 00001 111110 00000 0 0000000000000 + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5fc46d1b20..784a019dcf 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -54,6 +54,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_done(E) qemu_build_not_reached() +#define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() #endif @@ -4549,6 +4551,36 @@ static bool do_restore(DisasContext *dc, int rd, TCGv src) TRANS(RESTORE, ALL, do_add_special, a, do_restore) +static bool trans_DONE(DisasContext *dc, arg_DONE *a) +{ + if (!avail_64(dc)) { + return false; + } + if (!supervisor(dc)) { + return raise_priv(dc); + } + dc->npc = DYNAMIC_PC; + dc->pc = DYNAMIC_PC; + translator_io_start(&dc->base); + gen_helper_done(tcg_env); + return true; +} + +static bool trans_RETRY(DisasContext *dc, arg_RETRY *a) +{ + if (!avail_64(dc)) { + return false; + } + if (!supervisor(dc)) { + return raise_priv(dc); + } + dc->npc = DYNAMIC_PC; + dc->pc = DYNAMIC_PC; + translator_io_start(&dc->base); + gen_helper_retry(tcg_env); + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4560,7 +4592,8 @@ TRANS(RESTORE, ALL, do_add_special, a, do_restore) static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; - TCGv cpu_src1, cpu_src2; + TCGv cpu_src1; + TCGv cpu_src2 __attribute__((unused)); TCGv_i32 cpu_src1_32, cpu_src2_32, cpu_dst_32; TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; target_long simm; @@ -4575,9 +4608,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ { - unsigned int xop __attribute__((unused)) = GET_FIELD(insn, 7, 12); + unsigned int xop = GET_FIELD(insn, 7, 12); TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); - TCGv cpu_tmp0 __attribute__((unused)); if (xop == 0x34) { /* FPU Operations */ if (gen_trap_ifnofpu(dc)) { @@ -4897,8 +4929,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } - } else if (xop < 0x36) { - goto illegal_insn; /* in decodetree */ } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ @@ -5340,65 +5370,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } -#else - g_assert_not_reached(); /* in decodetree */ #endif - } else if (xop == 0x37) { - /* V8 CPop2, V9 impdep2 */ - goto illegal_insn; /* in decodetree */ } else { - cpu_src1 = get_src1(dc, insn); - cpu_tmp0 = tcg_temp_new(); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - tcg_gen_addi_tl(cpu_tmp0, cpu_src1, simm); - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2) { - cpu_src2 = gen_load_gpr(dc, rs2); - tcg_gen_add_tl(cpu_tmp0, cpu_src1, cpu_src2); - } else { - tcg_gen_mov_tl(cpu_tmp0, cpu_src1); - } - } - switch (xop) { - case 0x38: /* jmpl */ - case 0x39: /* rett, V9 return */ - case 0x3b: /* flush */ - case 0x3c: /* save */ - case 0x3d: /* restore */ - g_assert_not_reached(); /* in decode tree */ -#if !defined(CONFIG_USER_ONLY) && defined(TARGET_SPARC64) - case 0x3e: /* V9 done/retry */ - { - switch (rd) { - case 0: - if (!supervisor(dc)) - goto priv_insn; - dc->npc = DYNAMIC_PC; - dc->pc = DYNAMIC_PC; - translator_io_start(&dc->base); - gen_helper_done(tcg_env); - goto jmp_insn; - case 1: - if (!supervisor(dc)) - goto priv_insn; - dc->npc = DYNAMIC_PC; - dc->pc = DYNAMIC_PC; - translator_io_start(&dc->base); - gen_helper_retry(tcg_env); - goto jmp_insn; - default: - goto illegal_insn; - } - } - break; -#endif - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } - break; } break; case 3: /* load/store instructions */ @@ -5795,7 +5770,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; -#if !defined(CONFIG_USER_ONLY) +#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) priv_insn: gen_exception(dc, TT_PRIV_INSN); return; From patchwork Tue Oct 17 06:11:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734271 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323418wro; Mon, 16 Oct 2023 23:18:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF21FVF3uS/ta514Rhrqai1aN6nThaoKU/3W8VWNbldxveZRmmPjskGP2Ke8NuFZY5LXL7p X-Received: by 2002:a05:620a:1727:b0:767:c30:517 with SMTP id az39-20020a05620a172700b007670c300517mr1121414qkb.3.1697523483060; Mon, 16 Oct 2023 23:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523483; cv=none; d=google.com; s=arc-20160816; b=JQfoCOqgoVjMsjAKIP3FV7Ubw1zCBO9WPmdz07HUvLYEJ6+/XycsNMkF4Q5QSgVYTJ b5KdxsMcAW++7goEsTxFwtJwgJWkR3UB6lp+Y0Ga5q+X0voFNsGr5N+UqOvW1BlFV12F yNKjevSBg5Mw1bHbx7/dYPQePK4mFAiAh3PxNaFqtZD5iX1M3A1Jkuvoq6CKdCbSGFMy JrOXtLGHMV+HhpeVv62Xr+Z9y9qcRuE62RrLOmcJsCBBfuXXdfNWgVzAhkCsPYb6mgL9 TE7NfRUTZHTxfvxqbY54VijchibehVZMIADk3e6ziYOZuJ9f8OZFMliQrChFuZfAYMn6 wbCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=wmNAKobzs1tBTX3N5VeSlsY1hTDzbAPwToQ6SBu8p38=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=decG32wR6RPWYe9fYvowgSkxDSzS8hLw1TMw6T7UpUwriDzfUDPwUpApSXHkym/0Tq 239ckHPPEDeRzxJ6ANyx76ANSL5/sFlGwB4X1KMsGXVkQvuVPAaFTxXolg8mlKaV2Bns IW5zSFJjd4vmTImZFcg8WTecRraw1LJd+ezvdjkUxY5EnOmbIpgeVSA4iFYOG5SVRqEo BztZ3y93rUN+n6TDSJBeMOiT/miOi8tJa7ssTp/0PUyCSf2HyYCDXfrrz+XNUTSGWNKq WOY72RTKwEVE+1IDlecq/Lk7qfOSCwMYe+XYvidyTy2/jpKzjaMMpw7jVzh4pgjYd8oE eBZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UyeCm1jJ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jt8-20020a05621427e800b0066d12b4f281si536073qvb.477.2023.10.16.23.18.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:03 -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=UyeCm1jJ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNb-0002rm-IW; Tue, 17 Oct 2023 02:16:38 -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 1qsdNR-0002Tf-VZ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:26 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNQ-0004fc-79 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:25 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1640762b3a.0 for ; Mon, 16 Oct 2023 23:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523382; x=1698128182; 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=wmNAKobzs1tBTX3N5VeSlsY1hTDzbAPwToQ6SBu8p38=; b=UyeCm1jJ7eF/Qg/R1c9cOVuaZBX1+S70HWZJiSEpeiOpBtRciblfxiNqeMGvBjiQWb BhBHIhYRggDm/CGlKRZQ2N8xOhJjUJ4ipe7eyctE0yXH8zpSAkaFG0QGfNUaFZlR1Qh0 qzc7k/LNOmmrrAz67yzD3z9hNBmeTQv0rSAl9pSvMr2DX0COoMZwq2MMN4BVlfM17yWJ lHGC9ztU5F1DwPl4tpIK73QPGEm1Y0h1RRl2XFEo7P87CW7xgrWU1iG3/EKNdrZ1l+tC 3+s4DkZoC4Cf5t09f8jVBUo7lqajcKipNlyEH2b0q5ypDiI/BXJqwLZHIwn4xJaXC8zd Cu0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523382; x=1698128182; 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=wmNAKobzs1tBTX3N5VeSlsY1hTDzbAPwToQ6SBu8p38=; b=Df6OQ7u9/EiHwjSb6Eh0RqGRp53u99H/NMLZrQnkK+OLDXDLWkx8S0TGWoVAyOozpW /1Yi3jZq5Y7n18d9fQh+FWP8qxBLXfr3m8uAw0fQiEkTUzbuzB51cu2h3RXIhjmGURfB qFIdYtySzHlGsexN1YT57W04bB2NYNcdFupCsaohpBds/fX8e1sikupGL93MbmjQAMC6 F8DuMylwYfe7BB7P2LRde5XDqmZ1B4nC+w5IEe8Cp+NJ5m9roF5myu3U3e9Fv3qJAFNs 9dcejPTIul9APZ9qojD4tph/ZrJ1G6/q0uogUhz3I8wEuMjEOrW5SUNGagu9R0Yojfkd DMoA== X-Gm-Message-State: AOJu0Yzu/WejBvar1QqbgkLx5wZRpxe/UFQopVgGa3bbhaRPixtyfaX3 d+f9vMdv1+mwXnbGt0nYe7fFIoz2OekLtKsiAGk= X-Received: by 2002:a05:6a00:290f:b0:68f:c1e0:a2c4 with SMTP id cg15-20020a056a00290f00b0068fc1e0a2c4mr1549061pfb.3.1697523382537; Mon, 16 Oct 2023 23:16:22 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 44/90] target/sparc: Split out resolve_asi Date: Mon, 16 Oct 2023 23:11:58 -0700 Message-Id: <20231017061244.681584-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 Signed-off-by: Richard Henderson --- target/sparc/translate.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 784a019dcf..1d3bfb724e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1864,15 +1864,25 @@ typedef struct { MemOp memop; } DisasASI; -static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) +/* + * Build DisasASI. + * For asi == -1, treat as non-asi. + * For ask == -2, treat as immediate offset (v8 error, v9 %asi). + */ +static DisasASI resolve_asi(DisasContext *dc, int asi, MemOp memop) { - int asi = GET_FIELD(insn, 19, 26); ASIType type = GET_ASI_HELPER; int mem_idx = dc->mem_idx; + if (asi == -1) { + /* Artificial "non-asi" case. */ + type = GET_ASI_DIRECT; + goto done; + } + #ifndef TARGET_SPARC64 /* Before v9, all asis are immediate and privileged. */ - if (IS_IMM) { + if (asi < 0) { gen_exception(dc, TT_ILL_INSN); type = GET_ASI_EXCP; } else if (supervisor(dc) @@ -1915,7 +1925,7 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) type = GET_ASI_EXCP; } #else - if (IS_IMM) { + if (asi < 0) { asi = dc->asi; } /* With v9, all asis below 0x80 are privileged. */ @@ -2074,9 +2084,16 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) } #endif + done: return (DisasASI){ type, asi, mem_idx, memop }; } +static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) +{ + int asi = IS_IMM ? -2 : GET_FIELD(insn, 19, 26); + return resolve_asi(dc, asi, memop); +} + static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) { From patchwork Tue Oct 17 06:11:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734326 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326230wro; Mon, 16 Oct 2023 23:27:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6L1Ms839rJVjWaQ/Ochrok9XrdUm015/yKs/iBoxFYxXUjNLt8pBhwvJM7cF3LYiizSnj X-Received: by 2002:ad4:5aa8:0:b0:65b:17e9:1c90 with SMTP id u8-20020ad45aa8000000b0065b17e91c90mr1794549qvg.27.1697524040687; Mon, 16 Oct 2023 23:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524040; cv=none; d=google.com; s=arc-20160816; b=s0ztwY3j2LJXMbZiAF33+qcmiJEMS7CuDxS8DoQrADMlf5T+Ci5DAbybWIOwTSbgN6 bNlLlauhgjEJRcLTlynUlR2RePgICos20hldtiA2UUXI+LaARlRv1yKKj9E/5nTdbPxZ sh7iJX10ncsnWbaGpwILBzJCxlktEH41CGRykLY240pkVYPLJ2/o601L6cCqZWFnNRy+ TD6IiMYt6qnIxUm6ZgMLAU0v5lKosqRoleVPd/dZ2zLrZlRIWc02xQqhiQaihRN2zp9i wHYko/+U1OARpJCeNXGmls2Pxpgf2m/yveA/MP0o560HRNebwr3m1+/VQPAPexZB4B5Q I3OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=yIdv4hx783oHJ/Rv5v17K5kZUyzvz0qQFAi5WSlSZKU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=vvN0fhn5S2OTyGFGG921Hy8ZZDC2EBrHoHrMF4BgewusJq74k7h2YeViL88F3k9F9d tO9oDn04KvxPDN974GU7U6XIf7fAl5hEluXYoEyjcszUjp0SZxhno1lxw0S3damIbnjq yrkcm8xbFeNVSR5ORh+hLX6/oEwyu3PnS1nD0puhouqRXRq7mWobon1IOLb8NzaQxC7B +/jS8mVZzbF+y/VB3dKVDysWEPxKjRdnTVMKcPsDpEFHmKRYDzLgAHhNk7kwmp9COVbW XmualSUItc8g5iFYLHDWY87yX8Ca4oPzCe6FoCtk3+IyglF7NG8OlVzObXCi2lTYvBeh 2Vhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EoLOl1Qa; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id el18-20020ad459d2000000b0065b2cca41a2si555958qvb.110.2023.10.16.23.27.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:27:20 -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=EoLOl1Qa; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNo-0003P9-4C; Tue, 17 Oct 2023 02:16: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 1qsdNT-0002m5-JQ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:28 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNQ-0004fq-PZ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:27 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-57bb6a2481fso2702037eaf.1 for ; Mon, 16 Oct 2023 23:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523383; x=1698128183; 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=yIdv4hx783oHJ/Rv5v17K5kZUyzvz0qQFAi5WSlSZKU=; b=EoLOl1QaJSL777vbgB3o9pnKnSrjLQnVuFyHlSr7+iL3c/LTeCkUj/3CpL10Y5pwns Yt44U3yfVQUF1he946QcI2HgkC2Ym8xvuvKZ/pz7bYIbi89QuTg55i638JQxKTOgHoSa cSrjBp1cPlCPHMkDGsEJnfrjbqUFnz1Ob86NX5ysfD56oQYa1lcmYyjKaUtC8oFMAHcx RD1SDLi4wzQ8m4aXiP6Pk5jkwtrA0KcpLox+uV1FiNo8I9YVdO6zH+r0Oqqoydop2xNb z0aHVOzoQZB9xV16Osbhd2lORd0aYNqtrnQ3HtREPvdUG9SWwTie+3vhfiCRGKlDKYTa bMuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523383; x=1698128183; 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=yIdv4hx783oHJ/Rv5v17K5kZUyzvz0qQFAi5WSlSZKU=; b=aMNLu48eiB9NSzTQ5G0+PI+YvPaHSgfWokeyqlGJUvwqK87M1U88nLyPNqUYR6/ZXF o8J8AnPAvgPAAQCBeFLQJA5uB5p5inALY9HwSRPCM0h/t5px1y4o/dh9eDgmVG95P+bz i4SpF8DqtoWtx65HVBmL75Yfh821i9jl8S21sr/KTcMLEUbnumrMQXykbuQ1JAZGrACN 01QLfd8qfKe9mok43hdcg+TDSR4NvUIhh2kVnsh+SL6JyL9x1+sAQiI4KtV3JNtkixOr S1lKMFcPDDbkpv4u50+n+Ts5PEuArONxE2na9kdECiEUNEkWj3adSGvwDEoDsQO6yXoe sGCw== X-Gm-Message-State: AOJu0Ywojj8tVJ94RcakgmGYjx87+IhRSR3bVgKjLuEJ4MTB6JS8nXAO tyvJjXwf4iDpz96b/Gmn2CdC7Mxkov9ySnTDh2U= X-Received: by 2002:a05:6358:cc15:b0:148:1a09:2469 with SMTP id gx21-20020a056358cc1500b001481a092469mr1377550rwb.25.1697523383403; Mon, 16 Oct 2023 23:16:23 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 45/90] target/sparc: Drop ifdef around get_asi and friends Date: Mon, 16 Oct 2023 23:11:59 -0700 Message-Id: <20231017061244.681584-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.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 Mark some of the functions as unused, temporarily. Fix up some tl vs i64 issues revealed in the process. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 187 +++++++++++++++------------------------ 1 file changed, 70 insertions(+), 117 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 1d3bfb724e..6404ec5858 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,6 +58,18 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() +# ifdef CONFIG_USER_ONLY +static void gen_helper_ld_asi(TCGv_i64 r, TCGv_env e, TCGv a, + TCGv_i32 asi, TCGv_i32 mop) +{ + g_assert_not_reached(); +} +static void gen_helper_st_asi(TCGv_env e, TCGv a, TCGv_i64 r, + TCGv_i32 asi, TCGv_i32 mop) +{ + g_assert_not_reached(); +} +# endif #endif /* Dynamic PC, must exit to main loop. */ @@ -1845,7 +1857,6 @@ static void gen_ldstub(DisasContext *dc, TCGv dst, TCGv addr, int mmu_idx) } /* asi moves */ -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) typedef enum { GET_ASI_HELPER, GET_ASI_EXCP, @@ -2094,8 +2105,8 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) return resolve_asi(dc, asi, memop); } -static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, - int insn, MemOp memop) +static void __attribute__((unused)) +gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) { DisasASI da = get_asi(dc, insn, memop); @@ -2129,8 +2140,8 @@ static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, } } -static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, - int insn, MemOp memop) +static void __attribute__((unused)) +gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) { DisasASI da = get_asi(dc, insn, memop); @@ -2205,8 +2216,8 @@ static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, } } -static void gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, - TCGv addr, int insn) +static void __attribute__((unused)) +gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, TCGv addr, int insn) { DisasASI da = get_asi(dc, insn, MO_TEUL); @@ -2223,8 +2234,8 @@ static void gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, } } -static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, - int insn, int rd) +static void __attribute__((unused)) +gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUL); TCGv oldv; @@ -2245,7 +2256,8 @@ static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, } } -static void gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) +static void __attribute__((unused)) +gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) { DisasASI da = get_asi(dc, insn, MO_UB); @@ -2280,11 +2292,9 @@ static void gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) break; } } -#endif -#ifdef TARGET_SPARC64 -static void gen_ldf_asi(DisasContext *dc, TCGv addr, - int insn, int size, int rd) +static void __attribute__((unused)) +gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); TCGv_i32 d32; @@ -2392,8 +2402,8 @@ static void gen_ldf_asi(DisasContext *dc, TCGv addr, } } -static void gen_stf_asi(DisasContext *dc, TCGv addr, - int insn, int size, int rd) +static void __attribute__((unused)) +gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); TCGv_i32 d32; @@ -2475,21 +2485,23 @@ static void gen_stf_asi(DisasContext *dc, TCGv addr, } } -static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) +static void __attribute__((unused)) +gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv_i64 hi = gen_dest_gpr(dc, rd); - TCGv_i64 lo = gen_dest_gpr(dc, rd + 1); + TCGv hi = gen_dest_gpr(dc, rd); + TCGv lo = gen_dest_gpr(dc, rd + 1); switch (da.type) { case GET_ASI_EXCP: return; case GET_ASI_DTWINX: + assert(TARGET_LONG_BITS == 64); gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_ld_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_ld_tl(lo, addr, da.mem_idx, da.memop); break; case GET_ASI_DIRECT: @@ -2503,9 +2515,9 @@ static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) result is byte swapped. Having just performed one 64-bit bswap, we need now to swap the writebacks. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_extr32_i64(lo, hi, tmp); + tcg_gen_extr_i64_tl(lo, hi, tmp); } else { - tcg_gen_extr32_i64(hi, lo, tmp); + tcg_gen_extr_i64_tl(hi, lo, tmp); } } break; @@ -2525,9 +2537,9 @@ static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) /* See above. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_extr32_i64(lo, hi, tmp); + tcg_gen_extr_i64_tl(lo, hi, tmp); } else { - tcg_gen_extr32_i64(hi, lo, tmp); + tcg_gen_extr_i64_tl(hi, lo, tmp); } } break; @@ -2537,8 +2549,8 @@ static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) gen_store_gpr(dc, rd + 1, lo); } -static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, - int insn, int rd) +static void __attribute__((unused)) +gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); TCGv lo = gen_load_gpr(dc, rd + 1); @@ -2548,10 +2560,11 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, break; case GET_ASI_DTWINX: + assert(TARGET_LONG_BITS == 64); gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_st_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_tl(lo, addr, da.mem_idx, da.memop); break; case GET_ASI_DIRECT: @@ -2562,15 +2575,37 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, byte swapped. We will perform one 64-bit LE store, so now we must swap the order of the construction. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_concat32_i64(t64, lo, hi); + tcg_gen_concat_tl_i64(t64, lo, hi); } else { - tcg_gen_concat32_i64(t64, hi, lo); + tcg_gen_concat_tl_i64(t64, hi, lo); } gen_address_mask(dc, addr); tcg_gen_qemu_st_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); } break; + case GET_ASI_BFILL: + assert(TARGET_LONG_BITS == 32); + /* Store 32 bytes of T64 to ADDR. */ + /* ??? The original qemu code suggests 8-byte alignment, dropping + the low bits, but the only place I can see this used is in the + Linux kernel with 32 byte alignment, which would make more sense + as a cacheline-style operation. */ + { + TCGv_i64 t64 = tcg_temp_new_i64(); + TCGv d_addr = tcg_temp_new(); + TCGv eight = tcg_constant_tl(8); + int i; + + tcg_gen_concat_tl_i64(t64, lo, hi); + tcg_gen_andi_tl(d_addr, addr, -8); + for (i = 0; i < 32; i += 8) { + tcg_gen_qemu_st_i64(t64, d_addr, da.mem_idx, da.memop); + tcg_gen_add_tl(d_addr, d_addr, eight); + } + } + break; + default: /* ??? In theory we've handled all of the ASIs that are valid for stda, and this should raise DAE_invalid_asi. */ @@ -2581,9 +2616,9 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, /* See above. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_concat32_i64(t64, lo, hi); + tcg_gen_concat_tl_i64(t64, lo, hi); } else { - tcg_gen_concat32_i64(t64, hi, lo); + tcg_gen_concat_tl_i64(t64, hi, lo); } save_state(dc); @@ -2593,8 +2628,8 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, } } -static void gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, - int insn, int rd) +static void __attribute__((unused)) +gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); TCGv oldv; @@ -2615,88 +2650,6 @@ static void gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, } } -#elif !defined(CONFIG_USER_ONLY) -static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) -{ - /* ??? Work around an apparent bug in Ubuntu gcc 4.8.2-10ubuntu2+12, - whereby "rd + 1" elicits "error: array subscript is above array". - Since we have already asserted that rd is even, the semantics - are unchanged. */ - TCGv lo = gen_dest_gpr(dc, rd | 1); - TCGv hi = gen_dest_gpr(dc, rd); - TCGv_i64 t64 = tcg_temp_new_i64(); - DisasASI da = get_asi(dc, insn, MO_TEUQ); - - switch (da.type) { - case GET_ASI_EXCP: - return; - case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); - break; - default: - { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(MO_UQ); - - save_state(dc); - gen_helper_ld_asi(t64, tcg_env, addr, r_asi, r_mop); - } - break; - } - - tcg_gen_extr_i64_i32(lo, hi, t64); - gen_store_gpr(dc, rd | 1, lo); - gen_store_gpr(dc, rd, hi); -} - -static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, - int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv lo = gen_load_gpr(dc, rd + 1); - TCGv_i64 t64 = tcg_temp_new_i64(); - - tcg_gen_concat_tl_i64(t64, lo, hi); - - switch (da.type) { - case GET_ASI_EXCP: - break; - case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); - break; - case GET_ASI_BFILL: - /* Store 32 bytes of T64 to ADDR. */ - /* ??? The original qemu code suggests 8-byte alignment, dropping - the low bits, but the only place I can see this used is in the - Linux kernel with 32 byte alignment, which would make more sense - as a cacheline-style operation. */ - { - TCGv d_addr = tcg_temp_new(); - TCGv eight = tcg_constant_tl(8); - int i; - - tcg_gen_andi_tl(d_addr, addr, -8); - for (i = 0; i < 32; i += 8) { - tcg_gen_qemu_st_i64(t64, d_addr, da.mem_idx, da.memop); - tcg_gen_add_tl(d_addr, d_addr, eight); - } - } - break; - default: - { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(MO_UQ); - - save_state(dc); - gen_helper_st_asi(tcg_env, addr, t64, r_asi, r_mop); - } - break; - } -} -#endif - static TCGv get_src1(DisasContext *dc, unsigned int insn) { unsigned int rs1 = GET_FIELD(insn, 13, 17); From patchwork Tue Oct 17 06:12:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734293 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324327wro; Mon, 16 Oct 2023 23:21:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH51RfdEHJ9eaZIqio0o7Iohk1Ygth9DmHaD1QL6w+dYw6piBG3P/eh2ZfjN2l3vjiv/JQV X-Received: by 2002:a05:622a:1a82:b0:412:c2a:eaef with SMTP id s2-20020a05622a1a8200b004120c2aeaefmr1697815qtc.11.1697523677447; Mon, 16 Oct 2023 23:21:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523677; cv=none; d=google.com; s=arc-20160816; b=kGVenSsmxhggAtis9VjiViQ3WI0F+WsKvQVzdkjnQedRokDuIwGN5sypXIwcNTc2DK t66HEVJ+CgjGK42aoORk9kFJZU5JO2A4TSc8FsXFyX3IoAWcguXbJZSmCRCsNvYFIjJ2 uVKK+jRO9ABmkOgMM4ItD6+FrWQ/QJGk4hdLbyYLiwOZb+bOo6cTVHYduTWyvz0VwrTW P75MTxNbEKWtbKvHiRAJ3nyRRJcuFFH27ZmnjEJlIB5P32F+FD6hg7VWFQuJxndS7DCK gxE2gPX8f+pPC16Injvg26ti8dquWQs40t2WG7AF4ZoLtuEFwIGDgxRFO1HoqR0SL7pv ozhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=2yKX3ubOopsU+rj4jurKNINzvppARLg08vtpsruBAUQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=zu9TmMBoab/iYfon9lp5sKk5z+BQMpXSIEgupvcCTAdEJ9cItEH9oLiLUvtHAtrq1f WvGfPYVL8BdzGFyRwqVuthIBzkma5GtKXLIqL8voy+ldzGYaeNGLBkJ0dVXSgG24ILEL doCH4v6vDenKhCKLURMSOZm4FHjuZrdPP3X0AgNTep0yf2Re0HOmsWKSWanOghE6hLht j7N4AMAG7eqQp0rDPX65ZN1y3tSehbcCBT5r0Y9DX3/V/ygsGom2Kvz4ADaypoY8TV/7 tE87EMbDDgWr0ty55DwYJRktMOtcW5yj6hbt039OUAkrXRmalV/v5C5tchlh/QOZFA+z r4bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i7uqjyeL; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i9-20020ac85e49000000b004181273c69csi636733qtx.399.2023.10.16.23.21.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:17 -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=i7uqjyeL; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNk-00039o-8h; Tue, 17 Oct 2023 02:16:44 -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 1qsdNU-0002mb-5J for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:28 -0400 Received: from mail-yb1-xb2d.google.com ([2607:f8b0:4864:20::b2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNR-0004gD-Ls for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:27 -0400 Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-d8a000f6a51so5934863276.3 for ; Mon, 16 Oct 2023 23:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523384; x=1698128184; 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=2yKX3ubOopsU+rj4jurKNINzvppARLg08vtpsruBAUQ=; b=i7uqjyeLLmx8bCExGlFgAxNApdbLIyyIBeuoPwei/tGTzLsR9f/9X/IcNc897+wqRz hlmcd85x7/y5dKnCaDfA+xmMESegLMylavSii/pu/uDvZrOS3l1EOjlh7c5emsY41RtP HH//SQ6KpHnIGM46KmKA2Y5Wtj6Jdz+uHLZJMxmQBuuh6UsW9Ipmlha8Dn0Qtwk6D2J4 CSKb9bN9t/bXzRq/bc2FzkZCV5gV8Mh5Bi3mTc4Fg1YRJ/gRj2GOeK3wso1xgov96uc8 p6oTsuF5i4vn+0mJS2G88IguJ1sjIU94ry9NNP+fR+aIVO8tG+90cf+KYik071b86Kl7 6h2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523384; x=1698128184; 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=2yKX3ubOopsU+rj4jurKNINzvppARLg08vtpsruBAUQ=; b=DvBgrqOpy7ZZRn+Qa76OVI0jupOqWXYkfzt0z8vKzb8FGAJppUHHYOjX7r6i+surrN qsyg8obuBZLF5tYTVQD0M9Zg0oCVIMGp4BHk9sZAZ6NQAHNycfvuiNoFwAHmbk9iJiKA M+gW+Oj62VllljXPy+cGDkEqVTEGVRMive5lir1jnK+6Kft1OjMIY2a914IKGH4hFFgm IWO1eNpzTmrU0j9g+dbNFBXOykO6FiI0Awq+ME3YUHQgkqPzeLPBZQsD5CoYOjGMluEE EZWNxt7Z7LUEsZSiVojkga+9i9Cf67lRcbywfmn+QmIa+it28QEaVSXpBzTe8uG+p8Qy FOMA== X-Gm-Message-State: AOJu0Yz8FiuC5SS/LNswZX2XnAbotCZ/EFW1VD9OWBQ80GamwkHN/E1a hXmOXo5qp3r1nvVDPbKo6C2dEJ2y0rbHB11buIk= X-Received: by 2002:a25:ab88:0:b0:d80:4533:9556 with SMTP id v8-20020a25ab88000000b00d8045339556mr1194372ybi.63.1697523384234; Mon, 16 Oct 2023 23:16:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 46/90] target/sparc: Split out ldst functions with asi pre-computed Date: Mon, 16 Oct 2023 23:12:00 -0700 Message-Id: <20231017061244.681584-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::b2d; envelope-from=richard.henderson@linaro.org; helo=mail-yb1-xb2d.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 As an intermediate step in decodetree conversion, create new functions passing in DisasASI and not insn. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 215 ++++++++++++++++++++++----------------- 1 file changed, 123 insertions(+), 92 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6404ec5858..eed0fbadf9 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2105,25 +2105,21 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) return resolve_asi(dc, asi, memop); } -static void __attribute__((unused)) -gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) +static void gen_ld_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { - DisasASI da = get_asi(dc, insn, memop); - - switch (da.type) { + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DTWINX: /* Reserved for ldda. */ gen_exception(dc, TT_ILL_INSN); break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_tl(dst, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_ld_tl(dst, addr, da->mem_idx, da->memop | MO_ALIGN); break; default: { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(memop | MO_ALIGN); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop | MO_ALIGN); save_state(dc); #ifdef TARGET_SPARC64 @@ -2141,33 +2137,38 @@ gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) } static void __attribute__((unused)) -gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) +gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) { DisasASI da = get_asi(dc, insn, memop); - switch (da.type) { + gen_address_mask(dc, addr); + gen_ld_asi0(dc, &da, dst, addr); +} + +static void gen_st_asi0(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) +{ + switch (da->type) { case GET_ASI_EXCP: break; + case GET_ASI_DTWINX: /* Reserved for stda. */ -#ifndef TARGET_SPARC64 - gen_exception(dc, TT_ILL_INSN); - break; -#else - if (!(dc->def->features & CPU_FEATURE_HYPV)) { + if (TARGET_LONG_BITS == 32) { + gen_exception(dc, TT_ILL_INSN); + break; + } else if (!(dc->def->features & CPU_FEATURE_HYPV)) { /* Pre OpenSPARC CPUs don't have these */ gen_exception(dc, TT_ILL_INSN); - return; + break; } - /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions - * are ST_BLKINIT_ ASIs */ -#endif + /* In OpenSPARC T1+ CPUs TWINX ASIs in store are ST_BLKINIT_ ASIs */ /* fall through */ + case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_st_tl(src, addr, da->mem_idx, da->memop | MO_ALIGN); break; -#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) + case GET_ASI_BCOPY: + assert(TARGET_LONG_BITS == 32); /* Copy 32 bytes from the address in SRC to ADDR. */ /* ??? The original qemu code suggests 4-byte alignment, dropping the low bits, but the only place I can see this used is in the @@ -2185,18 +2186,18 @@ gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) for (i = 0; i < 32; i += 4) { /* Since the loads and stores are paired, allow the copy to happen in the host endianness. */ - tcg_gen_qemu_ld_i32(tmp, saddr, da.mem_idx, MO_UL); - tcg_gen_qemu_st_i32(tmp, daddr, da.mem_idx, MO_UL); + tcg_gen_qemu_ld_i32(tmp, saddr, da->mem_idx, MO_UL); + tcg_gen_qemu_st_i32(tmp, daddr, da->mem_idx, MO_UL); tcg_gen_add_tl(saddr, saddr, four); tcg_gen_add_tl(daddr, daddr, four); } } break; -#endif + default: { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(memop | MO_ALIGN); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop | MO_ALIGN); save_state(dc); #ifdef TARGET_SPARC64 @@ -2216,16 +2217,49 @@ gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) } } +static void __attribute__((unused)) +gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) +{ + DisasASI da = get_asi(dc, insn, memop); + + gen_address_mask(dc, addr); + gen_st_asi0(dc, &da, src, addr); +} + +static void gen_swap_asi0(DisasContext *dc, DisasASI *da, + TCGv dst, TCGv src, TCGv addr) +{ + switch (da->type) { + case GET_ASI_EXCP: + break; + case GET_ASI_DIRECT: + gen_swap(dc, dst, src, addr, da->mem_idx, da->memop); + break; + default: + /* ??? Should be DAE_invalid_asi. */ + gen_exception(dc, TT_DATA_ACCESS); + break; + } +} + static void __attribute__((unused)) gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, TCGv addr, int insn) { DisasASI da = get_asi(dc, insn, MO_TEUL); - switch (da.type) { + gen_address_mask(dc, addr); + gen_swap_asi0(dc, &da, dst, src, addr); +} + +static void gen_cas_asi0(DisasContext *dc, DisasASI *da, + TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) +{ + switch (da->type) { case GET_ASI_EXCP: - break; + return; case GET_ASI_DIRECT: - gen_swap(dc, dst, src, addr, da.mem_idx, da.memop); + tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, newv, + da->mem_idx, da->memop | MO_ALIGN); break; default: /* ??? Should be DAE_invalid_asi. */ @@ -2238,34 +2272,33 @@ static void __attribute__((unused)) gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUL); - TCGv oldv; + TCGv oldv = gen_dest_gpr(dc, rd); + TCGv newv = gen_load_gpr(dc, rd); - switch (da.type) { - case GET_ASI_EXCP: - return; - case GET_ASI_DIRECT: - oldv = tcg_temp_new(); - tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd), - da.mem_idx, da.memop | MO_ALIGN); - gen_store_gpr(dc, rd, oldv); - break; - default: - /* ??? Should be DAE_invalid_asi. */ - gen_exception(dc, TT_DATA_ACCESS); - break; - } + gen_address_mask(dc, addr); + gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); + gen_store_gpr(dc, rd, oldv); } static void __attribute__((unused)) -gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) +gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { - DisasASI da = get_asi(dc, insn, MO_UB); + DisasASI da = get_asi(dc, insn, MO_TEUQ); + TCGv oldv = gen_dest_gpr(dc, rd); + TCGv newv = gen_load_gpr(dc, rd); - switch (da.type) { + gen_address_mask(dc, addr); + gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); + gen_store_gpr(dc, rd, oldv); +} + +static void gen_ldstub_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) +{ + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_ldstub(dc, dst, addr, da.mem_idx); + gen_ldstub(dc, dst, addr, da->mem_idx); break; default: /* ??? In theory, this should be raise DAE_invalid_asi. @@ -2273,7 +2306,7 @@ gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) if (tb_cflags(dc->base.tb) & CF_PARALLEL) { gen_helper_exit_atomic(tcg_env); } else { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); TCGv_i32 r_mop = tcg_constant_i32(MO_UB); TCGv_i64 s64, t64; @@ -2293,6 +2326,15 @@ gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) } } +static void __attribute__((unused)) +gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) +{ + DisasASI da = get_asi(dc, insn, MO_UB); + + gen_address_mask(dc, addr); + gen_ldstub_asi0(dc, &da, dst, addr); +} + static void __attribute__((unused)) gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { @@ -2485,36 +2527,32 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } } -static void __attribute__((unused)) -gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) +static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { - DisasASI da = get_asi(dc, insn, MO_TEUQ); TCGv hi = gen_dest_gpr(dc, rd); TCGv lo = gen_dest_gpr(dc, rd + 1); - switch (da.type) { + switch (da->type) { case GET_ASI_EXCP: return; case GET_ASI_DTWINX: assert(TARGET_LONG_BITS == 64); - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_ld_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_tl(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_ld_tl(lo, addr, da->mem_idx, da->memop); break; case GET_ASI_DIRECT: { TCGv_i64 tmp = tcg_temp_new_i64(); - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(tmp, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_ld_i64(tmp, addr, da->mem_idx, da->memop | MO_ALIGN); /* Note that LE ldda acts as if each 32-bit register result is byte swapped. Having just performed one 64-bit bswap, we need now to swap the writebacks. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_extr_i64_tl(lo, hi, tmp); } else { tcg_gen_extr_i64_tl(hi, lo, tmp); @@ -2528,15 +2566,15 @@ gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) real hardware allows others. This can be seen with e.g. FreeBSD 10.3 wrt ASI_IC_TAG. */ { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(da.memop); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop); TCGv_i64 tmp = tcg_temp_new_i64(); save_state(dc); gen_helper_ld_asi(tmp, tcg_env, addr, r_asi, r_mop); /* See above. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_extr_i64_tl(lo, hi, tmp); } else { tcg_gen_extr_i64_tl(hi, lo, tmp); @@ -2550,21 +2588,28 @@ gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) } static void __attribute__((unused)) -gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) +gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); + + gen_address_mask(dc, addr); + gen_ldda_asi0(dc, &da, addr, rd); +} + +static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +{ + TCGv hi = gen_load_gpr(dc, rd); TCGv lo = gen_load_gpr(dc, rd + 1); - switch (da.type) { + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DTWINX: assert(TARGET_LONG_BITS == 64); - gen_address_mask(dc, addr); - tcg_gen_qemu_st_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_st_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_tl(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_tl(lo, addr, da->mem_idx, da->memop); break; case GET_ASI_DIRECT: @@ -2574,13 +2619,12 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) /* Note that LE stda acts as if each 32-bit register result is byte swapped. We will perform one 64-bit LE store, so now we must swap the order of the construction. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_concat_tl_i64(t64, lo, hi); } else { tcg_gen_concat_tl_i64(t64, hi, lo); } - gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_st_i64(t64, addr, da->mem_idx, da->memop | MO_ALIGN); } break; @@ -2600,7 +2644,7 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) tcg_gen_concat_tl_i64(t64, lo, hi); tcg_gen_andi_tl(d_addr, addr, -8); for (i = 0; i < 32; i += 8) { - tcg_gen_qemu_st_i64(t64, d_addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_i64(t64, d_addr, da->mem_idx, da->memop); tcg_gen_add_tl(d_addr, d_addr, eight); } } @@ -2610,12 +2654,12 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) /* ??? In theory we've handled all of the ASIs that are valid for stda, and this should raise DAE_invalid_asi. */ { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(da.memop); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop); TCGv_i64 t64 = tcg_temp_new_i64(); /* See above. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_concat_tl_i64(t64, lo, hi); } else { tcg_gen_concat_tl_i64(t64, hi, lo); @@ -2629,25 +2673,12 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) } static void __attribute__((unused)) -gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) +gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv oldv; - switch (da.type) { - case GET_ASI_EXCP: - return; - case GET_ASI_DIRECT: - oldv = tcg_temp_new(); - tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd), - da.mem_idx, da.memop | MO_ALIGN); - gen_store_gpr(dc, rd, oldv); - break; - default: - /* ??? Should be DAE_invalid_asi. */ - gen_exception(dc, TT_DATA_ACCESS); - break; - } + gen_address_mask(dc, addr); + gen_stda_asi0(dc, &da, addr, rd); } static TCGv get_src1(DisasContext *dc, unsigned int insn) From patchwork Tue Oct 17 06:12:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734313 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp325068wro; Mon, 16 Oct 2023 23:23:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXe56F9VKIYqeNRWSziKAAiH09vz2uzzVmiObXEwbdmlVQtYrT5u8StbusK/AEzWXqJSZQ X-Received: by 2002:a05:620a:2989:b0:773:e1e7:bb2d with SMTP id r9-20020a05620a298900b00773e1e7bb2dmr1644113qkp.60.1697523832746; Mon, 16 Oct 2023 23:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523832; cv=none; d=google.com; s=arc-20160816; b=AQGnCMdrrkt3WsDYGsxl/VyIg/yg0f1qHhSMpHHzCgazGfQ2lKAv1suwe9CI5vl/sR o6Ppo113xPAbGWqYq30lwsikOg+Vedj2dUMWofCq3X1u/prLgf/c5kr+GZsp6pddLkQQ mp0fdyRzj7qQaIleD8cwgQ32aXi3TA5lNaX1WIo5g6PJl0IgCwu/B6DRBHjJPF2tGxkx nZ/Cp1f478xjdXnTZrKLSndOiTGa1XNi11ONNtS44enQtsdNkO5Ll4qBzPV5qEZz+n1u aEhIkLFAKoqpXUfh4kQSw2muJ3UPuGnOsxKp/kkPnY+gwq5UjN6X2YgRIiMSM/XeBQn2 cK7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=4VRWKpUsXoRjx6DL0w+41fc0NNohJYrIqmxDkszKvZ8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=A3FZzCvTvvhhcRuUa+MwBkhxe4sKptoHwg9yGrMKZz6ULxQJDZ7AfghYTsslZBXPHD pQBEKI2gYXBOPytuRoFq7GpeGCR2ojpbkWHKZ0ldQO8E80cmBwaPdxz8y7G9kH+fqiua huTUn6omKVRh/pSimaO+EwhmHlUbAYpW8k6tYFgTYqhTvAro9XoKYf7BKGJmM40e4kw5 Zy/IC36QSokQXMfK8zJnkLkeUKnBEsP1MK2Am5jCrfcURjWgRtDHT7sHHNXIxyYyNAXU 0hOyIS1538vKEmMTglM3/PVY1DjtUmsSHh+l+J60Bldm0GYHzXgHSM40UyxwAJh2LxJF dT3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YSHcoL+j; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b4-20020a05620a04e400b00773e4b0d065si594195qkh.532.2023.10.16.23.23.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:23:52 -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=fail header.i=@linaro.org header.s=google header.b=YSHcoL+j; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNp-0003Ru-68; Tue, 17 Oct 2023 02:16:49 -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 1qsdNV-0002oI-4B for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:30 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNS-0004gZ-Aj for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:28 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6c6504c9ac5so3712008a34.0 for ; Mon, 16 Oct 2023 23:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523385; x=1698128185; 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=4VRWKpUsXoRjx6DL0w+41fc0NNohJYrIqmxDkszKvZ8=; b=YSHcoL+jlqCf7TFXd6UmzlmRkhdOyVxMlTID9b+Dlq1ZtU9g7370Pzb6fY/87R1Ur7 tXpvWiBv+0BlQ8BUfEqIPqnodMb6xrG16Z4u0n6U4QUNf4GZIS1UINHoVBRc0dHVhVjA xPelHnA9mI/V80Yt/fjOZuKrnhvbMAyUzFPivOC6+uooXyyE4Wwly9g+KrbttTbry+Ub 7eOcMTgxOonY1V+0jIjfOW+zaFag9SiA4ubfkzM09Xm3tzLr+wrHaNYg5sy00cz7fO2p Lef3MmCjJq5IMIPM70CRTdhz+k4MIjttte2k/iID7mKI+CneDMcfLqpjBP0jJ1/9mv14 YIww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523385; x=1698128185; 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=4VRWKpUsXoRjx6DL0w+41fc0NNohJYrIqmxDkszKvZ8=; b=CoPAZ9SNonhOXXgNR6TI/ZN1UQDs3EfiIWR3RTRcOE/6yY7AkfHYZb0vBwTQJvMSFJ taOEDxZwGNb87y1slafmXdisRlXGuNFSUV3pAhKKuVE+zKdcUq+u5WeaKAUzaJCAnOiG 4kxMfmelc3d1+PJIblpKa6roPMXdwrxB9PnbOQyTgGXXaqIOYq5PhlbtNUJ5rmwIp5vu 4Rzyes7OuexEFuqC8BbJhu3am66mwisKmoddPjRjphVPapfQzocqKfT8cTAjZfCnV7h9 qwyKNxak2AqogUc63WrulP2XJZkG2re4M35yjb9xKzR27sq5ezAddcnLa7tvTChXINuk 6Qhw== X-Gm-Message-State: AOJu0YwPIq7DNAJ1alh9HD3tkpI4b9IObXotHWspBerkNeUA2a3xXujh hA8ZVn3wVfxtBT+HiQz7CXfYoO2drNtEQ7JfArg= X-Received: by 2002:a9d:6d9a:0:b0:6b8:807b:b50 with SMTP id x26-20020a9d6d9a000000b006b8807b0b50mr1469061otp.22.1697523385133; Mon, 16 Oct 2023 23:16:25 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 47/90] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX Date: Mon, 16 Oct 2023 23:12:01 -0700 Message-Id: <20231017061244.681584-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 Perform one atomic 16-byte operation. The atomicity is required for the LDTXA instructions. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 48 +++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index eed0fbadf9..16b024fab7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2537,11 +2537,27 @@ static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) return; case GET_ASI_DTWINX: - assert(TARGET_LONG_BITS == 64); - tcg_gen_qemu_ld_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_tl(lo, addr, da->mem_idx, da->memop); +#ifdef TARGET_SPARC64 + { + MemOp mop = (da->memop & MO_BSWAP) | MO_128 | MO_ALIGN_16; + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_qemu_ld_i128(t, addr, da->mem_idx, mop); + /* + * Note that LE twinx acts as if each 64-bit register result is + * byte swapped. We perform one 128-bit LE load, so must swap + * the order of the writebacks. + */ + if ((mop & MO_BSWAP) == MO_TE) { + tcg_gen_extr_i128_i64(lo, hi, t); + } else { + tcg_gen_extr_i128_i64(hi, lo, t); + } + } break; +#else + g_assert_not_reached(); +#endif case GET_ASI_DIRECT: { @@ -2606,11 +2622,27 @@ static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) break; case GET_ASI_DTWINX: - assert(TARGET_LONG_BITS == 64); - tcg_gen_qemu_st_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_tl(lo, addr, da->mem_idx, da->memop); +#ifdef TARGET_SPARC64 + { + MemOp mop = (da->memop & MO_BSWAP) | MO_128 | MO_ALIGN_16; + TCGv_i128 t = tcg_temp_new_i128(); + + /* + * Note that LE twinx acts as if each 64-bit register result is + * byte swapped. We perform one 128-bit LE store, so must swap + * the order of the construction. + */ + if ((mop & MO_BSWAP) == MO_TE) { + tcg_gen_concat_i64_i128(t, lo, hi); + } else { + tcg_gen_concat_i64_i128(t, hi, lo); + } + tcg_gen_qemu_st_i128(t, addr, da->mem_idx, mop); + } break; +#else + g_assert_not_reached(); +#endif case GET_ASI_DIRECT: { From patchwork Tue Oct 17 06:12:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734310 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324918wro; Mon, 16 Oct 2023 23:23:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuN9Oex+zxg3rYqy9kolc9evaJD8NiBnJ8T4piDyFOQQ0t6Ax7EgS7M3pVzMV+Pk6h5XDj X-Received: by 2002:a0c:f2cf:0:b0:66d:66dd:bc14 with SMTP id c15-20020a0cf2cf000000b0066d66ddbc14mr1372217qvm.11.1697523802916; Mon, 16 Oct 2023 23:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523802; cv=none; d=google.com; s=arc-20160816; b=tSttPGjSZ0CsgTp2tr3UdFgDeB2KdMsxbt09f8KEjzeScoG5KqQTeL3j2zSamaDN0a hEDznT6+JWnTMJ/95ZKml+646yoJmmnsp4A5fwXWNTLpVptZEh9Cn9vaO7csMsWU7t+H AzsItFzjSYBAGws+3tjMDeoSDXD645DQbFhQsiuJ7x6MAbLNqTTVzSo4Kddke9fU+2Dj 47OhDNSKWgWM7/5AbEOxK/Vsc09li/J/4vMFh4Ud62dgW2CRsFhh6B5Ex4w0OntWxTMd huTb9RcgtOTVyaarF95vKlW57YaI7KMa/HZpMLIGXPq6ae9wcR4hryHYC46kXMhzQiER Qo0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=BHH0zmSKQh/7q8ZcOItuJ2qdH4tJ61/g67Z0aPFO1As=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=piMnsJfe/F7GNT4RBfHckVUDffAR4n3hAhqrrVDyF+p8L+Ot/i+Aq+L0DkaqY8PibF esdhCkC78l8IZcFIl+nin4SXSNZ+LKN3Dk1rj/GN94YPxoDRR2RO1NI+B5rj2xQATOpu 7w9sHriGsCKjFh6QCP3XzwdOZYycw7WDpv++KSFvEsdo+3J7ZGZbgCM/72bOdddNLMYJ XFPRAeGlJnGfX2Yll+Efxna6yVvApaAakOPPeVpNiSJQ7UVRuAC7B4LOzasNGgyVymN6 ewHF7CAJijZ6DOtScNRt0Cw1ZF9JWSOgi9U4xKzFTjAREeKC8sP7rCQEUrePMdM+LdH7 7Lbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rBewh69O; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id mv5-20020a056214338500b0063f7d73dd87si523958qvb.584.2023.10.16.23.23.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:23:22 -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=rBewh69O; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNl-0003DI-0W; Tue, 17 Oct 2023 02:16:45 -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 1qsdNW-0002pg-9K for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:31 -0400 Received: from mail-yb1-xb30.google.com ([2607:f8b0:4864:20::b30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNT-0004gm-Tu for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:29 -0400 Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-d9a58f5f33dso5946755276.1 for ; Mon, 16 Oct 2023 23:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523386; x=1698128186; 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=BHH0zmSKQh/7q8ZcOItuJ2qdH4tJ61/g67Z0aPFO1As=; b=rBewh69O+rD8nxtPQYdwQMX6asjBWfkj9PAxr41hCLE5Hh7tQLBwOCAzB4kUPDI3dO pgwWIFBkPTTE7C/6m69qwg8JfPOy37ayPVrCaxKBj3jh7qL1Rz01SBB6P9Ja1tAdBYLP dfTKo6Yz54s9NB9b3h+l+A4A4SJbRHuPJXfBr1yarAwAl0Ymj10cMB98xlfAL5Z2HxPp Y4sRw1rjdafTt1Buviv7NDxxIImkLcolVNyD9gOZ4APy9M0xlRzvEoerFJTB7cCNXyj+ Ea2JKWcaV5ixPTnn8RAjBKlzo6C1NXJim3OLrFhJ0zMAXpHYUzygzoJi9pPCOsmZPOnp EHKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523386; x=1698128186; 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=BHH0zmSKQh/7q8ZcOItuJ2qdH4tJ61/g67Z0aPFO1As=; b=kYrRLF665tfS49iF9uH4Z4BBJk7705JwgtNICcW2+GHOuDQARDtsvWZ+ctcPQklmJN UZ2kiTchTGidDy4cLFcz5m/8/GQElvi9q712ozwQMFuYaeXH7jz6Qy17tjwvAsk1S3RR mH1qohKacVUsk/D2/sGHcKS6Tas2QZJV7AM6v7RRV9H790aEeF+Q/9XedfEFdxDPZaLo UvHu7bvLvOJCzG4AiBiPwyaehxkpLWPFkpqJGfB9jSIDNJDHVhSGDFAi2cOzTqwTEn5M P45MAjtz5s3nx1npCf3xR4aQi0XP3SmG4q9GrUqLN4/3Vk+2jnP55EkPmdCRPWFTpv3c k4dQ== X-Gm-Message-State: AOJu0YzoK25CaJfCb38Jg9/HSdQyQiTqYMpzZLUgAwRmXU3vt2uWZTfY /V8/1XHjNnz1zzasoViIiS2E6FAEDuZcUQ2rNn0= X-Received: by 2002:a25:2558:0:b0:d9b:3ed:41a5 with SMTP id l85-20020a252558000000b00d9b03ed41a5mr1266554ybl.21.1697523385851; Mon, 16 Oct 2023 23:16:25 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 48/90] target/sparc: Move simple integer load/store to decodetree Date: Mon, 16 Oct 2023 23:12:02 -0700 Message-Id: <20231017061244.681584-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::b30; envelope-from=richard.henderson@linaro.org; helo=mail-yb1-xb30.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 Move LDUW, LDUB, LDUH, LDD, LDSW, LDSB, LDSH, LDX, STW, STB, STH, STD, STX. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++++ target/sparc/translate.c | 196 +++++++++++++++++++++++--------------- 2 files changed, 142 insertions(+), 76 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index dface4a9dd..24c22c6ae3 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -224,6 +224,28 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +## +## Major Opcode 11 -- load and store instructions +## + +&r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool +@r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 + +LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na +LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na +LDUH 11 ..... 000010 ..... . ............. @r_r_ri_na +LDD 11 ..... 000011 ..... . ............. @r_r_ri_na +LDSW 11 ..... 001000 ..... . ............. @r_r_ri_na +LDSB 11 ..... 001001 ..... . ............. @r_r_ri_na +LDSH 11 ..... 001010 ..... . ............. @r_r_ri_na +LDX 11 ..... 001011 ..... . ............. @r_r_ri_na + +STW 11 ..... 000100 ..... . ............. @r_r_ri_na +STB 11 ..... 000101 ..... . ............. @r_r_ri_na +STH 11 ..... 000110 ..... . ............. @r_r_ri_na +STD 11 ..... 000111 ..... . ............. @r_r_ri_na +STX 11 ..... 001110 ..... . ............. @r_r_ri_na + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 16b024fab7..db577ee963 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4614,6 +4614,117 @@ static bool trans_RETRY(DisasContext *dc, arg_RETRY *a) return true; } +/* + * Major opcode 11 -- load and store instructions + */ + +static TCGv gen_ldst_addr(DisasContext *dc, int rs1, bool imm, int rs2_or_imm) +{ + TCGv addr, tmp = NULL; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!imm && rs2_or_imm & ~0x1f) { + return NULL; + } + + addr = gen_load_gpr(dc, rs1); + if (rs2_or_imm) { + tmp = tcg_temp_new(); + if (imm) { + tcg_gen_addi_tl(tmp, addr, rs2_or_imm); + } else { + tcg_gen_add_tl(tmp, addr, cpu_regs[rs2_or_imm]); + } + addr = tmp; + } + if (AM_CHECK(dc)) { + if (!tmp) { + tmp = tcg_temp_new(); + } + tcg_gen_ext32u_tl(tmp, addr); + addr = tmp; + } + return addr; +} + +static bool do_ld_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv reg, addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, mop); + + reg = gen_dest_gpr(dc, a->rd); + gen_ld_asi0(dc, &da, reg, addr); + gen_store_gpr(dc, a->rd, reg); + return advance_pc(dc); +} + +TRANS(LDUW, ALL, do_ld_gpr, a, MO_TEUL) +TRANS(LDUB, ALL, do_ld_gpr, a, MO_UB) +TRANS(LDUH, ALL, do_ld_gpr, a, MO_TEUW) +TRANS(LDSB, ALL, do_ld_gpr, a, MO_SB) +TRANS(LDSH, ALL, do_ld_gpr, a, MO_TESW) +TRANS(LDSW, 64, do_ld_gpr, a, MO_TESL) +TRANS(LDX, 64, do_ld_gpr, a, MO_TEUQ) + +static bool do_st_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv reg, addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, mop); + + reg = gen_load_gpr(dc, a->rd); + gen_st_asi0(dc, &da, reg, addr); + return advance_pc(dc); +} + +TRANS(STW, ALL, do_st_gpr, a, MO_TEUL) +TRANS(STB, ALL, do_st_gpr, a, MO_UB) +TRANS(STH, ALL, do_st_gpr, a, MO_TEUW) +TRANS(STX, 64, do_st_gpr, a, MO_TEUQ) + +static bool trans_LDD(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr; + DisasASI da; + + if (a->rd & 1) { + return false; + } + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_TEUQ); + gen_ldda_asi0(dc, &da, addr, a->rd); + return advance_pc(dc); +} + +static bool trans_STD(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr; + DisasASI da; + + if (a->rd & 1) { + return false; + } + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_TEUQ); + gen_stda_asi0(dc, &da, addr, a->rd); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5437,47 +5548,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { case 0x0: /* ld, V9 lduw, load unsigned word */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - break; case 0x1: /* ldub, load unsigned byte */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_UB); - break; case 0x2: /* lduh, load unsigned halfword */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUW | MO_ALIGN); - break; case 0x3: /* ldd, load double word */ - if (rd & 1) - goto illegal_insn; - else { - TCGv_i64 t64; - - gen_address_mask(dc, cpu_addr); - t64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(t64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - tcg_gen_trunc_i64_tl(cpu_val, t64); - tcg_gen_ext32u_tl(cpu_val, cpu_val); - gen_store_gpr(dc, rd + 1, cpu_val); - tcg_gen_shri_i64(t64, t64, 32); - tcg_gen_trunc_i64_tl(cpu_val, t64); - tcg_gen_ext32u_tl(cpu_val, cpu_val); - } - break; case 0x9: /* ldsb, load signed byte */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, dc->mem_idx, MO_SB); - break; case 0xa: /* ldsh, load signed halfword */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TESW | MO_ALIGN); - break; + g_assert_not_reached(); /* in decodetree */ + case 0x08: /* V9 ldsw */ + case 0x0b: /* V9 ldx */ + goto illegal_insn; /* in decodetree */ case 0xd: /* ldstub */ gen_ldstub(dc, cpu_val, cpu_addr, dc->mem_idx); break; @@ -5519,16 +5598,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif #ifdef TARGET_SPARC64 - case 0x08: /* V9 ldsw */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TESL | MO_ALIGN); - break; - case 0x0b: /* V9 ldx */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - break; case 0x18: /* V9 ldswa */ gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TESL); break; @@ -5621,38 +5690,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } } else if (xop < 8 || (xop >= 0x14 && xop < 0x18) || xop == 0xe || xop == 0x1e) { +#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) TCGv cpu_val = gen_load_gpr(dc, rd); +#endif switch (xop) { case 0x4: /* st, store word */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - break; case 0x5: /* stb, store byte */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, dc->mem_idx, MO_UB); - break; case 0x6: /* sth, store halfword */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUW | MO_ALIGN); - break; case 0x7: /* std, store double word */ - if (rd & 1) - goto illegal_insn; - else { - TCGv_i64 t64; - TCGv lo; - - gen_address_mask(dc, cpu_addr); - lo = gen_load_gpr(dc, rd + 1); - t64 = tcg_temp_new_i64(); - tcg_gen_concat_tl_i64(t64, lo, cpu_val); - tcg_gen_qemu_st_i64(t64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - } - break; + g_assert_not_reached(); /* in decodetree */ + case 0x0e: /* V9 stx */ + goto illegal_insn; /* in decodetree */ #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x14: /* sta, V9 stwa, store word alternate */ gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUL); @@ -5671,11 +5720,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif #ifdef TARGET_SPARC64 - case 0x0e: /* V9 stx */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - break; case 0x1e: /* V9 stxa */ gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUQ); break; From patchwork Tue Oct 17 06:12:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734296 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324402wro; Mon, 16 Oct 2023 23:21:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGA5VGO/L4KOji9lUsmc2n+kT/5CRMazVYOkKj8J/CM6owJSaSd3Wt9pueakxVelYOTzATC X-Received: by 2002:ac8:4e4b:0:b0:40f:dfbc:2405 with SMTP id e11-20020ac84e4b000000b0040fdfbc2405mr1320560qtw.27.1697523690695; Mon, 16 Oct 2023 23:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523690; cv=none; d=google.com; s=arc-20160816; b=FybHcMlpuVloJgwS1tsr0ZiBk385O+gw9mGeodra9Do0c/VFTMteyyhJSJcP9ktHPs 9X5AHasJHX0ERaGmzYsRE9Mjtve7ZIqceUr0m5q2ElufWxOCdMt8c/t7O0+2hNIboOBK ZtB8Manf39g8BvLlzSntqoYgz9MKcvSfIHUMjtqU4q9eryArvVnrDFkuRzxJ9Ru3Ong+ X19bes0zVE7yhp7wfZpumXq0iqzqA0pBW+OeinxAIDwybciR6aEpOkd2iRkxu50fVkGj YoSNnYttwpi25p5RitJfMW5aLpjLzpt7nbjEqQODueWGeEJg5l3UkvDmJQyhvLYk55Hd /R7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=7OcqfLX0n4HBjR84BTnyOLb2r4IRA7T7l4/GfiNJjcs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=H6CvM43LpcNY8M95Oc2sHj/QCRtTe55/bBVk6qiPFIzvCM+ikCY/FjvjT9QzFIZCSv QI7GcGNV1ToI/SdnhDA6tlwwCmGndGK7pegjiV7eulG8qqefj7aPtzNU8dxlplQRB8qq bQjZ5GHs7b1OFjdHhpAJIJcdE3t+tQ9ZK+JMQ8SAtI23sqLX/GC5XpyJ3+bgjCFwlpLR TK0sIXOw7leNgW3p/jpL2jzQGnYKMd5P9gOc9dBe4UZ7xBemjJqkrL6wofzh6oHY6vQr rGKnE8Uo75Y6FYRYX/gesTAFZS5z9QSoPCJt9HjKQ+mrJ9260rT54IODD4oKrmDFNGKs MjJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IDsYJ/g7"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a8-20020a05622a064800b00417f76c422fsi629401qtb.380.2023.10.16.23.21.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:30 -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="IDsYJ/g7"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNj-00035t-Iz; Tue, 17 Oct 2023 02:16:43 -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 1qsdNW-0002py-EG for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:31 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNU-0004h5-1y for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:30 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso2370969b3a.1 for ; Mon, 16 Oct 2023 23:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523387; x=1698128187; 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=7OcqfLX0n4HBjR84BTnyOLb2r4IRA7T7l4/GfiNJjcs=; b=IDsYJ/g7J0DjqRyXcsMOA5UFMPGBtAzw5jdItKAUfl8yzuIY4uc1xoijqKIvgpdU+y M9bDTbXU5D4Dvn93UGSyGFOX/dnZaExck1tfLQrLitQgQDwXcsqvQ06ddNpnqEOQvN0V 5fj78JJP7R1FwHZKArwjf3Dcmq+uDPrxud14rtv85y0MUGEyYh8WgOfFDG0u3xww3qae 4gpkNkV/dpPp7sLkRn084ZmEJXEgaO62dxv6JQxz9DcFDElY11QtR6GC5xwKkQi58fAh JTVGURb0vZ6w52zOqR0VOuri6ajkPm39cBteermtUN4JFmbsWZTQG4vATVMvEwsXgnS2 QwFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523387; x=1698128187; 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=7OcqfLX0n4HBjR84BTnyOLb2r4IRA7T7l4/GfiNJjcs=; b=WWRnQd0OHgEA+DFzSn8Ja1Ge/rv6OoirlKO348CDLG6/Wg1NJXZdhQgQqOxdi3dCeO AJV/I41N7q3p6Evbfxx0WLTCjicudqMorEe8oG5efnR9vx6M0yBvH22iDzXk1/CcYSMP kkhKQvUV/Co7kZdhzxhYxnhTimet65AM7PJWZDzzQZtABmOf9VuVxWaFgRNlHBh+d/xW yjw78kFMq9+Nll8lH61cJLUKLI/TTKvJkpkZrndzS2KocAW+FgFx+ULn/ZF3v7dhf9YL oioMC1zzM7nOCdzR46lN4HASeuO84KJ4D2SFc0wFcJwYj4e7JS9XzE+p6B2Z8LZVj/vV OdMA== X-Gm-Message-State: AOJu0YxiRl3hQOD2bZqJu2Uegtc6NlLUPHc8rbhnE7JoqZLy6VQ/V7uC AObTENiQjTdmAoJKsCnRIXf2/7ywDvZoX9wbF98= X-Received: by 2002:a05:6a00:248b:b0:68f:d44c:22f8 with SMTP id c11-20020a056a00248b00b0068fd44c22f8mr1467772pfv.1.1697523386656; Mon, 16 Oct 2023 23:16:26 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 49/90] target/sparc: Move asi integer load/store to decodetree Date: Mon, 16 Oct 2023 23:12:03 -0700 Message-Id: <20231017061244.681584-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 Move LDDA, LDSBA, LDSHA, LDSWA, LDUBA, LDUHA, LDUWA, LDXA, STBA, STDA, STHA, STWA, STXA. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 31 +++++++++ target/sparc/translate.c | 128 +++++--------------------------------- 2 files changed, 48 insertions(+), 111 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 24c22c6ae3..94f1f5b9c9 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -230,6 +230,9 @@ RETRY 10 00001 111110 00000 0 0000000000000 &r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool @r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 +@r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 +@r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi imm=1 asi=-2 LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na @@ -246,6 +249,34 @@ STH 11 ..... 000110 ..... . ............. @r_r_ri_na STD 11 ..... 000111 ..... . ............. @r_r_ri_na STX 11 ..... 001110 ..... . ............. @r_r_ri_na +LDUW 11 ..... 010000 ..... . ............. @r_r_r_asi # LDUWA +LDUW 11 ..... 010000 ..... . ............. @r_r_i_asi # LDUWA +LDUB 11 ..... 010001 ..... . ............. @r_r_r_asi # LDUBA +LDUB 11 ..... 010001 ..... . ............. @r_r_i_asi # LDUBA +LDUH 11 ..... 010010 ..... . ............. @r_r_r_asi # LDUHA +LDUH 11 ..... 010010 ..... . ............. @r_r_i_asi # LDUHA +LDD 11 ..... 010011 ..... . ............. @r_r_r_asi # LDDA +LDD 11 ..... 010011 ..... . ............. @r_r_i_asi # LDDA +LDX 11 ..... 011011 ..... . ............. @r_r_r_asi # LDXA +LDX 11 ..... 011011 ..... . ............. @r_r_i_asi # LDXA +LDSB 11 ..... 011001 ..... . ............. @r_r_r_asi # LDSBA +LDSB 11 ..... 011001 ..... . ............. @r_r_i_asi # LDSBA +LDSH 11 ..... 011010 ..... . ............. @r_r_r_asi # LDSHA +LDSH 11 ..... 011010 ..... . ............. @r_r_i_asi # LDSHA +LDSW 11 ..... 011000 ..... . ............. @r_r_r_asi # LDSWA +LDSW 11 ..... 011000 ..... . ............. @r_r_i_asi # LDSWA + +STW 11 ..... 010100 ..... . ............. @r_r_r_asi # STWA +STW 11 ..... 010100 ..... . ............. @r_r_i_asi # STWA +STB 11 ..... 010101 ..... . ............. @r_r_r_asi # STBA +STB 11 ..... 010101 ..... . ............. @r_r_i_asi # STBA +STH 11 ..... 010110 ..... . ............. @r_r_r_asi # STHA +STH 11 ..... 010110 ..... . ............. @r_r_i_asi # STHA +STD 11 ..... 010111 ..... . ............. @r_r_r_asi # STDA +STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA +STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA +STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index db577ee963..587eb0ccd5 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2105,7 +2105,7 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) return resolve_asi(dc, asi, memop); } -static void gen_ld_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) +static void gen_ld_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: @@ -2136,16 +2136,7 @@ static void gen_ld_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void __attribute__((unused)) -gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) -{ - DisasASI da = get_asi(dc, insn, memop); - - gen_address_mask(dc, addr); - gen_ld_asi0(dc, &da, dst, addr); -} - -static void gen_st_asi0(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) +static void gen_st_asi(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: @@ -2217,15 +2208,6 @@ static void gen_st_asi0(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) } } -static void __attribute__((unused)) -gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) -{ - DisasASI da = get_asi(dc, insn, memop); - - gen_address_mask(dc, addr); - gen_st_asi0(dc, &da, src, addr); -} - static void gen_swap_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv src, TCGv addr) { @@ -2527,7 +2509,7 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } } -static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); TCGv lo = gen_dest_gpr(dc, rd + 1); @@ -2603,16 +2585,7 @@ static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) gen_store_gpr(dc, rd + 1, lo); } -static void __attribute__((unused)) -gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - - gen_address_mask(dc, addr); - gen_ldda_asi0(dc, &da, addr, rd); -} - -static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_stda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_load_gpr(dc, rd); TCGv lo = gen_load_gpr(dc, rd + 1); @@ -2704,15 +2677,6 @@ static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } -static void __attribute__((unused)) -gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - - gen_address_mask(dc, addr); - gen_stda_asi0(dc, &da, addr, rd); -} - static TCGv get_src1(DisasContext *dc, unsigned int insn) { unsigned int rs1 = GET_FIELD(insn, 13, 17); @@ -4658,7 +4622,7 @@ static bool do_ld_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) da = resolve_asi(dc, a->asi, mop); reg = gen_dest_gpr(dc, a->rd); - gen_ld_asi0(dc, &da, reg, addr); + gen_ld_asi(dc, &da, reg, addr); gen_store_gpr(dc, a->rd, reg); return advance_pc(dc); } @@ -4682,7 +4646,7 @@ static bool do_st_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) da = resolve_asi(dc, a->asi, mop); reg = gen_load_gpr(dc, a->rd); - gen_st_asi0(dc, &da, reg, addr); + gen_st_asi(dc, &da, reg, addr); return advance_pc(dc); } @@ -4704,7 +4668,7 @@ static bool trans_LDD(DisasContext *dc, arg_r_r_ri_asi *a) return false; } da = resolve_asi(dc, a->asi, MO_TEUQ); - gen_ldda_asi0(dc, &da, addr, a->rd); + gen_ldda_asi(dc, &da, addr, a->rd); return advance_pc(dc); } @@ -4721,7 +4685,7 @@ static bool trans_STD(DisasContext *dc, arg_r_r_ri_asi *a) return false; } da = resolve_asi(dc, a->asi, MO_TEUQ); - gen_stda_asi0(dc, &da, addr, a->rd); + gen_stda_asi(dc, &da, addr, a->rd); return advance_pc(dc); } @@ -5553,9 +5517,17 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x3: /* ldd, load double word */ case 0x9: /* ldsb, load signed byte */ case 0xa: /* ldsh, load signed halfword */ + case 0x10: /* lda, V9 lduwa, load word alternate */ + case 0x11: /* lduba, load unsigned byte alternate */ + case 0x12: /* lduha, load unsigned halfword alternate */ + case 0x13: /* ldda, load double word alternate */ + case 0x19: /* ldsba, load signed byte alternate */ + case 0x1a: /* ldsha, load signed halfword alternate */ g_assert_not_reached(); /* in decodetree */ case 0x08: /* V9 ldsw */ case 0x0b: /* V9 ldx */ + case 0x18: /* V9 ldswa */ + case 0x1b: /* V9 ldxa */ goto illegal_insn; /* in decodetree */ case 0xd: /* ldstub */ gen_ldstub(dc, cpu_val, cpu_addr, dc->mem_idx); @@ -5567,27 +5539,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL); break; #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x10: /* lda, V9 lduwa, load word alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TEUL); - break; - case 0x11: /* lduba, load unsigned byte alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_UB); - break; - case 0x12: /* lduha, load unsigned halfword alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TEUW); - break; - case 0x13: /* ldda, load double word alternate */ - if (rd & 1) { - goto illegal_insn; - } - gen_ldda_asi(dc, cpu_addr, insn, rd); - goto skip_move; - case 0x19: /* ldsba, load signed byte alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_SB); - break; - case 0x1a: /* ldsha, load signed halfword alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TESW); - break; case 0x1d: /* ldstuba -- XXX: should be atomically */ gen_ldstub_asi(dc, cpu_val, cpu_addr, insn); break; @@ -5598,12 +5549,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif #ifdef TARGET_SPARC64 - case 0x18: /* V9 ldswa */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TESL); - break; - case 0x1b: /* V9 ldxa */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TEUQ); - break; case 0x2d: /* V9 prefetch, no effect */ goto skip_move; case 0x30: /* V9 ldfa */ @@ -5635,7 +5580,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } gen_store_gpr(dc, rd, cpu_val); -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) +#if defined(TARGET_SPARC64) skip_move: ; #endif } else if (xop >= 0x20 && xop < 0x24) { @@ -5688,45 +5633,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } - } else if (xop < 8 || (xop >= 0x14 && xop < 0x18) || - xop == 0xe || xop == 0x1e) { -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - TCGv cpu_val = gen_load_gpr(dc, rd); -#endif - - switch (xop) { - case 0x4: /* st, store word */ - case 0x5: /* stb, store byte */ - case 0x6: /* sth, store halfword */ - case 0x7: /* std, store double word */ - g_assert_not_reached(); /* in decodetree */ - case 0x0e: /* V9 stx */ - goto illegal_insn; /* in decodetree */ -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x14: /* sta, V9 stwa, store word alternate */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUL); - break; - case 0x15: /* stba, store byte alternate */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_UB); - break; - case 0x16: /* stha, store halfword alternate */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUW); - break; - case 0x17: /* stda, store double word alternate */ - if (rd & 1) { - goto illegal_insn; - } - gen_stda_asi(dc, cpu_val, cpu_addr, insn, rd); - break; -#endif -#ifdef TARGET_SPARC64 - case 0x1e: /* V9 stxa */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUQ); - break; -#endif - default: - goto illegal_insn; - } } else if (xop > 0x23 && xop < 0x28) { if (gen_trap_ifnofpu(dc)) { goto jmp_insn; From patchwork Tue Oct 17 06:12:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734290 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324286wro; Mon, 16 Oct 2023 23:21:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0jrOnSTEusVnKePpE5uwrS13L28sYr+Q+7xBU/XEq1Nr1lN4zyyGYjvXk2WzyptV8a0L6 X-Received: by 2002:a05:622a:1755:b0:409:de05:4593 with SMTP id l21-20020a05622a175500b00409de054593mr1705116qtk.62.1697523670428; Mon, 16 Oct 2023 23:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523670; cv=none; d=google.com; s=arc-20160816; b=s8x2KUv1rOBj/L2B4Ugyw8wRbt7KKpVt14EleWWqDTAOqA5JYjBw5xpVExBYZzDng5 XPHu8sdDUWRrAMGX9DpSAVcOW5kMSSkUGUDvd03f2uC7sEaUHY3Wg6uWpq3TX5BkhOST +AN4lZhMaPnzoINroE1Y2ySDvo9UqgVI7oi8BY53Dnua9qUlWsQ+h01J2L7AnasdSqZM jBtdNnKRfZoHQPXFGM41AticT5TQbDRGTt1dQEhZk8Nh/OuY4cD4OgORYoA+C8nDUNvk BIb1mPxVQqzrsV5znQvM3OwPFWds7AIMCy57KPRBbwZ6e3McBipkF17NuwtGtYOQO4o1 FvwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=zRvcPjw6iOnW8M+jEQRp0Rzi/QWsBGj/pVxcQGWxd8w=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=etVU69j3Rw1sej9M0B6dFU5crbltARH6wjA++fxCv+tQITzi4owciim0cNifwIb/tl Jxl8kLS1VoCTEAHsQzsEZ8Nxsn80ND/ClPM+0IDWujkrSGAn5XtthA83n5RJ3E5dqD5z EP2MTGFeGmBWgeH9O5UsMpAjvaKNYj5MapBFKPJ/eMIix51CrVGAIRoX0mW29eDxydk8 XIMQy/xOEzjJPe8Lr0L5R8Ejp8EAPgHxyv1nCGHzDAwoHObuzG6wPf5YwNB0X68ewJzP /0VeEM9RW1AYrNP6ckHhjtbf1+Xo3a27rpLKK8TAt3TU6r/p0W+AeXB1oAdTJ7HRu8/X o8MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="L/VQkj94"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f8-20020ac87f08000000b00419628da44csi655553qtk.526.2023.10.16.23.21.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:10 -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="L/VQkj94"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNq-0003Sx-3q; Tue, 17 Oct 2023 02:16: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 1qsdNX-0002qj-Ce for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:31 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNU-0004hH-Tu for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:31 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-692c02adeefso3800026b3a.3 for ; Mon, 16 Oct 2023 23:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523387; x=1698128187; 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=zRvcPjw6iOnW8M+jEQRp0Rzi/QWsBGj/pVxcQGWxd8w=; b=L/VQkj94e22Y7+PSswjDpf6pA12TO5+URrfX+Y5/6srBXmlPHhhKc2WjYuVHw4DcLr IsxgAi8DQtJb2nRaWnoqU7TSaHEm+VCsEGAwzz1mFJPozfKPE0ljwJaV980uW2Gz/KhV vbVYRWF5Gxc3vP6WCeuZCb01xp1Slw8+GAZqgoE9nSw2EfGazGSLMuESbwkeRPi6RtZ3 uacjXNnzaoZPJDC/oa4jwAlu4q6XcAyXHKiR1GhdhgtXC3pQGMMfZIE+d8+bUrlSrl86 GvgwEv0q50QRrWKfpAO4YoAwell4gko9klRr7eTs1yn1FDogLF4XYzsWGTk5ihis2JFp Vc8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523387; x=1698128187; 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=zRvcPjw6iOnW8M+jEQRp0Rzi/QWsBGj/pVxcQGWxd8w=; b=STqor/w24AFgYlmG6KFsvCzla+R8idi8MFeYY3tkFuva6OwJp/bBbMUFLEL8o9aVrE B6wefEStuDC5y0nRSJDnxc2aorrbsMFp+ZRSSgfVQwCmpLNSiMlgFztZKQ0I6lICKRoF UCRnYssj4H4IiunhdHTlc2XvmuNTrrAa0IkuKfjQ9kTGkvW+34IAnBmv3/kVm9JwihTb Rnn/GjwdGoBKd8gYEtILcz1mVYCkgafD+FBqaf1CBJyfakUSOTadPtxhsy3kd0QiSN3E PbFUCj1M4hj71yzW4h+vRQgCgqAfa//LG97EjOXQ1k0Gs+ZTSR2VD5KOow50bWReW3pE yWjA== X-Gm-Message-State: AOJu0YynWK2ub2AHFjDXPY+KUY+88wEgYFmovq5GFn2oBQWK567PUSS/ sFemdU/ALPmMzgcMFOVW5zDJR3l4JZyvBM0kjhA= X-Received: by 2002:a05:6a00:2d13:b0:6be:3c44:c18b with SMTP id fa19-20020a056a002d1300b006be3c44c18bmr1441715pfb.25.1697523387502; Mon, 16 Oct 2023 23:16:27 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 50/90] target/sparc: Move LDSTUB, LDSTUBA to decodetree Date: Mon, 16 Oct 2023 23:12:04 -0700 Message-Id: <20231017061244.681584-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 Remove gen_ldstub_asi. Rename gen_ldstub_asi0 to gen_ldstub_asi. Merge gen_ldstub into gen_ldstub_asi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++++ target/sparc/translate.c | 46 +++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 94f1f5b9c9..3233528b08 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -277,6 +277,10 @@ STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA +LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na +LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA +LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 587eb0ccd5..c2ea027fe1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1849,13 +1849,6 @@ static void gen_swap(DisasContext *dc, TCGv dst, TCGv src, tcg_gen_atomic_xchg_tl(dst, addr, src, mmu_idx, memop | MO_ALIGN); } -static void gen_ldstub(DisasContext *dc, TCGv dst, TCGv addr, int mmu_idx) -{ - TCGv m1 = tcg_constant_tl(0xff); - gen_address_mask(dc, addr); - tcg_gen_atomic_xchg_tl(dst, addr, m1, mmu_idx, MO_UB); -} - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -2274,13 +2267,14 @@ gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) gen_store_gpr(dc, rd, oldv); } -static void gen_ldstub_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) +static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_ldstub(dc, dst, addr, da->mem_idx); + tcg_gen_atomic_xchg_tl(dst, addr, tcg_constant_tl(0xff), + da->mem_idx, MO_UB); break; default: /* ??? In theory, this should be raise DAE_invalid_asi. @@ -2308,15 +2302,6 @@ static void gen_ldstub_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void __attribute__((unused)) -gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) -{ - DisasASI da = get_asi(dc, insn, MO_UB); - - gen_address_mask(dc, addr); - gen_ldstub_asi0(dc, &da, dst, addr); -} - static void __attribute__((unused)) gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { @@ -4689,6 +4674,23 @@ static bool trans_STD(DisasContext *dc, arg_r_r_ri_asi *a) return advance_pc(dc); } +static bool trans_LDSTUB(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr, reg; + DisasASI da; + + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_UB); + + reg = gen_dest_gpr(dc, a->rd); + gen_ldstub_asi(dc, &da, reg, addr); + gen_store_gpr(dc, a->rd, reg); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5517,21 +5519,20 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x3: /* ldd, load double word */ case 0x9: /* ldsb, load signed byte */ case 0xa: /* ldsh, load signed halfword */ + case 0xd: /* ldstub */ case 0x10: /* lda, V9 lduwa, load word alternate */ case 0x11: /* lduba, load unsigned byte alternate */ case 0x12: /* lduha, load unsigned halfword alternate */ case 0x13: /* ldda, load double word alternate */ case 0x19: /* ldsba, load signed byte alternate */ case 0x1a: /* ldsha, load signed halfword alternate */ + case 0x1d: /* ldstuba */ g_assert_not_reached(); /* in decodetree */ case 0x08: /* V9 ldsw */ case 0x0b: /* V9 ldx */ case 0x18: /* V9 ldswa */ case 0x1b: /* V9 ldxa */ goto illegal_insn; /* in decodetree */ - case 0xd: /* ldstub */ - gen_ldstub(dc, cpu_val, cpu_addr, dc->mem_idx); - break; case 0x0f: /* swap, swap register with memory. Also atomically */ cpu_src1 = gen_load_gpr(dc, rd); @@ -5539,9 +5540,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL); break; #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x1d: /* ldstuba -- XXX: should be atomically */ - gen_ldstub_asi(dc, cpu_val, cpu_addr, insn); - break; case 0x1f: /* swapa, swap reg with alt. memory. Also atomically */ cpu_src1 = gen_load_gpr(dc, rd); From patchwork Tue Oct 17 06:12:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734314 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp325494wro; Mon, 16 Oct 2023 23:25:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGc8eTP3Aq0N3jic6YEK6bqWl6AUPXR+knHocQBx0/w6T82aTo582hePv5jw4rd6IlOnnpQ X-Received: by 2002:a05:620a:158b:b0:776:f8b5:c35 with SMTP id d11-20020a05620a158b00b00776f8b50c35mr1416038qkk.4.1697523902838; Mon, 16 Oct 2023 23:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523902; cv=none; d=google.com; s=arc-20160816; b=vcLaedME5U+WZENfR6pYPt3rUr7VteAocMWeD9AkfM77HKDcMH5F4parnOBAq5PI7r 8J8Kd+QgIVHv/h24sm+S8rUvIJNZA6YjAEhCEViEHjK+br4JL/VyXtU3omfnRWrWFcKb uZoNhOBoLk7qaZ+lIFhrROuVLE1hi00aW2ELCdUEOw03W9CaVcmwtNSWRLqc8FPfpvum FlHCTZPh8YuZXh5Ua/YeVHriwgcfcW4KNXcXih6WeJ6EIGMjBaqRCzIbD/6pYsCuOnIK mne+0riTglqiF5MJYxdWPw9CtOxxeSrlTWXIQ4QRCTxvFtLjq9ZOuiokxajwbOJGpqJc +Frw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=oynuqxebIh5u+8YIx7roHVDtnKQBfZX9HSGTH2xmAUw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=tZCMzDk2rD2xpptOa5CZxYzOUA4AadHYU9CNu1/DhgF9y0dX09JN4+gJwH4n6yl6Vk DrUFWtxvXLnCL+V77utDZOdZWU/YISnjDlY8FIEsAu0XRRxDvAGYfsCQDQhPQqpXbLSN neBuHGEe0gzHnKmdaA14EDQCdcldrASI8OzTiYY+iFR5BNryMx+QEp9Grjag0mfgo4PL 1zulUwF4ksU7j2Qnuaft3/AqaxfmDOjgfX3pLCWykg7Bk1qkFBrrSHz891A6btos4KSy 2RC2VUPeXYjlZ6gbryBHd+yMKBAbeTYVguDiquvA5HRHp5t9kGeDdqqzhBdUYGmX5A9x cb4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jyRjiuJs; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id mx23-20020a0562142e1700b0066cf12ca208si528734qvb.309.2023.10.16.23.25.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:25: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=jyRjiuJs; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNl-0003HB-Qj; Tue, 17 Oct 2023 02:16:45 -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 1qsdNY-0002rL-1O for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:33 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNV-0004hZ-TS for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:31 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b20577ef7bso2962177b3a.3 for ; Mon, 16 Oct 2023 23:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523388; x=1698128188; 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=oynuqxebIh5u+8YIx7roHVDtnKQBfZX9HSGTH2xmAUw=; b=jyRjiuJsNDV9FgsLHRSq5plgDC6McePKwxYh8WlDaCumaS6UtwV7zAqzLgMf6wTw// 2sInmwX2f6HIUhSCqateCXfBx659BF/v0GnXXdRjY2G2u0pelgUMAz8dHHNz7TmyBemV Bz5CYy7mppE/MoI0d7hEUwzMfHkjpCTopO7G9knTAvPZzD46V2mb0hHtZnwIlB7xKHhs cpGPJJvInWHE9CSU0KRbODzGUuJ59M7u6iKdqV6nksTTNelk+97fJwLb6hkmWmcXWUlK Te9nCqJfa3SO81fzpMsnbonkhFxfRz5ms1Xnt7e0NvXmhDRGGjPke2aXggy53i4tFvxz PcMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523388; x=1698128188; 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=oynuqxebIh5u+8YIx7roHVDtnKQBfZX9HSGTH2xmAUw=; b=tRrhoJSiXV+hn7oSp+pkb8UJL42eKNYrzQJXOcjC4aHHKJpWKfLB0ixB+5UKTmRF4h 0xozqSi9oygsgVvjDhDz9FlE29v2CLhLpEnUPiGyqxULxKfQFFwSFYVHnQvGDyEyKxzK XHMaBhGyGFaxLO3XXEwmERjI/g0IthEleJ5Mfzk8I1qekdzNBaPPyWU0ZwB5iWJ7hNia T3oo3lrL/9PQCSmQ23knDFO+zgtfuP8mu7bDgNMOhjINEI0wBak3+ER959wWS1c+v3uo HkHsnzze0oKTZOfFFIb3mUTbFnJ14H0SKV7K/9UHjqigek2TFlZc9joQ97v9fqmVMELj jayg== X-Gm-Message-State: AOJu0YxUWJnVJrbYjooD2eW8YgAXp9QgZBWY3fuM8dIeFov+Bg8L29tV MotzqWEZqSs23u6WY3bbwZqxaCPhQoGgpBeHr4o= X-Received: by 2002:a05:6a00:1a86:b0:6b5:92d9:ef44 with SMTP id e6-20020a056a001a8600b006b592d9ef44mr1236088pfv.7.1697523388278; Mon, 16 Oct 2023 23:16:28 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 51/90] target/sparc: Move SWAP, SWAPA to decodetree Date: Mon, 16 Oct 2023 23:12:05 -0700 Message-Id: <20231017061244.681584-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 Remove gen_swap_asi. Rename gen_swap_asi0 to gen_swap_asi. Merge gen_swap into gen_swap_asi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 58 +++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 3233528b08..32ac9cdbf7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -281,6 +281,10 @@ LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA +SWAP 11 ..... 001111 ..... . ............. @r_r_ri_na +SWAP 11 ..... 011111 ..... . ............. @r_r_r_asi # SWAPA +SWAP 11 ..... 011111 ..... . ............. @r_r_i_asi # SWAPA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index c2ea027fe1..e1b8cdd798 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1842,13 +1842,6 @@ static void gen_ne_fop_QD(DisasContext *dc, int rd, int rs, gen_update_fprs_dirty(dc, QFPREG(rd)); } -static void gen_swap(DisasContext *dc, TCGv dst, TCGv src, - TCGv addr, int mmu_idx, MemOp memop) -{ - gen_address_mask(dc, addr); - tcg_gen_atomic_xchg_tl(dst, addr, src, mmu_idx, memop | MO_ALIGN); -} - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -2201,14 +2194,15 @@ static void gen_st_asi(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) } } -static void gen_swap_asi0(DisasContext *dc, DisasASI *da, - TCGv dst, TCGv src, TCGv addr) +static void gen_swap_asi(DisasContext *dc, DisasASI *da, + TCGv dst, TCGv src, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_swap(dc, dst, src, addr, da->mem_idx, da->memop); + tcg_gen_atomic_xchg_tl(dst, addr, src, + da->mem_idx, da->memop | MO_ALIGN); break; default: /* ??? Should be DAE_invalid_asi. */ @@ -2217,15 +2211,6 @@ static void gen_swap_asi0(DisasContext *dc, DisasASI *da, } } -static void __attribute__((unused)) -gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, TCGv addr, int insn) -{ - DisasASI da = get_asi(dc, insn, MO_TEUL); - - gen_address_mask(dc, addr); - gen_swap_asi0(dc, &da, dst, src, addr); -} - static void gen_cas_asi0(DisasContext *dc, DisasASI *da, TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) { @@ -4691,6 +4676,24 @@ static bool trans_LDSTUB(DisasContext *dc, arg_r_r_ri_asi *a) return advance_pc(dc); } +static bool trans_SWAP(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr, dst, src; + DisasASI da; + + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_TEUL); + + dst = gen_dest_gpr(dc, a->rd); + src = gen_load_gpr(dc, a->rd); + gen_swap_asi(dc, &da, dst, src, addr); + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4702,7 +4705,7 @@ static bool trans_LDSTUB(DisasContext *dc, arg_r_r_ri_asi *a) static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; - TCGv cpu_src1; + TCGv cpu_src1 __attribute__((unused)); TCGv cpu_src2 __attribute__((unused)); TCGv_i32 cpu_src1_32, cpu_src2_32, cpu_dst_32; TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; @@ -5520,6 +5523,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x9: /* ldsb, load signed byte */ case 0xa: /* ldsh, load signed halfword */ case 0xd: /* ldstub */ + case 0x0f: /* swap */ case 0x10: /* lda, V9 lduwa, load word alternate */ case 0x11: /* lduba, load unsigned byte alternate */ case 0x12: /* lduha, load unsigned halfword alternate */ @@ -5527,25 +5531,13 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x19: /* ldsba, load signed byte alternate */ case 0x1a: /* ldsha, load signed halfword alternate */ case 0x1d: /* ldstuba */ + case 0x1f: /* swapa */ g_assert_not_reached(); /* in decodetree */ case 0x08: /* V9 ldsw */ case 0x0b: /* V9 ldx */ case 0x18: /* V9 ldswa */ case 0x1b: /* V9 ldxa */ goto illegal_insn; /* in decodetree */ - case 0x0f: - /* swap, swap register with memory. Also atomically */ - cpu_src1 = gen_load_gpr(dc, rd); - gen_swap(dc, cpu_val, cpu_src1, cpu_addr, - dc->mem_idx, MO_TEUL); - break; -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x1f: /* swapa, swap reg with alt. memory. Also - atomically */ - cpu_src1 = gen_load_gpr(dc, rd); - gen_swap_asi(dc, cpu_val, cpu_src1, cpu_addr, insn); - break; -#endif #ifdef TARGET_SPARC64 case 0x2d: /* V9 prefetch, no effect */ goto skip_move; From patchwork Tue Oct 17 06:12:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734307 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324721wro; Mon, 16 Oct 2023 23:22:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXoVp+/uX2/++fF7RBSUwxl2WAijZfWsfohx78pW5PbsfU68DlY06tPk1Ao8dV+bjhMKQu X-Received: by 2002:a05:620a:4554:b0:775:6c97:fbae with SMTP id u20-20020a05620a455400b007756c97fbaemr1112489qkp.39.1697523761921; Mon, 16 Oct 2023 23:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523761; cv=none; d=google.com; s=arc-20160816; b=i06UrH3T8PxuXkbK6mfkXZPExA1OClp/8MDyVD7o42D10TiW2LQyNUHNFe5Y88sVPL hUCEcuSmQzhwkt30TUsyv11bNnWFlMVRU4BcbncaVmh0evKFkjvGn0WhAhzKDxFi5LYM RsQKxSBHUKmx8G+S7F5YcH917xdO66FOSeko+KeVzvGoC8Re6aNPXlbdYj0DUKB+HdBo UIPUMgvdKNzhURch4XEQFn4ozw6OweEGkpdC/dRL6c4UgC9tluqA8HEP5KZ8DaIomzsp 4hliz1ijmYPLy5gpAHSUgnA2q+9RMST9rsJzRlLglkXG8uWbo8edjt8sO9PmizMPcWNK wDlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=EUH/zCjHRWrJhuZO0lPAiKH0TunCvsKy8p9HhauQ8og=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Rk4f8xFBvT9v5xya5I/NMIGAdY/0AYQ8jxY9LY6DAkZqgSadLAGdTi3+daypbZSsTc IndvnudZv1u97E+QQ89qA+vZRSkwCH9agxYc+6zQ8ksd1AR9NMlzPeiCAWIpY+oggB3z cs8t/0gKdosLvguisj3BrxJ1whVuS2moR3iXTF2oFGzztROKeFMyT1lOYV/ZF6IRKbMZ 2GxPqZzQMJDFw1Qev8El4yaW2eV/JUe/JmBIUB6BP90Wmehyv4otimBpEtbxG1Xo7OS7 vrAPFiQ9DvTwS4pv8NeRXMdoBQJzngXDVw2a9Yz9+8+kpLQ26EI2VZWWr0TNJZin/xkd 5HTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cyg2eYlq; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bq11-20020a05620a468b00b00773bb585660si628430qkb.348.2023.10.16.23.22.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22: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=cyg2eYlq; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNm-0003Jx-NM; Tue, 17 Oct 2023 02:16:46 -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 1qsdNY-0002s4-7B for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:33 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNW-0004hm-Af for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:31 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6b44befac59so2671039b3a.0 for ; Mon, 16 Oct 2023 23:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523389; x=1698128189; 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=EUH/zCjHRWrJhuZO0lPAiKH0TunCvsKy8p9HhauQ8og=; b=cyg2eYlqkj4ayPWsx+eC9tjJAaUMp3xEpbmu4v4w2Gw/BTeyKBOKTLLgM4ryW0E2ns 2ARVzywkgEn4Jn0q7MQuFyT8pG+j+0fSp/dAC23MDnTblLcDRHz3WiRVirQC2YwdmLF5 R322ErcRKlKrBY+Gd7pUS3L3c9ZWu7X6eSaN3i/tR4knghTORtvv8LU8z56iY1TT2+ur o8aGTZEJus04XTpTQqfLAYeS2g1H+C7AsHdU/lYZWueuvUSBrvmDJlnwjDnMF8osNZ6P 05dfkxS2CBgK+rNvioveNRR+28P84wXjKlRoG0dK3pAlj9YcOdLy4ILNKqXehPc7p/JB qgdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523389; x=1698128189; 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=EUH/zCjHRWrJhuZO0lPAiKH0TunCvsKy8p9HhauQ8og=; b=g5gVGy/V2MOk2gd3QhZIwQLd+Jgcb1kE0VlqevRj8Rn4j/eb0jHJO1BK7LgV1DSvMr buh4uLUgWaLKtszQBWRd4JAGvLNU+re+mmmCo2utqaIUWhku0/LGjyVIQpz5jYxTtlku q0/Er+019SiUsPDRjZm/z5E88WvjRGbf1UuvuU0P7QxFTxmQCAVG0f1S+5SM8opkRqyn NzuHj9mfWpwvzVblRKe56BhcPwdD8mP7y8D3qyybyGqs10rFdWqtzjjg0Uf18vGbwU/c RWvSMi9drS37taA8VOl4/8NhEkN7TCK4uqavArJcWLr9Gkg8JaNGczfFbpecxmR6Sp37 VgGQ== X-Gm-Message-State: AOJu0YxtuB7pGTeGjzEC/7Qg2PRtpHMj5Wl7pex1GUutll8ZzeQg/DvZ ISKTzFi/ScrVHOwlVnbRHBRsMW7WEmyFX3ny+N0= X-Received: by 2002:a05:6a20:748d:b0:133:1d62:dcbd with SMTP id p13-20020a056a20748d00b001331d62dcbdmr1427539pzd.28.1697523389003; Mon, 16 Oct 2023 23:16:29 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 52/90] target/sparc: Move CASA, CASXA to decodetree Date: Mon, 16 Oct 2023 23:12:06 -0700 Message-Id: <20231017061244.681584-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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 Remove gen_cas_asi, gen_casx_asi. Rename gen_cas_asi0 to gen_cas_asi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 ++++ target/sparc/translate.c | 71 +++++++++++++++------------------------ 2 files changed, 35 insertions(+), 43 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 32ac9cdbf7..8e6a24e094 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -233,6 +233,8 @@ RETRY 10 00001 111110 00000 0 0000000000000 @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 +@casa_imm .. rd:5 ...... rs1:5 1 00000000 rs2_or_imm:5 \ + &r_r_ri_asi imm=1 asi=-2 LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na @@ -285,6 +287,11 @@ SWAP 11 ..... 001111 ..... . ............. @r_r_ri_na SWAP 11 ..... 011111 ..... . ............. @r_r_r_asi # SWAPA SWAP 11 ..... 011111 ..... . ............. @r_r_i_asi # SWAPA +CASA 11 ..... 111100 ..... . ............. @r_r_r_asi +CASA 11 ..... 111100 ..... . ............. @casa_imm +CASXA 11 ..... 111110 ..... . ............. @r_r_r_asi +CASXA 11 ..... 111110 ..... . ............. @casa_imm + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e1b8cdd798..6b860dbd75 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2211,8 +2211,8 @@ static void gen_swap_asi(DisasContext *dc, DisasASI *da, } } -static void gen_cas_asi0(DisasContext *dc, DisasASI *da, - TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) +static void gen_cas_asi(DisasContext *dc, DisasASI *da, + TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: @@ -2228,30 +2228,6 @@ static void gen_cas_asi0(DisasContext *dc, DisasASI *da, } } -static void __attribute__((unused)) -gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUL); - TCGv oldv = gen_dest_gpr(dc, rd); - TCGv newv = gen_load_gpr(dc, rd); - - gen_address_mask(dc, addr); - gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); - gen_store_gpr(dc, rd, oldv); -} - -static void __attribute__((unused)) -gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv oldv = gen_dest_gpr(dc, rd); - TCGv newv = gen_load_gpr(dc, rd); - - gen_address_mask(dc, addr); - gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); - gen_store_gpr(dc, rd, oldv); -} - static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { @@ -2861,6 +2837,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_64(C) false #endif #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_CASA(C) ((C)->def->features & CPU_FEATURE_CASA) #define avail_DIV(C) ((C)->def->features & CPU_FEATURE_DIV) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) @@ -4694,6 +4671,28 @@ static bool trans_SWAP(DisasContext *dc, arg_r_r_ri_asi *a) return advance_pc(dc); } +static bool do_casa(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv addr, o, n, c; + DisasASI da; + + addr = gen_ldst_addr(dc, a->rs1, true, 0); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, mop); + + o = gen_dest_gpr(dc, a->rd); + n = gen_load_gpr(dc, a->rd); + c = gen_load_gpr(dc, a->rs2_or_imm); + gen_cas_asi(dc, &da, o, n, c, addr); + gen_store_gpr(dc, a->rd, o); + return advance_pc(dc); +} + +TRANS(CASA, CASA, do_casa, a, MO_TEUL) +TRANS(CASXA, 64, do_casa, a, MO_TEUQ) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5497,9 +5496,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_addr = tcg_temp_new(); tcg_gen_mov_tl(cpu_addr, get_src1(dc, insn)); - if (xop == 0x3c || xop == 0x3e) { - /* V9 casa/casxa : no offset */ - } else if (IS_IMM) { /* immediate */ + if (IS_IMM) { /* immediate */ simm = GET_FIELDs(insn, 19, 31); if (simm != 0) { tcg_gen_addi_tl(cpu_addr, cpu_addr, simm); @@ -5712,22 +5709,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } gen_stf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); break; +#endif case 0x3e: /* V9 casxa */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_casx_asi(dc, cpu_addr, cpu_src2, insn, rd); - break; -#endif -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x3c: /* V9 or LEON3 casa */ -#ifndef TARGET_SPARC64 - CHECK_IU_FEATURE(dc, CASA); -#endif - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_cas_asi(dc, cpu_addr, cpu_src2, insn, rd); - break; -#endif + goto illegal_insn; /* in decodetree */ default: goto illegal_insn; } From patchwork Tue Oct 17 06:12:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734339 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326785wro; Mon, 16 Oct 2023 23:29:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGq0lbmqpgiExlzykfms90/4mSVBgkCGEBWhHyJr56Laj4NqF0ajo/CvEjvaomJQSe1DmYH X-Received: by 2002:a05:620a:15bb:b0:767:2471:c880 with SMTP id f27-20020a05620a15bb00b007672471c880mr1271334qkk.28.1697524159564; Mon, 16 Oct 2023 23:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524159; cv=none; d=google.com; s=arc-20160816; b=bcI+J2M5umM1cbaIGJux8h2QaO2NbeF+SqY4k1H9Mdy+I69bgfd5onJlhF8TXmPUJu ppojNH9PcTk0yx8VFESyUbC3sOdBgw8pbhSTZcj2QPjpBj3M5aWXmic56vRr7ccEM1Tk eh/S53PhgzC+dVxWJQJLpf5tu1cp32uVK0nFXn+DAVjNhDLqRJmfUTOi3iV3eUmGkO4M uOfg9zfWh5e78KtrIzeiMvqHEf1vIsCXzRTFUeAALPRceRm1lh0Lt+10vEb9At2dZY8v 82a767LgV82FcEpQOcCashUbW4LABIgMCu+PhaL4xEzlQZBEzAtjQ6Wb2fI3ypgSwHH6 vhKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Rm7z9mYq9FPEIcvf5xAJUJvg0gWyaJ4v7z2/vituMlg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=MkyHViKrjeE3zI7FUvlMSIDflXuapN3N8Te8Sful8I7B8fvK09fXJwbUywFux9oIfr cXMGaGK6sW7EsXo3qyISGpMhpbxVwn4Qlp5ECZ/tsjwm5LC1qRyY/nWsZD+C8PW+zNOi 2fzrhgR+4GUppZsRkav/U/ew9Nw/iaiyRUMygbLy/xOnWMubx9i3/AbqTUCLFawi7Ydd Ti0w5wLmXWGDPbVIVD9i0swahiErCyJpNOd/+VpE7xTQCS9mGqlo6x6a743lZ5+kd8Hv +6LJvReEqlW8wqrZwDE5k3lcyrFyJav1gAzJKlqpG0eWvnJLTkokgy1EpRYzvyn2lSrq M2Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e8oAQXz9; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id az17-20020a05620a171100b00775a6554b41si641509qkb.285.2023.10.16.23.29.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:29:19 -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=e8oAQXz9; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNr-0003U0-0j; Tue, 17 Oct 2023 02:16:51 -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 1qsdNY-0002sI-Sh for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:33 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNX-0004iB-6g for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:32 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so2952826b3a.0 for ; Mon, 16 Oct 2023 23:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523390; x=1698128190; 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=Rm7z9mYq9FPEIcvf5xAJUJvg0gWyaJ4v7z2/vituMlg=; b=e8oAQXz9otL0F+IbDLLcnUgePgVLmFlJewaqGSjp8I+FVIeylPGweB5Weu7FCJsJ3p 4/S2yrJT3tX7+8WbFgnd6Y3HDC9h/TJmg9X1PlsMccdoeh6DOQw1PBE2M1UWChiqY9d+ eNoufJFGp3JV8olF8wZQI2jrYCIMgcKPF6z1F9ORt+srv++X5MMV82ebEFJOoACpqH5l x/4cvvyq5UyPD13B7hhfNgCaWMv2uBCTkoWjzlpi7zY8VS8YrQfAh8Ipzs/HDBHrXt9B ub4LsjpDCJiR7h7HJ3A7Lkru0Bthyk8tXvCni/AuTiwwJ/MYUWAMQ/iSF2/vrKWWLxBx 8CrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523390; x=1698128190; 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=Rm7z9mYq9FPEIcvf5xAJUJvg0gWyaJ4v7z2/vituMlg=; b=urxz70x1lORrCx736Cv7kDfE74PP3/m7kXom1H+1r2kAI7UR7l86LUJwON70YgWjMu qr2lc3yODIeJecYYDsicpAhybW7rOQ97nA1EkWFr00mcl/dYnFgv1nBc9DTCFv/WJTUo /0+PSdekKa0iglS187AoLZ8KMye4N9Irn6+t2I88q3oKQgVbhbbPKJIIneGXsmly3og6 1vYhcZxUiL7PUYgwsFj+Q43I1Z/C0urQd5AbBtR8VXfuKxTPAsKAOA0+FXzpu/D8jSxn MvCSsiYEyGEj3BrNTgKKpwz27XLMakbDfTgmUGp0r89bF+XttpLCV74Z7JAzgvWBKwdH DRnQ== X-Gm-Message-State: AOJu0Yzn9KNvKWnf8U5dC+nQBSfwqxXC595OMbcr84ErQexmUJKDIIs1 ox2hTT98nO5u6InIqL9CNBIy0bapkJ+N3po9ruw= X-Received: by 2002:a05:6a00:1ad2:b0:6b8:f7ed:4deb with SMTP id f18-20020a056a001ad200b006b8f7ed4debmr1367119pfv.13.1697523389757; Mon, 16 Oct 2023 23:16:29 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 53/90] target/sparc: Move PREFETCH, PREFETCHA to decodetree Date: Mon, 16 Oct 2023 23:12:07 -0700 Message-Id: <20231017061244.681584-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 8 ++++++-- target/sparc/translate.c | 14 ++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 8e6a24e094..86108679eb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -224,6 +224,9 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 + ## ## Major Opcode 11 -- load and store instructions ## @@ -292,8 +295,9 @@ CASA 11 ..... 111100 ..... . ............. @casa_imm CASXA 11 ..... 111110 ..... . ............. @r_r_r_asi CASXA 11 ..... 111110 ..... . ............. @casa_imm -NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 -NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 +NOP_v9 11 ----- 101101 ----- 0 00000000 ----- # PREFETCH +NOP_v9 11 ----- 101101 ----- 1 ------------- # PREFETCH +NOP_v9 11 ----- 111101 ----- - ------------- # PREFETCHA NCP 11 ----- 110000 ----- --------- ----- # v8 LDC NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6b860dbd75..1b402de49f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4101,6 +4101,14 @@ static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) return false; } +static bool trans_NOP_v9(DisasContext *dc, arg_NOP_v9 *a) +{ + if (avail_64(dc)) { + return advance_pc(dc); + } + return false; +} + static bool do_cc_arith(DisasContext *dc, arg_r_r_ri *a, int cc_op, void (*func)(TCGv, TCGv, TCGv), void (*funci)(TCGv, TCGv, target_long)) @@ -5534,10 +5542,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x0b: /* V9 ldx */ case 0x18: /* V9 ldswa */ case 0x1b: /* V9 ldxa */ + case 0x2d: /* V9 prefetch */ + case 0x3d: /* V9 prefetcha */ goto illegal_insn; /* in decodetree */ #ifdef TARGET_SPARC64 - case 0x2d: /* V9 prefetch, no effect */ - goto skip_move; case 0x30: /* V9 ldfa */ if (gen_trap_ifnofpu(dc)) { goto jmp_insn; @@ -5552,8 +5560,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_ldf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); gen_update_fprs_dirty(dc, DFPREG(rd)); goto skip_move; - case 0x3d: /* V9 prefetcha, no effect */ - goto skip_move; case 0x32: /* V9 ldqfa */ CHECK_FPU_FEATURE(dc, FLOAT128); if (gen_trap_ifnofpu(dc)) { From patchwork Tue Oct 17 06:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734295 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324342wro; Mon, 16 Oct 2023 23:21:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtbcoTLrZAq/LWr9RFbyYjN6Eu9tRwGNwLSMdIuti5eSMNAE2hjdv2U18QcjxISIsKZDZO X-Received: by 2002:ae9:e30b:0:b0:765:aa35:f03f with SMTP id v11-20020ae9e30b000000b00765aa35f03fmr1217356qkf.37.1697523682196; Mon, 16 Oct 2023 23:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523682; cv=none; d=google.com; s=arc-20160816; b=xOWFccUtrHeph7JMz9lriqJHZ/3SUSs3gCotAiQFTZ2tQF6ZYSr3xmInzS9ZFLFyPI a/QHy3pPFJWITkmVJD9Cgn7S7HTMBpS8jeNPqyjGaTsNPD29IsgTSbIbJgfAJKuzK5D3 7p66PVUsv1Z5l9IuBlne2p0912h3dUnHgE8joyDerKffb48USTDwyHFquOX6/phdordG Lmcs1g/ffTePDvxRn67cp21WAFxmXXlTj6SE/VCzkgCiVAmhKZ9X/y+9EmrfnANOcNNZ fBkZyB91aYVUQkRNzcjnY/ySdWz6/Zpc3gU2acXrZ6AD4eCuHxu5leYb43z7gnv4bCs2 38RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=3d0wuJleGzi80YFJZIm7tQsbxOIGrrhLpnqdAP71A+g=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=jqwad3ASSIraPcW5fF5W/Ap25tCe4A33UwTQ+i62AKTAtRN/eATtVhhCiB3GtoKist qG6RqK9cPelgOwBHAtFiD2fSvN8JWyIYMN8XSZWTf/oI3ntApH0/bumoLuwMz22ICXx4 AJQ0KvDCP+wCdPfB8RZZg6WdQaBwTGRHIIqMlg+KNTc2j8MJZ8O+eJayHG3sgV2m4qYe Z5QJgcGFyy5jH1/ZaYY0+3n9rYTOZ343X4oQGsmsEiIyJARNTjxHyTbC3yh2VXcv99U2 JHNVZS9rJQyq9vEiyp06kiuOPdujQ3IbgHleBLtPb7H3TrE4E7Fs9PQ+icqJrWyaK724 xEQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nf3eB9cF; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c24-20020a05620a201800b0077263b30b40si598804qka.196.2023.10.16.23.21.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:22 -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=nf3eB9cF; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNm-0003JV-H9; Tue, 17 Oct 2023 02:16:46 -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 1qsdNZ-0002xm-Sm for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:35 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNX-0004iM-Ob for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:33 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6c7bbfb7a73so3614787a34.3 for ; Mon, 16 Oct 2023 23:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523390; x=1698128190; 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=3d0wuJleGzi80YFJZIm7tQsbxOIGrrhLpnqdAP71A+g=; b=nf3eB9cFlUmkCjwYwc1/8UWpHDqs3dYgr4KAITGLfd2OK5fd1NGUv/3FTpA/nP4YUN YcKY0Rkjhl2+AWSW6WEvhz2CtJwX1hCHjWx4vc45Hdr/A+rx04kxfhCHwO8WHzT8fwUi Zw3nvv2xXiwr0MJcBLF3sNU2Uk6yv7JMAmv+Oa1ybpD8ww8aBQOnCC8JNzCniHGgu97p pFLg7xAY/CcMA5YjklGK4tT+qF/xpG33akLkgUC8ZHZhgbohZvIqQAR+L6idVcmnOgNo +3YRW0o2I3SPwZhMaEBLuNEHudKafy5KcfI5G20GqHD5mFE9QqTBiFSNgFes0F3x9YUE 03SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523390; x=1698128190; 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=3d0wuJleGzi80YFJZIm7tQsbxOIGrrhLpnqdAP71A+g=; b=q/igljeCoGCnv0MOtq97GSSctI9IqugIu2rEpFjB+3SsVISaj/oT0t3Ja12xyheULW 445vtAeska6qfbOocexWvYxuKs5xF2xUBGQg+gdBH0ugQErwopI6zx1LzCU0RiLHMGvu 3OZD76wtEJMcGfUCWKVGrEEzHMAQH0ZdJ6KRaxoyhViIAtObRGvYh9Xu5U+Y3umSJEnx qi0/qxvHQMdjYnB6G3PvNbZWtOhnLvWJ1j+aR+gK8t3a2LmGV44QttUrvVBJD/QWHRhL r/joQ/n1HY3Q93soIHnhPy3apCnnrpCZjVBqYu0ZUCQvVxP9rW2nRr3QZJwouOai+q8a h/uw== X-Gm-Message-State: AOJu0Yz4eZ2o82+jEMt2D/92OG0W2i14R6p1eShq64uLb6LSvY5XG7cZ 1gkxPOl8zoi2WspjjrnCrCbkoJ3H3oCLZ1EOHd8= X-Received: by 2002:a9d:74d5:0:b0:6bd:63b:4b21 with SMTP id a21-20020a9d74d5000000b006bd063b4b21mr1418167otl.15.1697523390520; Mon, 16 Oct 2023 23:16:30 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 54/90] target/sparc: Split out fp ldst functions with asi precomputed Date: Mon, 16 Oct 2023 23:12:08 -0700 Message-Id: <20231017061244.681584-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.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 Take the operation size from the MemOp instead of a separate parameter. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 136 ++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 58 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 1b402de49f..822e74fa3e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2263,35 +2263,40 @@ static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void __attribute__((unused)) -gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); + MemOp memop = da->memop; + MemOp size = memop & MO_SIZE; TCGv_i32 d32; TCGv_i64 d64; - switch (da.type) { + /* TODO: Use 128-bit load/store below. */ + if (size == MO_128) { + memop = (memop & ~MO_SIZE) | MO_64; + } + + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); + memop |= MO_ALIGN_4; switch (size) { - case 4: + case MO_32: d32 = gen_dest_fpr_F(dc); - tcg_gen_qemu_ld_i32(d32, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_ld_i32(d32, addr, da->mem_idx, memop); gen_store_fpr_F(dc, rd, d32); break; - case 8: - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + + case MO_64: + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da->mem_idx, memop); break; - case 16: + + case MO_128: d64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(d64, addr, da.mem_idx, da.memop | MO_ALIGN_4); + tcg_gen_qemu_ld_i64(d64, addr, da->mem_idx, memop); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(cpu_fpr[rd/2+1], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2301,24 +2306,19 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_BLOCK: /* Valid for lddfa on aligned registers only. */ - if (size == 8 && (rd & 7) == 0) { - MemOp memop; + if (size == MO_64 && (rd & 7) == 0) { TCGv eight; int i; - gen_address_mask(dc, addr); - /* The first operation checks required alignment. */ - memop = da.memop | MO_ALIGN_64; eight = tcg_constant_tl(8); for (i = 0; ; ++i) { - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, - da.mem_idx, memop); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, + memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } tcg_gen_add_tl(addr, addr, eight); - memop = da.memop; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2327,10 +2327,9 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_SHORT: /* Valid for lddfa only. */ - if (size == 8) { - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN); + if (size == MO_64) { + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN); } else { gen_exception(dc, TT_ILL_INSN); } @@ -2338,8 +2337,8 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) default: { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(da.memop | MO_ALIGN); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(memop | MO_ALIGN); save_state(dc); /* According to the table in the UA2011 manual, the only @@ -2347,21 +2346,23 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) the NO_FAULT asis. We still need a helper for these, but we can just use the integer asi helper for them. */ switch (size) { - case 4: + case MO_32: d64 = tcg_temp_new_i64(); gen_helper_ld_asi(d64, tcg_env, addr, r_asi, r_mop); d32 = gen_dest_fpr_F(dc); tcg_gen_extrl_i64_i32(d32, d64); gen_store_fpr_F(dc, rd, d32); break; - case 8: - gen_helper_ld_asi(cpu_fpr[rd / 2], tcg_env, addr, r_asi, r_mop); + case MO_64: + gen_helper_ld_asi(cpu_fpr[rd / 2], tcg_env, addr, + r_asi, r_mop); break; - case 16: + case MO_128: d64 = tcg_temp_new_i64(); gen_helper_ld_asi(d64, tcg_env, addr, r_asi, r_mop); tcg_gen_addi_tl(addr, addr, 8); - gen_helper_ld_asi(cpu_fpr[rd/2+1], tcg_env, addr, r_asi, r_mop); + gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr, + r_asi, r_mop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2373,36 +2374,51 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } static void __attribute__((unused)) -gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); + DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : + size == 8 ? MO_TEUQ : MO_TE | MO_128)); + + gen_address_mask(dc, addr); + gen_ldf_asi0(dc, &da, addr, rd); +} + +static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +{ + MemOp memop = da->memop; + MemOp size = memop & MO_SIZE; TCGv_i32 d32; - switch (da.type) { + /* TODO: Use 128-bit load/store below. */ + if (size == MO_128) { + memop = (memop & ~MO_SIZE) | MO_64; + } + + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); + memop |= MO_ALIGN_4; switch (size) { - case 4: + case MO_32: d32 = gen_load_fpr_F(dc, rd); - tcg_gen_qemu_st_i32(d32, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_st_i32(d32, addr, da->mem_idx, memop | MO_ALIGN); break; - case 8: - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + case MO_64: + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN_4); break; - case 16: + case MO_128: /* Only 4-byte alignment required. However, it is legal for the cpu to signal the alignment fault, and the OS trap handler is required to fix it up. Requiring 16-byte alignment here avoids having to probe the second page before performing the first write. */ - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_16); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(cpu_fpr[rd/2+1], addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); break; default: g_assert_not_reached(); @@ -2411,24 +2427,19 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_BLOCK: /* Valid for stdfa on aligned registers only. */ - if (size == 8 && (rd & 7) == 0) { - MemOp memop; + if (size == MO_64 && (rd & 7) == 0) { TCGv eight; int i; - gen_address_mask(dc, addr); - /* The first operation checks required alignment. */ - memop = da.memop | MO_ALIGN_64; eight = tcg_constant_tl(8); for (i = 0; ; ++i) { - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, - da.mem_idx, memop); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, + memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } tcg_gen_add_tl(addr, addr, eight); - memop = da.memop; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2437,10 +2448,9 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_SHORT: /* Valid for stdfa only. */ - if (size == 8) { - gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN); + if (size == MO_64) { + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN); } else { gen_exception(dc, TT_ILL_INSN); } @@ -2455,6 +2465,16 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } } +static void __attribute__((unused)) +gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +{ + DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : + size == 8 ? MO_TEUQ : MO_TE | MO_128)); + + gen_address_mask(dc, addr); + gen_stf_asi0(dc, &da, addr, rd); +} + static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); From patchwork Tue Oct 17 06:12:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734341 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326809wro; Mon, 16 Oct 2023 23:29:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEd/XErWsE9+cxKpeHNr03xgtmC/6O8MUOpdCf1tJg5RunXN51e72YNn4TPdZ1yULw/uq0m X-Received: by 2002:a05:622a:142:b0:412:24e6:a485 with SMTP id v2-20020a05622a014200b0041224e6a485mr1712626qtw.2.1697524168019; Mon, 16 Oct 2023 23:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524168; cv=none; d=google.com; s=arc-20160816; b=dnOcM18JtLtefbFZejSIHxM/UcLNyGupbNbGfgRjKHUHX/m9rBOvfCqRTiK4dtTJTj r1g3RcY801Jjh7j9Cra3gRB64yB6yu9SRAM3rW11RnrWpuS7Al+NoFWC6phvPZxybaGz nzigIsujit4Aex5iIaTVN7CTIlX3xJXI3+6JzjszNuGvEbz5aqtOLQ5eRsn9cvGNXW3c RboqDXJo9rCc8Iw69HTu12J/10GR6pHYBzVG8pPawhZf0WwI8FPv00p2gj2WRpR/n9e8 q6ULj87q+T0QiO0bnhLvVlDhcvJboyPQeJQmQNeU1MRgMDu2NjWdqABV6VHs8UYvpeIP PyRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=mX5JvNOr3Qbqbv8+qYdq2/v3jBiGLs5Yv9+4s5C2zOI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=yxgDh8TBUaXKlwQdYursilYfMBOsE4AKJjwAuMoKcqKPVZFCtuu+DrMBLrhiqWrO+x hBA5oFJQ+jeazUsFcqutef6KG+xv345Bb6Tg4YpCvq9LWwVp6fhiKuM8frbXP6fRl5E4 5fpPCJtmVho5Dl3FhDvwp7vEfBbelJoe8yJxZa0bmZgW5cVQqIfk9H5ihIA0dTyph6ZT OwNg75mAjgzBA/uyohIl7NTnydo3PXseu6ZEWSWsfkoGkf66OTKuFESpDP3McxBUt2w+ V6FBYQZCRleXjBziSjL6wWTHfGmiiYlkSKYTS2gswg7bss7996hQC17ZWuUHEV737SJe 0ETw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wn3E5Hbu; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a13-20020a05622a02cd00b0041804dba740si650333qtx.747.2023.10.16.23.29.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:29:28 -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=Wn3E5Hbu; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNn-0003Mz-NO; Tue, 17 Oct 2023 02:16:47 -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 1qsdNa-0002y5-R9 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:35 -0400 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNY-0004if-K7 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:34 -0400 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-57ad95c555eso3048012eaf.3 for ; Mon, 16 Oct 2023 23:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523391; x=1698128191; 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=mX5JvNOr3Qbqbv8+qYdq2/v3jBiGLs5Yv9+4s5C2zOI=; b=Wn3E5HbuDK7WlwUn6Dfiw6AdYAZ9hfmNrDnUd7Z01yvDKd0q3gpYUrIdIc/8Kc1UOF 6LCsneVZ13ZKIdN7N0meTPCGOTCs/DbYCoY+sbh3gT50ATPT4C0gDRuQw08dZV4ln9Pp CygxWak8kKWYEQgFp7URs70ZMZorkyxESYnaQR4eRBOK6XxIJZxGOyL+Nz8gShJbcv3J KOHyqilcF+8iiPUTUsp2S9I1a4H0+qibev0MOzpDimhQpAZ5DhrnoBNeW9oEBSJq7cxH 9BNtO6WWNs+RLpH9NC6fOG6yWooRT8f8XW3Gr8g2UvzjMRSApjUjdL7O8rxidtfAHkHQ spmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523391; x=1698128191; 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=mX5JvNOr3Qbqbv8+qYdq2/v3jBiGLs5Yv9+4s5C2zOI=; b=vfE1OngAJi3UTy1kEXoCmQbCSfkN3mAt/DRYLKYY2lxlmzkFX/wRH35387iquaWG4s RiVvuftxn5zqhUlYwXOwJ9yx0WGDQfdfDSchbim843Q2hjW4yXnJ4U9eslxEWpfl9N0f NtFSI6BUtyt0uCcbV1VJTU96oz/OQidoiqabIfuQTftdi+/IxRxpg2PxDuEktwJ5hWYE L03/hX8TY/zP4SsJHIKUH6WwVkLMvkK+EDk5kSzBNKusQ9cA/sfF3BFUzriyzO8WpF3L HjfkE1Kq/hzGAnKc9dYU+LFtnJQrUNJWiK4+nz/eBuMr8z4CZdI2N4DkPFFNs8QJuXob Boww== X-Gm-Message-State: AOJu0Ywt35rn1D0PtoUAz13PKTLXy17QZnBFQlBtKKaFeltoipL9/bdH 429Pf6+VgtKDorsaiehOC3+2DWZ91NkFtvXmowE= X-Received: by 2002:a05:6359:2d4d:b0:15b:249:b520 with SMTP id rm13-20020a0563592d4d00b0015b0249b520mr1407527rwb.7.1697523391293; Mon, 16 Oct 2023 23:16:31 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 55/90] target/sparc: Move simple fp load/store to decodetree Date: Mon, 16 Oct 2023 23:12:09 -0700 Message-Id: <20231017061244.681584-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c32; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc32.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 19 ++++ target/sparc/translate.c | 194 ++++++++++++++++++-------------------- 2 files changed, 113 insertions(+), 100 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 86108679eb..ab311055da 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -231,8 +231,16 @@ NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 ## Major Opcode 11 -- load and store instructions ## +%dfp_rd 25:5 !function=extract_dfpreg +%qfp_rd 25:5 !function=extract_qfpreg + &r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool @r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 +@d_r_ri_na .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%dfp_rd asi=-1 +@q_r_ri_na .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%qfp_rd asi=-1 + @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 @@ -282,6 +290,17 @@ STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA +LDF 11 ..... 100000 ..... . ............. @r_r_ri_na +LDQF 11 ..... 100010 ..... . ............. @q_r_ri_na +LDDF 11 ..... 100011 ..... . ............. @d_r_ri_na + +STF 11 ..... 100100 ..... . ............. @r_r_ri_na +{ + STQF 11 ..... 100110 ..... . ............. @q_r_ri_na + STDFQ 11 ----- 100110 ----- - ------------- +} +STDF 11 ..... 100111 ..... . ............. @d_r_ri_na + LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 822e74fa3e..eeec1e751c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -253,29 +253,7 @@ static void gen_op_store_QT0_fpr(unsigned int dst) offsetof(CPU_QuadU, ll.lower)); } -static void gen_store_fpr_Q(DisasContext *dc, unsigned int dst, - TCGv_i64 v1, TCGv_i64 v2) -{ - dst = QFPREG(dst); - - tcg_gen_mov_i64(cpu_fpr[dst / 2], v1); - tcg_gen_mov_i64(cpu_fpr[dst / 2 + 1], v2); - gen_update_fprs_dirty(dc, dst); -} - #ifdef TARGET_SPARC64 -static TCGv_i64 gen_load_fpr_Q0(DisasContext *dc, unsigned int src) -{ - src = QFPREG(src); - return cpu_fpr[src / 2]; -} - -static TCGv_i64 gen_load_fpr_Q1(DisasContext *dc, unsigned int src) -{ - src = QFPREG(src); - return cpu_fpr[src / 2 + 1]; -} - static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) { rd = QFPREG(rd); @@ -2841,6 +2819,16 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) } #endif +static int extract_dfpreg(DisasContext *dc, int x) +{ + return DFPREG(x); +} + +static int extract_qfpreg(DisasContext *dc, int x) +{ + return QFPREG(x); +} + /* Include the auto-generated decoder. */ #include "decode-insns.c.inc" @@ -2969,6 +2957,20 @@ static bool raise_priv(DisasContext *dc) return true; } +static bool raise_unimpfpop(DisasContext *dc) +{ + gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); + return true; +} + +static bool gen_trap_float128(DisasContext *dc) +{ + if (dc->def->features & CPU_FEATURE_FLOAT128) { + return false; + } + return raise_unimpfpop(dc); +} + static bool do_bpcc(DisasContext *dc, arg_bcc *a) { target_long target = dc->pc + a->i * 4; @@ -4721,6 +4723,68 @@ static bool do_casa(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) TRANS(CASA, CASA, do_casa, a, MO_TEUL) TRANS(CASXA, 64, do_casa, a, MO_TEUQ) +static bool do_ld_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if ((mop & MO_SIZE) == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, mop); + gen_ldf_asi0(dc, &da, addr, a->rd); + gen_update_fprs_dirty(dc, a->rd); + return advance_pc(dc); +} + +TRANS(LDF, ALL, do_ld_fpr, a, MO_TEUL) +TRANS(LDDF, ALL, do_ld_fpr, a, MO_TEUQ) +TRANS(LDQF, ALL, do_ld_fpr, a, MO_TE | MO_128) + +static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if ((mop & MO_SIZE) == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, mop); + gen_stf_asi0(dc, &da, addr, a->rd); + return advance_pc(dc); +} + +TRANS(STF, ALL, do_st_fpr, a, MO_TEUL) +TRANS(STDF, ALL, do_st_fpr, a, MO_TEUQ) +TRANS(STQF, ALL, do_st_fpr, a, MO_TE | MO_128) + +static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) +{ + if (!avail_32(dc)) { + return false; + } + if (!supervisor(dc)) { + return raise_priv(dc); + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR); + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4735,7 +4799,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_src1 __attribute__((unused)); TCGv cpu_src2 __attribute__((unused)); TCGv_i32 cpu_src1_32, cpu_src2_32, cpu_dst_32; - TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; + TCGv_i64 cpu_src1_64, cpu_src2_64; + TCGv_i64 cpu_dst_64 __attribute__((unused)); target_long simm; opc = GET_FIELD(insn, 0, 1); @@ -5602,12 +5667,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } switch (xop) { case 0x20: /* ldf, load fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_qemu_ld_i32(cpu_dst_32, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; + case 0x22: /* ldqf, load quad fpreg */ + case 0x23: /* lddf, load double fpreg */ + g_assert_not_reached(); /* in decodetree */ case 0x21: /* ldfsr, V9 ldxfsr */ #ifdef TARGET_SPARC64 gen_address_mask(dc, cpu_addr); @@ -5624,25 +5686,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL | MO_ALIGN); gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, cpu_dst_32); break; - case 0x22: /* ldqf, load quad fpreg */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_address_mask(dc, cpu_addr); - cpu_src1_64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(cpu_src1_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - tcg_gen_addi_tl(cpu_addr, cpu_addr, 8); - cpu_src2_64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(cpu_src2_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - gen_store_fpr_Q(dc, rd, cpu_src1_64, cpu_src2_64); - break; - case 0x23: /* lddf, load double fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_qemu_ld_i64(cpu_dst_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; default: goto illegal_insn; } @@ -5652,11 +5695,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } switch (xop) { case 0x24: /* stf, store fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_src1_32 = gen_load_fpr_F(dc, rd); - tcg_gen_qemu_st_i32(cpu_src1_32, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - break; + case 0x26: /* v9 stqf, v8 stdfq */ + case 0x27: /* stdf, store double fpreg */ + g_assert_not_reached(); case 0x25: /* stfsr, V9 stxfsr */ { #ifdef TARGET_SPARC64 @@ -5671,43 +5712,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL | MO_ALIGN); } break; - case 0x26: -#ifdef TARGET_SPARC64 - /* V9 stqf, store quad fpreg */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_address_mask(dc, cpu_addr); - /* ??? While stqf only requires 4-byte alignment, it is - legal for the cpu to signal the unaligned exception. - The OS trap handler is then required to fix it up. - For qemu, this avoids having to probe the second page - before performing the first write. */ - cpu_src1_64 = gen_load_fpr_Q0(dc, rd); - tcg_gen_qemu_st_i64(cpu_src1_64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN_16); - tcg_gen_addi_tl(cpu_addr, cpu_addr, 8); - cpu_src2_64 = gen_load_fpr_Q1(dc, rd); - tcg_gen_qemu_st_i64(cpu_src1_64, cpu_addr, - dc->mem_idx, MO_TEUQ); - break; -#else /* !TARGET_SPARC64 */ - /* stdfq, store floating point queue */ -#if defined(CONFIG_USER_ONLY) - goto illegal_insn; -#else - if (!supervisor(dc)) - goto priv_insn; - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - goto nfq_insn; -#endif -#endif - case 0x27: /* stdf, store double fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_src1_64 = gen_load_fpr_D(dc, rd); - tcg_gen_qemu_st_i64(cpu_src1_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - break; default: goto illegal_insn; } @@ -5754,19 +5758,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; -#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) - priv_insn: - gen_exception(dc, TT_PRIV_INSN); - return; -#endif nfpu_insn: gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); return; -#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) - nfq_insn: - gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR); - return; -#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Tue Oct 17 06:12:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734330 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326551wro; Mon, 16 Oct 2023 23:28:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiy4EA2Sv0O7fIbEEabLpwwSIdqPHgDHWrZAK6zbE21A6fcLpst5j9e+TI/xhQ7+XX3ZkT X-Received: by 2002:ac8:59cf:0:b0:418:2213:4c7c with SMTP id f15-20020ac859cf000000b0041822134c7cmr1388859qtf.59.1697524113936; Mon, 16 Oct 2023 23:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524113; cv=none; d=google.com; s=arc-20160816; b=A2Q9VFmoRlPr+tHr49yGHjL2z1XQ5QXxQ7mB/G6JN2l7matsVQGCBf1+ibd7rmMAph 8iwVOxFJFppNEUyb+DQ6RoBbNtBLztkiU2DIU6Ojzwg98o+TLZwIojCdHlHt2YbvegiU qTBFplQCooVCCrbaTtXkj8QpussbaaZle9IZluRn/B25hoAeyuSPhy8P0bkQ1DBz65PU roX67LFE2KUIrh7BcNmVUka6cAx3Wgg/1IpJun7NbszscyxfDgoEqzoo6VTHyqnaGnnh 5Y6EjxpjZ5vPtyYl3tY0/z7FOMC8yMKNcGMZs2QBbqkGnJeZhBZCMxdnZsAnOEhNFGyF e0bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=M2AlexsC5+7X5knpxNybFFvyGTBkJYOC+d65ljDHcS8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=edPZ8UuZwE8Fen/V4iekM1e6VsjBS9c6XOmBwKeIOsEXXhEYMkKTNi6VNs0EHH+Xb1 3SJr38aWBEl+aBLlj9Ow82vrMxw4BFB8KxDKYKYnl6wJze3hQaUeiBChQhEO7r3VUBbT o8pDFE3hjufaTYtRU1dcwNzb0m9hW9/klKOuNkzbU3UhYuVPXlqCJeWePl5Xlg2X26gR FNf/pTW/KBfwtXjBTAYT0cu4/44mi7uAox4jH46n/GhKx+oV6ghYCUAhphTHUQ2eB6pP Yd7+xLpE5zMncnqtVQp8oBWSh8LSQqxxq5v+4r0Bu9KjKakkzAjrrjwCgMdlk5stVCez dAlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jxl3/klE"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n6-20020a05622a11c600b00417f817da78si660807qtk.565.2023.10.16.23.28.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:33 -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="jxl3/klE"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNn-0003Mh-Mr; Tue, 17 Oct 2023 02:16:47 -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 1qsdNj-00038A-Q7 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:43 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNZ-0004iz-Gv for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:35 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6b497c8575aso3476960b3a.1 for ; Mon, 16 Oct 2023 23:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523392; x=1698128192; 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=M2AlexsC5+7X5knpxNybFFvyGTBkJYOC+d65ljDHcS8=; b=jxl3/klEKpZDVzc3JOgpV8hCpKRuvBy5KiRrHjXBYzZMgaQiU9BtAxtJyufgXYa0Un v3E12fAxddOD/q4h/tLBRY3kbBt4UQJMSwJQ6jpEVSCn5MQAdrjIQUjL19oUApXqgsyU M/Lldb8LEEN9W5ruMes4r6ZhyC+DBxQ2kcMdkWnwZhwU8vdC6/RVlJA2qLiblwPHLVMc w7GdoxUmdkrpgmog1PDRs97brcaNAXLgFWwCBmrzR/6D2Rv+Tf2UarCYQ51CacOzTI3q GXKcD9v+4qVaE+i6tuw/qx3oRoS9v+V6nnI8dyBf3P0GBNOoOt3jAM4E34Gp22t3D7lD YLfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523392; x=1698128192; 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=M2AlexsC5+7X5knpxNybFFvyGTBkJYOC+d65ljDHcS8=; b=Vh1Vs2TsT5DdenNgditJqCEEScXa3kpzJ03YfDwKjNlUUsy5bvHsz20CjL/MCM+rB/ B4S+HW9d9054jdHEY9l1gNEgxHOJIgUdKC313Nf0b94iMB18Ya+Q/2BtTzyD2zbo7NTG FRxLWhbS1sC3k0qrZGQn2QnUdTNLQME0P/y4E9q0aC6xIYrZXC2AgcOmSHRLWqkUYZ/B R4ma/LlP8bY/bpJZjUj4Pas/XQvpaRp4utCelss/8VJYFgabPZwpjOEO2J3qFVvmnWeO ksI/YYdKR7pUDuPJ1DFFFDLIF99wj+J7zC4PSAbRmDM8FJre/AS+TnLkfzRnrOsyfvZX sRWg== X-Gm-Message-State: AOJu0YxG8XfWqBnwFpW+0Kk33u1AbXXUrcwT41Cv3f0U9GZTuOwYs9u5 hSTV3a+qcX5ngChKFYgULCVzMZFz2S3+FwAuFPo= X-Received: by 2002:a05:6a00:23d1:b0:6bd:b3b9:649f with SMTP id g17-20020a056a0023d100b006bdb3b9649fmr1280433pfc.7.1697523392185; Mon, 16 Oct 2023 23:16:32 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 56/90] target/sparc: Move asi fp load/store to decodetree Date: Mon, 16 Oct 2023 23:12:10 -0700 Message-Id: <20231017061244.681584-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 51 ++++++++++-- target/sparc/translate.c | 169 ++++++++------------------------------ 2 files changed, 79 insertions(+), 141 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index ab311055da..fa9c8d3d8b 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -244,6 +244,14 @@ NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 +@d_r_r_asi .. ..... ...... rs1:5 0 asi:8 rs2_or_imm:5 \ + &r_r_ri_asi rd=%dfp_rd imm=0 +@d_r_i_asi .. ..... ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%dfp_rd imm=1 asi=-2 +@q_r_r_asi .. ..... ...... rs1:5 0 asi:8 rs2_or_imm:5 \ + &r_r_ri_asi rd=%qfp_rd imm=0 +@q_r_i_asi .. ..... ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%qfp_rd imm=1 asi=-2 @casa_imm .. rd:5 ...... rs1:5 1 00000000 rs2_or_imm:5 \ &r_r_ri_asi imm=1 asi=-2 @@ -318,10 +326,43 @@ NOP_v9 11 ----- 101101 ----- 0 00000000 ----- # PREFETCH NOP_v9 11 ----- 101101 ----- 1 ------------- # PREFETCH NOP_v9 11 ----- 111101 ----- - ------------- # PREFETCHA -NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +{ + [ + LDFA 11 ..... 110000 ..... . ............. @r_r_r_asi + LDFA 11 ..... 110000 ..... . ............. @r_r_i_asi + ] + NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +} NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR -NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC -NCP 11 ----- 110100 ----- --------- ----- # v8 STC +LDQFA 11 ..... 110010 ..... . ............. @q_r_r_asi +LDQFA 11 ..... 110010 ..... . ............. @q_r_i_asi +{ + [ + LDDFA 11 ..... 110011 ..... . ............. @d_r_r_asi + LDDFA 11 ..... 110011 ..... . ............. @d_r_i_asi + ] + NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC +} + +{ + [ + STFA 11 ..... 110100 ..... . ............. @r_r_r_asi + STFA 11 ..... 110100 ..... . ............. @r_r_i_asi + ] + NCP 11 ----- 110100 ----- --------- ----- # v8 STC +} NCP 11 ----- 110101 ----- --------- ----- # v8 STCSR -NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ -NCP 11 ----- 110111 ----- --------- ----- # v8 STDC +{ + [ + STQFA 11 ..... 110110 ..... . ............. @q_r_r_asi + STQFA 11 ..... 110110 ..... . ............. @q_r_i_asi + ] + NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ +} +{ + [ + STDFA 11 ..... 110111 ..... . ............. @d_r_r_asi + STDFA 11 ..... 110111 ..... . ............. @d_r_i_asi + ] + NCP 11 ----- 110111 ----- --------- ----- # v8 STDC +} diff --git a/target/sparc/translate.c b/target/sparc/translate.c index eeec1e751c..6fdcfebe55 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2063,12 +2063,6 @@ static DisasASI resolve_asi(DisasContext *dc, int asi, MemOp memop) return (DisasASI){ type, asi, mem_idx, memop }; } -static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) -{ - int asi = IS_IMM ? -2 : GET_FIELD(insn, 19, 26); - return resolve_asi(dc, asi, memop); -} - static void gen_ld_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { @@ -2241,12 +2235,13 @@ static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_ldf_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { MemOp memop = da->memop; MemOp size = memop & MO_SIZE; TCGv_i32 d32; TCGv_i64 d64; + TCGv addr_tmp; /* TODO: Use 128-bit load/store below. */ if (size == MO_128) { @@ -2273,8 +2268,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) case MO_128: d64 = tcg_temp_new_i64(); tcg_gen_qemu_ld_i64(d64, addr, da->mem_idx, memop); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr_tmp, da->mem_idx, memop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2285,18 +2281,16 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) case GET_ASI_BLOCK: /* Valid for lddfa on aligned registers only. */ if (size == MO_64 && (rd & 7) == 0) { - TCGv eight; - int i; - /* The first operation checks required alignment. */ - eight = tcg_constant_tl(8); - for (i = 0; ; ++i) { + addr_tmp = tcg_temp_new(); + for (int i = 0; ; ++i) { tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } - tcg_gen_add_tl(addr, addr, eight); + tcg_gen_addi_tl(addr_tmp, addr, 8); + addr = addr_tmp; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2338,8 +2332,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) case MO_128: d64 = tcg_temp_new_i64(); gen_helper_ld_asi(d64, tcg_env, addr, r_asi, r_mop); - tcg_gen_addi_tl(addr, addr, 8); - gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr, + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr_tmp, r_asi, r_mop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; @@ -2351,21 +2346,12 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } -static void __attribute__((unused)) -gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) -{ - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : - size == 8 ? MO_TEUQ : MO_TE | MO_128)); - - gen_address_mask(dc, addr); - gen_ldf_asi0(dc, &da, addr, rd); -} - -static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_stf_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { MemOp memop = da->memop; MemOp size = memop & MO_SIZE; TCGv_i32 d32; + TCGv addr_tmp; /* TODO: Use 128-bit load/store below. */ if (size == MO_128) { @@ -2395,8 +2381,9 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) write. */ tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, memop | MO_ALIGN_16); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr_tmp, da->mem_idx, memop); break; default: g_assert_not_reached(); @@ -2406,18 +2393,16 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) case GET_ASI_BLOCK: /* Valid for stdfa on aligned registers only. */ if (size == MO_64 && (rd & 7) == 0) { - TCGv eight; - int i; - /* The first operation checks required alignment. */ - eight = tcg_constant_tl(8); - for (i = 0; ; ++i) { + addr_tmp = tcg_temp_new(); + for (int i = 0; ; ++i) { tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } - tcg_gen_add_tl(addr, addr, eight); + tcg_gen_addi_tl(addr_tmp, addr, 8); + addr = addr_tmp; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2443,16 +2428,6 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } -static void __attribute__((unused)) -gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) -{ - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : - size == 8 ? MO_TEUQ : MO_TE | MO_128)); - - gen_address_mask(dc, addr); - gen_stf_asi0(dc, &da, addr, rd); -} - static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); @@ -4738,7 +4713,7 @@ static bool do_ld_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) return true; } da = resolve_asi(dc, a->asi, mop); - gen_ldf_asi0(dc, &da, addr, a->rd); + gen_ldf_asi(dc, &da, addr, a->rd); gen_update_fprs_dirty(dc, a->rd); return advance_pc(dc); } @@ -4747,6 +4722,10 @@ TRANS(LDF, ALL, do_ld_fpr, a, MO_TEUL) TRANS(LDDF, ALL, do_ld_fpr, a, MO_TEUQ) TRANS(LDQF, ALL, do_ld_fpr, a, MO_TE | MO_128) +TRANS(LDFA, 64, do_ld_fpr, a, MO_TEUL) +TRANS(LDDFA, 64, do_ld_fpr, a, MO_TEUQ) +TRANS(LDQFA, 64, do_ld_fpr, a, MO_TE | MO_128) + static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) { TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); @@ -4762,7 +4741,7 @@ static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) return true; } da = resolve_asi(dc, a->asi, mop); - gen_stf_asi0(dc, &da, addr, a->rd); + gen_stf_asi(dc, &da, addr, a->rd); return advance_pc(dc); } @@ -4770,6 +4749,10 @@ TRANS(STF, ALL, do_st_fpr, a, MO_TEUL) TRANS(STDF, ALL, do_st_fpr, a, MO_TEUQ) TRANS(STQF, ALL, do_st_fpr, a, MO_TE | MO_128) +TRANS(STFA, 64, do_st_fpr, a, MO_TEUL) +TRANS(STDFA, 64, do_st_fpr, a, MO_TEUQ) +TRANS(STQFA, 64, do_st_fpr, a, MO_TE | MO_128) + static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) { if (!avail_32(dc)) { @@ -5603,64 +5586,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) if (xop < 4 || (xop > 7 && xop < 0x14 && xop != 0x0e) || (xop > 0x17 && xop <= 0x1d ) || (xop > 0x2c && xop <= 0x33) || xop == 0x1f || xop == 0x3d) { - TCGv cpu_val = gen_dest_gpr(dc, rd); - - switch (xop) { - case 0x0: /* ld, V9 lduw, load unsigned word */ - case 0x1: /* ldub, load unsigned byte */ - case 0x2: /* lduh, load unsigned halfword */ - case 0x3: /* ldd, load double word */ - case 0x9: /* ldsb, load signed byte */ - case 0xa: /* ldsh, load signed halfword */ - case 0xd: /* ldstub */ - case 0x0f: /* swap */ - case 0x10: /* lda, V9 lduwa, load word alternate */ - case 0x11: /* lduba, load unsigned byte alternate */ - case 0x12: /* lduha, load unsigned halfword alternate */ - case 0x13: /* ldda, load double word alternate */ - case 0x19: /* ldsba, load signed byte alternate */ - case 0x1a: /* ldsha, load signed halfword alternate */ - case 0x1d: /* ldstuba */ - case 0x1f: /* swapa */ - g_assert_not_reached(); /* in decodetree */ - case 0x08: /* V9 ldsw */ - case 0x0b: /* V9 ldx */ - case 0x18: /* V9 ldswa */ - case 0x1b: /* V9 ldxa */ - case 0x2d: /* V9 prefetch */ - case 0x3d: /* V9 prefetcha */ - goto illegal_insn; /* in decodetree */ -#ifdef TARGET_SPARC64 - case 0x30: /* V9 ldfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_ldf_asi(dc, cpu_addr, insn, 4, rd); - gen_update_fprs_dirty(dc, rd); - goto skip_move; - case 0x33: /* V9 lddfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_ldf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); - gen_update_fprs_dirty(dc, DFPREG(rd)); - goto skip_move; - case 0x32: /* V9 ldqfa */ - CHECK_FPU_FEATURE(dc, FLOAT128); - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_ldf_asi(dc, cpu_addr, insn, 16, QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); - goto skip_move; -#endif - default: - goto illegal_insn; - } - gen_store_gpr(dc, rd, cpu_val); -#if defined(TARGET_SPARC64) - skip_move: ; -#endif + goto illegal_insn; /* in decodetree */ } else if (xop >= 0x20 && xop < 0x24) { if (gen_trap_ifnofpu(dc)) { goto jmp_insn; @@ -5716,36 +5642,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } } else if (xop > 0x33 && xop < 0x3f) { - switch (xop) { -#ifdef TARGET_SPARC64 - case 0x34: /* V9 stfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_stf_asi(dc, cpu_addr, insn, 4, rd); - break; - case 0x36: /* V9 stqfa */ - { - CHECK_FPU_FEATURE(dc, FLOAT128); - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_stf_asi(dc, cpu_addr, insn, 16, QFPREG(rd)); - } - break; - case 0x37: /* V9 stdfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_stf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); - break; -#endif - case 0x3e: /* V9 casxa */ - case 0x3c: /* V9 or LEON3 casa */ - goto illegal_insn; /* in decodetree */ - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } else { goto illegal_insn; } From patchwork Tue Oct 17 06:12:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734343 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326859wro; Mon, 16 Oct 2023 23:29:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy8Mjn0NPeZp7KX0FMpUhMisQRgd8438r9pL4S9tW9M5YhNK1QTvSptegW+1nBzD/nFk22 X-Received: by 2002:a05:620a:6604:b0:774:5ab:d032 with SMTP id qf4-20020a05620a660400b0077405abd032mr1302676qkn.23.1697524179381; Mon, 16 Oct 2023 23:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524179; cv=none; d=google.com; s=arc-20160816; b=YcMGkrT8FyCHZ1twFwKoImlMlblGiG9zHL0XTHLB8U1tME7GreFTbOKbSkg/V5/WNH +JoMalH0uVJcPvM5JNjGb7O2BrtbUJqGsGIUi8rY7UKtrQgwko7dRNogTjyEqqfZtz2i VN6ktJ4nS2dwe/vYsYbVRhaTMCfebeX9tpOFLXHSnayyDYDB4fzU7hUp2HGKTDmhzbGO Cip/nrh6WyEvxEzSvXrtkKZVVcmhajpDxSJ/1viPVjiyggQPLAgu+TGIXpVo4nuIwYne F6yrFGcC1HdMI+0+yXizEaMfwVYDvfKqKC5f+ML4VDX4oPDPUCktddFTTwaRe/cGt11H qd7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=dMSUFS9qh79LcgmLspNPYV12WqEJpxUzeh5RmFSfxBg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=poZYU2ai2+fHbZ98nwMwIHtLhEavPDSkEEtcTKPx+8dOzEtr4KZ8cbJC4vF5XEkSNK sFXyE5Fyp6pZoQw+aETg7NuO3BUw6HV9Z0HhFBRYmYM/Iu3bUtemskSY7D9aPbkhwxC0 +CcdmCwBvw+BPLcCR0RNTSLsI51KoLNk0OM7wkQ7EN9QKaZtmuMmgvC/1iYIxmYrEWHA /Qok2fSWsY7j6p6eRidATq1ZcxglwgsH9ATmCgQ3JLm6twms6T2rOco3FTAZoDO3NhHb HvwdGxTOkPWzfVaa/IadpGDpmI55la/qm7MDspmbEfystLLTn19GRU1JhqZ9Vx6e4o0P 2xMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KyijiEJZ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m20-20020a05620a24d400b0076d3296b0a5si612092qkn.737.2023.10.16.23.29.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:29:39 -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=KyijiEJZ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNr-0003V2-QG; Tue, 17 Oct 2023 02:16:51 -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 1qsdNj-00038H-Rz for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:43 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNa-0004jA-5a for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:43 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6c7b3adbeb6so3795482a34.0 for ; Mon, 16 Oct 2023 23:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523393; x=1698128193; 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=dMSUFS9qh79LcgmLspNPYV12WqEJpxUzeh5RmFSfxBg=; b=KyijiEJZrzdL/XZKc58a4Uj0STimf6pC6yT3oGE5PR7/PaawNyOjorv0nHMQkD/ZrV Ecj+AGme2Oc6UJfYmXl9/LzXC9qCBmaOCbaUuoNRBX180MtJM1SxSXqkQZIqQSujwhdV 52I9U7mvSZB2e2NY2B6D2xStbCtipwALUinl/Rh+rOeFycaPbKMYtaKopgxiIab9VdfU AOpGAv2oYErx1Zff0QK/zmIKFrWTjceLVm3d2srHdycTZPgU889i1RVMCnTG1+dQfvtE PFFjdFi/EOCxc6z2iAkNaL5mCfqDgX4GYh1DeMEXawALHRtOY8tLkArT4va3+lgovQuL 21MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523393; x=1698128193; 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=dMSUFS9qh79LcgmLspNPYV12WqEJpxUzeh5RmFSfxBg=; b=oRyJFnbL9OC5BkIpPeTqyRpOhLP55f1QI1qupwSBdDVj5+vitMCJ62UACzr80o4zto qoLxbI7/Z8hu4QN+WyOQ1p3c+uiBQ08EP7aPUdYbvaV4CJcDU1FQt2DLS1PL8lsKyqbC DlE0Ox5KHU64/W/jOW3lASEEHAO0bIcCQgm0nfNuv3AQgaKXnFVXcCcpECcqamri39Xg +sFTaaqOKKWA2dV+im4v/wwQWUp7XyHRUdgO9yU0TgD840kVEG1GyKfocMWrghRuZFSH nZ3bhROQQ1n0zup4/8llrH4RR16ETAGY62BhqfgHvesweAvqdLLQ8b+9RIldevn3FRSy 1prg== X-Gm-Message-State: AOJu0YwJS20A5YPr6y0gR58cJcAUu/C4fInoM6Wx+31ZJ8PRuyrmNoxT BnwjDftmN28TI8Kh4nCLQMamkgLeU6qxLmp3aII= X-Received: by 2002:a05:6830:25d4:b0:6bd:b879:c313 with SMTP id d20-20020a05683025d400b006bdb879c313mr1561270otu.10.1697523392929; Mon, 16 Oct 2023 23:16:32 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 57/90] target/sparc: Move LDFSR, STFSR to decodetree Date: Mon, 16 Oct 2023 23:12:11 -0700 Message-Id: <20231017061244.681584-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 + target/sparc/translate.c | 152 +++++++++++++++----------------------- 2 files changed, 64 insertions(+), 92 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index fa9c8d3d8b..42eb807e21 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -299,10 +299,14 @@ STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA LDF 11 ..... 100000 ..... . ............. @r_r_ri_na +LDFSR 11 00000 100001 ..... . ............. @n_r_ri +LDXFSR 11 00001 100001 ..... . ............. @n_r_ri LDQF 11 ..... 100010 ..... . ............. @q_r_ri_na LDDF 11 ..... 100011 ..... . ............. @d_r_ri_na STF 11 ..... 100100 ..... . ............. @r_r_ri_na +STFSR 11 00000 100101 ..... . ............. @n_r_ri +STXFSR 11 00001 100101 ..... . ............. @n_r_ri { STQF 11 ..... 100110 ..... . ............. @q_r_ri_na STDFQ 11 ----- 100110 ----- - ------------- diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6fdcfebe55..b23f77a199 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,6 +58,7 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() +#define gen_helper_ldxfsr(R, E, X, Y) qemu_build_not_reached() # ifdef CONFIG_USER_ONLY static void gen_helper_ld_asi(TCGv_i64 r, TCGv_env e, TCGv a, TCGv_i32 asi, TCGv_i32 mop) @@ -163,12 +164,6 @@ typedef struct { #define UA2005_HTRAP_MASK 0xff #define V8_TRAP_MASK 0x7f -static int sign_extend(int x, int len) -{ - len = 32 - len; - return (x << len) >> len; -} - #define IS_IMM (insn & (1<<13)) static void gen_update_fprs_dirty(DisasContext *dc, int rd) @@ -2596,13 +2591,13 @@ static void gen_stda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } +#ifdef TARGET_SPARC64 static TCGv get_src1(DisasContext *dc, unsigned int insn) { unsigned int rs1 = GET_FIELD(insn, 13, 17); return gen_load_gpr(dc, rs1); } -#ifdef TARGET_SPARC64 static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { TCGv_i32 c32, zero, dst, s1, s2; @@ -4768,6 +4763,61 @@ static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) return true; } +static bool trans_LDFSR(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv addr; + TCGv_i32 tmp; + + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + tmp = tcg_temp_new_i32(); + tcg_gen_qemu_ld_i32(tmp, addr, dc->mem_idx, MO_TEUL | MO_ALIGN); + gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); + return advance_pc(dc); +} + +static bool trans_LDXFSR(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv addr; + TCGv_i64 tmp; + + if (!avail_64(dc)) { + return false; + } + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + tmp = tcg_temp_new_i64(); + tcg_gen_qemu_ld_i64(tmp, addr, dc->mem_idx, MO_TEUQ | MO_ALIGN); + gen_helper_ldxfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); + return advance_pc(dc); +} + +static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + tcg_gen_qemu_st_tl(cpu_fsr, addr, dc->mem_idx, mop | MO_ALIGN); + return advance_pc(dc); +} + +TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL) +TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4781,10 +4831,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) unsigned int opc, rs1, rs2, rd; TCGv cpu_src1 __attribute__((unused)); TCGv cpu_src2 __attribute__((unused)); - TCGv_i32 cpu_src1_32, cpu_src2_32, cpu_dst_32; + TCGv_i32 cpu_src1_32, cpu_src2_32; TCGv_i64 cpu_src1_64, cpu_src2_64; + TCGv_i32 cpu_dst_32 __attribute__((unused)); TCGv_i64 cpu_dst_64 __attribute__((unused)); - target_long simm; opc = GET_FIELD(insn, 0, 1); rd = GET_FIELD(insn, 2, 6); @@ -5565,89 +5615,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } break; case 3: /* load/store instructions */ - { - unsigned int xop = GET_FIELD(insn, 7, 12); - /* ??? gen_address_mask prevents us from using a source - register directly. Always generate a temporary. */ - TCGv cpu_addr = tcg_temp_new(); - - tcg_gen_mov_tl(cpu_addr, get_src1(dc, insn)); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - if (simm != 0) { - tcg_gen_addi_tl(cpu_addr, cpu_addr, simm); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2 != 0) { - tcg_gen_add_tl(cpu_addr, cpu_addr, gen_load_gpr(dc, rs2)); - } - } - if (xop < 4 || (xop > 7 && xop < 0x14 && xop != 0x0e) || - (xop > 0x17 && xop <= 0x1d ) || - (xop > 0x2c && xop <= 0x33) || xop == 0x1f || xop == 0x3d) { - goto illegal_insn; /* in decodetree */ - } else if (xop >= 0x20 && xop < 0x24) { - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - switch (xop) { - case 0x20: /* ldf, load fpreg */ - case 0x22: /* ldqf, load quad fpreg */ - case 0x23: /* lddf, load double fpreg */ - g_assert_not_reached(); /* in decodetree */ - case 0x21: /* ldfsr, V9 ldxfsr */ -#ifdef TARGET_SPARC64 - gen_address_mask(dc, cpu_addr); - if (rd == 1) { - TCGv_i64 t64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(t64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - gen_helper_ldxfsr(cpu_fsr, tcg_env, cpu_fsr, t64); - break; - } -#endif - cpu_dst_32 = tcg_temp_new_i32(); - tcg_gen_qemu_ld_i32(cpu_dst_32, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, cpu_dst_32); - break; - default: - goto illegal_insn; - } - } else if (xop > 0x23 && xop < 0x28) { - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - switch (xop) { - case 0x24: /* stf, store fpreg */ - case 0x26: /* v9 stqf, v8 stdfq */ - case 0x27: /* stdf, store double fpreg */ - g_assert_not_reached(); - case 0x25: /* stfsr, V9 stxfsr */ - { -#ifdef TARGET_SPARC64 - gen_address_mask(dc, cpu_addr); - if (rd == 1) { - tcg_gen_qemu_st_tl(cpu_fsr, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - break; - } -#endif - tcg_gen_qemu_st_tl(cpu_fsr, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - } - break; - default: - goto illegal_insn; - } - } else if (xop > 0x33 && xop < 0x3f) { - goto illegal_insn; /* in decodetree */ - } else { - goto illegal_insn; - } - } - break; + goto illegal_insn; /* in decodetree */ } advance_pc(dc); jmp_insn: From patchwork Tue Oct 17 06:12:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734306 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324722wro; Mon, 16 Oct 2023 23:22:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsL223ojQDOFvLseW7fFgRuLxfIkrkR11cBWTbs2HhGE4iA3eeENI0PKw+63xnrTmxtB11 X-Received: by 2002:a05:620a:19a1:b0:774:19a4:117a with SMTP id bm33-20020a05620a19a100b0077419a4117amr1216041qkb.19.1697523762086; Mon, 16 Oct 2023 23:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523762; cv=none; d=google.com; s=arc-20160816; b=p7q2L5/ajo6Z0mYo1ARiTgvnlW6CgqWM/aE1znXkeDWvWuzfZUfsLTAzci0/GxipWa 7XfHYrHJ83XN2Icunv9YGVXRXhMnK8yA/zbWf6nR4lzhdBVg00118CFlXNLMayHSZezp Wsk7kUgnDeVrMwxDAwOYUNMQ7PqHvWgXR6K9EjgUf69hLePE/AwX9iJ6HMnPUUuFLA14 Gf1OzXbNubIdtOvbNNIpad0vKWbFPGD2cD6KCOQOxxdlYe2rS+ZZi9TKv+75Zd+nPS4V aXwSbtGrTd/FGuIg0Oic31ZfzlB3IXcO444ihVl8gZT/5/EtwLkm9FTqL/EbiVMZJYhy +91Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Q4+SaF3VY/x5Ah5tZLiEV/sjaUwkLoV+fKXZrV1OiF4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=XiRhiUXJ170rNQFT2Nqe9gRpzKkiuJxvfi0czzHVWwkUMYSL4ImbgW8uV7OqIeRZmc m2t+g7gUlOjkm6txndRLtfEDT0LWVtILFLtahkf4b7xeL71Eet2Xvmvi75LOAlk9660w nC6gLbQs34Yut6vmaKJHdyP3Sfbav8jNXSBbeTZ5vASC/y/bd3bn2QEivX+ZXomdEfE+ mFE2aBfMbt7vaPNEuQaxf4pG9ykriZQ92BIoQbublb+d6Fl+zWgWf83NFBdb4i3jrpDU O6O/ORBVaDD9CBCYhweLaK9cf2KvBJpXGm4LV4nW7gG4ted+8onO+Fo1FE3VGoDy0l8M AxMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rFK4q1NG; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s1-20020a05620a030100b007770d8ed700si589303qkm.460.2023.10.16.23.22.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23: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=rFK4q1NG; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNq-0003Tl-Ph; Tue, 17 Oct 2023 02:16: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 1qsdNl-0003FY-Ce for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:45 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNb-0004jY-1w for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:45 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso2371055b3a.1 for ; Mon, 16 Oct 2023 23:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523394; x=1698128194; 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=Q4+SaF3VY/x5Ah5tZLiEV/sjaUwkLoV+fKXZrV1OiF4=; b=rFK4q1NGt0Eba1K0KNlrcJ14gP7DlUUV5x3IEb+ZL6k6K/WfJRsgtq0Pnp0OdjOpOJ bzyP/4b3R1yo8vuCRkrZpy4Fw+yotdDl5G4aWoKzu50ryp79ko3UCaEO+O9rPt0d2naq Hu7hA6ve4kbcC+vnE/aZnMCS99HD+KgrDabABFZzxEpqFqoKfiaVqLsnLJ730y/cw2F4 C3Akl0WuIrijmly1Si8KB3IrvjqIT/HrQTUd0ZEJ9GZMUr3+zXRvLXXrzwxhXUBCxQf0 ulhIZAgh85g4kw0jEVpR2vzsqPeKrv5WiQb6AyNX1hPvv9j+v07CvVAE08/b3fdoV1lq J8vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523394; x=1698128194; 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=Q4+SaF3VY/x5Ah5tZLiEV/sjaUwkLoV+fKXZrV1OiF4=; b=Vi4cvfMO9X/7vzC6dDa0AB0MfLlRu5h7914qyS3HfqD5tPot5/Pt2wX/kdpzY7orYE ifay/JFsZLOWw020KC1v6H3euU0LaH8A3MEdBO+CrtFxHK4zblMNEOZe6WfpGhhFy9ZP gABKpOq3ksQy2pB7YHKAbSdK15AZRX96IjZpcLoVqG6iz87T50tRAa0ev9SYLWsEvNc4 gwVjqQKxuvaGJOmWAGydD5yDLLMOfTNjbrim8X3EB+K2CcObjwEWWKCt0dDQzU0YSjK3 LYEs3D82+KkXCYcanqtuhWKQSZfHaJtLvvKEdr5D0oMtEhwA6uifX3TOL3w5OQpQ0fDw OMKg== X-Gm-Message-State: AOJu0Yx5d9I4Jf7KYF6n1FTLMcL4dnxuijm7n6uS//ckYbmRD5yysaEg mxMtLbUVxnJgqP83sauqfln0VpAMh4nW0BRNHeU= X-Received: by 2002:a05:6a00:134b:b0:68f:cbd3:5b01 with SMTP id k11-20020a056a00134b00b0068fcbd35b01mr1753534pfu.13.1697523393792; Mon, 16 Oct 2023 23:16:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 58/90] target/sparc: Merge LDFSR, LDXFSR implementations Date: Mon, 16 Oct 2023 23:12:12 -0700 Message-Id: <20231017061244.681584-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 Combine the helper to a single set_fsr(). Perform the mask and merge inline. Signed-off-by: Richard Henderson --- target/sparc/helper.h | 3 +-- target/sparc/fop_helper.c | 17 ++-------------- target/sparc/translate.c | 42 ++++++++++++--------------------------- 3 files changed, 16 insertions(+), 46 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index b116ddcb29..790752467f 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -42,7 +42,7 @@ DEF_HELPER_FLAGS_4(ld_asi, TCG_CALL_NO_WG, i64, env, tl, int, i32) DEF_HELPER_FLAGS_5(st_asi, TCG_CALL_NO_WG, void, env, tl, i64, int, i32) #endif DEF_HELPER_FLAGS_1(check_ieee_exceptions, TCG_CALL_NO_WG, tl, env) -DEF_HELPER_FLAGS_3(ldfsr, TCG_CALL_NO_RWG, tl, env, tl, i32) +DEF_HELPER_FLAGS_2(set_fsr, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_1(fabss, TCG_CALL_NO_RWG_SE, f32, f32) DEF_HELPER_FLAGS_2(fsqrts, TCG_CALL_NO_RWG, f32, env, f32) DEF_HELPER_FLAGS_2(fsqrtd, TCG_CALL_NO_RWG, f64, env, f64) @@ -54,7 +54,6 @@ DEF_HELPER_FLAGS_1(fsqrtq, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_1(fcmpq, TCG_CALL_NO_WG, tl, env) DEF_HELPER_FLAGS_1(fcmpeq, TCG_CALL_NO_WG, tl, env) #ifdef TARGET_SPARC64 -DEF_HELPER_FLAGS_3(ldxfsr, TCG_CALL_NO_RWG, tl, env, tl, i64) DEF_HELPER_FLAGS_1(fabsd, TCG_CALL_NO_RWG_SE, f64, f64) DEF_HELPER_FLAGS_3(fcmps_fcc1, TCG_CALL_NO_WG, tl, env, f32, f32) DEF_HELPER_FLAGS_3(fcmps_fcc2, TCG_CALL_NO_WG, tl, env, f32, f32) diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c index f54fa9b959..0f8aa3abcd 100644 --- a/target/sparc/fop_helper.c +++ b/target/sparc/fop_helper.c @@ -382,20 +382,7 @@ static void set_fsr(CPUSPARCState *env, target_ulong fsr) set_float_rounding_mode(rnd_mode, &env->fp_status); } -target_ulong helper_ldfsr(CPUSPARCState *env, target_ulong old_fsr, - uint32_t new_fsr) +void helper_set_fsr(CPUSPARCState *env, target_ulong fsr) { - old_fsr = (new_fsr & FSR_LDFSR_MASK) | (old_fsr & FSR_LDFSR_OLDMASK); - set_fsr(env, old_fsr); - return old_fsr; + set_fsr(env, fsr); } - -#ifdef TARGET_SPARC64 -target_ulong helper_ldxfsr(CPUSPARCState *env, target_ulong old_fsr, - uint64_t new_fsr) -{ - old_fsr = (new_fsr & FSR_LDXFSR_MASK) | (old_fsr & FSR_LDXFSR_OLDMASK); - set_fsr(env, old_fsr); - return old_fsr; -} -#endif diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b23f77a199..5ee5d30b2a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,7 +58,8 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() -#define gen_helper_ldxfsr(R, E, X, Y) qemu_build_not_reached() +#define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) +#define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY static void gen_helper_ld_asi(TCGv_i64 r, TCGv_env e, TCGv a, TCGv_i32 asi, TCGv_i32 mop) @@ -4763,44 +4764,27 @@ static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) return true; } -static bool trans_LDFSR(DisasContext *dc, arg_r_r_ri *a) +static bool do_ldfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop, + target_ulong new_mask, target_ulong old_mask) { - TCGv addr; - TCGv_i32 tmp; - - addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + TCGv tmp, addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); if (addr == NULL) { return false; } if (gen_trap_ifnofpu(dc)) { return true; } - tmp = tcg_temp_new_i32(); - tcg_gen_qemu_ld_i32(tmp, addr, dc->mem_idx, MO_TEUL | MO_ALIGN); - gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); + tmp = tcg_temp_new(); + tcg_gen_qemu_ld_tl(tmp, addr, dc->mem_idx, mop | MO_ALIGN); + tcg_gen_andi_tl(tmp, tmp, new_mask); + tcg_gen_andi_tl(cpu_fsr, cpu_fsr, old_mask); + tcg_gen_or_tl(cpu_fsr, cpu_fsr, tmp); + gen_helper_set_fsr(tcg_env, cpu_fsr); return advance_pc(dc); } -static bool trans_LDXFSR(DisasContext *dc, arg_r_r_ri *a) -{ - TCGv addr; - TCGv_i64 tmp; - - if (!avail_64(dc)) { - return false; - } - addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); - if (addr == NULL) { - return false; - } - if (gen_trap_ifnofpu(dc)) { - return true; - } - tmp = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(tmp, addr, dc->mem_idx, MO_TEUQ | MO_ALIGN); - gen_helper_ldxfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); - return advance_pc(dc); -} +TRANS(LDFSR, ALL, do_ldfsr, a, MO_TEUL, FSR_LDFSR_MASK, FSR_LDFSR_OLDMASK) +TRANS(LDXFSR, 64, do_ldfsr, a, MO_TEUQ, FSR_LDXFSR_MASK, FSR_LDXFSR_OLDMASK) static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) { From patchwork Tue Oct 17 06:12:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734308 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324791wro; Mon, 16 Oct 2023 23:22:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJHpLSdNs2hLXL7Yaxmro5iPZcmMUbkpOz2yfqelF/1SM0N+/KNLYtF1bG70yYguRvnRb/ X-Received: by 2002:a05:6214:21ce:b0:66d:3e1e:1afa with SMTP id d14-20020a05621421ce00b0066d3e1e1afamr1770761qvh.48.1697523775823; Mon, 16 Oct 2023 23:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523775; cv=none; d=google.com; s=arc-20160816; b=KWVRJRnjvHENnfthyCdWXy/Ix7Aule+yswV4qgZTcBzr9d+BCiRQowgmA7ICyva0pJ o4B5jNUkKaHuTWBk7CmeDgM8rRDXJt7jUjsAMzcEgCtDi7N5JFOkeZO6XIRysg7NqrqJ sQi+GC/xYUbaYOOG+8+K1QhqPU0rH8CyCLCTpd3XF4cBbk/WSGv42GQ2x3T/ArWVNPfY i7SMyR7XLyHtwX1Gbgp+IBOApEz02PwVzHyW3gfVIIaY4FXC5J3FTDPrz65/EqEo8qCd stt/D2lnOwYHl7yaK7++Y4tjW1UedLtQ+wjuRtSVyV2eyLqWwy32O5a0wGoOuqSBioGZ Hlyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=4eHgjQIXPhY+gGlrxjyu0E+TSRvCwcHC7ArlfZnk4wE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=pFIKb7ApmvCgsVr/M6VNm/zdRRgv3mj4JqR3aJUF4JOhL4LXllFX2RMPLk1ncXpE2r tm6TrfE+MkMrmLfpAchjHrXtCf2h/bxtWO3EYiqBG/1GpE5zVTlo/oyWmiyUSjd6Hr18 mpOnQ3zMk4AtD4pfWAKRN0cwM05APijd2BKUiO01AwCAT/9HeP5aYNkvIpZ9v0KNSowE cPwleiIHLZSGb1eDTQrIey9h2taj7cVvAiWUWia7ArmluNLvoiFf/9KrOsBlE/KghdOM /jyAFjIO6pv0lcQF5RMtkct0e3Zq0NL5F92q3ZJE29zGI/2hHXcp/HspyX3v47VZj0yZ Qxwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rQgWSVsy; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ei6-20020ad45a06000000b0065b16b39ce6si539492qvb.207.2023.10.16.23.22.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22:55 -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=rQgWSVsy; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNp-0003SX-SG; Tue, 17 Oct 2023 02:16:49 -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 1qsdNn-0003Lw-Bb for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:47 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004jm-Gn for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:47 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6c7ce16ddfaso3700152a34.3 for ; Mon, 16 Oct 2023 23:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523394; x=1698128194; 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=4eHgjQIXPhY+gGlrxjyu0E+TSRvCwcHC7ArlfZnk4wE=; b=rQgWSVsy4CvRjv7WHz9XleqPIzP1bwVH0R3pYuM3ZxaVnLi9WT/E1IMoxKuDxOY4fe 0N/Rn27TOe+N2H9+J1/x/OtQzJoAg5RWsjJMchOSP+jzyLCUGWQ30Y7QqlglT0Ort7zm vTng7HZrMSeQTxlJRD8sfjLbOs3fz3SKO1/8ZV0Uv0IGEQGShO+xUpRsvUTCg+rSZ1uD nRPdStzsMcPnKc04APKrWE9xJbDf8dSULpYokAIdPnE1wEKi4Uab5fx4bcSNyLnlnkN8 C287ZuBM1MGspFP/TEfv9gXnjt1A5XWvaL9kObcsN0XhFHbQ55o0XOtxAlxitTjl0mQ3 JuGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523394; x=1698128194; 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=4eHgjQIXPhY+gGlrxjyu0E+TSRvCwcHC7ArlfZnk4wE=; b=bZAd3n8E4ITVTpPDHX/vi/AS5jlVvbKGhfKBGHk6NkkksZ3KxK05wPj7io08FvxYkH Dg3246XeNLo6kuT+MH1hctzVHW2EmKIeeIy4F0p2LnjWdegReuH9POo1MDoIuOaHRFgG T0P3MWWkDnOS2StqP8D6jcabqFF59ZFAAenggrelQIc2ygyd34lY6aX8/TNMnbkUbX6R tyBAvtCyA3hFtNHjJLO20WAaZHAoRVvTV6DetyYKNegbzCyQHVZ0J2gj2xOWsKS8SlxY T5sBTN8CmraKb2W2NU7lc4RodS/QVuLkpj2qF9hc3Jci9UUs5+B1h7ZL2sUF3c99HeWi czEg== X-Gm-Message-State: AOJu0YyqTZeI+IxJzb5ywMRMM1qA5HORYNT3mqP0yGRjKeK0Al1uyXVa xnuePPTO1+W6UV7qAVegRH3YeTAWRcERxokhahg= X-Received: by 2002:a05:6830:25d4:b0:6c2:2f93:4d2a with SMTP id d20-20020a05683025d400b006c22f934d2amr1698236otu.8.1697523394677; Mon, 16 Oct 2023 23:16:34 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 59/90] target/sparc: Move EDGE* to decodetree Date: Mon, 16 Oct 2023 23:12:13 -0700 Message-Id: <20231017061244.681584-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 ++- target/sparc/translate.c | 272 ++++++++++++++++---------------------- 2 files changed, 134 insertions(+), 160 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 42eb807e21..fb104e77d1 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -30,6 +30,9 @@ CALL 01 i:s30 @n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 @r_r_ri .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri +&r_r_r rd rs1 rs2 +@r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -224,7 +227,24 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 -NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +{ + [ + EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r + EDGE8N 10 ..... 110110 ..... 0 0000 0001 ..... @r_r_r + EDGE8Lcc 10 ..... 110110 ..... 0 0000 0010 ..... @r_r_r + EDGE8LN 10 ..... 110110 ..... 0 0000 0011 ..... @r_r_r + EDGE16cc 10 ..... 110110 ..... 0 0000 0100 ..... @r_r_r + EDGE16N 10 ..... 110110 ..... 0 0000 0101 ..... @r_r_r + EDGE16Lcc 10 ..... 110110 ..... 0 0000 0110 ..... @r_r_r + EDGE16LN 10 ..... 110110 ..... 0 0000 0111 ..... @r_r_r + EDGE32cc 10 ..... 110110 ..... 0 0000 1000 ..... @r_r_r + EDGE32N 10 ..... 110110 ..... 0 0000 1001 ..... @r_r_r + EDGE32Lcc 10 ..... 110110 ..... 0 0000 1010 ..... @r_r_r + EDGE32LN 10 ..... 110110 ..... 0 0000 1011 ..... @r_r_r + ] + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +} + NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 ## diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5ee5d30b2a..5145692885 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2669,93 +2669,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) } } -static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1, TCGv s2, - int width, bool cc, bool left) -{ - TCGv lo1, lo2; - uint64_t amask, tabl, tabr; - int shift, imask, omask; - - if (cc) { - tcg_gen_mov_tl(cpu_cc_src, s1); - tcg_gen_mov_tl(cpu_cc_src2, s2); - tcg_gen_sub_tl(cpu_cc_dst, s1, s2); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB); - dc->cc_op = CC_OP_SUB; - } - - /* Theory of operation: there are two tables, left and right (not to - be confused with the left and right versions of the opcode). These - are indexed by the low 3 bits of the inputs. To make things "easy", - these tables are loaded into two constants, TABL and TABR below. - The operation index = (input & imask) << shift calculates the index - into the constant, while val = (table >> index) & omask calculates - the value we're looking for. */ - switch (width) { - case 8: - imask = 0x7; - shift = 3; - omask = 0xff; - if (left) { - tabl = 0x80c0e0f0f8fcfeffULL; - tabr = 0xff7f3f1f0f070301ULL; - } else { - tabl = 0x0103070f1f3f7fffULL; - tabr = 0xfffefcf8f0e0c080ULL; - } - break; - case 16: - imask = 0x6; - shift = 1; - omask = 0xf; - if (left) { - tabl = 0x8cef; - tabr = 0xf731; - } else { - tabl = 0x137f; - tabr = 0xfec8; - } - break; - case 32: - imask = 0x4; - shift = 0; - omask = 0x3; - if (left) { - tabl = (2 << 2) | 3; - tabr = (3 << 2) | 1; - } else { - tabl = (1 << 2) | 3; - tabr = (3 << 2) | 2; - } - break; - default: - abort(); - } - - lo1 = tcg_temp_new(); - lo2 = tcg_temp_new(); - tcg_gen_andi_tl(lo1, s1, imask); - tcg_gen_andi_tl(lo2, s2, imask); - tcg_gen_shli_tl(lo1, lo1, shift); - tcg_gen_shli_tl(lo2, lo2, shift); - - tcg_gen_shr_tl(lo1, tcg_constant_tl(tabl), lo1); - tcg_gen_shr_tl(lo2, tcg_constant_tl(tabr), lo2); - tcg_gen_andi_tl(lo1, lo1, omask); - tcg_gen_andi_tl(lo2, lo2, omask); - - amask = -8; - if (AM_CHECK(dc)) { - amask &= 0xffffffffULL; - } - tcg_gen_andi_tl(s1, s1, amask); - tcg_gen_andi_tl(s2, s2, amask); - - /* Compute dst = (s1 == s2 ? lo1 : lo1 & lo2). */ - tcg_gen_and_tl(lo2, lo2, lo1); - tcg_gen_movcond_tl(TCG_COND_EQ, dst, s1, s2, lo1, lo2); -} - static void gen_alignaddr(TCGv dst, TCGv s1, TCGv s2, bool left) { TCGv tmp = tcg_temp_new(); @@ -2822,6 +2735,8 @@ static int extract_qfpreg(DisasContext *dc, int x) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) #define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) #define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) +#define avail_VIS1(C) ((C)->def->features & CPU_FEATURE_VIS1) +#define avail_VIS2(C) ((C)->def->features & CPU_FEATURE_VIS2) /* Default case for non jump instructions. */ static bool advance_pc(DisasContext *dc) @@ -4277,6 +4192,116 @@ static bool trans_MULScc(DisasContext *dc, arg_r_r_ri *a) return do_cc_arith(dc, a, CC_OP_ADD, gen_op_mulscc, NULL); } +static bool gen_edge(DisasContext *dc, arg_r_r_r *a, + int width, bool cc, bool left) +{ + TCGv dst, s1, s2, lo1, lo2; + uint64_t amask, tabl, tabr; + int shift, imask, omask; + + dst = gen_dest_gpr(dc, a->rd); + s1 = gen_load_gpr(dc, a->rs1); + s2 = gen_load_gpr(dc, a->rs2); + + if (cc) { + tcg_gen_mov_tl(cpu_cc_src, s1); + tcg_gen_mov_tl(cpu_cc_src2, s2); + tcg_gen_sub_tl(cpu_cc_dst, s1, s2); + tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB); + dc->cc_op = CC_OP_SUB; + } + + /* + * Theory of operation: there are two tables, left and right (not to + * be confused with the left and right versions of the opcode). These + * are indexed by the low 3 bits of the inputs. To make things "easy", + * these tables are loaded into two constants, TABL and TABR below. + * The operation index = (input & imask) << shift calculates the index + * into the constant, while val = (table >> index) & omask calculates + * the value we're looking for. + */ + switch (width) { + case 8: + imask = 0x7; + shift = 3; + omask = 0xff; + if (left) { + tabl = 0x80c0e0f0f8fcfeffULL; + tabr = 0xff7f3f1f0f070301ULL; + } else { + tabl = 0x0103070f1f3f7fffULL; + tabr = 0xfffefcf8f0e0c080ULL; + } + break; + case 16: + imask = 0x6; + shift = 1; + omask = 0xf; + if (left) { + tabl = 0x8cef; + tabr = 0xf731; + } else { + tabl = 0x137f; + tabr = 0xfec8; + } + break; + case 32: + imask = 0x4; + shift = 0; + omask = 0x3; + if (left) { + tabl = (2 << 2) | 3; + tabr = (3 << 2) | 1; + } else { + tabl = (1 << 2) | 3; + tabr = (3 << 2) | 2; + } + break; + default: + abort(); + } + + lo1 = tcg_temp_new(); + lo2 = tcg_temp_new(); + tcg_gen_andi_tl(lo1, s1, imask); + tcg_gen_andi_tl(lo2, s2, imask); + tcg_gen_shli_tl(lo1, lo1, shift); + tcg_gen_shli_tl(lo2, lo2, shift); + + tcg_gen_shr_tl(lo1, tcg_constant_tl(tabl), lo1); + tcg_gen_shr_tl(lo2, tcg_constant_tl(tabr), lo2); + tcg_gen_andi_tl(lo1, lo1, omask); + tcg_gen_andi_tl(lo2, lo2, omask); + + amask = -8; + if (AM_CHECK(dc)) { + amask &= 0xffffffffULL; + } + tcg_gen_andi_tl(s1, s1, amask); + tcg_gen_andi_tl(s2, s2, amask); + + /* Compute dst = (s1 == s2 ? lo1 : lo1 & lo2). */ + tcg_gen_and_tl(lo2, lo2, lo1); + tcg_gen_movcond_tl(TCG_COND_EQ, dst, s1, s2, lo1, lo2); + + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(EDGE8cc, VIS1, gen_edge, a, 8, 1, 0) +TRANS(EDGE8Lcc, VIS1, gen_edge, a, 8, 1, 1) +TRANS(EDGE16cc, VIS1, gen_edge, a, 16, 1, 0) +TRANS(EDGE16Lcc, VIS1, gen_edge, a, 16, 1, 1) +TRANS(EDGE32cc, VIS1, gen_edge, a, 32, 1, 0) +TRANS(EDGE32Lcc, VIS1, gen_edge, a, 32, 1, 1) + +TRANS(EDGE8N, VIS2, gen_edge, a, 8, 0, 0) +TRANS(EDGE8LN, VIS2, gen_edge, a, 8, 0, 1) +TRANS(EDGE16N, VIS2, gen_edge, a, 16, 0, 0) +TRANS(EDGE16LN, VIS2, gen_edge, a, 16, 0, 1) +TRANS(EDGE32N, VIS2, gen_edge, a, 32, 0, 0) +TRANS(EDGE32LN, VIS2, gen_edge, a, 32, 0, 1) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -5163,89 +5188,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (opf) { case 0x000: /* VIS I edge8cc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 1, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x001: /* VIS II edge8n */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 0, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x002: /* VIS I edge8lcc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 1, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x003: /* VIS II edge8ln */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 0, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x004: /* VIS I edge16cc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 1, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x005: /* VIS II edge16n */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 0, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x006: /* VIS I edge16lcc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 1, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x007: /* VIS II edge16ln */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 0, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x008: /* VIS I edge32cc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 1, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x009: /* VIS II edge32n */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 0, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x00a: /* VIS I edge32lcc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 1, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x00b: /* VIS II edge32ln */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 0, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x010: /* VIS I array8 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1 = gen_load_gpr(dc, rs1); From patchwork Tue Oct 17 06:12:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734286 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323874wro; Mon, 16 Oct 2023 23:19:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMl11pBXhdupDIn1Wk8AyoMdlKmA2M/2ZuNUvVlY21tybWNxe4fwM9WGkilTVVWnmc4/xk X-Received: by 2002:ac8:5a0c:0:b0:417:9994:eb75 with SMTP id n12-20020ac85a0c000000b004179994eb75mr1558419qta.21.1697523580752; Mon, 16 Oct 2023 23:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523580; cv=none; d=google.com; s=arc-20160816; b=D2A6Ob4hW5IF6t7lnZD2aLP7hyiM0JexQibP4XmDmlI1O1gLPIzKozZGLBuiYSUt4m s8iFgPQaIX1Q1M0tF3Beoqc+AdM38LcSrhPm8Le6FzlkvHqPSjeBQ0XgQbtOmU1gNibF NiMQoFNj4oq3pKRmtjJBD2e87VQDNQZwpyzbcnX45vj8tFfYdWC5/mLNkuHIUuj4BP8u SBpw2Mp7Q9+IM1r8tNK6Q1O6cA9a87Z5HsmRbZiP33IO6/vQB2DGGJeXF96I6aENZG0U wkEllgVOXrfgoeFCWm0FbnDa99MaVJMmXCYoFxSSeAI2CcshY5wM8aqdHnultuIiLjKV oAUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=fYU619EhmiJiMok1HjhepJqZxdbfU7SP1HHHFGCJg74=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=R/f9Q8FEzLrPnFLCeaPVF/XV4E6RwRPTLbUoLlBdnxnnKOme/vx01JZsqnp/9FdSJC zfpQBUWNtnfZxUi4uqIYb7WspRm5r2xmDitBh9PVqVAK+FQwG+UeCdswqlh6CQqCH9xV iDSF7fI92qd+I4I85qUEMjwv8NySBUREVLGWgxxjBRgPM0VJs5iL+X7BfzzjqRD3mFJc zNiUTBgB3dz83/Lv1rUXmz+iUwTljQsMZUGzr2lxZtj7GIW/SpE/O9g9vdy9mXPnWmya y0ax24DDW871zHg8D9eJ6WLlTZULQTS45M4LCtuSJ+9oWOlguatOHDmbHf9z84PjJ2L8 YA7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yVvqIjlm; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f23-20020a05622a1a1700b0040306253e31si662829qtb.416.2023.10.16.23.19.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:19:40 -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=yVvqIjlm; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNq-0003Tg-NU; Tue, 17 Oct 2023 02:16: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 1qsdNo-0003Pn-Dd for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004k0-JA for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b5e6301a19so3141623b3a.0 for ; Mon, 16 Oct 2023 23:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523395; x=1698128195; 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=fYU619EhmiJiMok1HjhepJqZxdbfU7SP1HHHFGCJg74=; b=yVvqIjlm6bFnGU5eEFp6q54BxfV2hE3Z4FZb6rf27hoWKvzOPitoLxu/L/+GrkzYQt b8yQOtkoRayire2ahMmf/1wBO1eCujuU5qmUS5rN5Gr5S8mPRq7URJAVuV2kS4uRy8M7 ZvqAhCJtMiCIr5Y21n/qjoVcB7S/Qr/Jyn5/2nAv522HF0R+m5ZbE5XGVrNQt1YCZbIh V2RimTppojvAJy5tSEp9VQERWpTNyHpGbawVpdGnzoki4ZcRl39QlWrVJpv3hv1Vy9l3 cXx7ejyH0pEmcPerEsvvetqiJkXC800rAXTuOYEpLKqiRBDmWn8hOK58PpQo29HNRd8d Y6Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523395; x=1698128195; 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=fYU619EhmiJiMok1HjhepJqZxdbfU7SP1HHHFGCJg74=; b=e/rorElzIzDxTktUk3guWFs0B5tzPLFOVN8GLlRTjnJ22OC0nfsydHS4UditmjXl2j dZEcCUwyIsM4AoLhUjYfcVAAxs2j6AQmFHhGO9gXKggYgTOImeoAq51Ik3SnKKRxfZAN FkIkLyHurEyAGyaDBTFFmEO2+W45lTj/Wv4AMbR1QiSXfUw3hvBCP791JCZrCeXBxIFF j3Bf2QRNNII4jdyyMqbAO1Ub4ZFKNPJjaAAthzCy9ptX4hZzEUwtdJQNUetAdlVHzZFX TzxQMTYXylvNvPZlzBCRhIhFDQvXIq+8y3aCoDXF9qxwmTyUGv4rT/XmXhP2ogtsQsts 1s4g== X-Gm-Message-State: AOJu0YxdL1KsE37oUGTNHlv07sXoc3+ngbVknPGxeANmLxukoG1zyTBt L+RhgwVyrZqTLh6RRiMZjW/Isv+bPX8BwmYtPo8= X-Received: by 2002:a05:6a00:21cc:b0:6b1:cc77:4d2 with SMTP id t12-20020a056a0021cc00b006b1cc7704d2mr1444785pfj.15.1697523395643; Mon, 16 Oct 2023 23:16:35 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 60/90] target/sparc: Move ARRAY* to decodetree Date: Mon, 16 Oct 2023 23:12:14 -0700 Message-Id: <20231017061244.681584-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 54 ++++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index fb104e77d1..07a84b109c 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -241,6 +241,10 @@ RETRY 10 00001 111110 00000 0 0000000000000 EDGE32N 10 ..... 110110 ..... 0 0000 1001 ..... @r_r_r EDGE32Lcc 10 ..... 110110 ..... 0 0000 1010 ..... @r_r_r EDGE32LN 10 ..... 110110 ..... 0 0000 1011 ..... @r_r_r + + ARRAY8 10 ..... 110110 ..... 0 0001 0000 ..... @r_r_r + ARRAY16 10 ..... 110110 ..... 0 0001 0010 ..... @r_r_r + ARRAY32 10 ..... 110110 ..... 0 0001 0100 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5145692885..87f3ab27b1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -72,6 +72,10 @@ static void gen_helper_st_asi(TCGv_env e, TCGv a, TCGv_i64 r, g_assert_not_reached(); } # endif +static void gen_helper_array8(TCGv r, TCGv a, TCGv b) +{ + g_assert_not_reached(); +} #endif /* Dynamic PC, must exit to main loop. */ @@ -679,6 +683,18 @@ static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2) tcg_gen_ctpop_tl(dst, src2); } +static void gen_op_array16(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_array8(dst, src1, src2); + tcg_gen_shli_tl(dst, dst, 1); +} + +static void gen_op_array32(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_array8(dst, src1, src2); + tcg_gen_shli_tl(dst, dst, 2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -4302,6 +4318,22 @@ TRANS(EDGE16LN, VIS2, gen_edge, a, 16, 0, 1) TRANS(EDGE32N, VIS2, gen_edge, a, 32, 0, 0) TRANS(EDGE32LN, VIS2, gen_edge, a, 32, 0, 1) +static bool do_rrr(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv, TCGv, TCGv)) +{ + TCGv dst = gen_dest_gpr(dc, a->rd); + TCGv src1 = gen_load_gpr(dc, a->rs1); + TCGv src2 = gen_load_gpr(dc, a->rs2); + + func(dst, src1, src2); + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(ARRAY8, VIS1, do_rrr, a, gen_helper_array8) +TRANS(ARRAY16, VIS1, do_rrr, a, gen_op_array16) +TRANS(ARRAY32, VIS1, do_rrr, a, gen_op_array32) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -5199,30 +5231,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x009: /* VIS II edge32n */ case 0x00a: /* VIS I edge32lcc */ case 0x00b: /* VIS II edge32ln */ - g_assert_not_reached(); /* in decodetree */ case 0x010: /* VIS I array8 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_helper_array8(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x012: /* VIS I array16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_helper_array8(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_shli_i64(cpu_dst, cpu_dst, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x014: /* VIS I array32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_helper_array8(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_shli_i64(cpu_dst, cpu_dst, 2); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x018: /* VIS I alignaddr */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1 = gen_load_gpr(dc, rs1); From patchwork Tue Oct 17 06:12:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734338 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326729wro; Mon, 16 Oct 2023 23:29:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEA8KxgBH+jOMyxVnqH+iwolsHQo8yHMQ3OLDhLbNRVnnZYfP6KOOvponWV+8kjsHfAPEjN X-Received: by 2002:a05:622a:593:b0:419:5162:5e0f with SMTP id c19-20020a05622a059300b0041951625e0fmr1691606qtb.13.1697524146345; Mon, 16 Oct 2023 23:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524146; cv=none; d=google.com; s=arc-20160816; b=RSoij+nFib2pTTAa2djfSocYfOhBiKJm/iHeKdzjmFAYA+rPMyfww2XrL+oSd/CkS3 NdsGay6YHIR/OL/LxVjnItTHnC9/lU8ZQPe7H9IT62z8gYrWcX4xBh5/4bJXRcSPsmHi 5QBh6UB2Xb29j0Iisy8WYzDAEY+CtM4vRVNwY/5v3Ut5qbbOM3avpZB9zhfMtEgLI0Ra ucum4oFRpRXYpDstByYKNMvRJWg7zdpoIiPifyWd+MLaLIZvBqXel52SMcj9AlZDZu46 7JGTR/RCwHUd4QjCLgupVLpDWC4K0hvW+1S7QinnCb1Dw/K3oRuNJhpASta9G3wdZw+U IM2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=5rhHwfmKZohtuDPT+hhaSHxZrrHX/JjVGE+L8S3fWgM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=DIrQxrmyJn86blSaM9/l1e4Bek3ozHbdQ4liEg9+52v0iHUj3yZXldGwZbugCiYc+c 69WDjMtDBX5Jn55AZet8WhdDAhH+cSGBUHl80x/T3/WM/uG+3G1DnJaZbv2PWu9Nkixj 9c5GysYH757Yo6XmOOXnfxeUkHGsHaRPRv+BQYdTe+Ine7jo12XAUogON+9aJEY+GYCO gJzHsMjEDGIfQdFv9/k3iZxnX3CDLZGTs/f56ygV+vJuS7jcoL5vp1790w/S0OljY7CN fIfSX2QTyQGp2OzM6R9BlWy5EuDOk4hLcZ2k6CklUN2ahWuOlFlJ3GIj9c0HMTjMle9E ZOLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=boFXvLtf; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s5-20020a05622a018500b00419544d5883si684339qtw.134.2023.10.16.23.29.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:29: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=boFXvLtf; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNu-0003bQ-6x; Tue, 17 Oct 2023 02:16:54 -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 1qsdNm-0003Kw-U8 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:46 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004kC-Hf for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:46 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so2952910b3a.0 for ; Mon, 16 Oct 2023 23:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523397; x=1698128197; 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=5rhHwfmKZohtuDPT+hhaSHxZrrHX/JjVGE+L8S3fWgM=; b=boFXvLtf9JRMd9Vokt9cUO+PVNzoykYmSrfxMsWFHkRe+BkCjY7tQuGIuFk1XnKFvA 2hBB0ExC5k3wdxpkEkM+iqecSbClR6QxuHn963mcT+qFZrjPEKygrxm5orWjUdlhInRF AngZ7VhnzaU6G3VWVDKiLXNXRl8ZOuUaB1RoFZ7e6MI2CifgbE55URF1c5ed2R2N7qtD LXK2cDXGnr/l4fy/W7sCsji0J4jfjoz4M5Ub/wpi6L4RVD69ntHjzfHTXumJPCSBdUhS q3c/JdsbmZUhs56MVbw/tJ1tLNcMWE6TVQqPuTZZGs54/4SKWOm8daGCUShhSzayAnDQ mH3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523397; x=1698128197; 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=5rhHwfmKZohtuDPT+hhaSHxZrrHX/JjVGE+L8S3fWgM=; b=gM2jACJqsqUMomcOlFvQDAeUvG3ksUzMK2hRmAXnRwfjGjVMLUMiVxalMpj53GAy9p uelI994etWlneZL/ym+P8w2587UkHPPH0MAf8k3UXqd4OGPfdRKELfb4nhDQu6I7saHN y6p2R3QG8jnlbmfTCueFlKWYUSuHVsFk8WDdp+qerpe3Dv9dmR6vso4yWNtpkYHIRiK6 fSFdw5K4Pdzu3D4Y9Ghd607b54yJ2YN+eUpbc9FgVmDN2ESMPksg/4+8g05TFGXi99wF M6C8q+9bnwtIpDfPdgINrGfG13kylPdtHcVXBLGHQWjq9RQswmc3d6fVUsP3G3Z04Oox onGw== X-Gm-Message-State: AOJu0YwmqMg++1rNGuxaYrCwHF1BtROLEJU71qnIFk5KN6Wcf4dJ6PDB sNnFwDKhqJKVSnFRuUcZj/2E2AFEw4iJRDbA4BE= X-Received: by 2002:a05:6a00:13a1:b0:6be:265:1bf7 with SMTP id t33-20020a056a0013a100b006be02651bf7mr1375577pfg.34.1697523396813; Mon, 16 Oct 2023 23:16:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 61/90] target/sparc: Move ADDRALIGN* to decodetree Date: Mon, 16 Oct 2023 23:12:15 -0700 Message-Id: <20231017061244.681584-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 56 ++++++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 07a84b109c..8bd57f620a 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -245,6 +245,9 @@ RETRY 10 00001 111110 00000 0 0000000000000 ARRAY8 10 ..... 110110 ..... 0 0001 0000 ..... @r_r_r ARRAY16 10 ..... 110110 ..... 0 0001 0010 ..... @r_r_r ARRAY32 10 ..... 110110 ..... 0 0001 0100 ..... @r_r_r + + ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r + ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 87f3ab27b1..dab3e83c27 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2685,18 +2685,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) } } -static void gen_alignaddr(TCGv dst, TCGv s1, TCGv s2, bool left) -{ - TCGv tmp = tcg_temp_new(); - - tcg_gen_add_tl(tmp, s1, s2); - tcg_gen_andi_tl(dst, tmp, -8); - if (left) { - tcg_gen_neg_tl(tmp, tmp); - } - tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, tmp, 0, 3); -} - static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) { TCGv t1, t2, shift; @@ -4334,6 +4322,36 @@ TRANS(ARRAY8, VIS1, do_rrr, a, gen_helper_array8) TRANS(ARRAY16, VIS1, do_rrr, a, gen_op_array16) TRANS(ARRAY32, VIS1, do_rrr, a, gen_op_array32) +static void gen_op_alignaddr(TCGv dst, TCGv s1, TCGv s2) +{ +#ifdef TARGET_SPARC64 + TCGv tmp = tcg_temp_new(); + + tcg_gen_add_tl(tmp, s1, s2); + tcg_gen_andi_tl(dst, tmp, -8); + tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, tmp, 0, 3); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_alignaddrl(TCGv dst, TCGv s1, TCGv s2) +{ +#ifdef TARGET_SPARC64 + TCGv tmp = tcg_temp_new(); + + tcg_gen_add_tl(tmp, s1, s2); + tcg_gen_andi_tl(dst, tmp, -8); + tcg_gen_neg_tl(tmp, tmp); + tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, tmp, 0, 3); +#else + g_assert_not_reached(); +#endif +} + +TRANS(ALIGNADDR, VIS1, do_rrr, a, gen_op_alignaddr) +TRANS(ALIGNADDRL, VIS1, do_rrr, a, gen_op_alignaddrl) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -5234,21 +5252,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x010: /* VIS I array8 */ case 0x012: /* VIS I array16 */ case 0x014: /* VIS I array32 */ - g_assert_not_reached(); /* in decodetree */ case 0x018: /* VIS I alignaddr */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x01a: /* VIS I alignaddrl */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x019: /* VIS II bmask */ CHECK_FPU_FEATURE(dc, VIS2); cpu_src1 = gen_load_gpr(dc, rs1); From patchwork Tue Oct 17 06:12:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734301 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324636wro; Mon, 16 Oct 2023 23:22:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcE4YEtOgOI86HQDQ30YX9Ngqc4aY53pz/8tGn15iX3Q0pBqkYs/DmZVghF17fp7Bljw0Z X-Received: by 2002:a05:620a:2412:b0:777:7214:44d with SMTP id d18-20020a05620a241200b007777214044dmr1153076qkn.23.1697523742588; Mon, 16 Oct 2023 23:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523742; cv=none; d=google.com; s=arc-20160816; b=j9KQA7h3m1lUJhk/Lpjtoome91GxbC6zUbdpJT4lqI+IYQi7Kihxo/y6v0JFacCsV+ L5Yx9MKENVlGahFkGoJKsXmoIEgvafMDTC/QNsFLJmIhOnkzJta4YkUZwE/cukL1+Xxm T8KVfbgp9lTuwFd3E2r593AVVD6w7aMhAxWulC2mg1t6e54DCYZ3b53KE1YBOFBe7YgR L1CBWam6PlnETMyBYVsPin5VKwO/tU2CG1Nmb0YXTuGcma1OScQkOBCdSYi6K8FD10ZB 0uv2jifVHAm4TGo2l70VsTKDE6X4HnW7bFaVMA1A/miqOykMbdXBm9vtmgjUfmRbEQju 5zTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=HHo4SeyS7aw5ijTjoJ0VnbYoHhU1uLzmuWbYypfMjeM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ko1XD4gsh6svtWFeV7FufRK6Dml1g/v26DMG614FsIujZWR9Yz/NzYbt3yuh2klYm2 PzqMXbhP0NFEMA6OuomC/HBd/cbKJTReQooWq7J1PAXnJlN0bFQRk5iO3PfJdqVIatRw Up9Hrpa6CGlZRuCSQxbaGpJH81JHVndNe1hpuTWRGhYTqtvb6Mcf09a3SwAY3L4m7e1r DnTaUTnGpeMqp5AG4z6eyzIRSMrBMtCMMikr34fHPh5hDR9ht+2JVFehhgl+pgudAL+E jtygV9FDl2JJf2U+FKIj+MdC1unlccPBKF32/CV5mU7SZmPdjHSGFBA/NP861KDVQ+Mh UHTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Re2a7pFg; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u10-20020a05620a430a00b0076d9ca72d0esi617741qko.699.2023.10.16.23.22.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22:22 -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=Re2a7pFg; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNw-0003oC-Fa; Tue, 17 Oct 2023 02:16:56 -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 1qsdNm-0003Kg-SC for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:46 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004kM-HS for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:46 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1640915b3a.0 for ; Mon, 16 Oct 2023 23:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523398; x=1698128198; 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=HHo4SeyS7aw5ijTjoJ0VnbYoHhU1uLzmuWbYypfMjeM=; b=Re2a7pFgrlR3ZBIXDCWDh3jIEbhT3ornTpCIH+uPHQvxXEUsdHYoaTsbtrGpCyL9Ns brN7MHbefbpL7uGK7l/m12aavAgxJ0eOuColn0dE5XLL9AclDCv3LnT+Wmac/g7RJqvG tPaTpmLnqx0YLelpghLibk/1Kr68IDCvuqGmwQUVlyQ4VxsoDiTDhPmZ6lSe69Gm46S4 7XaxVVGVfTxqyzjHKALlqnvGJ5E3gK7e6epVOIrQDCf65XhLBkCdkG6IgEzd9bCzV1oW /B1Wuxk11dXZBfK7fzpqfjyzF2eMXIwGZRRSt+l5QG/7Dq6TdFVvuzZ3FSUoffPaHgHE k3tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523398; x=1698128198; 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=HHo4SeyS7aw5ijTjoJ0VnbYoHhU1uLzmuWbYypfMjeM=; b=nD0Q9YfDDEfGwXcWyyLImIdbtyExP5N/Xw1AmShGsi3JDoP3tyXFjP5lQ3SBF6VBb3 /Zf7aUzXe2pdIkHLHCoBlf5qU3W6TKvQvmopmSDSg6zxxtGvA4pubH+CYjBkTP5NASMj MFXhvYabC8khQmSsIz9T9a3I674XLjqNMreprLxCKEkSel8tcMkZSixOVvQgHLTsAG2w CLM00dre+cBIzsRQ6lsc3u8GwGGSmrTwsMJOg8kdRDjlYGmZgosTKTqPsXFKsX6qx3J5 RSZvok+ZXaDmKXLlgtRMhHIrL2jwKw8JdWqWgKUhxUfipGluPR/dZNVJP7ZhEn7O0wMC BEKQ== X-Gm-Message-State: AOJu0YwCH4sNENBbCVz4N678aoLWRKzvbKPHbhs8BvNb8MQmb3tuVq4z 0r112Rt4pua/UV8vsC6RBG0jM+XnXwuHz/EJyNk= X-Received: by 2002:a05:6a00:1353:b0:68f:b5a3:5ec6 with SMTP id k19-20020a056a00135300b0068fb5a35ec6mr1500386pfu.0.1697523397912; Mon, 16 Oct 2023 23:16:37 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 62/90] target/sparc: Move BMASK to decodetree Date: Mon, 16 Oct 2023 23:12:16 -0700 Message-Id: <20231017061244.681584-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 8bd57f620a..6f136e0602 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -248,6 +248,8 @@ RETRY 10 00001 111110 00000 0 0000000000000 ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r + + BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index dab3e83c27..64f1999cba 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4352,6 +4352,18 @@ static void gen_op_alignaddrl(TCGv dst, TCGv s1, TCGv s2) TRANS(ALIGNADDR, VIS1, do_rrr, a, gen_op_alignaddr) TRANS(ALIGNADDRL, VIS1, do_rrr, a, gen_op_alignaddrl) +static void gen_op_bmask(TCGv dst, TCGv s1, TCGv s2) +{ +#ifdef TARGET_SPARC64 + tcg_gen_add_tl(dst, s1, s2); + tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, dst, 32, 32); +#else + g_assert_not_reached(); +#endif +} + +TRANS(BMASK, VIS2, do_rrr, a, gen_op_bmask) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -4889,7 +4901,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; TCGv cpu_src1 __attribute__((unused)); - TCGv cpu_src2 __attribute__((unused)); TCGv_i32 cpu_src1_32, cpu_src2_32; TCGv_i64 cpu_src1_64, cpu_src2_64; TCGv_i32 cpu_dst_32 __attribute__((unused)); @@ -5254,15 +5265,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x014: /* VIS I array32 */ case 0x018: /* VIS I alignaddr */ case 0x01a: /* VIS I alignaddrl */ - g_assert_not_reached(); /* in decodetree */ case 0x019: /* VIS II bmask */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - tcg_gen_add_tl(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, cpu_dst, 32, 32); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1_64 = gen_load_fpr_D(dc, rs1); From patchwork Tue Oct 17 06:12:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734342 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326858wro; Mon, 16 Oct 2023 23:29:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCosT8GcbQdTasqW0YYMdRJuIW9FXrb8jVApbT5XDF4FSc/cVeY9anDi90FNQae5EI7eIh X-Received: by 2002:ae9:ee19:0:b0:775:ced2:3c7 with SMTP id i25-20020ae9ee19000000b00775ced203c7mr1300495qkg.26.1697524179363; Mon, 16 Oct 2023 23:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524179; cv=none; d=google.com; s=arc-20160816; b=Ku8FF20EfHNiwLnzLWlLHQYO+CGP6imrXkYltrLRTeDBWYa4gERMvsO+MnSe+D0sd8 5KqdFnnAGmpl1+XhqMxkzgLYTuNQiCFiBtbiKFvEfS1XvUlNpPtfRrDTXtbUqGLs8/9O axyZigI8ASXyZGoVCU4xVH0dggmqOLDxC29tOH31Kr3bPgScugJDTee4D/D/rx8t+DyC n3XTjbQFtvjm6Ppg4+/hhlzrhJ3EObV93vXLuMcFLgIyKzpfJd7pQxqsJu1df1R8+2Wn c1//BWXcyitcIZO5uYZ/WAlKfuZfiEPFR7dZVdp9Um6LZEzUIWGJEK3r5TXskIkHpXwk ZMmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=HhpcpPleeDxxc/XEAW/TxFnZJ12WYojxzkQnIH6VleQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=SqTNZd+7O49T5GShsfHtpWG34ZZbQQjlhhcDtzykO0JIRkKZVYWBlfrEmZzntc5CPc pVxOV1vV3Tv0D9NHkSpX0M606sJj/SxioEGVvqjIQ6McrWPyJ3S2t5/6GknSn+7HKcE5 DVQg45N3ONyI3pgZ147dtl0Uq7uoegXF5MInLME98KdQYPL58EAhZwOSDiej7mXMRY44 L1KNoeUgWXhcmJ7dAq1mBrGwKM/7w2+p4O09S7XbOjEJezAjgvlRXla/7Botd3cBue1J pCpcKDtmKveszrVolHSzr84bFX714jbqeLEIAxZLm6KFebSO5IfFw51b3vJua/RP3WL7 JDVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aHTNfrse; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y17-20020a05620a25d100b00773e6deb673si630686qko.670.2023.10.16.23.29.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:29:39 -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=aHTNfrse; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNr-0003Ur-Kx; Tue, 17 Oct 2023 02:16:51 -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 1qsdNn-0003Lr-8I for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:47 -0400 Received: from mail-yw1-x112b.google.com ([2607:f8b0:4864:20::112b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004kR-Ip for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:46 -0400 Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-5a7ab31fb8bso63471217b3.1 for ; Mon, 16 Oct 2023 23:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523398; x=1698128198; 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=HhpcpPleeDxxc/XEAW/TxFnZJ12WYojxzkQnIH6VleQ=; b=aHTNfrseGVvpPnt5B7oa7W/xoacHf0okWSmDJVZKsTZ7LP8pldqMK9k5ITd57vu47U EU348GDhjIp8HYG/GgFVdIxg9YY4ctmv1nM0XKZDqLjFDFjOgLJKotydvT3C0ssRMLT5 biZut5vJ7NUy0Rc5PpDdqhVEMbXT8pin2bxbTn6DJS3DM2yRLpEyUsj1SmJuClmP1tgF Spl/6Z4RGl3+XO55AHOXXFtjn5qK8UyZ0Mzee7xPonkQvdtl4akeASgExxthMB6SfDHm 78vi1KFHUN/Wy3Pe7A0hlcNvBpYODf2qSAI3Z/Byd1tI4XL8VHPlE3DpMxy5KSsE4oA6 wX2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523398; x=1698128198; 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=HhpcpPleeDxxc/XEAW/TxFnZJ12WYojxzkQnIH6VleQ=; b=PZIwwoyF3pbinpTkQJ/cJxVX1Z9Ey0MYZne5dz/0uY+56sKxkN8GgEhMPQNW03yVhX qH6zpRGQHAzvyIdp43BMZmpqfbKsShjXrxR0dz0iIVRPDH8Lbrr0x9D/YRl0k/vyOtBV HsAKLYgfb5NwU1TNGQCphrezuGSR8547Y6wzgap3lzrO+xdl3InvJACiMwiP5KumvgaA nKX//GPvcWnoB7/wPn4q7yzr+aMbrfO2dGqjp317L7pkQaIylJR0MODommrztK0GnJ3M acrg/SRyIFmllzB0hiTnCWE+1+YC7c5Upw1TVNo4GdJiV+YJ2i6mabCrveOnp6WPgBcn V2vw== X-Gm-Message-State: AOJu0Yw295sWPeAO3ieitK1hoLXgCXxiu8Uh2bwwUra31WUyz6ol1mnW Xx8yg+iEl28a3O1DPvF6rMqKpJMxUCl7rGNgo4o= X-Received: by 2002:a0d:c447:0:b0:59f:21c1:30b6 with SMTP id g68-20020a0dc447000000b0059f21c130b6mr1281220ywd.51.1697523398665; Mon, 16 Oct 2023 23:16:38 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 63/90] target/sparc: Move FMOVS, FNEGS, FABSS, FSRC*S, FNOT*S to decodetree Date: Mon, 16 Oct 2023 23:12:17 -0700 Message-Id: <20231017061244.681584-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::112b; envelope-from=richard.henderson@linaro.org; helo=mail-yw1-x112b.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 13 ++++++ target/sparc/translate.c | 92 +++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 6f136e0602..d591efb0f9 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -33,6 +33,10 @@ CALL 01 i:s30 &r_r_r rd rs1 rs2 @r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r +&r_r rd rs +@r_r1 .. rd:5 ...... rs:5 . ........ ..... &r_r +@r_r2 .. rd:5 ...... ..... . ........ rs:5 &r_r + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -227,6 +231,10 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 +FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 +FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r @@ -250,6 +258,11 @@ RETRY 10 00001 111110 00000 0 0000000000000 ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + + FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s + FSRCs 10 ..... 110110 00000 0 0111 1001 ..... @r_r2 # FSRC2s + FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s + FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 64f1999cba..3b0ce1adcc 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1351,6 +1351,29 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) cmp->c2 = tcg_constant_tl(0); } +static void gen_op_clear_ieee_excp_and_FTT(void) +{ + tcg_gen_andi_tl(cpu_fsr, cpu_fsr, FSR_FTT_CEXC_NMASK); +} + +static void gen_op_fmovs(TCGv_i32 dst, TCGv_i32 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + tcg_gen_mov_i32(dst, src); +} + +static void gen_op_fnegs(TCGv_i32 dst, TCGv_i32 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fnegs(dst, src); +} + +static void gen_op_fabss(TCGv_i32 dst, TCGv_i32 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fabss(dst, src); +} + #ifdef TARGET_SPARC64 static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { @@ -1511,11 +1534,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_op_clear_ieee_excp_and_FTT(void) -{ - tcg_gen_andi_tl(cpu_fsr, cpu_fsr, FSR_FTT_CEXC_NMASK); -} - static void gen_fop_FF(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32)) { @@ -1530,19 +1548,6 @@ static void gen_fop_FF(DisasContext *dc, int rd, int rs, gen_store_fpr_F(dc, rd, dst); } -static void gen_ne_fop_FF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_i32)) -{ - TCGv_i32 dst, src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_F(dc); - - gen(dst, src); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32)) { @@ -4889,6 +4894,27 @@ static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL) TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ) +static bool do_ff(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_i32)) +{ + TCGv_i32 tmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + tmp = gen_load_fpr_F(dc, a->rs); + func(tmp, tmp); + gen_store_fpr_F(dc, a->rd, tmp); + return advance_pc(dc); +} + +TRANS(FMOVs, ALL, do_ff, a, gen_op_fmovs) +TRANS(FNEGs, ALL, do_ff, a, gen_op_fnegs) +TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) +TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) +TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4930,15 +4956,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { case 0x1: /* fmovs */ - cpu_src1_32 = gen_load_fpr_F(dc, rs2); - gen_store_fpr_F(dc, rd, cpu_src1_32); - break; case 0x5: /* fnegs */ - gen_ne_fop_FF(dc, rd, rs2, gen_helper_fnegs); - break; case 0x9: /* fabss */ - gen_ne_fop_FF(dc, rd, rs2, gen_helper_fabss); - break; + g_assert_not_reached(); /* in decodetree */ case 0x29: /* fsqrts */ gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); break; @@ -5266,6 +5286,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x018: /* VIS I alignaddr */ case 0x01a: /* VIS I alignaddrl */ case 0x019: /* VIS II bmask */ + case 0x067: /* VIS I fnot2s */ + case 0x06b: /* VIS I fnot1s */ + case 0x075: /* VIS I fsrc1s */ + case 0x079: /* VIS I fsrc2s */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5453,10 +5477,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DD(dc, rd, rs2, tcg_gen_not_i64); break; - case 0x067: /* VIS I fnot2s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FF(dc, rd, rs2, tcg_gen_not_i32); - break; case 0x068: /* VIS I fandnot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); @@ -5469,10 +5489,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DD(dc, rd, rs1, tcg_gen_not_i64); break; - case 0x06b: /* VIS I fnot1s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FF(dc, rd, rs1, tcg_gen_not_i32); - break; case 0x06c: /* VIS I fxor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); @@ -5510,11 +5526,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1_64 = gen_load_fpr_D(dc, rs1); gen_store_fpr_D(dc, rd, cpu_src1_64); break; - case 0x075: /* VIS I fsrc1s */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_32 = gen_load_fpr_F(dc, rs1); - gen_store_fpr_F(dc, rd, cpu_src1_32); - break; case 0x076: /* VIS I fornot2 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64); @@ -5528,11 +5539,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1_64 = gen_load_fpr_D(dc, rs2); gen_store_fpr_D(dc, rd, cpu_src1_64); break; - case 0x079: /* VIS I fsrc2s */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_32 = gen_load_fpr_F(dc, rs2); - gen_store_fpr_F(dc, rd, cpu_src1_32); - break; case 0x07a: /* VIS I fornot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); From patchwork Tue Oct 17 06:12:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734297 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324489wro; Mon, 16 Oct 2023 23:21:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmuR4E4vCxi35G788+60cvKBvMTf7Cnp4Xo188eAIpUfKORc/6X0/0HudcGQxqhkn+/My5 X-Received: by 2002:a67:ae4a:0:b0:452:66b0:e3ad with SMTP id u10-20020a67ae4a000000b0045266b0e3admr1428324vsh.20.1697523712068; Mon, 16 Oct 2023 23:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523712; cv=none; d=google.com; s=arc-20160816; b=IVYTL81arZ4T2XDvwlWjTmTFWh3k0TfkJuOpdfY7UYNVVy5hmxGSjl+k5+829fETuW EjumrvzTdHwcm+Rb7885dLkluzeWtEYiEcMW0n/0WRb+x6jxJscUI/OurgE5ewcN4zHd BCUFRHwoXwYM2ECVzD77leTpqXAyfFumuINt9MxHb5YUUzaDH4he3Hp8si6MHJSTzyMb Zq/e7m15Y2LwdtmEqhLeJYTRJ+Dp5TafkWwe3MS+ejLy5DAs0LNtOBCxhTl+YXpPKHT0 NMGnY57O0DTTvM77jkTDS3TOWCf7zPz4Le2S96uru3z9p670Q+G9oczcAzt2PHwINA5q N+lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=yCGDrMzmRBAmSkf7YIPhJL0GlU8BvHPUcI8WVe7himg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=mCex53zojmbLKyzmLQZmjaiRGFcqkhw8X4AeDDfyjK+41Y5xXTYwtmurp65H8ulXBg pCiSAR40mpZ0wf2N4IShcURRZDxPDhb+HCAkBip9CPPV+WGJ+9LnxFvLqoWyVx6a/m0Q 0Et+lZtN3rXh3yoK+Xr2kyGtq6BMp4hXKt+p74JizLYCnDLIKzxUWY8ckmrfR2wr0FfQ Mxz70wk9XBixwJIqBOTpYJImPO8v3OohBlE7SLoCgSzTTtJNSYdnfPqPkErqdeMD8P3M s5UuCm2obCWhulq+MVMz7J/r5z7H3QnNW8E1dJCShjOVa7/zTaTP/bLqgcu20Xq3ZZ7J d/Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jMFhgnt9; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bi19-20020a05620a319300b00773e8a628f6si602574qkb.663.2023.10.16.23.21.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:52 -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=jMFhgnt9; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNt-0003aP-8U; Tue, 17 Oct 2023 02:16:53 -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 1qsdNn-0003LL-2v for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:47 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004kf-H6 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:46 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6bd0e1b1890so1859664b3a.3 for ; Mon, 16 Oct 2023 23:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523400; x=1698128200; 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=yCGDrMzmRBAmSkf7YIPhJL0GlU8BvHPUcI8WVe7himg=; b=jMFhgnt9GMx3L+QhoQozshsJ7DbWbY9/AkA5pCmNFRDpOlS3L6SZKo5SlOs6of4trt thWJCDiIaR5LJR4dMIYAw1HfTEiHo09b1GopIMj5oi3DeAMG1o5hw+d5TcvMB9c9q/BS boeh9lJtZULsqfO+yjtxw/qmaNs0IqSdMZMr6HwLDs/iJ73dNfdyUnjabWp6z6EkamWc hK3DoAnCf1lwnwkykOHHjh1A/vfiblqJL6uQs0rw3xVF6LBF1ZJUZCNnmPRWl/qXppH2 TzlgWePSG5t5OBdZqMWsxJRocTqA0YtW6+4whJi/NXFWT0EBBC9f1aLP/6DTyIwe2afG vEIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523400; x=1698128200; 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=yCGDrMzmRBAmSkf7YIPhJL0GlU8BvHPUcI8WVe7himg=; b=HNewXSAdoSQrp90pjy1mHrHwO3gWmo4ZNjFgGKtjInnmIWLG8Oj5/OZ4KK6mZNYmwl Tiq7hE2FH27dOmrC4LaDwk6p6ay+cUQQ6nxX+f+EXD+iQJKbfzWJpLKzFkjTJ6NlM1es O9jcI27RdR8Eko4y9tZ++Udxpq8Vg5EzW5uyWQyPdkuObKy6TllTd5Uvgigixw4xVD9x PrwwE+EPwXkhs+wxv88Z4heK2caxAvyRhlFvSg5BZZGL+PwypxZFVFsqWc8jv/bYCq0h 4sKQ7dMafP830bKqCeD8jBZ/B3dLiTZUf9p4G93ChnanXy3qNGG4u9MYvmSqkMZiK08J /jNg== X-Gm-Message-State: AOJu0YwMyc85bwvvZBWOhwRt/EzOMTGpaZczxW7ku2y7nofJyWH5eDW1 J3RbAWeM5u4inm4miBHYgtKlmoNVXG9VuuJGdLs= X-Received: by 2002:a05:6a00:148d:b0:68e:351b:15b8 with SMTP id v13-20020a056a00148d00b0068e351b15b8mr1441099pfu.12.1697523400273; Mon, 16 Oct 2023 23:16:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 64/90] target/sparc: Move FMOVD, FNEGD, FABSD, FSRC*D, FNOT*D to decodetree Date: Mon, 16 Oct 2023 23:12:18 -0700 Message-Id: <20231017061244.681584-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 +++ target/sparc/translate.c | 91 +++++++++++++++++++++------------------ 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d591efb0f9..91988e2978 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -232,8 +232,11 @@ DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 +FMOVd 10 ..... 110100 00000 0 0000 0010 ..... @r_r2 FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 +FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 +FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 { [ @@ -259,9 +262,13 @@ FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s + FSRCd 10 ..... 110110 00000 0 0111 1000 ..... @r_r2 # FSRC2d FSRCs 10 ..... 110110 00000 0 0111 1001 ..... @r_r2 # FSRC2s + FNOTd 10 ..... 110110 ..... 0 0110 1010 00000 @r_r1 # FNOT1d FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s + FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 3b0ce1adcc..c92b080b8f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -54,6 +54,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fnegd(D, S) qemu_build_not_reached() +#define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() @@ -1374,6 +1376,24 @@ static void gen_op_fabss(TCGv_i32 dst, TCGv_i32 src) gen_helper_fabss(dst, src); } +static void gen_op_fmovd(TCGv_i64 dst, TCGv_i64 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + tcg_gen_mov_i64(dst, src); +} + +static void gen_op_fnegd(TCGv_i64 dst, TCGv_i64 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fnegd(dst, src); +} + +static void gen_op_fabsd(TCGv_i64 dst, TCGv_i64 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fabsd(dst, src); +} + #ifdef TARGET_SPARC64 static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { @@ -1593,21 +1613,6 @@ static void gen_fop_DD(DisasContext *dc, int rd, int rs, gen_store_fpr_D(dc, rd, dst); } -#ifdef TARGET_SPARC64 -static void gen_ne_fop_DD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src; - - src = gen_load_fpr_D(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, src); - - gen_store_fpr_D(dc, rd, dst); -} -#endif - static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -4915,6 +4920,28 @@ TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) +static bool do_dd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_D(dc, a->rd); + src = gen_load_fpr_D(dc, a->rs); + func(dst, src); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FMOVd, 64, do_dd, a, gen_op_fmovd) +TRANS(FNEGd, 64, do_dd, a, gen_op_fnegd) +TRANS(FABSd, 64, do_dd, a, gen_op_fabsd) +TRANS(FSRCd, VIS1, do_dd, a, tcg_gen_mov_i64) +TRANS(FNOTd, VIS1, do_dd, a, tcg_gen_not_i64) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4958,6 +4985,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x1: /* fmovs */ case 0x5: /* fnegs */ case 0x9: /* fabss */ + case 0x2: /* V9 fmovd */ + case 0x6: /* V9 fnegd */ + case 0xa: /* V9 fabsd */ g_assert_not_reached(); /* in decodetree */ case 0x29: /* fsqrts */ gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); @@ -5060,24 +5090,14 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_fop_FQ(dc, rd, rs2, gen_helper_fqtoi); break; #ifdef TARGET_SPARC64 - case 0x2: /* V9 fmovd */ - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - gen_store_fpr_D(dc, rd, cpu_src1_64); - break; case 0x3: /* V9 fmovq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_move_Q(dc, rd, rs2); break; - case 0x6: /* V9 fnegd */ - gen_ne_fop_DD(dc, rd, rs2, gen_helper_fnegd); - break; case 0x7: /* V9 fnegq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fnegq); break; - case 0xa: /* V9 fabsd */ - gen_ne_fop_DD(dc, rd, rs2, gen_helper_fabsd); - break; case 0xb: /* V9 fabsq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); @@ -5290,6 +5310,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x06b: /* VIS I fnot1s */ case 0x075: /* VIS I fsrc1s */ case 0x079: /* VIS I fsrc2s */ + case 0x066: /* VIS I fnot2 */ + case 0x06a: /* VIS I fnot1 */ + case 0x074: /* VIS I fsrc1 */ + case 0x078: /* VIS I fsrc2 */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5473,10 +5497,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_andc_i32); break; - case 0x066: /* VIS I fnot2 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DD(dc, rd, rs2, tcg_gen_not_i64); - break; case 0x068: /* VIS I fandnot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); @@ -5485,10 +5505,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_andc_i32); break; - case 0x06a: /* VIS I fnot1 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DD(dc, rd, rs1, tcg_gen_not_i64); - break; case 0x06c: /* VIS I fxor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); @@ -5521,10 +5537,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_eqv_i32); break; - case 0x074: /* VIS I fsrc1 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - gen_store_fpr_D(dc, rd, cpu_src1_64); break; case 0x076: /* VIS I fornot2 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5534,11 +5546,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_orc_i32); break; - case 0x078: /* VIS I fsrc2 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - gen_store_fpr_D(dc, rd, cpu_src1_64); - break; case 0x07a: /* VIS I fornot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); From patchwork Tue Oct 17 06:12:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734287 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323876wro; Mon, 16 Oct 2023 23:19:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSZE3Y2YsZeVi3db87OnW82Qup+ZnUzxIyyk77/5/CNkqKH7LUVsftvN34wJjFoKUncbNR X-Received: by 2002:ad4:5bce:0:b0:66d:182a:c083 with SMTP id t14-20020ad45bce000000b0066d182ac083mr1730148qvt.9.1697523581419; Mon, 16 Oct 2023 23:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523581; cv=none; d=google.com; s=arc-20160816; b=YzA31OD77mVe1I+lySPscGz9dQBjbgl3nCS3bzKO21cMq/frsMi7VqGjEthbNsy56w litk0jaRl4J7bxo18q1gt+MPZCo8y/1NFJ9RQONE8mb1Ab5vhvc3/ibyFh2/QSxB7Rju GOBX1KjZYLs+COC7J3SISum3w2jd7eTB1RoG2D4nGHb5ah1tbWPnDlkVKYKHQT1P3QiB fUyDsVZBI9oCPLuZ0GB1X0MGhis/LvR6GH5vX0k4Hhz3J3RMI1OEwuUiw5R0Ax1sNMlG DvhqxEub0fk4jQ3HYKoRRaSlD13+N5nLvp1vyKWMRMsJB9b9nBKkZtmxn4JBtdAv+usF ObBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=3uuD2rDmZMR5o563o/j+AVcXACMbYVEAjE9D//DDnJE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=FqEr+cmI/qDANbN1HGb5VckY/cyF3YcHEhl7rw8XCSwCVc3BTGS9la8LuZoFX56wIj ddrfE+Z41rRUGorXOFZeVepqKb1xxkEIJ1kx3UgjscWxsm8bdGoaQDLeYh/D/b4QKvJY tGhM9pa9vAN1/a1mWhACPTmXGs0ls8yDY8Ex4yb4TxKAcsTGry/ESRc0SaXkxB9o7jAJ VvMXvS4A4FGLDhBtUKnbASOEV7PTlGeehzWJNcZt375XLUGj9xLIAwUMu1A1MhM+0S0P G1EoJ17RiEW570F9TNcuEyhZcwOpn+mDL/wSYrTc68wNIOlWr3gxOyL2agP1njBCHgFV yVLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lWHlUw4H; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l4-20020ad44bc4000000b0065b1160dbb6si511893qvw.440.2023.10.16.23.19.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:19: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=lWHlUw4H; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNt-0003bB-HV; Tue, 17 Oct 2023 02:16:53 -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 1qsdNo-0003Pv-EP for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004kn-J3 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-57babef76deso2965011eaf.0 for ; Mon, 16 Oct 2023 23:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523401; x=1698128201; 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=3uuD2rDmZMR5o563o/j+AVcXACMbYVEAjE9D//DDnJE=; b=lWHlUw4HXfqJN+o7yroOatjkaAEj7T7CTVp9vCz0K9k0/92E+o0+5SvCnpDdL+VawA /TYHq1o7vrdaQDlNti5kwm0tP3ocMKu/hEehMEbAZLThSy6bLYpnmdaZMyasIg6aOfM4 p80l/DrcqA6tEvR4TciP6fiBIXbM2Wn4O6eSvKFt6yIGGFpqZb1m8Q80jatz2IIx5brL XSjAiRtZxSP3ewqNHEMy0qH0+Sv4uknZO50h7XXY16Wa+RRxD4YTHAtiABub1tTybD51 D2AMHHWoLEr95T8/91LoZOYPgNB8I63vRgsdrm9osACfJ3nCLkmvy6EVOc97f8ypl5Vh 3vVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523401; x=1698128201; 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=3uuD2rDmZMR5o563o/j+AVcXACMbYVEAjE9D//DDnJE=; b=qOmvwq7tU8bi/4UBvXbDIXhY1qLc9o2uQm3LXtsFDIYfMDbmPAczaQKRGkCe1X/tmH RcX/ijwD9Y7WK/bYTv4QxcRdFFvEepabGa/6/8qNE8CJBSETKfItnT3Q5xjXm8him66A t8XXnQ+NCAFni8dftEohsRKQqAVU4g1VLLMszYHDhmPlpTB0F2Ly8IYJ6r/4pFnafFQE h+ytU86lAFmsFvOtLyXEEjOm5ZVRyhI57m7sal9N1petjIKqMBFR3KmWC48Ez9z/IEMq JgcgkTWaoAXfv6iVQkgX6UgapwZJlPNZnAgiMU9wihU4Hh1m5rUPecisHBWjoGQyihuO MbBA== X-Gm-Message-State: AOJu0YxhlW+mZq5gIrL1/a0vfdoJvpa8jDEMwXkAkIHnHiJQqRDNikJ5 v1e6XA9dDVW5c8v0pTvB4t95V0COw2Nvd/E9ots= X-Received: by 2002:a05:6358:44e:b0:14c:e2d3:fb2e with SMTP id 14-20020a056358044e00b0014ce2d3fb2emr1636879rwe.0.1697523401091; Mon, 16 Oct 2023 23:16:41 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 65/90] target/sparc: Use tcg_gen_vec_{add,sub}* Date: Mon, 16 Oct 2023 23:12:19 -0700 Message-Id: <20231017061244.681584-66-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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 Replace the local helpers for the same integer operations. Signed-off-by: Richard Henderson --- target/sparc/helper.h | 12 -------- target/sparc/translate.c | 15 +++++----- target/sparc/vis_helper.c | 59 --------------------------------------- 3 files changed, 7 insertions(+), 79 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index 790752467f..dd1721a340 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -137,18 +137,6 @@ DEF_HELPER_FLAGS_2(fpack16, TCG_CALL_NO_RWG_SE, i32, i64, i64) DEF_HELPER_FLAGS_3(fpack32, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) DEF_HELPER_FLAGS_2(fpackfix, TCG_CALL_NO_RWG_SE, i32, i64, i64) DEF_HELPER_FLAGS_3(bshuffle, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) -#define VIS_HELPER(name) \ - DEF_HELPER_FLAGS_2(f ## name ## 16, TCG_CALL_NO_RWG_SE, \ - i64, i64, i64) \ - DEF_HELPER_FLAGS_2(f ## name ## 16s, TCG_CALL_NO_RWG_SE, \ - i32, i32, i32) \ - DEF_HELPER_FLAGS_2(f ## name ## 32, TCG_CALL_NO_RWG_SE, \ - i64, i64, i64) \ - DEF_HELPER_FLAGS_2(f ## name ## 32s, TCG_CALL_NO_RWG_SE, \ - i32, i32, i32) - -VIS_HELPER(padd) -VIS_HELPER(psub) #define VIS_CMPHELPER(name) \ DEF_HELPER_FLAGS_2(f##name##16, TCG_CALL_NO_RWG_SE, \ i64, i64, i64) \ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index c92b080b8f..d13980165b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -25,9 +25,8 @@ #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" - +#include "tcg/tcg-op-gvec.h" #include "exec/helper-gen.h" - #include "exec/translator.h" #include "exec/log.h" #include "asi.h" @@ -5439,15 +5438,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; case 0x050: /* VIS I fpadd16 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpadd16); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add16_i64); break; case 0x051: /* VIS I fpadd16s */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, gen_helper_fpadd16s); + gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_add16_i32); break; case 0x052: /* VIS I fpadd32 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpadd32); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; case 0x053: /* VIS I fpadd32s */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5455,15 +5454,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; case 0x054: /* VIS I fpsub16 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpsub16); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i64); break; case 0x055: /* VIS I fpsub16s */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, gen_helper_fpsub16s); + gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i32); break; case 0x056: /* VIS I fpsub32 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpsub32); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; case 0x057: /* VIS I fpsub32s */ CHECK_FPU_FEATURE(dc, VIS1); diff --git a/target/sparc/vis_helper.c b/target/sparc/vis_helper.c index 3afdc6975c..7763b16c24 100644 --- a/target/sparc/vis_helper.c +++ b/target/sparc/vis_helper.c @@ -275,65 +275,6 @@ uint64_t helper_fexpand(uint64_t src1, uint64_t src2) return d.ll; } -#define VIS_HELPER(name, F) \ - uint64_t name##16(uint64_t src1, uint64_t src2) \ - { \ - VIS64 s, d; \ - \ - s.ll = src1; \ - d.ll = src2; \ - \ - d.VIS_W64(0) = F(d.VIS_W64(0), s.VIS_W64(0)); \ - d.VIS_W64(1) = F(d.VIS_W64(1), s.VIS_W64(1)); \ - d.VIS_W64(2) = F(d.VIS_W64(2), s.VIS_W64(2)); \ - d.VIS_W64(3) = F(d.VIS_W64(3), s.VIS_W64(3)); \ - \ - return d.ll; \ - } \ - \ - uint32_t name##16s(uint32_t src1, uint32_t src2) \ - { \ - VIS32 s, d; \ - \ - s.l = src1; \ - d.l = src2; \ - \ - d.VIS_W32(0) = F(d.VIS_W32(0), s.VIS_W32(0)); \ - d.VIS_W32(1) = F(d.VIS_W32(1), s.VIS_W32(1)); \ - \ - return d.l; \ - } \ - \ - uint64_t name##32(uint64_t src1, uint64_t src2) \ - { \ - VIS64 s, d; \ - \ - s.ll = src1; \ - d.ll = src2; \ - \ - d.VIS_L64(0) = F(d.VIS_L64(0), s.VIS_L64(0)); \ - d.VIS_L64(1) = F(d.VIS_L64(1), s.VIS_L64(1)); \ - \ - return d.ll; \ - } \ - \ - uint32_t name##32s(uint32_t src1, uint32_t src2) \ - { \ - VIS32 s, d; \ - \ - s.l = src1; \ - d.l = src2; \ - \ - d.l = F(d.l, s.l); \ - \ - return d.l; \ - } - -#define FADD(a, b) ((a) + (b)) -#define FSUB(a, b) ((a) - (b)) -VIS_HELPER(helper_fpadd, FADD) -VIS_HELPER(helper_fpsub, FSUB) - #define VIS_CMPHELPER(name, F) \ uint64_t name##16(uint64_t src1, uint64_t src2) \ { \ From patchwork Tue Oct 17 06:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734329 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326483wro; Mon, 16 Oct 2023 23:28:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqQeN7sX4CFfQIr0kEkDXSh2yBnZUOPoupdYAb1mWycuDp/vlL7XCiVs3ZgQZ4QW0eF/KJ X-Received: by 2002:a05:622a:1b8d:b0:417:914a:104d with SMTP id bp13-20020a05622a1b8d00b00417914a104dmr1867658qtb.49.1697524097099; Mon, 16 Oct 2023 23:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524097; cv=none; d=google.com; s=arc-20160816; b=d6/BP2OSZkoEHa2eoiizoQ+UmueYwJ1hYk+5wNnq66Oxp7Fbq42ZcmLUQm0wT7Lk5+ Kh0t5WGdgp8m4+yFekGMc15qMNwOBgKOiby2KbL8at0zP3FaGsjK7KN9VCHZHKdLzPhL DMSn59OjvygdPEiYO2V3D2agumsv6m6e6ZOHTo8Tjsdujydxsa2T5ySgzA2yphi7DLse Mi+HCdQNmfci/DKI+x07lnq3LNONc8F9L38+O4wwzmxsaSZ913Ohp995y+K2gxm2CpP8 eAJFy7MSRQoddMp2CYHhbrfdzXWevg+aACMrYb7oTu2sTd9MUjgH6DFT8N47hW5ynq4S ydJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=kdKI39jTB75U33OO0cwkda+9TcuPl5vM+6GokChRsRM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ZReRLrlBs5c9zU9CAmK9O//x+bFwgtKN6UaduniRkRPGAr7CPWL28GYeBnExujtXIN 07TcfV11knRA6fRGkqfH2j52akhfYZdRRr7jdi++QB6zFXOT29J3OAVf88erWarVgJSG t0RDPcYNQbi8MwfRUc6lQZbmBzj1KukY6Kkxucj6NXyHfdax1N0DMjXDn0iUTH0k1Lls GBn88IMEtMjvIfNq/9I7qE59XFhq96zZt/KwURKyPeNVfeeXg/kU4QpRB61AzWRh71f8 k2NJIk9cnrfKJzK/4lXrvYhZEaERwd1n31cnRsV+ECubutmB0yw3dSZqU1uMpc1YHhVQ j+YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NYSarp5J; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c7-20020ac85a87000000b0041986ea11a9si653581qtc.318.2023.10.16.23.28.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:17 -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=NYSarp5J; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNs-0003Vf-96; Tue, 17 Oct 2023 02:16:52 -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 1qsdNo-0003Qz-Qc for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004ky-Ie for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6b5af4662b7so2684523b3a.3 for ; Mon, 16 Oct 2023 23:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523402; x=1698128202; 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=kdKI39jTB75U33OO0cwkda+9TcuPl5vM+6GokChRsRM=; b=NYSarp5JeT7HTtRzfZVG4TEkII/Gt7HA6sGEtX+NhRrS+H80dOJ78ENPBa4U+02y4F C0kB4Fm1k5AAY1W9Qw1ROONkopublYmyjDI40w0VhSzDZrBq3StFgAtOsYrCorPSdGR/ yo8OH+Eew162wHY50l6wLJXQtOEhn5kNKguw+5W1AWjzdSRbQ1QwYCnR4f1fAsBonIFe wQEkoMdq2eyMYsUZ0kRZACfy/P6K+6OU+i0UIno+dGPGjWFGifB9+z6wDOaPOsbynpTa oYX0n7XnB/13HiknDNpmSofdPfI5kxGXsnZhd33B5c9USSh3TYly9DtQ1jCAkm2L12Fu XxvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523402; x=1698128202; 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=kdKI39jTB75U33OO0cwkda+9TcuPl5vM+6GokChRsRM=; b=d0n0P9ALzgN77/OmKDUOKMy3euZY8Sr+py6TgEA2sBRD5OGW8E+audYdML7QlgAVGf 7Zl96lx0zYdVEPy82n82Fs00sQr18FiZRPk/zGoylEsJLFuw4gJt06vxH1TOKZ9ZPDVb lCNnQ/LHXnGVPe+PFh6umizpJ5M/+xnsCc+eD7cE5r0MEpKNKoIslbSJDevIV/kpHn/3 6Z5lscYYUcJW/6SEWXGUVb76+e8z0gp0FEcIjhIMJOvCWBkRbC4YukORlJEbMmWyWpKh yszvmzn2CLBqriKkU+yQEuyc6O9rpXSTn1d394gFGvEG1YI3QVhNhStXZ5O7ZaSDzmxf GDXw== X-Gm-Message-State: AOJu0YxFaQbQ7r9Gp33uZKqyG2vXOxxdtDkPHtH01CklU8+1ZFmkzWqP El8KmISdYN3NqsLHEujaN2aqW2SZ7KmFqSVx7SE= X-Received: by 2002:a05:6a00:17a8:b0:6b8:69fa:8ff with SMTP id s40-20020a056a0017a800b006b869fa08ffmr1430135pfg.17.1697523401784; Mon, 16 Oct 2023 23:16:41 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 66/90] target/sparc: Move gen_ne_fop_FFF insns to decodetree Date: Mon, 16 Oct 2023 23:12:20 -0700 Message-Id: <20231017061244.681584-67-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 Move FANDNOT1s, FANDNOT2s, FANDs, FNANDs, FNORs, FORNOT1s, FORNOT2s, FORs, FPADD16s, FPADD32s, FPSUB16s, FPSUB32s, FXNORs, FXORs. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 16 ++++++ target/sparc/translate.c | 116 ++++++++++++++------------------------ 2 files changed, 59 insertions(+), 73 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 91988e2978..d0301c929c 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -32,6 +32,7 @@ CALL 01 i:s30 &r_r_r rd rs1 rs2 @r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r +@r_r_r_swap .. rd:5 ...... rs2:5 . ........ rs1:5 &r_r_r &r_r rd rs @r_r1 .. rd:5 ...... rs:5 . ........ ..... &r_r @@ -270,6 +271,21 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s + + FPADD16s 10 ..... 110110 ..... 0 0101 0001 ..... @r_r_r + FPADD32s 10 ..... 110110 ..... 0 0101 0011 ..... @r_r_r + FPSUB16s 10 ..... 110110 ..... 0 0101 0101 ..... @r_r_r + FPSUB32s 10 ..... 110110 ..... 0 0101 0111 ..... @r_r_r + FNORs 10 ..... 110110 ..... 0 0110 0011 ..... @r_r_r + FANDNOTs 10 ..... 110110 ..... 0 0110 0101 ..... @r_r_r # FANDNOT2s + FANDNOTs 10 ..... 110110 ..... 0 0110 1001 ..... @r_r_r_swap # ... 1s + FXORs 10 ..... 110110 ..... 0 0110 1101 ..... @r_r_r + FNANDs 10 ..... 110110 ..... 0 0110 1111 ..... @r_r_r + FANDs 10 ..... 110110 ..... 0 0111 0001 ..... @r_r_r + FXNORs 10 ..... 110110 ..... 0 0111 0011 ..... @r_r_r + FORNOTs 10 ..... 110110 ..... 0 0111 0111 ..... @r_r_r # FORNOT2s + FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s + FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index d13980165b..6f4406dbb3 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1582,22 +1582,6 @@ static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_F(dc, rd, dst); } -#ifdef TARGET_SPARC64 -static void gen_ne_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i32, TCGv_i32, TCGv_i32)) -{ - TCGv_i32 dst, src1, src2; - - src1 = gen_load_fpr_F(dc, rs1); - src2 = gen_load_fpr_F(dc, rs2); - dst = gen_dest_fpr_F(dc); - - gen(dst, src1, src2); - - gen_store_fpr_F(dc, rd, dst); -} -#endif - static void gen_fop_DD(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64)) { @@ -4941,6 +4925,35 @@ TRANS(FABSd, 64, do_dd, a, gen_op_fabsd) TRANS(FSRCd, VIS1, do_dd, a, tcg_gen_mov_i64) TRANS(FNOTd, VIS1, do_dd, a, tcg_gen_not_i64) +static bool do_fff(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) +{ + TCGv_i32 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + func(src1, src1, src2); + gen_store_fpr_F(dc, a->rd, src1); + return advance_pc(dc); +} + +TRANS(FPADD16s, VIS1, do_fff, a, tcg_gen_vec_add16_i32) +TRANS(FPADD32s, VIS1, do_fff, a, tcg_gen_add_i32) +TRANS(FPSUB16s, VIS1, do_fff, a, tcg_gen_vec_sub16_i32) +TRANS(FPSUB32s, VIS1, do_fff, a, tcg_gen_sub_i32) +TRANS(FNORs, VIS1, do_fff, a, tcg_gen_nor_i32) +TRANS(FANDNOTs, VIS1, do_fff, a, tcg_gen_andc_i32) +TRANS(FXORs, VIS1, do_fff, a, tcg_gen_xor_i32) +TRANS(FNANDs, VIS1, do_fff, a, tcg_gen_nand_i32) +TRANS(FANDs, VIS1, do_fff, a, tcg_gen_and_i32) +TRANS(FXNORs, VIS1, do_fff, a, tcg_gen_eqv_i32) +TRANS(FORNOTs, VIS1, do_fff, a, tcg_gen_orc_i32) +TRANS(FORs, VIS1, do_fff, a, tcg_gen_or_i32) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5313,6 +5326,20 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x06a: /* VIS I fnot1 */ case 0x074: /* VIS I fsrc1 */ case 0x078: /* VIS I fsrc2 */ + case 0x051: /* VIS I fpadd16s */ + case 0x053: /* VIS I fpadd32s */ + case 0x055: /* VIS I fpsub16s */ + case 0x057: /* VIS I fpsub32s */ + case 0x063: /* VIS I fnors */ + case 0x065: /* VIS I fandnot2s */ + case 0x069: /* VIS I fandnot1s */ + case 0x06d: /* VIS I fxors */ + case 0x06f: /* VIS I fnands */ + case 0x071: /* VIS I fands */ + case 0x073: /* VIS I fxnors */ + case 0x077: /* VIS I fornot2s */ + case 0x07b: /* VIS I fornot1s */ + case 0x07d: /* VIS I fors */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5440,34 +5467,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add16_i64); break; - case 0x051: /* VIS I fpadd16s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_add16_i32); - break; case 0x052: /* VIS I fpadd32 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; - case 0x053: /* VIS I fpadd32s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_add_i32); - break; case 0x054: /* VIS I fpsub16 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i64); break; - case 0x055: /* VIS I fpsub16s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i32); - break; case 0x056: /* VIS I fpsub32 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; - case 0x057: /* VIS I fpsub32s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_sub_i32); - break; case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); @@ -5484,83 +5495,42 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nor_i64); break; - case 0x063: /* VIS I fnors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_nor_i32); - break; case 0x064: /* VIS I fandnot2 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_andc_i64); break; - case 0x065: /* VIS I fandnot2s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_andc_i32); - break; case 0x068: /* VIS I fandnot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); break; - case 0x069: /* VIS I fandnot1s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_andc_i32); - break; case 0x06c: /* VIS I fxor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); break; - case 0x06d: /* VIS I fxors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_xor_i32); - break; case 0x06e: /* VIS I fnand */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nand_i64); break; - case 0x06f: /* VIS I fnands */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_nand_i32); - break; case 0x070: /* VIS I fand */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_and_i64); break; - case 0x071: /* VIS I fands */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_and_i32); - break; case 0x072: /* VIS I fxnor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_eqv_i64); break; - case 0x073: /* VIS I fxnors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_eqv_i32); - break; - break; case 0x076: /* VIS I fornot2 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64); break; - case 0x077: /* VIS I fornot2s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_orc_i32); - break; case 0x07a: /* VIS I fornot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); break; - case 0x07b: /* VIS I fornot1s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_orc_i32); - break; case 0x07c: /* VIS I for */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_or_i64); break; - case 0x07d: /* VIS I fors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_or_i32); - break; case 0x07e: /* VIS I fone */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Tue Oct 17 06:12:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734334 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326679wro; Mon, 16 Oct 2023 23:28:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0b6OIPC7E35DC71x06mvpaU/C9Y154U/ote0sqqI78cUAcN8rcWHBKqAob627C0QdGYYm X-Received: by 2002:ac8:5ac7:0:b0:412:22f5:fe00 with SMTP id d7-20020ac85ac7000000b0041222f5fe00mr1391987qtd.2.1697524138371; Mon, 16 Oct 2023 23:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524138; cv=none; d=google.com; s=arc-20160816; b=GTb8wLNVZQZaty0uVHFQgigoWYGZRcxGB38C+VTyBkFMXEINXfN0YtMF+GW2rRcG1S qGhqmFxfKZo7dL946StVJ5sBPkZofYS+p60ztOPIMuj/nbrvlOdKBYsUjrgIlsxdDJmi Di3i2+w7Lv9y/bSFBRoUIhgrzVLa3SfZhovSh37Zx5oymPlvLa0NQcLvMfyOIiZGM1yV yguAlALX8gL/j/1X9g32tBzYlwVn3M3HGpQGYuk+OfcPX8EiXDen1vz3oDmExPRXeQoQ qJKSzkDP+8UjUap+3T5GA64clCUYDY4cXqpRq7htgDhhqO9PGkkeqnxQrAxOeU2Dvqja o0cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=P9JeLnNVkO4TVO+kQ8SrqtHBZ0+FG7vMsqRzC5Zm66I=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=lmSUVlFFfVJnf5ArFvcy6LuNkv/UaCQtXEo6OrYQ3DIg3dEQvv+rCsZovnd1bw3vSZ rOxgHsGtgI7dQROV2MyKPJE4ietVrX0QtR+4eh5VTG7QTKDC2B17fKMqSlaUwlFFvavw nAaT7ki3P8RENmawrBmrgHK5cxloT3VykJNLL7MRUGmTxQ+Fickwa3+/+HAlIG1Tj+G1 8g4nhOgCoSIU6MHtJNodYPUu3mbR2tGgtYxNtqsOSFRhRyVRwkv59uwVSSQDQkWUF7WL F/CZl4vh2XP5LbMGONcSH+mZqQVl4T2pS4V59LJZ+816rMUk8rpBuaX8f62YXS1Dvt8B oT+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=owarlkA7; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y16-20020a05622a165000b0040775a0c914si681102qtj.203.2023.10.16.23.28.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:58 -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=owarlkA7; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNv-0003gv-6x; Tue, 17 Oct 2023 02:16:55 -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 1qsdNp-0003S9-8L for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:49 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNj-0004mS-W4 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:49 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso2371132b3a.1 for ; Mon, 16 Oct 2023 23:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523402; x=1698128202; 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=P9JeLnNVkO4TVO+kQ8SrqtHBZ0+FG7vMsqRzC5Zm66I=; b=owarlkA7BMcKLOnzoWuf3NB3X8Ef2b5RoL/CjAx6TgT/OEm32DqmLQRvnjv1WK9rsr +0ta+1TblfR6kqSi4lbSX3c69gLeAytnqRfF7/KbJOH2KYrPMSni4Jo9JWLfIIshdflP /eZuxVXBmQPe+PliA5n4nFftvVBinjm8XqIemWGFubuAX0RSlZqQveTkbd9V8R/Rpjfk 7A/b0ZHe8x/thiVhNw+euxb2+mnv5E9/UvRpGuHYuvza8PFLSacOkY4MQdbfY7wlPZ5p Iwq7A6T7wt5FyX6VApNhg814JfXcLwMYcRKRoCeOGAl3NnBZ3UCXdYSt58TPjbnF1qlO P3Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523402; x=1698128202; 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=P9JeLnNVkO4TVO+kQ8SrqtHBZ0+FG7vMsqRzC5Zm66I=; b=XsqRXkznGLmjB3NFigQkQVvB0LdSoeUsj0khSI6cGeYavTJp6x8nrzxD5d0Os/PYmj iFQ/5AqR1BHQ+YrWhDc0Q43zbH84iJ/Stt4tFj9hTB3q1CGUmXRRZ9BJKm57j0JSQ/k0 EgCYrEq8vR0buILtrKwB4HjQgcYJBDwoXYyhfzzmToF+6v6lT3WdSknsZotPS1PLY1Vt hPRqkT7IaK1gDHmKo7Po1sADLP8maOugNEnAJjQm6QTKrwDVKkzO0hl7jufBFiKHue8P cRjZbYZ0VIeMAwEgjP4QysoN8YPVudNACqNHe4jkSpB2z1+NCM4EWfBsMSyt4PEVPa1q e2rw== X-Gm-Message-State: AOJu0YxG7iyX5odzZe75COVKGc6D5uJAgqW7cFMt8WlTZXYV1eBQASZB bC7u9T/m1FyFTt0/C7qZt2xWXb3fynpsR3mnTF0= X-Received: by 2002:a05:6a00:13a1:b0:6b3:80f8:7e91 with SMTP id t33-20020a056a0013a100b006b380f87e91mr1716543pfg.9.1697523402521; Mon, 16 Oct 2023 23:16:42 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 67/90] target/sparc: Move gen_ne_fop_DDD insns to decodetree Date: Mon, 16 Oct 2023 23:12:21 -0700 Message-Id: <20231017061244.681584-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Move FMUL8x16, FMUL8x16AU, FMUL8x16AL, FMUL8SUx16, FMUL8ULx16, FMULD8SUx16, FMULD8ULx16, FPMERGE, FEXPAND, FANDNOT1d, FANDNOT2d, FANDd, FNANDd, FNORd, FORNOT1d, FORNOT2d, FORd, FPADD16d, FPADD32d, FPSUB16d, FPSUB32d, FXNORd, FXORd. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 26 ++++++ target/sparc/translate.c | 178 +++++++++++++++----------------------- 2 files changed, 98 insertions(+), 106 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d0301c929c..197d6a0db3 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -263,6 +263,17 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FMUL8x16 10 ..... 110110 ..... 0 0011 0001 ..... @r_r_r + FMUL8x16AU 10 ..... 110110 ..... 0 0011 0011 ..... @r_r_r + FMUL8x16AL 10 ..... 110110 ..... 0 0011 0101 ..... @r_r_r + FMUL8SUx16 10 ..... 110110 ..... 0 0011 0110 ..... @r_r_r + FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r + FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r + FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + + FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r + FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r + FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s FSRCd 10 ..... 110110 00000 0 0111 1000 ..... @r_r2 # FSRC2d @@ -272,19 +283,34 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s + FPADD16 10 ..... 110110 ..... 0 0101 0000 ..... @r_r_r FPADD16s 10 ..... 110110 ..... 0 0101 0001 ..... @r_r_r + FPADD32 10 ..... 110110 ..... 0 0101 0010 ..... @r_r_r FPADD32s 10 ..... 110110 ..... 0 0101 0011 ..... @r_r_r + FPSUB16 10 ..... 110110 ..... 0 0101 0100 ..... @r_r_r FPSUB16s 10 ..... 110110 ..... 0 0101 0101 ..... @r_r_r + FPSUB32 10 ..... 110110 ..... 0 0101 0110 ..... @r_r_r FPSUB32s 10 ..... 110110 ..... 0 0101 0111 ..... @r_r_r + + FNORd 10 ..... 110110 ..... 0 0110 0010 ..... @r_r_r FNORs 10 ..... 110110 ..... 0 0110 0011 ..... @r_r_r + FANDNOTd 10 ..... 110110 ..... 0 0110 0100 ..... @r_r_r # FANDNOT2d FANDNOTs 10 ..... 110110 ..... 0 0110 0101 ..... @r_r_r # FANDNOT2s + FANDNOTd 10 ..... 110110 ..... 0 0110 1000 ..... @r_r_r_swap # ... 1d FANDNOTs 10 ..... 110110 ..... 0 0110 1001 ..... @r_r_r_swap # ... 1s + FXORd 10 ..... 110110 ..... 0 0110 1100 ..... @r_r_r FXORs 10 ..... 110110 ..... 0 0110 1101 ..... @r_r_r + FNANDd 10 ..... 110110 ..... 0 0110 1110 ..... @r_r_r FNANDs 10 ..... 110110 ..... 0 0110 1111 ..... @r_r_r + FANDd 10 ..... 110110 ..... 0 0111 0000 ..... @r_r_r FANDs 10 ..... 110110 ..... 0 0111 0001 ..... @r_r_r + FXNORd 10 ..... 110110 ..... 0 0111 0010 ..... @r_r_r FXNORs 10 ..... 110110 ..... 0 0111 0011 ..... @r_r_r + FORNOTd 10 ..... 110110 ..... 0 0111 0110 ..... @r_r_r # FORNOT2d FORNOTs 10 ..... 110110 ..... 0 0111 0111 ..... @r_r_r # FORNOT2s + FORNOTd 10 ..... 110110 ..... 0 0111 1010 ..... @r_r_r_swap # ... 1d FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s + FORd 10 ..... 110110 ..... 0 0111 1100 ..... @r_r_r FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6f4406dbb3..a5901164f3 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -59,6 +59,15 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() +#define gen_helper_fmul8x16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8x16au ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8x16al ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8sux16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8ulx16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmuld8sux16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmuld8ulx16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -1612,20 +1621,6 @@ static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, } #ifdef TARGET_SPARC64 -static void gen_ne_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, src1, src2); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_gsr_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -4954,6 +4949,46 @@ TRANS(FXNORs, VIS1, do_fff, a, tcg_gen_eqv_i32) TRANS(FORNOTs, VIS1, do_fff, a, tcg_gen_orc_i32) TRANS(FORs, VIS1, do_fff, a, tcg_gen_or_i32) +static bool do_ddd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_D(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, src1, src2); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FMUL8x16, VIS1, do_ddd, a, gen_helper_fmul8x16) +TRANS(FMUL8x16AU, VIS1, do_ddd, a, gen_helper_fmul8x16au) +TRANS(FMUL8x16AL, VIS1, do_ddd, a, gen_helper_fmul8x16al) +TRANS(FMUL8SUx16, VIS1, do_ddd, a, gen_helper_fmul8sux16) +TRANS(FMUL8ULx16, VIS1, do_ddd, a, gen_helper_fmul8ulx16) +TRANS(FMULD8SUx16, VIS1, do_ddd, a, gen_helper_fmuld8sux16) +TRANS(FMULD8ULx16, VIS1, do_ddd, a, gen_helper_fmuld8ulx16) +TRANS(FPMERGE, VIS1, do_ddd, a, gen_helper_fpmerge) +TRANS(FEXPAND, VIS1, do_ddd, a, gen_helper_fexpand) + +TRANS(FPADD16, VIS1, do_ddd, a, tcg_gen_vec_add16_i64) +TRANS(FPADD32, VIS1, do_ddd, a, tcg_gen_vec_add32_i64) +TRANS(FPSUB16, VIS1, do_ddd, a, tcg_gen_vec_sub16_i64) +TRANS(FPSUB32, VIS1, do_ddd, a, tcg_gen_vec_sub32_i64) +TRANS(FNORd, VIS1, do_ddd, a, tcg_gen_nor_i64) +TRANS(FANDNOTd, VIS1, do_ddd, a, tcg_gen_andc_i64) +TRANS(FXORd, VIS1, do_ddd, a, tcg_gen_xor_i64) +TRANS(FNANDd, VIS1, do_ddd, a, tcg_gen_nand_i64) +TRANS(FANDd, VIS1, do_ddd, a, tcg_gen_and_i64) +TRANS(FXNORd, VIS1, do_ddd, a, tcg_gen_eqv_i64) +TRANS(FORNOTd, VIS1, do_ddd, a, tcg_gen_orc_i64) +TRANS(FORd, VIS1, do_ddd, a, tcg_gen_or_i64) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5340,6 +5375,29 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x077: /* VIS I fornot2s */ case 0x07b: /* VIS I fornot1s */ case 0x07d: /* VIS I fors */ + case 0x050: /* VIS I fpadd16 */ + case 0x052: /* VIS I fpadd32 */ + case 0x054: /* VIS I fpsub16 */ + case 0x056: /* VIS I fpsub32 */ + case 0x062: /* VIS I fnor */ + case 0x064: /* VIS I fandnot2 */ + case 0x068: /* VIS I fandnot1 */ + case 0x06c: /* VIS I fxor */ + case 0x06e: /* VIS I fnand */ + case 0x070: /* VIS I fand */ + case 0x072: /* VIS I fxnor */ + case 0x076: /* VIS I fornot2 */ + case 0x07a: /* VIS I fornot1 */ + case 0x07c: /* VIS I for */ + case 0x031: /* VIS I fmul8x16 */ + case 0x033: /* VIS I fmul8x16au */ + case 0x035: /* VIS I fmul8x16al */ + case 0x036: /* VIS I fmul8sux16 */ + case 0x037: /* VIS I fmul8ulx16 */ + case 0x038: /* VIS I fmuld8sux16 */ + case 0x039: /* VIS I fmuld8ulx16 */ + case 0x04b: /* VIS I fpmerge */ + case 0x04d: /* VIS I fexpand */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5397,34 +5455,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64); gen_store_gpr(dc, rd, cpu_dst); break; - case 0x031: /* VIS I fmul8x16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16); - break; - case 0x033: /* VIS I fmul8x16au */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16au); - break; - case 0x035: /* VIS I fmul8x16al */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16al); - break; - case 0x036: /* VIS I fmul8sux16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8sux16); - break; - case 0x037: /* VIS I fmul8ulx16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8ulx16); - break; - case 0x038: /* VIS I fmuld8sux16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld8sux16); - break; - case 0x039: /* VIS I fmuld8ulx16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld8ulx16); - break; case 0x03a: /* VIS I fpack32 */ CHECK_FPU_FEATURE(dc, VIS1); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpack32); @@ -5451,34 +5481,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata); break; - case 0x04b: /* VIS I fpmerge */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpmerge); - break; case 0x04c: /* VIS II bshuffle */ CHECK_FPU_FEATURE(dc, VIS2); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_bshuffle); break; - case 0x04d: /* VIS I fexpand */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fexpand); - break; - case 0x050: /* VIS I fpadd16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add16_i64); - break; - case 0x052: /* VIS I fpadd32 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); - break; - case 0x054: /* VIS I fpsub16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i64); - break; - case 0x056: /* VIS I fpsub32 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); - break; case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); @@ -5491,46 +5497,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) tcg_gen_movi_i32(cpu_dst_32, 0); gen_store_fpr_F(dc, rd, cpu_dst_32); break; - case 0x062: /* VIS I fnor */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nor_i64); - break; - case 0x064: /* VIS I fandnot2 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_andc_i64); - break; - case 0x068: /* VIS I fandnot1 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); - break; - case 0x06c: /* VIS I fxor */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); - break; - case 0x06e: /* VIS I fnand */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nand_i64); - break; - case 0x070: /* VIS I fand */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_and_i64); - break; - case 0x072: /* VIS I fxnor */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_eqv_i64); - break; - case 0x076: /* VIS I fornot2 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64); - break; - case 0x07a: /* VIS I fornot1 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); - break; - case 0x07c: /* VIS I for */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_or_i64); - break; case 0x07e: /* VIS I fone */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Tue Oct 17 06:12:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734309 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324857wro; Mon, 16 Oct 2023 23:23:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvlRJ+w8x76ETcTD5BHBxhaY9ZZYWPQF6LsxL9/1HQszgHaQQXsEZlQKIbGzJkkaHeiOPf X-Received: by 2002:a05:6214:2243:b0:66d:3c5:1cdc with SMTP id c3-20020a056214224300b0066d03c51cdcmr2205263qvc.60.1697523790467; Mon, 16 Oct 2023 23:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523790; cv=none; d=google.com; s=arc-20160816; b=gQRG1cf/g++Ub1ZI7wm0OYk7WHdN7iTl7nwxlHCCiBwNDTEULopTUM7K5Pl4EOeQ7/ IaoTRro6ZTHu3UQTsAUyW/PKsL9Zr3Og9a5R9qtUTTmccKFOGJG8s6o7NrHC6calSuL3 mUj03QlzVpBwv3htZbfUhfKhjUPmxiEN4AV9/fSm7h1qY1xLUegUbH8E7i0XlAM11Uhj ZYrQmWVhUFw2WhHQdcFCEfy+mUo0hooyTTanGXfXzk86OjoCfxAi6XBe33k5IYrupz9F +7z6BgBEY3HPq6Rb4CMIalVnpzQVRbkS1XMMAiCoTPnO8rlEFcxmOjRJImkVxSkhEKHQ P/2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=pAFj8x/czFPdwn8DziPG6iUtUxhBh9W+l521ap6aJJU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=R7Hnw/CoTxWcGQeUrtfp1N7k0uC7K2n+OFSdnhXfEr3ExkGeruPfhyzpfozCftFi2j /xqbxy4ta0GIFp3Vx+oAg03dqsZeWUfoG2pPpFhyPmyKMY62nO0104c7rNRj3udBCsAs EXN67mmDxv8ZSvKbeBBpKhRfzlsQ4RayU+Qbj8hhiGJq8xeUTK67xwGb+m7U3o0Jyqdk obWvwNa3tRKIE+5ltmrt0iY7vq99zCAogNNMLlG+k0xHnogZnRliidC7bAceAGBkn1ia 1rBcEkxXsSMiO+TMD3zVe/Acjwq24ucsV449ujbbp97qd/eQrLKPfLi/v68z6hUvk+kA CqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xHST2L6g; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l4-20020ad44bc4000000b0066ceeacae81si521605qvw.536.2023.10.16.23.23.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:23:10 -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=xHST2L6g; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNv-0003hX-DR; Tue, 17 Oct 2023 02:16:55 -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 1qsdNo-0003RF-SS for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNk-0004mq-Ie for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:48 -0400 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-581cb88f645so345757eaf.1 for ; Mon, 16 Oct 2023 23:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523403; x=1698128203; 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=pAFj8x/czFPdwn8DziPG6iUtUxhBh9W+l521ap6aJJU=; b=xHST2L6g3q486PM4evGzyV2xgXdre8FGEHcZbsEnQOQSfq05cyA3ikGsv540kXugWj aiGGOtx48VfcS5fA+omKK3oqgRRUJnlxsAKM2lfcl3jfW5dKqx1L5QdWLADepsCj4PZO ZExJ4oSthBmWU62847uDNCNn0P1wVX0T9043iTQfzImOwfRUrJB3KJrJVjhTOKpOYq8x cgthwaIi2JS1CZV5XYcJBJnQOPO77nkdYkS8yTJHI5TkC7jOzVCeYb+9If6kg54ROdvM NEV8pyc1tmNKyKlTpcNwnw8K5ee8rX9GaRAEG5fJU0Qr9XGjgs3+Z7IKfdYeOgeIqbwR v7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523403; x=1698128203; 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=pAFj8x/czFPdwn8DziPG6iUtUxhBh9W+l521ap6aJJU=; b=iHuzKbJ53UeHhtGhM3QS6Mh96pkb76Bo9xMy1W1LT1d+QV/D1L0K1cpckAUlesbaDx IoAi4tV61uRTC2dLlfOdl2uRtuB0eyBqKvhOiMw48XeBC2GjfObC5vZH17CYDQHdFMJ5 VpOqLB607Ut3XKtAvSbLuLm54j05aA3kEl3Me2qyLSZyQqyGkXRwe0wiLgB+hZLo11VS pZhnOBmtJ5yt/kS5WVdRefqbUQ/U0fQL5pxk0k5VVp+zmeZTacczk4FjpZOO8DHEHMkM w5u5H3wOpaFlHvapBQWvCDKN+B0Vj/SPFjF2ghMi10fToeF0Act71/myXsaSyE5oBrpU QV1Q== X-Gm-Message-State: AOJu0YxXkCtHtho42yquwUuDZdoUrgsrPgXg3+pO9PwCp/XouTXGGV4Z lGJXeRXFk7jdVEXxFQZ/W/CcLO2kEmWQd/FGhqE= X-Received: by 2002:a05:6359:3107:b0:135:57d0:d171 with SMTP id rh7-20020a056359310700b0013557d0d171mr1500510rwb.15.1697523403311; Mon, 16 Oct 2023 23:16:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 68/90] target/sparc: Move PDIST to decodetree Date: Mon, 16 Oct 2023 23:12:22 -0700 Message-Id: <20231017061244.681584-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc33.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 41 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 197d6a0db3..64a7b3bd0b 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -270,6 +270,7 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a5901164f3..5d2c95841a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -68,6 +68,7 @@ #define gen_helper_fmuld8ulx16 ({ g_assert_not_reached(); NULL; }) #define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) #define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) +#define gen_helper_pdist ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -1634,21 +1635,6 @@ static void gen_gsr_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_D(dc, rd, dst); } - -static void gen_ne_fop_DDDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src0, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - src0 = gen_load_fpr_D(dc, rd); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, src0, src1, src2); - - gen_store_fpr_D(dc, rd, dst); -} #endif static void gen_fop_QQ(DisasContext *dc, int rd, int rs, @@ -4989,6 +4975,26 @@ TRANS(FXNORd, VIS1, do_ddd, a, tcg_gen_eqv_i64) TRANS(FORNOTd, VIS1, do_ddd, a, tcg_gen_orc_i64) TRANS(FORd, VIS1, do_ddd, a, tcg_gen_or_i64) +static bool do_dddd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src0, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_D(dc, a->rd); + src0 = gen_load_fpr_D(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, src0, src1, src2); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(PDIST, VIS1, do_dddd, a, gen_helper_pdist) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5398,6 +5404,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x039: /* VIS I fmuld8ulx16 */ case 0x04b: /* VIS I fpmerge */ case 0x04d: /* VIS I fexpand */ + case 0x03e: /* VIS I pdist */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5473,10 +5480,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64); gen_store_fpr_F(dc, rd, cpu_dst_32); break; - case 0x03e: /* VIS I pdist */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDDD(dc, rd, rs1, rs2, gen_helper_pdist); - break; case 0x048: /* VIS I faligndata */ CHECK_FPU_FEATURE(dc, VIS1); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata); From patchwork Tue Oct 17 06:12:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734280 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323610wro; Mon, 16 Oct 2023 23:18:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIlJLN5QqiI+fGRpTYWYiYauZqLU/MUYxR5/zxFg7pBU/y3wHhOnL5wEfxHReaMqsBmq7R X-Received: by 2002:a05:622a:14d3:b0:412:c81:eff3 with SMTP id u19-20020a05622a14d300b004120c81eff3mr1256154qtx.15.1697523523114; Mon, 16 Oct 2023 23:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523523; cv=none; d=google.com; s=arc-20160816; b=wbB6RwGDMtCHRt6ln9IlCs3kGQN8gZ7PGa0zb3PU5oxUzZIXbfFfOut9LyQ/I6ExjC hHtxdkYKiVUFwG1voofAzTdNw7TQGeXoYpMKv5uv1HEk42Hhb6uv+GXNGHhtrKNlbym5 CWKprHMT1J4/gq2astoQ+m9w2lyGRwmMa5yfQvFvRYUtM55hRErvtO1kVzQrV+Hd39va wJneKinUyFH7usBiBVeipT8joPQCF6OKEA45m0aKHrG8jmwOsauZXNMdNA+1S3imwLpz /wf0gmxOl4bv58rflgq1ZEhkrvKaSRYcI32+zfoDdd/1//Olnnj4WlXpFcn2h802EDzm I8tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=9xyXeBm1cZsKYG0Z/SfcuWUUM5g+8rh0rTjC5P/PaUs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=UveKkg0xl6uilVN8Kjie79KOw9rrwEGxN/ZwW/tB/8EilLhODUtuQSB0OMg5Y0aqgS yCZ3kz9CwIBkSH2/wv3BJh/vxAvER1xThdaA0TqpM7nHTbvesQRUc4feW+GeB0ZVSyX5 b/bbPCIGsS7JONfR9e2qQizUKt5tY0neAbvutOS41LkZvpy8N047kpB09wmK4/M3fQs/ U++wtfjEmOmviW3CLeZwnSTNd+dptxx8PMfg775z4PyO47iWkirkZW13B1rrk6oIsu5a p5Vrald3B9zRQj/P0t2avXSO5eVLtqu6ZPp5q5iuon7N0ZGSclfdzZiC3rCsH2S7SnMZ PX0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f2zwxP2J; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y6-20020ac85f46000000b00419930eb09dsi633923qta.740.2023.10.16.23.18.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:43 -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=f2zwxP2J; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdOF-000479-PP; Tue, 17 Oct 2023 02:17:15 -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 1qsdNr-0003Su-28 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:51 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNl-0004n3-HJ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:49 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b44befac59so2671185b3a.0 for ; Mon, 16 Oct 2023 23:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523404; x=1698128204; 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=9xyXeBm1cZsKYG0Z/SfcuWUUM5g+8rh0rTjC5P/PaUs=; b=f2zwxP2JaUTskqp5xiE/bVmm+xbRnYl/9hPEMdMp/YS0aMG6FVDOdn3nUZirql8DNS scqW66smTWixalgGRyFCMnMBtS0s8mWUFFPAEH7BTk+a76UzZV7aMhzrmnkqwBnfN75W bcRGs/DG2vJGomnZ0r3dBoKwkvrTdN97MnVI69limgo9YJ7QiL0hY7n9vdUvX5qlGH5P x2GpFmTVFb9FgeFKkleen8yew9X9qCMhJW9LCG7ed9rUUFmSPawQtpf79yKhFkQAX4wi IyIUDNd7llWlmAGfXT7qfeQZbIknkrw+fg/u0HTq1qJiX7hbyk/3oto/i0Ml2EMvjNBk v+xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523404; x=1698128204; 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=9xyXeBm1cZsKYG0Z/SfcuWUUM5g+8rh0rTjC5P/PaUs=; b=UFinBpIs+alm8TCpXS31Kiihj+HDuzFB6DtfylX7g75kxdnce6MET1cpNj05GWcxgN zGsFNk8Ra8DXK2jaACondpD3pvS6SF6n2m8hZN37ZaL5igjuMxTuTVeaSxL1i2gHXbQp y90EC39WYGjjgf46uLaXyzHpNKW4j9fTOG7xlr5Z1mGENuNqPwBiMIDyvbDLnvQobmXG qJ+TkrzfmmxNP3aFNqZrjBu9abfzKCsTrnlA20J8zqYOihJ5AujQWU6Z09skTLgTmUs7 2Ww3rgKu9ExsJSedEimUzVecwrZtHR87hQQml7o+NQxQKlr7gqvkcv64EZF0LzphdDX2 +H2w== X-Gm-Message-State: AOJu0YxIAhHdK9zBMyr7boL0yUqH7Upu5f3B7fkDuID6VsSSWcJ6UHFD AlMoI72gpPubkmLbbM7BOeg2nbTa1tqpqvjiyNo= X-Received: by 2002:a05:6a20:8e08:b0:15d:8366:65b8 with SMTP id y8-20020a056a208e0800b0015d836665b8mr1488825pzj.13.1697523404119; Mon, 16 Oct 2023 23:16:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 69/90] target/sparc: Move gen_gsr_fop_DDD insns to decodetree Date: Mon, 16 Oct 2023 23:12:23 -0700 Message-Id: <20231017061244.681584-70-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 Move FPACK32, FALIGNDATA, BSHUFFLE. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 101 ++++++++++++++++++++------------------ 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 64a7b3bd0b..966cda6680 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -270,9 +270,12 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + FPACK32 10 ..... 110110 ..... 0 0011 1010 ..... @r_r_r PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r + FALIGNDATAg 10 ..... 110110 ..... 0 0100 1000 ..... @r_r_r FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r + BSHUFFLE 10 ..... 110110 ..... 0 0100 1100 ..... @r_r_r FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5d2c95841a..cd585b77bc 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -706,6 +706,51 @@ static void gen_op_array32(TCGv dst, TCGv src1, TCGv src2) tcg_gen_shli_tl(dst, dst, 2); } +static void gen_op_fpack32(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) +{ +#ifdef TARGET_SPARC64 + gen_helper_fpack32(dst, cpu_gsr, src1, src2); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_faligndata(TCGv_i64 dst, TCGv_i64 s1, TCGv_i64 s2) +{ +#ifdef TARGET_SPARC64 + TCGv t1, t2, shift; + + t1 = tcg_temp_new(); + t2 = tcg_temp_new(); + shift = tcg_temp_new(); + + tcg_gen_andi_tl(shift, cpu_gsr, 7); + tcg_gen_shli_tl(shift, shift, 3); + tcg_gen_shl_tl(t1, s1, shift); + + /* + * A shift of 64 does not produce 0 in TCG. Divide this into a + * shift of (up to 63) followed by a constant shift of 1. + */ + tcg_gen_xori_tl(shift, shift, 63); + tcg_gen_shr_tl(t2, s2, shift); + tcg_gen_shri_tl(t2, t2, 1); + + tcg_gen_or_tl(dst, t1, t2); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_bshuffle(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) +{ +#ifdef TARGET_SPARC64 + gen_helper_bshuffle(dst, cpu_gsr, src1, src2); +#else + g_assert_not_reached(); +#endif +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -1621,22 +1666,6 @@ static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_D(dc, rd, dst); } -#ifdef TARGET_SPARC64 -static void gen_gsr_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, cpu_gsr, src1, src2); - - gen_store_fpr_D(dc, rd, dst); -} -#endif - static void gen_fop_QQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr)) { @@ -2658,27 +2687,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) tcg_gen_add_ptr(r_tsptr, r_tsptr, r_tl_tmp); } } - -static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) -{ - TCGv t1, t2, shift; - - t1 = tcg_temp_new(); - t2 = tcg_temp_new(); - shift = tcg_temp_new(); - - tcg_gen_andi_tl(shift, gsr, 7); - tcg_gen_shli_tl(shift, shift, 3); - tcg_gen_shl_tl(t1, s1, shift); - - /* A shift of 64 does not produce 0 in TCG. Divide this into a - shift of (up to 63) followed by a constant shift of 1. */ - tcg_gen_xori_tl(shift, shift, 63); - tcg_gen_shr_tl(t2, s2, shift); - tcg_gen_shri_tl(t2, t2, 1); - - tcg_gen_or_tl(dst, t1, t2); -} #endif static int extract_dfpreg(DisasContext *dc, int x) @@ -4975,6 +4983,10 @@ TRANS(FXNORd, VIS1, do_ddd, a, tcg_gen_eqv_i64) TRANS(FORNOTd, VIS1, do_ddd, a, tcg_gen_orc_i64) TRANS(FORd, VIS1, do_ddd, a, tcg_gen_or_i64) +TRANS(FPACK32, VIS1, do_ddd, a, gen_op_fpack32) +TRANS(FALIGNDATAg, VIS1, do_ddd, a, gen_op_faligndata) +TRANS(BSHUFFLE, VIS2, do_ddd, a, gen_op_bshuffle) + static bool do_dddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5405,6 +5417,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x04b: /* VIS I fpmerge */ case 0x04d: /* VIS I fexpand */ case 0x03e: /* VIS I pdist */ + case 0x03a: /* VIS I fpack32 */ + case 0x048: /* VIS I faligndata */ + case 0x04c: /* VIS II bshuffle */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5462,10 +5477,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64); gen_store_gpr(dc, rd, cpu_dst); break; - case 0x03a: /* VIS I fpack32 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpack32); - break; case 0x03b: /* VIS I fpack16 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1_64 = gen_load_fpr_D(dc, rs2); @@ -5480,14 +5491,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64); gen_store_fpr_F(dc, rd, cpu_dst_32); break; - case 0x048: /* VIS I faligndata */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata); - break; - case 0x04c: /* VIS II bshuffle */ - CHECK_FPU_FEATURE(dc, VIS2); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_bshuffle); - break; case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Tue Oct 17 06:12:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734327 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326322wro; Mon, 16 Oct 2023 23:27:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFA4GlPN2lBzJ6OdZo65IU0OHwjbCZSySrmmPmxAVAtssMc732/Z4T728TF/z70FossPjj X-Received: by 2002:a05:622a:1006:b0:417:b901:91a7 with SMTP id d6-20020a05622a100600b00417b90191a7mr2043724qte.24.1697524061481; Mon, 16 Oct 2023 23:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524061; cv=none; d=google.com; s=arc-20160816; b=tv7pJlCWFzww7tFASUeiLHq0JJB22AuKnl2ifu9jZXWOUCjv+2++00Z1iOXhmV/QmQ 8IBxKRGZY21VO5NqhckOp8twu3+VHB2sC0J8uH2zKNEmpz81RntA/brQy121MGcYk4XM dyGtm9EzA7nx6tKrf1FW+5ttRObMhiG9cqezTMgbwkQ0kziVyynKWQxrPp4wPWavisMR Ww3vRFBDv9FPxpeVFBS+t8bmyGJtrvzocqyQwnfKrCIYudng1X3IVHMm6ckNoBnmkVmp +IJibfL2vapMS15xGGwYET3htvIGuu1vyj4ZoBIMcPqUtf/EXEuuT7QT+7hyAQ2KDHb5 dN6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=fwVmSHeYexn71dvX+8E6usFelzw3up8bbDGmKt8+qZ4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ZrQXK6E4dyNR7RVBGwkvHbBPjAovJoDlxGuVDr5o/jvqlBILYF5kRxFnBAcjl6J2O8 8n1H0blx+Q/OVeIh+tRyqjIGyKKqMMRJcru/7Zbw8k3nlGCYMIGh1ETJgCKWzPfce0ss fcYG6qYbvz+8gPk0RnWi3IdQihrBJzcfY6KwTsrVJNjOj2eRcMvUWT4nzQ0eIFAcclvM M9Sd4jCUWQ3npOF5gxTA4IxGJu12iitOGp/LCTZn+YOmBAzm3Hwa8vh1vvHDm1di+oDo VzqfjNP5MF++ixBOCNGsUTjc6o8V5hcB61taez+4FtVr6zg3YCMHwAlG4TVvTvSpp1Xn q4sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dntQXuWF; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y3-20020a05622a004300b0041b7773ee44si684135qtw.443.2023.10.16.23.27.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:27: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=dntQXuWF; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNu-0003fD-UW; Tue, 17 Oct 2023 02:16:54 -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 1qsdNq-0003T9-8i for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:50 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNm-0004nR-Qo for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:49 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6be0277c05bso1395169b3a.0 for ; Mon, 16 Oct 2023 23:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523405; x=1698128205; 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=fwVmSHeYexn71dvX+8E6usFelzw3up8bbDGmKt8+qZ4=; b=dntQXuWFDPWlreCAU6lzkMjiFOCQVudOkHA4LIptVHuuAOqWVbqQU3jcG/G9V00yCM OW5nDihy9ja+iTibpw2whwxdik7gCGbXfCd1dw/hRetwN8LsXWAFbjtXttFizP68ymws DWIgQ7w+aj2bkt+8CHeWJ3U2DwEwa+Q1P0/qi/+CrmDf+jyzaD5CDkCe+Yw8dHhEnzrA HumxSsflnCLUg2v5lHNueX9ckHaaK5dxM3y70aWUI4g0YU8DF9BhzsXEXTW3H2sJgNI4 UJoHkE4W7qoP3GnxyyEMP3BcqTFbNbywcxzBKClA29wYfWVFzHRjMrhpV/ILzcEyvt3D t3Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523405; x=1698128205; 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=fwVmSHeYexn71dvX+8E6usFelzw3up8bbDGmKt8+qZ4=; b=hknqXpF+QPx9VsmKkleSBpwPFLxkDsUjBSYzhD9klZzzD8ZgDfUxCVlwKf4YBBnIJ2 EhOoqxuCZWwIStjErkLtETUypRWgu2FcANoRE4OS5EYfJJm07XKszZNubGEkU9tJM3dY /T+wv8Jw0F1AcXWQ8VQurps3QUc48r6ec7VBkBCrcbYrYGMo2gvTmMdcvIGbu8DXeap7 cSkBYiISsLkTFbgTBDLUpWc1ved1Za6zagnn+VzB767jP/i4uaSdTXEKd7/Fo3FN0ZUV Evd33nM/E64cv0KxNtBXN4pHbS5M4eHZs287jrtnFa1NPk60/9V8PIZCgtdtkcQtYb5H bIVg== X-Gm-Message-State: AOJu0Yy2wcxGUd5HpmCPmECRAa4Wk+j8dVVzsgM8eEr6xvni1mqRKIZR SnpMUUQXDBcjrz9hBB4oVTtCJbeQ3h7Sk6G7ZdE= X-Received: by 2002:a05:6a00:1827:b0:6be:2e07:5c5c with SMTP id y39-20020a056a00182700b006be2e075c5cmr1397372pfa.20.1697523405296; Mon, 16 Oct 2023 23:16:45 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 70/90] target/sparc: Move gen_fop_FF insns to decodetree Date: Mon, 16 Oct 2023 23:12:24 -0700 Message-Id: <20231017061244.681584-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 Move FSQRTs, FiTOs, FsTOi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 47 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 966cda6680..4f10809e98 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -238,6 +238,9 @@ FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 +FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 +FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 +FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cd585b77bc..6707164207 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1608,20 +1608,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_fop_FF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32)) -{ - TCGv_i32 dst, src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32)) { @@ -4892,6 +4878,27 @@ TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) +static bool do_env_ff(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_env, TCGv_i32)) +{ + TCGv_i32 tmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + tmp = gen_load_fpr_F(dc, a->rs); + func(tmp, tcg_env, tmp); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, tmp); + return advance_pc(dc); +} + +TRANS(FSQRTs, ALL, do_env_ff, a, gen_helper_fsqrts) +TRANS(FiTOs, ALL, do_env_ff, a, gen_helper_fitos) +TRANS(FsTOi, ALL, do_env_ff, a, gen_helper_fstoi) + static bool do_dd(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i64, TCGv_i64)) { @@ -5053,10 +5060,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x2: /* V9 fmovd */ case 0x6: /* V9 fnegd */ case 0xa: /* V9 fabsd */ - g_assert_not_reached(); /* in decodetree */ case 0x29: /* fsqrts */ - gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); - break; + case 0xc4: /* fitos */ + case 0xd1: /* fstoi */ + g_assert_not_reached(); /* in decodetree */ case 0x2a: /* fsqrtd */ gen_fop_DD(dc, rd, rs2, gen_helper_fsqrtd); break; @@ -5112,9 +5119,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QDD(dc, rd, rs1, rs2, gen_helper_fdmulq); break; - case 0xc4: /* fitos */ - gen_fop_FF(dc, rd, rs2, gen_helper_fitos); - break; case 0xc6: /* fdtos */ gen_fop_FD(dc, rd, rs2, gen_helper_fdtos); break; @@ -5144,9 +5148,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); break; - case 0xd1: /* fstoi */ - gen_fop_FF(dc, rd, rs2, gen_helper_fstoi); - break; case 0xd2: /* fdtoi */ gen_fop_FD(dc, rd, rs2, gen_helper_fdtoi); break; From patchwork Tue Oct 17 06:12:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734320 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326080wro; Mon, 16 Oct 2023 23:26:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrKGNeIchU6aGN2VvzvXnFPH326+vlFCYryvM0qw9YmW/tcjqkC0M7rbh5BGw5eIqQWq3W X-Received: by 2002:a05:6214:2264:b0:66d:57ca:fa59 with SMTP id gs4-20020a056214226400b0066d57cafa59mr1637997qvb.37.1697524009778; Mon, 16 Oct 2023 23:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524009; cv=none; d=google.com; s=arc-20160816; b=u00Nh4K7q9uwHujvzDvIa4zRoVS/bMNb+eXHULY0rPcyVWZhgcg85t4AT0NzXyruLB Ct5KDjB+nuj3gv+XtPGgDdw4KkbhosXpzCpJV8iG8q+pRmlz+2uVCdDRfElVsUo2P+Pg px7LEG3W7V4lbx4cwEkvXJ+nVV4qMq9FhmkNaBx3qWfRugZGOFDdtE5I+ABBBKsAjSdT mXqPPmuokePqPCUCivLNKwSjH/6+QuZBO0uK9Q7sV8zogl1XQ3+e/4sHOSxGPezzlvqZ zuqllw2kEpZG3dgSsl+L1sou7BUg2mFgILYZFELrZMM8Rer0ziojJBeDehVf+6PU8ObX mqmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=V0ig2xAlbRoOxf6SMJuUw0w4vgldzT8/7vGmOft+bGo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=fWYAww9bcnDF5WnFA3S12MSGB7AM4CNp1wsOYvBEen6b1T4cUmgKc82FL2Cfb7smh3 lzWOCqVMxBBTW3VSJc47WdN3NTmx3UlDkA49pQIGCsWy+Sh2QQdiMEQBOmIconuhvfX8 azbbo9gKM6SaBGwccCB5/Knd0MCZoNs45YObMyNm5HJX9TNRkrv8p30K8Twhx32nbECX q6h1dsSxUMAfRX+noQ5u3gDRTpt5xr50tsIIY350iVyEpuevcdDIhxOBsHl/a8zX/iys MmW7wxLOBa/SnqrrSN2lb9gbHq1EarnNAnGuc43lXwwjMsGrP4Zv2KT/IAO/XscEo99h uhgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WhYdU0sp; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q4-20020a0ce204000000b0066d07413db4si539084qvl.62.2023.10.16.23.26.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:26:49 -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=WhYdU0sp; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNv-0003kL-To; Tue, 17 Oct 2023 02:16:55 -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 1qsdNq-0003TH-EC for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:50 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNn-0004nb-Eu for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:50 -0400 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6ccfed5e05bso778a34.1 for ; Mon, 16 Oct 2023 23:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523406; x=1698128206; 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=V0ig2xAlbRoOxf6SMJuUw0w4vgldzT8/7vGmOft+bGo=; b=WhYdU0sp5QT5U7IFddbhJeZUCy6rsIVOBYopATxS99dzu8vq0XN1Z5dhR6G3Hco3Uz Yu9dYNhgYM0BW4jaysp/+Tf8uwfH1KV03P2tWa6k4AEspzvRqfqXUmN5nFH+lJ0tupnh Km2oz+FdAd8Gkond+YTKTdyG4JR6IfPGeUwQvlLqn6VbOLdZ3qTgLRZUtI2TOQyTLxRu Pfx8H+T75WVNs/bxhajFiFe7adCptlBuz+tfh0N3f/CypkJzz0/eZvRDc9ohFORb60+H aL/eLxhZ2T7sE4h36SypXGwcuWzPBl1pOoF++qIdXZxkUzrQQtHuoI6y+rpbP41GT1ad BxpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523406; x=1698128206; 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=V0ig2xAlbRoOxf6SMJuUw0w4vgldzT8/7vGmOft+bGo=; b=jN29ZKQlG4PMZoMQ8iHNbacCsStRBuVtaYLXT2zehIzUh2SFX4BFevM9cNzxyOwpLn S3bSdG/RpYD03BYXRKM0Z+U1sWAVZcVDoQOIUVoZpdNnk1oQ9CO8kjBB7fdOO1p4EClh jr3w2cFhgnFfoMafJ7+VhWgAuQII/ZD/5t9jetSK61TiLIBNee51J/dkD4C/SRTY2Dv/ noUBARkNIarMcefDdtVv4aHEsKs0nebz1xeaaoT9nvmtkmB6f+aqgLXAShGJXeRQ0VWK ksWL/3FNZTj+JpZT4O6fxxo/jQwQ40lGNTP9jh7DKMzp7aRThPYlMlrCL1wt8Y4gdOaU WNIw== X-Gm-Message-State: AOJu0YwXHK+exq4ENoKqOBL1p6M1azGiMvCRPh4csNTS3UK1x9U0ZzzT 3gHksAj0LYMoRILF3nSkbGU69RmxFqJcRonPntA= X-Received: by 2002:a05:6359:29c4:b0:143:897e:6e31 with SMTP id qf4-20020a05635929c400b00143897e6e31mr1447078rwb.7.1697523406012; Mon, 16 Oct 2023 23:16:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 71/90] target/sparc: Move gen_fop_DD insns to decodetree Date: Mon, 16 Oct 2023 23:12:25 -0700 Message-Id: <20231017061244.681584-72-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.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 Move FSQRTd, FxTOd, FdTOx. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 50 +++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4f10809e98..fa95ca056a 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -239,6 +239,9 @@ FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 +FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 +FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6707164207..b7eac4a6e5 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -53,6 +53,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -1623,20 +1625,6 @@ static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_F(dc, rd, dst); } -static void gen_fop_DD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64)) -{ - TCGv_i64 dst, src; - - src = gen_load_fpr_D(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -4921,6 +4909,28 @@ TRANS(FABSd, 64, do_dd, a, gen_op_fabsd) TRANS(FSRCd, VIS1, do_dd, a, tcg_gen_mov_i64) TRANS(FNOTd, VIS1, do_dd, a, tcg_gen_not_i64) +static bool do_env_dd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_env, TCGv_i64)) +{ + TCGv_i64 dst, src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src = gen_load_fpr_D(dc, a->rs); + func(dst, tcg_env, src); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FSQRTd, ALL, do_env_dd, a, gen_helper_fsqrtd) +TRANS(FxTOd, 64, do_env_dd, a, gen_helper_fxtod) +TRANS(FdTOx, 64, do_env_dd, a, gen_helper_fdtox) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5063,10 +5073,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x29: /* fsqrts */ case 0xc4: /* fitos */ case 0xd1: /* fstoi */ - g_assert_not_reached(); /* in decodetree */ case 0x2a: /* fsqrtd */ - gen_fop_DD(dc, rd, rs2, gen_helper_fsqrtd); - break; + case 0x82: /* V9 fdtox */ + case 0x88: /* V9 fxtod */ + g_assert_not_reached(); /* in decodetree */ case 0x2b: /* fsqrtq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQ(dc, rd, rs2, gen_helper_fsqrtq); @@ -5171,9 +5181,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x81: /* V9 fstox */ gen_fop_DF(dc, rd, rs2, gen_helper_fstox); break; - case 0x82: /* V9 fdtox */ - gen_fop_DD(dc, rd, rs2, gen_helper_fdtox); - break; case 0x83: /* V9 fqtox */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); @@ -5181,9 +5188,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x84: /* V9 fxtos */ gen_fop_FD(dc, rd, rs2, gen_helper_fxtos); break; - case 0x88: /* V9 fxtod */ - gen_fop_DD(dc, rd, rs2, gen_helper_fxtod); - break; case 0x8c: /* V9 fxtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); From patchwork Tue Oct 17 06:12:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734294 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324329wro; Mon, 16 Oct 2023 23:21:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYselK+8odqikft4OWCZZjrU534C40OjN3AZjudmgKUkwNfKNvYTXHR1h8wU7+thg4xBWp X-Received: by 2002:a05:620a:2908:b0:777:323:c340 with SMTP id m8-20020a05620a290800b007770323c340mr1467154qkp.52.1697523678019; Mon, 16 Oct 2023 23:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523678; cv=none; d=google.com; s=arc-20160816; b=Ph0XfSKXC5ppEhyrSbCPQX1mlw23VlypQ7UPIfCfFmtDNwMMeHLMW2p0KEsUl7EEuX s6ODEZW/JMoWHWcOyr9qBcEw6ihyhhiWXdaWPlDAsnE9D9yl0MhxDFqry15Oq8Vprwjd u3C3XU/ThD3VaFx3aHMw++6v0d86pEeBpNLzEEHfyrIndW/pSofK/C+gnJwu+w/7oO4B +b60wzSZm7cayG2m3OoZviIRqvQr3F76E1XulRfvtSQEN34KE+imkt5AJSVehS6a+/kc TlsENCBGPlP3aKUD1Hr92oIGIppX2yG2NUukE0pHaoZ2J1O/L8kUpmLL0fLlKTcKEKRL qFmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=3gYie/v6IqqLGja8COJ8WBxigcVna1e9VeJJzqC02sY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=nxLJTu1x+NX91XCSw0t6bGlEFc+CnnZLGqIrIUp7qKDl6Nkzi1iaEvf4SYaJB/PZV+ gxIFM+Pd1siQ31IjojeTJjCcSvHfB3CSfkJp1TtyeNM+nUMpyHqPV0iFCMMnJLuUjZrW JhayQ2D58AcuYKu0KfnaqmKKxBs2/8Z9Ws8lUjX3EjtxFnZkxItwBmD6henVtcMPFkq8 nYTtdj65fRF7Osmn2z+6Kyj3czR3bqxWtfxHlPp1iA+pFum4TkFU1NPYaad27Wtxn3Og juafKPj0Sacjizk0xVu6iBS6ecWuj3e51zD07rhuMjcn/SEzoE9p5Soyvu/uNFsABcyv zBEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z3EgRe9+; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t6-20020a056214118600b0065af57857cbsi530837qvv.213.2023.10.16.23.21.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:18 -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=z3EgRe9+; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdOH-0004JZ-6K; Tue, 17 Oct 2023 02:17:17 -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 1qsdNq-0003Tf-Mt for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:50 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNo-0004o5-4M for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:50 -0400 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6c4bad60a1aso3185612a34.2 for ; Mon, 16 Oct 2023 23:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523407; x=1698128207; 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=3gYie/v6IqqLGja8COJ8WBxigcVna1e9VeJJzqC02sY=; b=z3EgRe9+wFYNajD9ne0+h7Araz/NCO4yyFQ0iIYy8+wRvPZDPnFXapweyIPD6dP4DX 9llhv+qR00k6s0QIyIuW0Df0ibV93GZyoRqbv+ueAAFb6v+YVw+Xvwydzo2Vunfknn41 WL/a51T2RIK6j2Ac3B5JqfoJ27KzRYLJ9mOsCB0VdIeP2uToGuLs5KbuyzmWqTRMLk52 iaa9MqwM4eRg/eZeWSRh8c2n4xwfUkalZnEgjDxuc8HbLFZe0b/xtoifYk+6lpu0MXbD sx+Fsbdsw14DpkhuzpmFs8RC27ho2S39Afg2nOszdz5pcK77FokE7WN4P4/71ij3kCju c8FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523407; x=1698128207; 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=3gYie/v6IqqLGja8COJ8WBxigcVna1e9VeJJzqC02sY=; b=jjSNvHt+yqj6h9Xq6kb6SyhhDzPSrvpyA7iR+ZIQHV4e8q0rf+szWdGzVFdreJh2pb KFB2SpqeZobNpP20Tl2e+g/Brm6lAsqHUMqChepR/COy5Di3BLRDPumWyTZ7xEwWhh2G AqwcqwVqbvWxvTkjXjseFhENhdmhOZruL71mTHrSqOIxctPEItbgf4aldhlYHJnnZBSy bPJ55htiV708+no6d0NNl92MYYs1GJoIVZCZJm+OmBiAaEHxNedK18aBV6fgXFeXge8b NwrPpRgYdVjXDCFEMrinnPzAS8CnQEXnbuISrADlGelNdezroM3ig9EREUsN6XD9SP3w /J2w== X-Gm-Message-State: AOJu0Yw+4m6JH0map9echXS6+HJ4QYIYq/g2M+59OkcZLKCmNydAZgEa yt4dtsVdafjiXtWM2EJtEq+s6MivzaK0E7KrEMI= X-Received: by 2002:a05:6830:4106:b0:6c4:9fda:a1e2 with SMTP id w6-20020a056830410600b006c49fdaa1e2mr1974033ott.4.1697523406916; Mon, 16 Oct 2023 23:16:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 72/90] target/sparc: Move FSQRTq to decodetree Date: Mon, 16 Oct 2023 23:12:26 -0700 Message-Id: <20231017061244.681584-73-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 39 +++++++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index fa95ca056a..7fdd8e37d1 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -240,6 +240,7 @@ FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 +FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b7eac4a6e5..ffcd630a91 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -71,6 +71,7 @@ #define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) #define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) #define gen_helper_pdist ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fsqrtq ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -1640,18 +1641,6 @@ static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_D(dc, rd, dst); } -static void gen_fop_QQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr)) -{ - gen_op_load_fpr_QT1(QFPREG(rs)); - - gen(tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - #ifdef TARGET_SPARC64 static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr)) @@ -4931,6 +4920,27 @@ TRANS(FSQRTd, ALL, do_env_dd, a, gen_helper_fsqrtd) TRANS(FxTOd, 64, do_env_dd, a, gen_helper_fxtod) TRANS(FdTOx, 64, do_env_dd, a, gen_helper_fdtox) +static bool do_env_qq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env)) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + func(tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FSQRTq, ALL, do_env_qq, a, gen_helper_fsqrtq) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5076,11 +5086,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x2a: /* fsqrtd */ case 0x82: /* V9 fdtox */ case 0x88: /* V9 fxtod */ - g_assert_not_reached(); /* in decodetree */ case 0x2b: /* fsqrtq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQ(dc, rd, rs2, gen_helper_fsqrtq); - break; + g_assert_not_reached(); /* in decodetree */ case 0x41: /* fadds */ gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fadds); break; From patchwork Tue Oct 17 06:12:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734289 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324285wro; Mon, 16 Oct 2023 23:21:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGc5B+h0yg1OnyNTsncgSocWwrZ5URx+Y8bHJefFkTvlv0UsdPfMGiFvZT5n9Mx164fW60 X-Received: by 2002:ac8:5c0c:0:b0:410:a088:38f5 with SMTP id i12-20020ac85c0c000000b00410a08838f5mr1478743qti.4.1697523670268; Mon, 16 Oct 2023 23:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523670; cv=none; d=google.com; s=arc-20160816; b=JtutiCSWfgrTHdkB74C3K2mBJNEJrhLjBtqucXVcTWNA3dl5sDcBqQSy9WX29VtU3E VHJCEAfOA7EPS6YdxmyH3WRkZygdETUESNSkKJyULMFxQSgMKJ0uRkwKJsf74QLxzbtT TTielWlBGOqnnthOoyS4TqyXtDv55K6UHhGXQPDqHVTzGXbBXjOOC02lypPZeDL6fbU2 ZpZj4ci51BgfWTZAtwlx57MI7YlwF2SNM+s9shtAvDP+ja8gRuhN2iGdugsi9ujLJfJG l4YPPzfbqs4AVa3QSbdYk3kWCA/kHFG/kqOpx4G8Jypt3ReGP1IWaIZExzyJMpmPSNoP nrVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=oNj/xziie8J5tcU5TOuNOrD/R+wPDckkYUxdB/9hsF8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Lst3pBYzU99Bd4yJuKarJ0TTO9h8oeyAIKOX51m3cdCGSx6WVJZXglTWUTFc1T9+nB MfL2cMhpNPzkHzpOozs98BvCsBvpxYDrrAtCcyuK/9SEhxpNyKARocw0kFDbOjUypHQN Jdvpmap6rs1vP408Tnqx0wU80iKwW1EoBj9Q/AenrtcQGUFukL7tnXzgSwSG6aDG9Pq2 aZE1WPPhlaANIJ6WUsYB6SeyqV1PK6m3+DDIMNbFMvXJvTXCjiK9VYcgGm+Nf+6/8Vyt MJof4W9+nmFgPnnIr/9oQr0CLtsFAEkiekZ/69Zef8SbGkG6YzQkOyvQ/eZdIiYTlqx1 z27g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rVjSLoVL; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w17-20020a05622a135100b0041981d576c3si642209qtk.595.2023.10.16.23.21.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:10 -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=rVjSLoVL; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdO2-00044E-0f; Tue, 17 Oct 2023 02:17:02 -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 1qsdNr-0003Uw-N5 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:51 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNp-0004oJ-4l for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:51 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6c4a25f6390so3543129a34.2 for ; Mon, 16 Oct 2023 23:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523407; x=1698128207; 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=oNj/xziie8J5tcU5TOuNOrD/R+wPDckkYUxdB/9hsF8=; b=rVjSLoVLgtW8TfkBlKpAspYWmRmq+xR6gsb3uSvk4C2ByTOWxbb8/y0PLYpi3Zf+WL bwMMbbDaf9y0TCXZ5va0eP2l6YIfq/l2SLTGri+oN58kVYRATlc8nzUnNvSqWUdM5Iub PpSEwATaHigyNNPSsEVzYKWPkTkMxZqPP7pZyGzWqecfu2xPOiXUdFHk+a2xTL60DrtL 7wghp+u3JvoqN7tVOOt2pJzzeNXEdCo0LYrISTMshss8mesBAldKC/bmsdNSHAEWHz0y 0pD6apInCQ1cjDUnbVCjMUn1+MaM0NDwn+dYere3dRAKqyp/aB7WwgubQ7VATvardBlr BDwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523407; x=1698128207; 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=oNj/xziie8J5tcU5TOuNOrD/R+wPDckkYUxdB/9hsF8=; b=QVATbgo9XTOTzEwTw60hiQkIWHKJlP+APMpnDU3KLkwQPHjQphgQfMv1EsI+c9QX/q jY1j5o5GITRO5De1DQQD16NhSwFtURlbUmsvm7KcnJiW8L3ipOsNzX2BW2EHSGjosmcA hrFTWv35x+y2sZitzKSgy8ES5ExzLJ1PfWkD2AwJzSyV+4NIB+Us0T8m9ngxic/9pF4p d2Bv8mZ7U/zAlbIKomU5bwyDetdy1saCt+vK+a65Z8a/PoPpjQai9qct9QIK0xLYA1s5 zwYjPzP9WPFxMUbJ7z3FXFyXBTlEOba8Gza7vj8p+ZOC1Y4syVATkWoK+Oqx9R0+l1oy Mzgw== X-Gm-Message-State: AOJu0YyR2tPGbsvSjaQuD5QNkVelg/PNHjDf+iDkV9v/qUWrLu/bN1Gy tDmAUTLeDXcczCSUpFPebsxsHXw5KM5Z77Eiwds= X-Received: by 2002:a9d:62da:0:b0:6b9:dc90:8a85 with SMTP id z26-20020a9d62da000000b006b9dc908a85mr1322258otk.24.1697523407709; Mon, 16 Oct 2023 23:16:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 73/90] target/sparc: Move gen_fop_FFF insns to decodetree Date: Mon, 16 Oct 2023 23:12:27 -0700 Message-Id: <20231017061244.681584-74-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 Move FADDs, FSUBs, FMULs, FDIVs. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 54 +++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 7fdd8e37d1..d70f193883 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -241,6 +241,10 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 +FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r +FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r +FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r +FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ffcd630a91..6b3b60fb22 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1611,21 +1611,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32)) -{ - TCGv_i32 dst, src1, src2; - - src1 = gen_load_fpr_F(dc, rs1); - src2 = gen_load_fpr_F(dc, rs2); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -4970,6 +4955,29 @@ TRANS(FXNORs, VIS1, do_fff, a, tcg_gen_eqv_i32) TRANS(FORNOTs, VIS1, do_fff, a, tcg_gen_orc_i32) TRANS(FORs, VIS1, do_fff, a, tcg_gen_or_i32) +static bool do_env_fff(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i32, TCGv_env, TCGv_i32, TCGv_i32)) +{ + TCGv_i32 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + func(src1, tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, src1); + return advance_pc(dc); +} + +TRANS(FADDs, ALL, do_env_fff, a, gen_helper_fadds) +TRANS(FSUBs, ALL, do_env_fff, a, gen_helper_fsubs) +TRANS(FMULs, ALL, do_env_fff, a, gen_helper_fmuls) +TRANS(FDIVs, ALL, do_env_fff, a, gen_helper_fdivs) + static bool do_ddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5087,10 +5095,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x82: /* V9 fdtox */ case 0x88: /* V9 fxtod */ case 0x2b: /* fsqrtq */ - g_assert_not_reached(); /* in decodetree */ case 0x41: /* fadds */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fadds); - break; + case 0x45: /* fsubs */ + case 0x49: /* fmuls */ + case 0x4d: /* fdivs */ + g_assert_not_reached(); /* in decodetree */ case 0x42: /* faddd */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_faddd); break; @@ -5098,9 +5107,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_faddq); break; - case 0x45: /* fsubs */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fsubs); - break; case 0x46: /* fsubd */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fsubd); break; @@ -5108,9 +5114,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); break; - case 0x49: /* fmuls */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fmuls); - break; case 0x4a: /* fmuld */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld); break; @@ -5118,9 +5121,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); break; - case 0x4d: /* fdivs */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fdivs); - break; case 0x4e: /* fdivd */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fdivd); break; From patchwork Tue Oct 17 06:12:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734315 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp325563wro; Mon, 16 Oct 2023 23:25:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpkRt7+pqwZL/wELAzRc5FTz51D4OB4+qdb9LG/H0WVTNiWgGOHCyZ+oT9qHp0O+a25Jrz X-Received: by 2002:ad4:5bab:0:b0:66d:589:5841 with SMTP id 11-20020ad45bab000000b0066d05895841mr1386545qvq.28.1697523912731; Mon, 16 Oct 2023 23:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523912; cv=none; d=google.com; s=arc-20160816; b=xB4fTNyb2IOdPPliamUF3Cl4hUlL0fsrV9wCq8thXEo9vHzMmRYNU6QS4h0aicFH6d KdC5dKUqOVOtp7RDZCzPePGhGgnwJMITFXA9CHMjDxxt/XRUt6QqAczOgkiCcNQo0KG6 rmnEIF6Ruxy+mX6bOk308xBZg/iirYUyDPjINbZ+d6CVMY8pUJIMo4ld3EsT52Sx3laq gcdv7rxl4UfCl9REvLZI3GqXhYtTqQxneRvAADH6O+3pFG43g4z8pWIzeNC53Bxaj7Cl IVdNHQJsp+Z5cmEbALnaiT98dUPA0ny80QWt1TiaCQF+6d/wzXsoG9xT1VjgJe/cfNSs Fp0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=W2ISP4lr5rnIMwb0yZS6PTt451/dWOxiq52Nw5r1cw8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=M9pgAt3jJsmjs3Snmapqgm+ReZqZTn95V3wk/Z7NF4OmnQ3jtCUywhhDheErMYBGL1 ZI1C/X6FkVE2SiyJIbIwPX0D3QkbCbp/JYpEd9zteezM+S6a61Df9w0ecc/B1kuBOKDh oiNHnX4hIRZwpX6UrM3WCKhOj/nLtr5RelAcRTrP5ZUo6sQT0mO1ymalgdEABZ01bfEx cIyw7t3BwH5qvWIrggtYkJ8re47MEye3AQ0yv1i3mPp503P7MyQFAHHCk2sqStzV3lQd eEQ4Xfh15Qy7qONdyRg5Jei3R4KPkBFq5ur3EQIvW65xR7eDDyitMR26dwfUJCXoMh/+ M3Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vsE51kRQ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ph28-20020a0562144a5c00b0066d09d73eadsi524518qvb.462.2023.10.16.23.25.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:25: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=vsE51kRQ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdNx-0003rj-6d; Tue, 17 Oct 2023 02:16:57 -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 1qsdNt-0003aO-5W for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:53 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNr-0004oz-Af for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:52 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1ca74e77aecso13871245ad.1 for ; Mon, 16 Oct 2023 23:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523409; x=1698128209; 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=W2ISP4lr5rnIMwb0yZS6PTt451/dWOxiq52Nw5r1cw8=; b=vsE51kRQU/FCBPQJAn6YdyAcDrxrFPpCKCIM8JYq9LnFtV7CVcIV9Ehd9cCI6kQeZK +DcT4rb7TkU2bivYjWx5GJ+JQnfyc4vfcdf6M+CBHefDREKApGhpe3OOWE+7/s6EzNXy 0FxkdkkDcJbAkx4HoaYEa4XH4HG3vR60KVqRjYj6oZeg3cyKZh/BvB3SlDUJ7ztoyhmu IACdF8bC/3kWNZM9Thes5z8CZfKokfbczw1IeU5lg8tRX3A9srI1zU0PxTdfIbvByCQS TuEAj5WpnIcJYn0nX2Dy7PS/WYkfWTTF0pUMBDpFG1JbjGcJrjGetCOU1HM5IvblweR6 Erew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523409; x=1698128209; 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=W2ISP4lr5rnIMwb0yZS6PTt451/dWOxiq52Nw5r1cw8=; b=CgRPAK8//Xf0Z3ZpLYsgR7AuDC+IZ29iDiQl7p25FY2+OGKqHNWZEtExD2vWI+85nO QGV7wMU+Jzv/IysATk5iO3mJ81hN/IY5O7EG4ZZRIPFNeJgTEUf8Z51sITbQJht9BbUo qa7dBDYX3sQDTIu1wHVawtR2/alDE9iiUI3LQUTvEBiW51JNTv10iQtXTjBLVUuKRg21 akTNrJvUs9RQEQX24bQsnx1XXD32V2bjcihzc50u+sJ88swkI5wVhAuASrHyh/umX4dB dcYLIhmsWgrp98fYELWa/Ff5YDUUrW+H6s+0ISUt0LVSq8X4f7twe0yXHhwyYMLJfHpO hVJQ== X-Gm-Message-State: AOJu0YwaWQKcyboc1S1syIRcPblLTpOBapSl9zXhwNEWNyISDin4DW2H WIrHvZDhf2unjgiuR//IDu2grB7NaeLIbMiHZqs= X-Received: by 2002:a17:902:e841:b0:1bd:d510:78fb with SMTP id t1-20020a170902e84100b001bdd51078fbmr1715700plg.3.1697523408951; Mon, 16 Oct 2023 23:16:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 74/90] target/sparc: Move gen_fop_DDD insns to decodetree Date: Mon, 16 Oct 2023 23:12:28 -0700 Message-Id: <20231017061244.681584-75-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 Move FADDd, FSUBd, FMULd, FDIVd. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 55 ++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d70f193883..a86c9c85f7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -242,9 +242,13 @@ FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r +FADDd 10 ..... 110100 ..... 0 0100 0010 ..... @r_r_r FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r +FSUBd 10 ..... 110100 ..... 0 0100 0110 ..... @r_r_r FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r +FMULd 10 ..... 110100 ..... 0 0100 1010 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r +FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6b3b60fb22..a875ca716b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1611,21 +1611,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - #ifdef TARGET_SPARC64 static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr)) @@ -5022,6 +5007,30 @@ TRANS(FPACK32, VIS1, do_ddd, a, gen_op_fpack32) TRANS(FALIGNDATAg, VIS1, do_ddd, a, gen_op_faligndata) TRANS(BSHUFFLE, VIS2, do_ddd, a, gen_op_bshuffle) +static bool do_env_ddd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FADDd, ALL, do_env_ddd, a, gen_helper_faddd) +TRANS(FSUBd, ALL, do_env_ddd, a, gen_helper_fsubd) +TRANS(FMULd, ALL, do_env_ddd, a, gen_helper_fmuld) +TRANS(FDIVd, ALL, do_env_ddd, a, gen_helper_fdivd) + static bool do_dddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5099,31 +5108,23 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x45: /* fsubs */ case 0x49: /* fmuls */ case 0x4d: /* fdivs */ - g_assert_not_reached(); /* in decodetree */ case 0x42: /* faddd */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_faddd); - break; + case 0x46: /* fsubd */ + case 0x4a: /* fmuld */ + case 0x4e: /* fdivd */ + g_assert_not_reached(); /* in decodetree */ case 0x43: /* faddq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_faddq); break; - case 0x46: /* fsubd */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fsubd); - break; case 0x47: /* fsubq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); break; - case 0x4a: /* fmuld */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld); - break; case 0x4b: /* fmulq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); break; - case 0x4e: /* fdivd */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fdivd); - break; case 0x4f: /* fdivq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fdivq); From patchwork Tue Oct 17 06:12:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734298 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324511wro; Mon, 16 Oct 2023 23:21:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpwwPo3dhqc0vQigv6GY01E12Lb0KeqAZyl7MI7fnXBQaE9rTdsdshpAHo3lFBsAuVDejJ X-Received: by 2002:a05:620a:40c7:b0:772:63d9:6e69 with SMTP id g7-20020a05620a40c700b0077263d96e69mr1038839qko.35.1697523717274; Mon, 16 Oct 2023 23:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523717; cv=none; d=google.com; s=arc-20160816; b=uBuBknzDmfvR/LF0DOLgGlTyk9X7VPUeWVRRPprsLngCQp8G1ZxR7jGaNZQIK/8v2Y PX08pY6MXEoDFXgoK2kswxzTtzXkaDKa/vYqj9c5StaN016HmsUUILHaseYdOVbQALvN xeN3VU6lB75drtmcju8kwMarkdl9jAkAQnr/tTNRZcK0ErdDn+gUP797C9D+MAW8QNOA oCgy5t+Ulw+xoxQvKkypbdJxrbhQYDgaZiB0dxxwALjm1dNEoZN6MGrFqlK4NhCLLHpr lXCnXxWd+RRhbwL7sXVichERwnKxEmyt58N227eZZDYWD6N/UxWcsdlG0xNQ9kMvr5aA TTow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=0vCuq+uuID5Z32hzaclmdSsH09x8KML1p7HKEF5dnuA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=O7IWVrpZ0kwpUMLge3GPzAFgxfoVTF7Bj8ySimo9QEDUIxmLB5bkCP1SrR6cF47Hep y4utscEehbcQih6iypCKHI6CEPsEaQZLu4+EOqUOBN6Ulzc0ttBhPt37Jdi8NnaTbm3O qw/04y5Iv9spIh8lwdOuOnz5/kbBB88OEtgH1vHm6yaRgcO+pYaIxkXvWjJjVlLTIBZI k0umEWruwM9+ve9vzmiWYoQtfU2VOuaiEenGz9PamC7Gu/iR2/Ie4a22dUQs0JhCsRW5 skF15Ct6L3rsPRO5G0ZfOeChlJSpXoawVoOmfGREg28DOVzr1yWCsXOXH55oo1JT0qBm eTXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CqAnKowJ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i9-20020ac85e49000000b0041965efdac4si642827qtx.395.2023.10.16.23.21.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:21:57 -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=CqAnKowJ; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdO2-00045u-Nr; Tue, 17 Oct 2023 02:17:02 -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 1qsdNt-0003dK-V0 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:53 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNr-0004pG-3v for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:53 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5892832f8daso4886842a12.0 for ; Mon, 16 Oct 2023 23:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523410; x=1698128210; 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=0vCuq+uuID5Z32hzaclmdSsH09x8KML1p7HKEF5dnuA=; b=CqAnKowJVMDawXz/b3myT8j/N7r1AeL9nQJTGEIsDPEkatPQpIAvFY8ddN3zpSQjDS /XPNzHRfkwXvLEr+XmKhV7NX75yXKN/+BSKQbK3lOpnxt+UwEU43dk/VTC6YazqVjDD1 Lnk94VXx+NC1CNdqWGhOrxxZZ92SfbWqY8wJNf1QoXn4rWUTMyLAK5gk3VL7Lf3Q8RJL OHVLij5I3CFdkdDqBFGoQOBwbHg6Bak0/KDw60D0pJiV41ORnUab+82V/uIpwA6kzv6H H9QAI37TCTdCY/VJf98GjqXFwvmNholkryhrcUVq39ab4JBHqSro1Ri6o0n7h7BA/8xA Rvrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523410; x=1698128210; 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=0vCuq+uuID5Z32hzaclmdSsH09x8KML1p7HKEF5dnuA=; b=vg3H1BRTv0tmfvyYJFPM1SM1xy+G++sZo4+kdss+0ZE0zeAlE6t0FyWyFFPIIjjfwu XeNL32unOvXT2LXnrdupVOVVDLWXXCtdXnBSj5memt/WRFAZbxm4Iswt4nXdDieHI6dK dO7jqqQ3GFOHSM69WKkpW+DEycd9BCmYkwYmz3nyvQ88tkV74EkvKlC0GheoiWR1OtRj Zoi0oDyLqj682nHlA7m/ryMazSSAPQlVeUBBKUemdqDG5aXO0hExFHNro36055jFLJqJ LO8HpS7tCh58j9zYjJqsPmmcnnVo53osIfqdOfjZj2wSSpkuNpDeOrw1W5evp4q4U1mq HNng== X-Gm-Message-State: AOJu0YwQ6gX0/GMglJMglwcedPGBIcudlGCQj2xX9jUoEcRniARkdgLH t4+FQzdHcMoLnm8Hdz6MZBidiUX9dUcldz5x+iY= X-Received: by 2002:a17:90a:4b0f:b0:277:61d7:78be with SMTP id g15-20020a17090a4b0f00b0027761d778bemr1461000pjh.14.1697523409777; Mon, 16 Oct 2023 23:16:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 75/90] target/sparc: Move gen_fop_QQQ insns to decodetree Date: Mon, 16 Oct 2023 23:12:29 -0700 Message-Id: <20231017061244.681584-76-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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 Move FADDq, FSUBq, FMULq, FDIVq. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 52 +++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a86c9c85f7..0f7d898071 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -243,12 +243,16 @@ FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r FADDd 10 ..... 110100 ..... 0 0100 0010 ..... @r_r_r +FADDq 10 ..... 110100 ..... 0 0100 0011 ..... @r_r_r FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r FSUBd 10 ..... 110100 ..... 0 0100 0110 ..... @r_r_r +FSUBq 10 ..... 110100 ..... 0 0100 0111 ..... @r_r_r FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r FMULd 10 ..... 110100 ..... 0 0100 1010 ..... @r_r_r +FMULq 10 ..... 110100 ..... 0 0100 1011 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r +FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a875ca716b..f1bc85c1d7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1624,19 +1624,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_QQQ(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_ptr)) -{ - gen_op_load_fpr_QT0(QFPREG(rs1)); - gen_op_load_fpr_QT1(QFPREG(rs2)); - - gen(tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - static void gen_fop_DFF(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32, TCGv_i32)) { @@ -5051,6 +5038,31 @@ static bool do_dddd(DisasContext *dc, arg_r_r_r *a, TRANS(PDIST, VIS1, do_dddd, a, gen_helper_pdist) +static bool do_env_qqq(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_env)) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT0(QFPREG(a->rs1)); + gen_op_load_fpr_QT1(QFPREG(a->rs2)); + func(tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FADDq, ALL, do_env_qqq, a, gen_helper_faddq) +TRANS(FSUBq, ALL, do_env_qqq, a, gen_helper_fsubq) +TRANS(FMULq, ALL, do_env_qqq, a, gen_helper_fmulq) +TRANS(FDIVq, ALL, do_env_qqq, a, gen_helper_fdivq) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5112,23 +5124,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x46: /* fsubd */ case 0x4a: /* fmuld */ case 0x4e: /* fdivd */ - g_assert_not_reached(); /* in decodetree */ case 0x43: /* faddq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_faddq); - break; case 0x47: /* fsubq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); - break; case 0x4b: /* fmulq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); - break; case 0x4f: /* fdivq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fdivq); - break; + g_assert_not_reached(); /* in decodetree */ case 0x69: /* fsmuld */ CHECK_FPU_FEATURE(dc, FSMULD); gen_fop_DFF(dc, rd, rs1, rs2, gen_helper_fsmuld); From patchwork Tue Oct 17 06:12:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734304 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324668wro; Mon, 16 Oct 2023 23:22:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQwQ+WiTxyUQPNkIlR8KY45UhkUVInW45coO8gEx96Wu41u2aLKwc4/ao373nmHkMmPFdn X-Received: by 2002:a05:620a:818b:b0:774:1494:bb0f with SMTP id ot11-20020a05620a818b00b007741494bb0fmr1203335qkn.60.1697523749091; Mon, 16 Oct 2023 23:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523749; cv=none; d=google.com; s=arc-20160816; b=MIlgWxSWE2h3JwuFUZjpsg0nKyFDLYKvVGsmQ20k8lMr0uoIF37mGEm+DrMleBl87e MWAtVjgHxZ9pY1VyiwMjbWvggvJs6PbSIZyjAY0uA3Wu8v+Kx+OY6W3btPR515ofTHJc WG2inQkAI2YEm1/5DV8fbYTy8R1B2QHuFx59yNKPXkUmeeAw08uk3lE5BQzw6DEbKvbi /Q+MTaTl1C67DnhDAkk8fbbP9ZXWW1BUGxEHHzVrzrUKjbppkC9fUfx3eZGHmYuiH0I3 eH23QbrB35ssQkhn/zv50QU8maNdtX76yNKgdgBmSsiYyOmoVBdrlLc8r9k8N58BoBTn mrow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=nScph8hjHzM4G7+Y2vCkY31j2HzlZ3TJQFgFIJqxRZI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=XWCvRLOqwaJ+xjWhPYrmFyUQJ35wNLM3BJyY23foZ+CHK/1P1UeMC3m6IofQ9W72TQ +ifKMKCbWtPn6T7rbKelHlvxJh8hwJobR5m76q45R/f1a6D9XqqF+AdLS35kKyAfnKeT Dym/kodekVKpfA4K1yg+5iN3Tj/hbQWtXvO4F02tYzR+RTUTg5lQz7deQprY63mNtnGd q+j10KxJJXLdHvYOomzvngUG7Tgl00v8mdGHeJBULePGbmGXlTPcDqC4u0ysOCORFPgB zaWc6zCd0t70LB9QD78UoVxxTvmhrHudR39NJtidrXfS5448LoUJ2BJ8pa+BHtYXuFkc 41RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ESktbTOv; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 18-20020ac85712000000b004122ed3e21dsi617377qtw.555.2023.10.16.23.22.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22:29 -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=ESktbTOv; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdOH-0004LM-Sa; Tue, 17 Oct 2023 02:17:17 -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 1qsdOF-0004Dd-Aj for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:17:15 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNr-0004pV-O3 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:17:09 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-57babef76deso2965066eaf.0 for ; Mon, 16 Oct 2023 23:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523410; x=1698128210; 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=nScph8hjHzM4G7+Y2vCkY31j2HzlZ3TJQFgFIJqxRZI=; b=ESktbTOvpFxK+wKGRun8zevtJ7AvqjIVaofxj7NppvFw/pxcY3LqFetu/MkQTeCwkJ G0yu5eU2AwRh6lOJVG/IWOky4l2Kw3W9lmT/qknQ28flp64f/JtjpGH7VOyqYrBRQxbI jyEdZKHYydQ4jde9Bi+BIhqTaJ+QQDGIooJw6vsBCaal0RNNl5hseFiRW4PM1vvS99m8 Y+Ut3N1zbWifq+tILhJKSGAemFF7mhclsU27IfdDhnoprX715wqqg2ALbRjnX77KXFN6 KZD+hleboCoL9ymQ7cpnz71ChM/js03gwzbB8Fuxq50dj3DABDuCj3QQ3Bzagp2q7248 nSKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523410; x=1698128210; 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=nScph8hjHzM4G7+Y2vCkY31j2HzlZ3TJQFgFIJqxRZI=; b=NTyl/Fcr0Poz8ih1RwyvrGToHKPRTUNA3rE/3sWDNxaqa8fdHFVXW1TVlcRAucXDpv cnhPzGxsSwLRB6OfdmMwdZ3PtU9xB365pl/8zLSSEdrdIuoxGqCOZoBnAcUi97VmcKsu 5deGRfj+gShTneydRnAwqFoV+A066jDD80Q1aqak+x9aF/y5yewUzvzdMFNRSriqNJA/ xqwH4o655OTdQkiHzO0/ZcRfOO0yEtG7b8s5ly9Zz1JkyQ70QwFjrSL64FKeEfuRRtI/ bfN/d8Hvhx97+whfSxEzIepH02lStMlhyILzzllUiBvVosI0Uf+CQ9NdEQWBMY2FE7Xz 615A== X-Gm-Message-State: AOJu0YytaC4Uk4ZtbdOpMShc5UdkfUXOTaOdGJ/vYkyUTQWRivl/xhzV HyNk8BFx7aD8V+skdTrzEaOQPCVyaKCa1KjBpdk= X-Received: by 2002:a05:6359:5e02:b0:134:e458:688d with SMTP id pw2-20020a0563595e0200b00134e458688dmr1508922rwb.15.1697523410533; Mon, 16 Oct 2023 23:16:50 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 76/90] target/sparc: Move FSMULD to decodetree Date: Mon, 16 Oct 2023 23:12:30 -0700 Message-Id: <20231017061244.681584-77-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2b; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2b.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 43 +++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0f7d898071..96d9139d21 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -253,6 +253,7 @@ FMULq 10 ..... 110100 ..... 0 0100 1011 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r +FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index f1bc85c1d7..7f94bb99e0 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1624,22 +1624,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_DFF(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32, TCGv_i32)) -{ - TCGv_i64 dst; - TCGv_i32 src1, src2; - - src1 = gen_load_fpr_F(dc, rs1); - src2 = gen_load_fpr_F(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_fop_QDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -5018,6 +5002,28 @@ TRANS(FSUBd, ALL, do_env_ddd, a, gen_helper_fsubd) TRANS(FMULd, ALL, do_env_ddd, a, gen_helper_fmuld) TRANS(FDIVd, ALL, do_env_ddd, a, gen_helper_fdivd) +static bool trans_FsMULd(DisasContext *dc, arg_r_r_r *a) +{ + TCGv_i64 dst; + TCGv_i32 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (!(dc->def->features & CPU_FEATURE_FSMULD)) { + return raise_unimpfpop(dc); + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + gen_helper_fsmuld(dst, tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + static bool do_dddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5128,11 +5134,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x47: /* fsubq */ case 0x4b: /* fmulq */ case 0x4f: /* fdivq */ - g_assert_not_reached(); /* in decodetree */ case 0x69: /* fsmuld */ - CHECK_FPU_FEATURE(dc, FSMULD); - gen_fop_DFF(dc, rd, rs1, rs2, gen_helper_fsmuld); - break; + g_assert_not_reached(); /* in decodetree */ case 0x6e: /* fdmulq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QDD(dc, rd, rs1, rs2, gen_helper_fdmulq); From patchwork Tue Oct 17 06:12:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734283 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp323678wro; Mon, 16 Oct 2023 23:18:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFtlNfmw8FOU7powi+3nNnOgGgXQJDYtgNvThynKwlCUMErCIchZ+Ynv1TPeppn3C0X15u X-Received: by 2002:ac8:58d5:0:b0:417:d865:8295 with SMTP id u21-20020ac858d5000000b00417d8658295mr1609596qta.66.1697523537219; Mon, 16 Oct 2023 23:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523537; cv=none; d=google.com; s=arc-20160816; b=uo/55E8DBaLygMZn0sfkgJtcOvyz1T1wrh4jDN21oB8Xky2UBqJmgT2pItErEIOVwB 6cPYJiAdGiUH9yBfmbqrncVvrb1LUML8bIaWsPFKW4Y16sirtLPlRBh21pwfmuhFsFAP anV2HsJ0YAhaU9uO5RlYCLcCN4SDO9PsuqLo95GGuuTbudRHM3lRZ0HEceBZT32piTNw 5OrXzPeeydrcg4vjkbEDcygDkVKbZnz5hkglRDRq3l5mXN41jfDz9NhXat3R5C4hz3wx N3DZIUbtxptHgZDI6wx3yBVBo3MjZpi0SavsnO7/YemKJI+Id0lnXszjbPdGhnskBCem FM1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=RBVDczIzJd36UTe8IiE5Bt+zb8ayI5XWrKAn966xiPE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Js1KOEw6jl/OeERaKAp1A0YBPuL7Qr57BQCHQ5MzOMAyUrSZX6OMH/6mUXL3PBuLbh l9FE2M8uhXdPkBKL5T2nRbX7RvqY5GcWe6HmNNw6EGC3f6GAlQctRk/Y/GGBGAHYXKBG x7wFmnB+Mbt6Yf2KVIBO2M9eUKZhdsIOv5fXx3rhkuNOgvUvht9vvVQgQxh9Es+jamsz 5JzgfbsBQqoE73m38+C7ZqqR9MJSGXMJCFK723ukvewRn5Rkf1Km7QmPd9BYY4h65OZ3 fysMuNK2q1B5YhzHpbcSYlCXdDULXJnLGP9nKrWBvwwzSC5TnQN3+Qln1GmUOF7QNUQ5 Q7ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=To5HvP2e; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n21-20020ac85a15000000b00410a4cb9039si648779qta.157.2023.10.16.23.18.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:18:57 -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=To5HvP2e; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdOJ-0004Qt-8F; Tue, 17 Oct 2023 02:17: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 1qsdOF-0004Dc-Ak for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:17:15 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNs-0004pr-A5 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:17:09 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-57bb6b1f764so3534138eaf.2 for ; Mon, 16 Oct 2023 23:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523411; x=1698128211; 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=RBVDczIzJd36UTe8IiE5Bt+zb8ayI5XWrKAn966xiPE=; b=To5HvP2eINqQ8/vgN8SQunkz4e3xKi0TXWRMpExzrUo8Y1HAW3/1OZijnpjBsbPdG6 /T2C51EC6jW6y4QCJEFn0h2TIJAyalkl99XxH+XpfbbjNBTw4XGTBlCzb6GKdL1mRHlH hzmeG9PtRJPxCX/m1soeiLmMGIsiuclrdqaGdR4aSzI6mSNK46dg2AS4ANNdT4zZfdbl tQXVcqYGrGyBfZb8RKjtZCppS4MAC6ldCZAo0k7WmtQLaDDqf1jDP6/BIKmDXh73JdAk FGLWsQlb+pkKrHAGAXBfH3fIrXnuMPCtO2kX7uCCZwKxLP89yvcOnWtn++QL77U3Rrvj B4Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523411; x=1698128211; 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=RBVDczIzJd36UTe8IiE5Bt+zb8ayI5XWrKAn966xiPE=; b=ZWkEU8TISAL1EF+JEvvZqSObeXOUWjhVGuT5LDXX56wRM4Lhilsr6nITNG0w9ImBjM u+EvfKIHIXGVbOydkliShmTC+luxYLh7Xbrr8qvIUmDcHqwrp1XLisj4bcrAC8nWTlFW BLnFxnshB1XPQFYNZLDrvjOh06doR/yyiD4vBGeS6svnkeejs1yp3H6jQcBEtFcgeX1K 2NuMcurt7qj47sg2h3U4AkkO6WXilnw+/K+wRK6QwLH+N4lmlo0TECLZ5/6lQYjkdTRf 0RM/mMuPZ7nNeeR3JJQPgYTTlD45Jjw/JFuAjJpqf6rdlifOdOBuG6+LpZ3ebylGrZOV View== X-Gm-Message-State: AOJu0YxGGL4wnjoKTUFmE72UHPosJrXMe2NPihS38bPF2iaJhLPOPKFT lgUcp2h57tw1ZzGPF3CkVfe0tTaxBaAh/emgd1c= X-Received: by 2002:a05:6359:2ea3:b0:166:cae0:6e19 with SMTP id rp35-20020a0563592ea300b00166cae06e19mr1617518rwb.3.1697523411222; Mon, 16 Oct 2023 23:16:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 77/90] target/sparc: Move FDMULQ to decodetree Date: Mon, 16 Oct 2023 23:12:31 -0700 Message-Id: <20231017061244.681584-78-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2e.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 41 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 96d9139d21..a98b3b2bdd 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -254,6 +254,7 @@ FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r +FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7f94bb99e0..28d63c9915 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1624,21 +1624,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_QDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_ptr, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - - gen(tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - #ifdef TARGET_SPARC64 static void gen_fop_DF(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32)) @@ -5069,6 +5054,27 @@ TRANS(FSUBq, ALL, do_env_qqq, a, gen_helper_fsubq) TRANS(FMULq, ALL, do_env_qqq, a, gen_helper_fmulq) TRANS(FDIVq, ALL, do_env_qqq, a, gen_helper_fdivq) +static bool trans_FdMULq(DisasContext *dc, arg_r_r_r *a) +{ + TCGv_i64 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + gen_helper_fdmulq(tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5135,11 +5141,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x4b: /* fmulq */ case 0x4f: /* fdivq */ case 0x69: /* fsmuld */ - g_assert_not_reached(); /* in decodetree */ case 0x6e: /* fdmulq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QDD(dc, rd, rs1, rs2, gen_helper_fdmulq); - break; + g_assert_not_reached(); /* in decodetree */ case 0xc6: /* fdtos */ gen_fop_FD(dc, rd, rs2, gen_helper_fdtos); break; From patchwork Tue Oct 17 06:12:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734299 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324525wro; Mon, 16 Oct 2023 23:22:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnkmI4fzBxA33ouLfCKNIaEr4PfpVyQ933CFYOxvxxx9m+46clKFcnEwVfFRe9+fdm/wi+ X-Received: by 2002:a05:620a:4c85:b0:767:2a66:b792 with SMTP id to5-20020a05620a4c8500b007672a66b792mr1196133qkn.42.1697523720613; Mon, 16 Oct 2023 23:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523720; cv=none; d=google.com; s=arc-20160816; b=QqYsm4Sgj81AP785o4LhFxQxNCNBfanY/YNDSTg935keyXagheLYBGkZMTIZq9cYok Szs0Gg9oWYfbXl/nWKRL1XCMVm1KDYp61iyS2a8vzdBj6bdEgZQQyf1m9yY+G5t0Mo1k sDbjiLUO8GHeTku8mkJ+4vGZZuiXGBTKTP+UcofP9GlNm/K+0badTvTzxgQEO6L8Xxfy WzS13k60QoQrXCebrYUg2p35pZPRdkZgwwPYIU7OLlU9zP9xnOocdV79SMuj61Km6hlK vIMHQeiP/431Z0fGQ7JgeDSiq4RKJwMroSUdiv6Fa3nIAa1Qd4yOlaF8DWNyWIPwimMD yZvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=WuIByJHH5v/TZr5fDP/carJPcPPWSe3W25nTOp2MILs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=lS71lHfr0e76aedGk2zX/DbCdNXm44bFZtO0MFPDhhB5/m3lz7ZvXJxXwZeV0FAuZQ lSJs2v75OFscm+JS/rLEoYU6PX7Yt0v/sUaIVb8YnQp7mFGAepzxVqeYsUOaFO7fGb+h 60Z3QFGfG5BoZvtuBwbq9QGkTK+0NM9vl2TJzfGJ4mtEs55od9lOc8YWmGctcs2on5sj WwejwCDqT2K/u1d+1rPMwvthdSRXJKqeZ6YvJse8m6lCpDqWlXfGCuyhiiYkEeYkv4dQ IfWHEOQlQ6eKBMhM3FGLOGhb//H1m9Jxqe7HOkIXJLblAg+aQelzHELfgh4/ynXLHKnH ZyDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qNd/p9Mp"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id qr7-20020a05620a390700b0076d9dc0bc9esi603951qkn.230.2023.10.16.23.22.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22: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="qNd/p9Mp"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdOG-0004Gm-Be; Tue, 17 Oct 2023 02:17:16 -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 1qsdNw-0003o1-D4 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:56 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNu-0004pz-6D for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:55 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6c4fc2ce697so3737620a34.0 for ; Mon, 16 Oct 2023 23:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523412; x=1698128212; 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=WuIByJHH5v/TZr5fDP/carJPcPPWSe3W25nTOp2MILs=; b=qNd/p9Mp4QqEkXxuzoUvzhRu1qFTNOJJLSFsva/2zuyrU163o8NX4mLtPO3Pf+cRcw /qgIvKTLwMLPUl3h0g6vITFM/hiyiHVNHktCVPGYK01zty7s2XrZmYRijvfQ2Zt7d+Xn eJAo/o4AK9yUyvC4RBmIJwZt+Clmv7u4hQ1FZ+wfGeSebwo3bkfzNrnzMUlf1Ie7RFUh 8YW/8+OntOR5695Wo8cHsUhatg33aa4ovNLiIhVpk5p4d1UqE6YXuu6ZkRSIfIm/aEEm XEqMzC2hgQ6AwnRhhO7llOjtfF/1KWR1UT8C7cVpJApvlrk05EG04n6CNKaH4O7QHC1N fHDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523412; x=1698128212; 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=WuIByJHH5v/TZr5fDP/carJPcPPWSe3W25nTOp2MILs=; b=wIPXOMR7YzgEZeJGMbxFWe2+GZ6lyh7UkQwSKqK1lbgGffe1BoHuLSduNmjCK8OtIt b6tuuSdVKLrYByByOTNQ2CMu/NLew/GwGsQrRWXeNfsxaPetTVJOWKZHdKJc+pgmjwHj f/6Ju9dpLPMwfj6rh8RTMpOI7zbCK3VXQ1jmVvaAMwveCkU1J3aTvqX6ha/7d9FTl5gx a3iPuuZTfNV1KK32vzAVWmcorXC7mpoCjr3TkMde7yPmazD1LOAcCBlmDVmrnaNWOs1T cxM6/Qp6JBMd7ZBhGlV93/80E17G/Z8lhDFp9Y2E6p1kDqGxv5EBp9VMD7D0ZsJ358rD 4GBw== X-Gm-Message-State: AOJu0YwhB0RdNoG8LY/mfJMn4dIWUoPZ9p37rH3yPWUfDdDZvVMIIkAV BvVrjOdpNXSYtZjjSEJb6R+FVVItrsGjpk1X3d8= X-Received: by 2002:a05:6359:6d49:b0:14f:736b:7745 with SMTP id tf9-20020a0563596d4900b0014f736b7745mr1213531rwb.31.1697523412063; Mon, 16 Oct 2023 23:16:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 78/90] target/sparc: Move gen_fop_FD insns to decodetree Date: Mon, 16 Oct 2023 23:12:32 -0700 Message-Id: <20231017061244.681584-79-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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 Move FdTOs, FdTOi, FxTOs. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 51 +++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a98b3b2bdd..a0af20f042 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -256,9 +256,12 @@ FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 +FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 +FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 28d63c9915..acb9e58319 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -55,6 +55,7 @@ #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -1655,21 +1656,6 @@ static void gen_ne_fop_DF(DisasContext *dc, int rd, int rs, gen_store_fpr_D(dc, rd, dst); } -static void gen_fop_FD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i64)) -{ - TCGv_i32 dst; - TCGv_i64 src; - - src = gen_load_fpr_D(dc, rs); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_FQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i32, TCGv_ptr)) { @@ -4802,6 +4788,29 @@ TRANS(FSQRTs, ALL, do_env_ff, a, gen_helper_fsqrts) TRANS(FiTOs, ALL, do_env_ff, a, gen_helper_fitos) TRANS(FsTOi, ALL, do_env_ff, a, gen_helper_fstoi) +static bool do_env_fd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_env, TCGv_i64)) +{ + TCGv_i32 dst; + TCGv_i64 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_F(dc); + src = gen_load_fpr_D(dc, a->rs); + func(dst, tcg_env, src); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FdTOs, ALL, do_env_fd, a, gen_helper_fdtos) +TRANS(FdTOi, ALL, do_env_fd, a, gen_helper_fdtoi) +TRANS(FxTOs, 64, do_env_fd, a, gen_helper_fxtos) + static bool do_dd(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i64, TCGv_i64)) { @@ -5142,10 +5151,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x4f: /* fdivq */ case 0x69: /* fsmuld */ case 0x6e: /* fdmulq */ - g_assert_not_reached(); /* in decodetree */ case 0xc6: /* fdtos */ - gen_fop_FD(dc, rd, rs2, gen_helper_fdtos); - break; + case 0xd2: /* fdtoi */ + case 0x84: /* V9 fxtos */ + g_assert_not_reached(); /* in decodetree */ case 0xc7: /* fqtos */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_FQ(dc, rd, rs2, gen_helper_fqtos); @@ -5172,9 +5181,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); break; - case 0xd2: /* fdtoi */ - gen_fop_FD(dc, rd, rs2, gen_helper_fdtoi); - break; case 0xd3: /* fqtoi */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_FQ(dc, rd, rs2, gen_helper_fqtoi); @@ -5199,9 +5205,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); break; - case 0x84: /* V9 fxtos */ - gen_fop_FD(dc, rd, rs2, gen_helper_fxtos); - break; case 0x8c: /* V9 fxtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); From patchwork Tue Oct 17 06:12:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734312 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp325033wro; Mon, 16 Oct 2023 23:23:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJ1iBAgrHA2oPwLq/1L3O5qGWx2kgzs0HXxIEWinw+/Y0FkmQv1SGzoiypj8vQEJbVjxj0 X-Received: by 2002:a05:622a:188a:b0:417:b975:6d8a with SMTP id v10-20020a05622a188a00b00417b9756d8amr1889604qtc.56.1697523827224; Mon, 16 Oct 2023 23:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523827; cv=none; d=google.com; s=arc-20160816; b=VQX18X5UgrkVyIb4DpZG5yTN7HLPv4IpPqC5g00NLrd16AtcJddtAgjcvgKb49iJZG tuLwKuYXi7eWKQeKUBkOwk29aetGGsT38ilWaQbXCWGkh/7xz0Q0Zze6VKlA8t41a8at v35SYV0Pe+fTU5VtWoM1WTfX17yzze3hJNNNG18SYS+Ol2UQAVIuxDyv8JQVmSb75w8C Da0X4AVQ9t66V4+p2T4FgMhkN5UDuJ+LzvjwCKXUJP5QyMAIi7e1wHLQ2pdQiePgSw1s tfMLjA8P/Hs/kxKKP4fHgIlnUwZWFSUlqFmrLV4FUdAo9Fl1sjohk7lk2pjx1+72prJi 1QMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=elYXAD3nwI6hLY/7KpdbyhH5H49IoHErFhX1BnONLII=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=INMDn46fZQGG/IQea/8eSKHqLfy0aBo2ZxAyFeM4OlaTrJxc/AXGaIpKsbsTBMPkKA oZbkHFe2mUG/znihmDdeS4OKUx49KbopGaoXvLhJ4XugmkVZ5ygCVWSZFHz4XjJ4Tp9r DryR5NVJsxW5HFVe4nlRju/2GQ9n2swNyzRYJshSqVoxfCmc3jJf9i56e4ER4+Te4d6G 8eajzdvk7lXwMz/jPdd2ne+aWv1s5kEWTTBA2HD172DdayJGY5kUrfLjnAjTdVrj9wn3 DVHM5GS+tm2QEOryjvvxW5UvUuqCi9Chv9Rahmkp2Of4WAebL2gVJ7vVMbVuvDzId9H2 UWvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B6hn4JVI; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y21-20020a05622a005500b0041981b8a9dfsi655378qtw.75.2023.10.16.23.23.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:23:47 -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=B6hn4JVI; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdO3-00046L-62; Tue, 17 Oct 2023 02:17:03 -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 1qsdNv-0003jD-MD for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:55 -0400 Received: from mail-vs1-xe2c.google.com ([2607:f8b0:4864:20::e2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdNu-0004q9-01 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:16:55 -0400 Received: by mail-vs1-xe2c.google.com with SMTP id ada2fe7eead31-457e5dec94dso783530137.3 for ; Mon, 16 Oct 2023 23:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523413; x=1698128213; 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=elYXAD3nwI6hLY/7KpdbyhH5H49IoHErFhX1BnONLII=; b=B6hn4JVIU9zXDEsFnx3wWaK4NHJ22Bwkhlo0ZLQEzQhGbJkbFGfcgKlzhIoo/ZPg2b gbzMuexg0sd3vE1IwEZEDyKPYrEjvx1FB/YwGJp3rlQCTGyqaEf9iV9pvJmwd9omLvoh knAOziHCaywIpU2J74s41uVbTddfZfICqTrHIhJAUxIBTJncVWqKyMLuZeVDyjZGg5JD V/+jjym65lu9ewvR7f3FBM73qqZxseAC0Ohd02L00IgZOZrHzTzVZ95jKkLJ+T+Njw8O egGFK5vE7jLTqPh5Jhfa4WVgGrOeY4Vq6N7Y8ip2cWEQA9Ls1kbOimDwl1ERPbzpmeBe Ws+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523413; x=1698128213; 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=elYXAD3nwI6hLY/7KpdbyhH5H49IoHErFhX1BnONLII=; b=WiaMxL4xSF+dE6nze2hD8FonFc9Xp0pzpSRyC05r8j24SyhSgRnuxu7CxNYvjO68F4 JsDw2A/tfgxWtoQdiVZYRPMy5F0pnHVprX09bEz3eLUo+g+rTsCOigFXPsq7Q2Xc9kDl zbg4pabKHUJ4vgt034zm2rxNHyJM4Q54+lCqe1CXXtQ87QlfT7NPdALGDO1ztTTL0pLU 5eDjYf/8K0/zbIhvGJcPRdnbJ5aBMiwIN34rKp4tRtnsxw6JlIl789Gg/xRQxo2Nyngk lzBnIFG+a68UVjsjzvy/6unBCbs4qqiiCP17bVN4LngCiSL3Infsap+zwI0BL38MTglj vOfw== X-Gm-Message-State: AOJu0YwIrmrsuVmI17LMgvMs0vep4JAaaSshOUfZz+MQm2K9EXZvDnh6 Dqo7wr6xbeILlwL6brbIyQ9cUin7xAuikmvMWHo= X-Received: by 2002:a67:c390:0:b0:458:aa1:e0d6 with SMTP id s16-20020a67c390000000b004580aa1e0d6mr1578939vsj.0.1697523412888; Mon, 16 Oct 2023 23:16:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id m10-20020a056a00080a00b00690ca4356f1sm579280pfk.198.2023.10.16.23.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:16:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 79/90] target/sparc: Move FiTOd, FsTOd, FsTOx to decodetree Date: Mon, 16 Oct 2023 23:12:33 -0700 Message-Id: <20231017061244.681584-80-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::e2c; envelope-from=richard.henderson@linaro.org; helo=mail-vs1-xe2c.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 Note that gen_ne_fop_DF was incorrectly named and does pass env. The two sets of helpers should have been unified. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 67 ++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a0af20f042..1965084fb8 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -255,11 +255,14 @@ FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r +FsTOx 10 ..... 110100 00000 0 1000 0001 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 +FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 +FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index acb9e58319..395674d901 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -54,6 +54,7 @@ #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fstox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() @@ -1625,37 +1626,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -#ifdef TARGET_SPARC64 -static void gen_fop_DF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32)) -{ - TCGv_i64 dst; - TCGv_i32 src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} -#endif - -static void gen_ne_fop_DF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32)) -{ - TCGv_i64 dst; - TCGv_i32 src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_fop_FQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i32, TCGv_ptr)) { @@ -4855,6 +4825,29 @@ TRANS(FSQRTd, ALL, do_env_dd, a, gen_helper_fsqrtd) TRANS(FxTOd, 64, do_env_dd, a, gen_helper_fxtod) TRANS(FdTOx, 64, do_env_dd, a, gen_helper_fdtox) +static bool do_env_df(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_env, TCGv_i32)) +{ + TCGv_i64 dst; + TCGv_i32 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src = gen_load_fpr_F(dc, a->rs); + func(dst, tcg_env, src); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FiTOd, ALL, do_env_df, a, gen_helper_fitod) +TRANS(FsTOd, ALL, do_env_df, a, gen_helper_fstod) +TRANS(FsTOx, 64, do_env_df, a, gen_helper_fstox) + static bool do_env_qq(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_env)) { @@ -5154,17 +5147,14 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0xc6: /* fdtos */ case 0xd2: /* fdtoi */ case 0x84: /* V9 fxtos */ + case 0xc8: /* fitod */ + case 0xc9: /* fstod */ + case 0x81: /* V9 fstox */ g_assert_not_reached(); /* in decodetree */ case 0xc7: /* fqtos */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_FQ(dc, rd, rs2, gen_helper_fqtos); break; - case 0xc8: /* fitod */ - gen_ne_fop_DF(dc, rd, rs2, gen_helper_fitod); - break; - case 0xc9: /* fstod */ - gen_ne_fop_DF(dc, rd, rs2, gen_helper_fstod); - break; case 0xcb: /* fqtod */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtod); @@ -5198,9 +5188,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); break; - case 0x81: /* V9 fstox */ - gen_fop_DF(dc, rd, rs2, gen_helper_fstox); - break; case 0x83: /* V9 fqtox */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); From patchwork Tue Oct 17 06:12:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734316 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp325639wro; Mon, 16 Oct 2023 23:25:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGskNvsPePeyy21m8vFd7CfqP5MUrmUUUNuXfml5hOKioBhMcDsWdy55seWrrQGXpHF4uK7 X-Received: by 2002:a05:6214:1d0b:b0:658:9565:9736 with SMTP id e11-20020a0562141d0b00b0065895659736mr1897769qvd.56.1697523924692; Mon, 16 Oct 2023 23:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523924; cv=none; d=google.com; s=arc-20160816; b=PcLoZIm8VUh16D6I0PsDJgM4QfaKIjdF9LndLjr7ZFI9/9lC05FlJ91y/sc1lkOx95 crRzCCUByAsjy4w/eNeMk59ttIQNox6TvHatrvxfg3D9AG3SkFDaCNVvnanoLgGq9OHx RTd+o4Toh2FMjvJB7eqrzQoU6CMVtPG+t0ZCG+naUi8WhsZPfCqjPt9mNILBwMzDw5sS /3/FsYeE/0lt9K/60hP7rgW33LySAXOM+AstCMNW+DtAe/Gp547PIC7Su1I2KvdvFL/v HOR0f07s5acJw7+Q00nyLw9J/nUK2/Jp6Rkd0ZzVoXiUjkuFit85XHe88fOWi4CXwj2d kGew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=np6wyp9H5bwq/rv3no32dfOhOOOhfjRybO2Ph28cMbc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=sPu5JaA27ropkkQ7WdMjuZrYCUtFxvxN32x2NyPSjN/sU6e76rFp8ImRJRZkUAU8/9 A/HBoPMhjMXNYzVTt74ca9QS4vwGEHOk/8Q9e2l1D70ssc/jj/JXT2yTjX6L6h0A1yd1 xgTBsP4yssfGMYszvHlSWJVrecJ80R4lHCejohac1GzgEj4mEJ7gxh9ewicR2sqIINh9 8dWvnIwmsuHxQ4lhMGqyqZ/HyDbBtvB2HaIJbbhI4JYIx09jgto/bQ960PmUQFazxvxm gMPdDxfAFRyzc7xmSrIk8lv/qCnVdhH9pymhpkaMOp4Z7kEezr4wAtXM3mxihjUReqps mGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yH0Dn3hU; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g14-20020a0cf84e000000b0065afb72d696si530828qvo.454.2023.10.16.23.25.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:25:24 -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=yH0Dn3hU; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRx-0006SO-Bv; Tue, 17 Oct 2023 02:21: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 1qsdR2-0003hj-D6 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:12 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQp-0005Bo-LC for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:19:57 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3af609c3e74so3555398b6e.2 for ; Mon, 16 Oct 2023 23:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523594; x=1698128394; 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=np6wyp9H5bwq/rv3no32dfOhOOOhfjRybO2Ph28cMbc=; b=yH0Dn3hUN3GfrEMRc3x+yLYG40Q1yYrwLfxWJKF2ZlZ+jmKPNIhhc1zGjKYvMR2Bxc NTVKzc1378bW5ghBlGc7njdc4UoN9OHMio0C0gigbER6mgUVMqCuYLJlLc/DCQIIbPpv waagnnyj9596Ttox+xskDUk5B97w6suf7cHQV7bG/wRPwSL3ySWJO/UDGIefYfCCIVdY 5u8UaEqeMWB6+a7iYzQzn/0wL/AS/znwODgYcbHm+d47gmoJ5Q3lZY0lEm91Cx2IufKO RVTplWNOpNG64f//e2APdG7k4g5gZuoc0IkG3kmM2gDT0PuRD4mN9P/5anHgLd58laZi 34qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523594; x=1698128394; 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=np6wyp9H5bwq/rv3no32dfOhOOOhfjRybO2Ph28cMbc=; b=dWySW5FPOlnB2ex/F1pBfgA92LALZbnjqtOdYRQcToqO8S2qUOND6FFCoATufd/AbT 3VeYmW1rb91kYHy8KvG7WXPSsTJLilC/OX5lDZ/uE49EaUsGQXXa6CK6+DLRJk+McOeU YBbxIeySr2SZVv2Gh+hTJT0cx4HlpnD4HHjjVbqRDQfE1xFP1wux+IlCvnAd2Zj6CY8d JgakKdPCecXJzMWmYDOLQrxypJoEvh0u92/rtkLtLBcRMR6+mwI1Z+G860vyvls8oN/w bsW4Vr3MbUXiK3rVLe7aCvt1qslCiFKIwJG317/3MsoZOErYKrf8JdVmwNmq0VUBV423 SiAQ== X-Gm-Message-State: AOJu0Ywd9KBxtnPnLAz1Jp+MFqlKxsbcQokB8pLU6M+rVOmeWE9cOyax rILOm4ChzI6cjUHdyoumhn24mz8o9xOnAxnPMKU= X-Received: by 2002:a54:4103:0:b0:3a7:30cb:c092 with SMTP id l3-20020a544103000000b003a730cbc092mr1481350oic.48.1697523594051; Mon, 16 Oct 2023 23:19:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 80/90] target/sparc: Move FqTOs, FqTOi to decodetree Date: Mon, 16 Oct 2023 23:12:34 -0700 Message-Id: <20231017061244.681584-81-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x233.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 48 +++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1965084fb8..d890d97f12 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -261,10 +261,12 @@ FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 +FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 +FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 395674d901..3d073c8b22 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1626,20 +1626,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_FQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_ptr)) -{ - TCGv_i32 dst; - - gen_op_load_fpr_QT1(QFPREG(rs)); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_DQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i64, TCGv_ptr)) { @@ -4869,6 +4855,30 @@ static bool do_env_qq(DisasContext *dc, arg_r_r *a, TRANS(FSQRTq, ALL, do_env_qq, a, gen_helper_fsqrtq) +static bool do_env_fq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_env)) +{ + TCGv_i32 dst; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + dst = gen_dest_fpr_F(dc); + func(dst, tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FqTOs, ALL, do_env_fq, a, gen_helper_fqtos) +TRANS(FqTOi, ALL, do_env_fq, a, gen_helper_fqtoi) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5150,11 +5160,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0xc8: /* fitod */ case 0xc9: /* fstod */ case 0x81: /* V9 fstox */ - g_assert_not_reached(); /* in decodetree */ case 0xc7: /* fqtos */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_FQ(dc, rd, rs2, gen_helper_fqtos); - break; + case 0xd3: /* fqtoi */ + g_assert_not_reached(); /* in decodetree */ case 0xcb: /* fqtod */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtod); @@ -5171,10 +5179,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); break; - case 0xd3: /* fqtoi */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_FQ(dc, rd, rs2, gen_helper_fqtoi); - break; #ifdef TARGET_SPARC64 case 0x3: /* V9 fmovq */ CHECK_FPU_FEATURE(dc, FLOAT128); From patchwork Tue Oct 17 06:12:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734324 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326156wro; Mon, 16 Oct 2023 23:27:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWeRjFA5xypaUI2GhlkSi+JWNecu8q0ZQP79YIjU8yc7tu6pzttF+l/3Jheclsuibsb+Zh X-Received: by 2002:ac8:7c55:0:b0:41c:157a:6869 with SMTP id o21-20020ac87c55000000b0041c157a6869mr659895qtv.13.1697524024818; Mon, 16 Oct 2023 23:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524024; cv=none; d=google.com; s=arc-20160816; b=JiEdWKECQOGolbfpl8HxykyhITcPcuHPqIYeojLZRpqQx98kcmp73+W/+0TsDsYe8O MAqdcyBu59TDGWktpCEDaw9YGTS0njFJRZERifcPboaHmi8DdRsynPOmkjTZfxsnjX/f 7HWIbarLxPqHvIfzCpqxBGayLXY682i8D8NC9/FTQ8lp063owvdQsTt7nyqa68+HnlZy vUt0pOse2W5D5crCo5llsDs3HALe0mmTgMIvUAoExA5DsuGHR1xACAN4IcFdStRvMQAC 2jfSM9i2FqjmvH7dXph2rLo/evHGV4iUdfyb1kyXO/gg2NANjo3qlpGRLasZ9RDJNeba V2mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=gpV7NV2fb6Fg7/mV9avD2pYgApmI6/Iok+MPeSBfXOk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ABf6YL45P0ZFZQCwn0nNZNDLLRgiOV/PlvbmP0c+BGURFZetg10D49evbW0y6RyNoG hOrdlHcifuqoMAURMZkWB3UPmb5goc6T4y3RaNUoenSzahmdn/JZ9kHFdQ3FumaCKBy6 siolwQAYQ7Uo7p2kyCgJE7o+pOfUKcTC+1zVPIMTYX3DWpxNFLdSmbCfoOB92sOYjTAA APLDxKMLFipD2YA9QC5MAd8xYDJQi7alWt45elZT425puGdfC++Gkrhlntif9G8FUd4Q L0T+bdnD2E/ZW2FKDBSa2MlijNNmzo5RQZ9VDw7+9UWb+1qzUa4OJk/b8mGnFdZ1D2Z9 Y0lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WJ9yJhPL; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z7-20020a05622a028700b00419563029b5si668528qtw.351.2023.10.16.23.27.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:27:04 -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=WJ9yJhPL; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRo-0005hd-G1; Tue, 17 Oct 2023 02:20:56 -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 1qsdR2-0003iL-Mp for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQq-0005Bv-5t for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:19:57 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6b44befac59so2672894b3a.0 for ; Mon, 16 Oct 2023 23:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523595; x=1698128395; 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=gpV7NV2fb6Fg7/mV9avD2pYgApmI6/Iok+MPeSBfXOk=; b=WJ9yJhPLShlvtwhxPk4fH9eRoHrg24Yph87chXMansCP6RvBc3Cj3IZyft+sBCawkz 4kVU+dEh+d9a8N9Yw7zcgMTsGr5e1zVRF72qtTp4q0iPwgwCMaX8Cg5Tma7/GivlktRn fahJdCuXccuG4XDrnUPt3EwopqrazXX9UI2VZ/pEtmkT3dcecrZoKJtZE8W8TUNq1LUp k7Rad88NMQC9pOg3sLVNevVER8YVSj1yVt+RbBSM0BcZWlbPWC0n7JLyoB5lpy2tDPIk dY39CA32zwi9fDh1vWMZ3y2g0FIsXmVN2jfu3b2jmQF0bIyKSAFUmeXmHp6vLfud3F3v 1APg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523595; x=1698128395; 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=gpV7NV2fb6Fg7/mV9avD2pYgApmI6/Iok+MPeSBfXOk=; b=wUa2f7qh2VCxwZ1E/VQ618edxdnXWL5FLQvZ5KN9VJLsEaY91hHl3HkgQQJCjR6XD8 h8zApgyARJioXzjPKySTOhFexg1YNatN/f27GBERKPL5A/Np3GbjpjX+NfIdMXeMgOOX 1fCImzRRYA+mhgOygwpUKxvoLvGG9XRkEhQA4zteMY0zBYyvfqCD0p0KYrmurHwEL+Rc F/w0lfDsfv0/zB1YecbwSC+xTQhowJhFZ5mBgeedHhHZ/0uu6El8YUe9D84udvca0AoX iwt7EqTG/qEHs9gfFMFaJZ4soNsGpWrhqueB547FTLYL0h9sEd/NFwo0P6TiN+RqvHND ulYw== X-Gm-Message-State: AOJu0Yw6oxHFnaXHz9bm6KchCgd72Z1oWxJthTeNkhHFEEhNkrq7X+Ig D9Z1ab+fO+l2jI4ZI+4ilAbH9/qhzrdyBr2AD9k= X-Received: by 2002:a05:6a20:54a6:b0:161:aef5:6395 with SMTP id i38-20020a056a2054a600b00161aef56395mr1243652pzk.24.1697523594713; Mon, 16 Oct 2023 23:19:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 81/90] target/sparc: Move FqTOd, FqTOx to decodetree Date: Mon, 16 Oct 2023 23:12:35 -0700 Message-Id: <20231017061244.681584-82-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 49 +++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d890d97f12..249f03a075 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -257,6 +257,7 @@ FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FsTOx 10 ..... 110100 00000 0 1000 0001 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FqTOx 10 ..... 110100 00000 0 1000 0011 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 @@ -264,6 +265,7 @@ FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 +FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 3d073c8b22..a0506a91f0 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -55,6 +55,7 @@ #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fstox ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fqtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() @@ -1626,20 +1627,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_DQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr)) -{ - TCGv_i64 dst; - - gen_op_load_fpr_QT1(QFPREG(rs)); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_ne_fop_QF(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr, TCGv_i32)) { @@ -4879,6 +4866,30 @@ static bool do_env_fq(DisasContext *dc, arg_r_r *a, TRANS(FqTOs, ALL, do_env_fq, a, gen_helper_fqtos) TRANS(FqTOi, ALL, do_env_fq, a, gen_helper_fqtoi) +static bool do_env_dq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_env)) +{ + TCGv_i64 dst; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + dst = gen_dest_fpr_D(dc, a->rd); + func(dst, tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FqTOd, ALL, do_env_dq, a, gen_helper_fqtod) +TRANS(FqTOx, 64, do_env_dq, a, gen_helper_fqtox) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5162,11 +5173,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x81: /* V9 fstox */ case 0xc7: /* fqtos */ case 0xd3: /* fqtoi */ - g_assert_not_reached(); /* in decodetree */ case 0xcb: /* fqtod */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_DQ(dc, rd, rs2, gen_helper_fqtod); - break; + case 0x83: /* V9 fqtox */ + g_assert_not_reached(); /* in decodetree */ case 0xcc: /* fitoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QF(dc, rd, rs2, gen_helper_fitoq); @@ -5192,10 +5201,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); break; - case 0x83: /* V9 fqtox */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); - break; case 0x8c: /* V9 fxtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); From patchwork Tue Oct 17 06:12:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734305 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324699wro; Mon, 16 Oct 2023 23:22:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8uvpMx/3LKFI0HpK0rWLWc6t/5omtCyBiiusLXmYThA5FmWdjKa6JsKg9mTTXmzdFywFG X-Received: by 2002:a05:622a:1787:b0:418:76c7:52ab with SMTP id s7-20020a05622a178700b0041876c752abmr1712741qtk.52.1697523757276; Mon, 16 Oct 2023 23:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523757; cv=none; d=google.com; s=arc-20160816; b=gC9n9RRacX7Jei6NdyJhs6HZymEMfiq5mNTSXdmBzN3DSjsjn/mzrqkj7xp/xZAKJC Py6Qp/283kG5XCA2FcngJINcFfWKsbQ+Vj5B4HTaINRubMD+k3T6MZqcfees4ag+eGzS 8LhUFG12gwkUivmqnTAQp3C5Oi14dEAFOGJdGrBfU0vFRiFNbVvh1gMGtK3iLwXBmVLZ /lrqKbuCaCwUz4OhSoCgoE7d/5hXs4vkkYpOrmtriH/eAEpF3Bdgg6TTY5xqdtY4a2Gz 3Fx2LGqtcolybL6ofjmcLDsvoyX/hXe2AlfMnpBKyE3C/e6w46gIszF06iKBFOXLBXgZ hPTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=5OjJ5AiU0xH1P7f5G96IVpR77EbKjVVCmfo3WnB7jEk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=MLIAd/wrV+cbkz2UTa5k+giHzLxQWnZh8gj+cyTKKVYa4EvVvLHcKa+HwyrQqoIt/e EN+7Q9v6n6AnMFWvkBL9xotr6IyHuan5VXzwI+ge433PtBKyIS+0XTQyl1nh5E9PLl37 G+ssslUGJeqJJTPkeS4GJHKDsc7iUqp659bOA9n2p2tP7deEfvqWG+uQucHRqzh2iq4b c+f5J1Fz3TzWhaiebE8mcY0lpqLHizCS6TPsKcCwCbxAIRyT44t03/+FvZfYt+U2lHgA ZV8JV3dbhJJXDaO+rOanbubugs8ih6czQRTMk0DlPudWh642nVMgOeivBftlK8Jo0HWV k3xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sd3iGbSA; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p12-20020a05622a00cc00b00419842fb21csi644586qtw.488.2023.10.16.23.22.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:22:37 -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=sd3iGbSA; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRw-0005yy-B7; Tue, 17 Oct 2023 02:21: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 1qsdR2-0003ip-Sd for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQq-0005CB-Rq for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:19:58 -0400 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3ae2896974bso3333682b6e.0 for ; Mon, 16 Oct 2023 23:19:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523595; x=1698128395; 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=5OjJ5AiU0xH1P7f5G96IVpR77EbKjVVCmfo3WnB7jEk=; b=sd3iGbSATMxPFFmfTr62O0QGrotYI9idbpZLflhA1pyELYN8UuyLJYnES1gZjPOH7p F5B1pd6m3QVqChGbAV3DvwXS3BINXQf9U2flBzIAmCmCiWDHNFBZRgZfeOWhkjFBQgHF X3x8XW1HJIX6dXaMK5GI2r1nhHSrwyEgj5UPrmJSxCUNvEPIUCtC6S161+2sEapjRNCO ulTDLxT5gR54/2S8PIt3y6Kc087LCl26v1pJXjUTdMrZjZ/OdUCGYR3o4M5QEWx/OAq1 yb2qcj6ISHmSbp58Ir1Y7GFi5YfcU9pm59HxuvxjtNg3qoh3gABM4kT23bZYTny9eW/3 PhqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523595; x=1698128395; 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=5OjJ5AiU0xH1P7f5G96IVpR77EbKjVVCmfo3WnB7jEk=; b=FBgBQyMvDruhy19bGI+9yCWIS2I26Fa9xHvC9wc1OS1rKj3PRgzzJqI5z/wJ4wrqIK AyTQdzbERL+m0HrrPdGt/QIInTFOe4XjqW7ZKJ8DxKLWyTcOuXK0fO0tV2kR8g5OjUuD 6bFKH8A9UIf6VvdQcFA839ohvRvvUce9mgOXXqJjHkbsvHLRyRiWhx4jqThX9wzJ4mj9 6Qr14GTodBU8qNv3MsUM+PZ9roL7P0zpNa9aSzkLVsNK/Oo//DuZiy/UyjAhKFAfan3j Ge9iEgks5u0w15cPD1UDhX+rU1UUEKjX89m1bV3cZyAv5b3lT+wEahwVqEch8kRPPST/ U0hA== X-Gm-Message-State: AOJu0Yy+x0Wl54wjgehTuYC4n4Lg+VoBx1BrClo/YXPFftTkXaRdt2o3 KOlnl/bf6RZx+E1v2glAwdEfgTF9Gv8CTta2ciQ= X-Received: by 2002:a05:6808:30a2:b0:3a8:1c07:17d3 with SMTP id bl34-20020a05680830a200b003a81c0717d3mr1941995oib.19.1697523595569; Mon, 16 Oct 2023 23:19:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 82/90] target/sparc: Move FiTOq, FsTOq to decodetree Date: Mon, 16 Oct 2023 23:12:36 -0700 Message-Id: <20231017061244.681584-83-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x230.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 44 +++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 249f03a075..0b54384af7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -266,6 +266,8 @@ FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 +FiTOq 10 ..... 110100 00000 0 1100 1100 ..... @r_r2 +FsTOq 10 ..... 110100 00000 0 1100 1101 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a0506a91f0..ecaf1c02bd 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1627,19 +1627,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_ne_fop_QF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr, TCGv_i32)) -{ - TCGv_i32 src; - - src = gen_load_fpr_F(dc, rs); - - gen(tcg_env, src); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - static void gen_ne_fop_QD(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr, TCGv_i64)) { @@ -4890,6 +4877,29 @@ static bool do_env_dq(DisasContext *dc, arg_r_r *a, TRANS(FqTOd, ALL, do_env_dq, a, gen_helper_fqtod) TRANS(FqTOx, 64, do_env_dq, a, gen_helper_fqtox) +static bool do_env_qf(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env, TCGv_i32)) +{ + TCGv_i32 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src = gen_load_fpr_F(dc, a->rs); + func(tcg_env, src); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FiTOq, ALL, do_env_qf, a, gen_helper_fitoq) +TRANS(FsTOq, ALL, do_env_qf, a, gen_helper_fstoq) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5175,15 +5185,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0xd3: /* fqtoi */ case 0xcb: /* fqtod */ case 0x83: /* V9 fqtox */ - g_assert_not_reached(); /* in decodetree */ case 0xcc: /* fitoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QF(dc, rd, rs2, gen_helper_fitoq); - break; case 0xcd: /* fstoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QF(dc, rd, rs2, gen_helper_fstoq); - break; + g_assert_not_reached(); /* in decodetree */ case 0xce: /* fdtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); From patchwork Tue Oct 17 06:12:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734328 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326474wro; Mon, 16 Oct 2023 23:28:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBnlYTEg2HvNg5w3mNH94I7S6iApem7896kfyoFHgzsxTuU/iCIXYlsmG7JUpXYVQxb1em X-Received: by 2002:a05:622a:144a:b0:418:1071:7303 with SMTP id v10-20020a05622a144a00b0041810717303mr1723268qtx.31.1697524095496; Mon, 16 Oct 2023 23:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524095; cv=none; d=google.com; s=arc-20160816; b=TD9R31HWzCCS4RuiNrD1BaPitPAYUShoCiwMYJdB15jTKfFgol85uzXnyKgtkdTDBQ KmgF37xB+CXdxrx1fbKtj9VebjueaWpopPxZf+uuMwaIrrTfeMDJxIPdnwR9sR2gG7kw 09uwKmpKioJrNTp6SEyyKYzLxng09Mnmnvarf1P45ve02zcfC9wDNwsVnj+NT1HI3l06 z8Guf3iEGs34rL3BM90lRasrpxY6K3Wg59r9WTcbTXw4veKJZlFiAcY7P2AuIpYeWTZW q9FmoWK0FSXtu6JPczJzl+BPTncck1xNm4cp5bopEReanJ3TYNE63MZdsHG/zR4UKz49 oBXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=dyhf1sFdL+iqlmxAPOZlXhlHFKLevrlBgIAJcJ46gCw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=zLYbD7zWPL681qwWM0kocTzeCq+tz0cYMecAkWjgpCGc/MqoxDbpchFqLYpywlHN6y 4NM6eaiJHS/w6vKPkN5aV+y+CkpJXEorOfJQTKY00OBJXIJD3QEsO0uECT0SIm2Jt7EN qet+83UpLaXTV73JxtYdmsSnCeTm0d4QZoKzP6WDkkab6Tv1oGF6vjyrJisCdsHZND2x /n33B2ttMkx7K3FD5yvRFtDG3+PDDzZS9MxIIzKzkVOvE5uRpP21tu7H9Y2HJW0pFYgd YaGqT4MDgtVIEjJ15Fwu5RZgaZyGKv87frVCWUoAgEIfJ1/NJP60Gjna3yLb3e04yNhE mwpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lJsip3q3; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b10-20020a05622a020a00b00417fa4d4ffcsi680567qtx.104.2023.10.16.23.28.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:15 -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=lJsip3q3; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRq-0005oe-K7; Tue, 17 Oct 2023 02:20:58 -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 1qsdR2-0003jB-TA for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0: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 1qsdQr-0005CL-MH for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:19:59 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3ae2f8bf865so3319152b6e.2 for ; Mon, 16 Oct 2023 23:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523596; x=1698128396; 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=dyhf1sFdL+iqlmxAPOZlXhlHFKLevrlBgIAJcJ46gCw=; b=lJsip3q3ZctrtOGwES5bN4a1uleJo46gyC5IkqXFExk3o/GoU9UT4OuDIUop7y7/1X tH+8ruzZWjNF3mGBOOu7qrrX2VJ24V7hbMdOKVcF2GRFafQQXECDWcM2Iek9YoXJ3F8m i3Czwgu/q3922BRSYjd75raUW9VEMQyIMyJyYIKQyNpjvjBotUtlLEmj5frL62WDabsV LAOKy8T2t2OtMw9YeXHFmhJiZWaJPIolC43o3Cjm/nvoy2otGjEXosyRzDnm6nkDOEpN v9M5qmTi1uVa94nol+JBAerBSW9V5hZInQZOehoO89IjmvIk/jxz9G7NR4THzEAo6EhR oV7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523596; x=1698128396; 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=dyhf1sFdL+iqlmxAPOZlXhlHFKLevrlBgIAJcJ46gCw=; b=wULgIpytAAlL9brtSBTPpCzDq/jCf6pruX7+bd9iMoHWhQNVZHposdPQCDlplhJHz8 M6xsm8bfFPJtc57xGqNFOJV4IEJnA+Te3V0KET4ow6g1jM1bInAOLTq1xEUy2E+D/Oxa dQvLLOIrw6KG1ejw+YnplP0qzr1yVSPxyvI92RBD8ImxyCMMf2+BSlOXKaTM4rBTOrl1 CO5eqb4O2PoZr6hKcbNGUEqYjJ5jDTEU8VrnZMeLHmX660leDDA4Rwbt/YCpMg1luj8r 0zXTVqFW53nBH5z/QDb2PHZW5RJ0li61oJ8HXa2yDQQ+ax0IzTcqp8O21LOxOI0Qj3DG 8i0A== X-Gm-Message-State: AOJu0Yx2zpbW7YggvB0Z1VU30P0wWzl2sjJs09Am4+KN/l4KegG+PMBt BlBBwvD/j26HhRiH2/3ySuXVo33dsegYQMqOyMs= X-Received: by 2002:a05:6808:42:b0:3a8:4dfd:4f02 with SMTP id v2-20020a056808004200b003a84dfd4f02mr1418886oic.11.1697523596372; Mon, 16 Oct 2023 23:19:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 83/90] target/sparc: Move FdTOq, FxTOq to decodetree Date: Mon, 16 Oct 2023 23:12:37 -0700 Message-Id: <20231017061244.681584-84-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 47 ++++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0b54384af7..0bb5b3fca6 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -260,6 +260,7 @@ FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FqTOx 10 ..... 110100 00000 0 1000 0011 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 +FxTOq 10 ..... 110100 00000 0 1000 1100 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 @@ -268,6 +269,7 @@ FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 FiTOq 10 ..... 110100 00000 0 1100 1100 ..... @r_r2 FsTOq 10 ..... 110100 00000 0 1100 1101 ..... @r_r2 +FdTOq 10 ..... 110100 00000 0 1100 1110 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ecaf1c02bd..86d77c62da 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,6 +58,7 @@ #define gen_helper_fqtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fxtoq ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -1627,19 +1628,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_ne_fop_QD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr, TCGv_i64)) -{ - TCGv_i64 src; - - src = gen_load_fpr_D(dc, rs); - - gen(tcg_env, src); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -4900,6 +4888,29 @@ static bool do_env_qf(DisasContext *dc, arg_r_r *a, TRANS(FiTOq, ALL, do_env_qf, a, gen_helper_fitoq) TRANS(FsTOq, ALL, do_env_qf, a, gen_helper_fstoq) +static bool do_env_qd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env, TCGv_i64)) +{ + TCGv_i64 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src = gen_load_fpr_D(dc, a->rs); + func(tcg_env, src); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FdTOq, ALL, do_env_qd, a, gen_helper_fdtoq) +TRANS(FxTOq, 64, do_env_qd, a, gen_helper_fxtoq) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5187,11 +5198,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x83: /* V9 fqtox */ case 0xcc: /* fitoq */ case 0xcd: /* fstoq */ - g_assert_not_reached(); /* in decodetree */ case 0xce: /* fdtoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); - break; + case 0x8c: /* V9 fxtoq */ + g_assert_not_reached(); /* in decodetree */ #ifdef TARGET_SPARC64 case 0x3: /* V9 fmovq */ CHECK_FPU_FEATURE(dc, FLOAT128); @@ -5205,10 +5214,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); break; - case 0x8c: /* V9 fxtoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); - break; #endif default: goto illegal_insn; From patchwork Tue Oct 17 06:12:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734311 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp324919wro; Mon, 16 Oct 2023 23:23:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOfP1uVfOudWdZqedHb0EmGpoiYanboH2wm4oJxfYK/2USEhFb8if/jC9Kg2msG2RoTLt1 X-Received: by 2002:a05:6214:519b:b0:66d:1540:f9ef with SMTP id kl27-20020a056214519b00b0066d1540f9efmr1692049qvb.44.1697523803072; Mon, 16 Oct 2023 23:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523803; cv=none; d=google.com; s=arc-20160816; b=gaEftWMwAhPAEjyEJfCxH55CuNp6T1daqhyhZzrUUD7ozdIKgCM85VmFV0Nf03Xt5b JJDBljOeOwnh8FmWXBUrFzMS3/mLMbwYCbwRk6IdxCKzdgQL1cir9Jj/hK8CSr/W7k5S WGaPPhO0cmRr8hiy3pFw31PupYRyC5kytj9NRRA1ikmASUxnYH5TItNajLy+2S3uVk9M +T/TYSgyBMyhZKXgDLkAHbROf6Z56Wwx46J1bwEo97IovsEYy4FspbNW4WdvJNvnUeK4 RIa1eshlotYbFa2pLvsCmqBxOacauBa3LvVuy99efIiaYrnOaWaNKyaMDmrzwfD1cMEp onhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=DseVKorTkSLFql65Rc2lxOSAnW8/3GevChwFxK10D3Q=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=XQlc8gf4eQ6mzLdEbYUnfY2iq3lPW8G/Ifrrs/Q+kjN1FQptDQUqlozjqESeLsNaBf fEDRm9A1fXY2qnXNNbnhhGnj8OrEHRb8ppWxqIxRsW+DTMV0Sq6qoIlZg0u/K+PsMYBU TvN2TBV9obdJiTgDhwVb74MNE3e9l4uQ5x0V4iOOBAvJA2dPNrRNTWF2UWGK8LHSKxIp eGlBNDqUwuoVUUWG1nIu4NaCVPUUkQHHwM8E76NHkvJfAtNq1TBSqq1cRhzNfwP1EN27 5u+7ZKUbPwg7G8pK5t4yFUhIo/+mVqPOYCAZq4qYzL3OoFKfXm0TkJGBUj88UqbpELvu DQ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=syP3A2sB; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l11-20020ad44bcb000000b0065b0161a263si539959qvw.27.2023.10.16.23.23.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23: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=syP3A2sB; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRp-0005kS-HL; Tue, 17 Oct 2023 02:20:57 -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 1qsdR3-0003jh-5N for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQt-0005Ci-CK for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:01 -0400 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3b2bd27f203so1704480b6e.3 for ; Mon, 16 Oct 2023 23:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523597; x=1698128397; 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=DseVKorTkSLFql65Rc2lxOSAnW8/3GevChwFxK10D3Q=; b=syP3A2sBJNSq9ky5IUekmBnAUF4CMGum5ZkqkbAHiQ2EHg5N6VhypdH36q3uDWv4Sz 8eDhO4DJRxU9FNj2EsfW5ao6fLQ/BSTRAx/30aRf0awp/C2qlU1zfvnGqrqfhS9k+Zfm oVHeHL0KFlWDhNGTzaV6uDw3HZMjiPOT91Aed6EDI6x740d4GYimp4Z4CFzbfSwmF+v4 xeukmezCHMGi8JDT9lkUtVLD6d+SAadZuVFjmt+3hUSIHgc+bN7wIAuv9XWRm3irZl+8 Z/wHI66GUes5bZcCVugqJEP1XAdoX0S1Fu10lf+4x2kgsdmv1iDJxlFJ0lFXrIk1EunB hgnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523597; x=1698128397; 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=DseVKorTkSLFql65Rc2lxOSAnW8/3GevChwFxK10D3Q=; b=mN//eNrOHa+TcmvGM3lJTy+JDdvYJBchrfckUSKCWHSt5ciFTOG5ptnMyRxIGseXsJ GjbNZJWeo3J0jucR5k3A6iqwMuAftCpf6HOANMvNYzefcFnbcnOMzgPG4hTo58M/6Ksm Ec3ioBAkIEZvjCpt8jcwQ27UwLlY7ThOINarpEH5x+f6k2vtKMhNPpf2HGfyBO6WLnlb 2UCNLq5vYQ2eHWQQemgKlUqhXEW1WGsLLSf5ZEWsKFI8G9rSNLgoFm5fHfgbMmmiCwxG fXqIjfCxEBn5xleng+rWyJ6hrvy4i5ZuXFQ9V/yNuXcjtdeaX7Dyjn8WEjOOLucm1VmW gwxQ== X-Gm-Message-State: AOJu0YyaxRRtOjDnkvB6tbSxvMBiM5ePwnEbCmzf6sl+Wye+HTnaZWDF p80xb8MYJBszAHJ5y+vkPIbP6h/y9+DhR1bK2dI= X-Received: by 2002:a05:6808:2116:b0:3ae:132a:e7ae with SMTP id r22-20020a056808211600b003ae132ae7aemr1800537oiw.27.1697523597055; Mon, 16 Oct 2023 23:19:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 84/90] target/sparc: Move FMOVq, FNEGq, FABSq to decodetree Date: Mon, 16 Oct 2023 23:12:38 -0700 Message-Id: <20231017061244.681584-85-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x236.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 + target/sparc/translate.c | 140 +++++++++++++------------------------- 2 files changed, 50 insertions(+), 93 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0bb5b3fca6..23db453617 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -234,10 +234,13 @@ RETRY 10 00001 111110 00000 0 0000000000000 FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 FMOVd 10 ..... 110100 00000 0 0000 0010 ..... @r_r2 +FMOVq 10 ..... 110100 00000 0 0000 0011 ..... @r_r2 FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 +FNEGq 10 ..... 110100 00000 0 0000 0111 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 +FABSq 10 ..... 110100 00000 0 0000 1011 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 86d77c62da..7baf8f5cff 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -59,6 +59,8 @@ #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtoq ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fabsq ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fnegq ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -271,18 +273,6 @@ static void gen_op_store_QT0_fpr(unsigned int dst) offsetof(CPU_QuadU, ll.lower)); } -#ifdef TARGET_SPARC64 -static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) -{ - rd = QFPREG(rd); - rs = QFPREG(rs); - - tcg_gen_mov_i64(cpu_fpr[rd / 2], cpu_fpr[rs / 2]); - tcg_gen_mov_i64(cpu_fpr[rd / 2 + 1], cpu_fpr[rs / 2 + 1]); - gen_update_fprs_dirty(dc, rd); -} -#endif - /* moves */ #ifdef CONFIG_USER_ONLY #define supervisor(dc) 0 @@ -1615,19 +1605,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -#ifdef TARGET_SPARC64 -static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr)) -{ - gen_op_load_fpr_QT1(QFPREG(rs)); - - gen(tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} -#endif - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -4796,6 +4773,50 @@ TRANS(FiTOd, ALL, do_env_df, a, gen_helper_fitod) TRANS(FsTOd, ALL, do_env_df, a, gen_helper_fstod) TRANS(FsTOx, 64, do_env_df, a, gen_helper_fstox) +static bool trans_FMOVq(DisasContext *dc, arg_FMOVq *a) +{ + int rd, rs; + + if (!avail_64(dc)) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + rd = QFPREG(a->rd); + rs = QFPREG(a->rs); + tcg_gen_mov_i64(cpu_fpr[rd / 2], cpu_fpr[rs / 2]); + tcg_gen_mov_i64(cpu_fpr[rd / 2 + 1], cpu_fpr[rs / 2 + 1]); + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +static bool do_qq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env)) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + func(tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FNEGq, 64, do_qq, a, gen_helper_fnegq) +TRANS(FABSq, 64, do_qq, a, gen_helper_fabsq) + static bool do_env_qq(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_env)) { @@ -5150,74 +5171,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); if (xop == 0x34) { /* FPU Operations */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_op_clear_ieee_excp_and_FTT(); - rs1 = GET_FIELD(insn, 13, 17); - rs2 = GET_FIELD(insn, 27, 31); - xop = GET_FIELD(insn, 18, 26); - - switch (xop) { - case 0x1: /* fmovs */ - case 0x5: /* fnegs */ - case 0x9: /* fabss */ - case 0x2: /* V9 fmovd */ - case 0x6: /* V9 fnegd */ - case 0xa: /* V9 fabsd */ - case 0x29: /* fsqrts */ - case 0xc4: /* fitos */ - case 0xd1: /* fstoi */ - case 0x2a: /* fsqrtd */ - case 0x82: /* V9 fdtox */ - case 0x88: /* V9 fxtod */ - case 0x2b: /* fsqrtq */ - case 0x41: /* fadds */ - case 0x45: /* fsubs */ - case 0x49: /* fmuls */ - case 0x4d: /* fdivs */ - case 0x42: /* faddd */ - case 0x46: /* fsubd */ - case 0x4a: /* fmuld */ - case 0x4e: /* fdivd */ - case 0x43: /* faddq */ - case 0x47: /* fsubq */ - case 0x4b: /* fmulq */ - case 0x4f: /* fdivq */ - case 0x69: /* fsmuld */ - case 0x6e: /* fdmulq */ - case 0xc6: /* fdtos */ - case 0xd2: /* fdtoi */ - case 0x84: /* V9 fxtos */ - case 0xc8: /* fitod */ - case 0xc9: /* fstod */ - case 0x81: /* V9 fstox */ - case 0xc7: /* fqtos */ - case 0xd3: /* fqtoi */ - case 0xcb: /* fqtod */ - case 0x83: /* V9 fqtox */ - case 0xcc: /* fitoq */ - case 0xcd: /* fstoq */ - case 0xce: /* fdtoq */ - case 0x8c: /* V9 fxtoq */ - g_assert_not_reached(); /* in decodetree */ -#ifdef TARGET_SPARC64 - case 0x3: /* V9 fmovq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_move_Q(dc, rd, rs2); - break; - case 0x7: /* V9 fnegq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fnegq); - break; - case 0xb: /* V9 fabsq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); - break; -#endif - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } else if (xop == 0x35) { /* FPU Operations */ #ifdef TARGET_SPARC64 int cond; From patchwork Tue Oct 17 06:12:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734333 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326564wro; Mon, 16 Oct 2023 23:28:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFE8ICo32KVaYTfy3RnPDiNBM4/9QyEDQea2ZC8o6RBytLxSgocsgPvAfJV5KO860JtT1UI X-Received: by 2002:a05:6214:260d:b0:66d:4b1f:e121 with SMTP id gu13-20020a056214260d00b0066d4b1fe121mr1883367qvb.40.1697524115630; Mon, 16 Oct 2023 23:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524115; cv=none; d=google.com; s=arc-20160816; b=JAXvxjIgUub478agQ+rJZtSen0XHVUrZuLrPyySlLE2MQRsdDezLbZBQCMEGeGRmMI NCfY5hOf/7JNHpTYOqfsmeP3x9S5DsIas2p+OxcgGzDO3bNm2iFdN99YwfjKWhrII3Rq /aOTvhmgjweX/EXGy+UpPhpiBUF3heVudq3WX6sVBHff6OBI9/TuDde/uNEFJnwG69sn ESKSA8CC4dmwDEVX+RdAvoRaxVy9N68lifHT0J4IAlw5w5aMMuTtRDSbecpUkBJx/oPM JujRYkSklgn42bZwGgVL9xx1uh3f5x2/SMZnrAkK2CalX+NlwgvTRRGb9KJPah3NE8dH 6hWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=5QeMUw78p/tJHUkNOYbpeaMRVGvJ9iRUUNxnjmV73p0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=zfE2dxH8TATxq/8vEogy5KpoDOmsZVVRd36VpH6HPBg28UHC6U0FyqWECswL3wUQRh yeUW4alO137TJe4dK/sOa5TzpIBLO0BptM9+6R6Lf0eivNlUqSX6ZL/ufgdernQ/M9fE hZNwr8mDA3J+/V/NJ7lbkf/N4tQ3atogQi52zF01iZXkW/l0jmnEGsXNq8K9cXpLYwlc t91uW4onpyA/arVx1iyggBDNdNzvhVpvOLED9m9qwHgKzG/4CoD8NNUKfwD+zRzRsdK0 NkuVn8wUd++pjevgPtt+YHYQECWNl1o1WaOaVekpySmIS0m4do7YcScVJ9dGsC9527yP MkAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RcQ37R/d"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z2-20020a0ce982000000b0065b2e9cee3fsi526141qvn.492.2023.10.16.23.28.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:35 -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="RcQ37R/d"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRu-0005x7-Pw; Tue, 17 Oct 2023 02:21:02 -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 1qsdR3-0003lE-9e for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQt-0005Cw-CX for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:05 -0400 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6c4fc2ce697so3738955a34.0 for ; Mon, 16 Oct 2023 23:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523598; x=1698128398; 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=5QeMUw78p/tJHUkNOYbpeaMRVGvJ9iRUUNxnjmV73p0=; b=RcQ37R/dad21Mo7gNt/SGTcOhQLT+DlIyEkzvYWIu//bV2aDBDJTr0szxhJwmQNJ60 hlGl9B5SJbOnzbGrPDBTfRVcMGxtgTKozM5qt9bgesRq0KLX9aTLn9nd8fGq+/r9Lj8k YCH6LFSdpdCerDd4XLve3/mrfxrOa72u3bIjTYQtpTa4UIsbpUA1zjH02KrSb0+Ty8hC nyP8nd5/NIds0/XYiqbhNpC8WoNLiez3JBu2td+ThwjI9OsSJ7twKY+a7QQ6k9u+2aRj 6lz25AhCORU7+k8k6t+IwWxQCjbQXpvT8Jwa2q8I393dMYcSwKGv0CIG2OOvu++F6dZ9 sbVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523598; x=1698128398; 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=5QeMUw78p/tJHUkNOYbpeaMRVGvJ9iRUUNxnjmV73p0=; b=Y1/eg9oZzYR325nJ/lTfffRuKkllOr1nFz6CU11PkgoOleJWmARB7FL9NvRHzumf7C GICaqWPchodDO4IN1+A2J9uP0Txmu6/iPW/S8ofQaVxNqhlL+k4DqJMjbby1X+9RRLV0 D1mi54eniASZXbxzT5GrY20rY0UchNqPCCTGsnGwRBBFMlAd19SJkN60bkWyWUT9ZVFy mTFnQkf5BGt9lleoDzi8lkBNziWQK4Koie9tIr76WB72ULzekOObJkzU45OCLgcSNnpe tAw7S+Bw8+r0qdAeTopTUAlsDZb5rcniRjiYFB7PoDHKHbGCUF+lo3qO6FJo3ISKsaDT K5nQ== X-Gm-Message-State: AOJu0YzxYXL5TJC6WtMYDrfTcWp6yFE3rHaDKWpGiS02ElOfAG0HnpyQ lXawhrfGPwVtJEWdcKjaa3apucQP65F4SOPM5R0= X-Received: by 2002:a05:6870:9e8f:b0:1e9:bc53:b78c with SMTP id pu15-20020a0568709e8f00b001e9bc53b78cmr1325438oab.8.1697523597825; Mon, 16 Oct 2023 23:19:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 85/90] target/sparc: Move FMOVR, FMOVcc, FMOVfcc to decodetree Date: Mon, 16 Oct 2023 23:12:39 -0700 Message-Id: <20231017061244.681584-86-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 12 +++ target/sparc/translate.c | 192 ++++++++++++++++---------------------- 2 files changed, 91 insertions(+), 113 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 23db453617..88d4b8529d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -277,6 +277,18 @@ FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 +FMOVscc 10 rd:5 110101 0 cond:4 1 cc:1 0 000001 rs2:5 +FMOVdcc 10 rd:5 110101 0 cond:4 1 cc:1 0 000010 rs2:5 +FMOVqcc 10 rd:5 110101 0 cond:4 1 cc:1 0 000011 rs2:5 + +FMOVsfcc 10 rd:5 110101 0 cond:4 0 cc:2 000001 rs2:5 +FMOVdfcc 10 rd:5 110101 0 cond:4 0 cc:2 000010 rs2:5 +FMOVqfcc 10 rd:5 110101 0 cond:4 0 cc:2 000011 rs2:5 + +FMOVRs 10 rd:5 110101 rs1:5 0 cond:3 00101 rs2:5 +FMOVRd 10 rd:5 110101 rs1:5 0 cond:3 00110 rs2:5 +FMOVRq 10 rd:5 110101 rs1:5 0 cond:3 00111 rs2:5 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7baf8f5cff..84b67ac1a8 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2381,15 +2381,9 @@ static void gen_stda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } -#ifdef TARGET_SPARC64 -static TCGv get_src1(DisasContext *dc, unsigned int insn) -{ - unsigned int rs1 = GET_FIELD(insn, 13, 17); - return gen_load_gpr(dc, rs1); -} - static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { +#ifdef TARGET_SPARC64 TCGv_i32 c32, zero, dst, s1, s2; /* We have two choices here: extend the 32 bit data and use movcond_i64, @@ -2412,19 +2406,27 @@ static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) tcg_gen_movcond_i32(TCG_COND_NE, dst, c32, zero, s1, s2); gen_store_fpr_F(dc, rd, dst); +#else + qemu_build_not_reached(); +#endif } static void gen_fmovd(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { +#ifdef TARGET_SPARC64 TCGv_i64 dst = gen_dest_fpr_D(dc, rd); tcg_gen_movcond_i64(cmp->cond, dst, cmp->c1, cmp->c2, gen_load_fpr_D(dc, rs), gen_load_fpr_D(dc, rd)); gen_store_fpr_D(dc, rd, dst); +#else + qemu_build_not_reached(); +#endif } static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { +#ifdef TARGET_SPARC64 int qd = QFPREG(rd); int qs = QFPREG(rs); @@ -2434,8 +2436,12 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) cpu_fpr[qs / 2 + 1], cpu_fpr[qd / 2 + 1]); gen_update_fprs_dirty(dc, qd); +#else + qemu_build_not_reached(); +#endif } +#ifdef TARGET_SPARC64 static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) { TCGv_i32 r_tl = tcg_temp_new_i32(); @@ -5140,6 +5146,72 @@ static bool trans_FdMULq(DisasContext *dc, arg_r_r_r *a) return advance_pc(dc); } +static bool do_fmovr(DisasContext *dc, arg_FMOVRs *a, bool is_128, + void (*func)(DisasContext *, DisasCompare *, int, int)) +{ + DisasCompare cmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (is_128 && gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); + func(dc, &cmp, a->rd, a->rs2); + return advance_pc(dc); +} + +TRANS(FMOVRs, 64, do_fmovr, a, false, gen_fmovs) +TRANS(FMOVRd, 64, do_fmovr, a, false, gen_fmovd) +TRANS(FMOVRq, 64, do_fmovr, a, true, gen_fmovq) + +static bool do_fmovcc(DisasContext *dc, arg_FMOVscc *a, bool is_128, + void (*func)(DisasContext *, DisasCompare *, int, int)) +{ + DisasCompare cmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (is_128 && gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_compare(&cmp, a->cc, a->cond, dc); + func(dc, &cmp, a->rd, a->rs2); + return advance_pc(dc); +} + +TRANS(FMOVscc, 64, do_fmovcc, a, false, gen_fmovs) +TRANS(FMOVdcc, 64, do_fmovcc, a, false, gen_fmovd) +TRANS(FMOVqcc, 64, do_fmovcc, a, true, gen_fmovq) + +static bool do_fmovfcc(DisasContext *dc, arg_FMOVsfcc *a, bool is_128, + void (*func)(DisasContext *, DisasCompare *, int, int)) +{ + DisasCompare cmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (is_128 && gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_fcompare(&cmp, a->cc, a->cond); + func(dc, &cmp, a->rd, a->rs2); + return advance_pc(dc); +} + +TRANS(FMOVsfcc, 64, do_fmovfcc, a, false, gen_fmovs) +TRANS(FMOVdfcc, 64, do_fmovfcc, a, false, gen_fmovd) +TRANS(FMOVqfcc, 64, do_fmovfcc, a, true, gen_fmovq) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5173,9 +5245,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) if (xop == 0x34) { /* FPU Operations */ goto illegal_insn; /* in decodetree */ } else if (xop == 0x35) { /* FPU Operations */ -#ifdef TARGET_SPARC64 - int cond; -#endif if (gen_trap_ifnofpu(dc)) { goto jmp_insn; } @@ -5184,110 +5253,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) rs2 = GET_FIELD(insn, 27, 31); xop = GET_FIELD(insn, 18, 26); -#ifdef TARGET_SPARC64 -#define FMOVR(sz) \ - do { \ - DisasCompare cmp; \ - cond = GET_FIELD_SP(insn, 10, 12); \ - cpu_src1 = get_src1(dc, insn); \ - gen_compare_reg(&cmp, cond, cpu_src1); \ - gen_fmov##sz(dc, &cmp, rd, rs2); \ - } while (0) - - if ((xop & 0x11f) == 0x005) { /* V9 fmovsr */ - FMOVR(s); - break; - } else if ((xop & 0x11f) == 0x006) { // V9 fmovdr - FMOVR(d); - break; - } else if ((xop & 0x11f) == 0x007) { // V9 fmovqr - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVR(q); - break; - } -#undef FMOVR -#endif switch (xop) { -#ifdef TARGET_SPARC64 -#define FMOVCC(fcc, sz) \ - do { \ - DisasCompare cmp; \ - cond = GET_FIELD_SP(insn, 14, 17); \ - gen_fcompare(&cmp, fcc, cond); \ - gen_fmov##sz(dc, &cmp, rd, rs2); \ - } while (0) - - case 0x001: /* V9 fmovscc %fcc0 */ - FMOVCC(0, s); - break; - case 0x002: /* V9 fmovdcc %fcc0 */ - FMOVCC(0, d); - break; - case 0x003: /* V9 fmovqcc %fcc0 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(0, q); - break; - case 0x041: /* V9 fmovscc %fcc1 */ - FMOVCC(1, s); - break; - case 0x042: /* V9 fmovdcc %fcc1 */ - FMOVCC(1, d); - break; - case 0x043: /* V9 fmovqcc %fcc1 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(1, q); - break; - case 0x081: /* V9 fmovscc %fcc2 */ - FMOVCC(2, s); - break; - case 0x082: /* V9 fmovdcc %fcc2 */ - FMOVCC(2, d); - break; - case 0x083: /* V9 fmovqcc %fcc2 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(2, q); - break; - case 0x0c1: /* V9 fmovscc %fcc3 */ - FMOVCC(3, s); - break; - case 0x0c2: /* V9 fmovdcc %fcc3 */ - FMOVCC(3, d); - break; - case 0x0c3: /* V9 fmovqcc %fcc3 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(3, q); - break; -#undef FMOVCC -#define FMOVCC(xcc, sz) \ - do { \ - DisasCompare cmp; \ - cond = GET_FIELD_SP(insn, 14, 17); \ - gen_compare(&cmp, xcc, cond, dc); \ - gen_fmov##sz(dc, &cmp, rd, rs2); \ - } while (0) - - case 0x101: /* V9 fmovscc %icc */ - FMOVCC(0, s); - break; - case 0x102: /* V9 fmovdcc %icc */ - FMOVCC(0, d); - break; - case 0x103: /* V9 fmovqcc %icc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(0, q); - break; - case 0x181: /* V9 fmovscc %xcc */ - FMOVCC(1, s); - break; - case 0x182: /* V9 fmovdcc %xcc */ - FMOVCC(1, d); - break; - case 0x183: /* V9 fmovqcc %xcc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(1, q); - break; -#undef FMOVCC -#endif case 0x51: /* fcmps, V9 %fcc */ cpu_src1_32 = gen_load_fpr_F(dc, rs1); cpu_src2_32 = gen_load_fpr_F(dc, rs2); From patchwork Tue Oct 17 06:12:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734336 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326692wro; Mon, 16 Oct 2023 23:28:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbCRzeTAOQmannBUyRI1FAjHvyy25ZSJwCAKKxzpfpLuTo0SUkr85g1zZw2EUBuQbUpoMr X-Received: by 2002:a05:6214:19eb:b0:66d:5dd7:e82a with SMTP id q11-20020a05621419eb00b0066d5dd7e82amr1813640qvc.5.1697524139516; Mon, 16 Oct 2023 23:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524139; cv=none; d=google.com; s=arc-20160816; b=F0fGO8Sr5ditlhn0SWHcRh3v7g/StBzcPqTDKSU3MWQaG1kF2EN7BuPS9u143Y7ABI 1QO8QectJu5I0LGSzLk3BZ4BsRhmL8OP9UVDBMs4s3xWGz/GWORrFr8v7I8p8J5wHLzo f9iSOgbg8GE5LjmldgBibOcTWWcrMC7pXTYiAqmKSdRgdeeVGRbO50B7/Y67BD+mXpD9 DW4xTMkZ48r9+XhTMjrO26c8P8f2wTQ5cRd6R+HUXqJtYjZIa7nT/2bbSOpb+NwZ0gvt t+mXsg0tQ+A72z3olG/g1J1RhPcRWNJLHDNqqSwNar+6rO6t6Gy/vK2l9mCGZ8njb294 /yjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=OsswZ4m+p5sHVQ4VqGmu5XdQhh8AvISCV+JisFOh8vc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=BzF3T5qsHTJvt+difnDci2HWA48aYKR9rIB0/TyaIm99sRpOcBuyHdA4P+2+9W4sEj xwW3UnaNkkGLy/hQv6jm2Lu5h/VQWSe2sao05X20Cf4yC/wIwy1ZKH7fQ1cz6Qbj0bq9 lBpgu0wDB7inGbmE8SKmwN71Wx37eyWIIOpxDgUHvI1pwVL0iqj4z3nrB/pI2Zjw2jCv l5rGvKqEBNho9EFPQfW25J26ZuPOj5gfZoLcSyHTN7JJZkF4aGoAiImaJ3KgqqeFZa8k KVTWoePZdbj0YWkATK0cyUi5PN8xyOPOqTEYjBnuTFEGyTG2eIk8URcAkynAPYjWpOHp c24Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=msh+iPmp; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pa23-20020a05620a831700b007743658a2besi590611qkn.499.2023.10.16.23.28.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:28:59 -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=msh+iPmp; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRv-0005va-5N; Tue, 17 Oct 2023 02:21:03 -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 1qsdR3-0003kx-9G for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQv-0005D5-AJ for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:04 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1e9b6f39f9eso3546425fac.2 for ; Mon, 16 Oct 2023 23:19:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523598; x=1698128398; 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=OsswZ4m+p5sHVQ4VqGmu5XdQhh8AvISCV+JisFOh8vc=; b=msh+iPmpfGF1tbC4Tpy07x1jLi8PlHrguijF1XSflBc8l5xKXQ0bci6BYOMHCQjutj Ae5r5ksPdetTphJZ4I4KSSjmZ/5ySvbRGZdeeP72mtOrpFnbr4uHXmqOvcsvCW0YbieW vmzhQSKOgtKFsalxQBVH6XMs24pY3e+HQ3iXuUQACIbP2700tAFLKir8leC9oEJfEcWX 3SIiwlxD2t9zrDCL2LpmwEwMHKJ66uUW0fNSaKAcwdQSI9HrVgZUnllaXsNvugbPn7i9 huLQUNuCMmGfpNLMACmkFSdTPgpwufEUu8M+pVE1AFRo/QgyZczo/PFjoeMqL4FkA19E itHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523598; x=1698128398; 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=OsswZ4m+p5sHVQ4VqGmu5XdQhh8AvISCV+JisFOh8vc=; b=YvkVzy4I7V+/SjW656IZtVbmA2gABAUx7kDqouDX9h+PMix55ANd4A4Bk/7G5JNaza yvms32uS6H/ykmP7t+keRLvn9L8WDbZQ+4VOz9X72ePHrgmzciROOQjs6e3Zf4jXgp4z ynNytJlbx/DxVyeGfFmLwKnbwyfAd3/2//7PC4q5rF8MOW1Sn6L4Oe+vBRdq7CT6kgOp eCvXmobIi4pW7Y8YB6QDg3ik517K/j7F4G4PCgErnCqPCxJ27rytmpmu14Cfr0pQxvkN E9UU1ifFmwQcYf4UAoUXe5Rzj9fIoYi5kJVmxfJnFimqhOOenrTeD/4zsjwXRCC3eBzz auYA== X-Gm-Message-State: AOJu0YxyE+L50yqxNqd27nJBaw2rUcYJusdwoQ3Jwy+6jJHVrYXP/YW8 yK4R0FB7k16oex9VEtrtvl4mTLqdkRq93EYiizc= X-Received: by 2002:a05:6870:1002:b0:1e9:9bec:c01d with SMTP id 2-20020a056870100200b001e99becc01dmr1317185oai.6.1697523598535; Mon, 16 Oct 2023 23:19:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 86/90] target/sparc: Convert FCMP, FCMPE to decodetree Date: Mon, 16 Oct 2023 23:12:40 -0700 Message-Id: <20231017061244.681584-87-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x32.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 ++ target/sparc/translate.c | 145 +++++++++++++++++++++++--------------- 2 files changed, 96 insertions(+), 56 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 88d4b8529d..3167797854 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -289,6 +289,13 @@ FMOVRs 10 rd:5 110101 rs1:5 0 cond:3 00101 rs2:5 FMOVRd 10 rd:5 110101 rs1:5 0 cond:3 00110 rs2:5 FMOVRq 10 rd:5 110101 rs1:5 0 cond:3 00111 rs2:5 +FCMPs 10 000 cc:2 110101 rs1:5 0 0101 0001 rs2:5 +FCMPd 10 000 cc:2 110101 rs1:5 0 0101 0010 rs2:5 +FCMPq 10 000 cc:2 110101 rs1:5 0 0101 0011 rs2:5 +FCMPEs 10 000 cc:2 110101 rs1:5 0 0101 0101 rs2:5 +FCMPEd 10 000 cc:2 110101 rs1:5 0 0101 0110 rs2:5 +FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 84b67ac1a8..8dd5ef0c92 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5212,6 +5212,82 @@ TRANS(FMOVsfcc, 64, do_fmovfcc, a, false, gen_fmovs) TRANS(FMOVdfcc, 64, do_fmovfcc, a, false, gen_fmovd) TRANS(FMOVqfcc, 64, do_fmovfcc, a, true, gen_fmovq) +static bool do_fcmps(DisasContext *dc, arg_FCMPs *a, bool e) +{ + TCGv_i32 src1, src2; + + if (avail_32(dc) && a->cc != 0) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + if (e) { + gen_op_fcmpes(a->cc, src1, src2); + } else { + gen_op_fcmps(a->cc, src1, src2); + } + return advance_pc(dc); +} + +TRANS(FCMPs, ALL, do_fcmps, a, false) +TRANS(FCMPEs, ALL, do_fcmps, a, true) + +static bool do_fcmpd(DisasContext *dc, arg_FCMPd *a, bool e) +{ + TCGv_i64 src1, src2; + + if (avail_32(dc) && a->cc != 0) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + if (e) { + gen_op_fcmped(a->cc, src1, src2); + } else { + gen_op_fcmpd(a->cc, src1, src2); + } + return advance_pc(dc); +} + +TRANS(FCMPd, ALL, do_fcmpd, a, false) +TRANS(FCMPEd, ALL, do_fcmpd, a, true) + +static bool do_fcmpq(DisasContext *dc, arg_FCMPq *a, bool e) +{ + if (avail_32(dc) && a->cc != 0) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT0(QFPREG(a->rs1)); + gen_op_load_fpr_QT1(QFPREG(a->rs2)); + if (e) { + gen_op_fcmpeq(a->cc); + } else { + gen_op_fcmpq(a->cc); + } + return advance_pc(dc); +} + +TRANS(FCMPq, ALL, do_fcmpq, a, false) +TRANS(FCMPEq, ALL, do_fcmpq, a, true) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5222,15 +5298,7 @@ TRANS(FMOVqfcc, 64, do_fmovfcc, a, true, gen_fmovq) /* before an instruction, dc->pc must be static */ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { - unsigned int opc, rs1, rs2, rd; - TCGv cpu_src1 __attribute__((unused)); - TCGv_i32 cpu_src1_32, cpu_src2_32; - TCGv_i64 cpu_src1_64, cpu_src2_64; - TCGv_i32 cpu_dst_32 __attribute__((unused)); - TCGv_i64 cpu_dst_64 __attribute__((unused)); - - opc = GET_FIELD(insn, 0, 1); - rd = GET_FIELD(insn, 2, 6); + unsigned int opc = GET_FIELD(insn, 0, 1); switch (opc) { case 0: @@ -5240,61 +5308,22 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 2: /* FPU & Logical Operations */ { unsigned int xop = GET_FIELD(insn, 7, 12); - TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); if (xop == 0x34) { /* FPU Operations */ goto illegal_insn; /* in decodetree */ } else if (xop == 0x35) { /* FPU Operations */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_op_clear_ieee_excp_and_FTT(); - rs1 = GET_FIELD(insn, 13, 17); - rs2 = GET_FIELD(insn, 27, 31); - xop = GET_FIELD(insn, 18, 26); - - switch (xop) { - case 0x51: /* fcmps, V9 %fcc */ - cpu_src1_32 = gen_load_fpr_F(dc, rs1); - cpu_src2_32 = gen_load_fpr_F(dc, rs2); - gen_op_fcmps(rd & 3, cpu_src1_32, cpu_src2_32); - break; - case 0x52: /* fcmpd, V9 %fcc */ - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_op_fcmpd(rd & 3, cpu_src1_64, cpu_src2_64); - break; - case 0x53: /* fcmpq, V9 %fcc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_op_load_fpr_QT0(QFPREG(rs1)); - gen_op_load_fpr_QT1(QFPREG(rs2)); - gen_op_fcmpq(rd & 3); - break; - case 0x55: /* fcmpes, V9 %fcc */ - cpu_src1_32 = gen_load_fpr_F(dc, rs1); - cpu_src2_32 = gen_load_fpr_F(dc, rs2); - gen_op_fcmpes(rd & 3, cpu_src1_32, cpu_src2_32); - break; - case 0x56: /* fcmped, V9 %fcc */ - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_op_fcmped(rd & 3, cpu_src1_64, cpu_src2_64); - break; - case 0x57: /* fcmpeq, V9 %fcc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_op_load_fpr_QT0(QFPREG(rs1)); - gen_op_load_fpr_QT1(QFPREG(rs2)); - gen_op_fcmpeq(rd & 3); - break; - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ + TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; + TCGv_i32 cpu_dst_32; + TCGv cpu_dst = tcg_temp_new(); int opf = GET_FIELD_SP(insn, 5, 13); - rs1 = GET_FIELD(insn, 13, 17); - rs2 = GET_FIELD(insn, 27, 31); + int rs1 = GET_FIELD(insn, 13, 17); + int rs2 = GET_FIELD(insn, 27, 31); + int rd = GET_FIELD(insn, 2, 6); + if (gen_trap_ifnofpu(dc)) { goto jmp_insn; } @@ -5479,14 +5508,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; /* in decodetree */ } advance_pc(dc); +#ifdef TARGET_SPARC64 jmp_insn: +#endif return; illegal_insn: gen_exception(dc, TT_ILL_INSN); return; +#ifdef TARGET_SPARC64 nfpu_insn: gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); return; +#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Tue Oct 17 06:12:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734322 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326090wro; Mon, 16 Oct 2023 23:26:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDn2WKckWPZEB2TQa3gz+aG3nDQEiRbgLdmxNl/i54CUqOIWTfDo2NaU/4NJrZ8h+NeEgA X-Received: by 2002:a05:622a:387:b0:412:4c9:93c4 with SMTP id j7-20020a05622a038700b0041204c993c4mr1617001qtx.59.1697524011390; Mon, 16 Oct 2023 23:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524011; cv=none; d=google.com; s=arc-20160816; b=ex2T77AXsxya6/+ibqX1T42r6Nj4E8q/KV5vX70kuUYa6taUaM05JaCycK9otTrjBI ovQgvpNIfHjJrsgwHq1F1vKxmEWsZlyPY1DY/TMQv6Il4YmkEgqalEWALj2HK7gYew9p 8a+ur46siANOcK4mTtLGtpBXo7skV4+HxQUPiDarTl3zfSjX99KrjH7pVqbfGi98IupN T3w9TIgvqFQwjbD08M3fCvmPM6phqsQAOSGFrQXdBltCUcm2R1OwyE0Te5GCKM8iMlda rs/PHzOpAVsgquwy3kh7OM16YMQJfE66C11cwSf67PdytWUjCMAm+6Z0Im99bLroeLvj 0J4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=o5rSJ4iR2yjI4iXFqavGkYqZhvRD1R5Bp8SKWlo9pj0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=J+eEOMsuTWLZLW38YA7Op7UIrmfPlTs/NYch+/f3NfozDfJRYK6oSclT/tg2uBscti 6zQAzelFY7ppdNmBjx4M+1a5w3aGSYD5rX+0QkBdMClnIEhl7IkZmsbX1Z01pDHagabK SM8JKk3kkgbiqKIUJ32OsjlQCGiRZYDczIlujCDNJb1N2dszJoHlPdXQvScLTOrG9Fhv CkKGMLXjNw6cieTNAYfhjWooyWUNEzCuSGVkjDQPgTh0Fxc8TjyR6SDAq4M2n24sy+46 FywnPZG5Hl4nSBOQ7SiK/hTr6OF3UOLySMvgNB7r5w9JZ9+++oA9fN3DWXsTCw4T9FF7 hyAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LEE1Gs/t"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v7-20020ac85787000000b004181f579652si653928qta.118.2023.10.16.23.26.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:26:51 -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="LEE1Gs/t"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRj-0004jJ-2Y; Tue, 17 Oct 2023 02:20:52 -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 1qsdR3-0003k8-5O for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0: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 1qsdQv-0005DH-6r for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:03 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3ae2ec1a222so3299492b6e.2 for ; Mon, 16 Oct 2023 23:19:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523599; x=1698128399; 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=o5rSJ4iR2yjI4iXFqavGkYqZhvRD1R5Bp8SKWlo9pj0=; b=LEE1Gs/taD01HtGG1eISf/1cQPVsYOvUdOy/bhLRS+GwCdrGDF544us9dzS7twrY9s u+26stq5j6HW8B8avOlaUEe2rhacJ1Iw1stCwkSICm6ZukC9plqoCozF8jPZSFT/3pnC Qbj5SQPf+GK/5cBfGUSpnmxLIPT8jjdx8ornADGIqVJQXMKPulgH0gP7HvbWdj9zqsjp Yu0sSbQI+OQHwK5LKLFdozbVXwucJai2951TAfOzCY6UydZFaIQYqkbGKzikv5z/zfp3 a8+QCJnaJ4AvkIemP+hWI2ni1yihnqntS5GPYiQHqKCa8UATXMYjxuT2I86pCXg7ZYHO 4VFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523599; x=1698128399; 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=o5rSJ4iR2yjI4iXFqavGkYqZhvRD1R5Bp8SKWlo9pj0=; b=NSA8hfhAQsuUQIs8OZiMMTvHt+fdS8wZqi1pgrkzaiHTSVYFl1m9FXLNrkEN0/nZAI KvMuzDyvydfejE4W1eFW9amhXA0jDDOx9yGWLmxQUYxtw+/JCuqxE77cCdwyfMIXvfX8 9NkqdTq42Gd9jW4s8zAsN6HoB2nWDs+4dy7mpynKibr+JVURvzey9AG8N7K7nvSq8kZF D4A7qxpHUhIgt/MN4lFkz6L4wEDPUHXwVanGSOIeNVKHCOSJXFMfgAIS21cK1HvSaLn3 i2aQUQC2+mGxNB6nKJK4Ty+V4fBGpJHXQG2L9I/4HC3IPbriLMUI12y29o0WHVzFtdpF X2wA== X-Gm-Message-State: AOJu0YykclBL1ZGBr/7cjPBbTCoUn/50F30WJiirKF8XhIJmeDaGrqR/ elQCVQDcD/WeBGzr1honfSIDRt8STNJcYmLSuj4= X-Received: by 2002:aca:1212:0:b0:3ae:170f:a39b with SMTP id 18-20020aca1212000000b003ae170fa39bmr1523236ois.17.1697523599251; Mon, 16 Oct 2023 23:19:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 87/90] target/sparc: Move FPCMP* to decodetree Date: Mon, 16 Oct 2023 23:12:41 -0700 Message-Id: <20231017061244.681584-88-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 9 ++++ target/sparc/translate.c | 94 +++++++++++++++++---------------------- 2 files changed, 50 insertions(+), 53 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 3167797854..0a0c5b2505 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -320,6 +320,15 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FPCMPLE16 10 ..... 110110 ..... 0 0010 0000 ..... @r_r_r + FPCMPNE16 10 ..... 110110 ..... 0 0010 0010 ..... @r_r_r + FPCMPGT16 10 ..... 110110 ..... 0 0010 1000 ..... @r_r_r + FPCMPEQ16 10 ..... 110110 ..... 0 0010 1010 ..... @r_r_r + FPCMPLE32 10 ..... 110110 ..... 0 0010 0100 ..... @r_r_r + FPCMPNE32 10 ..... 110110 ..... 0 0010 0110 ..... @r_r_r + FPCMPGT32 10 ..... 110110 ..... 0 0010 1100 ..... @r_r_r + FPCMPEQ32 10 ..... 110110 ..... 0 0010 1110 ..... @r_r_r + FMUL8x16 10 ..... 110110 ..... 0 0011 0001 ..... @r_r_r FMUL8x16AU 10 ..... 110110 ..... 0 0011 0011 ..... @r_r_r FMUL8x16AL 10 ..... 110110 ..... 0 0011 0101 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 8dd5ef0c92..01063afa30 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -77,7 +77,14 @@ #define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) #define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) #define gen_helper_pdist ({ g_assert_not_reached(); NULL; }) -#define gen_helper_fsqrtq ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpeq16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpne16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmple16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpgt16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpeq32 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpne32 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmple32 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpgt32 ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -5034,6 +5041,37 @@ TRANS(FPACK32, VIS1, do_ddd, a, gen_op_fpack32) TRANS(FALIGNDATAg, VIS1, do_ddd, a, gen_op_faligndata) TRANS(BSHUFFLE, VIS2, do_ddd, a, gen_op_bshuffle) +static bool do_rdd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_i64, TCGv_i64)) +{ +#ifdef TARGET_SPARC64 + TCGv_i64 dst, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_gpr(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, src1, src2); + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +#else + g_assert_not_reached(); +#endif +} + +TRANS(FPCMPLE16, VIS1, do_rdd, a, gen_helper_fcmple16) +TRANS(FPCMPNE16, VIS1, do_rdd, a, gen_helper_fcmpne16) +TRANS(FPCMPGT16, VIS1, do_rdd, a, gen_helper_fcmpgt16) +TRANS(FPCMPEQ16, VIS1, do_rdd, a, gen_helper_fcmpeq16) + +TRANS(FPCMPLE32, VIS1, do_rdd, a, gen_helper_fcmple32) +TRANS(FPCMPNE32, VIS1, do_rdd, a, gen_helper_fcmpne32) +TRANS(FPCMPGT32, VIS1, do_rdd, a, gen_helper_fcmpgt32) +TRANS(FPCMPEQ32, VIS1, do_rdd, a, gen_helper_fcmpeq32) + static bool do_env_ddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64)) { @@ -5316,11 +5354,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ - TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; + TCGv_i64 cpu_src1_64, cpu_dst_64; TCGv_i32 cpu_dst_32; - TCGv cpu_dst = tcg_temp_new(); int opf = GET_FIELD_SP(insn, 5, 13); - int rs1 = GET_FIELD(insn, 13, 17); int rs2 = GET_FIELD(insn, 27, 31); int rd = GET_FIELD(insn, 2, 6); @@ -5396,63 +5432,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x03a: /* VIS I fpack32 */ case 0x048: /* VIS I faligndata */ case 0x04c: /* VIS II bshuffle */ - g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmple16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x022: /* VIS I fcmpne16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpne16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x024: /* VIS I fcmple32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmple32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x026: /* VIS I fcmpne32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpne32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x028: /* VIS I fcmpgt16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpgt16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x02a: /* VIS I fcmpeq16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpeq16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x02c: /* VIS I fcmpgt32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpgt32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x02e: /* VIS I fcmpeq32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x03b: /* VIS I fpack16 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1_64 = gen_load_fpr_D(dc, rs2); From patchwork Tue Oct 17 06:12:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734319 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326079wro; Mon, 16 Oct 2023 23:26:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGW8L29hTQvBZV4U0paVQMpAuVKE3KUPac0sSjjdoYrIPNpVtpkxndAOjL4xgsR23lJXH1q X-Received: by 2002:a05:620a:8c0c:b0:777:7178:ebf2 with SMTP id qz12-20020a05620a8c0c00b007777178ebf2mr1128689qkn.18.1697524009781; Mon, 16 Oct 2023 23:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524009; cv=none; d=google.com; s=arc-20160816; b=e0Tnjmc+xNzEyHi5YxasVXjHR/elRpwD9ar3K5T7tKAgio+nWQy/Ovg6Cn3uNTKsxY yvbkjqzpMmVz4cw2CwQ6+PDe53m80Uj2eGrY53zL0kXc1eODCFdDTHn5HhMikQdxJOf+ jGNE0Wx/XfaXp5A+BxLwdCwwzE7UHm7re/30RrxYKHWUezMxHiYz6GlUPlulmKExRnds eG+nYtdmORj7o5ZameO/Kw0f2DiWCJWUbCto2eyc9SUusEWebBrYgdT4Uhwg4p0u0/P8 6Cyow+O7CyiSeXN9GA9rYGsAOHMampuXqiiDCIIDhPtTzB+lFgTDDZEqv9TqPaBotIgO 3Z2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=JeYRUl/8fAWyiOtO/ldxHccrm5fOKPmxfUgUi0vKSOI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=VNM74MbzFSLq24b+Haub4hDLh+rFigxldMiyfk5N/cwSObVPkpCsFLeHrxoLSVqaV5 blGD0VXHaztxIadixkBbwLvdR1fBGm0WSzweBvK0gSjjDh9LsfjpSreciGayuu9DX3j2 FCs81Y09Ps3JFcyJ/YKDHQv0Twkx/yyC+jszGidHkXqaZX8HL2gfR9mM3EELcikWOOap N4ZDldD2jX1a5CpJ+K5PEKNvZOItYtjQJ0ilHk1oANEF1Qzw+LD0bHliqAmmU8wWSh98 QdL5znWzmnN3vMGB82so1f9my9YwYVmeMtBxu0KUm437w9tgbPm/wcEiwZkqLnLyOjyy dw6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Me3zRcKI; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v9-20020a05620a440900b0076db12d14c2si593553qkp.719.2023.10.16.23.26.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:26:49 -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=Me3zRcKI; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRt-0005tM-1n; Tue, 17 Oct 2023 02:21:01 -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 1qsdR3-0003kh-9E for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQv-0005DW-9Z for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:04 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3af6bd48093so3507451b6e.3 for ; Mon, 16 Oct 2023 23:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523600; x=1698128400; 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=JeYRUl/8fAWyiOtO/ldxHccrm5fOKPmxfUgUi0vKSOI=; b=Me3zRcKI0um56sit/wZQG15ar6I2eMD5moiz4EWbfdbuQGYI4gpCsDlJdZaHG5nrdd oEb2kHpWheH8XdMh6t1kNKWZ3+fcSzfKseUVyRkeSg318Zb/+OODVaxW5dTOAW8TUSW0 +KbkFsX8L5nAc0FQkTP28trHr8lL8K3K71issN9XjmyCWgxgNN7YDX0AbhWi+pcH/tu4 OxaP8NtFc2GvgzWtXOV3dvRxcanLsNK1TNAuEO/D62rgwuaPRaiDsl3i7Uzt7WpfSfuU 2n9VpDjuJrlxLvNTuEySQu6s8dIr7TggK2K+1H9mNpgKO8FkGgvEAtKFi4UZTYzFigrx CnYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523600; x=1698128400; 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=JeYRUl/8fAWyiOtO/ldxHccrm5fOKPmxfUgUi0vKSOI=; b=CpKYxKipsutlA+WjWczpSEP9y3zPl1PHMOP4Jk7PllhLDvxkws3+6iKWW5nHS6SHiU inX4MTlGJopg9QmuVoR/TFRvQnJ2B+cHcVU8lKAZWw/dFfZt4mF71NplcfBgdjgg9Wlp r6DPP/QFNXaMNEf5npNYNMGId66rW1Ci4wwmjTGxa62YXkuWMAW63dGVXgCkSnhDyfk3 Zsi4RKjLQokF8/S9NWRmXnjzb5HhUQtWHfBKVeGByZPQ39e7a0LKC1nQaQsYc4D/93EZ yW1EOjUinjpryIxZ3TRxR5Cw/vlRN1dVYPvan/dJET1DnLLVb9nvGu1KxxLDwQ61tC68 Heww== X-Gm-Message-State: AOJu0YwhZVuY1K9aIdBa5Nw2NzHyNtMBWmrEVsrjpsHP2bdyhvK7U+Jz Rd/wChT1yTQ2Ee6cT+6JUMRzm3HO76TSQfqNNww= X-Received: by 2002:a05:6808:408a:b0:3a7:1e98:80ad with SMTP id db10-20020a056808408a00b003a71e9880admr1399899oib.9.1697523599953; Mon, 16 Oct 2023 23:19:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:19:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 88/90] target/sparc: Move FPACK16, FPACKFIX to decodetree Date: Mon, 16 Oct 2023 23:12:42 -0700 Message-Id: <20231017061244.681584-89-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 55 ++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0a0c5b2505..c9fe45adff 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -337,6 +337,8 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r FPACK32 10 ..... 110110 ..... 0 0011 1010 ..... @r_r_r + FPACK16 10 ..... 110110 00000 0 0011 1011 ..... @r_r2 + FPACKFIX 10 ..... 110110 00000 0 0011 1101 ..... @r_r2 PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r FALIGNDATAg 10 ..... 110110 ..... 0 0100 1000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 01063afa30..bee9212ba2 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -710,6 +710,24 @@ static void gen_op_array32(TCGv dst, TCGv src1, TCGv src2) tcg_gen_shli_tl(dst, dst, 2); } +static void gen_op_fpack16(TCGv_i32 dst, TCGv_i64 src) +{ +#ifdef TARGET_SPARC64 + gen_helper_fpack16(dst, cpu_gsr, src); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_fpackfix(TCGv_i32 dst, TCGv_i64 src) +{ +#ifdef TARGET_SPARC64 + gen_helper_fpackfix(dst, cpu_gsr, src); +#else + g_assert_not_reached(); +#endif +} + static void gen_op_fpack32(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) { #ifdef TARGET_SPARC64 @@ -4675,6 +4693,26 @@ TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) +static bool do_fd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_i64)) +{ + TCGv_i32 dst; + TCGv_i64 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_F(dc); + src = gen_load_fpr_D(dc, a->rs); + func(dst, src); + gen_store_fpr_F(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FPACK16, VIS1, do_fd, a, gen_op_fpack16) +TRANS(FPACKFIX, VIS1, do_fd, a, gen_op_fpackfix) + static bool do_env_ff(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i32, TCGv_env, TCGv_i32)) { @@ -5354,10 +5392,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ - TCGv_i64 cpu_src1_64, cpu_dst_64; + TCGv_i64 cpu_dst_64; TCGv_i32 cpu_dst_32; int opf = GET_FIELD_SP(insn, 5, 13); - int rs2 = GET_FIELD(insn, 27, 31); int rd = GET_FIELD(insn, 2, 6); if (gen_trap_ifnofpu(dc)) { @@ -5440,21 +5477,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x02a: /* VIS I fcmpeq16 */ case 0x02c: /* VIS I fcmpgt32 */ case 0x02e: /* VIS I fcmpeq32 */ - g_assert_not_reached(); /* in decodetree */ case 0x03b: /* VIS I fpack16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - cpu_dst_32 = gen_dest_fpr_F(dc); - gen_helper_fpack16(cpu_dst_32, cpu_gsr, cpu_src1_64); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; case 0x03d: /* VIS I fpackfix */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - cpu_dst_32 = gen_dest_fpr_F(dc); - gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; + g_assert_not_reached(); /* in decodetree */ case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Tue Oct 17 06:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734321 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326077wro; Mon, 16 Oct 2023 23:26:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9sWKG+c0BMuUhwjmmovDwWurrybjUuU3ornE8GIMCA0AXrZ1jBlcfiZI+7VrVA2mN9yFL X-Received: by 2002:ac8:5ac7:0:b0:412:22f5:fe00 with SMTP id d7-20020ac85ac7000000b0041222f5fe00mr1387305qtd.2.1697524009696; Mon, 16 Oct 2023 23:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524009; cv=none; d=google.com; s=arc-20160816; b=LJZ3EvBaZNBiBOF4WAueqADTnHaoh/4ktSDKq5jdQ7udjcR8KEaq47FP+7VxagF7Nv 8YR4VsALUGnE3mEqBUade8B6w5OcmzW91R3YNgryY8mYUkDe6B6L6loRAc1y0eY3AlnV fLSUHeQ2k/tWdduNfPqPiw2zErg/pdy3TnANjuusDLstfJC0Q7UhlL0TCMMGKceZBjJb CFk4VQTJcwCDy7qAdOGLIPiEgdaIlRhc0gmtbD77vSaGUkCzkxiAFnhz37JmltZTTAVV sEWpuJc9ZIaqhcpoFIn6q2NtOT0+HmBALbo0wxzOyFjci+HxXq1mi3dpYTKR93Ux68qP V1bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=E1pdZHpeeWMsiJd0OhonUMx7zfAPncr8d+ROFD2wdCE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Cp1bSM+5gJWF0SfA5Kv7nIbnKKBYkZOU76489fq9UElMzVhvkt2W/GwabyI+K8Ksrz j9mPtgqL6guhsZjbxER5aqXq8VteK+1ZOC9vn10Aq1uhafIn0l9YfbJKUCvSZtXuSGYh G4lbgWrISxSioHshlE6ame1Gvc4a0igucUOUaXbxMAqgu/Rqe8hyoz4xTuAsSDogLibY lzpi+eOmyJqjT0TD436eXDx/hcpqGVySkx0XwXHcHLdA8YX5Np3HvIseMEiQI45J9X0M yjXGAPavD6MvZOU/QRriRi4f2K094+gTZqQPsVWRtOdrl/9AzEDUBggaO3YLCRhrgsao hRKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jzkCAOro; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v1-20020ac85781000000b0041814c12507si637133qta.383.2023.10.16.23.26.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:26:49 -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=jzkCAOro; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRs-0005t2-G1; Tue, 17 Oct 2023 02:21:00 -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 1qsdR3-0003ks-9G for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQw-0005Dh-Ve for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:04 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1642700b3a.0 for ; Mon, 16 Oct 2023 23:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523600; x=1698128400; 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=E1pdZHpeeWMsiJd0OhonUMx7zfAPncr8d+ROFD2wdCE=; b=jzkCAOrovihXX/UPgigkPlSmxKVtYDFlE6DrtH9bceH+E1g8rObZ4x3Nea+pgYBZ7s ze9cWUBb02THP+nfqO1AvNgGANZLTgFYB2JMEeJXKkFI5o+1p28jjhu7ZWAp2Q3pEkG7 X06HSZcsve9xGcvS+4cddtiHniX/bhBOfdKh5CAEcLnDK8GyFZP6S1IKoUHGCBWUs5mH rAhGR3TTE4Ybgd2kTBDu5fVIqMFvxdRECNIDvjhQIAEBicLGQiIMuPsXOEXydUNVStLk Hw7iGuEQVmMHg7M15FNnlVP1mxQtnDEMxmYS8BAwuu17yT42hFmW0LLH1qAwRiNH7e61 B1gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523600; x=1698128400; 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=E1pdZHpeeWMsiJd0OhonUMx7zfAPncr8d+ROFD2wdCE=; b=xUxEvgrB0bc30yC35dsJitBO9Ru48YXyez8kMZ3b2DLKCFB+0ghd0Tg9sia+dhp1fP YQDGoFzjkzc/yr0dRBjAn7dseD60+WIM106OHp9aba5weTf+0DEUP30iFBO5ATU1sTod qcG1We/aYU7vZsS98zKuJRDvElmqwjbR/EW99J19JYM0/u71XdimZgSEDAxPdRxPNnRE VbOKo4/QqZP0rJYY6FdAsI394x4R8Ba5gT9CvhByIGChbaJF8kVbDfzrp35szeoeFiN7 +7Y8KT3S7vPVRm7OMWSMF1Weyhyzw0YOr9HqOGrg5Ra5hBeDBgL7eNXWBkHPRFaMDYh1 GaJQ== X-Gm-Message-State: AOJu0YzOZvkUJAMJ7WVLRELOeTgnTmK4SiWGFZg+tlX07BQQkk99gPT9 p9nLTirrQZMRu9mwaubnLIHuIVHO7RczkYp3APU= X-Received: by 2002:a05:6a00:2d19:b0:6b2:5d32:57d with SMTP id fa25-20020a056a002d1900b006b25d32057dmr1485157pfb.5.1697523600666; Mon, 16 Oct 2023 23:20:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:20:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 89/90] target/sparc: Convert FZERO, FONE to decodetree Date: Mon, 16 Oct 2023 23:12:43 -0700 Message-Id: <20231017061244.681584-90-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 5 +++ target/sparc/translate.c | 69 +++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index c9fe45adff..22d7e7fc09 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -384,6 +384,11 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s FORd 10 ..... 110110 ..... 0 0111 1100 ..... @r_r_r FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r + + FZEROd 10 rd:5 110110 00000 0 0110 0000 00000 + FZEROs 10 rd:5 110110 00000 0 0110 0001 00000 + FONEd 10 rd:5 110110 00000 0 0111 1110 00000 + FONEs 10 rd:5 110110 00000 0 0111 1111 00000 ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index bee9212ba2..ba41cfda3d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4672,6 +4672,45 @@ static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL) TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ) +static bool do_fc(DisasContext *dc, int rd, bool c) +{ + uint64_t mask; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + if (rd & 1) { + mask = MAKE_64BIT_MASK(0, 32); + } else { + mask = MAKE_64BIT_MASK(32, 32); + } + if (c) { + tcg_gen_ori_i64(cpu_fpr[rd / 2], cpu_fpr[rd / 2], mask); + } else { + tcg_gen_andi_i64(cpu_fpr[rd / 2], cpu_fpr[rd / 2], ~mask); + } + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +TRANS(FZEROs, VIS1, do_fc, a->rd, 0) +TRANS(FONEs, VIS1, do_fc, a->rd, 1) + +static bool do_dc(DisasContext *dc, int rd, int64_t c) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + + tcg_gen_movi_i64(cpu_fpr[rd / 2], c); + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +TRANS(FZEROd, VIS1, do_dc, a->rd, 0) +TRANS(FONEd, VIS1, do_dc, a->rd, -1) + static bool do_ff(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i32, TCGv_i32)) { @@ -5392,10 +5431,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ - TCGv_i64 cpu_dst_64; - TCGv_i32 cpu_dst_32; int opf = GET_FIELD_SP(insn, 5, 13); - int rd = GET_FIELD(insn, 2, 6); if (gen_trap_ifnofpu(dc)) { goto jmp_insn; @@ -5479,31 +5515,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x02e: /* VIS I fcmpeq32 */ case 0x03b: /* VIS I fpack16 */ case 0x03d: /* VIS I fpackfix */ - g_assert_not_reached(); /* in decodetree */ case 0x060: /* VIS I fzero */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_movi_i64(cpu_dst_64, 0); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; case 0x061: /* VIS I fzeros */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_movi_i32(cpu_dst_32, 0); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; case 0x07e: /* VIS I fone */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_movi_i64(cpu_dst_64, -1); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; case 0x07f: /* VIS I fones */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_movi_i32(cpu_dst_32, -1); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; + g_assert_not_reached(); /* in decodetree */ case 0x080: /* VIS I shutdown */ case 0x081: /* VIS II siam */ // XXX @@ -5528,11 +5544,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; -#ifdef TARGET_SPARC64 - nfpu_insn: - gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); - return; -#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Tue Oct 17 06:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734340 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp326788wro; Mon, 16 Oct 2023 23:29:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFl0r8h4si+mwk8tqJTsYgi+wSyVmTKqs+ZSD6p6e096wCjSIWUEG13UqbWPz8G3aZ6sl54 X-Received: by 2002:ad4:5bc8:0:b0:66d:6823:bc7a with SMTP id t8-20020ad45bc8000000b0066d6823bc7amr1321327qvt.49.1697524160454; Mon, 16 Oct 2023 23:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697524160; cv=none; d=google.com; s=arc-20160816; b=pCeNyJhCLjkTfP+C4WCY5jwNdXkh3ptlbz6yFUdWEb9eWpjGggA8o34BVAPFMBTIPW 3xO/y5RdkMKqnvlBLTfJ79JCLEukSdDXAM/En9IX8IwD/wr65qWPNbr/u0JPEmY9yygc Erduw2lZhhMDB3KvN3ypB/VKRjQ7AbbhNlJJYErI9ieF3medo0P4KklrUEDzLaMg46qy M78LBMeSgIvYdf147Um7CMZzsVVhOVxtRQ13ARXTq8wyatR7cJae5P/3zkwTs3GzcFlv it/8TZ0V6vIIlCLLx4XU3mscBtb1GDxpXaUk3q5HVfRcG8A5BfYq+wjm5kPm44+IPygX Bg+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Oj4L1wn5xycsKiEhLIXeWeTUxVzLt/BGJR7AYYVjFwY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=shYDvEc/KkIHG/ct9qRY9YDSUVBiCKI2IUUdrW7JhK3PQRxBN8szwYYRv7p7Zq0aDV ioQz+K0lm+PTBBKqcnBFNQXwKhgeKYyGAhqXcgDmOeLwEUS961o0yO05JonCF6OZUSqg FfANOOVXYftMihVVsAPWZIWj+ImwEm9sUzqQ35GPk4FU3C2wt7UKNtoMU86jocfkOyBl iQYkcc2pYTyn1AhBReHn88fOpCDUhO5iKYs8z6ndioInM4fkKBsE0gUdiChhvaaqsFRr QY57T4E3gLAePLE0d6TWIDHpjhnhur3wDhut4Emnz/ySYk2ZLlbMDM2TlLQ5B+tjxyLT EKAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EL2AHF+o; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n5-20020a05620a294500b00773cae5aec9si595309qkp.159.2023.10.16.23.29.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:29:20 -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=EL2AHF+o; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdRn-0005et-6Y; Tue, 17 Oct 2023 02:20:55 -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 1qsdR3-0003lA-A9 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:13 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdQw-0005Du-Vh for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:20:06 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-27d3c886671so3250905a91.3 for ; Mon, 16 Oct 2023 23:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523601; x=1698128401; 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=Oj4L1wn5xycsKiEhLIXeWeTUxVzLt/BGJR7AYYVjFwY=; b=EL2AHF+o+9nC7+PiPUkSud/mAzjNuTLgoT1ncSaco4pegslPYboFL9//bFWKtPIo1S 4ZVRhCJMoqpfdK56aggXkGs6j1s+08L5wUdVXaADNyNu2Ia5TyBiT5ZMY0fRLjOzmhvn idEu+NgBFcXlyELSkgTUPRWfBQHuptGAxTx6cXMpX1tp/J31VWCufKrnmuTYrQqmFQbz AHbbV7RSLjayJkvhjzT8aQwTirMFERNrx7a/tkT0hCVvQ6TuoqKAXZslXzy8u1PUscSY XnrS5AyNmy1hPszJ9IAThexhG5nH6K0/5s01/s7iTEEnrOuMTa9rbicJclVg2C6IMxFp Sp1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523601; x=1698128401; 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=Oj4L1wn5xycsKiEhLIXeWeTUxVzLt/BGJR7AYYVjFwY=; b=R/88yhOrDrSsOX+NND130gGAnxfZIkZcFY3djSEBwjrO/vcLLl/eDfrPsT5iFomUQS Q79cMK7q0li7e3kTq2wcapv+Bu1IErD6R6oMeKIT68Ts3g+AEJPS/nV5qxVrGobFDZxR ab2g+dXruPwMBHREAqxM8GmWMwLRUJpQLLmY60JWmP0XmgNXAQ5MOzxAt2YjyXo8fFxC OFRL74eJMirAY2hKUmvkCgEJ536RmlSi6WCjaMVXT+EgcVUPQJ+h2U4TEerjkd58R2Mm yM2piXL5v4+QAbS9hJx/W3RdehDO0On+KO8n4PJAhXJZEIvvQjVM/In+W79qRkpKwOH0 5PFw== X-Gm-Message-State: AOJu0YwxqAN5Vi6L8GEbpzr4bm5Lhu6cOLNxemQ/OFUsNtCd+5cZjfxh rxvFLy2NJLK36gRnRTlR4BZp6/5A9LG38vHimyI= X-Received: by 2002:a17:90a:6089:b0:27d:7eeb:d4d0 with SMTP id z9-20020a17090a608900b0027d7eebd4d0mr1320211pji.12.1697523601377; Mon, 16 Oct 2023 23:20:01 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id by2-20020a056a02058200b00588e8421fa8sm550331pgb.84.2023.10.16.23.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:20:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 90/90] target/sparc: Remove disas_sparc_legacy Date: Mon, 16 Oct 2023 23:12:44 -0700 Message-Id: <20231017061244.681584-91-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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 All instructions are now converted. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 145 +-------------------------------------- 1 file changed, 1 insertion(+), 144 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ba41cfda3d..c458de2103 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5403,149 +5403,6 @@ static bool do_fcmpq(DisasContext *dc, arg_FCMPq *a, bool e) TRANS(FCMPq, ALL, do_fcmpq, a, false) TRANS(FCMPEq, ALL, do_fcmpq, a, true) -#define CHECK_IU_FEATURE(dc, FEATURE) \ - if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ - goto illegal_insn; -#define CHECK_FPU_FEATURE(dc, FEATURE) \ - if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ - goto nfpu_insn; - -/* before an instruction, dc->pc must be static */ -static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) -{ - unsigned int opc = GET_FIELD(insn, 0, 1); - - switch (opc) { - case 0: - goto illegal_insn; /* in decodetree */ - case 1: - g_assert_not_reached(); /* in decodetree */ - case 2: /* FPU & Logical Operations */ - { - unsigned int xop = GET_FIELD(insn, 7, 12); - - if (xop == 0x34) { /* FPU Operations */ - goto illegal_insn; /* in decodetree */ - } else if (xop == 0x35) { /* FPU Operations */ - goto illegal_insn; /* in decodetree */ - } else if (xop == 0x36) { -#ifdef TARGET_SPARC64 - /* VIS */ - int opf = GET_FIELD_SP(insn, 5, 13); - - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - - switch (opf) { - case 0x000: /* VIS I edge8cc */ - case 0x001: /* VIS II edge8n */ - case 0x002: /* VIS I edge8lcc */ - case 0x003: /* VIS II edge8ln */ - case 0x004: /* VIS I edge16cc */ - case 0x005: /* VIS II edge16n */ - case 0x006: /* VIS I edge16lcc */ - case 0x007: /* VIS II edge16ln */ - case 0x008: /* VIS I edge32cc */ - case 0x009: /* VIS II edge32n */ - case 0x00a: /* VIS I edge32lcc */ - case 0x00b: /* VIS II edge32ln */ - case 0x010: /* VIS I array8 */ - case 0x012: /* VIS I array16 */ - case 0x014: /* VIS I array32 */ - case 0x018: /* VIS I alignaddr */ - case 0x01a: /* VIS I alignaddrl */ - case 0x019: /* VIS II bmask */ - case 0x067: /* VIS I fnot2s */ - case 0x06b: /* VIS I fnot1s */ - case 0x075: /* VIS I fsrc1s */ - case 0x079: /* VIS I fsrc2s */ - case 0x066: /* VIS I fnot2 */ - case 0x06a: /* VIS I fnot1 */ - case 0x074: /* VIS I fsrc1 */ - case 0x078: /* VIS I fsrc2 */ - case 0x051: /* VIS I fpadd16s */ - case 0x053: /* VIS I fpadd32s */ - case 0x055: /* VIS I fpsub16s */ - case 0x057: /* VIS I fpsub32s */ - case 0x063: /* VIS I fnors */ - case 0x065: /* VIS I fandnot2s */ - case 0x069: /* VIS I fandnot1s */ - case 0x06d: /* VIS I fxors */ - case 0x06f: /* VIS I fnands */ - case 0x071: /* VIS I fands */ - case 0x073: /* VIS I fxnors */ - case 0x077: /* VIS I fornot2s */ - case 0x07b: /* VIS I fornot1s */ - case 0x07d: /* VIS I fors */ - case 0x050: /* VIS I fpadd16 */ - case 0x052: /* VIS I fpadd32 */ - case 0x054: /* VIS I fpsub16 */ - case 0x056: /* VIS I fpsub32 */ - case 0x062: /* VIS I fnor */ - case 0x064: /* VIS I fandnot2 */ - case 0x068: /* VIS I fandnot1 */ - case 0x06c: /* VIS I fxor */ - case 0x06e: /* VIS I fnand */ - case 0x070: /* VIS I fand */ - case 0x072: /* VIS I fxnor */ - case 0x076: /* VIS I fornot2 */ - case 0x07a: /* VIS I fornot1 */ - case 0x07c: /* VIS I for */ - case 0x031: /* VIS I fmul8x16 */ - case 0x033: /* VIS I fmul8x16au */ - case 0x035: /* VIS I fmul8x16al */ - case 0x036: /* VIS I fmul8sux16 */ - case 0x037: /* VIS I fmul8ulx16 */ - case 0x038: /* VIS I fmuld8sux16 */ - case 0x039: /* VIS I fmuld8ulx16 */ - case 0x04b: /* VIS I fpmerge */ - case 0x04d: /* VIS I fexpand */ - case 0x03e: /* VIS I pdist */ - case 0x03a: /* VIS I fpack32 */ - case 0x048: /* VIS I faligndata */ - case 0x04c: /* VIS II bshuffle */ - case 0x020: /* VIS I fcmple16 */ - case 0x022: /* VIS I fcmpne16 */ - case 0x024: /* VIS I fcmple32 */ - case 0x026: /* VIS I fcmpne32 */ - case 0x028: /* VIS I fcmpgt16 */ - case 0x02a: /* VIS I fcmpeq16 */ - case 0x02c: /* VIS I fcmpgt32 */ - case 0x02e: /* VIS I fcmpeq32 */ - case 0x03b: /* VIS I fpack16 */ - case 0x03d: /* VIS I fpackfix */ - case 0x060: /* VIS I fzero */ - case 0x061: /* VIS I fzeros */ - case 0x07e: /* VIS I fone */ - case 0x07f: /* VIS I fones */ - g_assert_not_reached(); /* in decodetree */ - case 0x080: /* VIS I shutdown */ - case 0x081: /* VIS II siam */ - // XXX - goto illegal_insn; - default: - goto illegal_insn; - } -#endif - } else { - goto illegal_insn; /* in decodetree */ - } - } - break; - case 3: /* load/store instructions */ - goto illegal_insn; /* in decodetree */ - } - advance_pc(dc); -#ifdef TARGET_SPARC64 - jmp_insn: -#endif - return; - illegal_insn: - gen_exception(dc, TT_ILL_INSN); - return; -} - static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -5613,7 +5470,7 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) dc->base.pc_next += 4; if (!decode(dc, insn)) { - disas_sparc_legacy(dc, insn); + gen_exception(dc, TT_ILL_INSN); } if (dc->base.is_jmp == DISAS_NORETURN) {