From patchwork Fri Feb 5 22:56:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 376985 Delivered-To: patch@linaro.org Received: by 2002:a17:906:48d2:0:0:0:0 with SMTP id d18csp2573476ejt; Fri, 5 Feb 2021 15:00:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzV9w7Rdx8WVcfxDyuyhXQJ5kR2241ZtDkWzMC2ijmgAJZKP7ExfWpcm8wLvB93hGrauTR5 X-Received: by 2002:a25:6cc6:: with SMTP id h189mr9762811ybc.434.1612566034684; Fri, 05 Feb 2021 15:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612566034; cv=none; d=google.com; s=arc-20160816; b=dqLZgQZ8eWaX7eK0gVaMGWY1wwCwV0TguSjvNpxn11YinOLcUIIZoNWQQ/a1H8xBHC F4LH0KMd5Juw23eeUxfvrOJaMUxWOnB5gTgPqUii0CS0yCakOfMwUoN7UhdYMGg2yCyK Dd1zwRWVkA56O52ozjxLMxz+41h/mkRLDOe210MNu6G387psR0f5UGyjSb6OzQiJYtZw /gChayCQF2kysHoCR28E2AGd6/imFGjvMIo/uU9cdJ+whwZIm3mdUsU5vxM9r1cZSBIs 1tjD1gYvX7dWVyqDeRm2WJirOTvOwGPj3zdpDPdxs6pKcHRNyncnkF723k8y8Ynb4kH6 ck+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=5/ZgyQAuQvE4YcOG34t++03WUxcDnhNMW/sElkvFii8=; b=IzwkS+KJUNfz4/0X284fjRxF6V9zH989+TCSnm5mGL0vZKL08Do4yjL4nmeE5OssIe S5I9H7ToCiCGFCQtY2TB3Tr2BTQ8ahAPDQCnwNBikE2lL37JR70AiwWeiD33eVf0E4hu LJ4SYGOT5G5dWRmg0+Pn3m9gT5yj/veiRSffq3tfT3i/QGOl5VoRWxn1aPks60MuwqiJ etKYZiVNrONPi4il/bpsWlrpSWT/4q/fKBFA4CHGhVDiar9gSl5oa0ddnVGybgEbHGIK 3eNXOqOA0buUKOpkN2DX76Qab1UF4/3s0IZCujGCOYSd9QQKp7DSQdZFkyZKw8sMzyCs 17wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Sm2DRgca; 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=fail (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 j2si8853129ybb.357.2021.02.05.15.00.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Feb 2021 15:00:34 -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=fail header.i=@linaro.org header.s=google header.b=Sm2DRgca; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8A5a-0006oG-1T for patch@linaro.org; Fri, 05 Feb 2021 18:00:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8A28-0001CS-Bp for qemu-devel@nongnu.org; Fri, 05 Feb 2021 17:57:00 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:34043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l8A26-00039E-QJ for qemu-devel@nongnu.org; Fri, 05 Feb 2021 17:57:00 -0500 Received: by mail-pg1-x532.google.com with SMTP id o7so5596249pgl.1 for ; Fri, 05 Feb 2021 14:56:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5/ZgyQAuQvE4YcOG34t++03WUxcDnhNMW/sElkvFii8=; b=Sm2DRgcaealHOz6DVWja2oTH7ZYjsKCP9FKO/tiksAfYErg9t6Mp43YGDVYEEi5lYE spmLKi8Y6MOxzKH57JRnw2EeEt7czJGgb0705w+HGLadSUhJo654pSU5M4n3Hc2CEVyW gq9T6YtQ3lEps9GtREfxNIsP3BVhBeMLpP1LIUO3OjFpOlU1tS3lib19ZAFjwLDKwasv bYeQqG3yDfDrZjvoLmQltPN+1IMuRBVamT7Fht2g5xaUIZpkies8PmXfFWl/B54yZaBG J7v94qywKLlaBDcIoiaiq7WRZ4We/nlkC8Mmp0L46xLnnjhNoKGOOZwh47zU6xX0mcEd iRnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5/ZgyQAuQvE4YcOG34t++03WUxcDnhNMW/sElkvFii8=; b=P/fl7LiDLSqxDm2qHmE6Yyj4lG53oK+Wxw4r1ciAf3vGTnIRPScu9AB4y01HiXRteI g++ZvoPAutYRxJgpVPOeGIaV2A4Bf9wP+ucNa7oj74e3RODWW42gUSipNlypSbNHmZBV IQrqNHOHMLvC/3BH0GsS7/KCvWkjM0qVULWRuO9VyxpK6neV5NGRITx6YI1UgefqyAn+ GS84Z5C3a5ssQffneM38gAKL68rxefIiwmDgVkjKrQmrPNxrtoEfYpPgXRCVgkUJbuB3 Px8eh6MX4F37FlNEpEzMzjerLOnddjbV3IpUY0gjSQhXdzpWB/MlMOfNVGvIKGQGauTM YHJA== X-Gm-Message-State: AOAM530rvz0OqXz+YZmxqTVUl9M73hnzzZyCjMlK51ldYSJfu3IIhPQP 7tpKYTzPOaDmtM1JI21DjBQRWoGJEtR+5Juf X-Received: by 2002:a63:2306:: with SMTP id j6mr6591705pgj.187.1612565816421; Fri, 05 Feb 2021 14:56:56 -0800 (PST) Received: from localhost.localdomain (cpe-66-27-222-29.hawaii.res.rr.com. [66.27.222.29]) by smtp.gmail.com with ESMTPSA id c23sm12155149pgc.72.2021.02.05.14.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 14:56:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/46] tcg/s390: Fix compare instruction from extended-immediate facility Date: Fri, 5 Feb 2021 12:56:05 -1000 Message-Id: <20210205225650.1330794-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210205225650.1330794-1-richard.henderson@linaro.org> References: <20210205225650.1330794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Richard W . M . Jones" , Miroslav Rezanina Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The code is currently comparing c2 to the type promotion of uint32_t and int32_t. That is, the conversion rules are as: (common_type) c2 == (common_type) (uint32_t) (is_unsigned ? (uint32_t)c2 : (uint32_t)(int32_t)c2) In the signed case we lose the desired sign extensions because of the argument promotion rules of the ternary operator. Solve the problem by doing the round-trip parsing through the intermediate type and back to the desired common type (all at one expression). Fixes: a534bb15f30 ("tcg/s390: Use constant pool for cmpi") Tested-by: Richard W.M. Jones Reviewed-by: David Hildenbrand Reported-by: Miroslav Rezanina Reported-by: Richard W.M. Jones Suggested-by: David Hildenbrand Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210204182902.1742826-1-f4bug@amsat.org> Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc index b67470137c..695d7ee652 100644 --- a/tcg/s390/tcg-target.c.inc +++ b/tcg/s390/tcg-target.c.inc @@ -1067,7 +1067,7 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, op = (is_unsigned ? RIL_CLFI : RIL_CFI); tcg_out_insn_RIL(s, op, r1, c2); goto exit; - } else if (c2 == (is_unsigned ? (uint32_t)c2 : (int32_t)c2)) { + } else if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) { op = (is_unsigned ? RIL_CLGFI : RIL_CGFI); tcg_out_insn_RIL(s, op, r1, c2); goto exit;