Raymond Toy pushed to branch master at cmucl / cmucl
Commits: 404e4b28 by Raymond Toy at 2023-02-27T20:18:24+00:00 Fix #168: Use positive forms for conditional jmp.
- - - - - 27979066 by Raymond Toy at 2023-02-27T20:18:27+00:00 Merge branch 'issue-168-no-negated-forms-for-jmp' into 'master'
Fix #168: Use positive forms for conditional jmp.
Closes #168
See merge request cmucl/cmucl!119 - - - - -
3 changed files:
- .gitlab-ci.yml - + src/bootfiles/21d/boot-2021-07-2.lisp - src/compiler/x86/insts.lisp
Changes:
===================================== .gitlab-ci.yml ===================================== @@ -1,7 +1,7 @@ variables: download_url: "https://common-lisp.net/project/cmucl/downloads/snapshots/2021/07" version: "2021-07-x86" - bootstrap: "-B boot-2021-07-1" + bootstrap: "-B boot-2021-07-1 -B boot-2021-07-2"
stages: - install
===================================== src/bootfiles/21d/boot-2021-07-2.lisp ===================================== @@ -0,0 +1,30 @@ +;; Bootstrap file for x86 to choose the non-negated forms of the +;; condition flag for conditional jumps. +;; +;; Use bin/build.sh -B boot-2021-07-2 to build this. + +(in-package :x86) + +(ext:without-package-locks + (handler-bind + ((error + (lambda (c) + (declare (ignore c)) + (invoke-restart 'continue)))) + (defconstant conditions + '((:o . 0) + (:no . 1) + (:b . 2) (:nae . 2) (:c . 2) + (:ae . 3) (:nb . 3) (:nc . 3) + (:e . 4) (:eq . 4) (:z . 4) + (:ne . 5) (:nz . 5) + (:be . 6) (:na . 6) + (:a . 7) (:nbe . 7) + (:s . 8) + (:ns . 9) + (:p . 10) (:pe . 10) + (:np . 11) (:po . 11) + (:l . 12) (:nge . 12) + (:ge . 13) (:nl . 13) + (:le . 14) (:ng . 14) + (:g . 15) (:nle . 15)))))
===================================== src/compiler/x86/insts.lisp ===================================== @@ -259,22 +259,39 @@ ;; the first one is the one that is preferred when printing the ;; condition code out. (defconstant conditions - '((:o . 0) + '( + ;; OF = 1 + (:o . 0) + ;; OF = 0 (:no . 1) + ;; Unsigned <; CF = 1 (:b . 2) (:nae . 2) (:c . 2) - (:nb . 3) (:ae . 3) (:nc . 3) + ;; Unsigned >=; CF = 0 + (:ae . 3) (:nb . 3) (:nc . 3) + ;; Equal; ZF = 1 (:e . 4) (:eq . 4) (:z . 4) + ;; Not equal; ZF = 0 (:ne . 5) (:nz . 5) + ;; Unsigned <=; CF = 1 or ZF = 1 (:be . 6) (:na . 6) - (:nbe . 7) (:a . 7) + ;; Unsigned >; CF = 1 and ZF = 0 + (:a . 7) (:nbe . 7) + ;; SF = 1 (:s . 8) + ;; SF = 0 (:ns . 9) + ;; Parity even (:p . 10) (:pe . 10) + ;; Parity odd (:np . 11) (:po . 11) + ;; Signed <; SF /= OF (:l . 12) (:nge . 12) - (:nl . 13) (:ge . 13) + ;; Signed >=; SF = OF + (:ge . 13) (:nl . 13) + ;; Signed <=; ZF = 1 or SF /= OF (:le . 14) (:ng . 14) - (:nle . 15) (:g . 15))) + ;; Signed >; ZF =0 and SF = OF + (:g . 15) (:nle . 15)))
(defun conditional-opcode (condition) (cdr (assoc condition conditions :test #'eq))))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/bb43504bf3ac0886cac0998...