Update Linux kernel to current glibc soft-fp
Joseph Myers
joseph@codesourcery.com
Thu Apr 2 17:45:00 GMT 2015
On Thu, 26 Mar 2015, Stefan Liebler wrote:
> According to "error: lvalue required as left operand of assignment":
> Why did you write back r in include/math-emu/op-common.h:
> #define _FP_FROM_INT(fs, wc, X, r, rsize, rtype):
> if ((X##_s = ((r) < 0)))
> (r) = -(rtype) (r);
> _FP_FROM_INT_ur = (rtype) (r);
Because the _FP_FROM_INT interface requires an argument of the correct
signedness, but needs to work internally on an unsigned value, so starts
by negating a signed argument.
> @@ -435,11 +436,12 @@ void s390_adjust_jiffies(void)
> * by the cpu capability number. Yes, that means a floating
> * point division .. math-emu here we come :-)
> */
> - FP_UNPACK_SP(SA, &fmil);
> - if ((info->capability >> 23) == 0)
> - FP_FROM_INT_S(SB, (long) info->capability, 64, long);
> - else
> - FP_UNPACK_SP(SB, &info->capability);
> + FP_UNPACK_SEMIRAW_SP(SA, &fmil);
> + if ((info->capability >> 23) == 0) {
> + unsigned long r = info->capability;
> + FP_FROM_INT_S(SB, r, 64, unsigned long);
> + } else
> + FP_UNPACK_SEMIRAW_SP(SB, &info->capability);
> FP_DIV_S(SR, SA, SB);
> FP_TO_INT_S(capability, SR, 32, 0);
Division uses cooked inputs and outputs. FP_TO_INT uses raw inputs.
FP_FROM_INT uses raw outputs.
So for unpacking SA you should continue to use FP_UNPACK_SP, as the result
goes straight into division. For unpacking SB, it seems appropriate to
use FP_UNPACK_RAW_SP. Then, after either unpacking or FP_FROM_INT_S, you
have a raw value in SB, and can use _FP_UNPACK_CANONICAL to produce a
cooked value from it that can be used as an input to the division.
As for the integer argument to FP_FROM_INT_S, the existing code treats it
as signed long, so the same semantics would be preserved by making the
temporary variable of that type (however, you still need to pass "unsigned
long" as the last argument to FP_FROM_INT_S, as it expects the type name
passed to be the name of an unsigned type).
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list