[X86]Support options -mno-gather -mno-scatter
authorXinWang10 <xin10.wang@intel.com>
Fri, 18 Aug 2023 06:01:50 +0000 (23:01 -0700)
committerTobias Hieta <tobias@hieta.se>
Tue, 22 Aug 2023 05:47:04 +0000 (07:47 +0200)
commitde0f8c265cef662a6acc6d09823d1d461a1bc8b9
tree6da2451721ced4ef7f801017ccdf27e7fe6a0db3
parent7470d9a13088f97959f0e58519a72dbf537f1e59
[X86]Support options -mno-gather -mno-scatter

Gather instructions could lead to security issues, details please refer to https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/gather-data-sampling.html.
This supported options -mno-gather and -mno-scatter, which could avoid generating gather/scatter instructions in backend except using intrinsics or inline asms.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D157680
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/X86.cpp
clang/test/Driver/x86-no-gather-no-scatter.cpp [new file with mode: 0644]
llvm/lib/Target/X86/X86.td
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/lib/Target/X86/X86TargetTransformInfo.h
llvm/test/CodeGen/X86/x86-prefer-no-gather-no-scatter.ll [new file with mode: 0644]