From patchwork Fri Feb 28 16:43:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 11412951 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90C1B14B4 for ; Fri, 28 Feb 2020 17:10:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6797024691 for ; Fri, 28 Feb 2020 17:10:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="H212CCVj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6797024691 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=quicinc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7j9J-0002Ah-Er for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Feb 2020 12:10:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58146) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7ilL-0004JQ-T2 for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:45:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7ilK-0006RZ-M0 for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:45:19 -0500 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:13235) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j7ilK-0005U6-A6 for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:45:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1582908318; x=1614444318; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sz7cTBLXZ39E2Ayr0LEt3+On+c/m/Mochko6fLoMR1g=; b=H212CCVj1gQwWmYlf0lImKaeLwSoILuhT2rVx/yBY8V8CE370c1fsIVi x0WCHSNNN8CFj1gBb3TF/J6C4tk1TDkILNxR1sYqB6q/Ckg0/Rr6JIu8+ fhAuRw3crEohz5fwCYKvSfIrordza9pbyeH+69ITPa63YzNQ1KqF6CT9D I=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-01.qualcomm.com with ESMTP; 28 Feb 2020 08:44:31 -0800 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg02-sd.qualcomm.com with ESMTP; 28 Feb 2020 08:44:31 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id D3ABF1102; Fri, 28 Feb 2020 10:44:30 -0600 (CST) From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 35/67] Hexagon TCG generation helpers - step 2 Date: Fri, 28 Feb 2020 10:43:31 -0600 Message-Id: <1582908244-304-36-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582908244-304-1-git-send-email-tsimpson@quicinc.com> References: <1582908244-304-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 199.106.114.38 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, richard.henderson@linaro.org, laurent@vivier.eu, Taylor Simpson , philmd@redhat.com, aleksandar.m.mail@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Helpers for load-locked/store-conditional Signed-off-by: Taylor Simpson --- target/hexagon/genptr_helpers.h | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/target/hexagon/genptr_helpers.h b/target/hexagon/genptr_helpers.h index d8d5d95..c0e4c39 100644 --- a/target/hexagon/genptr_helpers.h +++ b/target/hexagon/genptr_helpers.h @@ -334,4 +334,56 @@ static inline TCGv gen_set_bit(int i, TCGv result, TCGv src) return result; } +static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int mem_index) +{ + tcg_gen_qemu_ld32u(dest, vaddr, mem_index); + tcg_gen_mov_tl(llsc_addr, vaddr); + tcg_gen_mov_tl(llsc_val, dest); +} + +static inline void gen_load_locked8u(TCGv_i64 dest, TCGv vaddr, int mem_index) +{ + tcg_gen_qemu_ld64(dest, vaddr, mem_index); + tcg_gen_mov_tl(llsc_addr, vaddr); + tcg_gen_mov_i64(llsc_val_i64, dest); +} + +static inline void gen_store_conditional4(CPUHexagonState *env, + DisasContext *ctx, int prednum, + TCGv pred, TCGv vaddr, TCGv src) +{ + TCGv tmp = tcg_temp_new(); + TCGLabel *fail = gen_new_label(); + + tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_addr)); + tcg_gen_brcond_tl(TCG_COND_NE, vaddr, tmp, fail); + tcg_gen_movi_tl(tmp, prednum); + tcg_gen_st_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_reg)); + tcg_gen_st_tl(src, cpu_env, offsetof(CPUHexagonState, llsc_newval)); + gen_exception(HEX_EXCP_SC4); + + gen_set_label(fail); + tcg_gen_movi_tl(pred, 0); + tcg_temp_free(tmp); +} + +static inline void gen_store_conditional8(CPUHexagonState *env, + DisasContext *ctx, int prednum, + TCGv pred, TCGv vaddr, TCGv_i64 src) +{ + TCGv tmp = tcg_temp_new(); + TCGLabel *fail = gen_new_label(); + + tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_addr)); + tcg_gen_brcond_tl(TCG_COND_NE, vaddr, tmp, fail); + tcg_gen_movi_tl(tmp, prednum); + tcg_gen_st_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_reg)); + tcg_gen_st_i64(src, cpu_env, offsetof(CPUHexagonState, llsc_newval_i64)); + gen_exception(HEX_EXCP_SC8); + + gen_set_label(fail); + tcg_gen_movi_tl(pred, 0); + tcg_temp_free(tmp); +} + #endif