Changeset 37675 in vbox for trunk/src/recompiler/host-utils.h
- Timestamp:
- Jun 29, 2011 7:07:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/host-utils.h
r36125 r37675 28 28 #if defined(__x86_64__) 29 29 #define __HAVE_FAST_MULU64__ 30 static always_inline void mulu64(uint64_t *plow, uint64_t *phigh,31 30 static inline void mulu64(uint64_t *plow, uint64_t *phigh, 31 uint64_t a, uint64_t b) 32 32 { 33 33 __asm__ ("mul %0\n\t" … … 36 36 } 37 37 #define __HAVE_FAST_MULS64__ 38 static always_inline void muls64(uint64_t *plow, uint64_t *phigh,39 38 static inline void muls64(uint64_t *plow, uint64_t *phigh, 39 int64_t a, int64_t b) 40 40 { 41 41 __asm__ ("imul %0\n\t" … … 50 50 /* Binary search for leading zeros. */ 51 51 52 static always_inline int clz32(uint32_t val)52 static inline int clz32(uint32_t val) 53 53 { 54 54 #if QEMU_GNUC_PREREQ(3, 4) … … 87 87 } 88 88 89 static always_inline int clo32(uint32_t val)89 static inline int clo32(uint32_t val) 90 90 { 91 91 return clz32(~val); 92 92 } 93 93 94 static always_inline int clz64(uint64_t val)94 static inline int clz64(uint64_t val) 95 95 { 96 96 #if QEMU_GNUC_PREREQ(3, 4) … … 112 112 } 113 113 114 static always_inline int clo64(uint64_t val)114 static inline int clo64(uint64_t val) 115 115 { 116 116 return clz64(~val); 117 117 } 118 118 119 static always_inline int ctz32(uint32_t val)119 static inline int ctz32(uint32_t val) 120 120 { 121 121 #if QEMU_GNUC_PREREQ(3, 4) … … 129 129 cnt = 0; 130 130 if (!(val & 0x0000FFFFUL)) { 131 131 cnt += 16; 132 132 val >>= 16; 133 133 } 134 134 if (!(val & 0x000000FFUL)) { 135 135 cnt += 8; 136 136 val >>= 8; 137 137 } 138 138 if (!(val & 0x0000000FUL)) { 139 139 cnt += 4; 140 140 val >>= 4; 141 141 } 142 142 if (!(val & 0x00000003UL)) { 143 143 cnt += 2; 144 144 val >>= 2; 145 145 } 146 146 if (!(val & 0x00000001UL)) { 147 147 cnt++; 148 148 val >>= 1; 149 149 } 150 150 if (!(val & 0x00000001UL)) { 151 152 153 154 155 #endif 156 157 158 static always_inline int cto32(uint32_t val)151 cnt++; 152 } 153 154 return cnt; 155 #endif 156 } 157 158 static inline int cto32(uint32_t val) 159 159 { 160 160 return ctz32(~val); 161 161 } 162 162 163 static always_inline int ctz64(uint64_t val)164 { 165 #if QEMU_GNUC_PREREQ(3, 4) 166 if (val) 167 return __builtin_ctz (val);163 static inline int ctz64(uint64_t val) 164 { 165 #if QEMU_GNUC_PREREQ(3, 4) 166 if (val) 167 return __builtin_ctzll(val); 168 168 else 169 169 return 64; … … 181 181 } 182 182 183 static always_inline int cto64(uint64_t val)183 static inline int cto64(uint64_t val) 184 184 { 185 185 return ctz64(~val); 186 186 } 187 187 188 static always_inline int ctpop8(uint8_t val)188 static inline int ctpop8(uint8_t val) 189 189 { 190 190 val = (val & 0x55) + ((val >> 1) & 0x55); … … 195 195 } 196 196 197 static always_inline int ctpop16(uint16_t val)197 static inline int ctpop16(uint16_t val) 198 198 { 199 199 val = (val & 0x5555) + ((val >> 1) & 0x5555); … … 205 205 } 206 206 207 static always_inline int ctpop32(uint32_t val)207 static inline int ctpop32(uint32_t val) 208 208 { 209 209 #if QEMU_GNUC_PREREQ(3, 4) … … 220 220 } 221 221 222 static always_inline int ctpop64(uint64_t val)222 static inline int ctpop64(uint64_t val) 223 223 { 224 224 #if QEMU_GNUC_PREREQ(3, 4)
Note:
See TracChangeset
for help on using the changeset viewer.