[Ecls-list] logior/ash and fixnum inlining

Matthew Mondor mm_lists at pulsar-zone.net
Tue Jul 26 20:10:33 UTC 2011


On Tue, 26 Jul 2011 10:24:20 -0400
Matthew Mondor <mm_lists at pulsar-zone.net> wrote:

> When looking at the cmp/ proclamations, it's unclear to me why the
> following code does not inline to C << and |.  Perhaps I'm missing
> something obvious?

Well here is some slight progress; I remembered that + worked better in
pairs and thought I'd also try with LOGIOR.  ASH calls however are
still implicit even if the parameters consist of a pair of fixnums.


(defun address-fixnum (addr)
  (declare (optimize (speed 3) (safety 0) (debug 0))
	   (type (simple-array fixnum (4)) addr))
  (the fixnum
    (logior (the fixnum (logior (the fixnum (ash (the fixnum (aref addr 0)) 24))
				(the fixnum (ash (the fixnum (aref addr 1)) 16))))
	    (the fixnum (logior
			 (the fixnum (ash (the fixnum (aref addr 2)) 8))
			 (the fixnum (aref addr 3)))))))


/* function definition for ADDRESS-FIXNUM                        */
/* optimize speed 3, debug 0, space 0, safety 0                  */
static cl_object 
L1address_fixnum(cl_object V1)
{
	VT2 VLEX2 CLSR2 STCK2
	const cl_env_ptr cl_env_copy = ecl_process_env();
	cl_object       value0;
TTL:
	{
		cl_fixnum       V2;
		V2 = (cl_fixnum) ((V1)->vector.self.i32[0]);
		T0 = cl_ash(MAKE_FIXNUM(V2), MAKE_FIXNUM(24)) /* ASH */ ;
		{
			cl_fixnum       V3;
			V3 = (cl_fixnum) ((V1)->vector.self.i32[1]);
			T1 = cl_ash(MAKE_FIXNUM(V3), MAKE_FIXNUM(16)) /* ASH */ ;
			{
				cl_fixnum       V4;
				V4 = ((fix(T0)) | (fix(T1)));
				{
					cl_fixnum       V5;
					V5 = (cl_fixnum) ((V1)->vector.self.i32[2]);
					T2 = cl_ash(MAKE_FIXNUM(V5), MAKE_FIXNUM(8)) /* ASH */ ;
					{
						cl_fixnum       V6;
						V6 = (cl_fixnum) ((V1)->vector.self.i32[3]);
						{
							cl_fixnum       V7;
							V7 = ((fix(T2)) | (V6));
							value0 = MAKE_FIXNUM(((V4) | (V7)));
							cl_env_copy->nvalues = 1;
							return value0;
						}
					}
				}
			}
		}
	}
}


Thanks again,
-- 
Matt




More information about the ecl-devel mailing list