[PATCH] D12390: Also enable the avx/avx512 ABIs for i386, not just x86_64.

Ahmed Bougacha via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 17:03:31 PDT 2015


ab created this revision.
ab added a reviewer: rjmccall.
ab added a subscriber: cfe-commits.

One problem that came up in D12389 is that i386 doesn't know about the "avx" ABIs.  Judging by the commit that originally introduced the X86_64 check and the "avx" ABI (r145652), it was just unnecessary.

Because of that, we can't decide based on the ABI string only for i386.

The only effect this should have is that SimdDefaultAlign would previously always be 128 on i386, no matter the SSE level. We will now use a larger alignment, which seems desirable to me. I added i386 RUN lines to the OpenMP simd test.

I also moved the no-mmx check earlier, as I gather it's necessary for correctness with -mno-mmx (as opposed to the "avx" ABIs which make no difference other than SIMD/vector alignment on i386).

http://reviews.llvm.org/D12390

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

Index: test/OpenMP/simd_metadata.c
===================================================================
--- test/OpenMP/simd_metadata.c
+++ test/OpenMP/simd_metadata.c
@@ -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
 
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2308,13 +2308,13 @@
   bool handleTargetFeatures(std::vector<std::string> &Features,
                             DiagnosticsEngine &Diags) override;
   StringRef getABI() const override {
-    if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX512F)
+    if (getTriple().getArch() == llvm::Triple::x86 &&
+        MMX3DNowLevel == NoMMX3DNow)
+      return "no-mmx";
+    else if (SSELevel >= AVX512F)
       return "avx512";
-    else if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
+    else if (SSELevel >= AVX)
       return "avx";
-    else if (getTriple().getArch() == llvm::Triple::x86 &&
-             MMX3DNowLevel == NoMMX3DNow)
-      return "no-mmx";
     return "";
   }
   bool setCPU(const std::string &Name) override {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12390.33280.patch
Type: text/x-patch
Size: 2309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150827/453439d1/attachment.bin>


More information about the cfe-commits mailing list