diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2007-12-12 07:55:34 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2007-12-12 07:55:34 +0000 |
| commit | 0f42730722715555e082b854996b01b9b5655720 (patch) | |
| tree | aaf37ae6fc87e142c1781ef9ac1582c4c5770029 /llvm/test/CodeGen/X86 | |
| parent | 0a1254f634d928e7ec5c485b3fd845275506b577 (diff) | |
| download | bcm5719-llvm-0f42730722715555e082b854996b01b9b5655720.tar.gz bcm5719-llvm-0f42730722715555e082b854996b01b9b5655720.zip | |
Use shuffles to implement insert_vector_elt for i32, i64, f32, and f64.
llvm-svn: 44929
Diffstat (limited to 'llvm/test/CodeGen/X86')
| -rw-r--r-- | llvm/test/CodeGen/X86/2007-07-31-VInsertBug.ll | 16 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/vec_insert-2.ll | 23 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/vec_insert-3.ll | 6 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/vec_insert.ll | 23 |
4 files changed, 40 insertions, 28 deletions
diff --git a/llvm/test/CodeGen/X86/2007-07-31-VInsertBug.ll b/llvm/test/CodeGen/X86/2007-07-31-VInsertBug.ll deleted file mode 100644 index 1b13b080454..00000000000 --- a/llvm/test/CodeGen/X86/2007-07-31-VInsertBug.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -mattr=+sse2 | %prcontext {pinsrw \$2} 1 | grep "movl \$1" -; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -mattr=+sse2 | not grep movss - -@G = global <4 x float> zeroinitializer - -define void @test(i32 *%P1, i32* %P2, float *%FP) { - %T = load float* %FP - store i32 0, i32* %P1 - - %U = load <4 x float>* @G - store i32 1, i32* %P1 - %V = insertelement <4 x float> %U, float %T, i32 1 - store <4 x float> %V, <4 x float>* @G - - ret void -} diff --git a/llvm/test/CodeGen/X86/vec_insert-2.ll b/llvm/test/CodeGen/X86/vec_insert-2.ll new file mode 100644 index 00000000000..8fc97bfd211 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_insert-2.ll @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pinsrw | count 1 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movhpd | count 1 +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep unpcklpd | count 1 + +define <4 x float> @t1(float %s, <4 x float> %tmp) { + %tmp1 = insertelement <4 x float> %tmp, float %s, i32 3 + ret <4 x float> %tmp1 +} + +define <4 x i32> @t2(i32 %s, <4 x i32> %tmp) { + %tmp1 = insertelement <4 x i32> %tmp, i32 %s, i32 3 + ret <4 x i32> %tmp1 +} + +define <2 x double> @t3(double %s, <2 x double> %tmp) { + %tmp1 = insertelement <2 x double> %tmp, double %s, i32 1 + ret <2 x double> %tmp1 +} + +define <8 x i16> @t4(i16 %s, <8 x i16> %tmp) { + %tmp1 = insertelement <8 x i16> %tmp, i16 %s, i32 5 + ret <8 x i16> %tmp1 +} diff --git a/llvm/test/CodeGen/X86/vec_insert-3.ll b/llvm/test/CodeGen/X86/vec_insert-3.ll new file mode 100644 index 00000000000..1d374b4b9c6 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_insert-3.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep punpcklqdq | count 1 + +define <2 x i64> @t1(i64 %s, <2 x i64> %tmp) { + %tmp1 = insertelement <2 x i64> %tmp, i64 %s, i32 1 + ret <2 x i64> %tmp1 +} diff --git a/llvm/test/CodeGen/X86/vec_insert.ll b/llvm/test/CodeGen/X86/vec_insert.ll index 8ee0484fda1..c8c9f141ec1 100644 --- a/llvm/test/CodeGen/X86/vec_insert.ll +++ b/llvm/test/CodeGen/X86/vec_insert.ll @@ -1,20 +1,19 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 -o %t -f -; RUN: grep movss %t | count 1 -; RUN: grep pinsrw %t | count 2 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movss | count 1 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep pinsrw -void %test(<4 x float>* %F, int %I) { - %tmp = load <4 x float>* %F - %f = cast int %I to float - %tmp1 = insertelement <4 x float> %tmp, float %f, uint 0 - %tmp18 = add <4 x float> %tmp1, %tmp1 +define void @test(<4 x float>* %F, i32 %I) { + %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=1] + %f = sitofp i32 %I to float ; <float> [#uses=1] + %tmp1 = insertelement <4 x float> %tmp, float %f, i32 0 ; <<4 x float>> [#uses=2] + %tmp18 = add <4 x float> %tmp1, %tmp1 ; <<4 x float>> [#uses=1] store <4 x float> %tmp18, <4 x float>* %F ret void } -void %test2(<4 x float>* %F, int %I, float %g) { - %tmp = load <4 x float>* %F - %f = cast int %I to float - %tmp1 = insertelement <4 x float> %tmp, float %f, uint 2 +define void @test2(<4 x float>* %F, i32 %I, float %g) { + %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=1] + %f = sitofp i32 %I to float ; <float> [#uses=1] + %tmp1 = insertelement <4 x float> %tmp, float %f, i32 2 ; <<4 x float>> [#uses=1] store <4 x float> %tmp1, <4 x float>* %F ret void } |

