Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230690/?format=api
{ "id": 2230690, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230690/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430000524.56046-39-richard.henderson@linaro.org/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260430000524.56046-39-richard.henderson@linaro.org>", "date": "2026-04-30T00:05:21", "name": "[v2,38/40] host-utils: Introduce signed saturation primitives", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "bfc1ba578f2b9c3bdc7cb75d32a29c291e6bd68b", "submitter": { "id": 72104, "url": "http://patchwork.ozlabs.org/api/1.1/people/72104/?format=api", "name": "Richard Henderson", "email": "richard.henderson@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430000524.56046-39-richard.henderson@linaro.org/mbox/", "series": [ { "id": 502170, "url": "http://patchwork.ozlabs.org/api/1.1/series/502170/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502170", "date": "2026-04-30T00:04:48", "name": "fpu: Export some internals for targets", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/502170/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230690/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230690/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=NohtZ3QV;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5ZKg2VcRz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 10:09:27 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIEwL-0001Hh-1V; Wed, 29 Apr 2026 20:07:37 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1wIEvj-0008Ot-UP\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 20:07:03 -0400", "from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1wIEvg-00020T-Vq\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 20:06:58 -0400", "by mail-pf1-x431.google.com with SMTP id\n d2e1a72fcca58-82f1f6103afso165109b3a.1\n for <qemu-devel@nongnu.org>; Wed, 29 Apr 2026 17:06:56 -0700 (PDT)", "from stoup.. ([180.233.125.15]) by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-834ed7ef7a8sm2928667b3a.47.2026.04.29.17.06.53\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 17:06:55 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1777507616; x=1778112416; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=JJ+2mrZj2pb/FuoZHFmN0VWVvULjnuLwIvCT2CXO/do=;\n b=NohtZ3QVqvMCjVMiZNbw2CfFfrQv/l9+zbOY8fONak6atC7dpAImr8DvSIZCBjxALT\n VyS/Em7qb4kte7ctC2BOgzxOqCR5biKrZOokTLyjaOGoPALvBk6o+5Y3uFB0iEX2c7Z4\n 9E9CW9mUUmnrMz0C9y4K/GPf4VBoovXY/yoboSAQdqmy4TT7Vps+j5F9nG4yFw/xA0N+\n xC8jF26YUAmZm04F1N/BPApzSgYz/bFlY8IZdSW66LZjt/pkElDtpAYdd8kRxTsly6Xg\n MVmY8o2WW6T4dQgpuoaRde4un73JdnqaF2F8uA1Xw6JvtG/MQeI1gglSPrfg+G/1jqs1\n ev4g==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777507616; x=1778112416;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=JJ+2mrZj2pb/FuoZHFmN0VWVvULjnuLwIvCT2CXO/do=;\n b=LQEMKVEnvd77/WHaWGyywMG8RwQnFsUg2iC2qQH8zZAWl4ClNX7E8e5NeV2jAexgYO\n oTkg8VFQRGFAXZ2xgxeI5tICBSuSyfBaSN0yS9q6ltnnysD7EY0rsRSH+urCOyiRBEwR\n eaHOHcgLQDsnxeXmwKxjPbTPo0SDLarkGMtr1g5GOWP6e2KNaS+nFMom39dyYZFnL3Xl\n Xaccejtcapfnn2SalfCxBsyzI4qOzNZsD9MIrMrSRXhIzmxMLNcf5Z3A9v7X49ZrizST\n ODqkMFXJt6PlAwWwaD9H41tLLmvZBJ37VrYxgCiOI5FWha1R3VgDoJJTLRWaoxmBAYnc\n 4rgw==", "X-Gm-Message-State": "AOJu0Yz40cp72x9A3P72AE73GwOMi0U7BI/to9wJbHESCy5mxazDEZrT\n B+pH8OKYH9Xm4LFXnAhxlVf4/Sv4yfFwMUk3JaMverIeYZwAFdB17HN9l5+0/qtlrRaY0+/h+N5\n qQamIZ+E=", "X-Gm-Gg": "AeBDievJghXq2ViNhVk54RIGIxUPCL6CWlMUIUU8CHbjPbJLV5a74ZvPnKGbmEOEWpp\n /W+JgJ6baDs0QwIvUSX9TqoZdeumt2LdmFZV+fU/FBCmQ/alnPyciPURSBKLTcEok6tAgiQHlRC\n jXfJJxK3zniXvBi8XaLbCg5PAxuKqfYfgQfGDMdnnGjGiH0eHowVxHNSpl+rAOGDqGEMIRsBc5S\n +TFxEbVt7tVXZ7lN3hULw5sD6eV3uhMkY376K/zt1If8DXQ8rjf1dpcf/162jj7l5wT+FBCkRfa\n psUzmS7/+kFmFMq/9xYTA/zLs8WUeKT+IImAslY8qrwHtW3xIsMV7K1C6khwQ5+7tUnSEvVlGR6\n h/rNY3QUHgfuYVWWWrGcPkAIPHCGYuObThnde/9ICa/sms/X8H2LDXv/LP5h6X/pfGO7IBm+82M\n iL7Povep7blA0+Wr3VgDeuN8gmTh0F//D2fiMvr6ZU", "X-Received": "by 2002:a05:6a00:4fcc:b0:82c:db50:ef77 with SMTP id\n d2e1a72fcca58-834fdca283cmr754958b3a.49.1777507615540;\n Wed, 29 Apr 2026 17:06:55 -0700 (PDT)", "From": "Richard Henderson <richard.henderson@linaro.org>", "To": "qemu-devel@nongnu.org", "Cc": "philmd@linaro.org", "Subject": "[PATCH v2 38/40] host-utils: Introduce signed saturation primitives", "Date": "Thu, 30 Apr 2026 10:05:21 +1000", "Message-ID": "<20260430000524.56046-39-richard.henderson@linaro.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260430000524.56046-1-richard.henderson@linaro.org>", "References": "<20260430000524.56046-1-richard.henderson@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::431;\n envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Signed-off-by: Richard Henderson <richard.henderson@linaro.org>\n---\n include/qemu/host-utils.h | 60 ++++++++++++++++++++++++++++++++++++\n accel/tcg/tcg-runtime-gvec.c | 20 +++---------\n 2 files changed, 64 insertions(+), 16 deletions(-)", "diff": "diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h\nindex 181d026b6c..2e8da7fb3d 100644\n--- a/include/qemu/host-utils.h\n+++ b/include/qemu/host-utils.h\n@@ -606,6 +606,66 @@ static inline bool umul64_overflow(uint64_t x, uint64_t y, uint64_t *ret)\n return __builtin_mul_overflow(x, y, ret);\n }\n \n+/**\n+ * sadd32_saturate - addition with saturation\n+ * @x, @y: addends\n+ *\n+ * Computes @x + @y, and saturates rathern than truncating the result.\n+ */\n+static inline int32_t sadd32_saturate(int32_t x, int32_t y)\n+{\n+ int32_t ret;\n+ if (sadd32_overflow(x, y, &ret)) {\n+ ret = y < 0 ? INT32_MIN : INT32_MAX;\n+ }\n+ return ret;\n+}\n+\n+/**\n+ * sadd64_saturate - addition with saturation\n+ * @x, @y: addends\n+ *\n+ * Computes @x + @y, and saturates rathern than truncating the result.\n+ */\n+static inline int64_t sadd64_saturate(int64_t x, int64_t y)\n+{\n+ int64_t ret;\n+ if (sadd64_overflow(x, y, &ret)) {\n+ ret = y < 0 ? INT64_MIN : INT64_MAX;\n+ }\n+ return ret;\n+}\n+\n+/**\n+ * ssub32_saturate - subtraction with saturation\n+ * @x, @y: addends\n+ *\n+ * Computes @x + @y, and saturates rathern than truncating the result.\n+ */\n+static inline bool ssub32_saturate(int32_t x, int32_t y)\n+{\n+ int32_t ret;\n+ if (ssub32_overflow(x, y, &ret)) {\n+ ret = x < 0 ? INT32_MAX : INT32_MIN;\n+ }\n+ return ret;\n+}\n+\n+/**\n+ * ssub64_saturate - subtraction with saturation\n+ * @x, @y: addends\n+ *\n+ * Computes @x + @y, and saturates rathern than truncating the result.\n+ */\n+static inline bool ssub64_saturate(int64_t x, int64_t y)\n+{\n+ int64_t ret;\n+ if (ssub64_overflow(x, y, &ret)) {\n+ ret = x < 0 ? INT64_MAX : INT64_MIN;\n+ }\n+ return ret;\n+}\n+\n /*\n * Unsigned 128x64 multiplication.\n * Returns true if the result got truncated to 128 bits.\ndiff --git a/accel/tcg/tcg-runtime-gvec.c b/accel/tcg/tcg-runtime-gvec.c\nindex ff927c5dd8..67a741e45e 100644\n--- a/accel/tcg/tcg-runtime-gvec.c\n+++ b/accel/tcg/tcg-runtime-gvec.c\n@@ -1109,10 +1109,7 @@ void HELPER(gvec_ssadd32)(void *d, void *a, void *b, uint32_t desc)\n for (i = 0; i < oprsz; i += sizeof(int32_t)) {\n int32_t ai = *(int32_t *)(a + i);\n int32_t bi = *(int32_t *)(b + i);\n- int32_t di;\n- if (sadd32_overflow(ai, bi, &di)) {\n- di = (di < 0 ? INT32_MAX : INT32_MIN);\n- }\n+ int32_t di = sadd32_saturate(ai, bi);\n *(int32_t *)(d + i) = di;\n }\n clear_high(d, oprsz, desc);\n@@ -1126,10 +1123,7 @@ void HELPER(gvec_ssadd64)(void *d, void *a, void *b, uint32_t desc)\n for (i = 0; i < oprsz; i += sizeof(int64_t)) {\n int64_t ai = *(int64_t *)(a + i);\n int64_t bi = *(int64_t *)(b + i);\n- int64_t di;\n- if (sadd64_overflow(ai, bi, &di)) {\n- di = (di < 0 ? INT64_MAX : INT64_MIN);\n- }\n+ int64_t di = sadd64_saturate(ai, bi);\n *(int64_t *)(d + i) = di;\n }\n clear_high(d, oprsz, desc);\n@@ -1177,10 +1171,7 @@ void HELPER(gvec_sssub32)(void *d, void *a, void *b, uint32_t desc)\n for (i = 0; i < oprsz; i += sizeof(int32_t)) {\n int32_t ai = *(int32_t *)(a + i);\n int32_t bi = *(int32_t *)(b + i);\n- int32_t di;\n- if (ssub32_overflow(ai, bi, &di)) {\n- di = (di < 0 ? INT32_MAX : INT32_MIN);\n- }\n+ int32_t di = ssub32_saturate(ai, bi);\n *(int32_t *)(d + i) = di;\n }\n clear_high(d, oprsz, desc);\n@@ -1194,10 +1185,7 @@ void HELPER(gvec_sssub64)(void *d, void *a, void *b, uint32_t desc)\n for (i = 0; i < oprsz; i += sizeof(int64_t)) {\n int64_t ai = *(int64_t *)(a + i);\n int64_t bi = *(int64_t *)(b + i);\n- int64_t di;\n- if (ssub64_overflow(ai, bi, &di)) {\n- di = (di < 0 ? INT64_MAX : INT64_MIN);\n- }\n+ int64_t di = ssub64_saturate(ai, bi);\n *(int64_t *)(d + i) = di;\n }\n clear_high(d, oprsz, desc);\n", "prefixes": [ "v2", "38/40" ] }