mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Fix float comparisons on riscv, loongarch
Negating the result doesn't work for NaNs.
This commit is contained in:
parent
e2dec5cbbe
commit
207df49235
|
|
@ -400,22 +400,26 @@
|
|||
(:translate ,translate)
|
||||
(:generator 3
|
||||
(note-this-location vop :internal-error)
|
||||
(inst ,op-single 5 x y)
|
||||
(if ,(if complement '(not not-p) 'not-p)
|
||||
(inst ,op-single 5 ,@(if complement
|
||||
'(y x)
|
||||
'(x y)))
|
||||
(if not-p
|
||||
(inst bceqz 5 target)
|
||||
(inst bcnez 5 target))))
|
||||
(define-vop (,dname double-float-compare)
|
||||
(:translate ,translate)
|
||||
(:generator 3
|
||||
(note-this-location vop :internal-error)
|
||||
(inst ,op-double 5 x y)
|
||||
(if ,(if complement '(not not-p) 'not-p)
|
||||
(inst ,op-double 5 ,@(if complement
|
||||
'(y x)
|
||||
'(x y)))
|
||||
(if not-p
|
||||
(inst bceqz 5 target)
|
||||
(inst bcnez 5 target)))))))
|
||||
(frob < fcmp.clt.s fcmp.clt.d nil </single-float </double-float)
|
||||
(frob <= fcmp.cle.s fcmp.cle.d nil <=/single-float <=/double-float)
|
||||
(frob > fcmp.cle.s fcmp.cle.d t >/single-float >/double-float)
|
||||
(frob >= fcmp.clt.s fcmp.clt.d t >=/single-float >=/double-float)
|
||||
(frob > fcmp.clt.s fcmp.clt.d t >/single-float >/double-float)
|
||||
(frob >= fcmp.cle.s fcmp.cle.d t >=/single-float >=/double-float)
|
||||
(frob = fcmp.ceq.s fcmp.ceq.d nil =/single-float =/double-float))
|
||||
|
||||
(macrolet ((frob (name translate
|
||||
|
|
|
|||
|
|
@ -455,22 +455,26 @@
|
|||
(:translate ,translate)
|
||||
(:generator 3
|
||||
(note-this-location vop :internal-error)
|
||||
(inst ,op :single temp x y)
|
||||
(if ,(if complement '(not not-p) 'not-p)
|
||||
(inst ,op :single temp ,@(if complement
|
||||
'(y x)
|
||||
'(x y)))
|
||||
(if not-p
|
||||
(inst beq temp zero-tn target)
|
||||
(inst bne temp zero-tn target))))
|
||||
(define-vop (,dname double-float-compare)
|
||||
(:translate ,translate)
|
||||
(:generator 3
|
||||
(note-this-location vop :internal-error)
|
||||
(inst ,op :double temp x y)
|
||||
(if ,(if complement '(not not-p) 'not-p)
|
||||
(inst ,op :double temp ,@(if complement
|
||||
'(y x)
|
||||
'(x y)))
|
||||
(if not-p
|
||||
(inst beq temp zero-tn target)
|
||||
(inst bne temp zero-tn target)))))))
|
||||
(frob < flt nil </single-float </double-float)
|
||||
(frob <= fle nil <=/single-float <=/double-float)
|
||||
(frob > fle t >/single-float >/double-float)
|
||||
(frob >= flt t >=/single-float >=/double-float)
|
||||
(frob > flt t >/single-float >/double-float)
|
||||
(frob >= fle t >=/single-float >=/double-float)
|
||||
(frob = feq nil =/single-float =/double-float))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@
|
|||
(+ x0 x1 x6 x7) (+ x2 x3 x4 x5)))))))
|
||||
|
||||
(with-test (:name (:nan :comparison)
|
||||
:fails-on (or :no-float-traps :sparc :loongarch64))
|
||||
:fails-on :sparc)
|
||||
(sb-int:with-float-traps-masked (:invalid)
|
||||
(macrolet ((test (form)
|
||||
(let ((nform (subst '(/ 0.0 0.0) 'nan form)))
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
(test (not (> nan 1.0))))))
|
||||
|
||||
(with-test (:name (:nan :comparison :non-float)
|
||||
:fails-on (or :sparc :loongarch64))
|
||||
:fails-on :sparc)
|
||||
(sb-int:with-float-traps-masked (:invalid)
|
||||
(let ((nan (/ 0.0 0.0))
|
||||
(reals (list 0 1 -1 1/2 -1/2 (expt 2 300) (- (expt 2 300))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue