]> granicus.if.org Git - clang/commitdiff
[X86] Use AVX features instead of ABI to init. SimdDefaultAlign.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 27 Aug 2015 22:24:56 +0000 (22:24 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 27 Aug 2015 22:24:56 +0000 (22:24 +0000)
The ABI string only exists to communicate with TargetCodeGenInfo.
Concretely, since we only used "avx*" ABI strings on x86_64 (as AVX
doesn't affect the i386 ABIs), this meant that, when initializing
SimdDefaultAlign, we would ignore AVX/AVX512 on i386, for no good
reason.

Instead, directly check the features. A similar change for
MaxVectorAlign will follow.

Differential Revision: http://reviews.llvm.org/D12390

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246228 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/OpenMP/simd_metadata.c

index 577ee8abc81ca517797ad7efa0dcae3a41181eaa..985e991e6010eacbfd778a24b106c0e36c2bf2e0 100644 (file)
@@ -2984,7 +2984,7 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
     MMX3DNowLevel = std::max(MMX3DNowLevel, MMX);
 
   SimdDefaultAlign =
-      (getABI() == "avx512") ? 512 : (getABI() == "avx") ? 256 : 128;
+      hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
   return true;
 }
 
index 12f05503749ce980bfd68624cbd77cb2c2313427..6ed660747dcb0725aed5d185752242d947be1363 100644 (file)
@@ -1,6 +1,9 @@
 // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86
 // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -target-feature +avx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX
 // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -target-feature +avx512f -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX512
+// RUN: %clang_cc1 -fopenmp -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86
+// RUN: %clang_cc1 -fopenmp -triple i386-unknown-unknown -target-feature +avx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX
+// RUN: %clang_cc1 -fopenmp -triple i386-unknown-unknown -target-feature +avx512f -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX512
 // RUN: %clang_cc1 -fopenmp -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=PPC
 // RUN: %clang_cc1 -fopenmp -triple powerpc64-unknown-unknown -target-abi elfv1-qpx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=PPC-QPX