Patch "MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Clean up "maddf_flags" enumeration" has been added to the 4.13-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Clean up "maddf_flags" enumeration
to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mips-math-emu-maddf-msubf-.-d-s-clean-up-maddf_flags-enumeration.patch
and it can be found in the queue-4.13 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
ae11c0619973ffd73a496308d8a1cb5e1a353737Mon Sep 17 00:00:00 2001
From: Aleksandar Markovic <[email protected]>
Date: Thu, 27 Jul 2017 18:08:57 +0200
Subject: MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Clean up "maddf_flags" enumeration
From: Aleksandar Markovic <[email protected]>
commit ae11c0619973ffd73a496308d8a1cb5e1a353737 upstream.
Fix definition and usage of "maddf_flags" enumeration. Avoid duplicate definition and apply more common capitalization.
This patch does not change any scenario. It just makes MADDF and MSUBF emulation code more readable and easier to maintain, and hopefully prevents future bugs as well.
Patchwork: https://patchwork.linux-mips.org/patch/16889/
--- arch/mips/math-emu/dp_maddf.c | 19 ++++++++----------- arch/mips/math-emu/ieee754int.h | 4 ++++ arch/mips/math-emu/sp_maddf.c | 19 ++++++++----------- 3 files changed, 20 insertions(+), 22 deletions(-)
arch/mips/math-emu/dp_maddf.c +8 -11
@@ -14,9 +14,6 @@#include "ieee754dp.h" -enum maddf_flags { - maddf_negate_product =1 <<0 , -};static union ieee754dp _dp_maddf (union ieee754dp z,union ieee754dp x,union ieee754dp y,enum maddf_flags flags)
@@ -85,8 +82,8 @@ static union ieee754dp _dp_maddf(union icase CLPAIR (IEEE754_CLASS_INF ,IEEE754_CLASS_DNORM ):case CLPAIR (IEEE754_CLASS_INF ,IEEE754_CLASS_INF ):if ((zc ==IEEE754_CLASS_INF ) && - ((!(flags & maddf_negate_product) && (zs != (xs ^ ys))) || - ((flags & maddf_negate_product) && (zs == (xs ^ ys))))) { + ((!(flags &MADDF_NEGATE_PRODUCT ) && (zs != (xs ^ ys))) || + ((flags &MADDF_NEGATE_PRODUCT ) && (zs == (xs ^ ys))))) {/* * Cases of addition of infinities with opposite signs * or subtraction of infinities with same signs.
@@ -99,9 +96,9 @@ static union ieee754dp _dp_maddf(union i* same sign as product (x*y) (in case of MADDF.D instruction) * or product -(x*y) (in MSUBF.D case). The result must be an * infinity, and its sign is determined only by the value of -* (flags & maddf_negate_product) and the signs of x and y. +* (flags & MADDF_NEGATE_PRODUCT) and the signs of x and y. */ -if (flags & maddf_negate_product) +if (flags &MADDF_NEGATE_PRODUCT )return ieee754dp_inf (1 ^ (xs ^ ys));else return ieee754dp_inf (xs ^ ys);
@@ -115,9 +112,9 @@ static union ieee754dp _dp_maddf(union ireturn ieee754dp_inf (zs);if (zc ==IEEE754_CLASS_ZERO ) {/* Handle cases +0 + (-0) and similar ones. */ -if ((!(flags & maddf_negate_product) +if ((!(flags &MADDF_NEGATE_PRODUCT ) && (zs == (xs ^ ys))) || - ((flags & maddf_negate_product) + ((flags &MADDF_NEGATE_PRODUCT ) && (zs != (xs ^ ys))))/* * Cases of addition of zeros of equal signs
@@ -167,7 +164,7 @@ static union ieee754dp _dp_maddf(union i re = xe + ye; rs = xs ^ ys; -if (flags & maddf_negate_product) +if (flags &MADDF_NEGATE_PRODUCT ) rs ^=1 ;/* shunt to top of word */
@@ -291,5 +288,5 @@ union ieee754dp ieee754dp_maddf(union ieunion ieee754dp ieee754dp_msubf (union ieee754dp z,union ieee754dp x,union ieee754dp y) { -return _dp_maddf (z, x, y, maddf_negate_product); +return _dp_maddf (z, x, y,MADDF_NEGATE_PRODUCT ); }
arch/mips/math-emu/ieee754int.h +4 -0
@@ -26,6 +26,10 @@#define CLPAIR (x, y) ((x)*6+(y)) +enum maddf_flags { +MADDF_NEGATE_PRODUCT =1 <<0 , +}; +static inline void ieee754_clearcx (void ) { ieee754_csr.cx =0 ;
arch/mips/math-emu/sp_maddf.c +8 -11
@@ -14,9 +14,6 @@#include "ieee754sp.h" -enum maddf_flags { - maddf_negate_product =1 <<0 , -};static union ieee754sp _sp_maddf (union ieee754sp z,union ieee754sp x,union ieee754sp y,enum maddf_flags flags)
@@ -86,8 +83,8 @@ static union ieee754sp _sp_maddf(union icase CLPAIR (IEEE754_CLASS_INF ,IEEE754_CLASS_DNORM ):case CLPAIR (IEEE754_CLASS_INF ,IEEE754_CLASS_INF ):if ((zc ==IEEE754_CLASS_INF ) && - ((!(flags & maddf_negate_product) && (zs != (xs ^ ys))) || - ((flags & maddf_negate_product) && (zs == (xs ^ ys))))) { + ((!(flags &MADDF_NEGATE_PRODUCT ) && (zs != (xs ^ ys))) || + ((flags &MADDF_NEGATE_PRODUCT ) && (zs == (xs ^ ys))))) {/* * Cases of addition of infinities with opposite signs * or subtraction of infinities with same signs.
@@ -100,9 +97,9 @@ static union ieee754sp _sp_maddf(union i* same sign as product (x*y) (in case of MADDF.D instruction) * or product -(x*y) (in MSUBF.D case). The result must be an * infinity, and its sign is determined only by the value of -* (flags & maddf_negate_product) and the signs of x and y. +* (flags & MADDF_NEGATE_PRODUCT) and the signs of x and y. */ -if (flags & maddf_negate_product) +if (flags &MADDF_NEGATE_PRODUCT )return ieee754sp_inf (1 ^ (xs ^ ys));else return ieee754sp_inf (xs ^ ys);
@@ -116,9 +113,9 @@ static union ieee754sp _sp_maddf(union ireturn ieee754sp_inf (zs);if (zc ==IEEE754_CLASS_ZERO ) {/* Handle cases +0 + (-0) and similar ones. */ -if ((!(flags & maddf_negate_product) +if ((!(flags &MADDF_NEGATE_PRODUCT ) && (zs == (xs ^ ys))) || - ((flags & maddf_negate_product) + ((flags &MADDF_NEGATE_PRODUCT ) && (zs != (xs ^ ys))))/* * Cases of addition of zeros of equal signs
@@ -170,7 +167,7 @@ static union ieee754sp _sp_maddf(union i re = xe + ye; rs = xs ^ ys; -if (flags & maddf_negate_product) +if (flags &MADDF_NEGATE_PRODUCT ) rs ^=1 ;/* shunt to top of word */
@@ -287,5 +284,5 @@ union ieee754sp ieee754sp_maddf(union ieunion ieee754sp ieee754sp_msubf (union ieee754sp z,union ieee754sp x,union ieee754sp y) { -return _sp_maddf (z, x, y, maddf_negate_product); +return _sp_maddf (z, x, y,MADDF_NEGATE_PRODUCT ); }
Patches currently in stable-queue which might be from [email protected] are
queue-4.13/mips-math-emu-maddf-msubf-.-d-s-fix-nan-propagation.patch queue-4.13/mips-math-emu-max-maxa-min-mina-.-d-s-fix-cases-of-both-inputs-zero.patch queue-4.13/mips-math-emu-max-min-.-d-s-fix-cases-of-both-inputs-negative.patch queue-4.13/mips-math-emu-max-maxa-min-mina-.-d-s-fix-quiet-nan-propagation.patch queue-4.13/mips-math-emu-maddf-msubf-.d-fix-accuracy-64-bit-case.patch queue-4.13/mips-math-emu-maddf-msubf-.s-fix-accuracy-32-bit-case.patch queue-4.13/mips-math-emu-maxa-mina-.-d-s-fix-cases-of-input-values-with-opposite-signs.patch queue-4.13/mips-math-emu-maxa-mina-.-d-s-fix-cases-of-both-infinite-inputs.patch queue-4.13/mips-math-emu-mina.-d-s-fix-some-cases-of-infinity-and-zero-inputs.patch queue-4.13/mips-math-emu-maddf-msubf-.-d-s-fix-some-cases-of-zero-inputs.patch queue-4.13/mips-math-emu-maddf-msubf-.-d-s-clean-up-maddf_flags-enumeration.patch queue-4.13/mips-math-emu-maddf-msubf-.-d-s-fix-some-cases-of-infinite-inputs.patch