diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2013-11-12 10:45:18 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2013-11-12 10:45:18 +0000 |
commit | bb47fd04c9b1616c0371eb2c488c5f0f665c25f8 (patch) | |
tree | 50f9e859e8bebcf9e806d4b91547b657c33252b8 /test/CodeGen/Mips/msa/bitwise.ll | |
parent | 2ca352d027da26194deaa77ebc486df159e51c28 (diff) | |
download | external_llvm-bb47fd04c9b1616c0371eb2c488c5f0f665c25f8.zip external_llvm-bb47fd04c9b1616c0371eb2c488c5f0f665c25f8.tar.gz external_llvm-bb47fd04c9b1616c0371eb2c488c5f0f665c25f8.tar.bz2 |
[mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Mips/msa/bitwise.ll')
-rw-r--r-- | test/CodeGen/Mips/msa/bitwise.ll | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/msa/bitwise.ll b/test/CodeGen/Mips/msa/bitwise.ll index 2104921..5831a08 100644 --- a/test/CodeGen/Mips/msa/bitwise.ll +++ b/test/CodeGen/Mips/msa/bitwise.ll @@ -1243,6 +1243,78 @@ define void @binsr_v2i64_i(<2 x i64>* %c, <2 x i64>* %a, <2 x i64>* %b) nounwind ; CHECK: .size binsr_v2i64_i } +define void @bclr_v16i8(<16 x i8>* %c, <16 x i8>* %a, <16 x i8>* %b) nounwind { + ; CHECK: bclr_v16i8: + + %1 = load <16 x i8>* %a + ; CHECK-DAG: ld.b [[R1:\$w[0-9]+]], 0($5) + %2 = load <16 x i8>* %b + ; CHECK-DAG: ld.b [[R2:\$w[0-9]+]], 0($6) + %3 = shl <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>, %2 + %4 = xor <16 x i8> %3, <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> + %5 = and <16 x i8> %1, %4 + ; CHECK-DAG: bclr.b [[R3:\$w[0-9]+]], [[R1]], [[R2]] + store <16 x i8> %5, <16 x i8>* %c + ; CHECK-DAG: st.b [[R3]], 0($4) + + ret void + ; CHECK: .size bclr_v16i8 +} + +define void @bclr_v8i16(<8 x i16>* %c, <8 x i16>* %a, <8 x i16>* %b) nounwind { + ; CHECK: bclr_v8i16: + + %1 = load <8 x i16>* %a + ; CHECK-DAG: ld.h [[R1:\$w[0-9]+]], 0($5) + %2 = load <8 x i16>* %b + ; CHECK-DAG: ld.h [[R2:\$w[0-9]+]], 0($6) + %3 = shl <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, %2 + %4 = xor <8 x i16> %3, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + %5 = and <8 x i16> %1, %4 + ; CHECK-DAG: bclr.h [[R3:\$w[0-9]+]], [[R1]], [[R2]] + store <8 x i16> %5, <8 x i16>* %c + ; CHECK-DAG: st.h [[R3]], 0($4) + + ret void + ; CHECK: .size bclr_v8i16 +} + +define void @bclr_v4i32(<4 x i32>* %c, <4 x i32>* %a, <4 x i32>* %b) nounwind { + ; CHECK: bclr_v4i32: + + %1 = load <4 x i32>* %a + ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5) + %2 = load <4 x i32>* %b + ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6) + %3 = shl <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %2 + %4 = xor <4 x i32> %3, <i32 -1, i32 -1, i32 -1, i32 -1> + %5 = and <4 x i32> %1, %4 + ; CHECK-DAG: bclr.w [[R3:\$w[0-9]+]], [[R1]], [[R2]] + store <4 x i32> %5, <4 x i32>* %c + ; CHECK-DAG: st.w [[R3]], 0($4) + + ret void + ; CHECK: .size bclr_v4i32 +} + +define void @bclr_v2i64(<2 x i64>* %c, <2 x i64>* %a, <2 x i64>* %b) nounwind { + ; CHECK: bclr_v2i64: + + %1 = load <2 x i64>* %a + ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5) + %2 = load <2 x i64>* %b + ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6) + %3 = shl <2 x i64> <i64 1, i64 1>, %2 + %4 = xor <2 x i64> %3, <i64 -1, i64 -1> + %5 = and <2 x i64> %1, %4 + ; CHECK-DAG: bclr.d [[R3:\$w[0-9]+]], [[R1]], [[R2]] + store <2 x i64> %5, <2 x i64>* %c + ; CHECK-DAG: st.d [[R3]], 0($4) + + ret void + ; CHECK: .size bclr_v2i64 +} + define void @bset_v16i8(<16 x i8>* %c, <16 x i8>* %a, <16 x i8>* %b) nounwind { ; CHECK: bset_v16i8: @@ -1379,6 +1451,71 @@ define void @bneg_v2i64(<2 x i64>* %c, <2 x i64>* %a, <2 x i64>* %b) nounwind { ; CHECK: .size bneg_v2i64 } +define void @bclri_v16i8(<16 x i8>* %c, <16 x i8>* %a) nounwind { + ; CHECK: bclri_v16i8: + + %1 = load <16 x i8>* %a + ; CHECK-DAG: ld.b [[R1:\$w[0-9]+]], 0($5) + %2 = xor <16 x i8> <i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8>, + <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> + %3 = and <16 x i8> %1, %2 + ; bclri.b and andi.b are exactly equivalent. + ; CHECK-DAG: andi.b [[R3:\$w[0-9]+]], [[R1]], 247 + store <16 x i8> %3, <16 x i8>* %c + ; CHECK-DAG: st.b [[R3]], 0($4) + + ret void + ; CHECK: .size bclri_v16i8 +} + +define void @bclri_v8i16(<8 x i16>* %c, <8 x i16>* %a) nounwind { + ; CHECK: bclri_v8i16: + + %1 = load <8 x i16>* %a + ; CHECK-DAG: ld.h [[R1:\$w[0-9]+]], 0($5) + %2 = xor <8 x i16> <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>, + <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + %3 = and <8 x i16> %1, %2 + ; CHECK-DAG: bclri.h [[R3:\$w[0-9]+]], [[R1]], 3 + store <8 x i16> %3, <8 x i16>* %c + ; CHECK-DAG: st.h [[R3]], 0($4) + + ret void + ; CHECK: .size bclri_v8i16 +} + +define void @bclri_v4i32(<4 x i32>* %c, <4 x i32>* %a) nounwind { + ; CHECK: bclri_v4i32: + + %1 = load <4 x i32>* %a + ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5) + %2 = xor <4 x i32> <i32 8, i32 8, i32 8, i32 8>, + <i32 -1, i32 -1, i32 -1, i32 -1> + %3 = and <4 x i32> %1, %2 + ; CHECK-DAG: bclri.w [[R3:\$w[0-9]+]], [[R1]], 3 + store <4 x i32> %3, <4 x i32>* %c + ; CHECK-DAG: st.w [[R3]], 0($4) + + ret void + ; CHECK: .size bclri_v4i32 +} + +define void @bclri_v2i64(<2 x i64>* %c, <2 x i64>* %a) nounwind { + ; CHECK: bclri_v2i64: + + %1 = load <2 x i64>* %a + ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5) + %2 = xor <2 x i64> <i64 8, i64 8>, + <i64 -1, i64 -1> + %3 = and <2 x i64> %1, %2 + ; CHECK-DAG: bclri.d [[R3:\$w[0-9]+]], [[R1]], 3 + store <2 x i64> %3, <2 x i64>* %c + ; CHECK-DAG: st.d [[R3]], 0($4) + + ret void + ; CHECK: .size bclri_v2i64 +} + define void @bseti_v16i8(<16 x i8>* %c, <16 x i8>* %a) nounwind { ; CHECK: bseti_v16i8: |