Have sign-extend-complex deal correctly with bytes of size 0.
[movitz-ia-x86.git] / instr-simd.lisp
blob3aa4a9c19b5d9c42c25b5acc66f980317b01602c
1 ;;;;------------------------------------------------------------------
2 ;;;;
3 ;;;; Copyright (C) 2000,
4 ;;;; Department of Computer Science, University of Tromso, Norway
5 ;;;;
6 ;;;; Filename: ia-x86-instr-simd.lisp
7 ;;;; Description: Streaming SIMD instructions.
8 ;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
9 ;;;; Created at: Thu Aug 3 18:15:02 2000
10 ;;;; Distribution: See the accompanying file COPYING.
11 ;;;;
12 ;;;; $Id: instr-simd.lisp,v 1.2 2004/01/16 11:54:14 ffjeld Exp $
13 ;;;;
14 ;;;;------------------------------------------------------------------
16 (in-package #:ia-x86-instr)
18 (def-instr simd (instruction))
21 ;;; Packed Single-FP Add
22 (def-instr addps (simd) (:r #x0f58 (xmm/m128 xmm) :not-prefixes (repz)))
24 ;;; Scalar Single-FP Add
25 (def-instr addss (simd) (:r #x0f58 (xmm/m32 xmm) :req-prefixes (repz)))
27 ;;; Bit-wise Logical And Not for Single-FP
28 (def-instr andnps (simd) (:r #x0f55 (xmm/m128 xmm)))
30 ;;; Bit-wise Logical And for Single-FP
31 (def-instr andps (simd) (:r #x0f54 (xmm/m128 xmm)))
33 ;;; Packed Single-FP Compare
34 ; this is one fucked up instruction!
35 (def-instr cmpps (simd) (:r-imm #x0fc2 1 (imm8 xmm/m128 xmm) :not-prefixes (repz)))
37 ;;; Scalar Single-FP Compare
38 (def-instr cmpss (simd) (:r-imm #x0fc2 1 (imm8 xmm/m128 xmm) :req-prefixes (repz)))
40 ;;; Scalar Ordered Single-FP Comare and set EFLAGS
41 (def-instr comiss (simd) (:r #x0f2f (xmm/m32 xmm)))
43 ;;; Packed Signed INT32 to Packed Single-FP Conversion
44 (def-instr cvtpi2ps (simd) (:r #x0f2a (xmm/m64 xmm) :not-prefixes (repz)))
46 ;;; Scalar signed INT32 to Single-FP Conversion
47 (def-instr cvtsi2ss (simd) (:r #x0f2a (r/m32 xmm) :req-prefixes (repz)))
49 ;;; Packed Single-FP to Packed INT32 Conversion
50 (def-instr cvtps2pi (simd) (:r #x0f2d (xmm/m64 xmm) :not-prefixes (repz)))
52 ;;; Scalar Single-FP to Signed INT32 Conversion
53 (def-instr cvtss2si (simd) (:r #x0f2d (xmm/m32 r32) :req-prefixes (repz)))
55 ;;; Packed Single-FP to Packed INT32 Conversion (truncate)
56 (def-instr cvttps2pi (simd) (:r #x0f2c (xmm/m64 mm) :not-prefixes (repz)))
58 ;;; Scalar Single-FP to signed INT32 Conversion (truncate)
59 (def-instr cvttss2si (simd) (:r #x0f2c (xmm/m32 r32) :req-prefixes (repz)))
61 ;;; Packed Single-FP Divide
62 (def-instr divps (simd) (:r #x0f5e (xmm/m128 xmm) :not-prefixes (repz)))
64 ;;; Scalar Single-FP Divide
65 (def-instr divss (simd) (:r #x0f5e (xmm/m32 xmm) :req-prefixes (repz)))
67 ;;; Restore FP and MMX state and Streaming SIMD Extension State
68 (def-instr fxrstor (simd) (:digit (#x0fae 1) 0 (m) :indirect t))
70 ;;; Store FP and MMX State and Streaming SIMD Extension State
71 (def-instr fxsave (simd) (:digit (#x0fae 0) 0 (m) :indirect t))
73 ;;; Load Streaming SIMD Extension Control/Status
74 (def-instr ldmxcsr (simd) (:digit (#x0fae 2) 0 (m) :indirect t))
76 ;;; Packed Single-FP Maximum
77 (def-instr maxps (simd) (:r #x0f5f (xmm/m128 xmm) :not-prefixes (repz)))
79 ;;; Scalar Single-FP Maximum
80 (def-instr maxss (simd) (:r #x0f5f (xmm/m32 xmm) :req-prefixes (repz)))
82 ;;; Packed Single-FP Minimum
83 (def-instr minps (simd) (:r #x0f5d (xmm/m128 xmm) :not-prefixes (repz)))
85 ;;; Scalar Single-FP Minimum
86 (def-instr minss (simd) (:r #x0f5d (xmm/m32 xmm) :req-prefixes (repz)))
88 ;;; Move Aligned Four Packed Single-FP
89 (def-instr movaps (simd)
90 (:r #x0f28 (xmm/m128 xmm))
91 (:r #x0f29 (xmm xmm/m128)))
93 ;;; Move High to Low Packed Single-FP
94 (def-instr movhlps (simd) (:r #x0f12 (xmm/m128 xmm) :direct t))
96 ;;; Move High Packed Single-FP
97 (def-instr movhps (simd)
98 (:r #x0f16 (xmm/m64 xmm) :indirect t)
99 (:r #x0f17 (xmm xmm/m64) :indirect t))
101 ;;; Move Low to High Packed Single-FP
102 (def-instr movlhps (simd)
103 (:r #x0f16 (xmm/m64 xmm) :direct t))
105 ;;; Move Low Packed Single-FP
106 (def-instr movlps (simd)
107 (:r #x0f12 (xmm/m64 xmm) :indirect t)
108 (:r #x0f13 (xmm xmm/m64) :indirect t))
110 ;;; Move Mask to Integer
111 (def-instr movmskps (simd) (:r #x0f50 (xmm r/m32) :direct t))
113 ;;; Move Scalar Single-FP
114 (def-instr movss (simd)
115 (:r #x0f10 (xmm/m32 xmm) :req-prefixes (repz))
116 (:r #x0f11 (xmm xmm/m32) :req-prefixes (repz)))
118 ;;; Move Unaligned Four Packed Single-FP
119 (def-instr movups (simd)
120 (:r #x0f10 (xmm/m128 xmm) :not-prefixes (repz))
121 (:r #x0f11 (xmm xmm/m128) :not-prefixes (repz)))
123 ;;; Packed Single-FP Multiply
124 (def-instr mulps (simd) (:r #x0f59 (xmm/m128 xmm) :not-prefixes (repz)))
126 ;;; Scalar Single-FP Multiply
127 (def-instr mulss (simd) (:r #x0f59 (xmm/m32 xmm) :req-prefixes (repz)))
129 ;;; Bit-wise Logical OR for Single-FP Data
130 (def-instr orps (simd) (:r #x0f56 (xmm/m128 xmm)))
132 ;;; Packed Single-FP Reciprocal
133 (def-instr rcpps (simd) (:r #x0f53 (xmm/m128 xmm) :not-prefixes (repz)))
135 ;;; Scalar Single-FP Reciprocal
136 (def-instr rcpss (simd) (:r #x0f53 (xmm/m32 xmm) :req-prefixes (repz)))
138 ;;; Packed Single-FP Square Root Reciprocal
139 (def-instr rsqrtps (simd) (:r #x0f52 (xmm/m128 xmm) :not-prefixes (repz)))
141 ;;; Scalar Single-FP Square Root Reciprocal
142 (def-instr rsqrtss (simd) (:r #x0f52 (xmm/m32 xmm) :req-prefixes (repz)))
144 ;;; Suffle Single-FP
145 (def-instr shufps (simd) (:r-imm #x0fc6 1 (imm8 xmm/m128 xmm)))
147 ;;; Packed Single-FP Square Root
148 (def-instr sqrtps (simd) (:r #x0f51 (xmm/m128 xmm) :not-prefixes (repz)))
150 ;;; Scalar Single-FP Square Root
151 (def-instr sqrtss (simd) (:r #x0f51 (xmm/m32 xmm) :req-prefixes (repz)))
153 ;;; Store Streaming SIMD Extension Control/Status
154 (def-instr stmxcsr (simd) (:digit (#x0fae 3) 0 (r/m32) :indirect t))
156 ;;; Packed Single-FP Subtract
157 (def-instr subps (simd) (:r #x0f5c (xmm/m128 xmm) :not-prefixes (repz)))
159 ;;; Scalar Single-FP Subtract
160 (def-instr subss (simd) (:r #x0f5c (xmm/m128 xmm) :req-prefixes (repz)))
162 ;;; Unordered Scalar Single-FP Compare and Set EFLAGS
163 (def-instr ucomiss (simd) (:r #x0f2e (xmm/m32 xmm)))
165 ;;; Unpack High Packed Single-FP Data
166 (def-instr unpckhps (simd) (:r #x0f15 (xmm/m128 xmm)))
168 ;;; Unpack Low Packed Single-FP Data
169 (def-instr unpcklps (simd) (:r #x0f14 (xmm/m128 xmm)))
171 ;;; Bit-wise Logical XOR for Single-FP Data
172 (def-instr xorps (simd) (:r #x0f57 (xmm/m128 xmm)))
176 ;;; Cacheability Control
180 ;;; Move Aligned Four Packed Single-FP Non-temporal
181 (def-instr movntps (simd) (:r #x0f2b (xmm xmm/m128) :indirect t))