On Thu, Aug 12, 2010 at 2:27 AM, Juan Jose Garcia-Ripoll
<[email protected]> wrote:
> On Wed, Aug 11, 2010 at 5:29 PM, Alexander Gavrilov <[email protected]>
> wrote:
>>
>> Hi, I've finally got around to this, and after some investigation
>> implemented it using the static constant facility in cmpwt.lsp
>> instead:

Today I added definitions for a number of SSE intrinsic functions:

http://github.com/angavrilov/ecl-sse/blob/f9436efbf6b72544129d493a8342208392cf3354/contrib/sse/sse.lsp

However, when I try to use them, ECL generates correct code for SSE
operations, but fixnums are for some reason not handled inline:

(declaim (ftype (function ((array single-float) (array single-float))
t) add-floats))

(defun add-floats (arr1 arr2)
  (declare (optimize (speed 3) (safety 1)))
  (loop for i fixnum from 0 below (- (min (array-total-size arr1)
                                          (array-total-size arr2))
                                     3) by 4
     do (setf (sse:row-major-aref-ps arr1 i)
              (sse:add-ps (sse:row-major-aref-ps arr1 i)
                          (sse:row-major-aref-ps arr2 i)))))

transforms to:

/*      function definition for ADD-FLOATS                            */
/*      optimize speed 3, debug 3, space 0, safety 1                  */
static cl_object L2add_floats(cl_object V1, cl_object V2)
{ VT3 VLEX3 CLSR3 STCK3
        const cl_env_ptr cl_env_copy = ecl_process_env();
        cl_object value0;
        {
        {
        ecl_ihs_push(cl_env_copy,&ihs,VV[2],_ecl_debug_env);
TTL:
        T0= cl_typep(2,V1,VV[0])                  /*  TYPEP           */;
        if (ecl_unlikely(!((T0)!=Cnil)))
         FEwrong_type_argument(VV[0],V1);
        T0= cl_typep(2,V2,VV[0])                  /*  TYPEP           */;
        if (ecl_unlikely(!((T0)!=Cnil)))
         FEwrong_type_argument(VV[0],V2);
        {cl_fixnum V3;                            /*  I               */
        cl_fixnum V4;
        V3= 0;
        {cl_fixnum V5;
        V5= ((V1)->array.dim);
        {cl_fixnum V6;
        V6= ((V2)->array.dim);
        {cl_fixnum V7;
        V7= (V5)<=(V6)?V5:V6;
        V4= ecl_to_fixnum(ecl_minus(MAKE_FIXNUM(V7),MAKE_FIXNUM(3)));}}}
L8:;
        if(!((V3)>=(V4))){
        goto L12;}
        goto L9;
L12:;
        goto L10;
L10:;
        {__m128 V5;
        V5= _mm_loadu_ps((__m128*)(&(V1)->array.self.sf[V3]));
        {__m128 V6;
        V6= _mm_loadu_ps((__m128*)(&(V2)->array.self.sf[V3]));
        {__m128 V7;
        V7= _mm_add_ps(V5,V6);
        (_mm_storeu_ps((__m128*)(&(V1)->array.self.sf[V3]),V7),V7);}}}
        V3= ecl_to_fixnum(ecl_plus(MAKE_FIXNUM(V3),MAKE_FIXNUM(4)));
        goto L8;
L9:;
        value0=Cnil; cl_env_copy->nvalues=1;
        ecl_ihs_pop(cl_env_copy);
        return value0;
        }
        }
}}

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Ecls-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to