1 /// -*- mode: asm; asm-comment-char: ?/ -*-
3 /// Fancy SIMD implementation of Salsa20
5 /// (c) 2015 Straylight/Edgeware
8 ///----- Licensing notice ---------------------------------------------------
10 /// This file is part of Catacomb.
12 /// Catacomb is free software; you can redistribute it and/or modify
13 /// it under the terms of the GNU Library General Public License as
14 /// published by the Free Software Foundation; either version 2 of the
15 /// License, or (at your option) any later version.
17 /// Catacomb is distributed in the hope that it will be useful,
18 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 /// GNU Library General Public License for more details.
22 /// You should have received a copy of the GNU Library General Public
23 /// License along with Catacomb; if not, write to the Free
24 /// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 /// MA 02111-1307, USA.
27 ///--------------------------------------------------------------------------
28 /// General definitions.
30 // Preprocessor hacks.
31 #define STRINGY(x) _STRINGY(x, y)
32 #define _STRINGY(x) #x
33 #define GLUE(x, y) _GLUE(x, y)
34 #define _GLUE(x, y) x##y
37 // Some useful variables.
40 // Literal pools done the hard way.
41 #define _LIT .text .L$_subsec + 1
42 #define _ENDLIT .text .L$_subsec
43 #define _LTORG .L$_subsec = .L$_subsec + 2; .text .L$_subsec
48 # define _SECTTY(ty) %ty
50 # define _SECTTY(ty) @ty
55 #define TEXT .text .L$_subsec
57 # define RODATA .section .rdata, "dr"
59 # define RODATA .section .rodata, "a", _SECTTY(progbits)
65 // Announcing an external function.
69 .macro ENDFUNC; _ENDFUNC(name); .endm; \
74 // Marking the end of a function.
75 #define _ENDFUNC(name) \
81 // Make a helper function, if necessary.
83 .ifndef .L$_auxfn_def.name; \
85 .macro _ENDAUXFN; _ENDAUXFN_TAIL(name); .endm; \
88 #define _ENDAUXFN_TAIL(name) \
91 .L$_auxfn_def.name = 1
92 #define ENDAUXFN _ENDAUXFN; .endif
94 ///--------------------------------------------------------------------------
95 /// ELF-specific hacking.
99 #if __PIC__ || __PIE__
103 #define TYPE_FUNC(name) .type name, STT_FUNC
105 #define SIZE_OBJ(name) .size name, . - name
109 ///--------------------------------------------------------------------------
110 /// Windows-specific hacking.
115 # define F(name) _##name
120 ///--------------------------------------------------------------------------
121 /// x86- and amd64-specific hacking.
123 /// It's (slightly) easier to deal with both of these in one go.
125 #if CPUFAM_X86 || CPUFAM_AMD64
135 // Set the function hooks.
136 #define FUNC_PREHOOK(_) .balign 16
138 // On Windows, arrange to install stack-unwinding data.
139 #if CPUFAM_AMD64 && ABI_WIN
140 # define FUNC_POSTHOOK(name) .seh_proc name
141 # define ENDFUNC_HOOK(_) .seh_endproc
142 // Procedures are expected to invoke `.seh_setframe' if necessary, and
143 // `.seh_pushreg' and friends, and `.seh_endprologue'.
146 // Don't use the wretched AT&T syntax. It's festooned with pointless
147 // punctuation, and all of the data movement is backwards. Ugh!
148 .intel_syntax noprefix
150 // Call external subroutine at ADDR, possibly via PLT.
159 // Do I need to arrange a spare GOT register?
160 #if WANT_PIC && CPUFAM_X86
163 #define GOTREG ebx // Not needed in AMD64 so don't care.
165 // Maybe load GOT address into GOT.
166 .macro ldgot got
=GOTREG
167 #if WANT_PIC && CPUFAM_X86
173 add \got
, offset _GLOBAL_OFFSET_TABLE_
177 // Load address of external symbol ADDR into REG, maybe using GOT.
178 .macro leaext reg
, addr
, got
=GOTREG
181 mov
\reg
, [\got
+ \addr@GOT
]
184 mov
\reg
, \addr@GOTPCREL
[rip
]
188 mov
\reg
, offset
\addr
196 // Address expression (possibly using a base register, and a displacement)
197 // referring to ADDR, which is within our module, maybe using GOT.
198 #define INTADDR(...) INTADDR__0(__VA_ARGS__, GOTREG, dummy)
199 #define INTADDR__0(addr, got, ...) INTADDR__1(addr, got)
201 # define INTADDR__1(addr, got) addr + rip
203 # define INTADDR__1(addr, got) got + addr@GOTOFF
205 # define INTADDR__1(addr, got) addr
208 // Permutations for SIMD instructions. SHUF(D, C, B, A) is an immediate,
209 // suitable for use in `pshufd' or `shufpd', which copies element D
210 // (0 <= D < 4) of the source to element 3 of the destination, element C to
211 // element 2, element B to element 1, and element A to element 0.
212 #define SHUF(d, c, b, a) (64*(d) + 16*(c) + 4*(b) + (a))
214 // Map register names to their individual pieces.
216 // Apply decoration decor to (internal) register name reg of type ty.
218 // See `R_...' for internal register names. Decorations are as follows.
220 // b low byte (e.g., `al', `r8b')
221 // h high byte (e.g., `ah')
222 // w word (e.g., `ax', `r8w')
223 // d doubleword (e.g., `eax', `r8d')
224 // q quadword (e.g., `rax', `r8')
225 // r whole register (doubleword on x86, quadword on amd64)
227 // And types are as follows.
229 // abcd the four traditional registers `a', `b', `c', `d'
230 // xp the four pointer registers `si', `di', `bp', `sp'
231 // ip the instruction pointer `ip'
232 // rn the AMD64 numbered registers `r8'--`r15'
233 #define _DECOR(ty, decor, reg) _DECOR_##ty##_##decor(reg)
235 // Internal macros: _DECOR_ty_decor(reg) applies decoration decor to
236 // (internal) register name reg of type ty.
238 #define _DECOR_abcd_b(reg) reg##l
239 #define _DECOR_abcd_h(reg) reg##h
240 #define _DECOR_abcd_w(reg) reg##x
241 #define _DECOR_abcd_d(reg) e##reg##x
243 # define _DECOR_abcd_q(reg) r##reg##x
246 #define _DECOR_xp_b(reg) reg##l
247 #define _DECOR_xp_w(reg) reg
248 #define _DECOR_xp_d(reg) e##reg
250 # define _DECOR_xp_q(reg) r##reg
253 #define _DECOR_ip_w(reg) reg
254 #define _DECOR_ip_d(reg) e##reg
256 # define _DECOR_ip_q(reg) r##reg
260 # define _DECOR_rn_b(reg) reg##b
261 # define _DECOR_rn_w(reg) reg##w
262 # define _DECOR_rn_d(reg) reg##d
263 # define _DECOR_rn_q(reg) reg
264 # define _DECOR_rn_r(reg) reg
268 # define _DECOR_abcd_r(reg) e##reg##x
269 # define _DECOR_xp_r(reg) e##reg
270 # define _DECOR_ip_r(reg) e##reg
273 # define _DECOR_abcd_r(reg) r##reg##x
274 # define _DECOR_xp_r(reg) r##reg
275 # define _DECOR_ip_r(reg) r##reg
278 #define _DECOR_mem_b(addr) byte ptr addr
279 #define _DECOR_mem_w(addr) word ptr addr
280 #define _DECOR_mem_d(addr) dword ptr addr
282 # define _DECOR_mem_q(addr) qword ptr addr
285 // R_r(decor) applies decoration decor to register r, which is an internal
286 // register name. The internal register names are: `ip', `a', `b', `c', `d',
287 // `si', `di', `bp', `sp', `r8'--`r15'.
288 #define R_ip(decor) _DECOR(ip, decor, ip)
289 #define R_a(decor) _DECOR(abcd, decor, a)
290 #define R_b(decor) _DECOR(abcd, decor, b)
291 #define R_c(decor) _DECOR(abcd, decor, c)
292 #define R_d(decor) _DECOR(abcd, decor, d)
293 #define R_si(decor) _DECOR(xp, decor, si)
294 #define R_di(decor) _DECOR(xp, decor, di)
295 #define R_bp(decor) _DECOR(xp, decor, bp)
296 #define R_sp(decor) _DECOR(xp, decor, sp)
298 # define R_r8(decor) _DECOR(rn, decor, r8)
299 # define R_r9(decor) _DECOR(rn, decor, r9)
300 # define R_r10(decor) _DECOR(rn, decor, r10)
301 # define R_r11(decor) _DECOR(rn, decor, r11)
302 # define R_r12(decor) _DECOR(rn, decor, r12)
303 # define R_r13(decor) _DECOR(rn, decor, r13)
304 # define R_r14(decor) _DECOR(rn, decor, r14)
305 # define R_r15(decor) _DECOR(rn, decor, r15)
308 // Refer to an in-memory datum of the type implied by decor residing at
309 // address addr (which should supply its own square-brackets).
310 #define MEM(decor, addr) _DECOR(mem, decor, addr)
312 // Applies decoration decor to assembler-level register name reg.
313 #define _REGFORM(reg, decor) _GLUE(_REGFORM_, reg)(decor)
315 // Internal macros: _REGFORM_r(decor) applies decoration decor to an
316 // assembler-level register name, in place of any decoration that register
319 #define _REGFORM_ip(decor) R_ip(decor)
320 #define _REGFORM_eip(decor) R_ip(decor)
322 #define _REGFORM_a(decor) R_a(decor)
323 #define _REGFORM_al(decor) R_a(decor)
324 #define _REGFORM_ah(decor) R_a(decor)
325 #define _REGFORM_ax(decor) R_a(decor)
326 #define _REGFORM_eax(decor) R_a(decor)
328 #define _REGFORM_b(decor) R_b(decor)
329 #define _REGFORM_bl(decor) R_b(decor)
330 #define _REGFORM_bh(decor) R_b(decor)
331 #define _REGFORM_bx(decor) R_b(decor)
332 #define _REGFORM_ebx(decor) R_b(decor)
334 #define _REGFORM_c(decor) R_c(decor)
335 #define _REGFORM_cl(decor) R_c(decor)
336 #define _REGFORM_ch(decor) R_c(decor)
337 #define _REGFORM_cx(decor) R_c(decor)
338 #define _REGFORM_ecx(decor) R_c(decor)
340 #define _REGFORM_d(decor) R_d(decor)
341 #define _REGFORM_dl(decor) R_d(decor)
342 #define _REGFORM_dh(decor) R_d(decor)
343 #define _REGFORM_dx(decor) R_d(decor)
344 #define _REGFORM_edx(decor) R_d(decor)
346 #define _REGFORM_si(decor) R_si(decor)
347 #define _REGFORM_sil(decor) R_si(decor)
348 #define _REGFORM_esi(decor) R_si(decor)
350 #define _REGFORM_di(decor) R_di(decor)
351 #define _REGFORM_dil(decor) R_di(decor)
352 #define _REGFORM_edi(decor) R_di(decor)
354 #define _REGFORM_bp(decor) R_bp(decor)
355 #define _REGFORM_bpl(decor) R_bp(decor)
356 #define _REGFORM_ebp(decor) R_bp(decor)
358 #define _REGFORM_sp(decor) R_sp(decor)
359 #define _REGFORM_spl(decor) R_sp(decor)
360 #define _REGFORM_esp(decor) R_sp(decor)
364 # define _REGFORM_rip(decor) R_ip(decor)
365 # define _REGFORM_rsp(decor) R_sp(decor)
366 # define _REGFORM_rbp(decor) R_bp(decor)
367 # define _REGFORM_rdi(decor) R_di(decor)
368 # define _REGFORM_rsi(decor) R_si(decor)
369 # define _REGFORM_rdx(decor) R_d(decor)
370 # define _REGFORM_rcx(decor) R_c(decor)
371 # define _REGFORM_rbx(decor) R_b(decor)
372 # define _REGFORM_rax(decor) R_a(decor)
374 # define _REGFORM_r8(decor) R_r8(decor)
375 # define _REGFORM_r8b(decor) R_r8(decor)
376 # define _REGFORM_r8w(decor) R_r8(decor)
377 # define _REGFORM_r8d(decor) R_r8(decor)
379 # define _REGFORM_r9(decor) R_r9(decor)
380 # define _REGFORM_r9b(decor) R_r9(decor)
381 # define _REGFORM_r9w(decor) R_r9(decor)
382 # define _REGFORM_r9d(decor) R_r9(decor)
384 # define _REGFORM_r10(decor) R_r10(decor)
385 # define _REGFORM_r10b(decor) R_r10(decor)
386 # define _REGFORM_r10w(decor) R_r10(decor)
387 # define _REGFORM_r10d(decor) R_r10(decor)
389 # define _REGFORM_r11(decor) R_r11(decor)
390 # define _REGFORM_r11b(decor) R_r11(decor)
391 # define _REGFORM_r11w(decor) R_r11(decor)
392 # define _REGFORM_r11d(decor) R_r11(decor)
394 # define _REGFORM_r12(decor) R_r12(decor)
395 # define _REGFORM_r12b(decor) R_r12(decor)
396 # define _REGFORM_r12w(decor) R_r12(decor)
397 # define _REGFORM_r12d(decor) R_r12(decor)
399 # define _REGFORM_r13(decor) R_r13(decor)
400 # define _REGFORM_r13b(decor) R_r13(decor)
401 # define _REGFORM_r13w(decor) R_r13(decor)
402 # define _REGFORM_r13d(decor) R_r13(decor)
404 # define _REGFORM_r14(decor) R_r14(decor)
405 # define _REGFORM_r14b(decor) R_r14(decor)
406 # define _REGFORM_r14w(decor) R_r14(decor)
407 # define _REGFORM_r14d(decor) R_r14(decor)
409 # define _REGFORM_r15(decor) R_r15(decor)
410 # define _REGFORM_r15b(decor) R_r15(decor)
411 # define _REGFORM_r15w(decor) R_r15(decor)
412 # define _REGFORM_r15d(decor) R_r15(decor)
416 // Macros for converting register names.
417 #define BYTE(reg) _REGFORM(reg, b)
418 #define HIBYTE(reg) _REGFORM(reg, h)
419 #define WORD(reg) _REGFORM(reg, w)
420 #define DWORD(reg) _REGFORM(reg, d)
422 # define QWORD(reg) _REGFORM(reg, q)
424 #define WHOLE(reg) _REGFORM(reg, r)
431 // Stash GP registers and establish temporary stack frame.
450 // Print FMT and the other established arguments.
451 lea eax
, .L$_reg$msg
.\@
491 _reg
.3 "\msg: \r = %08x"
499 pshufd xmm0
, xmm0
, 0x1b
502 _reg
.3 "\msg: \r = %08x %08x %08x %08x"
512 _reg
.3 "\msg: \r = %08x %08x"
520 fldt
[esp
+ 32 + 16*\i
]
523 _reg
.3 "\msg: st(\i) = %.20Lg"
531 fldt
[esp
+ 32 + 16*\i
]
534 _reg
.3 "\msg: st(\i) = %La"
539 ///--------------------------------------------------------------------------
540 /// ARM-specific hacking.
544 // ARM/Thumb mode things. Use ARM by default.
545 #define ARM .arm; .L$_pcoff = 8
546 #define THUMB .thumb; .L$_pcoff = 4
549 // Set the function hooks.
550 #define FUNC_PREHOOK(_) .balign 4
551 #define ENDFUNC_HOOK(name) .ltorg
553 // Call external subroutine at ADDR, possibly via PLT.
554 .macro callext addr
, cond
=
562 // Do I need to arrange a spare GOT register?
568 // Maybe load GOT address into GOT.
569 .macro ldgot cond
=, got
=GOTREG
571 ldr\cond \got
, .L$_ldgot$\@
573 add\cond \got
, pc
, \got
577 .word _GLOBAL_OFFSET_TABLE_
- .L$_ldgot_pc$\@
- .L$_pcoff
582 // Load address of external symbol ADDR into REG, maybe using GOT.
583 .macro leaext reg
, addr
, cond
=, got
=GOTREG
585 ldr\cond
\reg
, .L$_leaext$\@
586 ldr\cond
\reg
, [\got
, \reg
]
593 ldr\cond
\reg
, =\addr
597 // Load address of external symbol ADDR into REG directly.
598 .macro leaextq reg
, addr
, cond
=
600 ldr\cond
\reg
, .L$_leaextq$\@
603 ldr\cond
\reg
, [pc
, \reg
]
606 ldr\cond
\reg
, [\reg
]
611 .word
\addr
(GOT_PREL
) + (. - .L$_leaextq_pc$\@
- .L$_pcoff
)
614 ldr\cond
\reg
, =\addr
618 // Apply decoration decor to register name reg.
619 #define _REGFORM(reg, decor) _GLUE(_REGFORM_, reg)(decor)
621 // Internal macros: `_REGFORM_r(decor)' applies decoration decor to register
624 #define _REGFORM_s0(decor) _DECOR(s, decor, 0)
625 #define _REGFORM_s1(decor) _DECOR(s, decor, 1)
626 #define _REGFORM_s2(decor) _DECOR(s, decor, 2)
627 #define _REGFORM_s3(decor) _DECOR(s, decor, 3)
628 #define _REGFORM_s4(decor) _DECOR(s, decor, 4)
629 #define _REGFORM_s5(decor) _DECOR(s, decor, 5)
630 #define _REGFORM_s6(decor) _DECOR(s, decor, 6)
631 #define _REGFORM_s7(decor) _DECOR(s, decor, 7)
632 #define _REGFORM_s8(decor) _DECOR(s, decor, 8)
633 #define _REGFORM_s9(decor) _DECOR(s, decor, 9)
634 #define _REGFORM_s10(decor) _DECOR(s, decor, 10)
635 #define _REGFORM_s11(decor) _DECOR(s, decor, 11)
636 #define _REGFORM_s12(decor) _DECOR(s, decor, 12)
637 #define _REGFORM_s13(decor) _DECOR(s, decor, 13)
638 #define _REGFORM_s14(decor) _DECOR(s, decor, 14)
639 #define _REGFORM_s15(decor) _DECOR(s, decor, 15)
640 #define _REGFORM_s16(decor) _DECOR(s, decor, 16)
641 #define _REGFORM_s17(decor) _DECOR(s, decor, 17)
642 #define _REGFORM_s18(decor) _DECOR(s, decor, 18)
643 #define _REGFORM_s19(decor) _DECOR(s, decor, 19)
644 #define _REGFORM_s20(decor) _DECOR(s, decor, 20)
645 #define _REGFORM_s21(decor) _DECOR(s, decor, 21)
646 #define _REGFORM_s22(decor) _DECOR(s, decor, 22)
647 #define _REGFORM_s23(decor) _DECOR(s, decor, 23)
648 #define _REGFORM_s24(decor) _DECOR(s, decor, 24)
649 #define _REGFORM_s25(decor) _DECOR(s, decor, 25)
650 #define _REGFORM_s26(decor) _DECOR(s, decor, 26)
651 #define _REGFORM_s27(decor) _DECOR(s, decor, 27)
652 #define _REGFORM_s28(decor) _DECOR(s, decor, 28)
653 #define _REGFORM_s29(decor) _DECOR(s, decor, 29)
654 #define _REGFORM_s30(decor) _DECOR(s, decor, 30)
655 #define _REGFORM_s31(decor) _DECOR(s, decor, 31)
657 #define _REGFORM_d0(decor) _DECOR(d, decor, 0)
658 #define _REGFORM_d1(decor) _DECOR(d, decor, 1)
659 #define _REGFORM_d2(decor) _DECOR(d, decor, 2)
660 #define _REGFORM_d3(decor) _DECOR(d, decor, 3)
661 #define _REGFORM_d4(decor) _DECOR(d, decor, 4)
662 #define _REGFORM_d5(decor) _DECOR(d, decor, 5)
663 #define _REGFORM_d6(decor) _DECOR(d, decor, 6)
664 #define _REGFORM_d7(decor) _DECOR(d, decor, 7)
665 #define _REGFORM_d8(decor) _DECOR(d, decor, 8)
666 #define _REGFORM_d9(decor) _DECOR(d, decor, 9)
667 #define _REGFORM_d10(decor) _DECOR(d, decor, 10)
668 #define _REGFORM_d11(decor) _DECOR(d, decor, 11)
669 #define _REGFORM_d12(decor) _DECOR(d, decor, 12)
670 #define _REGFORM_d13(decor) _DECOR(d, decor, 13)
671 #define _REGFORM_d14(decor) _DECOR(d, decor, 14)
672 #define _REGFORM_d15(decor) _DECOR(d, decor, 15)
673 #define _REGFORM_d16(decor) _DECOR(d, decor, 16)
674 #define _REGFORM_d17(decor) _DECOR(d, decor, 17)
675 #define _REGFORM_d18(decor) _DECOR(d, decor, 18)
676 #define _REGFORM_d19(decor) _DECOR(d, decor, 19)
677 #define _REGFORM_d20(decor) _DECOR(d, decor, 20)
678 #define _REGFORM_d21(decor) _DECOR(d, decor, 21)
679 #define _REGFORM_d22(decor) _DECOR(d, decor, 22)
680 #define _REGFORM_d23(decor) _DECOR(d, decor, 23)
681 #define _REGFORM_d24(decor) _DECOR(d, decor, 24)
682 #define _REGFORM_d25(decor) _DECOR(d, decor, 25)
683 #define _REGFORM_d26(decor) _DECOR(d, decor, 26)
684 #define _REGFORM_d27(decor) _DECOR(d, decor, 27)
685 #define _REGFORM_d28(decor) _DECOR(d, decor, 28)
686 #define _REGFORM_d29(decor) _DECOR(d, decor, 29)
687 #define _REGFORM_d30(decor) _DECOR(d, decor, 30)
688 #define _REGFORM_d31(decor) _DECOR(d, decor, 31)
690 #define _REGFORM_q0(decor) _DECOR(q, decor, 0)
691 #define _REGFORM_q1(decor) _DECOR(q, decor, 1)
692 #define _REGFORM_q2(decor) _DECOR(q, decor, 2)
693 #define _REGFORM_q3(decor) _DECOR(q, decor, 3)
694 #define _REGFORM_q4(decor) _DECOR(q, decor, 4)
695 #define _REGFORM_q5(decor) _DECOR(q, decor, 5)
696 #define _REGFORM_q6(decor) _DECOR(q, decor, 6)
697 #define _REGFORM_q7(decor) _DECOR(q, decor, 7)
698 #define _REGFORM_q8(decor) _DECOR(q, decor, 8)
699 #define _REGFORM_q9(decor) _DECOR(q, decor, 9)
700 #define _REGFORM_q10(decor) _DECOR(q, decor, 10)
701 #define _REGFORM_q11(decor) _DECOR(q, decor, 11)
702 #define _REGFORM_q12(decor) _DECOR(q, decor, 12)
703 #define _REGFORM_q13(decor) _DECOR(q, decor, 13)
704 #define _REGFORM_q14(decor) _DECOR(q, decor, 14)
705 #define _REGFORM_q15(decor) _DECOR(q, decor, 15)
707 // `_LOPART(n)' and `_HIPART(n)' return the numbers of the register halves of
708 // register n, i.e., 2*n and 2*n + 1 respectively.
709 #define _LOPART(n) _GLUE(_LOPART_, n)
710 #define _HIPART(n) _GLUE(_HIPART_, n)
712 // Internal macros: `_LOPART_n' and `_HIPART_n' return the numbers of the
713 // register halves of register n, i.e., 2*n and 2*n + 1 respectively.
735 #define _LOPART_10 20
736 #define _HIPART_10 21
737 #define _LOPART_11 22
738 #define _HIPART_11 23
739 #define _LOPART_12 24
740 #define _HIPART_12 25
741 #define _LOPART_13 26
742 #define _HIPART_13 27
743 #define _LOPART_14 28
744 #define _HIPART_14 29
745 #define _LOPART_15 30
746 #define _HIPART_15 31
748 // Return the register number of the pair containing register n, i.e.,
750 #define _PAIR(n) _GLUE(_PAIR_, n)
752 // Internal macros: `_PAIR_n' returns the register number of the pair
753 // containing register n, i.e., floor(n/2).
787 // Apply decoration decor to register number n of type ty. Decorations are
790 // decor types meaning
791 // Q s, d the NEON qN register containing this one
792 // D s the NEON dN register containing this one
793 // D0 q the low 64-bit half of this one
794 // D1 q the high 64-bit half of this one
795 // S0 d, q the first 32-bit piece of this one
796 // S1 d, q the second 32-bit piece of this one
797 // S2 q the third 32-bit piece of this one
798 // S3 q the fourth 32-bit piece of this one
799 // Bn q the nth byte of this register, as a scalar
800 // Hn q the nth halfword of this register, as a scalar
801 // Wn q the nth word of this register, as a scalar
802 #define _DECOR(ty, decor, n) _DECOR_##ty##_##decor(n)
804 // Internal macros: `_DECOR_ty_decor(n)' applies decoration decor to register
805 // number n of type ty.
807 #define _DECOR_s_Q(n) GLUE(q, _PAIR(_PAIR(n)))
808 #define _DECOR_s_D(n) GLUE(d, _PAIR(n))
810 #define _DECOR_d_Q(n) GLUE(q, _PAIR(n))
811 #define _DECOR_d_S0(n) GLUE(s, _LOPART(n))
812 #define _DECOR_d_S1(n) GLUE(s, _LOPART(n))
814 #define _DECOR_q_D0(n) GLUE(d, _LOPART(n))
815 #define _DECOR_q_D1(n) GLUE(d, _HIPART(n))
816 #define _DECOR_q_S0(n) GLUE(s, _LOPART(_LOPART(n)))
817 #define _DECOR_q_S1(n) GLUE(s, _HIPART(_LOPART(n)))
818 #define _DECOR_q_S2(n) GLUE(s, _LOPART(_HIPART(n)))
819 #define _DECOR_q_S3(n) GLUE(s, _HIPART(_HIPART(n)))
820 #define _DECOR_q_W0(n) GLUE(d, _LOPART(n))[0]
821 #define _DECOR_q_W1(n) GLUE(d, _LOPART(n))[1]
822 #define _DECOR_q_W2(n) GLUE(d, _HIPART(n))[0]
823 #define _DECOR_q_W3(n) GLUE(d, _HIPART(n))[1]
824 #define _DECOR_q_H0(n) GLUE(d, _LOPART(n))[0]
825 #define _DECOR_q_H1(n) GLUE(d, _LOPART(n))[1]
826 #define _DECOR_q_H2(n) GLUE(d, _LOPART(n))[2]
827 #define _DECOR_q_H3(n) GLUE(d, _LOPART(n))[3]
828 #define _DECOR_q_H4(n) GLUE(d, _HIPART(n))[0]
829 #define _DECOR_q_H5(n) GLUE(d, _HIPART(n))[1]
830 #define _DECOR_q_H6(n) GLUE(d, _HIPART(n))[2]
831 #define _DECOR_q_H7(n) GLUE(d, _HIPART(n))[3]
832 #define _DECOR_q_B0(n) GLUE(d, _LOPART(n))[0]
833 #define _DECOR_q_B1(n) GLUE(d, _LOPART(n))[1]
834 #define _DECOR_q_B2(n) GLUE(d, _LOPART(n))[2]
835 #define _DECOR_q_B3(n) GLUE(d, _LOPART(n))[3]
836 #define _DECOR_q_B4(n) GLUE(d, _LOPART(n))[4]
837 #define _DECOR_q_B5(n) GLUE(d, _LOPART(n))[5]
838 #define _DECOR_q_B6(n) GLUE(d, _LOPART(n))[6]
839 #define _DECOR_q_B7(n) GLUE(d, _LOPART(n))[7]
840 #define _DECOR_q_B8(n) GLUE(d, _HIPART(n))[0]
841 #define _DECOR_q_B9(n) GLUE(d, _HIPART(n))[1]
842 #define _DECOR_q_B10(n) GLUE(d, _HIPART(n))[2]
843 #define _DECOR_q_B11(n) GLUE(d, _HIPART(n))[3]
844 #define _DECOR_q_B12(n) GLUE(d, _HIPART(n))[4]
845 #define _DECOR_q_B13(n) GLUE(d, _HIPART(n))[5]
846 #define _DECOR_q_B14(n) GLUE(d, _HIPART(n))[6]
847 #define _DECOR_q_B15(n) GLUE(d, _HIPART(n))[7]
849 // Macros for navigating the NEON register hierarchy.
850 #define S0(reg) _REGFORM(reg, S0)
851 #define S1(reg) _REGFORM(reg, S1)
852 #define S2(reg) _REGFORM(reg, S2)
853 #define S3(reg) _REGFORM(reg, S3)
854 #define D(reg) _REGFORM(reg, D)
855 #define D0(reg) _REGFORM(reg, D0)
856 #define D1(reg) _REGFORM(reg, D1)
857 #define Q(reg) _REGFORM(reg, Q)
859 // Macros for indexing quadword registers.
860 #define QB(reg, i) _REGFORM(reg, B##i)
861 #define QH(reg, i) _REGFORM(reg, H##i)
862 #define QW(reg, i) _REGFORM(reg, W##i)
864 // Macros for converting vldm/vstm ranges.
865 #define QQ(qlo, qhi) D0(qlo)-D1(qhi)
869 ///--------------------------------------------------------------------------
872 // Default values for the various hooks.
874 # define FUNC_PREHOOK(_)
876 #ifndef FUNC_POSTHOOK
877 # define FUNC_POSTHOOK(_)
880 # define ENDFUNC_HOOK(_)
884 # define F(name) name
888 # define TYPE_FUNC(name)
892 # define SIZE_OBJ(name)
895 #if __ELF__ && defined(WANT_EXECUTABLE_STACK)
896 .pushsection
.note
.GNU
-stack
, "", _SECTTY(progbits
)
900 ///----- That's all, folks --------------------------------------------------