Have sign-extend-complex deal correctly with bytes of size 0.
[movitz-ia-x86.git] / instr-mul-div.lisp
blobfc73a923678e9863456e4ea438ab62714ffcccdb
1 ;;;;------------------------------------------------------------------
2 ;;;;
3 ;;;; Copyright (C) 2000, 2002,
4 ;;;; Department of Computer Science, University of Tromso, Norway
5 ;;;;
6 ;;;; Filename: instr-mul-div.lisp
7 ;;;; Description: Multiplication and division instructions
8 ;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
9 ;;;; Created at: Mon Jan 31 21:12:11 2000
10 ;;;; Distribution: See the accompanying file COPYING.
11 ;;;;
12 ;;;; $Id: instr-mul-div.lisp,v 1.2 2004/01/16 11:54:14 ffjeld Exp $
13 ;;;;
14 ;;;;------------------------------------------------------------------
16 (in-package "IA-X86-INSTR")
18 ;;;
20 (def-instr mul (instruction))
21 (def-instr mulb (mul) (:digit (#xf6 4) 0 (r/m8 ax al)))
22 (def-instr mulw (mul) (:digit (#xf7 4) 0 (r/m16 ax dx) :operand-mode :16-bit))
23 (def-instr mull (mul) (:digit (#xf7 4) 0 (r/m32 eax edx) :operand-mode :32-bit))
25 ;;;
27 (def-instr imul (instruction))
28 (def-instr imulb (imul)
29 (:digit (#xf6 5) 0 (r/m8 ax al)))
31 (def-instr imulw (imul)
32 (:digit (#xf7 5) 0 (r/m16 ax dx) :operand-mode :16-bit)
33 (:r #c(#x0faf 2) (r/m16 r16) :operand-mode :16-bit)
34 (:r-imm #x6b 1 (imm8 r/m16 r16) :operand-mode :16-bit)
35 (:r-imm #x69 2 (imm16 r/m16 r16) :operand-mode :16-bit))
37 (def-instr imull (imul)
38 (:digit (#xf7 5) 0 (r/m32 eax edx) :operand-mode :32-bit)
39 (:r #c(#x0faf 2) (r/m32 r32) :operand-mode :32-bit)
40 (:r-imm #x6b 1 (simm8 r/m32 r32) :operand-mode :32-bit)
41 (:r-imm #x69 4 (simm32 r/m32 r32) :operand-mode :32-bit))
43 ;;; Unsigned Divide
45 (def-instr div (instruction))
47 (def-instr divb (div)
48 ;; divide AX by r/m8 into AL, AH
49 (:digit (#xf6 6) 0 (r/m8 ax)))
50 (def-instr divw (div)
51 ;; divide DX:AX by r/m16 into AX, DX
52 (:digit (#xf7 6) 0 (r/m16 ax dx) :operand-mode :16-bit))
53 (def-instr divl (div)
54 ;; divide EDX:EAX by r/m32 into EAX, EDX
55 (:digit (#xf7 6) 0 (r/m32 eax edx) :operand-mode :32-bit))
57 ;;; Signed Divide
59 (def-instr idiv (instruction))
60 (def-instr idivb (idiv)
61 ;; divide AX by r/m8 into AL, AH
62 (:digit (#xf6 7) 0 (r/m8 ax)))
63 (def-instr idivw (idiv)
64 ;; divide DX:AX by r/m16 into AX, DX
65 (:digit (#xf7 7) 0 (r/m16 ax dx) :operand-mode :16-bit))
66 (def-instr idivl (idiv)
67 ;; divide EDX:EAX by r/m32 into EAX, EDX
68 (:digit (#xf7 7) 0 (r/m32 eax edx) :operand-mode :32-bit))