Assembly language versus intrinsics comparison: an example

The ease of implementing a DMA transfer using intrinsics versus assembly-language instructions is illustrated in the example-implementation of the dma_transfer subroutine that is provided in this section.

The dma_transfer subroutine issues a DMA command with transfer size bytes from the LS address lsa, to or from the 64-bit effective address specified by eah | eal. The DMA command specified by the dma parameter is tagged using the specified tag_id parameter.
extern void dma_transfer(volatile void *lsa,		// local store address
             unsigned int eah, 								// high 32-bit effective address
             unsigned int eal, 								// low 32-bit effective address
             unsigned int size, 							// transfer size in bytes
             unsigned int tag_id, 						// tag identifier (0-31)
             unsigned int cmd); 							// DMA command
The Application Binary Interface (ABI)-compliant assembly-language implementation of the subroutine would be:
      .text
      .global		dma_transfer
   dma_transfer:
      wrch 			$MFC_LSA, $3
      wrch			$MFC_EAH, $4
      wrch			$MFC_EAL, $5
      wrch 			$MFC_Size, $6
      wrch 			$MFC_TagID, $7
      wrch 			$MFC_Cmd, $8
      bi 			$0 
A comparable C implementation using the SPU intrinsic, spu_writech, for the write-channel (wrch) instruction would be:
#include <spu_intrinsics.h> 

void dma_transfer(volatile void *lsa, unsigned int eah, unsigned int eal, 
             unsigned int size, unsigned int tag_id, unsigned int cmd)
{
     spu_writech(MFC_LSA, (unsigned int)lsa);
     spu_writech(MFC_EAH, eah);
     spu_writech(MFC_EAL, eal);
     spu_writech(MFC_Size, size);
     spu_writech(MFC_TagID, tag_id);
     spu_writech(MFC_Cmd, cmd);
} 
This particular function could be more simply written using the spu_mfcdma64 composite intrinsic, as:
#include <spu_intrinsics.h> 

void dma_transfer(volatile void *lsa, unsigned int eah, unsigned int eal,
             unsigned int size, unsigned int tag_id, unsigned int cmd)
{ 
     spu_mfcdma64(lsa, eah, eal, size, tag_id, cmd);
}