Commit ebee6f7d authored by Stuart Swales's avatar Stuart Swales Committed by ROOL
Browse files

[535] fminf(x,y) / fmaxf(x,y) corrupt result for equal non-zero parameters

Detail:
  fminf(x,y) / fmaxf(x,y) corrupted the result when x==y and x!=0.0 due to
  ANDing/ORRing a single precision register with the high word of a double
  precision register pair when fixing up signs for mixed +/- 0 parameters
  in an analogous fashion to fmax/fmin (which are correct).

Version 6.11. Tagged as 'RISC_OSLib-6_11'
parent de3ac97b
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
Module_MajorVersion SETS "6.10" Module_MajorVersion SETS "6.11"
Module_Version SETA 610 Module_Version SETA 611
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "13 Nov 2021" Module_Date SETS "22 Nov 2021"
Module_ApplicationDate SETS "13-Nov-21" Module_ApplicationDate SETS "22-Nov-21"
Module_ComponentName SETS "RISC_OSLib" Module_ComponentName SETS "RISC_OSLib"
Module_FullVersion SETS "6.10" Module_FullVersion SETS "6.11"
Module_HelpVersion SETS "6.10 (13 Nov 2021)" Module_HelpVersion SETS "6.11 (22 Nov 2021)"
END END
/* (6.10) /* (6.11)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 6.10 #define Module_MajorVersion_CMHG 6.11
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Nov 2021 #define Module_Date_CMHG 22 Nov 2021
#define Module_MajorVersion "6.10" #define Module_MajorVersion "6.11"
#define Module_Version 610 #define Module_Version 611
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "13 Nov 2021" #define Module_Date "22 Nov 2021"
#define Module_ApplicationDate "13-Nov-21" #define Module_ApplicationDate "22-Nov-21"
#define Module_ComponentName "RISC_OSLib" #define Module_ComponentName "RISC_OSLib"
#define Module_FullVersion "6.10" #define Module_FullVersion "6.11"
#define Module_HelpVersion "6.10 (13 Nov 2021)" #define Module_HelpVersion "6.11 (22 Nov 2021)"
#define Module_LibraryVersionInfo "6:10" #define Module_LibraryVersionInfo "6:11"
...@@ -1241,11 +1241,18 @@ fmaxf ...@@ -1241,11 +1241,18 @@ fmaxf
[ FloatingPointArgsInRegs [ FloatingPointArgsInRegs
STFS f1, [sp, #-4]! STFS f1, [sp, #-4]!
STFS f0, [sp, #-4]! STFS f0, [sp, #-4]!
LDMIA sp!, {r0-r1} LDMIA sp!, {r0, r2} ; restore *narrowed* x & y to ARM regs
] AND r0, r0, r2 ; this works like fmax case as both are narrow
AND r0, r0, r1
STR r0, [sp, #-4]! STR r0, [sp, #-4]!
LDFS f0, [sp], #4 LDFS f0, [sp], #4
|
; EQ -> f0 (result) is still (narrowed) x from {r0,r1}
; NB r0 and r2 are not narrow! (Sign.Expt.MantHi word of x and y respectively)
; if x==y, then for fmaxf(-0,+0), return +0
EOR r1, r0, r2 ; were signs of x and y mixed?
TST r1, #1 :SHL: 31
MVFNES f0, #0 ; if so, result := +0
]
Return ,LinkNotStacked Return ,LinkNotStacked
fcmpnanf fcmpnanf
...@@ -1290,13 +1297,22 @@ fminf ...@@ -1290,13 +1297,22 @@ fminf
[ FloatingPointArgsInRegs [ FloatingPointArgsInRegs
STFS f1, [sp, #-4]! STFS f1, [sp, #-4]!
STFS f0, [sp, #-4]! STFS f0, [sp, #-4]!
LDMIA sp!, {r0-r1} LDMIA sp!, {r0, r2} ; restore *narrowed* x & y to ARM regs
] ORR r0, r0, r2 ; this works like fmin case as both are narrow
ORR r0, r0, r2
STR r0, [sp, #-4]! STR r0, [sp, #-4]!
LDFS f0, [sp], #4 LDFS f0, [sp], #4
|
; EQ -> f0 (result) is still (narrowed) x from {r0,r1}
; if x==y, then for fminf(+0,-0), return -0
; NB r0 and r2 are not narrow! (Sign.Expt.MantHi word of x and y respectively)
EOR r1, r0, r2 ; were signs of x and y mixed?
TST r1, #1 :SHL: 31
LDFNES f0, =-0.0 ; if so, result := -0 (doesn't fit in immediate constant)
]
Return ,LinkNotStacked Return ,LinkNotStacked
LTORG
nearbyint nearbyint
[ :LNOT:FloatingPointArgsInRegs [ :LNOT:FloatingPointArgsInRegs
STMFD sp!, {r0,r1} STMFD sp!, {r0,r1}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment