From patchwork Thu Nov 8 12:16:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 150503 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp752713ljp; Thu, 8 Nov 2018 04:21:11 -0800 (PST) X-Google-Smtp-Source: AJdET5cCUvbq/LeOoAcgPvzJxghU3NfyGwd1DWeKBH36BJDbkYbIJEQsviI0yU9KsPg5AetNQC4Z X-Received: by 2002:ac8:246:: with SMTP id o6mr4077835qtg.0.1541679671744; Thu, 08 Nov 2018 04:21:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541679671; cv=none; d=google.com; s=arc-20160816; b=vNVZCuZIhBWsbca1R1w9q5HzoeIIKcVHOXZ+pdOvpgJ0ItUYpRDv/rKxyqqMPmdplI JlC2Kic9F+15R7w5TEAOPXZR4vu4JF/3jTcFWih4P2xpbd/ZTNe3aXNBhueJ9CPn9MmA p5100X20dusnKPwgcuV2IFpuaMgxybQ6M4VG7biC7Fphhw9SXRdiP3snLS1jqZoDkKeb hOrn43r40CL/R8Gj5xOLcTb4vAtHb1tRbjgHVDGSo5pri/ewFRg++BM5CnD789CaAZtW B7cDo/exIEsSPVz3txMnYJYYADXNXbZtwsAa6HtY0XDUUgO6PzdsXSdYZBWhvFHjpdTW Q94g== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=eOSlclc5WlQi7RQaBw3P8AjMBZXitdBmgje/QQLJ0KM=; b=obzaL3ulxkMlsKwLcf6FeKsedqxeJ9QGVuaVEQgF3OP0p4ZBt4N+TEz+vUlWWA6zhM KB7ee/3/LgiX/zVADF8wZ/kfIdwzR4Rxli+iemUPTZSbMx+khbnz1ZT2Vhl7RQjXyGdk QDcSHqWo+qMwFi9rM67YaW3HRa16TUL3/dwcexH8XAojRNqBwo/KEJVZw9cQlwAoe6Ew wWu+MsGSChgzDrBEGcPQuBUQAwkp3QgrzdyekuIBM9N9NHcxCmaHvFO+ubh0H9pNVHOK JbSwj3kosbky6JIZB2eEXX6/idNJ9jSXCz2af30lFesbrH2l+RUotuQfz0Oe8vi/ZIfs B1Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=dYwGR8iM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d2-v6si134609qtl.189.2018.11.08.04.21.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 04:21:11 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=dYwGR8iM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:56271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjJ8-0008EW-S7 for patch@linaro.org; Thu, 08 Nov 2018 07:21:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjFI-0005Gd-M8 for qemu-devel@nongnu.org; Thu, 08 Nov 2018 07:17:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKjFF-0003j1-Vd for qemu-devel@nongnu.org; Thu, 08 Nov 2018 07:17:12 -0500 Received: from ozlabs.org ([203.11.71.1]:39955) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gKjF9-0003ai-1e; Thu, 08 Nov 2018 07:17:04 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 42rMhz4w9Nz9sC7; Thu, 8 Nov 2018 23:16:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1541679411; bh=ZtKJfw/x7B+A3VaIRZRTqMq0uSMST9WuJyiAqZyLuiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYwGR8iM3kLwSHsoRw8AOy1vtSiUh965PEjQKND5DMozF7KbUwomOVL2pdFYoA0JO S2ncq2PqrTGe6ntis7dXkwZ4L8zl23qwzSoYHWQfux+QGj3teh58FkAw/TBiKStXFg Z3/9CDDH7SblnNWy/FJ/R9nTcwxng28NdJlGhGIM= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 8 Nov 2018 23:16:33 +1100 Message-Id: <20181108121646.26173-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108121646.26173-1-david@gibson.dropbear.id.au> References: <20181108121646.26173-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 09/22] target/ppc: Split out float_invalid_op_addsub X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, Richard Henderson , agraf@suse.de, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 60 ++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 34 deletions(-) -- 2.19.1 diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 9ae55b1e93..111ce12a37 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -648,6 +648,17 @@ void helper_reset_fpstatus(CPUPPCState *env) set_float_exception_flags(0, &env->fp_status); } +static void float_invalid_op_addsub(CPUPPCState *env, bool set_fpcc, + uintptr_t retaddr, int classes) +{ + if ((classes & ~is_neg) == is_inf) { + /* Magnitude subtraction of infinities */ + float_invalid_op_vxisi(env, set_fpcc, retaddr); + } else if (classes & is_snan) { + float_invalid_op_vxsnan(env, retaddr); + } +} + /* fadd - fadd. */ float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2) { @@ -655,14 +666,9 @@ float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2) int status = get_float_exception_flags(&env->fp_status); if (unlikely(status & float_flag_invalid)) { - if (float64_is_infinity(arg1) && float64_is_infinity(arg2)) { - /* Magnitude subtraction of infinities */ - float_invalid_op_vxisi(env, 1, GETPC()); - } else if (float64_is_signaling_nan(arg1, &env->fp_status) || - float64_is_signaling_nan(arg2, &env->fp_status)) { - /* sNaN addition */ - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_addsub(env, 1, GETPC(), + float64_classify(arg1) | + float64_classify(arg2)); } return ret; @@ -675,14 +681,9 @@ float64 helper_fsub(CPUPPCState *env, float64 arg1, float64 arg2) int status = get_float_exception_flags(&env->fp_status); if (unlikely(status & float_flag_invalid)) { - if (float64_is_infinity(arg1) && float64_is_infinity(arg2)) { - /* Magnitude subtraction of infinities */ - float_invalid_op_vxisi(env, 1, GETPC()); - } else if (float64_is_signaling_nan(arg1, &env->fp_status) || - float64_is_signaling_nan(arg2, &env->fp_status)) { - /* sNaN addition */ - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_addsub(env, 1, GETPC(), + float64_classify(arg1) | + float64_classify(arg2)); } return ret; @@ -1803,12 +1804,9 @@ void helper_##name(CPUPPCState *env, uint32_t opcode) \ env->fp_status.float_exception_flags |= tstat.float_exception_flags; \ \ if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { \ - if (tp##_is_infinity(xa.fld) && tp##_is_infinity(xb.fld)) { \ - float_invalid_op_vxisi(env, sfprf, GETPC()); \ - } else if (tp##_is_signaling_nan(xa.fld, &tstat) || \ - tp##_is_signaling_nan(xb.fld, &tstat)) { \ - float_invalid_op_vxsnan(env, GETPC()); \ - } \ + float_invalid_op_addsub(env, sfprf, GETPC(), \ + tp##_classify(xa.fld) | \ + tp##_classify(xb.fld)); \ } \ \ if (r2sp) { \ @@ -1852,12 +1850,9 @@ void helper_xsaddqp(CPUPPCState *env, uint32_t opcode) env->fp_status.float_exception_flags |= tstat.float_exception_flags; if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { - if (float128_is_infinity(xa.f128) && float128_is_infinity(xb.f128)) { - float_invalid_op_vxisi(env, 1, GETPC()); - } else if (float128_is_signaling_nan(xa.f128, &tstat) || - float128_is_signaling_nan(xb.f128, &tstat)) { - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_addsub(env, 1, GETPC(), + float128_classify(xa.f128) | + float128_classify(xb.f128)); } helper_compute_fprf_float128(env, xt.f128); @@ -3518,12 +3513,9 @@ void helper_xssubqp(CPUPPCState *env, uint32_t opcode) env->fp_status.float_exception_flags |= tstat.float_exception_flags; if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { - if (float128_is_infinity(xa.f128) && float128_is_infinity(xb.f128)) { - float_invalid_op_vxisi(env, 1, GETPC()); - } else if (float128_is_signaling_nan(xa.f128, &tstat) || - float128_is_signaling_nan(xb.f128, &tstat)) { - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_addsub(env, 1, GETPC(), + float128_classify(xa.f128) | + float128_classify(xb.f128)); } helper_compute_fprf_float128(env, xt.f128);