[Git][cmucl/cmucl][issue-185-x86-shorter-insts] Simplify testing for signed-imm-byte data using sign-extend function.,

Raymond Toy (@rtoy) gitlab at common-lisp.net
Tue Apr 25 23:54:02 UTC 2023



Raymond Toy pushed to branch issue-185-x86-shorter-insts at cmucl / cmucl


Commits:
54ba7245 by Carl S. Shapiro at 2023-04-25T23:53:54+00:00
Simplify testing for signed-imm-byte data using sign-extend function.,
- - - - -


1 changed file:

- src/compiler/x86/insts.lisp


Changes:

=====================================
src/compiler/x86/insts.lisp
=====================================
@@ -1304,19 +1304,12 @@
 
 (defun arith-logical-constant-control (chunk inst stream dstate)
     (declare (ignore inst stream))
-    (let ((opcode (ldb (byte 8 0) chunk))
-	  (signed-imm-data (ldb (byte 8 16) chunk)))
-      ;; See emit-random-arith-inst for the case where we use an 8-bit
-      ;; signed immediate value in the instruction.  We print a note
-      ;; only if we have a 8-bit immediate and the 8-bit value is
-      ;; negative (MSB is 1).
-      (when (and (= opcode #b10000011)
-		 (logbitp 7 signed-imm-data))
-	(disassem:note #'(lambda (stream)
-			   (princ (ldb (byte 32 0)
-				       (sign-extend signed-imm-data 8))
-				  stream))
-		       dstate))))
+    (when (= (ldb (byte 8 0) chunk) #b10000011)
+      (let ((imm (sign-extend (ldb (byte 8 16) chunk) 8)))
+	(when (minusp imm)
+	  (disassem:note #'(lambda (stream)
+			     (princ (ldb (byte 32 0) imm) stream))
+			 dstate)))))
 
 (eval-when (compile eval)
   (defun arith-inst-printer-list (subop &key control)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/54ba7245abe655147e6dfe0742f4e16f1af274ad

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/54ba7245abe655147e6dfe0742f4e16f1af274ad
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20230425/f1a18dd3/attachment-0001.html>


More information about the cmucl-cvs mailing list