| 7 | .text |
| 8 |
| 9 | // BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, |
| 10 | // size_t num); |
| 11 | .type bn_add_words, %function |
| 12 | .globl bn_add_words |
| 13 | .hidden bn_add_words |
| 14 | .align 4 |
| 15 | bn_add_words: |
| 16 | AARCH64_VALID_CALL_TARGET |
| 17 | # Clear the carry flag. |
| 18 | cmn xzr, xzr |
| 19 |
| 20 | # aarch64 can load two registers at a time, so we do two loop iterations at |
| 21 | # at a time. Split x3 = 2 * x8 + x3. This allows loop |
| 22 | # operations to use CBNZ without clobbering the carry flag. |
| 23 | lsr x8, x3, #1 |
| 24 | and x3, x3, #1 |
| 25 |
| 26 | cbz x8, .Ladd_tail |
| 27 | .Ladd_loop: |
| 28 | ldp x4, x5, [x1], #16 |
| 29 | ldp x6, x7, [x2], #16 |
| 30 | sub x8, x8, #1 |
| 31 | adcs x4, x4, x6 |
| 32 | adcs x5, x5, x7 |
| 33 | stp x4, x5, [x0], #16 |
| 34 | cbnz x8, .Ladd_loop |
| 35 |
| 36 | .Ladd_tail: |
| 37 | cbz x3, .Ladd_exit |
| 38 | ldr x4, [x1], #8 |
| 39 | ldr x6, [x2], #8 |
| 40 | adcs x4, x4, x6 |
| 41 | str x4, [x0], #8 |
| 42 |
| 43 | .Ladd_exit: |
| 44 | cset x0, cs |
| 45 | ret |
| 46 | .size bn_add_words,.-bn_add_words |
| 47 |
| 48 | // BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, |
| 49 | // size_t num); |
| 50 | .type bn_sub_words, %function |
| 51 | .globl bn_sub_words |
| 52 | .hidden bn_sub_words |
| 53 | .align 4 |
| 54 | bn_sub_words: |
| 55 | AARCH64_VALID_CALL_TARGET |
| 56 | # Set the carry flag. Arm's borrow bit is flipped from the carry flag, |
| 57 | # so we want C = 1 here. |
| 58 | cmp xzr, xzr |
| 59 |
| 60 | # aarch64 can load two registers at a time, so we do two loop iterations at |
| 61 | # at a time. Split x3 = 2 * x8 + x3. This allows loop |
| 62 | # operations to use CBNZ without clobbering the carry flag. |
| 63 | lsr x8, x3, #1 |
| 64 | and x3, x3, #1 |
| 65 |
| 66 | cbz x8, .Lsub_tail |
| 67 | .Lsub_loop: |
| 68 | ldp x4, x5, [x1], #16 |
| 69 | ldp x6, x7, [x2], #16 |
| 70 | sub x8, x8, #1 |
| 71 | sbcs x4, x4, x6 |
| 72 | sbcs x5, x5, x7 |
| 73 | stp x4, x5, [x0], #16 |
| 74 | cbnz x8, .Lsub_loop |
| 75 |
| 76 | .Lsub_tail: |
| 77 | cbz x3, .Lsub_exit |
| 78 | ldr x4, [x1], #8 |
| 79 | ldr x6, [x2], #8 |
| 80 | sbcs x4, x4, x6 |
| 81 | str x4, [x0], #8 |
| 82 |
| 83 | .Lsub_exit: |
| 84 | cset x0, cc |
| 85 | ret |
| 86 | .size bn_sub_words,.-bn_sub_words |
| 87 | #endif // !OPENSSL_NO_ASM && defined(OPENSSL_AARCH64) && defined(__ELF__) |
| 88 |