开始使用SSE [英] Getting started with SSE

查看:122
本文介绍了开始使用SSE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更多地了解使用 SSE

有哪些途径来学习,除了明显的阅读英特尔®64和IA-32架构软件开发人员手册

What ways are there to learn, besides the obvious reading the Intel® 64 and IA-32 Architectures Software Developer's Manuals?

主要是我很感兴趣的<一个工作href=\"http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/X86-Built_002din-Functions.html#X86-Built_002din-Functions\">GCC X86内置函数的。

Mainly I'm interested to work with the GCC X86 Built-in Functions.

推荐答案

首先,我不建议使用内置的功能 - 它们是无法移植(在相同拱编译器)。

First, I don't recommend on using the built-in functions - they are not portable (across compilers of the same arch).

使用内在,GCC的做了出色的工作优化上证所内部函数到更优化的code。你总是可以有在大会偷看,看看如何使用SSE到它的全部潜力。

Use intrinsics, GCC does a wonderful job optimizing SSE intrinsics into even more optimized code. You can always have a peek at the assembly and see how to use SSE to it's full potential.

内在函数是很容易 - 就像正常的函数调用:

Intrinsics are easy - just like normal function calls:

#include <xmmintrin.h>

__m128 vector1 = _mm_set1_ps(4, 3, 2, 1); // Little endian, stored in 'reverse'
__m128 vector2 = _mm_set1_ps(7, 8, 9, 0);

// Addition
__m128 result = _mm_add_ps(vector1, vector2); // result = vector1 + vector 2

// A more advanced function, called shuffle
vector1 = _mm_shuf_ps(vector1, vector1, _MM_SHUFFLE(0,1,2,3));
// vector1 is now (1, 2, 3, 4) (above shuffle reversed it)

当然也有办法更多的​​选择,SSE真的很强大,在我看来比较容易学习。

Of course there are way more options, SSE is really powerful and in my opinion relatively easy to learn.

这篇关于开始使用SSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆