arch/hexagon/lib/memset.S

Source file repositories/reference/linux-study-clean/arch/hexagon/lib/memset.S

File Facts

System
Linux kernel
Corpus path
arch/hexagon/lib/memset.S
Extension
.S
Size
4659 bytes
Lines
303
Domain
Architecture Layer
Bucket
arch/hexagon
Inferred role
Architecture Layer: arch/hexagon
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

.macro HEXAGON_OPT_FUNC_BEGIN name
	.text
	.p2align 4
	.globl \name
	.type  \name, @function
\name:
	.endm

	.macro HEXAGON_OPT_FUNC_FINISH name
	.size  \name, . - \name
	.endm

/* FUNCTION: memset (v2 version) */
#if __HEXAGON_ARCH__ < 3
HEXAGON_OPT_FUNC_BEGIN memset
	{
		r6 = #8
		r7 = extractu(r0, #3 , #0)
		p0 = cmp.eq(r2, #0)
		p1 = cmp.gtu(r2, #7)
	}
	{
		r4 = vsplatb(r1)
		r8 = r0           /* leave r0 intact for return val  */
		r9 = sub(r6, r7)  /* bytes until double alignment  */
		if p0 jumpr r31   /* count == 0, so return  */
	}
	{
		r3 = #0
		r7 = #0
		p0 = tstbit(r9, #0)
		if p1 jump 2f /* skip byte loop */
	}

/* less than 8 bytes to set, so just set a byte at a time and return  */

		loop0(1f, r2) /* byte loop */
	.falign
1: /* byte loop */
	{
		memb(r8++#1) = r4
	}:endloop0
		jumpr r31
	.falign
2: /* skip byte loop */
	{
		r6 = #1
		p0 = tstbit(r9, #1)
		p1 = cmp.eq(r2, #1)
		if !p0 jump 3f /* skip initial byte store */
	}
	{
		memb(r8++#1) = r4
		r3:2 = sub(r3:2, r7:6)
		if p1 jumpr r31
	}
	.falign
3: /* skip initial byte store */
	{
		r6 = #2
		p0 = tstbit(r9, #2)
		p1 = cmp.eq(r2, #2)
		if !p0 jump 4f /* skip initial half store */
	}
	{
		memh(r8++#2) = r4
		r3:2 = sub(r3:2, r7:6)
		if p1 jumpr r31
	}
	.falign

Annotation

Implementation Notes