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