From patchwork Tue May 16 19:41:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 682395 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp19562wrt; Tue, 16 May 2023 12:54:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ449XGKDgfq42Xoruf6mlGi71mB+XI64vK4nYMkqA+ubeBmd5B5vBKUE/AXQaJmxP03FUze X-Received: by 2002:ac8:5c0c:0:b0:3f3:9080:dfba with SMTP id i12-20020ac85c0c000000b003f39080dfbamr53591108qti.26.1684266845777; Tue, 16 May 2023 12:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684266845; cv=none; d=google.com; s=arc-20160816; b=VAsiRZSBu1QIp+1anVORs8zc0z/hALqttq7Ty3g1BSBPqT2xMlQ5PKjJB8fgdub4X7 ED+F4T/z8KFqBVj8kNHDAkhBmMtsqzyRnbg7Q5J7Mde4clAEOeV0xUj5MpN+cEHyYmHn obBTjCv7UKvJkPY2w6bLXih7Ts7jZTCivPsaaZnn+eH/AUPk45qJBwi/7H8zB0N2JyOJ PiW/Fbs3+wPo7R5XvCe8FkpkxaJB72UxvESxZujSNn4ViSV+noPq6otLbRnwVnvPEd5j YFsMmHOxvQ4KCJZnpeZK5WjpBsU+uPnk4ZYiy6hlXWOS9XmuBKAiExs7vU9qHeIyx3wJ 3PoA== 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=fSOV4jl3j5hzwAPTwI3x2Fzdh0+s6tsMA+VJ/6oh0dE=; b=E7dSJGjWw/kgWqMDy/77/r1Se4KPcXmY2Ebd61uAS7bf0HFe8J5PuiCd8XS5WgykwA oE2Jg2bmYiYVjP6vczsGtthaFVrfNb6b5bg1IBEcUtFJoiynF+Hk66thXbyn4pK3Cte8 NaTi4xPjVOAA337z/i2y5oFaMtB0VsWbG3WjEIQpijFlJ+2wYBgTAjys+jTg17MvUlIn Tk67Sp5QqqHekmPNvWrBrYMfRxvMm0xQ2/sJo0JJRdAKetYqLPt3ksDu2UrHrVv0D9fI 5/xcqK+xWyoU0cOfRn5TT9Vc1KUSRES/HW0IzcdX0aEuVTXEBGhRB68uvlFE3llDapeZ JA/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TNURn/+w"; 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 h3-20020ac85843000000b003ef3aa3a380si11241602qth.798.2023.05.16.12.54.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 May 2023 12:54:05 -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="TNURn/+w"; 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 1pz0cW-0000le-K4; Tue, 16 May 2023 15:46: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 1pz0cC-0000F8-Nm for qemu-devel@nongnu.org; Tue, 16 May 2023 15:45:46 -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 1pz0c8-0003kD-Fj for qemu-devel@nongnu.org; Tue, 16 May 2023 15:45:43 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1ae3f6e5d70so476295ad.1 for ; Tue, 16 May 2023 12:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684266337; x=1686858337; 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=fSOV4jl3j5hzwAPTwI3x2Fzdh0+s6tsMA+VJ/6oh0dE=; b=TNURn/+wcOw0pA0vz/YDrAomaGJWsv0oCwqbpP5XUAh3dSj4sYkyXia8NZdzffQhE0 ObzTonhoU8vCoMc2nEYxZlCWzkQMbvzsGf+USr4QNm1+5HWUm2bxIrqmGx1o/PVPNKLs IEbJMQpSSw1FyRG/cSwWl82vWLeuWP8nnLfzsxmRCph3zdevQRbhIXCREjaAp50Yy7qL cqvF7vaKHd80kbBEZLOtCivqrUkkEuNzOjHKX5jJkDNgX0eS8Hc/LaZRQyqO3eO9DDIX eMNo08bcZWXWJ+C8nJiN/SzULs1sjMKWSAVtcCvED//VD8cGnznPU5ubDvDP1bK+Q1hg BxjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684266337; x=1686858337; 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=fSOV4jl3j5hzwAPTwI3x2Fzdh0+s6tsMA+VJ/6oh0dE=; b=d7P8Ievak273/ZRnKt6+DxdhQdfPxMg9qO1xFA+ELXo8Mnx8P1e1hoV30EJM+f6gOo 5iDNwfuH2KrPLZPY0TEgU4dDwNQdENT0qjp1Q13NH10ty/nKXIO0RnJEF3Qw02kh6AUT BW2nRKnR/eXe9rQodzoVgkPqfemwgiOyhFkUpszHjEUzZqHCB7sZ2ZWEsSpkuM+EvGDB YkMrCTZ9yaiWiWUHfCn5G46Xq+gpymnjRW74VNTtJjWVl9SZTs+gTvK+z1OvCEo93mBP cK6QyZqf9i0jTJnbKdB7enMm0kArZA6Z0aPB2Ths+XnulIgiOA0Mq1iOJtQOqM7zOOhs IlrA== X-Gm-Message-State: AC+VfDyioKkfwshSR3HTjr7zWRiKqwx1qguKhsmGcDwEYwRhK8wagm0c vWHvEFGpTrwL2qHga5sf6zILImoKkBon3yKPSpE= X-Received: by 2002:a17:902:eccc:b0:1ac:b449:3528 with SMTP id a12-20020a170902eccc00b001acb4493528mr28624229plh.46.1684266337204; Tue, 16 May 2023 12:45:37 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:ec81:440e:33a4:40b9]) by smtp.gmail.com with ESMTPSA id y12-20020a17090abd0c00b002508d73f4e8sm25555pjr.57.2023.05.16.12.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 12:45:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 56/80] tcg: Widen helper_{ld,st}_i128 addresses to uint64_t Date: Tue, 16 May 2023 12:41:21 -0700 Message-Id: <20230516194145.1749305-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516194145.1749305-1-richard.henderson@linaro.org> References: <20230516194145.1749305-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, T_SCC_BODY_TEXT_LINE=-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 Always pass the target address as uint64_t. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 4 ++-- accel/tcg/cputlb.c | 5 ++--- accel/tcg/user-exec.c | 5 ++--- tcg/tcg-op-ldst.c | 26 ++++++++++++++++++++++++-- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index d9adc646c1..0e6c5f55fd 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -39,8 +39,8 @@ DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) DEF_HELPER_FLAGS_3(memset, TCG_CALL_NO_RWG, ptr, ptr, int, ptr) #endif /* IN_HELPER_PROTO */ -DEF_HELPER_FLAGS_3(ld_i128, TCG_CALL_NO_WG, i128, env, tl, i32) -DEF_HELPER_FLAGS_4(st_i128, TCG_CALL_NO_WG, void, env, tl, i128, i32) +DEF_HELPER_FLAGS_3(ld_i128, TCG_CALL_NO_WG, i128, env, i64, i32) +DEF_HELPER_FLAGS_4(st_i128, TCG_CALL_NO_WG, void, env, i64, i128, i32) DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, i32, env, tl, i32, i32, i32) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 5440f68deb..ae0fbcdee2 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -2551,7 +2551,7 @@ Int128 helper_ld16_mmu(CPUArchState *env, uint64_t addr, return do_ld16_mmu(env, addr, oi, retaddr); } -Int128 helper_ld_i128(CPUArchState *env, target_ulong addr, uint32_t oi) +Int128 helper_ld_i128(CPUArchState *env, uint64_t addr, uint32_t oi) { return helper_ld16_mmu(env, addr, oi, GETPC()); } @@ -3024,8 +3024,7 @@ void helper_st16_mmu(CPUArchState *env, uint64_t addr, Int128 val, do_st16_mmu(env, addr, val, oi, retaddr); } -void helper_st_i128(CPUArchState *env, target_ulong addr, Int128 val, - MemOpIdx oi) +void helper_st_i128(CPUArchState *env, uint64_t addr, Int128 val, MemOpIdx oi) { helper_st16_mmu(env, addr, val, oi, GETPC()); } diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 9a7afb6f78..36ad8284a5 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -1136,7 +1136,7 @@ Int128 helper_ld16_mmu(CPUArchState *env, uint64_t addr, return ret; } -Int128 helper_ld_i128(CPUArchState *env, target_ulong addr, MemOpIdx oi) +Int128 helper_ld_i128(CPUArchState *env, uint64_t addr, MemOpIdx oi) { return helper_ld16_mmu(env, addr, oi, GETPC()); } @@ -1343,8 +1343,7 @@ void helper_st16_mmu(CPUArchState *env, uint64_t addr, Int128 val, do_st16_he_mmu(env, addr, val, mop, ra); } -void helper_st_i128(CPUArchState *env, target_ulong addr, - Int128 val, MemOpIdx oi) +void helper_st_i128(CPUArchState *env, uint64_t addr, Int128 val, MemOpIdx oi) { helper_st16_mmu(env, addr, val, oi, GETPC()); } diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index d8503d7da4..aab6dda454 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -393,6 +393,24 @@ static void canonicalize_memop_i128_as_i64(MemOp ret[2], MemOp orig) #define tcg_temp_ebb_new tcg_temp_ebb_new_i32 #endif +static TCGv_i64 maybe_extend_addr64(TCGv addr) +{ +#if TARGET_LONG_BITS == 32 + TCGv_i64 a64 = tcg_temp_ebb_new_i64(); + tcg_gen_extu_i32_i64(a64, addr); + return a64; +#else + return addr; +#endif +} + +static void maybe_free_addr64(TCGv_i64 a64) +{ +#if TARGET_LONG_BITS == 32 + tcg_temp_free_i64(a64); +#endif +} + void tcg_gen_qemu_ld_i128(TCGv_i128 val, TCGv addr, TCGArg idx, MemOp memop) { const MemOpIdx oi = make_memop_idx(memop, idx); @@ -467,7 +485,9 @@ void tcg_gen_qemu_ld_i128(TCGv_i128 val, TCGv addr, TCGArg idx, MemOp memop) tcg_gen_bswap64_i64(y, y); } } else { - gen_helper_ld_i128(val, cpu_env, addr, tcg_constant_i32(oi)); + TCGv_i64 a64 = maybe_extend_addr64(addr); + gen_helper_ld_i128(val, cpu_env, a64, tcg_constant_i32(oi)); + maybe_free_addr64(a64); } plugin_gen_mem_callbacks(addr, oi, QEMU_PLUGIN_MEM_R); @@ -547,7 +567,9 @@ void tcg_gen_qemu_st_i128(TCGv_i128 val, TCGv addr, TCGArg idx, MemOp memop) } tcg_temp_free(addr_p8); } else { - gen_helper_st_i128(cpu_env, addr, val, tcg_constant_i32(oi)); + TCGv_i64 a64 = maybe_extend_addr64(addr); + gen_helper_st_i128(cpu_env, a64, val, tcg_constant_i32(oi)); + maybe_free_addr64(a64); } plugin_gen_mem_callbacks(addr, oi, QEMU_PLUGIN_MEM_W);