如何使用gcc进行矢量化? [英] How to vectorize with gcc?

查看:219
本文介绍了如何使用gcc进行矢量化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gcc 编译器的v4系列可以使用 SIMD 处理器在一些现代CPU上,例如AMD Athlon或Intel Pentium / Core芯片。这是怎么完成的?

解决方案

这个页面提供了让gcc自动矢量化
循环的细节,包括几个例子:



http:/ /gcc.gnu.org/projects/tree-ssa/vectorization.html



总之,以下选项适用于带有SSE2的x86芯片,
给出已被矢量化的循环日志:

pre $ gcc -O2 -ftree-vectorize -msse2 -ftree-vectorizer -verbose = 5

请注意,-msse也是一种可能性,但它只会将循环向量化为
使用浮动,不是双打或整数。


The v4 series of the gcc compiler can automatically vectorize loops using the SIMD processor on some modern CPUs, such as the AMD Athlon or Intel Pentium/Core chips. How is this done?

解决方案

This page offers details on getting gcc to automatically vectorize loops, including a few examples:

http://gcc.gnu.org/projects/tree-ssa/vectorization.html

In summary, the following options will work for x86 chips with SSE2, giving a log of loops that have been vectorized:

gcc -O2 -ftree-vectorize -msse2 -ftree-vectorizer-verbose=5

Note that -msse is also a possibility, but it will only vectorize loops using floats, not doubles or ints.

这篇关于如何使用gcc进行矢量化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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