summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-05-01 02:56:15 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-05-01 02:56:15 +0000
commit9dd446c56162ce51e40f37941f48c86850302c9e (patch)
treec4812a6d15fe34b65cbe1b14443e8a4a8615a029 /test/CodeGen
parent8f92668f530d5d866a29ef45523fb7e13c92fa1a (diff)
downloadllvm-9dd446c56162ce51e40f37941f48c86850302c9e.tar.gz
llvm-9dd446c56162ce51e40f37941f48c86850302c9e.tar.bz2
llvm-9dd446c56162ce51e40f37941f48c86850302c9e.tar.xz
Split target dependent test portions to target-specific directories.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/Generic/vector.ll4
-rw-r--r--test/CodeGen/PowerPC/vector.ll157
-rw-r--r--test/CodeGen/X86/vector.ll157
3 files changed, 314 insertions, 4 deletions
diff --git a/test/CodeGen/Generic/vector.ll b/test/CodeGen/Generic/vector.ll
index 018ba6aab2..367d815079 100644
--- a/test/CodeGen/Generic/vector.ll
+++ b/test/CodeGen/Generic/vector.ll
@@ -1,10 +1,6 @@
; Test that vectors are scalarized/lowered correctly.
; RUN: llvm-upgrade < %s | llvm-as | llc
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple a-b-c
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g3
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=i386
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah
%f1 = type <1 x float>
%f2 = type <2 x float>
diff --git a/test/CodeGen/PowerPC/vector.ll b/test/CodeGen/PowerPC/vector.ll
new file mode 100644
index 0000000000..f8dbbb0823
--- /dev/null
+++ b/test/CodeGen/PowerPC/vector.ll
@@ -0,0 +1,157 @@
+; Test that vectors are scalarized/lowered correctly.
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g3
+
+%f1 = type <1 x float>
+%f2 = type <2 x float>
+%f4 = type <4 x float>
+%i4 = type <4 x int>
+%f8 = type <8 x float>
+%d8 = type <8 x double>
+
+implementation
+
+;;; TEST HANDLING OF VARIOUS VECTOR SIZES
+
+void %test_f1(%f1 *%P, %f1* %Q, %f1 *%S) {
+ %p = load %f1 *%P
+ %q = load %f1* %Q
+ %R = add %f1 %p, %q
+ store %f1 %R, %f1 *%S
+ ret void
+}
+
+void %test_f2(%f2 *%P, %f2* %Q, %f2 *%S) {
+ %p = load %f2* %P
+ %q = load %f2* %Q
+ %R = add %f2 %p, %q
+ store %f2 %R, %f2 *%S
+ ret void
+}
+
+void %test_f4(%f4 *%P, %f4* %Q, %f4 *%S) {
+ %p = load %f4* %P
+ %q = load %f4* %Q
+ %R = add %f4 %p, %q
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_f8(%f8 *%P, %f8* %Q, %f8 *%S) {
+ %p = load %f8* %P
+ %q = load %f8* %Q
+ %R = add %f8 %p, %q
+ store %f8 %R, %f8 *%S
+ ret void
+}
+
+void %test_fmul(%f8 *%P, %f8* %Q, %f8 *%S) {
+ %p = load %f8* %P
+ %q = load %f8* %Q
+ %R = mul %f8 %p, %q
+ store %f8 %R, %f8 *%S
+ ret void
+}
+
+void %test_div(%f8 *%P, %f8* %Q, %f8 *%S) {
+ %p = load %f8* %P
+ %q = load %f8* %Q
+ %R = div %f8 %p, %q
+ store %f8 %R, %f8 *%S
+ ret void
+}
+
+;;; TEST VECTOR CONSTRUCTS
+
+void %test_cst(%f4 *%P, %f4 *%S) {
+ %p = load %f4* %P
+ %R = add %f4 %p, <float 0.1, float 1.0, float 2.0, float 4.5>
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_zero(%f4 *%P, %f4 *%S) {
+ %p = load %f4* %P
+ %R = add %f4 %p, zeroinitializer
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_undef(%f4 *%P, %f4 *%S) {
+ %p = load %f4* %P
+ %R = add %f4 %p, undef
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_constant_insert(%f4 *%S) {
+ %R = insertelement %f4 zeroinitializer, float 10.0, uint 0
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_variable_buildvector(float %F, %f4 *%S) {
+ %R = insertelement %f4 zeroinitializer, float %F, uint 0
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_scalar_to_vector(float %F, %f4 *%S) {
+ %R = insertelement %f4 undef, float %F, uint 0 ;; R = scalar_to_vector F
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+float %test_extract_elt(%f8 *%P) {
+ %p = load %f8* %P
+ %R = extractelement %f8 %p, uint 3
+ ret float %R
+}
+
+double %test_extract_elt2(%d8 *%P) {
+ %p = load %d8* %P
+ %R = extractelement %d8 %p, uint 3
+ ret double %R
+}
+
+void %test_cast_1(<4 x float>* %b, <4 x int>* %a) {
+ %tmp = load <4 x float>* %b
+ %tmp2 = add <4 x float> %tmp, <float 1.0, float 2.0, float 3.0, float 4.0>
+ %tmp3 = cast <4 x float> %tmp2 to <4 x int>
+ %tmp4 = add <4 x int> %tmp3, <int 1, int 2, int 3, int 4>
+ store <4 x int> %tmp4, <4 x int>* %a
+ ret void
+}
+
+void %test_cast_2(<8 x float>* %a, <8 x int>* %b) {
+ %T = load <8 x float>* %a
+ %T2 = cast <8 x float> %T to <8 x int>
+ store <8 x int> %T2, <8 x int>* %b
+ ret void
+}
+
+
+;;; TEST IMPORTANT IDIOMS
+
+void %splat(%f4* %P, %f4* %Q, float %X) {
+ %tmp = insertelement %f4 undef, float %X, uint 0
+ %tmp2 = insertelement %f4 %tmp, float %X, uint 1
+ %tmp4 = insertelement %f4 %tmp2, float %X, uint 2
+ %tmp6 = insertelement %f4 %tmp4, float %X, uint 3
+ %q = load %f4* %Q
+ %R = add %f4 %q, %tmp6
+ store %f4 %R, %f4* %P
+ ret void
+}
+
+void %splat_i4(%i4* %P, %i4* %Q, int %X) {
+ %tmp = insertelement %i4 undef, int %X, uint 0
+ %tmp2 = insertelement %i4 %tmp, int %X, uint 1
+ %tmp4 = insertelement %i4 %tmp2, int %X, uint 2
+ %tmp6 = insertelement %i4 %tmp4, int %X, uint 3
+ %q = load %i4* %Q
+ %R = add %i4 %q, %tmp6
+ store %i4 %R, %i4* %P
+ ret void
+}
+
diff --git a/test/CodeGen/X86/vector.ll b/test/CodeGen/X86/vector.ll
new file mode 100644
index 0000000000..348d4d6ccf
--- /dev/null
+++ b/test/CodeGen/X86/vector.ll
@@ -0,0 +1,157 @@
+; Test that vectors are scalarized/lowered correctly.
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=i386
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah
+
+%f1 = type <1 x float>
+%f2 = type <2 x float>
+%f4 = type <4 x float>
+%i4 = type <4 x int>
+%f8 = type <8 x float>
+%d8 = type <8 x double>
+
+implementation
+
+;;; TEST HANDLING OF VARIOUS VECTOR SIZES
+
+void %test_f1(%f1 *%P, %f1* %Q, %f1 *%S) {
+ %p = load %f1 *%P
+ %q = load %f1* %Q
+ %R = add %f1 %p, %q
+ store %f1 %R, %f1 *%S
+ ret void
+}
+
+void %test_f2(%f2 *%P, %f2* %Q, %f2 *%S) {
+ %p = load %f2* %P
+ %q = load %f2* %Q
+ %R = add %f2 %p, %q
+ store %f2 %R, %f2 *%S
+ ret void
+}
+
+void %test_f4(%f4 *%P, %f4* %Q, %f4 *%S) {
+ %p = load %f4* %P
+ %q = load %f4* %Q
+ %R = add %f4 %p, %q
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_f8(%f8 *%P, %f8* %Q, %f8 *%S) {
+ %p = load %f8* %P
+ %q = load %f8* %Q
+ %R = add %f8 %p, %q
+ store %f8 %R, %f8 *%S
+ ret void
+}
+
+void %test_fmul(%f8 *%P, %f8* %Q, %f8 *%S) {
+ %p = load %f8* %P
+ %q = load %f8* %Q
+ %R = mul %f8 %p, %q
+ store %f8 %R, %f8 *%S
+ ret void
+}
+
+void %test_div(%f8 *%P, %f8* %Q, %f8 *%S) {
+ %p = load %f8* %P
+ %q = load %f8* %Q
+ %R = div %f8 %p, %q
+ store %f8 %R, %f8 *%S
+ ret void
+}
+
+;;; TEST VECTOR CONSTRUCTS
+
+void %test_cst(%f4 *%P, %f4 *%S) {
+ %p = load %f4* %P
+ %R = add %f4 %p, <float 0.1, float 1.0, float 2.0, float 4.5>
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_zero(%f4 *%P, %f4 *%S) {
+ %p = load %f4* %P
+ %R = add %f4 %p, zeroinitializer
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_undef(%f4 *%P, %f4 *%S) {
+ %p = load %f4* %P
+ %R = add %f4 %p, undef
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_constant_insert(%f4 *%S) {
+ %R = insertelement %f4 zeroinitializer, float 10.0, uint 0
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_variable_buildvector(float %F, %f4 *%S) {
+ %R = insertelement %f4 zeroinitializer, float %F, uint 0
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+void %test_scalar_to_vector(float %F, %f4 *%S) {
+ %R = insertelement %f4 undef, float %F, uint 0 ;; R = scalar_to_vector F
+ store %f4 %R, %f4 *%S
+ ret void
+}
+
+float %test_extract_elt(%f8 *%P) {
+ %p = load %f8* %P
+ %R = extractelement %f8 %p, uint 3
+ ret float %R
+}
+
+double %test_extract_elt2(%d8 *%P) {
+ %p = load %d8* %P
+ %R = extractelement %d8 %p, uint 3
+ ret double %R
+}
+
+void %test_cast_1(<4 x float>* %b, <4 x int>* %a) {
+ %tmp = load <4 x float>* %b
+ %tmp2 = add <4 x float> %tmp, <float 1.0, float 2.0, float 3.0, float 4.0>
+ %tmp3 = cast <4 x float> %tmp2 to <4 x int>
+ %tmp4 = add <4 x int> %tmp3, <int 1, int 2, int 3, int 4>
+ store <4 x int> %tmp4, <4 x int>* %a
+ ret void
+}
+
+void %test_cast_2(<8 x float>* %a, <8 x int>* %b) {
+ %T = load <8 x float>* %a
+ %T2 = cast <8 x float> %T to <8 x int>
+ store <8 x int> %T2, <8 x int>* %b
+ ret void
+}
+
+
+;;; TEST IMPORTANT IDIOMS
+
+void %splat(%f4* %P, %f4* %Q, float %X) {
+ %tmp = insertelement %f4 undef, float %X, uint 0
+ %tmp2 = insertelement %f4 %tmp, float %X, uint 1
+ %tmp4 = insertelement %f4 %tmp2, float %X, uint 2
+ %tmp6 = insertelement %f4 %tmp4, float %X, uint 3
+ %q = load %f4* %Q
+ %R = add %f4 %q, %tmp6
+ store %f4 %R, %f4* %P
+ ret void
+}
+
+void %splat_i4(%i4* %P, %i4* %Q, int %X) {
+ %tmp = insertelement %i4 undef, int %X, uint 0
+ %tmp2 = insertelement %i4 %tmp, int %X, uint 1
+ %tmp4 = insertelement %i4 %tmp2, int %X, uint 2
+ %tmp6 = insertelement %i4 %tmp4, int %X, uint 3
+ %q = load %i4* %Q
+ %R = add %i4 %q, %tmp6
+ store %i4 %R, %i4* %P
+ ret void
+}
+