David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2018 Free Software Foundation, Inc. |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 4 | */ |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 5 | |
| 6 | #include <linux/linkage.h> |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 7 | #include <asm-generic/export.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 8 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 9 | SYM_FUNC_START(__lshrti3) |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 10 | beqz a2, .L1 |
| 11 | li a5,64 |
| 12 | sub a5,a5,a2 |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 13 | sext.w a4,a5 |
| 14 | blez a5, .L2 |
| 15 | sext.w a2,a2 |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 16 | srl a0,a0,a2 |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 17 | sll a4,a1,a4 |
| 18 | srl a2,a1,a2 |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 19 | or a0,a0,a4 |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 20 | mv a1,a2 |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 21 | .L1: |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 22 | ret |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 23 | .L2: |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 24 | negw a0,a4 |
| 25 | li a2,0 |
| 26 | srl a0,a1,a0 |
| 27 | mv a1,a2 |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 28 | ret |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 29 | SYM_FUNC_END(__lshrti3) |
| 30 | EXPORT_SYMBOL(__lshrti3) |
| 31 | |
| 32 | SYM_FUNC_START(__ashrti3) |
| 33 | beqz a2, .L3 |
| 34 | li a5,64 |
| 35 | sub a5,a5,a2 |
| 36 | sext.w a4,a5 |
| 37 | blez a5, .L4 |
| 38 | sext.w a2,a2 |
| 39 | srl a0,a0,a2 |
| 40 | sll a4,a1,a4 |
| 41 | sra a2,a1,a2 |
| 42 | or a0,a0,a4 |
| 43 | mv a1,a2 |
| 44 | .L3: |
| 45 | ret |
| 46 | .L4: |
| 47 | negw a0,a4 |
| 48 | srai a2,a1,0x3f |
| 49 | sra a0,a1,a0 |
| 50 | mv a1,a2 |
| 51 | ret |
| 52 | SYM_FUNC_END(__ashrti3) |
| 53 | EXPORT_SYMBOL(__ashrti3) |
| 54 | |
| 55 | SYM_FUNC_START(__ashlti3) |
| 56 | beqz a2, .L5 |
| 57 | li a5,64 |
| 58 | sub a5,a5,a2 |
| 59 | sext.w a4,a5 |
| 60 | blez a5, .L6 |
| 61 | sext.w a2,a2 |
| 62 | sll a1,a1,a2 |
| 63 | srl a4,a0,a4 |
| 64 | sll a2,a0,a2 |
| 65 | or a1,a1,a4 |
| 66 | mv a0,a2 |
| 67 | .L5: |
| 68 | ret |
| 69 | .L6: |
| 70 | negw a1,a4 |
| 71 | li a2,0 |
| 72 | sll a1,a0,a1 |
| 73 | mv a0,a2 |
| 74 | ret |
| 75 | SYM_FUNC_END(__ashlti3) |
| 76 | EXPORT_SYMBOL(__ashlti3) |