SPARC Assembly Language Reference Manual

B.3 Example 3

The pseudo-ops shown in this example are .align, .global, .type, and .size.

The following C subroutine:

int sum(a, b)
	int a, b;
	return(a + b);

can be translated into the following assembly code:

	.section			".text"

	.global			sum

	.align			4


	add		%o0,%o1,%o0				! (a + b) is done in the

							! delay slot of retl

	.type		sum,#function				! sum is of type function
	.size		sum,.-sum				! size of sum is the diff

							! of current location

							! counter and the initial

							! definition of sum