0d809fb4fbf1726a9962a89f9aa40c45e4731fb8
[oota-llvm.git] / test / CodeGen / Mips / msa / shift-dagcombine.ll
1 ; RUN: llc -march=mips -mattr=+msa,+fp64 < %s | FileCheck %s
2
3 define void @ashr_v4i32(<4 x i32>* %c) nounwind {
4   ; CHECK-LABEL: ashr_v4i32:
5
6   %1 = ashr <4 x i32> <i32 1, i32 2, i32 4, i32 8>,
7                       <i32 0, i32 1, i32 2, i32 3>
8   ; CHECK-NOT: sra
9   ; CHECK-DAG: ldi.w [[R1:\$w[0-9]+]], 1
10   ; CHECK-NOT: sra
11   store volatile <4 x i32> %1, <4 x i32>* %c
12   ; CHECK-DAG: st.w [[R1]], 0($4)
13
14   %2 = ashr <4 x i32> <i32 -2, i32 -4, i32 -8, i32 -16>,
15                       <i32 0, i32 1, i32 2, i32 3>
16   ; CHECK-NOT: sra
17   ; CHECK-DAG: ldi.w [[R1:\$w[0-9]+]], -2
18   ; CHECK-NOT: sra
19   store volatile <4 x i32> %2, <4 x i32>* %c
20   ; CHECK-DAG: st.w [[R1]], 0($4)
21
22   ret void
23   ; CHECK-LABEL: .size ashr_v4i32
24 }
25
26 define void @lshr_v4i32(<4 x i32>* %c) nounwind {
27   ; CHECK-LABEL: lshr_v4i32:
28
29   %1 = lshr <4 x i32> <i32 1, i32 2, i32 4, i32 8>,
30                       <i32 0, i32 1, i32 2, i32 3>
31   ; CHECK-NOT: srl
32   ; CHECK-DAG: ldi.w [[R1:\$w[0-9]+]], 1
33   ; CHECK-NOT: srl
34   store volatile <4 x i32> %1, <4 x i32>* %c
35   ; CHECK-DAG: st.w [[R1]], 0($4)
36
37   %2 = lshr <4 x i32> <i32 -2, i32 -4, i32 -8, i32 -16>,
38                       <i32 0, i32 1, i32 2, i32 3>
39   ; CHECK-NOT: srl
40   ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], %lo
41   ; CHECK-NOT: srl
42   store volatile <4 x i32> %2, <4 x i32>* %c
43   ; CHECK-DAG: st.w [[R1]], 0($4)
44
45   ret void
46   ; CHECK-LABEL: .size lshr_v4i32
47 }
48
49 define void @shl_v4i32(<4 x i32>* %c) nounwind {
50   ; CHECK-LABEL: shl_v4i32:
51
52   %1 = shl <4 x i32> <i32 8, i32 4, i32 2, i32 1>,
53                      <i32 0, i32 1, i32 2, i32 3>
54   ; CHECK-NOT: sll
55   ; CHECK-DAG: ldi.w [[R1:\$w[0-9]+]], 8
56   ; CHECK-NOT: sll
57   store volatile <4 x i32> %1, <4 x i32>* %c
58   ; CHECK-DAG: st.w [[R1]], 0($4)
59
60   %2 = shl <4 x i32> <i32 -8, i32 -4, i32 -2, i32 -1>,
61                      <i32 0, i32 1, i32 2, i32 3>
62   ; CHECK-NOT: sll
63   ; CHECK-DAG: ldi.w [[R1:\$w[0-9]+]], -8
64   ; CHECK-NOT: sll
65   store volatile <4 x i32> %2, <4 x i32>* %c
66   ; CHECK-DAG: st.w [[R1]], 0($4)
67
68   ret void
69   ; CHECK-LABEL: .size shl_v4i32
70 }