1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK
3 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK
5 define void @vls3i8(ptr align 8 %array) {
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: vsetivli zero, 3, e8, mf4, ta, ma
9 ; CHECK-NEXT: vle8.v v8, (a0)
10 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
11 ; CHECK-NEXT: vadd.vv v8, v8, v8
12 ; CHECK-NEXT: vsetivli zero, 3, e8, mf4, ta, ma
13 ; CHECK-NEXT: vse8.v v8, (a0)
16 %arr = getelementptr inbounds <3 x i8>, ptr %array, i64 0
17 %1 = load <3 x i8>, ptr %array, align 1
18 %2 = add<3 x i8> %1, %1
19 store <3 x i8> %2, ptr %array, align 1
23 define void @vls3(ptr align 8 %array) {
25 ; CHECK: # %bb.0: # %entry
26 ; CHECK-NEXT: vsetivli zero, 3, e32, m1, ta, ma
27 ; CHECK-NEXT: vle32.v v8, (a0)
28 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
29 ; CHECK-NEXT: vadd.vv v8, v8, v8
30 ; CHECK-NEXT: vsetivli zero, 3, e32, m1, ta, ma
31 ; CHECK-NEXT: vse32.v v8, (a0)
34 %arr = getelementptr inbounds <3 x i32>, ptr %array, i64 0
35 %1 = load <3 x i32>, ptr %array, align 4
36 %2 = add<3 x i32> %1, %1
37 store <3 x i32> %2, ptr %array, align 4
41 define void @vls5(ptr align 8 %array) {
43 ; CHECK: # %bb.0: # %entry
44 ; CHECK-NEXT: vsetivli zero, 5, e32, m2, ta, ma
45 ; CHECK-NEXT: vle32.v v8, (a0)
46 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
47 ; CHECK-NEXT: vadd.vv v8, v8, v8
48 ; CHECK-NEXT: vsetivli zero, 5, e32, m2, ta, ma
49 ; CHECK-NEXT: vse32.v v8, (a0)
52 %arr = getelementptr inbounds <5 x i32>, ptr %array, i64 0
53 %1 = load <5 x i32>, ptr %array, align 4
54 %2 = add<5 x i32> %1, %1
55 store <5 x i32> %2, ptr %array, align 4
59 define void @vls6(ptr align 8 %array) {
61 ; CHECK: # %bb.0: # %entry
62 ; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma
63 ; CHECK-NEXT: vle32.v v8, (a0)
64 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
65 ; CHECK-NEXT: vadd.vv v8, v8, v8
66 ; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma
67 ; CHECK-NEXT: vse32.v v8, (a0)
70 %arr = getelementptr inbounds <6 x i32>, ptr %array, i64 0
71 %1 = load <6 x i32>, ptr %array, align 4
72 %2 = add<6 x i32> %1, %1
73 store <6 x i32> %2, ptr %array, align 4
77 define void @vls7(ptr align 8 %array) {
79 ; CHECK: # %bb.0: # %entry
80 ; CHECK-NEXT: vsetivli zero, 7, e32, m2, ta, ma
81 ; CHECK-NEXT: vle32.v v8, (a0)
82 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
83 ; CHECK-NEXT: vadd.vv v8, v8, v8
84 ; CHECK-NEXT: vsetivli zero, 7, e32, m2, ta, ma
85 ; CHECK-NEXT: vse32.v v8, (a0)
88 %arr = getelementptr inbounds <7 x i32>, ptr %array, i64 0
89 %1 = load <7 x i32>, ptr %array, align 4
90 %2 = add<7 x i32> %1, %1
91 store <7 x i32> %2, ptr %array, align 4
96 define void @vls9(ptr align 8 %array) {
98 ; CHECK: # %bb.0: # %entry
99 ; CHECK-NEXT: vsetivli zero, 9, e32, m4, ta, ma
100 ; CHECK-NEXT: vle32.v v8, (a0)
101 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
102 ; CHECK-NEXT: vadd.vv v8, v8, v8
103 ; CHECK-NEXT: vsetivli zero, 9, e32, m4, ta, ma
104 ; CHECK-NEXT: vse32.v v8, (a0)
107 %arr = getelementptr inbounds <9 x i32>, ptr %array, i64 0
108 %1 = load <9 x i32>, ptr %array, align 4
109 %2 = add<9 x i32> %1, %1
110 store <9 x i32> %2, ptr %array, align 4
115 define void @vls10(ptr align 8 %array) {
116 ; CHECK-LABEL: vls10:
117 ; CHECK: # %bb.0: # %entry
118 ; CHECK-NEXT: vsetivli zero, 10, e32, m4, ta, ma
119 ; CHECK-NEXT: vle32.v v8, (a0)
120 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
121 ; CHECK-NEXT: vadd.vv v8, v8, v8
122 ; CHECK-NEXT: vsetivli zero, 10, e32, m4, ta, ma
123 ; CHECK-NEXT: vse32.v v8, (a0)
126 %arr = getelementptr inbounds <10 x i32>, ptr %array, i64 0
127 %1 = load <10 x i32>, ptr %array, align 4
128 %2 = add<10 x i32> %1, %1
129 store <10 x i32> %2, ptr %array, align 4
133 define void @vls11(ptr align 8 %array) {
134 ; CHECK-LABEL: vls11:
135 ; CHECK: # %bb.0: # %entry
136 ; CHECK-NEXT: vsetivli zero, 11, e32, m4, ta, ma
137 ; CHECK-NEXT: vle32.v v8, (a0)
138 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
139 ; CHECK-NEXT: vadd.vv v8, v8, v8
140 ; CHECK-NEXT: vsetivli zero, 11, e32, m4, ta, ma
141 ; CHECK-NEXT: vse32.v v8, (a0)
144 %arr = getelementptr inbounds <11 x i32>, ptr %array, i64 0
145 %1 = load <11 x i32>, ptr %array, align 4
146 %2 = add<11 x i32> %1, %1
147 store <11 x i32> %2, ptr %array, align 4