1/*
2Copyright (c) 1990 The Regents of the University of California.
3All rights reserved.
4
5Redistribution and use in source and binary forms are permitted
6provided that the above copyright notice and this paragraph are
7duplicated in all such forms and that any documentation,
8and/or other materials related to such
9distribution and use acknowledge that the software was developed
10by the University of California, Berkeley.  The name of the
11University may not be used to endorse or promote products derived
12from this software without specific prior written permission.
13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17#include <picolibc.h>
18
19	.file "memchr.S"
20
21	.section .text
22	.global _memchr
23	.type	 _memchr,@function
24_memchr:
25	movm [d2,d3,a2,a3],(sp)
26.Lend_of_prologue:
27	mov d0,a0
28	mov d1,d2
29	mov (28,sp),a1
30#ifndef __OPTIMIZE_SIZE__
31	cmp 3,a1
32	bls .L44
33	mov a0,d3
34	btst 3,d3
35	bne .L44
36	mov a0,a2
37	mov 0,a3
38	clr d1
39	setlb
40	mov a3,d0
41	asl 8,d0
42	mov d2,a3
43	add d0,a3
44	inc d1
45	cmp 3,d1
46	lls
47	cmp 3,a1
48	bls .L48
49.L33:
50	mov (a2),d0
51	mov a3,d3
52	xor d3,d0
53	mov d0,d1
54	not d1
55	add -16843009,d0
56	and d1,d0
57	btst -2139062144,d0
58	beq .L34
59	mov a2,a0
60	clr d1
61	setlb
62	movbu (a0),d0
63	cmp d2,d0
64	beq .Lepilogue
65	inc a0
66	inc d1
67	cmp 3,d1
68	lls
69.L34:
70	add -4,a1
71	inc4 a2
72	cmp 3,a1
73	bhi .L33
74.L48:
75	mov a2,a0
76.L44:
77#endif
78	cmp 0,a1
79	beq .L50
80	setlb
81	movbu (a0),d0
82	cmp d2,d0
83	beq .Lepilogue
84	inc a0
85	sub 1,a1
86	lne
87.L50:
88	mov 0,a0
89.Lepilogue:
90	ret [d2,d3,a2,a3],16
91.Lend_of_memchr:
92	.size	 _memchr, .Lend_of_memchr - _memchr
93
94	.section	.debug_frame,"",@progbits
95.Lstart_of_debug_frame:
96	# Common Information Entry (CIE)
97	.4byte	.Lend_of_CIE - .Lstart_of_CIE	# CIE Length
98.Lstart_of_CIE:
99	.4byte	 0xffffffff			# CIE Identifier Tag
100	.byte	 0x1				# CIE Version
101	.ascii   "\0"				# CIE Augmentation
102	.uleb128 0x1				# CIE Code Alignment Factor
103	.sleb128 -4				# CIE Data Alignment Factor
104	.byte	 0x32				# CIE RA Column
105	.byte	 0xc				# DW_CFA_def_cfa
106	.uleb128 0x9
107	.uleb128 0x0
108	.byte	 0xb2				# DW_CFA_offset, column 0x32
109	.uleb128 0x0
110	.align   2
111.Lend_of_CIE:
112
113	# Frame Description Entry (FDE)
114	.4byte	.Lend_of_FDE - .Lstart_of_FDE	# FDE Length
115.Lstart_of_FDE:
116	.4byte	 .Lstart_of_debug_frame		# FDE CIE offset
117	.4byte	 _memchr			# FDE initial location
118	.4byte	 .Lend_of_memchr - _memchr	# FDE address range
119	.byte	 0x4				# DW_CFA_advance_loc4
120	.4byte	 .Lend_of_prologue - _memchr
121	.byte	 0xe				# DW_CFA_def_cfa_offset
122	.uleb128 0x4
123	.byte	 0x87				# DW_CFA_offset, column 0x7
124	.uleb128 0x1
125	.align 2
126.Lend_of_FDE:
127