From f63f5284807a67b47d5bb558520227d0ee8ad210 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 26 Apr 2011 12:01:42 -0400 Subject: [PATCH] disable avx code generation --- llvm-2.8-disable-avx.patch | 67 ++++++++++++++++++++++++++++++++++++++ llvm.spec | 7 +++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 llvm-2.8-disable-avx.patch diff --git a/llvm-2.8-disable-avx.patch b/llvm-2.8-disable-avx.patch new file mode 100644 index 0000000..4bdfb58 --- /dev/null +++ b/llvm-2.8-disable-avx.patch @@ -0,0 +1,67 @@ +diff -up llvm-2.8/lib/Target/X86/X86Subtarget.cpp.jx llvm-2.8/lib/Target/X86/X86Subtarget.cpp +--- llvm-2.8/lib/Target/X86/X86Subtarget.cpp.jx 2010-08-21 13:21:11.000000000 -0400 ++++ llvm-2.8/lib/Target/X86/X86Subtarget.cpp 2011-04-26 16:02:52.238855091 -0400 +@@ -262,7 +262,7 @@ void X86Subtarget::AutoDetectSubtargetFe + + HasCLMUL = IsIntel && ((ECX >> 1) & 0x1); + HasFMA3 = IsIntel && ((ECX >> 12) & 0x1); +- HasAVX = ((ECX >> 28) & 0x1); ++ HasAVX = 0; + HasAES = IsIntel && ((ECX >> 25) & 0x1); + + if (IsIntel || IsAMD) { +diff -up llvm-2.8/lib/Target/X86/X86Subtarget.h.jx llvm-2.8/lib/Target/X86/X86Subtarget.h +--- llvm-2.8/lib/Target/X86/X86Subtarget.h.jx 2010-09-02 19:03:46.000000000 -0400 ++++ llvm-2.8/lib/Target/X86/X86Subtarget.h 2011-04-26 16:01:23.336855019 -0400 +@@ -150,7 +150,7 @@ public: + bool hasSSE4A() const { return HasSSE4A; } + bool has3DNow() const { return X863DNowLevel >= ThreeDNow; } + bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; } +- bool hasAVX() const { return HasAVX; } ++ bool hasAVX() const { return false; } + bool hasAES() const { return HasAES; } + bool hasCLMUL() const { return HasCLMUL; } + bool hasFMA3() const { return HasFMA3; } +diff -up llvm-2.8/lib/Target/X86/X86.td.jx llvm-2.8/lib/Target/X86/X86.td +--- llvm-2.8/lib/Target/X86/X86.td.jx 2010-08-11 20:55:32.000000000 -0400 ++++ llvm-2.8/lib/Target/X86/X86.td 2011-04-26 16:02:21.127854790 -0400 +@@ -116,7 +116,8 @@ def : Proc<"westmere", [FeatureS + FeatureFastUAMem, FeatureAES]>; + // Sandy Bridge does not have FMA + // FIXME: Wikipedia says it does... it should have AES as well. +-def : Proc<"sandybridge", [FeatureSSE42, FeatureAVX, Feature64Bit]>; ++// FEDORA: AVX is broken in 2.8 ++def : Proc<"sandybridge", [FeatureSSE42, Feature64Bit]>; + + def : Proc<"k6", [FeatureMMX]>; + def : Proc<"k6-2", [FeatureMMX, Feature3DNow]>; +diff -up llvm-2.8/tools/clang/lib/Basic/Targets.cpp.jx llvm-2.8/tools/clang/lib/Basic/Targets.cpp +--- llvm-2.8/tools/clang/lib/Basic/Targets.cpp.jx 2010-08-31 12:44:54.000000000 -0400 ++++ llvm-2.8/tools/clang/lib/Basic/Targets.cpp 2011-04-26 16:03:40.768855658 -0400 +@@ -1048,8 +1048,6 @@ bool X86TargetInfo::setFeatureEnabled(ll + Features["3dnow"] = Features["3dnowa"] = true; + else if (Name == "aes") + Features["aes"] = true; +- else if (Name == "avx") +- Features["avx"] = true; + } else { + if (Name == "mmx") + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = +@@ -1101,7 +1099,6 @@ void X86TargetInfo::HandleTargetFeatures + // FIXME: Not sure yet how to treat AVX in regard to SSE levels. + // For now let it be enabled together with other SSE levels. + if (Features[i].substr(1) == "avx") { +- HasAVX = true; + continue; + } + +@@ -1146,9 +1143,6 @@ void X86TargetInfo::getTargetDefines(con + if (HasAES) + Builder.defineMacro("__AES__"); + +- if (HasAVX) +- Builder.defineMacro("__AVX__"); +- + // Target properties. + Builder.defineMacro("__LITTLE_ENDIAN__"); + diff --git a/llvm.spec b/llvm.spec index 27e4df4..77ee964 100644 --- a/llvm.spec +++ b/llvm.spec @@ -12,7 +12,7 @@ Name: llvm Version: 2.8 -Release: 10%{?dist} +Release: 11%{?dist} Summary: The Low Level Virtual Machine Group: Development/Languages @@ -26,6 +26,7 @@ Patch0: llvm-2.6-timestamp.patch # http://llvm.org/bugs/show_bug.cgi?id=8423 Patch1: llvm-2.8-alignOf.patch Patch2: clang-2.8-alignOf.patch +Patch3: llvm-2.8-disable-avx.patch BuildRequires: bison BuildRequires: chrpath @@ -211,6 +212,7 @@ mv clang-%{version} tools/clang pushd tools/clang %patch2 -p0 -b .alignOf popd +%patch3 -p1 -b .avx # Encoding fix #(cd tools/clang/docs && \ @@ -412,6 +414,9 @@ find examples -name 'Makefile' | xargs -0r rm -f %changelog +* Tue Apr 26 2011 Adam Jackson 2.8-11 +- llvm-2.8-disable-avx.patch: Disable AVX code generation. (#699896) + * Thu Mar 17 2011 Michel Salim - 2.8-10 - Don't include test logs; breaks multilib (# 666195) - Split shared libraries into separate subpackage