xref: /freebsd/sys/crypto/openssl/aarch64/arm64cpuid.S (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1/* Do not modify. This file is auto-generated from arm64cpuid.pl. */
2#include "arm_arch.h"
3
4.text
5.arch	armv8-a+crypto
6
7.align	5
8.globl	_armv7_neon_probe
9.type	_armv7_neon_probe,%function
10_armv7_neon_probe:
11	AARCH64_VALID_CALL_TARGET
12	orr	v15.16b, v15.16b, v15.16b
13	ret
14.size	_armv7_neon_probe,.-_armv7_neon_probe
15
16.globl	_armv7_tick
17.type	_armv7_tick,%function
18_armv7_tick:
19	AARCH64_VALID_CALL_TARGET
20#ifdef	__APPLE__
21	mrs	x0, CNTPCT_EL0
22#else
23	mrs	x0, CNTVCT_EL0
24#endif
25	ret
26.size	_armv7_tick,.-_armv7_tick
27
28.globl	_armv8_aes_probe
29.type	_armv8_aes_probe,%function
30_armv8_aes_probe:
31	AARCH64_VALID_CALL_TARGET
32	aese	v0.16b, v0.16b
33	ret
34.size	_armv8_aes_probe,.-_armv8_aes_probe
35
36.globl	_armv8_sha1_probe
37.type	_armv8_sha1_probe,%function
38_armv8_sha1_probe:
39	AARCH64_VALID_CALL_TARGET
40	sha1h	s0, s0
41	ret
42.size	_armv8_sha1_probe,.-_armv8_sha1_probe
43
44.globl	_armv8_sha256_probe
45.type	_armv8_sha256_probe,%function
46_armv8_sha256_probe:
47	AARCH64_VALID_CALL_TARGET
48	sha256su0	v0.4s, v0.4s
49	ret
50.size	_armv8_sha256_probe,.-_armv8_sha256_probe
51
52.globl	_armv8_pmull_probe
53.type	_armv8_pmull_probe,%function
54_armv8_pmull_probe:
55	AARCH64_VALID_CALL_TARGET
56	pmull	v0.1q, v0.1d, v0.1d
57	ret
58.size	_armv8_pmull_probe,.-_armv8_pmull_probe
59
60.globl	_armv8_sha512_probe
61.type	_armv8_sha512_probe,%function
62_armv8_sha512_probe:
63	AARCH64_VALID_CALL_TARGET
64.long	0xcec08000	// sha512su0	v0.2d,v0.2d
65	ret
66.size	_armv8_sha512_probe,.-_armv8_sha512_probe
67
68.globl	_armv8_cpuid_probe
69.type	_armv8_cpuid_probe,%function
70_armv8_cpuid_probe:
71	AARCH64_VALID_CALL_TARGET
72	mrs	x0, midr_el1
73	ret
74.size	_armv8_cpuid_probe,.-_armv8_cpuid_probe
75
76.globl	OPENSSL_cleanse
77.type	OPENSSL_cleanse,%function
78.align	5
79OPENSSL_cleanse:
80	AARCH64_VALID_CALL_TARGET
81	cbz	x1,.Lret	// len==0?
82	cmp	x1,#15
83	b.hi	.Lot		// len>15
84	nop
85.Little:
86	strb	wzr,[x0],#1	// store byte-by-byte
87	subs	x1,x1,#1
88	b.ne	.Little
89.Lret:	ret
90
91.align	4
92.Lot:	tst	x0,#7
93	b.eq	.Laligned	// inp is aligned
94	strb	wzr,[x0],#1	// store byte-by-byte
95	sub	x1,x1,#1
96	b	.Lot
97
98.align	4
99.Laligned:
100	str	xzr,[x0],#8	// store word-by-word
101	sub	x1,x1,#8
102	tst	x1,#-8
103	b.ne	.Laligned	// len>=8
104	cbnz	x1,.Little	// len!=0?
105	ret
106.size	OPENSSL_cleanse,.-OPENSSL_cleanse
107
108.globl	CRYPTO_memcmp
109.type	CRYPTO_memcmp,%function
110.align	4
111CRYPTO_memcmp:
112	AARCH64_VALID_CALL_TARGET
113	eor	w3,w3,w3
114	cbz	x2,.Lno_data	// len==0?
115	cmp	x2,#16
116	b.ne	.Loop_cmp
117	ldp	x8,x9,[x0]
118	ldp	x10,x11,[x1]
119	eor	x8,x8,x10
120	eor	x9,x9,x11
121	orr	x8,x8,x9
122	mov	x0,#1
123	cmp	x8,#0
124	csel	x0,xzr,x0,eq
125	ret
126
127.align	4
128.Loop_cmp:
129	ldrb	w4,[x0],#1
130	ldrb	w5,[x1],#1
131	eor	w4,w4,w5
132	orr	w3,w3,w4
133	subs	x2,x2,#1
134	b.ne	.Loop_cmp
135
136.Lno_data:
137	neg	w0,w3
138	lsr	w0,w0,#31
139	ret
140.size	CRYPTO_memcmp,.-CRYPTO_memcmp
141