mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-25 21:52:54 -05:00
Revert amd_bitalign/amd_bfe polyfills
This commit is contained in:
@@ -1,12 +1,47 @@
|
||||
#ifndef WOLF_AES_CL
|
||||
#define WOLF_AES_CL
|
||||
|
||||
#ifdef STATIC
|
||||
# undef STATIC
|
||||
#endif
|
||||
#ifdef cl_amd_media_ops2
|
||||
#pragma OPENCL EXTENSION cl_amd_media_ops2 : enable
|
||||
#define STATIC static
|
||||
# define STATIC static
|
||||
# pragma OPENCL EXTENSION cl_amd_media_ops2 : enable
|
||||
#else
|
||||
#define amd_bfe(src0, offset, width) ((src0 << (32 - (offset) - width)) >> (32 - width))
|
||||
#define STATIC
|
||||
# define STATIC
|
||||
/* taken from: https://www.khronos.org/registry/OpenCL/extensions/amd/cl_amd_media_ops2.txt
|
||||
* Built-in Function:
|
||||
* uintn amd_bfe (uintn src0, uintn src1, uintn src2)
|
||||
* Description
|
||||
* NOTE: operator >> below represent logical right shift
|
||||
* offset = src1.s0 & 31;
|
||||
* width = src2.s0 & 31;
|
||||
* if width = 0
|
||||
* dst.s0 = 0;
|
||||
* else if (offset + width) < 32
|
||||
* dst.s0 = (src0.s0 << (32 - offset - width)) >> (32 - width);
|
||||
* else
|
||||
* dst.s0 = src0.s0 >> offset;
|
||||
* similar operation applied to other components of the vectors
|
||||
*/
|
||||
inline int amd_bfe(const uint src0, const uint offset, const uint width)
|
||||
{
|
||||
/* casts are removed because we can implement everything as uint
|
||||
* int offset = src1;
|
||||
* int width = src2;
|
||||
* remove check for edge case, this function is always called with
|
||||
* `width==8`
|
||||
* @code
|
||||
* if ( width == 0 )
|
||||
* return 0;
|
||||
* @endcode
|
||||
*/
|
||||
if ((offset + width) < 32u) {
|
||||
return (src0 << (32u - offset - width)) >> (32u - width);
|
||||
}
|
||||
|
||||
return src0 >> offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
// AES table - the other three are generated on the fly
|
||||
|
||||
Reference in New Issue
Block a user