From patchwork Fri Oct 21 07:15:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 617158 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp833460pvb; Fri, 21 Oct 2022 02:03:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6y89Bs3sX32itVGH93LSfuil6UT45bhoBnPdQg+f0bs0h+REw5gE7hORaVqQqti3qR5HZh X-Received: by 2002:a37:4247:0:b0:6e7:6992:93c4 with SMTP id p68-20020a374247000000b006e7699293c4mr12591924qka.696.1666343018944; Fri, 21 Oct 2022 02:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666343018; cv=none; d=google.com; s=arc-20160816; b=Ny3IsbjGlI7Y/LIk2MkFB2YOJB9LwTQh6pmujNaYW5NCoPpi3Nfs8SwIPsEqIVmgrf KvXp4htkg5cj+a8rgMWCR9mEeiW/HOP6lgyc2zI5A9ivT02HNo6CbBIvSuA6RFaPEZJb f2ZiPjSaBfdMQOLvEvSw0upVSg8lZGYUdP03c8nqJOEOCEoiHz1ML0pLgbLIdwlzxdEa 8hGY0xJXFJGxlC1K2Rfz0I99X690IJhfWckiJCyxI2eKDet5+gVmUlTtweJA2pmqnMs6 MrKDopeeFiJGnbsomeAzqinNGgucKWNEnYP214ik9VgBh0le/Ln3o86H/9GV9lGw3jpJ OAZw== 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:to:from :dkim-signature; bh=PgG5Fqrssx+hkjV71ieV43u3E3Admzr0DyJnKERg/wk=; b=CqJ26R6d9dz0XTEb1vAVTVIZNjsxYZ1O2xkg+/kqo/BJ+D/I0wqSuFlmRSpulzBodH YgtFh0ZfiQrCsr81J9asU+vb4adEr9HnCWtsP1N4jUKoRZvCn64Hk67zGlqzxCfmeOgf kvrogsIur+3Cd5glChM30MZHpvFFXKsF9QMoh1yilaZF8aePnGT7zULOPf+vexuAYfyM vGKhLQwm+g9wcuDxiEFif4iM8RyxJoixPDMDjbtv1QJzjYMswKMKqt2BRBBHTVmrx1xK BMo3PUh+XXdRMTMewD31ybHQT3drg9c/LI4nGTw1ai4kzBxsPosQrf+uXS+MHJdWAbj2 +dGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uTjEO3S+; 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 j5-20020a05620a410500b006ce8a7187d1si12136166qko.36.2022.10.21.02.03.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Oct 2022 02:03:38 -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=uTjEO3S+; 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=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olnwC-0004B5-T4 for patch@linaro.org; Fri, 21 Oct 2022 05:03:34 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olmIE-0003bV-P4 for patch@linaro.org; Fri, 21 Oct 2022 03:18: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 1olmI7-0003Tb-4S for qemu-devel@nongnu.org; Fri, 21 Oct 2022 03:18:03 -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 1olmI5-0005vu-1i for qemu-devel@nongnu.org; Fri, 21 Oct 2022 03:18:02 -0400 Received: by mail-pf1-x42d.google.com with SMTP id 67so1768210pfz.12 for ; Fri, 21 Oct 2022 00:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PgG5Fqrssx+hkjV71ieV43u3E3Admzr0DyJnKERg/wk=; b=uTjEO3S+5D2iCzyR9gxlKziNgg/CVVxBavm+mGgXMCLCOw8k19pHpw7VemSUDD1sVd 6WzWgZ6/1oPuEkiGg/OQluP9Ctd5Evs3dNHJKKv+AXtdzhhnHyuk1rRuZcsA+IJM0pgU 6ZsDetv0Z7G7YmyaW6wbfxP68wbdjsrrKP4q2lRzKw0UfNcHDUGuIX0jNa5MwYy1Ft1v Wzf6C0qsdDKPQI97g582jw1rRmX2I23ym2Vt1oOBTXEGDX4kny6Vt2Th3MZTW8W5adT5 jFjECOeOy1mAkZbwvBwDmoh6f0NduRGVUWwbO/xfMz/cBaaIMLRFNQuSpM7PylXopFxn gsuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PgG5Fqrssx+hkjV71ieV43u3E3Admzr0DyJnKERg/wk=; b=lbrdpp8BFpm3gqi5857h4ruOfLqbpRXNC8tfj/ash/EbtKP8QuI4qXpBR+43JumWyB OR1IDCYnVc9DJI7Kz/ScW+0M4GhYgCP+i5YQUMBQh4I9TYiLYvaaGfhOeK9EmHmtUzF8 OrX6U2liLFS9OFUSPeQexKrkdts2hMhdaHuf0SCZuhYGYu18nYBtNsETiD/BkQqJggE8 +uwaW15JtMqQBavgC53cs09l671LkAIXu6uOBv8sPeLZQuIowaKGgp5gytmUzxfjdLPm oYWCfR/DFVzAEtkX+rbELQ9+lWTX6YiVOzkj4akJAkX8rkfvcb+dsFzZgNYrCoxq0LS+ UOPA== X-Gm-Message-State: ACrzQf2xHzuyxjvVn5HlpMQV61A/i40eZDODw/KlkXEKClYIq/87ZfAG PrWc9BsPeFRfd4ott7ekpwNNSVSuNfImIGog X-Received: by 2002:a63:5703:0:b0:439:14a8:52b with SMTP id l3-20020a635703000000b0043914a8052bmr14521561pgb.500.1666336679704; Fri, 21 Oct 2022 00:17:59 -0700 (PDT) Received: from localhost.localdomain ([149.135.10.35]) by smtp.gmail.com with ESMTPSA id q9-20020a638c49000000b0041cd5ddde6fsm13003327pgn.76.2022.10.21.00.17.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 00:17:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 35/36] tcg: Add temp allocation for TCGv_i128 Date: Fri, 21 Oct 2022 17:15:48 +1000 Message-Id: <20221021071549.2398137-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221021071549.2398137-1-richard.henderson@linaro.org> References: <20221021071549.2398137-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" This enables allocation of i128. The type is not yet usable, as we have not yet added data movement ops. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 32 ++++++++++++++++++++++++++++++++ tcg/tcg.c | 32 +++++++++++++++++++++++++++----- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 88fb4f1d17..db2e10610d 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -701,6 +701,11 @@ static inline TCGTemp *tcgv_i64_temp(TCGv_i64 v) return tcgv_i32_temp((TCGv_i32)v); } +static inline TCGTemp *tcgv_i128_temp(TCGv_i128 v) +{ + return tcgv_i32_temp((TCGv_i32)v); +} + static inline TCGTemp *tcgv_ptr_temp(TCGv_ptr v) { return tcgv_i32_temp((TCGv_i32)v); @@ -721,6 +726,11 @@ static inline TCGArg tcgv_i64_arg(TCGv_i64 v) return temp_arg(tcgv_i64_temp(v)); } +static inline TCGArg tcgv_i128_arg(TCGv_i128 v) +{ + return temp_arg(tcgv_i128_temp(v)); +} + static inline TCGArg tcgv_ptr_arg(TCGv_ptr v) { return temp_arg(tcgv_ptr_temp(v)); @@ -742,6 +752,11 @@ static inline TCGv_i64 temp_tcgv_i64(TCGTemp *t) return (TCGv_i64)temp_tcgv_i32(t); } +static inline TCGv_i128 temp_tcgv_i128(TCGTemp *t) +{ + return (TCGv_i128)temp_tcgv_i32(t); +} + static inline TCGv_ptr temp_tcgv_ptr(TCGTemp *t) { return (TCGv_ptr)temp_tcgv_i32(t); @@ -864,6 +879,11 @@ static inline void tcg_temp_free_i64(TCGv_i64 arg) tcg_temp_free_internal(tcgv_i64_temp(arg)); } +static inline void tcg_temp_free_i128(TCGv_i128 arg) +{ + tcg_temp_free_internal(tcgv_i128_temp(arg)); +} + static inline void tcg_temp_free_ptr(TCGv_ptr arg) { tcg_temp_free_internal(tcgv_ptr_temp(arg)); @@ -912,6 +932,18 @@ static inline TCGv_i64 tcg_temp_local_new_i64(void) return temp_tcgv_i64(t); } +static inline TCGv_i128 tcg_temp_new_i128(void) +{ + TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I128, false); + return temp_tcgv_i128(t); +} + +static inline TCGv_i128 tcg_temp_local_new_i128(void) +{ + TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I128, true); + return temp_tcgv_i128(t); +} + static inline TCGv_ptr tcg_global_mem_new_ptr(TCGv_ptr reg, intptr_t offset, const char *name) { diff --git a/tcg/tcg.c b/tcg/tcg.c index 7cde82f12d..adf592ac96 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1250,18 +1250,39 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) tcg_debug_assert(ts->base_type == type); tcg_debug_assert(ts->kind == kind); } else { + bool want_pair = false; + TCGType half = type; + + switch (type) { + case TCG_TYPE_I32: + case TCG_TYPE_V64: + case TCG_TYPE_V128: + case TCG_TYPE_V256: + break; + case TCG_TYPE_I64: + half = TCG_TYPE_I32; + want_pair = TCG_TARGET_REG_BITS == 32; + break; + case TCG_TYPE_I128: + half = TCG_TYPE_I64; + want_pair = TCG_TARGET_REG_BITS == 64; + break; + default: + g_assert_not_reached(); + } + ts = tcg_temp_alloc(s); - if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) { + if (want_pair) { TCGTemp *ts2 = tcg_temp_alloc(s); ts->base_type = type; - ts->type = TCG_TYPE_I32; + ts->type = half; ts->temp_allocated = 1; ts->kind = kind; tcg_debug_assert(ts2 == ts + 1); - ts2->base_type = TCG_TYPE_I64; - ts2->type = TCG_TYPE_I32; + ts2->base_type = type; + ts2->type = half; ts2->temp_allocated = 1; ts2->temp_subindex = 1; ts2->kind = kind; @@ -2773,7 +2794,7 @@ static void la_cross_call(TCGContext *s, int nt) for (i = 0; i < nt; i++) { TCGTemp *ts = &s->temps[i]; - if (!(ts->state & TS_DEAD)) { + if (ts->type != TCG_TYPE_I128 && !(ts->state & TS_DEAD)) { TCGRegSet *pset = la_temp_pref(ts); TCGRegSet set = *pset; @@ -3404,6 +3425,7 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) case TCG_TYPE_V64: align = 8; break; + case TCG_TYPE_I128: case TCG_TYPE_V128: case TCG_TYPE_V256: /* Note that we do not require aligned storage for V256. */