<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/math-emu, branch v6.6.131</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.131</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.131'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-09-05T07:28:25+00:00</updated>
<entry>
<title>powerpc/math-emu: Remove -w build flag and fix warnings</title>
<updated>2022-09-05T07:28:25+00:00</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2022-09-02T16:00:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7245fc5bb7a966852d5bd7779d1f5855530b461a'/>
<id>urn:sha1:7245fc5bb7a966852d5bd7779d1f5855530b461a</id>
<content type='text'>
As reported by Nathan, the module_init() macro was not taken into
account because the header was missing. That means spe_mathemu_init()
was never called.

This should have been detected by gcc at build time, but due to
'-w' flag it went undetected.

Removing that flag leads to many warnings hence errors.

Fix those warnings then remove the -w flag.

Reported-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Reviewed-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Link: https://lore.kernel.org/r/2663961738a46073713786d4efeb53100ca156e7.1662134272.git.christophe.leroy@csgroup.eu

</content>
</entry>
<entry>
<title>math-emu: Fix fall-through warning</title>
<updated>2021-07-13T18:57:44+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavoars@kernel.org</email>
</author>
<published>2021-07-13T18:09:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f336a009f8e3dd0b47168565584608a4a62cbbb4'/>
<id>urn:sha1:f336a009f8e3dd0b47168565584608a4a62cbbb4</id>
<content type='text'>
Fix the following fallthrough warning (nds32-randconfig with GCC):

include/math-emu/op-common.h:332:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Link: https://lore.kernel.org/lkml/60edca25.k00ut905IFBjPyt5%25lkp@intel.com/
Signed-off-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
</content>
</entry>
<entry>
<title>treewide: Use fallthrough pseudo-keyword</title>
<updated>2020-08-23T22:36:59+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavoars@kernel.org</email>
</author>
<published>2020-08-23T22:36:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=df561f6688fef775baa341a0f5d960becd248b11'/>
<id>urn:sha1:df561f6688fef775baa341a0f5d960becd248b11</id>
<content type='text'>
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
</content>
</entry>
<entry>
<title>nds32: Mark expected switch fall-throughs</title>
<updated>2019-08-29T16:06:56+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavo@embeddedor.com</email>
</author>
<published>2019-08-27T16:57:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7c9eb2dbd770b7c9980d5839dd305a70fbc5df67'/>
<id>urn:sha1:7c9eb2dbd770b7c9980d5839dd305a70fbc5df67</id>
<content type='text'>
Mark switch cases where we are expecting to fall through.

This patch fixes the following warnings (Building: allmodconfig nds32):

include/math-emu/soft-fp.h:124:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/nds32/kernel/signal.c:362:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/nds32/kernel/signal.c:315:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:417:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:430:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:310:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:320:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:310:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:320:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/soft-fp.h:124:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:417:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:430:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:310:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:320:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:310:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
include/math-emu/op-common.h:320:11: warning: this statement may fall through [-Wimplicit-fallthrough=]

Reported-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
</content>
</entry>
<entry>
<title>math-emu: Use statement expressions to fix Wshift-count-overflow warning</title>
<updated>2019-05-31T07:23:25+00:00</updated>
<author>
<name>Vincent Chen</name>
<email>vincentc@andestech.com</email>
</author>
<published>2019-05-27T06:17:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8183db10db6377ac58ad048a4c827425a614695c'/>
<id>urn:sha1:8183db10db6377ac58ad048a4c827425a614695c</id>
<content type='text'>
To avoid "shift count &gt;= width of type" warning, using statement
expressions to implement the conditional controlling before constant shift

The modification in op-2.h is taken from the glibc
commit 'sysdeps/unix/sysv/lin ("fe0b1e854ad32")'.

Signed-off-by: Vincent Chen &lt;vincentc@andestech.com&gt;
Acked-by: Greentime Hu &lt;greentime@andestech.com&gt;
Signed-off-by: Greentime Hu &lt;greentime@andestech.com&gt;
</content>
</entry>
<entry>
<title>math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning</title>
<updated>2018-11-22T10:13:42+00:00</updated>
<author>
<name>Vincent Chen</name>
<email>vincentc@andestech.com</email>
</author>
<published>2018-11-22T03:14:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=83312f1b7ae205dca647bf52bbe2d51303cdedfb'/>
<id>urn:sha1:83312f1b7ae205dca647bf52bbe2d51303cdedfb</id>
<content type='text'>
_FP_ROUND_ZERO is defined as 0 and used as a statemente in macro
_FP_ROUND. This generates "error: statement with no effect
[-Werror=unused-value]" from gcc. Defining _FP_ROUND_ZERO as (void)0 to
fix it.

This modification is quoted from glibc 'commit &lt;In libc/:&gt;
(8ed1e7d5894000c155acbd06f)'

Signed-off-by: Vincent Chen &lt;vincentc@andestech.com&gt;
Acked-by: Greentime Hu &lt;greentime@andestech.com&gt;
Signed-off-by: Greentime Hu &lt;greentime@andestech.com&gt;
</content>
</entry>
<entry>
<title>math-emu/op-2.h: Use statement expressions to prevent negative constant shift</title>
<updated>2018-11-22T10:13:33+00:00</updated>
<author>
<name>Vincent Chen</name>
<email>vincentc@andestech.com</email>
</author>
<published>2018-11-22T03:14:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7adb3e998f5bea3e1fd2f76c1cf80d76b8af6626'/>
<id>urn:sha1:7adb3e998f5bea3e1fd2f76c1cf80d76b8af6626</id>
<content type='text'>
This modification is quoted from glibc 'commit &lt;
sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c: Moved to&gt;
(fe0b1e854ad32a69b260)'

Signed-off-by: Vincent Chen &lt;vincentc@andestech.com&gt;
Acked-by: Greentime Hu &lt;greentime@andestech.com&gt;
Signed-off-by: Greentime Hu &lt;greentime@andestech.com&gt;
</content>
</entry>
<entry>
<title>math-emu: fix floating-point to integer overflow detection</title>
<updated>2014-01-08T00:36:24+00:00</updated>
<author>
<name>Joseph Myers</name>
<email>joseph@codesourcery.com</email>
</author>
<published>2013-11-04T16:54:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d06b3326dfd02f3f036b670d622fe56eb68a5f30'/>
<id>urn:sha1:d06b3326dfd02f3f036b670d622fe56eb68a5f30</id>
<content type='text'>
On overflow, the math-emu macro _FP_TO_INT_ROUND tries to saturate its
result (subject to the value of rsigned specifying the desired
overflow semantics).  However, if the rounding step has the effect of
increasing the exponent so as to cause overflow (if the rounded result
is 1 larger than the largest positive value with the given number of
bits, allowing for signedness), the overflow does not get detected,
meaning that for unsigned results 0 is produced instead of the maximum
unsigned integer with the give number of bits, without an exception
being raised for overflow, and that for signed results the minimum
(negative) value is produced instead of the maximum (positive) value,
again without an exception.  This patch makes the code check for
rounding increasing the exponent and adjusts the exponent value as
needed for the overflow check.

Signed-off-by: Joseph Myers &lt;joseph@codesourcery.com&gt;
Signed-off-by: Scott Wood &lt;scottwood@freescale.com&gt;
</content>
</entry>
<entry>
<title>math-emu: fix floating-point to integer unsigned saturation</title>
<updated>2014-01-08T00:34:47+00:00</updated>
<author>
<name>Joseph Myers</name>
<email>joseph@codesourcery.com</email>
</author>
<published>2013-11-04T16:53:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4f6db5efff8256c7f608285877e892e7e649137a'/>
<id>urn:sha1:4f6db5efff8256c7f608285877e892e7e649137a</id>
<content type='text'>
The math-emu macros _FP_TO_INT and _FP_TO_INT_ROUND are supposed to
saturate their results for out-of-range arguments, except in the case
rsigned == 2 (when instead the low bits of the result are taken).
However, in the case rsigned == 0 (converting to unsigned integers),
they mistakenly produce 0 for positive results and the maximum
unsigned integer for negative results, the opposite of correct
unsigned saturation.  This patch fixes the logic.

Signed-off-by: Joseph Myers &lt;joseph@codesourcery.com&gt;
Signed-off-by: Scott Wood &lt;scottwood@freescale.com&gt;
</content>
</entry>
<entry>
<title>math-emu: correct test for downshifting fraction in _FP_FROM_INT()</title>
<updated>2010-07-21T01:45:14+00:00</updated>
<author>
<name>Mikael Pettersson</name>
<email>mikpe@it.uu.se</email>
</author>
<published>2010-07-21T01:45:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f8324e20f8289dffc646d64366332e05eaacab25'/>
<id>urn:sha1:f8324e20f8289dffc646d64366332e05eaacab25</id>
<content type='text'>
The kernel's math-emu code contains a macro _FP_FROM_INT() which is
used to convert an integer to a raw normalized floating-point value.
It does this basically in three steps:

1. Compute the exponent from the number of leading zero bits.
2. Downshift large fractions to put the MSB in the right position
   for normalized fractions.
3. Upshift small fractions to put the MSB in the right position.

There is an boundary error in step 2, causing a fraction with its
MSB exactly one bit above the normalized MSB position to not be
downshifted.  This results in a non-normalized raw float, which when
packed becomes a massively inaccurate representation for that input.

The impact of this depends on a number of arch-specific factors,
but it is known to have broken emulation of FXTOD instructions
on UltraSPARC III, which was originally reported as GCC bug 44631
&lt;http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44631&gt;.

Any arch which uses math-emu to emulate conversions from integers to
same-size floats may be affected.

The fix is simple: the exponent comparison used to determine if the
fraction should be downshifted must be "&lt;=" not "&lt;".

I'm sending a kernel module to test this as a reply to this message.
There are also SPARC user-space test cases in the GCC bug entry.

Signed-off-by: Mikael Pettersson &lt;mikpe@it.uu.se&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
