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 "strchr.S"
20
21	.section .text
22	.global _strchr
23	.type	 _strchr,@function
24_strchr:
25	movm [d2,d3,a2,a3],(sp)
26	add -12,sp
27.Lend_of_prologue:
28	mov d0,a1
29	movbu d1,(7,sp)
30#ifndef __OPTIMIZE_SIZE__
31	btst 3,d0
32	bne .L20
33	clr d0
34	setlb
35	mov sp,a2
36	mov d0,d3
37	add d3,a2
38	mov a2,a0
39	add 12,a0
40	movbu (7,sp),d3
41	movbu d3,(-4,a0)
42	inc d0
43	cmp 3,d0
44	lls
45	mov a1,a0
46	mov -16843009,a1
47	mov (a0),d2
48	mov a1,d1
49	add d2,d1
50	mov d2,d0
51	not d0
52	and d0,d1
53	mov -2139062144,d3
54	mov d3,(0,sp)
55	btst -2139062144,d1
56	bne .L27
57	jmp .L38
58.L28:
59	inc4 a0
60	mov (a0),d2
61	mov a1,d1
62	add d2,d1
63	mov d2,d0
64	not d0
65	and d0,d1
66	mov (0,sp),d3
67	and d3,d1
68	bne .L27
69.L38:
70	mov (8,sp),d0
71	xor d2,d0
72	mov a1,d1
73	add d0,d1
74	not d0
75	and d0,d1
76	and d3,d1
77	beq .L28
78.L27:
79	mov a0,a1
80.L20:
81#endif
82	movbu (a1),d0
83	cmp 0,d0
84	beq .L32
85	movbu (7,sp),d1
86	setlb
87	cmp d1,d0
88	beq .L36
89	inc a1
90	movbu (a1),d0
91	cmp 0,d0
92	lne
93.L32:
94	movbu (7,sp),d0
95	movbu (a1),d3
96	cmp d0,d3
97	beq .L36
98	mov 0,a0
99	jmp .Lepilogue
100.L36:
101	mov a1,a0
102.Lepilogue:
103	ret [d2,d3,a2,a3],28
104.Lend_of_strchr:
105	.size	 _strchr, .Lend_of_strchr - _strchr
106
107	.section	.debug_frame,"",@progbits
108.Lstart_of_debug_frame:
109	# Common Information Entry (CIE)
110	.4byte	.Lend_of_CIE - .Lstart_of_CIE	# CIE Length
111.Lstart_of_CIE:
112	.4byte	 0xffffffff			# CIE Identifier Tag
113	.byte	 0x1				# CIE Version
114	.ascii   "\0"				# CIE Augmentation
115	.uleb128 0x1				# CIE Code Alignment Factor
116	.sleb128 -4				# CIE Data Alignment Factor
117	.byte	 0x32				# CIE RA Column
118	.byte	 0xc				# DW_CFA_def_cfa
119	.uleb128 0x9
120	.uleb128 0x0
121	.byte	 0xb2				# DW_CFA_offset, column 0x32
122	.uleb128 0x0
123	.align   2
124.Lend_of_CIE:
125
126	# Frame Description Entry (FDE)
127	.4byte	.Lend_of_FDE - .Lstart_of_FDE	# FDE Length
128.Lstart_of_FDE:
129	.4byte	 .Lstart_of_debug_frame		# FDE CIE offset
130	.4byte	 _strchr			# FDE initial location
131	.4byte	 .Lend_of_strchr - _strchr	# FDE address range
132	.byte	 0x4				# DW_CFA_advance_loc4
133	.4byte	 .Lend_of_prologue - _strchr
134	.byte	 0xe				# DW_CFA_def_cfa_offset
135	.uleb128 0x4
136	.byte	 0x87				# DW_CFA_offset, column 0x7
137	.uleb128 0x1
138	.align 2
139.Lend_of_FDE:
140