1#if defined(__x86_64__)
2.text
3
4.globl	_OPENSSL_ia32_cpuid
5.private_extern _OPENSSL_ia32_cpuid
6
7.p2align	4
8_OPENSSL_ia32_cpuid:
9
10
11	movq	%rdi,%rdi
12	movq	%rbx,%r8
13
14	xorl	%eax,%eax
15	movl	%eax,8(%rdi)
16	cpuid
17	movl	%eax,%r11d
18
19	xorl	%eax,%eax
20	cmpl	$1970169159,%ebx
21	setne	%al
22	movl	%eax,%r9d
23	cmpl	$1231384169,%edx
24	setne	%al
25	orl	%eax,%r9d
26	cmpl	$1818588270,%ecx
27	setne	%al
28	orl	%eax,%r9d
29	jz	L$intel
30
31	cmpl	$1752462657,%ebx
32	setne	%al
33	movl	%eax,%r10d
34	cmpl	$1769238117,%edx
35	setne	%al
36	orl	%eax,%r10d
37	cmpl	$1145913699,%ecx
38	setne	%al
39	orl	%eax,%r10d
40	jnz	L$intel
41
42
43
44
45	movl	$2147483648,%eax
46	cpuid
47
48
49	cmpl	$2147483649,%eax
50	jb	L$intel
51	movl	%eax,%r10d
52	movl	$2147483649,%eax
53	cpuid
54
55
56	orl	%ecx,%r9d
57	andl	$2049,%r9d
58
59	cmpl	$2147483656,%r10d
60	jb	L$intel
61
62	movl	$2147483656,%eax
63	cpuid
64
65	movzbq	%cl,%r10
66	incq	%r10
67
68	movl	$1,%eax
69	cpuid
70
71	btl	$28,%edx
72	jnc	L$generic
73	shrl	$16,%ebx
74	cmpb	%r10b,%bl
75	ja	L$generic
76	andl	$4026531839,%edx
77	jmp	L$generic
78
79L$intel:
80	cmpl	$4,%r11d
81	movl	$-1,%r10d
82	jb	L$nocacheinfo
83
84	movl	$4,%eax
85	movl	$0,%ecx
86	cpuid
87	movl	%eax,%r10d
88	shrl	$14,%r10d
89	andl	$4095,%r10d
90
91	cmpl	$7,%r11d
92	jb	L$nocacheinfo
93
94	movl	$7,%eax
95	xorl	%ecx,%ecx
96	cpuid
97	movl	%ebx,8(%rdi)
98
99L$nocacheinfo:
100	movl	$1,%eax
101	cpuid
102
103	andl	$3220176895,%edx
104	cmpl	$0,%r9d
105	jne	L$notintel
106	orl	$1073741824,%edx
107L$notintel:
108	btl	$28,%edx
109	jnc	L$generic
110	andl	$4026531839,%edx
111	cmpl	$0,%r10d
112	je	L$generic
113
114	orl	$268435456,%edx
115	shrl	$16,%ebx
116	cmpb	$1,%bl
117	ja	L$generic
118	andl	$4026531839,%edx
119L$generic:
120	andl	$2048,%r9d
121	andl	$4294965247,%ecx
122	orl	%ecx,%r9d
123
124	movl	%edx,%r10d
125	btl	$27,%r9d
126	jnc	L$clear_avx
127	xorl	%ecx,%ecx
128.byte	0x0f,0x01,0xd0
129	andl	$6,%eax
130	cmpl	$6,%eax
131	je	L$done
132L$clear_avx:
133	movl	$4026525695,%eax
134	andl	%eax,%r9d
135	andl	$4294967263,8(%rdi)
136L$done:
137	movl	%r9d,4(%rdi)
138	movl	%r10d,0(%rdi)
139	movq	%r8,%rbx
140	.byte	0xf3,0xc3
141
142
143#endif
144