clang是否提供与GCC 6.x的多版本功能(target_clones)类似的功能? [英] Does clang offer anything similar to GCC 6.x's function multi-versioning (target_clones)?

查看:47
本文介绍了clang是否提供与GCC 6.x的多版本功能(target_clones)类似的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很感兴趣地阅读了这篇LWN文章.执行摘要:GCC 6.x支持一种称为函数多版本的功能,该功能可构建同一功能的多个版本,并针对不同的指令集进行了优化.假设您有一台支持AVX2的计算机,而没有一台支持AVX2的计算机.可以使用两个版本中都存在的函数foo()在两个版本上运行相同的二进制文件,其中一个使用AVX2指令.但是,只有在CPU支持的情况下,才会调用带有AVX2指令的函数.

I've read this LWN article with great interest. Executive summary: GCC 6.x supports something called function multi-versioning which builds multiple versions of the same function, optimized for different instruction sets. Let's say you have a machine with AVX2 support and one without. It's possible to run the same binary on both, with function foo() existing in two versions, one of which uses AVX2 instructions. The function with the AVX2 instructions are, however, only called if the CPU supports it.

我的问题是:clang是否支持类似功能?它似乎不是世界上最先进的功能.

My question is: does clang support something similar? It doesn't seem like the most advanced feature in the world.

推荐答案

LLVM 7使用(用于基于ELF的x86/x86_64目标).

LLVM 7 supports function multiversioning using the 'target' attribute for ELF-based x86/x86_64 targets.

"target_clones" 尚未着陆.

这篇关于clang是否提供与GCC 6.x的多版本功能(target_clones)类似的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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