summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2015-05-06 23:54:14 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2015-05-06 23:54:14 +0000
commit3058d0f08026583f1db33a040eac0f8f654dff41 (patch)
treed9b0454cc98a1d3b808dc8b2e5740c3915daaef8 /llvm/test/CodeGen
parent2e0d29fb09f7d559616bc756709630c14d31677e (diff)
downloadbcm5719-llvm-3058d0f08026583f1db33a040eac0f8f654dff41.tar.gz
bcm5719-llvm-3058d0f08026583f1db33a040eac0f8f654dff41.zip
Let llc and opt override "-target-cpu" and "-target-features" via command line
options. This commit fixes a bug in llc and opt where "-mcpu" and "-mattr" wouldn't override function attributes "-target-cpu" and "-target-features" in the IR. Differential Revision: http://reviews.llvm.org/D9537 llvm-svn: 236677
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/llc-override-mcpu-mattr.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/llc-override-mcpu-mattr.ll b/llvm/test/CodeGen/X86/llc-override-mcpu-mattr.ll
new file mode 100644
index 00000000000..52563bdba5b
--- /dev/null
+++ b/llvm/test/CodeGen/X86/llc-override-mcpu-mattr.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -march x86-64 -mcpu=broadwell | FileCheck %s
+; RUN: llc < %s -march x86-64 -mattr=+avx2 | FileCheck %s
+
+; Check that llc can overide function attributes target-cpu and target-features
+; using command line options -mcpu and -mattr.
+
+; CHECK: vpsadbw %ymm{{[0-9]+}}, %ymm{{[0-9]+}}, %ymm{{[0-9]+}}
+
+define <4 x i64> @foo1(<4 x i64> %s1, <4 x i64> %s2) #0 {
+entry:
+ %0 = bitcast <4 x i64> %s1 to <32 x i8>
+ %1 = bitcast <4 x i64> %s2 to <32 x i8>
+ %2 = tail call <4 x i64> @llvm.x86.avx2.psad.bw(<32 x i8> %0, <32 x i8> %1)
+ ret <4 x i64> %2
+}
+
+declare <4 x i64> @llvm.x86.avx2.psad.bw(<32 x i8>, <32 x i8>)
+
+attributes #0 = { "target-cpu"="core2" "target-features"="+ssse3,+cx16,+sse4.2,+sse4.1,+sse,+sse2,+sse3,+avx,+popcnt" }
OpenPOWER on IntegriCloud