Jason A. Donenfeld | fb87227 | 2017-11-03 15:18:58 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/linkage.h> |
| 18 | |
| 19 | ENTRY(__ashlti3) |
| 20 | cbz x2, 1f |
| 21 | mov x3, #64 |
| 22 | sub x3, x3, x2 |
| 23 | cmp x3, #0 |
| 24 | b.le 2f |
| 25 | lsl x1, x1, x2 |
| 26 | lsr x3, x0, x3 |
| 27 | lsl x2, x0, x2 |
| 28 | orr x1, x1, x3 |
| 29 | mov x0, x2 |
| 30 | 1: |
| 31 | ret |
| 32 | 2: |
| 33 | neg w1, w3 |
| 34 | mov x2, #0 |
| 35 | lsl x1, x0, x1 |
| 36 | mov x0, x2 |
| 37 | ret |
| 38 | ENDPROC(__ashlti3) |
| 39 | |
| 40 | ENTRY(__ashrti3) |
Jason A. Donenfeld | f5ed22e | 2017-11-07 11:24:04 +0900 | [diff] [blame] | 41 | cbz x2, 1f |
Jason A. Donenfeld | fb87227 | 2017-11-03 15:18:58 +0100 | [diff] [blame] | 42 | mov x3, #64 |
| 43 | sub x3, x3, x2 |
| 44 | cmp x3, #0 |
Jason A. Donenfeld | f5ed22e | 2017-11-07 11:24:04 +0900 | [diff] [blame] | 45 | b.le 2f |
Jason A. Donenfeld | fb87227 | 2017-11-03 15:18:58 +0100 | [diff] [blame] | 46 | lsr x0, x0, x2 |
| 47 | lsl x3, x1, x3 |
| 48 | asr x2, x1, x2 |
| 49 | orr x0, x0, x3 |
| 50 | mov x1, x2 |
Jason A. Donenfeld | f5ed22e | 2017-11-07 11:24:04 +0900 | [diff] [blame] | 51 | 1: |
Jason A. Donenfeld | fb87227 | 2017-11-03 15:18:58 +0100 | [diff] [blame] | 52 | ret |
Jason A. Donenfeld | f5ed22e | 2017-11-07 11:24:04 +0900 | [diff] [blame] | 53 | 2: |
Jason A. Donenfeld | fb87227 | 2017-11-03 15:18:58 +0100 | [diff] [blame] | 54 | neg w0, w3 |
| 55 | asr x2, x1, #63 |
| 56 | asr x0, x1, x0 |
| 57 | mov x1, x2 |
| 58 | ret |
| 59 | ENDPROC(__ashrti3) |
Jason A. Donenfeld | 9bfe755 | 2017-11-07 01:49:54 +0000 | [diff] [blame] | 60 | |
| 61 | ENTRY(__lshrti3) |
| 62 | cbz x2, 1f |
| 63 | mov x3, #64 |
| 64 | sub x3, x3, x2 |
| 65 | cmp x3, #0 |
| 66 | b.le 2f |
| 67 | lsr x0, x0, x2 |
| 68 | lsl x3, x1, x3 |
| 69 | lsr x2, x1, x2 |
| 70 | orr x0, x0, x3 |
| 71 | mov x1, x2 |
| 72 | 1: |
| 73 | ret |
| 74 | 2: |
| 75 | neg w0, w3 |
| 76 | mov x2, #0 |
| 77 | lsr x0, x1, x0 |
| 78 | mov x1, x2 |
| 79 | ret |
| 80 | ENDPROC(__lshrti3) |