Commit f38e3d3d authored by Alexander Gavrilov's avatar Alexander Gavrilov Committed by Juan Jose Garcia Ripoll
Browse files

Use a c-inline transformation to represent SSE constants in code.

parent d0770f6a
......@@ -40,12 +40,29 @@
((typep val 'LONG-FLOAT)
(make-c1form* 'LOCATION :type 'LONG-FLOAT
:args (list 'LONG-FLOAT-VALUE val (add-object val))))
((typep val 'EXT:SSE-PACK)
(c1constant-value/sse val))
(make-c1form* 'LOCATION :type (object-type val)
:args (add-object val)))
(only-small-values nil)
(t nil)))
(defun c1constant-value/sse (value)
(let* ((bytes (ext:sse-pack-to-vector value '(unsigned-byte 8)))
(elt-type (ext:sse-pack-element-type value)))
(multiple-value-bind (wrapper rtype)
(case elt-type
(single-float (values "_mm_castsi128_ps" :float-sse-pack))
(double-float (values "_mm_castsi128_pd" :double-sse-pack))
(otherwise (values "" :int-sse-pack)))
(c1expr `(c-inline () () ,rtype
,(format nil "~A(_mm_setr_epi8(~{~A~^,~}))"
wrapper (coerce bytes 'list))
:one-liner t :side-effects nil)))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment