5 http
://www.amd.com
/us-en
/assets
/content_type
/white_papers_and_tech_docs
/26568.pdf
9 (declaim (optimize (debug 3)))
13 collect
`(emit-byte segment
,op
) into result
14 finally
(return result
)))
17 (defun gen-ops (&optional
(stream t
))
19 ;; single prec packed sse
21 ;;; ADDPS xmm1, xmm2/mem128 0F 58 /r
22 (loop for
(inst . ops
) in
24 ;; single precision float
26 (addsubps #xF2
#x0F
#xD0
)
39 ;; double precision float
40 (addpd #x66
#x0F
#x58
)
41 (addsubpd #x66
#x0F
#xD0
)
42 (andnpd #x66
#x0F
#x55
)
43 (andpd #x66
#x0F
#x54
)
44 (divpd #x66
#x0F
#x5E
)
45 (maxpd #x66
#x0F
#x5F
)
46 (minpd #x66
#x0F
#x5D
)
47 (mulpd #x66
#x0F
#x59
)
49 (rcppd #x66
#x0F
#x53
)
50 (rsqrtpd #x66
#x0F
#x52
)
51 (sqrtpd #x66
#x0F
#x51
)
52 (subpd #x66
#x0F
#x5C
)
53 (xorpd #x66
#x0F
#x57
)
56 (format stream
"~S~%~%"
57 `(define-instruction ,(intern (symbol-name inst
)) (segment dst src
)
60 (emit-ea segment src
(reg-tn-encoding dst
))))))
63 (loop for
(inst ops-m2r ops-r2m
) in
65 (movups (#x0F
#x10
) (#x0F
#x11
))
66 (movupd (#x66
#x0F
#x10
) (#x66
#x0F
#x11
)))
68 (format stream
"~S~%~%"
69 `(define-instruction ,(intern (symbol-name inst
)) (segment dst src
)
71 (cond ((sse-register-p dst
)
73 (emit-ea segment src
(reg-tn-encoding dst
)))
74 (t ,@(emit-ops ops-r2m
)
75 (emit-ea segment dst
(reg-tn-encoding src
)))))))))
77 (defun gen-ops-to-file (filename)
78 (with-open-file (stream filename
:direction
:output
:if-exists
:supersede
)