1; Copyright (C) 2012-2018 Free Software Foundation, Inc. 2; Contributed by Red Hat. 3; 4; This file is free software; you can redistribute it and/or modify it 5; under the terms of the GNU General Public License as published by the 6; Free Software Foundation; either version 3, or (at your option) any 7; later version. 8; 9; This file is distributed in the hope that it will be useful, but 10; WITHOUT ANY WARRANTY; without even the implied warranty of 11; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12; General Public License for more details. 13; 14; Under Section 7 of GPL version 3, you are granted additional 15; permissions described in the GCC Runtime Library Exception, version 16; 3.1, as published by the Free Software Foundation. 17; 18; You should have received a copy of the GNU General Public License and 19; a copy of the GCC Runtime Library Exception along with this program; 20; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 21; <http://www.gnu.org/licenses/>. 22 23 .text 24 25 .macro _srai n 26 .global __mspabi_srai_\n 27__mspabi_srai_\n: 28 RRA.W R12 29 .endm 30 31/* Logical Right Shift - R12 -> R12 */ 32 _srai 15 33 _srai 14 34 _srai 13 35 _srai 12 36 _srai 11 37 _srai 10 38 _srai 9 39 _srai 8 40 _srai 7 41 _srai 6 42 _srai 5 43 _srai 4 44 _srai 3 45 _srai 2 46 _srai 1 47#ifdef __MSP430X_LARGE__ 48 RETA 49#else 50 RET 51#endif 52 531: ADD.W #-1,R13 54 RRA.W R12,R12 55 .global __mspabi_srai 56__mspabi_srai: 57 CMP #0,R13 58 JNZ 1b 59#ifdef __MSP430X_LARGE__ 60 RETA 61#else 62 RET 63#endif 64 65/* Logical Right Shift - R12:R13 -> R12:R13 */ 66 67 .macro _sral n 68 .global __mspabi_sral_\n 69__mspabi_sral_\n: 70 RRA.W R13 71 RRC.W R12 72 .endm 73 74 _sral 15 75 _sral 14 76 _sral 13 77 _sral 12 78 _sral 11 79 _sral 10 80 _sral 9 81 _sral 8 82 _sral 7 83 _sral 6 84 _sral 5 85 _sral 4 86 _sral 3 87 _sral 2 88 _sral 1 89#ifdef __MSP430X_LARGE__ 90 RETA 91#else 92 RET 93#endif 94 951: ADD.W #-1,R14 96 RRA.W R13 97 RRC.W R12 98 .global __mspabi_sral 99__mspabi_sral: 100 CMP #0,R14 101 JNZ 1b 102#ifdef __MSP430X_LARGE__ 103 RETA 104#else 105 RET 106#endif 107