From patchwork Thu Jan 26 04:38:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 647074 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp59044pvb; Wed, 25 Jan 2023 20:43:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXttop2w75OhfY9+kUfPBYwgzfpzxYqL+FRvrI9hKNiOwN8xq2XiRJeZNSHeHjLMa+lOI6v2 X-Received: by 2002:ac8:71c8:0:b0:3af:b6bd:aba7 with SMTP id i8-20020ac871c8000000b003afb6bdaba7mr52454602qtp.43.1674708220099; Wed, 25 Jan 2023 20:43:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674708220; cv=none; d=google.com; s=arc-20160816; b=kioNZorkOyhcyJEH/uJBUv68lQILsDT/Rr4vR2TIHkaZrdNa18mYfjM4IT7U0+6JtO 48Aivxmh7hNZAoakegIuddD1Yag/jolWmBAHipKlAhHvMGzkC5iB8qrFyQ+cBY58ihFU ujlp+P/ieUeoQP50MvW5F85IlJL0fx7zBRrpqE8EX1h/5NZwZ8nK8QVTdhwmHOwiQA58 3ogdAfraBy73PHJVdhPLxgO+mTMNM5BRuNybbn6BuSSzpIiw3DS5ds3S8yKZvoLXv9MK OOtm0Yd1RQ7rJIilagTgABX0m7FL+x9rXf0gTYTBVrDnKcAQjlzjQWiF8w+0Hi9VZNco h4EQ== 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=UP8+uewyy5/Dp5hv7KFYTuYDZZ769Cjknfcg/UBdlzw=; b=I+koA6PV/4H8Fb6CUcbxWPrND0b3s3va0GCf8yDXqE5ISNtVBxtqb6rHi+Z8CW4ZKt DX5k3lrNWyo0VC9u9NO8PyqL+yatie94GEqlYgnI4nG68J/UtDQaqqXeM81T6tsfiRqT zYrC6IMQKXRkqWHHfhMkJb5MPEASxmmHkoCBrWw++uNsk1YH9QJ5WfknI2P4qOBJQFLA xUv8iw6qx0eKwqUsOutFrMyrTcUtOmli7iM+arlTedpiFkE978XslQGkaXD8ZHoHsvqD LzNNx3MXjYlIOGLBZHqsSYLwRecP/HwsG0r8B35+HJ6E8KSDp1w5XT8+xwGPiLiYOIAp kRFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mO8vhEYM; 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 t9-20020a05622a148900b003b68cc23804si114175qtx.528.2023.01.25.20.43.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jan 2023 20:43:40 -0800 (PST) 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=mO8vhEYM; 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 1pKu2I-0000Co-RH; Wed, 25 Jan 2023 23:38:54 -0500 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 1pKu2H-0000Bk-49 for qemu-devel@nongnu.org; Wed, 25 Jan 2023 23:38:53 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKu2F-0004SL-EO for qemu-devel@nongnu.org; Wed, 25 Jan 2023 23:38:52 -0500 Received: by mail-pj1-x102c.google.com with SMTP id h5-20020a17090a9c0500b0022bb85eb35dso701086pjp.3 for ; Wed, 25 Jan 2023 20:38:50 -0800 (PST) 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:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UP8+uewyy5/Dp5hv7KFYTuYDZZ769Cjknfcg/UBdlzw=; b=mO8vhEYMEmZle3X/TKK4InC7EJZLvWKjj89gV1BbF8uXwK80CaKQRmwu9dxiwu15oh fdPBfbhHW68jZTskcY+tTNQoXyQgPzO7VrzBh2b+mym9wgU7u2W+wJ4yNhhoj1yjNCdD UKickLuayHfsaV5VAV7xuJlvSg/HYIaX0gD6sCXErgW6H406puDVZL41fmFJzXrBOoFu h6iFWrUyX/XJMEQZUnrrT1UFKF9Sb68hriPGjqjjwYyXyGjV1FO3QMMKySUxrgLgXIKh P5A0GEviPKTfd3MGvCBuWcGF7uiDdLyBH/wX63QhQY7f751/3B+fbFcTh6DlEehCZinw vj1A== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UP8+uewyy5/Dp5hv7KFYTuYDZZ769Cjknfcg/UBdlzw=; b=wD1yCAG0DTbXrBsMLrG9YqPnOneDz1+o+W2BH+Kp7U48OdQ3SRms6TzkIIkBKuJMLz MivZbhd+vxSmFVm5BRhrU/yH6VG1V+6ytleMoUEzvyjZcA1jtWljpNJ837E+DMsPWi9o 0kobaeixvwtphbFWh4ALfLxMzxnzIbJ1TkzyH1L5ovkF/4t4EwGol6cYuQ26jD5VX/RD xtn4Y+vXGQjz/3IsS3dst40uZeo9xBcs+RMB2X0PQrYItwByHj0C+gH6DX1objFRXJDn bzoPVyNb1d1FlQVNb4y3LX072eGS2Q2JA9GpyXz4GZAeeaGkNe4myCddlHOlGm57CL78 MI8g== X-Gm-Message-State: AO0yUKUOLcE5kGL6cSIkUUbCq+rcZi5GkjjCFuxj3VCFXbsl/+ANt28e qt8svz5/0kUFcf1fDl5xTFIIMPGHT58BfCT9weE= X-Received: by 2002:a17:90a:31a:b0:22b:b681:2bb3 with SMTP id 26-20020a17090a031a00b0022bb6812bb3mr761275pje.38.1674707929524; Wed, 25 Jan 2023 20:38:49 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id s62-20020a17090a69c400b00228e56d375asm233376pjj.33.2023.01.25.20.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 20:38:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v5 14/36] tcg: Add basic data movement for TCGv_i128 Date: Wed, 25 Jan 2023 18:38:02 -1000 Message-Id: <20230126043824.54819-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126043824.54819-1-richard.henderson@linaro.org> References: <20230126043824.54819-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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-bounces+patch=linaro.org@nongnu.org Add code generation functions for data movement between TCGv_i128 (mov) and to/from TCGv_i64 (concat, extract). Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- include/tcg/tcg-op.h | 4 ++++ tcg/tcg-internal.h | 13 +++++++++++++ tcg/tcg-op.c | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 79b1cf786f..c4276767d1 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -712,6 +712,10 @@ void tcg_gen_extrh_i64_i32(TCGv_i32 ret, TCGv_i64 arg); void tcg_gen_extr_i64_i32(TCGv_i32 lo, TCGv_i32 hi, TCGv_i64 arg); void tcg_gen_extr32_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i64 arg); +void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src); +void tcg_gen_extr_i128_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i128 arg); +void tcg_gen_concat_i64_i128(TCGv_i128 ret, TCGv_i64 lo, TCGv_i64 hi); + static inline void tcg_gen_concat32_i64(TCGv_i64 ret, TCGv_i64 lo, TCGv_i64 hi) { tcg_gen_deposit_i64(ret, lo, hi, 32, 32); diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index 33f1d8b411..e542a4e9b7 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -117,4 +117,17 @@ extern TCGv_i32 TCGV_LOW(TCGv_i64) QEMU_ERROR("32-bit code path is reachable"); extern TCGv_i32 TCGV_HIGH(TCGv_i64) QEMU_ERROR("32-bit code path is reachable"); #endif +static inline TCGv_i64 TCGV128_LOW(TCGv_i128 t) +{ + /* For 32-bit, offset by 2, which may then have TCGV_{LOW,HIGH} applied. */ + int o = HOST_BIG_ENDIAN ? 64 / TCG_TARGET_REG_BITS : 0; + return temp_tcgv_i64(tcgv_i128_temp(t) + o); +} + +static inline TCGv_i64 TCGV128_HIGH(TCGv_i128 t) +{ + int o = HOST_BIG_ENDIAN ? 0 : 64 / TCG_TARGET_REG_BITS; + return temp_tcgv_i64(tcgv_i128_temp(t) + o); +} + #endif /* TCG_INTERNAL_H */ diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 326a9180ef..cb83d2375d 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2747,6 +2747,26 @@ void tcg_gen_extr32_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i64 arg) tcg_gen_shri_i64(hi, arg, 32); } +void tcg_gen_extr_i128_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i128 arg) +{ + tcg_gen_mov_i64(lo, TCGV128_LOW(arg)); + tcg_gen_mov_i64(hi, TCGV128_HIGH(arg)); +} + +void tcg_gen_concat_i64_i128(TCGv_i128 ret, TCGv_i64 lo, TCGv_i64 hi) +{ + tcg_gen_mov_i64(TCGV128_LOW(ret), lo); + tcg_gen_mov_i64(TCGV128_HIGH(ret), hi); +} + +void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src) +{ + if (dst != src) { + tcg_gen_mov_i64(TCGV128_LOW(dst), TCGV128_LOW(src)); + tcg_gen_mov_i64(TCGV128_HIGH(dst), TCGV128_HIGH(src)); + } +} + /* QEMU specific operations. */ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx)