1 /* Integer arithmetic support for gcn. 2 3 Copyright (C) 2012-2024 Free Software Foundation, Inc. 4 Contributed by Altera and Mentor Graphics, Inc. 5 6 This file is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License as published by the 8 Free Software Foundation; either version 3, or (at your option) any 9 later version. 10 11 This file is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 Under Section 7 of GPL version 3, you are granted additional 17 permissions described in the GCC Runtime Library Exception, version 18 3.1, as published by the Free Software Foundation. 19 20 You should have received a copy of the GNU General Public License and 21 a copy of the GCC Runtime Library Exception along with this program; 22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 <http://www.gnu.org/licenses/>. */ 24 25 #ifndef LIB2_GCN_H 26 #define LIB2_GCN_H 27 28 /* Types. */ 29 30 typedef int SItype __attribute__ ((mode (SI))); 31 typedef unsigned int USItype __attribute__ ((mode (SI))); 32 typedef int DItype __attribute__ ((mode (DI))); 33 typedef unsigned int UDItype __attribute__ ((mode (DI))); 34 typedef int TItype __attribute__ ((mode (TI))); 35 typedef unsigned int UTItype __attribute__ ((mode (TI))); 36 typedef int word_type __attribute__ ((mode (__word__))); 37 38 typedef float v2sf __attribute__ ((vector_size (8))); 39 typedef float v4sf __attribute__ ((vector_size (16))); 40 typedef float v8sf __attribute__ ((vector_size (32))); 41 typedef float v16sf __attribute__ ((vector_size (64))); 42 typedef float v32sf __attribute__ ((vector_size (128))); 43 typedef float v64sf __attribute__ ((vector_size (256))); 44 45 typedef double v2df __attribute__ ((vector_size (16))); 46 typedef double v4df __attribute__ ((vector_size (32))); 47 typedef double v8df __attribute__ ((vector_size (64))); 48 typedef double v16df __attribute__ ((vector_size (128))); 49 typedef double v32df __attribute__ ((vector_size (256))); 50 typedef double v64df __attribute__ ((vector_size (512))); 51 52 typedef signed char v2qi __attribute__ ((vector_size (2))); 53 typedef signed char v4qi __attribute__ ((vector_size (4))); 54 typedef signed char v8qi __attribute__ ((vector_size (8))); 55 typedef signed char v16qi __attribute__ ((vector_size (16))); 56 typedef signed char v32qi __attribute__ ((vector_size (32))); 57 typedef signed char v64qi __attribute__ ((vector_size (64))); 58 59 typedef unsigned char v2uqi __attribute__ ((vector_size (2))); 60 typedef unsigned char v4uqi __attribute__ ((vector_size (4))); 61 typedef unsigned char v8uqi __attribute__ ((vector_size (8))); 62 typedef unsigned char v16uqi __attribute__ ((vector_size (16))); 63 typedef unsigned char v32uqi __attribute__ ((vector_size (32))); 64 typedef unsigned char v64uqi __attribute__ ((vector_size (64))); 65 66 typedef short v2hi __attribute__ ((vector_size (4))); 67 typedef short v4hi __attribute__ ((vector_size (8))); 68 typedef short v8hi __attribute__ ((vector_size (16))); 69 typedef short v16hi __attribute__ ((vector_size (32))); 70 typedef short v32hi __attribute__ ((vector_size (64))); 71 typedef short v64hi __attribute__ ((vector_size (128))); 72 73 typedef unsigned short v2uhi __attribute__ ((vector_size (4))); 74 typedef unsigned short v4uhi __attribute__ ((vector_size (8))); 75 typedef unsigned short v8uhi __attribute__ ((vector_size (16))); 76 typedef unsigned short v16uhi __attribute__ ((vector_size (32))); 77 typedef unsigned short v32uhi __attribute__ ((vector_size (64))); 78 typedef unsigned short v64uhi __attribute__ ((vector_size (128))); 79 80 typedef int v2si __attribute__ ((vector_size (8))); 81 typedef int v4si __attribute__ ((vector_size (16))); 82 typedef int v8si __attribute__ ((vector_size (32))); 83 typedef int v16si __attribute__ ((vector_size (64))); 84 typedef int v32si __attribute__ ((vector_size (128))); 85 typedef int v64si __attribute__ ((vector_size (256))); 86 87 typedef unsigned int v2usi __attribute__ ((vector_size (8))); 88 typedef unsigned int v4usi __attribute__ ((vector_size (16))); 89 typedef unsigned int v8usi __attribute__ ((vector_size (32))); 90 typedef unsigned int v16usi __attribute__ ((vector_size (64))); 91 typedef unsigned int v32usi __attribute__ ((vector_size (128))); 92 typedef unsigned int v64usi __attribute__ ((vector_size (256))); 93 94 typedef long v2di __attribute__ ((vector_size (16))); 95 typedef long v4di __attribute__ ((vector_size (32))); 96 typedef long v8di __attribute__ ((vector_size (64))); 97 typedef long v16di __attribute__ ((vector_size (128))); 98 typedef long v32di __attribute__ ((vector_size (256))); 99 typedef long v64di __attribute__ ((vector_size (512))); 100 101 typedef unsigned long v2udi __attribute__ ((vector_size (16))); 102 typedef unsigned long v4udi __attribute__ ((vector_size (32))); 103 typedef unsigned long v8udi __attribute__ ((vector_size (64))); 104 typedef unsigned long v16udi __attribute__ ((vector_size (128))); 105 typedef unsigned long v32udi __attribute__ ((vector_size (256))); 106 typedef unsigned long v64udi __attribute__ ((vector_size (512))); 107 108 typedef UTItype v2uti __attribute__ ((vector_size (32))); 109 typedef UTItype v4uti __attribute__ ((vector_size (64))); 110 typedef UTItype v8uti __attribute__ ((vector_size (128))); 111 typedef UTItype v16uti __attribute__ ((vector_size (256))); 112 typedef UTItype v32uti __attribute__ ((vector_size (512))); 113 typedef UTItype v64uti __attribute__ ((vector_size (1024))); 114 115 /* Exported functions. */ 116 extern DItype __divdi3 (DItype, DItype); 117 extern DItype __moddi3 (DItype, DItype); 118 extern UTItype __divmoddi4 (DItype, DItype); 119 extern UDItype __udivdi3 (UDItype, UDItype); 120 extern UDItype __umoddi3 (UDItype, UDItype); 121 extern UTItype __udivmoddi4 (UDItype, UDItype); 122 extern SItype __divsi3 (SItype, SItype); 123 extern SItype __modsi3 (SItype, SItype); 124 extern UDItype __divmodsi4 (SItype, SItype); 125 extern USItype __udivsi3 (USItype, USItype); 126 extern USItype __umodsi3 (USItype, USItype); 127 extern UDItype __udivmodsi4 (USItype, USItype); 128 extern SItype __mulsi3 (SItype, SItype); 129 130 #define VECTOR_PROTOTYPES(SIZE) \ 131 extern v##SIZE##qi __divv##SIZE##qi3 (v##SIZE##qi, v##SIZE##qi); \ 132 extern v##SIZE##qi __modv##SIZE##qi3 (v##SIZE##qi, v##SIZE##qi); \ 133 extern v##SIZE##udi __divmodv##SIZE##qi4 (v##SIZE##qi, v##SIZE##qi); \ 134 extern v##SIZE##uqi __udivv##SIZE##qi3 (v##SIZE##uqi, v##SIZE##uqi); \ 135 extern v##SIZE##uqi __umodv##SIZE##qi3 (v##SIZE##uqi, v##SIZE##uqi); \ 136 extern v##SIZE##udi __udivmodv##SIZE##qi4 (v##SIZE##uqi, v##SIZE##uqi); \ 137 extern v##SIZE##hi __divv##SIZE##hi3 (v##SIZE##hi, v##SIZE##hi); \ 138 extern v##SIZE##hi __modv##SIZE##hi3 (v##SIZE##hi, v##SIZE##hi); \ 139 extern v##SIZE##udi __divmodv##SIZE##hi4 (v##SIZE##hi, v##SIZE##hi); \ 140 extern v##SIZE##uhi __udivv##SIZE##hi3 (v##SIZE##uhi, v##SIZE##uhi); \ 141 extern v##SIZE##uhi __umodv##SIZE##hi3 (v##SIZE##uhi, v##SIZE##uhi); \ 142 extern v##SIZE##udi __udivmodv##SIZE##hi4 (v##SIZE##uhi, v##SIZE##uhi); \ 143 extern v##SIZE##si __divv##SIZE##si3 (v##SIZE##si, v##SIZE##si); \ 144 extern v##SIZE##si __modv##SIZE##si3 (v##SIZE##si, v##SIZE##si); \ 145 extern v##SIZE##udi __divmodv##SIZE##si4 (v##SIZE##si, v##SIZE##si); \ 146 extern v##SIZE##usi __udivv##SIZE##si3 (v##SIZE##usi, v##SIZE##usi); \ 147 extern v##SIZE##usi __umodv##SIZE##si3 (v##SIZE##usi, v##SIZE##usi); \ 148 extern v##SIZE##udi __udivmodv##SIZE##si4 (v##SIZE##usi, v##SIZE##usi); \ 149 extern v##SIZE##di __divv##SIZE##di3 (v##SIZE##di, v##SIZE##di); \ 150 extern v##SIZE##di __modv##SIZE##di3 (v##SIZE##di, v##SIZE##di); \ 151 extern v##SIZE##uti __divmodv##SIZE##di4 (v##SIZE##di, v##SIZE##di); \ 152 extern v##SIZE##udi __udivv##SIZE##di3 (v##SIZE##udi, v##SIZE##udi); \ 153 extern v##SIZE##udi __umodv##SIZE##di3 (v##SIZE##udi, v##SIZE##udi); \ 154 extern v##SIZE##uti __udivmodv##SIZE##di4 (v##SIZE##udi, v##SIZE##udi); 155 VECTOR_PROTOTYPES (2) 156 VECTOR_PROTOTYPES (4) 157 VECTOR_PROTOTYPES (8) 158 VECTOR_PROTOTYPES (16) 159 VECTOR_PROTOTYPES (32) 160 VECTOR_PROTOTYPES (64) 161 #undef VECTOR_PROTOTYPES 162 163 #endif /* LIB2_GCN_H */ 164