Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f3f552e authored by LuK1337's avatar LuK1337 Committed by MajorP93
Browse files

erofs: lz4armv8: Make it compile with IAS

`LOCAL` is not supported by llvm-as.

Change-Id: Id2b4541ecad77fd3287a7c115982f41f0b32a9f3
parent 9edd7c0a
Loading
Loading
Loading
Loading
+31 −38
Original line number Diff line number Diff line
@@ -67,13 +67,6 @@

.altmacro
.macro lz4_decompress_asm_generic	doprfm=1
LOCAL Lz4_decompress_begin, Decode_token, Get_literal_length
LOCAL Copy_long_literal_hs_15, Copy_long_literal_loop
LOCAL Copy_literal_lt_15, Decode_offset_matchlength
LOCAL Get_long_matchlength, Copy_match_begin
LOCAL Cond_offset_lt_matchlength, Copy_offset_lt_32
LOCAL Copy_match_perm, Copy_offset_lt_32_loop
LOCAL Cond_offset_ge_matchlength, Copy_offset_ge_match_loop
	stp     x29, x30, [sp, #-16]!
	mov     x29, sp
	stp	x3, x0, [sp, #-16]!		/* push src and dst in stack */
@@ -82,7 +75,7 @@ LOCAL Cond_offset_ge_matchlength, Copy_offset_ge_match_loop
	adr	permtable_addr, Permtable
	adr	cplen_table_addr, Copylength_table

Lz4_decompress_begin:
Lz4_decompress_begin\@:
	/*
	 * save current dst and src ,ensure when return from asm routine
	 * current both of "dst" and "src" save good position.
@@ -96,12 +89,12 @@ Lz4_decompress_begin:
.if \doprfm
	add tmp, x0, #512
	cmp x2, tmp
	b.ls Decode_token
	b.ls Decode_token\@
	prfm pstl2strm,[x0,#512]
.endif

	/* Decode Token Byte: */
Decode_token:
Decode_token\@:
	ldrb	w_tmp, [x3], #1		/* read Token Byte */
	lsr	literal_length, tmp, #4	/* get literal_length */
	and	tmp_match_length, tmp, #0xf	/* get match_length */
@@ -112,21 +105,21 @@ Decode_token:
	 * or more bytes are liteal bytes.
	 */
	cmp	literal_length, #14
	b.ls	Copy_literal_lt_15
	b.ls	Copy_literal_lt_15\@

	/*
	 * literal_length == 15 : more literal length bytes after TokenByte.
	 * continue decoding more literal length bytes.
	 */
Get_literal_length:
Get_literal_length\@:
	check_src_overflow
	ldrb	w_tmp, [x3], #1
	add	literal_length, literal_length, tmp
	cmp	tmp, #255
	b.eq	Get_literal_length
	b.eq	Get_literal_length\@

/* literal copy */
Copy_long_literal_hs_15:
Copy_long_literal_hs_15\@:
	mov	copy_from_ptr, x3
	mov	copy_to_ptr, x0
	add	x3, x3, literal_length
@@ -134,22 +127,22 @@ Copy_long_literal_hs_15:
	check_dst_overflow
	check_src_overflow

Copy_long_literal_loop:
Copy_long_literal_loop\@:
	ldr	q0, [copy_from_ptr], #16
	str	q0, [copy_to_ptr], #16

	cmp	x0, copy_to_ptr
	b.ls	Decode_offset_matchlength
	b	Copy_long_literal_loop
	b.ls	Decode_offset_matchlength\@
	b	Copy_long_literal_loop\@

Copy_literal_lt_15:
Copy_literal_lt_15\@:
	ldr q0, [x3]
	str q0, [x0]
	add	x3, x3, literal_length
	add	x0, x0, literal_length

	/* Decode offset and match_length */
Decode_offset_matchlength:
Decode_offset_matchlength\@:
	mov	offset_src_ptr, x3
	ldrh	w_offset, [x3], #2	/* 2Byte:offset bytes */
	cbz	offset, Failed			/* match_length == 0 is invalid */
@@ -162,68 +155,68 @@ Decode_offset_matchlength:
	 */
	add	x0, x0, match_length
	cmp	match_length, #19
	b.lo	Copy_match_begin
	b.lo	Copy_match_begin\@
	/*
	 * continue decoding more match length bytes.
	 */
Get_long_matchlength:
Get_long_matchlength\@:
	check_src_overflow1
	ldrb	w_tmp, [x3], #1
	add	x0, x0, tmp
	add	match_length, match_length, tmp
	cmp	tmp, #255
	b.eq	Get_long_matchlength
	b.eq	Get_long_matchlength\@

	/*
	 * here got the matchlength,start "match copy".
	 */
Copy_match_begin:
Copy_match_begin\@:
	check_dst_overflow1
	cmp	offset , match_length
	b.hs	Cond_offset_ge_matchlength
	b.hs	Cond_offset_ge_matchlength\@

Cond_offset_lt_matchlength:
Cond_offset_lt_matchlength\@:
	cmp	offset , #32
	b.hs	Cond_offset_ge_matchlength
	b.hs	Cond_offset_ge_matchlength\@

Copy_offset_lt_32:
Copy_offset_lt_32\@:
	ldr	q1, [copy_from_ptr]
	add	tmp, permtable_addr, offset, lsl #5
	ldp	q2, q3, [tmp]
	tbl	v0.16b, {v1.16b}, v2.16b
	tbl	v1.16b, {v1.16b}, v3.16b
	cmp     offset , #16
	b.lo    Copy_match_perm
	b.lo    Copy_match_perm\@
	ldp     q0, q1, [copy_from_ptr]
Copy_match_perm:
Copy_match_perm\@:
	ldrb	w_tmp, [cplen_table_addr, offset]
	stp	q0, q1, [copy_to_ptr]
	add	copy_to_ptr, copy_to_ptr, tmp
	cmp	x0, copy_to_ptr
	b.ls	Lz4_decompress_begin
Copy_offset_lt_32_loop:
	b.ls	Lz4_decompress_begin\@
Copy_offset_lt_32_loop\@:
	stp	q0, q1, [copy_to_ptr]
	add	copy_to_ptr, copy_to_ptr, tmp
	stp	q0, q1, [copy_to_ptr]
	add	copy_to_ptr, copy_to_ptr, tmp
	cmp	x0, copy_to_ptr
	b.hi	Copy_offset_lt_32_loop
	b	Lz4_decompress_begin
	b.hi	Copy_offset_lt_32_loop\@
	b	Lz4_decompress_begin\@

/* offset >= match */
Cond_offset_ge_matchlength:
Cond_offset_ge_matchlength\@:
	ldr	q0, [copy_from_ptr], #16
	str	q0, [copy_to_ptr], #16

	cmp	x0, copy_to_ptr
	b.ls	Lz4_decompress_begin
Copy_offset_ge_match_loop:
	b.ls	Lz4_decompress_begin\@
Copy_offset_ge_match_loop\@:
	ldp	q0, q1, [copy_from_ptr], #32
	stp	q0, q1, [copy_to_ptr], #32

	cmp	x0, copy_to_ptr
	b.hi	Copy_offset_ge_match_loop
	b	Lz4_decompress_begin
	b.hi	Copy_offset_ge_match_loop\@
	b	Lz4_decompress_begin\@
.endm

.text