[Ecls-list] logior/ash and fixnum inlining

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


Hello,

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?


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


The following C code is generated (using ECL HEAD):


/* 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 = (cl_fixnum) ((V1)->vector.self.i32[2]);
				T2 = cl_ash(MAKE_FIXNUM(V4), MAKE_FIXNUM(8)) /* ASH */ ;
				{
					cl_fixnum       V5;
					V5 = (cl_fixnum) ((V1)->vector.self.i32[3]);
					value0 = cl_logior(4, T0, T1, T2, MAKE_FIXNUM(V5)) /* LOGIOR */ ;
					return value0;
				}
			}
		}
	}
}


Thanks,
-- 
Matt




More information about the ecl-devel mailing list