29 Aug, 2017

5 commits

  • Fix the value returned by . fd,fs,ft, if both inputs
    are infinite. The previous implementation returned always the value
    contained in ft in such cases. The correct behavior is specified
    in Mips instruction set manual and is as follows:

    fs ft MAXA MINA
    ---------------------------------
    inf inf inf inf
    inf -inf inf -inf
    -inf inf inf -inf
    -inf -inf -inf -inf

    A relevant example:

    MAXA.S fd,fs,ft:
    If fs contains +inf, and ft contains -inf, fd is going to contain
    +inf (without this patch, it used to contain -inf).

    Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")

    Signed-off-by: Miodrag Dinic
    Signed-off-by: Goran Ferenc
    Signed-off-by: Aleksandar Markovic
    Reviewed-by: James Hogan
    Cc: Bo Hu
    Cc: Douglas Leung
    Cc: Jin Qian
    Cc: Paul Burton
    Cc: Petar Jovanovic
    Cc: Raghu Gandham
    Cc: # 4.3+
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/16884/
    Signed-off-by: Ralf Baechle

    Aleksandar Markovic
     
  • Fix the value returned by ., if the inputs are normal
    fp numbers of the same absolute value, but opposite signs.

    A relevant example:

    MAXA.S fd,fs,ft:
    If fs contains -3.0, and ft contains +3.0, fd is going to contain
    +3.0 (without this patch, it used to contain -3.0).

    Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")

    Signed-off-by: Miodrag Dinic
    Signed-off-by: Goran Ferenc
    Signed-off-by: Aleksandar Markovic
    Reviewed-by: James Hogan
    Cc: Bo Hu
    Cc: Douglas Leung
    Cc: Jin Qian
    Cc: Paul Burton
    Cc: Petar Jovanovic
    Cc: Raghu Gandham
    Cc: # 4.3+
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/16883/
    Signed-off-by: Ralf Baechle

    Aleksandar Markovic
     
  • Fix the value returned by ., if both inputs are negative
    normal fp numbers. The previous logic did not take into account that
    if both inputs have the same sign, there should be separate treatment
    of the cases when both inputs are negative and when both inputs are
    positive.

    A relevant example:

    MAX.S fd,fs,ft:
    If fs contains -5.0, and ft contains -7.0, fd is going to contain
    -5.0 (without this patch, it used to contain -7.0).

    Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")

    Signed-off-by: Miodrag Dinic
    Signed-off-by: Goran Ferenc
    Signed-off-by: Aleksandar Markovic
    Reviewed-by: James Hogan
    Cc: Bo Hu
    Cc: Douglas Leung
    Cc: Jin Qian
    Cc: Paul Burton
    Cc: Petar Jovanovic
    Cc: Raghu Gandham
    Cc: # 4.3+
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/16882/
    Signed-off-by: Ralf Baechle

    Aleksandar Markovic
     
  • Fix the value returned by ., if both inputs
    are zeros. The right behavior in such cases is stated in instruction
    reference manual and is as follows:

    fs ft MAX MIN MAXA MINA
    ---------------------------------------------
    0 0 0 0 0 0
    0 -0 0 -0 0 -0
    -0 0 0 -0 0 -0
    -0 -0 -0 -0 -0 -0

    Prior to this patch, some of the above cases were yielding correct
    results. However, for the sake of code consistency, all such cases
    are rewritten in this patch.

    A relevant example:

    MAX.S fd,fs,ft:
    If fs contains +0.0, and ft contains -0.0, fd is going to contain
    +0.0 (without this patch, it used to contain -0.0).

    Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")

    Signed-off-by: Miodrag Dinic
    Signed-off-by: Goran Ferenc
    Signed-off-by: Aleksandar Markovic
    Reviewed-by: James Hogan
    Cc: Bo Hu
    Cc: Douglas Leung
    Cc: Jin Qian
    Cc: Paul Burton
    Cc: Petar Jovanovic
    Cc: Raghu Gandham
    Cc: # 4.3+
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/16881/
    Signed-off-by: Ralf Baechle

    Aleksandar Markovic
     
  • Fix the value returned by . fd,fs,ft, if both
    inputs are quiet NaNs. The . specifications
    state that the returned value in such cases should be the quiet NaN
    contained in register fs.

    A relevant example:

    MAX.S fd,fs,ft:
    If fs contains qNaN1, and ft contains qNaN2, fd is going to contain
    qNaN1 (without this patch, it used to contain qNaN2).

    Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")

    Signed-off-by: Miodrag Dinic
    Signed-off-by: Goran Ferenc
    Signed-off-by: Aleksandar Markovic
    Reviewed-by: James Hogan
    Cc: Bo Hu
    Cc: Douglas Leung
    Cc: Jin Qian
    Cc: Paul Burton
    Cc: Petar Jovanovic
    Cc: Raghu Gandham
    Cc: # 4.3+
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/16880/
    Signed-off-by: Ralf Baechle

    Aleksandar Markovic
     

03 Sep, 2015

1 commit

  • MIPS R6 introduced the following instruction:
    Scalar Floating-Point Maximum and
    Scalar Floating-Point argument with Maximum Absolute Value
    MAX.fmt writes the maximum value of the inputs fs and ft to the
    destination fd.
    MAXA.fmt takes input arguments fs and ft and writes the argument with
    the maximum absolute value to the destination fd.

    Signed-off-by: Markos Chandras
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/10961/
    Signed-off-by: Ralf Baechle

    Markos Chandras