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