... |
... |
@@ -945,23 +945,7 @@ |
945
|
945
|
(frob double ucomisd))
|
946
|
946
|
|
947
|
947
|
(macrolet
|
948
|
|
- ((gen-code (op sc-type inst ea)
|
949
|
|
- ;; When the operation is >, the second arg (y) can be a
|
950
|
|
- ;; register or a descriptor. When the operation is <, the args
|
951
|
|
- ;; are swapped and we want to allow x to be a register or
|
952
|
|
- ;; descriptor.
|
953
|
|
- (if (eq op '<)
|
954
|
|
- `(sc-case x
|
955
|
|
- (,sc-type
|
956
|
|
- (inst ,inst y x))
|
957
|
|
- (descriptor-reg
|
958
|
|
- (inst ,inst y (,ea x))))
|
959
|
|
- `(sc-case y
|
960
|
|
- (,sc-type
|
961
|
|
- (inst ,inst x y))
|
962
|
|
- (descriptor-reg
|
963
|
|
- (inst ,inst x (,ea y))))))
|
964
|
|
- (frob (op size inst)
|
|
948
|
+ ((frob (op size inst)
|
965
|
949
|
(let ((ea (ecase size
|
966
|
950
|
(single
|
967
|
951
|
'ea-for-sf-desc)
|
... |
... |
@@ -969,21 +953,32 @@ |
969
|
953
|
'ea-for-df-desc)))
|
970
|
954
|
(name (symbolicate op "/" size "-FLOAT"))
|
971
|
955
|
(sc-type (symbolicate size "-REG"))
|
972
|
|
- (inherit (symbolicate size "-FLOAT-COMPARE")))
|
|
956
|
+ (inherit (symbolicate size "-FLOAT-COMPARE"))
|
|
957
|
+ (reverse-args-p (eq op '<)))
|
973
|
958
|
`(define-vop (,name ,inherit)
|
974
|
|
- ;; When the operation is <, we want to rewrite x < y to y
|
975
|
|
- ;; > x. In that case, we want to allow x to be in a
|
976
|
|
- ;; descriptor. For >, y is allowed to be a descriptor.
|
977
|
|
- ,@(when (eq op '<)
|
978
|
|
- `((:args (x :scs (,sc-type descriptor-reg))
|
979
|
|
- (y :scs (,sc-type)))))
|
|
959
|
+ ;; The compare instructions take a reg argument for the
|
|
960
|
+ ;; first arg and reg or mem argument for the second. When
|
|
961
|
+ ;; inverting the arguments we must also invert which of
|
|
962
|
+ ;; the argument can be a mem argument.
|
|
963
|
+ (:args (x :scs (,sc-type ,@(when reverse-args-p 'descriptor-reg)))
|
|
964
|
+ (y :scs (,sc-type ,@(unless reverse-args-p 'descriptor-reg))))
|
980
|
965
|
(:translate ,op)
|
981
|
966
|
(:info target not-p)
|
982
|
967
|
(:generator 3
|
983
|
968
|
;; Note: x < y is the same as y > x. We reverse the
|
984
|
969
|
;; args to reduce the number of jump instructions
|
985
|
970
|
;; needed.
|
986
|
|
- (gen-code ,op ,sc-type ,inst ,ea)
|
|
971
|
+ ,(if reverse-args-p
|
|
972
|
+ `(sc-case x
|
|
973
|
+ (,sc-type
|
|
974
|
+ (inst ,inst y x))
|
|
975
|
+ (descriptor-reg
|
|
976
|
+ (inst ,inst y (,ea x))))
|
|
977
|
+ `(sc-case y
|
|
978
|
+ (,sc-type
|
|
979
|
+ (inst ,inst x y))
|
|
980
|
+ (descriptor-reg
|
|
981
|
+ (inst ,inst x (,ea y)))))
|
987
|
982
|
;; Consider the case of x > y.
|
988
|
983
|
;;
|
989
|
984
|
;; When a NaN occurs, comis sets ZF, PF, and CF = 1. In
|