From patchwork Thu Jun 28 03:03:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140392 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1647692ljj; Wed, 27 Jun 2018 20:10:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcL6pKDTocYHq5OfpiWCGdDJHc/yzyNIuG74wNBWeA0iN9k6u4axFZYKAVu9rL+k+N9EajC X-Received: by 2002:a37:5607:: with SMTP id k7-v6mr7266342qkb.342.1530155419141; Wed, 27 Jun 2018 20:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530155419; cv=none; d=google.com; s=arc-20160816; b=Suv1+HI0RUU/BHX9TqJjWT2tPZvLA1+ODD68a12GmSUqem2SJOgjKF5QLA5l3hsYOH T0WIPiMMXPRReaKROmPc7w8/qt9efdzDu9fD4cfwg1fkgS9Uk/XMngAVe6HQ3fip0uoa TIcstGtvV5Ke5awBpmQZudsZfGAeniQ1FwRwjc7n7u12KgKvSoydaoEgo5rKzTNU7FF2 97Q67jQyjVc39BDXTUgJnGZuQ37YEAlMBb9r18csF8bFWyCHGiAv3aOxapFwkFcDEdIQ aq+W2aGlcuZMU34YY8iJ5y1Wufpby506zYOQV9UapBhl0cCOKwIXAgMNEw8RKX0V2Lsn aL0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=S4gTFeZHYbzKEYFy+mCAPw0hiMK8NeY0BQXvoQHvQSQ=; b=HJVOw3G5Qy5cEEHUezA7cVA88xXDBsKkblk7y9ZUEhNBol1pMMANsCaG+p7Yjn4gNE FjzpuembqCnvHjkVkUt0FtAwboIssNpcotggCz/v7ShGbxA5XyEQgetRD4//IYo8nrNh HGEaZA2XW/p7UChBkhJ2mVrSV80Bc7vCBun+elJgJQc7pgoqes5B75RrwMBCGMnYORTJ E75YonITcNdLIC7L+nwB1vSdvZXOzjcVa1y5f/sqwURjoIA1JTz3t15tO17/TuIgLNxL MEG6jbwvzL+PVikWpiTnIz3dVyMUZclqrQW9aghgF/ticcF7XVxyMrAvxqw4OuOR7z93 ofbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LahRxllt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b6-v6si94311qtc.19.2018.06.27.20.10.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Jun 2018 20:10:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LahRxllt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:34270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYNK6-0001kp-Gg for patch@linaro.org; Wed, 27 Jun 2018 23:10:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYNDo-00050W-RD for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYNDn-0007qW-Q3 for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:48 -0400 Received: from mail-pg0-x234.google.com ([2607:f8b0:400e:c05::234]:43008) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYNDn-0007oe-KA for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:47 -0400 Received: by mail-pg0-x234.google.com with SMTP id a14-v6so1794411pgw.10 for ; Wed, 27 Jun 2018 20:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S4gTFeZHYbzKEYFy+mCAPw0hiMK8NeY0BQXvoQHvQSQ=; b=LahRxlltZXO2f3fjpHYmJb+xFN4by79AHRaGwNPFruaBWFlsnFCQWKibJSuvqMr5yn C8IG2PEtvsj87Azda2AdCR6N/PXI2weruD3Wdn7xt5T6zKSRZzQM8w2SZLPLfGwaTN1T LaOF0973N1HwJ/qTKCAGLVv6y7aIzehWvGojs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S4gTFeZHYbzKEYFy+mCAPw0hiMK8NeY0BQXvoQHvQSQ=; b=G01n2ab6B92RSVBUQUWRnsR00zLNXiur3AYsrUsVLCvbMr/WK5nmy3Obo6Dz7zmBj9 NqbsQ0FYASPTQbiGiOsV+PIR/+8FYHzREpZMkarpLAJElbSv9qgLBHSWLlzC6qE4qBB5 5438l4KKeoAoW/fiesuRFXGC2W4KmKqzamw+Osb9sjudQpCI5mCx143P9mayK80ENQVn gphGjozbbTkPqAMqpXcnFaFdN20SUlVy7zKEOmfp58dtj9kWoi/QaTTaMUH0bW+yfsx7 ULOAJ7TyU+wnB3PPIYihtYeuUGBVzW0c8XoBJ3VPIQKxVSFqaErRjD/aw9S0y4Kn4vLm jOLQ== X-Gm-Message-State: APt69E0YFdPF08WDYzzMZSPc8EWYsyMhKHoQc5YvjsZD4HLe1Gf9qfkv URKQZST5RFmSeFnGMdGU6VVTzj2NtII= X-Received: by 2002:a62:678f:: with SMTP id t15-v6mr4999349pfj.85.1530155026211; Wed, 27 Jun 2018 20:03:46 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id y15-v6sm8030489pfm.136.2018.06.27.20.03.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Jun 2018 20:03:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 27 Jun 2018 20:03:17 -0700 Message-Id: <20180628030330.15615-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628030330.15615-1-richard.henderson@linaro.org> References: <20180628030330.15615-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::234 Subject: [Qemu-devel] [PATCH v3 10/23] target/openrisc: Form the spr index from tcg X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shorne@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rather than pass base+offset to the helper, pass the full index. In most cases the base is r0 and optimization yields a constant. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/openrisc/helper.h | 4 ++-- target/openrisc/sys_helper.c | 9 +++------ target/openrisc/translate.c | 16 +++++++++------- 3 files changed, 14 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/target/openrisc/helper.h b/target/openrisc/helper.h index e37dabc77a..9db9bf3963 100644 --- a/target/openrisc/helper.h +++ b/target/openrisc/helper.h @@ -56,5 +56,5 @@ FOP_CMP(le) DEF_HELPER_FLAGS_1(rfe, 0, void, env) /* sys */ -DEF_HELPER_FLAGS_4(mtspr, 0, void, env, tl, tl, tl) -DEF_HELPER_FLAGS_4(mfspr, TCG_CALL_NO_WG, tl, env, tl, tl, tl) +DEF_HELPER_FLAGS_3(mtspr, 0, void, env, tl, tl) +DEF_HELPER_FLAGS_3(mfspr, TCG_CALL_NO_WG, tl, env, tl, tl) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index 2f337363ec..2c959f63f4 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -27,13 +27,11 @@ #define TO_SPR(group, number) (((group) << 11) + (number)) -void HELPER(mtspr)(CPUOpenRISCState *env, - target_ulong ra, target_ulong rb, target_ulong offset) +void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) { #ifndef CONFIG_USER_ONLY OpenRISCCPU *cpu = openrisc_env_get_cpu(env); CPUState *cs = CPU(cpu); - int spr = (ra | offset); int idx; switch (spr) { @@ -202,13 +200,12 @@ void HELPER(mtspr)(CPUOpenRISCState *env, #endif } -target_ulong HELPER(mfspr)(CPUOpenRISCState *env, - target_ulong rd, target_ulong ra, uint32_t offset) +target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, + target_ulong spr) { #ifndef CONFIG_USER_ONLY OpenRISCCPU *cpu = openrisc_env_get_cpu(env); CPUState *cs = CPU(cpu); - int spr = (ra | offset); int idx; switch (spr) { diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 59605aacca..64b5e84630 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -865,9 +865,10 @@ static bool trans_l_mfspr(DisasContext *dc, arg_l_mfspr *a, uint32_t insn) if (is_user(dc)) { gen_illegal_exception(dc); } else { - TCGv_i32 ti = tcg_const_i32(a->k); - gen_helper_mfspr(cpu_R[a->d], cpu_env, cpu_R[a->d], cpu_R[a->a], ti); - tcg_temp_free_i32(ti); + TCGv spr = tcg_temp_new(); + tcg_gen_ori_tl(spr, cpu_R[a->a], a->k); + gen_helper_mfspr(cpu_R[a->d], cpu_env, cpu_R[a->d], spr); + tcg_temp_free(spr); } return true; } @@ -877,7 +878,7 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr *a, uint32_t insn) if (is_user(dc)) { gen_illegal_exception(dc); } else { - TCGv_i32 ti; + TCGv spr; /* For SR, we will need to exit the TB to recognize the new * exception state. For NPC, in theory this counts as a branch @@ -892,9 +893,10 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr *a, uint32_t insn) } dc->base.is_jmp = DISAS_EXIT; - ti = tcg_const_i32(a->k); - gen_helper_mtspr(cpu_env, cpu_R[a->a], cpu_R[a->b], ti); - tcg_temp_free_i32(ti); + spr = tcg_temp_new(); + tcg_gen_ori_tl(spr, cpu_R[a->a], a->k); + gen_helper_mtspr(cpu_env, spr, cpu_R[a->b]); + tcg_temp_free(spr); } return true; }