[Git][cmucl/cmucl][master] Fix up shld/shrd instructions.

Raymond Toy rtoy at common-lisp.net
Sat Jan 16 21:01:57 UTC 2016


Raymond Toy pushed to branch master at cmucl / cmucl


Commits:
8058d410 by Raymond Toy at 2016-01-16T13:01:37Z
Fix up shld/shrd instructions.

o Need to define a new instruction format for these double shifts;
  they look like ext-reg-reg/mem but there's no width field.
o Clean up emit-double-shift slightly.
o Update double-shift-inst-printer-list to support both immediate
  shift or shifts in CL.

- - - - -


1 changed file:

- src/compiler/x86/insts.lisp


Changes:

=====================================
src/compiler/x86/insts.lisp
=====================================
--- a/src/compiler/x86/insts.lisp
+++ b/src/compiler/x86/insts.lisp
@@ -859,6 +859,18 @@
   ;; optional fields
   (imm))
 
+;; Double shift instructions. Like ext-reg-reg/mem but there's no
+;; width field.
+(disassem:define-instruction-format (ext-reg-reg/mem-shift 24)
+  (prefix  :field (byte 8 0)  :value #b00001111)
+  (op      :field (byte 8 8))
+  (reg/mem :fields (list (byte 2 22) (byte 3 16))
+	                      :type 'reg/mem)
+  (reg     :field (byte 3 19) :type 'reg)
+  ;; optional fields
+  (imm))
+							   
+
 ;;; ----------------------------------------------------------------
 ;;; this section added by jrd, for fp instructions.  
 
@@ -1535,24 +1547,22 @@
 (defun emit-double-shift (segment opcode dst src amt)
   (let ((size (matching-operand-size dst src)))
     (when (eq size :byte)
-      (error "Double shifts can only be used with words."))
+      (error "Double shifts cannot be used with byte registers."))
     (maybe-emit-operand-size-prefix segment size)
     (emit-byte segment #b00001111)
     (emit-byte segment (dpb opcode (byte 1 3)
 			    (if (eq amt :cl) #b10100101 #b10100100)))
-    #+nil
-    (emit-ea segment dst src)
-    (emit-ea segment dst (reg-tn-encoding src))	; pw tries this
+    (emit-ea segment dst (reg-tn-encoding src))
     (unless (eq amt :cl)
       (emit-byte segment amt))))
 
 (eval-when (compile eval)
   (defun double-shift-inst-printer-list (op)
-    `(#+nil
-      (ext-reg-reg/mem-imm ((op ,(logior op #b100))
-			    (imm nil :type signed-imm-byte)))
-      (ext-reg-reg/mem ((op ,(logior op #b101)))
-	 (:name :tab reg/mem ", " 'cl)))))
+    `((ext-reg-reg/mem-shift ((op ,(logior op #b100))
+			      (imm nil :type signed-imm-byte))
+         (:name :tab reg/mem ", " reg ", " imm))
+      (ext-reg-reg/mem-shift ((op ,(logior op #b101)))
+	 (:name :tab reg/mem ", " reg ", " 'cl)))))
 
 (define-instruction shld (segment dst src amt)
   (:declare (type (or (member :cl) (mod 32)) amt))



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/8058d410e86a77a6839d4c4228e03aae9cb70d2f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20160116/16c6e1d3/attachment-0001.html>


More information about the cmucl-cvs mailing list