[llvm-commits] [dragonegg] r166097 - in /dragonegg/trunk: include/arm/dragonegg/Target.h src/x86/Target.cpp test/validator/c/TargetAttributes.c test/validator/validator-lit.cfg

Duncan Sands baldrick at free.fr
Wed Oct 17 05:00:51 PDT 2012


Author: baldrick
Date: Wed Oct 17 07:00:50 2012
New Revision: 166097

URL: http://llvm.org/viewvc/llvm-project?rev=166097&view=rev
Log:
Specifying -mno-sse (or similar) wasn't actually turning off SSE!
Replace the mysterious system used to fiddle target attributes
(inherited from llvm-gcc, where presumably it worked) with something
a lot simpler that actually works with modern gcc.  Noticed by "tob"
on IRC.

Added:
    dragonegg/trunk/test/validator/c/TargetAttributes.c
Modified:
    dragonegg/trunk/include/arm/dragonegg/Target.h
    dragonegg/trunk/src/x86/Target.cpp
    dragonegg/trunk/test/validator/validator-lit.cfg

Modified: dragonegg/trunk/include/arm/dragonegg/Target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/arm/dragonegg/Target.h?rev=166097&r1=166096&r2=166097&view=diff
==============================================================================
--- dragonegg/trunk/include/arm/dragonegg/Target.h (original)
+++ dragonegg/trunk/include/arm/dragonegg/Target.h Wed Oct 17 07:00:50 2012
@@ -169,23 +169,11 @@
       C = ("arm7tdmi"); \
       break; \
     } \
-    if (TARGET_VFP3)            \
-      F.AddFeature("vfp3");         \
-    else {              \
-      F.AddFeature("vfp3", false);        \
-      if (TARGET_VFP && TARGET_HARD_FLOAT)      \
-        F.AddFeature("vfp2");         \
-      else              \
-        F.AddFeature("vfp2", false);        \
-    }               \
-    if (TARGET_NEON)            \
-      F.AddFeature("neon");         \
-    else              \
-      F.AddFeature("neon", false);        \
-    if (TARGET_FP16)            \
-      F.AddFeature("fp16");         \
-    else              \
-      F.AddFeature("fp16", false);        \
+    F.AddFeature("vfp3", TARGET_VFP3);                        \
+    if (!TARGET_VFP3)                                         \
+      F.AddFeature("vfp2", TARGET_VFP && TARGET_HARD_FLOAT);  \
+    F.AddFeature("neon", TARGET_NEON);                        \
+    F.AddFeature("fp16", TARGET_FP16);                        \
   }
 
 /* Encode arm / thumb modes and arm subversion number in the triplet. e.g.

Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=166097&r1=166096&r2=166097&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Wed Oct 17 07:00:50 2012
@@ -1850,95 +1850,24 @@
   else
     C = ix86_arch_string;
 
-  if (TARGET_64BIT)
-    F.AddFeature("64bit");
-  else if (target_flags_explicit & OPTION_MASK_ISA_64BIT)
-    F.AddFeature("64bit", false);
-
-  if (TARGET_3DNOW)
-    F.AddFeature("3dnow");
-  else if (target_flags_explicit & OPTION_MASK_ISA_3DNOW)
-    F.AddFeature("3dnow", false);
-
-  if (TARGET_3DNOW_A)
-    F.AddFeature("3dnowa");
-  else if (target_flags_explicit & OPTION_MASK_ISA_3DNOW_A)
-    F.AddFeature("3dnowa", false);
-
-  if (TARGET_AES)
-    F.AddFeature("aes");
-  else if (target_flags_explicit & OPTION_MASK_ISA_AES)
-    F.AddFeature("aes", false);
-
-  if (TARGET_AVX)
-    F.AddFeature("avx");
-  else if (target_flags_explicit & OPTION_MASK_ISA_AVX)
-    F.AddFeature("avx", false);
-
-  if (TARGET_CMPXCHG16B)
-    F.AddFeature("cmpxchg16b");
-  else if (target_flags_explicit & OPTION_MASK_ISA_CX16)
-    F.AddFeature("cmpxchg16b", false);
-
-  if (TARGET_FMA)
-    F.AddFeature("fma");
-  else if (target_flags_explicit & OPTION_MASK_ISA_FMA)
-    F.AddFeature("fma", false);
-
-  if (TARGET_FMA4)
-    F.AddFeature("fma4");
-  else if (target_flags_explicit & OPTION_MASK_ISA_FMA4)
-    F.AddFeature("fma4", false);
-
-  if (TARGET_MMX)
-    F.AddFeature("mmx");
-  else if (target_flags_explicit & OPTION_MASK_ISA_MMX)
-    F.AddFeature("mmx", false);
-
-  if (TARGET_POPCNT)
-    F.AddFeature("popcnt");
-  else if (target_flags_explicit & OPTION_MASK_ISA_POPCNT)
-    F.AddFeature("popcnt", false);
-
+  F.AddFeature("64bit", TARGET_64BIT);
+  F.AddFeature("3dnow", TARGET_3DNOW);
+  F.AddFeature("3dnowa", TARGET_3DNOW_A);
+  F.AddFeature("aes", TARGET_AES);
+  F.AddFeature("avx", TARGET_AVX);
+  F.AddFeature("cmpxchg16b", TARGET_CMPXCHG16B);
+  F.AddFeature("fma", TARGET_FMA);
+  F.AddFeature("fma4", TARGET_FMA4);
+  F.AddFeature("mmx", TARGET_MMX);
+  F.AddFeature("popcnt", TARGET_POPCNT);
 #ifdef TARGET_RDRND
-  if (TARGET_RDRND)
-    F.AddFeature("rdrand");
-  else if (target_flags_explicit & OPTION_MASK_ISA_RDRND)
-    F.AddFeature("rdrand", false);
+  F.AddFeature("rdrand", TARGET_RDRND);
 #endif
-
-  if (TARGET_SSE)
-    F.AddFeature("sse");
-  else if (target_flags_explicit & OPTION_MASK_ISA_SSE)
-    F.AddFeature("sse", false);
-
-  if (TARGET_SSE2)
-    F.AddFeature("sse2");
-  else if (target_flags_explicit & OPTION_MASK_ISA_SSE2)
-    F.AddFeature("sse2", false);
-
-  if (TARGET_SSE3)
-    F.AddFeature("sse3");
-  else if (target_flags_explicit & OPTION_MASK_ISA_SSE3)
-    F.AddFeature("sse3", false);
-
-  if (TARGET_SSE4_1)
-    F.AddFeature("sse41");
-  else if (target_flags_explicit & OPTION_MASK_ISA_SSE4_1)
-    F.AddFeature("sse41", false);
-
-  if (TARGET_SSE4_2)
-    F.AddFeature("sse42");
-  else if (target_flags_explicit & OPTION_MASK_ISA_SSE4_2)
-    F.AddFeature("sse42", false);
-
-  if (TARGET_SSE4A)
-    F.AddFeature("sse4a");
-  else if (target_flags_explicit & OPTION_MASK_ISA_SSE4A)
-    F.AddFeature("sse4a", false);
-
-  if (TARGET_SSSE3)
-    F.AddFeature("ssse3");
-  else if (target_flags_explicit & OPTION_MASK_ISA_SSSE3)
-    F.AddFeature("ssse3", false);
+  F.AddFeature("sse", TARGET_SSE);
+  F.AddFeature("sse2", TARGET_SSE2);
+  F.AddFeature("sse3", TARGET_SSE3);
+  F.AddFeature("sse41", TARGET_SSE4_1);
+  F.AddFeature("sse42", TARGET_SSE4_2);
+  F.AddFeature("sse4a", TARGET_SSE4A);
+  F.AddFeature("ssse3", TARGET_SSSE3);
 }

Added: dragonegg/trunk/test/validator/c/TargetAttributes.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/TargetAttributes.c?rev=166097&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/TargetAttributes.c (added)
+++ dragonegg/trunk/test/validator/c/TargetAttributes.c Wed Oct 17 07:00:50 2012
@@ -0,0 +1,12 @@
+// RUN: %eggdragon -O1 -S %s -o - -msse | FileCheck %s --check-prefix=CHECK-SSE
+// RUN: %eggdragon -O1 -S %s -o - -mno-sse | FileCheck %s --check-prefix=CHECK-NOSSE
+
+void bar(char *);
+
+void foo(void) {
+  char buf[32] __attribute__ ((aligned (16)));
+  memset(buf, 0, sizeof(buf));
+// CHECK-SSE: movaps
+// CHECK-NOSSE-NOT: xmm
+  bar(buf);
+}

Modified: dragonegg/trunk/test/validator/validator-lit.cfg
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/validator-lit.cfg?rev=166097&r1=166096&r2=166097&view=diff
==============================================================================
--- dragonegg/trunk/test/validator/validator-lit.cfg (original)
+++ dragonegg/trunk/test/validator/validator-lit.cfg Wed Oct 17 07:00:50 2012
@@ -51,6 +51,11 @@
 if lit.useValgrind:
     config.target_triple += '-vg'
 
+# %dragonegg means: run dragonegg and output LLVM IR.
 config.substitutions.append( ('%dragonegg', '%s -fplugin=%s '
                               '-fplugin-arg-dragonegg-emit-ir' %
                               (config.gcc_executable, config.dragonegg_plugin)))
+
+# %eggdragon means: run dragonegg and output target assembler.
+config.substitutions.append( ('%eggdragon', '%s -fplugin=%s ' %
+                              (config.gcc_executable, config.dragonegg_plugin)))





More information about the llvm-commits mailing list