Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix movelh-ps and movehl-ps intrinsics #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions sbcl-core.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ May emit additional instructions using the temporary register."

(defmacro def-binary-intrinsic (&whole whole
name rtype insn cost c-name
&key commutative tags immediate-arg x-type y-type)
&key commutative mem-alt-insn tags immediate-arg
x-type y-type)
(declare (ignore c-name x-type y-type))
(let* ((imm (if immediate-arg '(imm)))
(immt (if immediate-arg (list immediate-arg))))
Expand All @@ -470,7 +471,15 @@ May emit additional instructions using the temporary register."
`((unless (location= y r)
(setf tmp r))
(ensure-load ,rtype tmp x)
(inst ,insn ,@tags tmp (ensure-reg-or-mem y) ,@imm)
,(let ((std-inst `(inst ,insn ,@tags tmp
(ensure-reg-or-mem y) ,@imm))
(alt-inst `(inst ,mem-alt-insn ,@tags tmp
(ensure-reg-or-mem y) ,@imm)))
(if mem-alt-insn
`(sc-case y
(#.+any-sse-reg+ ,std-inst)
(t ,alt-inst))
std-inst))
(ensure-move ,rtype r tmp))))))))

#|---------------------------------|
Expand Down
6 changes: 4 additions & 2 deletions sse-intrinsics.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@

(def-binary-intrinsic move-ss float-sse-pack movss 1 "_mm_move_ss")

(def-binary-intrinsic movehl-ps float-sse-pack movhlps 1 "_mm_movehl_ps")
(def-binary-intrinsic movelh-ps float-sse-pack movlhps 1 "_mm_movelh_ps")
(def-binary-intrinsic movehl-ps float-sse-pack movhlps 1 "_mm_movehl_ps"
:mem-alt-insn movlps)
(def-binary-intrinsic movelh-ps float-sse-pack movlhps 1 "_mm_movelh_ps"
:mem-alt-insn movhps)

(def-unary-intrinsic movemask-ps (unsigned-byte 4) movmskps 1 "_mm_movemask_ps" :arg-type float-sse-pack)

Expand Down