diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2013-09-23 12:02:46 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2013-09-23 12:02:46 +0000 |
commit | da521cc1cc733ee1c27b00e4c0e365c8b702e2e0 (patch) | |
tree | 915376214ba144986936e599af7f9b6005df7974 /test/CodeGen/Mips | |
parent | 669b9668619eb167639bb6f3b0841eda7da78d6c (diff) | |
download | external_llvm-da521cc1cc733ee1c27b00e4c0e365c8b702e2e0.zip external_llvm-da521cc1cc733ee1c27b00e4c0e365c8b702e2e0.tar.gz external_llvm-da521cc1cc733ee1c27b00e4c0e365c8b702e2e0.tar.bz2 |
[mips][msa] Implemented build_vector using ldi, fill, and custom SelectionDAG nodes (VSPLAT and VSPLATD)
Note: There's a later patch on my branch that re-implements this to select
build_vector without the custom SelectionDAG nodes. The future patch avoids
the constant-folding problems stemming from the custom node (i.e. it doesn't
need to re-implement all the DAG combines related to BUILD_VECTOR).
Changes to MIPS specific SelectionDAG nodes:
* Added VSPLAT
This is a special case of BUILD_VECTOR that covers the case the
BUILD_VECTOR is a splat operation.
* Added VSPLATD
This is a special case of VSPLAT that handles the cases when v2i64 is legal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Mips')
-rw-r--r-- | test/CodeGen/Mips/msa/basic_operations.ll | 120 | ||||
-rw-r--r-- | test/CodeGen/Mips/msa/basic_operations_float.ll | 57 |
2 files changed, 177 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/msa/basic_operations.ll b/test/CodeGen/Mips/msa/basic_operations.ll new file mode 100644 index 0000000..4cec6aa --- /dev/null +++ b/test/CodeGen/Mips/msa/basic_operations.ll @@ -0,0 +1,120 @@ +; RUN: llc -march=mips -mattr=+msa < %s | FileCheck -check-prefix=MIPS32 %s + +@v16i8 = global <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0> +@v8i16 = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0> +@v4i32 = global <4 x i32> <i32 0, i32 0, i32 0, i32 0> +@v2i64 = global <2 x i64> <i64 0, i64 0> +@i64 = global i64 0 + +define void @const_v16i8() nounwind { + ; MIPS32: const_v16i8: + + store volatile <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, <16 x i8>*@v16i8 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 0 + + store volatile <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>*@v16i8 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 1 + + store volatile <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 31>, <16 x i8>*@v16i8 + ; MIPS32: ld.b [[R1:\$w[0-9]+]], %lo( + + store volatile <16 x i8> <i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6>, <16 x i8>*@v16i8 + ; MIPS32: ld.b [[R1:\$w[0-9]+]], %lo( + + store volatile <16 x i8> <i8 1, i8 2, i8 1, i8 2, i8 1, i8 2, i8 1, i8 2, i8 1, i8 2, i8 1, i8 2, i8 1, i8 2, i8 1, i8 2>, <16 x i8>*@v16i8 + ; MIPS32: ldi.h [[R1:\$w[0-9]+]], 258 + + store volatile <16 x i8> <i8 1, i8 2, i8 3, i8 4, i8 1, i8 2, i8 3, i8 4, i8 1, i8 2, i8 3, i8 4, i8 1, i8 2, i8 3, i8 4>, <16 x i8>*@v16i8 + ; MIPS32-DAG: lui [[R2:\$[0-9]+]], 258 + ; MIPS32-DAG: ori [[R2]], [[R2]], 772 + ; MIPS32-DAG: fill.w [[R1:\$w[0-9]+]], [[R2]] + + store volatile <16 x i8> <i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8>, <16 x i8>*@v16i8 + ; MIPS32: ld.b [[R1:\$w[0-9]+]], %lo( + + ret void + ; MIPS32: .size const_v16i8 +} + +define void @const_v8i16() nounwind { + ; MIPS32: const_v8i16: + + store volatile <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, <8 x i16>*@v8i16 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 0 + + store volatile <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16>*@v8i16 + ; MIPS32: ldi.h [[R1:\$w[0-9]+]], 1 + + store volatile <8 x i16> <i16 1, i16 1, i16 1, i16 2, i16 1, i16 1, i16 1, i16 31>, <8 x i16>*@v8i16 + ; MIPS32: ld.h [[R1:\$w[0-9]+]], %lo( + + store volatile <8 x i16> <i16 1028, i16 1028, i16 1028, i16 1028, i16 1028, i16 1028, i16 1028, i16 1028>, <8 x i16>*@v8i16 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 4 + + store volatile <8 x i16> <i16 1, i16 2, i16 1, i16 2, i16 1, i16 2, i16 1, i16 2>, <8 x i16>*@v8i16 + ; MIPS32-DAG: lui [[R2:\$[0-9]+]], 1 + ; MIPS32-DAG: ori [[R2]], [[R2]], 2 + ; MIPS32-DAG: fill.w [[R1:\$w[0-9]+]], [[R2]] + + store volatile <8 x i16> <i16 1, i16 2, i16 3, i16 4, i16 1, i16 2, i16 3, i16 4>, <8 x i16>*@v8i16 + ; MIPS32: ld.h [[R1:\$w[0-9]+]], %lo( + + ret void + ; MIPS32: .size const_v8i16 +} + +define void @const_v4i32() nounwind { + ; MIPS32: const_v4i32: + + store volatile <4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32>*@v4i32 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 0 + + store volatile <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>*@v4i32 + ; MIPS32: ldi.w [[R1:\$w[0-9]+]], 1 + + store volatile <4 x i32> <i32 1, i32 1, i32 1, i32 31>, <4 x i32>*@v4i32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <4 x i32> <i32 16843009, i32 16843009, i32 16843009, i32 16843009>, <4 x i32>*@v4i32 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 1 + + store volatile <4 x i32> <i32 65537, i32 65537, i32 65537, i32 65537>, <4 x i32>*@v4i32 + ; MIPS32: ldi.h [[R1:\$w[0-9]+]], 1 + + store volatile <4 x i32> <i32 1, i32 2, i32 1, i32 2>, <4 x i32>*@v4i32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <4 x i32> <i32 3, i32 4, i32 5, i32 6>, <4 x i32>*@v4i32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + ret void + ; MIPS32: .size const_v4i32 +} + +define void @const_v2i64() nounwind { + ; MIPS32: const_v2i64: + + store volatile <2 x i64> <i64 0, i64 0>, <2 x i64>*@v2i64 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 0 + + store volatile <2 x i64> <i64 72340172838076673, i64 72340172838076673>, <2 x i64>*@v2i64 + ; MIPS32: ldi.b [[R1:\$w[0-9]+]], 1 + + store volatile <2 x i64> <i64 281479271743489, i64 281479271743489>, <2 x i64>*@v2i64 + ; MIPS32: ldi.h [[R1:\$w[0-9]+]], 1 + + store volatile <2 x i64> <i64 4294967297, i64 4294967297>, <2 x i64>*@v2i64 + ; MIPS32: ldi.w [[R1:\$w[0-9]+]], 1 + + store volatile <2 x i64> <i64 1, i64 1>, <2 x i64>*@v2i64 + ; MIPS32: ldi.d [[R1:\$w[0-9]+]], 1 + + store volatile <2 x i64> <i64 1, i64 31>, <2 x i64>*@v2i64 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <2 x i64> <i64 3, i64 4>, <2 x i64>*@v2i64 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + ret void + ; MIPS32: .size const_v2i64 +} diff --git a/test/CodeGen/Mips/msa/basic_operations_float.ll b/test/CodeGen/Mips/msa/basic_operations_float.ll new file mode 100644 index 0000000..1921375 --- /dev/null +++ b/test/CodeGen/Mips/msa/basic_operations_float.ll @@ -0,0 +1,57 @@ +; RUN: llc -march=mips -mattr=+msa < %s | FileCheck -check-prefix=MIPS32 %s + +@v4f32 = global <4 x float> <float 0.0, float 0.0, float 0.0, float 0.0> +@v2f64 = global <2 x double> <double 0.0, double 0.0> + +define void @const_v4f32() nounwind { + ; MIPS32: const_v4f32: + + store volatile <4 x float> <float 0.0, float 0.0, float 0.0, float 0.0>, <4 x float>*@v4f32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, <4 x float>*@v4f32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <4 x float> <float 1.0, float 1.0, float 1.0, float 31.0>, <4 x float>*@v4f32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <4 x float> <float 65537.0, float 65537.0, float 65537.0, float 65537.0>, <4 x float>*@v4f32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <4 x float> <float 1.0, float 2.0, float 1.0, float 2.0>, <4 x float>*@v4f32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + store volatile <4 x float> <float 3.0, float 4.0, float 5.0, float 6.0>, <4 x float>*@v4f32 + ; MIPS32: ld.w [[R1:\$w[0-9]+]], %lo( + + ret void + ; MIPS32: .size const_v4f32 +} + +define void @const_v2f64() nounwind { + ; MIPS32: const_v2f64: + + store volatile <2 x double> <double 0.0, double 0.0>, <2 x double>*@v2f64 + ; MIPS32: ld.d [[R1:\$w[0-9]+]], %lo( + + store volatile <2 x double> <double 72340172838076673.0, double 72340172838076673.0>, <2 x double>*@v2f64 + ; MIPS32: ld.d [[R1:\$w[0-9]+]], %lo( + + store volatile <2 x double> <double 281479271743489.0, double 281479271743489.0>, <2 x double>*@v2f64 + ; MIPS32: ld.d [[R1:\$w[0-9]+]], %lo( + + store volatile <2 x double> <double 4294967297.0, double 4294967297.0>, <2 x double>*@v2f64 + ; MIPS32: ld.d [[R1:\$w[0-9]+]], %lo( + + store volatile <2 x double> <double 1.0, double 1.0>, <2 x double>*@v2f64 + ; MIPS32: ld.d [[R1:\$w[0-9]+]], %lo( + + store volatile <2 x double> <double 1.0, double 31.0>, <2 x double>*@v2f64 + ; MIPS32: ld.d [[R1:\$w[0-9]+]], %lo( + + store volatile <2 x double> <double 3.0, double 4.0>, <2 x double>*@v2f64 + ; MIPS32: ld.d [[R1:\$w[0-9]+]], %lo( + + ret void + ; MIPS32: .size const_v2f64 +} |