如何准备与MMX/SSE Interins一起使用的数据以转移16位值?

发布于 2025-01-26 05:45:52 字数 1057 浏览 0 评论 0原文

不管我如何处理{0,8,16,0}(16位向量,用于复制为大的endian 64bit值的表示)我无法正确地偏移的测试值偏移{0x00,0x01,(...)0x07};
我在调试器中获得的结果始终是0x0。

我试图以几种不同的方式转换值,但我无法正确地转换该值。

在一个小的endian上执行:

#include <mmintrin.h>
#include <stdint.h>

int main(int argc, char** argv) {
    __m64 input;
    __m64 vectors;
    __m64 output;

    _Alignas(8) uint16_t bit16Vectors[1*4] = {
        0x0000,0x0008,0x0010,0x0000
        // Intent: {0,8,16,0} 16 bit array
        // Convert for copy: {0,16,8,0} 64bit one item
        // 8bit data, Bytes need to rotate: {0,8,16,0}
    };
    _Alignas(8) uint8_t in[8] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
    };

    input = _m_from_int64(*((long long*)in) );
    vectors = _m_from_int64 (*((long long*)bit16Vectors));
    output = _mm_sll_pi16(input, vectors);
    __asm__("int3");
}

我写下了一个简单的仅MMX的RGB24平面分离pseudoSemembly [处理8x1值],但是我无法将所有16+32位移动矢量转换为“现实世界”,或者我做了一些错误与内在。

我无法准确地将其固定,我只知道它在第一个位移动时失败并返回0x0的值。

No matter what I do with {0,8,16,0}(16bit vector, representation for copying into a big endian 64bit value) I am unable to properly bit shift a test value of { 0x00, 0x01, (...) 0x07 };
The result I get in the debugger is always 0x0.

I tried to convert the value in a couple of different ways, but I am unable to get this right.

Executed on a little endian:

#include <mmintrin.h>
#include <stdint.h>

int main(int argc, char** argv) {
    __m64 input;
    __m64 vectors;
    __m64 output;

    _Alignas(8) uint16_t bit16Vectors[1*4] = {
        0x0000,0x0008,0x0010,0x0000
        // Intent: {0,8,16,0} 16 bit array
        // Convert for copy: {0,16,8,0} 64bit one item
        // 8bit data, Bytes need to rotate: {0,8,16,0}
    };
    _Alignas(8) uint8_t in[8] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
    };

    input = _m_from_int64(*((long long*)in) );
    vectors = _m_from_int64 (*((long long*)bit16Vectors));
    output = _mm_sll_pi16(input, vectors);
    __asm__("int3");
}

I wrote down a simple MMX-only RGB24 plane separation pseudoAssembly[which processes 8x1 values], but I am unable to convert all the 16+32bit bit shift vectors to "real world", or I do something wrong with the intrinsics.

I am unable to pin it down exactly, I just know it fails at the very first bit shift and returns the value of 0x0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文