1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=8 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX8
3 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=8 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX8
4 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1
5 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1
7 define void @gather_const_v8f16(ptr %x) {
8 ; CHECK-LABEL: gather_const_v8f16:
10 ; CHECK-NEXT: addi a1, a0, 10
11 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
12 ; CHECK-NEXT: vlse16.v v8, (a1), zero
13 ; CHECK-NEXT: vse16.v v8, (a0)
15 %a = load <8 x half>, ptr %x
16 %b = extractelement <8 x half> %a, i32 5
17 %c = insertelement <8 x half> poison, half %b, i32 0
18 %d = shufflevector <8 x half> %c, <8 x half> poison, <8 x i32> zeroinitializer
19 store <8 x half> %d, ptr %x
23 define void @gather_const_v4f32(ptr %x) {
24 ; CHECK-LABEL: gather_const_v4f32:
26 ; CHECK-NEXT: addi a1, a0, 8
27 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
28 ; CHECK-NEXT: vlse32.v v8, (a1), zero
29 ; CHECK-NEXT: vse32.v v8, (a0)
31 %a = load <4 x float>, ptr %x
32 %b = extractelement <4 x float> %a, i32 2
33 %c = insertelement <4 x float> poison, float %b, i32 0
34 %d = shufflevector <4 x float> %c, <4 x float> poison, <4 x i32> zeroinitializer
35 store <4 x float> %d, ptr %x
39 define void @gather_const_v2f64(ptr %x) {
40 ; CHECK-LABEL: gather_const_v2f64:
42 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
43 ; CHECK-NEXT: vlse64.v v8, (a0), zero
44 ; CHECK-NEXT: vse64.v v8, (a0)
46 %a = load <2 x double>, ptr %x
47 %b = extractelement <2 x double> %a, i32 0
48 %c = insertelement <2 x double> poison, double %b, i32 0
49 %d = shufflevector <2 x double> %c, <2 x double> poison, <2 x i32> zeroinitializer
50 store <2 x double> %d, ptr %x
54 define void @gather_const_v64f16(ptr %x) {
55 ; LMULMAX8-LABEL: gather_const_v64f16:
57 ; LMULMAX8-NEXT: li a1, 64
58 ; LMULMAX8-NEXT: addi a2, a0, 94
59 ; LMULMAX8-NEXT: vsetvli zero, a1, e16, m8, ta, ma
60 ; LMULMAX8-NEXT: vlse16.v v8, (a2), zero
61 ; LMULMAX8-NEXT: vse16.v v8, (a0)
64 ; LMULMAX1-LABEL: gather_const_v64f16:
66 ; LMULMAX1-NEXT: addi a1, a0, 80
67 ; LMULMAX1-NEXT: addi a2, a0, 16
68 ; LMULMAX1-NEXT: addi a3, a0, 48
69 ; LMULMAX1-NEXT: addi a4, a0, 32
70 ; LMULMAX1-NEXT: addi a5, a0, 94
71 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
72 ; LMULMAX1-NEXT: vlse16.v v8, (a5), zero
73 ; LMULMAX1-NEXT: addi a5, a0, 64
74 ; LMULMAX1-NEXT: addi a6, a0, 112
75 ; LMULMAX1-NEXT: addi a7, a0, 96
76 ; LMULMAX1-NEXT: vse16.v v8, (a7)
77 ; LMULMAX1-NEXT: vse16.v v8, (a6)
78 ; LMULMAX1-NEXT: vse16.v v8, (a5)
79 ; LMULMAX1-NEXT: vse16.v v8, (a1)
80 ; LMULMAX1-NEXT: vse16.v v8, (a4)
81 ; LMULMAX1-NEXT: vse16.v v8, (a3)
82 ; LMULMAX1-NEXT: vse16.v v8, (a0)
83 ; LMULMAX1-NEXT: vse16.v v8, (a2)
85 %a = load <64 x half>, ptr %x
86 %b = extractelement <64 x half> %a, i32 47
87 %c = insertelement <64 x half> poison, half %b, i32 0
88 %d = shufflevector <64 x half> %c, <64 x half> poison, <64 x i32> zeroinitializer
89 store <64 x half> %d, ptr %x
93 define void @gather_const_v32f32(ptr %x) {
94 ; LMULMAX8-LABEL: gather_const_v32f32:
96 ; LMULMAX8-NEXT: li a1, 32
97 ; LMULMAX8-NEXT: addi a2, a0, 68
98 ; LMULMAX8-NEXT: vsetvli zero, a1, e32, m8, ta, ma
99 ; LMULMAX8-NEXT: vlse32.v v8, (a2), zero
100 ; LMULMAX8-NEXT: vse32.v v8, (a0)
103 ; LMULMAX1-LABEL: gather_const_v32f32:
105 ; LMULMAX1-NEXT: addi a1, a0, 64
106 ; LMULMAX1-NEXT: addi a2, a0, 16
107 ; LMULMAX1-NEXT: addi a3, a0, 48
108 ; LMULMAX1-NEXT: addi a4, a0, 32
109 ; LMULMAX1-NEXT: addi a5, a0, 68
110 ; LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
111 ; LMULMAX1-NEXT: vlse32.v v8, (a5), zero
112 ; LMULMAX1-NEXT: addi a5, a0, 80
113 ; LMULMAX1-NEXT: addi a6, a0, 112
114 ; LMULMAX1-NEXT: addi a7, a0, 96
115 ; LMULMAX1-NEXT: vse32.v v8, (a7)
116 ; LMULMAX1-NEXT: vse32.v v8, (a6)
117 ; LMULMAX1-NEXT: vse32.v v8, (a1)
118 ; LMULMAX1-NEXT: vse32.v v8, (a5)
119 ; LMULMAX1-NEXT: vse32.v v8, (a4)
120 ; LMULMAX1-NEXT: vse32.v v8, (a3)
121 ; LMULMAX1-NEXT: vse32.v v8, (a0)
122 ; LMULMAX1-NEXT: vse32.v v8, (a2)
124 %a = load <32 x float>, ptr %x
125 %b = extractelement <32 x float> %a, i32 17
126 %c = insertelement <32 x float> poison, float %b, i32 0
127 %d = shufflevector <32 x float> %c, <32 x float> poison, <32 x i32> zeroinitializer
128 store <32 x float> %d, ptr %x
132 define void @gather_const_v16f64(ptr %x) {
133 ; LMULMAX8-LABEL: gather_const_v16f64:
135 ; LMULMAX8-NEXT: addi a1, a0, 80
136 ; LMULMAX8-NEXT: vsetivli zero, 16, e64, m8, ta, ma
137 ; LMULMAX8-NEXT: vlse64.v v8, (a1), zero
138 ; LMULMAX8-NEXT: vse64.v v8, (a0)
141 ; LMULMAX1-LABEL: gather_const_v16f64:
143 ; LMULMAX1-NEXT: addi a1, a0, 80
144 ; LMULMAX1-NEXT: addi a2, a0, 16
145 ; LMULMAX1-NEXT: addi a3, a0, 48
146 ; LMULMAX1-NEXT: addi a4, a0, 32
147 ; LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
148 ; LMULMAX1-NEXT: vlse64.v v8, (a1), zero
149 ; LMULMAX1-NEXT: addi a5, a0, 64
150 ; LMULMAX1-NEXT: addi a6, a0, 112
151 ; LMULMAX1-NEXT: addi a7, a0, 96
152 ; LMULMAX1-NEXT: vse64.v v8, (a7)
153 ; LMULMAX1-NEXT: vse64.v v8, (a6)
154 ; LMULMAX1-NEXT: vse64.v v8, (a5)
155 ; LMULMAX1-NEXT: vse64.v v8, (a1)
156 ; LMULMAX1-NEXT: vse64.v v8, (a4)
157 ; LMULMAX1-NEXT: vse64.v v8, (a3)
158 ; LMULMAX1-NEXT: vse64.v v8, (a0)
159 ; LMULMAX1-NEXT: vse64.v v8, (a2)
161 %a = load <16 x double>, ptr %x
162 %b = extractelement <16 x double> %a, i32 10
163 %c = insertelement <16 x double> poison, double %b, i32 0
164 %d = shufflevector <16 x double> %c, <16 x double> poison, <16 x i32> zeroinitializer
165 store <16 x double> %d, ptr %x