https://bugs.llvm.org/show_bug.cgi?id=52407
Bug ID: 52407
Summary: cpu_specific(generic) ignores a la carte CPU features
Product: new-bugs
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: andrew.kay...@intel.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
If I use cpu_dispatch+cpu_specific with a 'generic' implementation, the CPU
feature set for the 'generic' implementation does not include features that are
enabled on the command line by -m options, such as -mavx. For example:
extern __m256d _simd_drand48_pd64x4_avx1(void);
extern __m256d _simd_drand48_pd64x4_avx2(void);
// AVX1/AVX2 dispatcher
__attribute__((cpu_dispatch(generic, core_4th_gen_avx))) __m256d
_simd_drand48_pd64x4(void){}
__attribute__((cpu_specific(generic))) __m256d
_simd_drand48_pd64x4(void){ return _simd_drand48_pd64x4_avx1(); }
__attribute__((cpu_specific(core_4th_gen_avx))) __m256d
_simd_drand48_pd64x4(void){ return _simd_drand48_pd64x4_avx2(); }
If I compile this code with 'clang -O2 -mavx' I get the following error:
error: AVX vector return of type '__m256d' (vector of 4 'double' values)
without 'avx' enabled changes the ABI
However, if I compile with 'clang -O2 -march=sandybridge' it works.
https://godbolt.org/z/hb7hf1ddn
When ASTContext::getFunctionFeatureMap() calls
TargetInfo::getCPUSpecificCPUDispatchFeatures() for the 'generic' function, it
gets back an empty feature list, which I think makes sense. Then it calls
TargetInfo::initFeatureList() with CPU name set to 'x86_64' and passes the
empty feature list. I think ASTContext::getFunctionFeatureMap() needs to check
for 'generic' and specifically add the clang::TargetOptions::Features list to
the list it passes to TargetInfo::initFeatureList().
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs