Have sign-extend-complex deal correctly with bytes of size 0.
[movitz-ia-x86.git] / instr-sub.lisp
blob9765b1907949eca275ad42a23355ed1d34de7eb0
1 ;;;;------------------------------------------------------------------
2 ;;;;
3 ;;;; Copyright (C) 2000-2002,
4 ;;;; Department of Computer Science, University of Tromso, Norway
5 ;;;;
6 ;;;; Filename: instr-sub.lisp
7 ;;;; Description:
8 ;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
9 ;;;; Created at: Tue Feb 1 14:16:58 2000
10 ;;;; Distribution: See the accompanying file COPYING.
11 ;;;;
12 ;;;; $Id: instr-sub.lisp,v 1.2 2004/01/16 11:54:14 ffjeld Exp $
13 ;;;;
14 ;;;;------------------------------------------------------------------
16 (in-package "IA-X86-INSTR")
18 ;;; ----------------------------------------------------------------
19 ;;; SUB [IISR page 11-375]
20 ;;; ----------------------------------------------------------------
22 (def-instr sub (instruction))
23 (def-instr subb (sub)
24 (:plain #x2c (0 1) (imm8 al))
25 (:digit (#x80 5) 1 (imm8 r/m8))
26 (:r #x28 (r8 r/m8))
27 (:r #x2a (r/m8 r8)))
29 (def-instr subw (sub)
30 (:plain #x2d (0 2) (imm16 ax) :operand-mode :16-bit)
31 (:digit (#x81 5) 2 (imm16 r/m16) :operand-mode :16-bit)
32 (:digit (#x83 5) 1 (simm8 r/m16) :operand-mode :16-bit)
33 (:r #x29 (r16 r/m16) :operand-mode :16-bit)
34 (:r #x2b (r/m16 r16) :operand-mode :16-bit))
36 (def-instr subl (sub)
37 (:plain #x2d (0 4) (simm32 eax) :operand-mode :32-bit)
38 (:digit (#x81 5) 4 (simm32 r/m32) :operand-mode :32-bit)
39 (:digit (#x83 5) 1 (simm8 r/m32) :operand-mode :32-bit)
40 (:r #x29 (r32 r/m32) :operand-mode :32-bit)
41 (:r #x2b (r/m32 r32) :operand-mode :32-bit))
43 ;;; ----------------------------------------------------------------
44 ;;; SBB [IISR page 11-349]
45 ;;; ----------------------------------------------------------------
47 (def-instr sbb (instruction))
48 (def-instr sbbb (sbb)
49 (:plain #x1c (0 1) (simm8 al))
50 (:digit (#x80 3) 1 (simm8 r/m8))
51 (:r #x18 (r8 r/m8))
52 (:r #x1a (r/m8 r8)))
54 (def-instr sbbw (sbb)
55 (:plain #x1d (0 2) (imm16 ax) :operand-mode :16-bit)
56 (:digit (#x81 3) 2 (imm16 r/m16) :operand-mode :16-bit)
57 (:digit (#x83 3) 1 (imm8 r/m16) :operand-mode :16-bit)
58 (:r #x19 (r16 r/m16) :operand-mode :16-bit)
59 (:r #x1b (r/m16 r16) :operand-mode :16-bit))
61 (def-instr sbbl (sbb)
62 (:plain #x1d (0 4) (simm32 eax) :operand-mode :32-bit)
63 (:digit (#x81 3) 4 (simm32 r/m32) :operand-mode :32-bit)
64 (:digit (#x83 3) 1 (simm8 r/m32) :operand-mode :32-bit)
65 (:r #x19 (r32 r/m32) :operand-mode :32-bit)
66 (:r #x1b (r/m32 r32) :operand-mode :32-bit))
68 ;;; ----------------------------------------------------------------
69 ;;; DEC [IISR page 11-84]
70 ;;; ----------------------------------------------------------------
72 (def-instr dec (instruction))
74 (def-instr decb (dec)
75 (:digit (#xfe 1) 0 (r/m8)))
76 (def-instr decw (dec)
77 (:+ #x48 0 (+r16) :operand-mode :16-bit)
78 (:digit (#xff 1) 0 (r/m16) :operand-mode :16-bit))
79 (def-instr decl (dec)
80 (:+ #x48 0 (+r32) :operand-mode :32-bit)
81 (:digit (#xff 1) 0 (r/m32) :operand-mode :32-bit))
84 ;;; ----------------------------------------------------------------
85 ;;; NEG
86 ;;; ----------------------------------------------------------------
88 (def-instr neg (instruction))
89 (def-instr negb (neg) (:digit (#xf6 3) 0 (r/m8)))
90 (def-instr negw (neg) (:digit (#xf7 3) 0 (r/m16) :operand-mode :16-bit))
91 (def-instr negl (neg) (:digit (#xf7 3) 0 (r/m32) :operand-mode :32-bit))