cpufunc.h (37bd3aa6fac8ed2eda86e06f1aff854ed8b6acd8) | cpufunc.h (aae89f6f09576351cc3a9a54959649e60fdd849b) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2003 Peter Wemm. 5 * Copyright (c) 1993 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 51 unchanged lines hidden (view full) --- 60#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) 61 62static __inline void 63breakpoint(void) 64{ 65 __asm __volatile("int $3"); 66} 67 | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2003 Peter Wemm. 5 * Copyright (c) 1993 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 51 unchanged lines hidden (view full) --- 60#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) 61 62static __inline void 63breakpoint(void) 64{ 65 __asm __volatile("int $3"); 66} 67 |
68static __inline __pure2 u_int 69bsfl(u_int mask) 70{ 71 u_int result; | 68#define bsfl(mask) __builtin_ctz(mask) |
72 | 69 |
73 __asm __volatile("bsfl %1,%0" : "=r" (result) : "rm" (mask)); 74 return (result); 75} | 70#define bsfq(mask) __builtin_ctzl(mask) |
76 | 71 |
77static __inline __pure2 u_long 78bsfq(u_long mask) 79{ 80 u_long result; | 72#define bsrl(mask) (__builtin_clz(mask) ^ 0x1f) |
81 | 73 |
82 __asm __volatile("bsfq %1,%0" : "=r" (result) : "rm" (mask)); 83 return (result); 84} | 74#define bsrq(mask) (__builtin_clzl(mask) ^ 0x3f) |
85 | 75 |
86static __inline __pure2 u_int 87bsrl(u_int mask) 88{ 89 u_int result; 90 91 __asm __volatile("bsrl %1,%0" : "=r" (result) : "rm" (mask)); 92 return (result); 93} 94 95static __inline __pure2 u_long 96bsrq(u_long mask) 97{ 98 u_long result; 99 100 __asm __volatile("bsrq %1,%0" : "=r" (result) : "rm" (mask)); 101 return (result); 102} 103 | |
104static __inline void 105clflush(u_long addr) 106{ 107 108 __asm __volatile("clflush %0" : : "m" (*(char *)addr)); 109} 110 111static __inline void --- 935 unchanged lines hidden --- | 76static __inline void 77clflush(u_long addr) 78{ 79 80 __asm __volatile("clflush %0" : : "m" (*(char *)addr)); 81} 82 83static __inline void --- 935 unchanged lines hidden --- |