From patchwork Tue Feb 11 00:40:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 11374623 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 7EDA313A4 for ; Tue, 11 Feb 2020 01:09:13 +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 5638B20708 for ; Tue, 11 Feb 2020 01:09:13 +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="V3rYvf4K" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5638B20708 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]:41940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1K36-0004K2-HW for patchwork-qemu-devel@patchwork.kernel.org; Mon, 10 Feb 2020 20:09:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:32992) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1JcP-0001pg-45 for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1JcN-0007yJ-Ng for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:36 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:59208) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1JcN-0004uP-Cg for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1581381695; x=1612917695; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tCTAwQrhccTZja81gm8eTGQCwBVmjPzsNGRta885dnM=; b=V3rYvf4KcLDyfzuTNtB40bI6/n+RFjLAH74F8H+4m/90ko4I8Jes4k+5 0fmlzIJAqjWnAtrbIYC9SU7hBbLYOqTyRKCNDlRrHa14triURbkehcdYH QQMnPWFkElA5LUFIFasVxjzEiPqYpxtrRDyWZMLkHnq5LMlRkKSUkYlzf E=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 10 Feb 2020 16:41:01 -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; 10 Feb 2020 16:41:00 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id A17381B27; Mon, 10 Feb 2020 18:41:00 -0600 (CST) From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH 34/66] Hexagon TCG generation helpers - step 2 Date: Mon, 10 Feb 2020 18:40:12 -0600 Message-Id: <1581381644-13678-35-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581381644-13678-1-git-send-email-tsimpson@quicinc.com> References: <1581381644-13678-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.39 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 2b91fdb..b780522 100644 --- a/target/hexagon/genptr_helpers.h +++ b/target/hexagon/genptr_helpers.h @@ -320,4 +320,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