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 -verify-machineinstrs < %s | FileCheck %s
3 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s
5 define void @gather_const_v8f16(ptr %x) {
6 ; CHECK-LABEL: gather_const_v8f16:
8 ; CHECK-NEXT: addi a1, a0, 10
9 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
10 ; CHECK-NEXT: vlse16.v v8, (a1), zero
11 ; CHECK-NEXT: vse16.v v8, (a0)
13 %a = load <8 x half>, ptr %x
14 %b = extractelement <8 x half> %a, i32 5
15 %c = insertelement <8 x half> poison, half %b, i32 0
16 %d = shufflevector <8 x half> %c, <8 x half> poison, <8 x i32> zeroinitializer
17 store <8 x half> %d, ptr %x
21 define void @gather_const_v4f32(ptr %x) {
22 ; CHECK-LABEL: gather_const_v4f32:
24 ; CHECK-NEXT: addi a1, a0, 8
25 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
26 ; CHECK-NEXT: vlse32.v v8, (a1), zero
27 ; CHECK-NEXT: vse32.v v8, (a0)
29 %a = load <4 x float>, ptr %x
30 %b = extractelement <4 x float> %a, i32 2
31 %c = insertelement <4 x float> poison, float %b, i32 0
32 %d = shufflevector <4 x float> %c, <4 x float> poison, <4 x i32> zeroinitializer
33 store <4 x float> %d, ptr %x
37 define void @gather_const_v2f64(ptr %x) {
38 ; CHECK-LABEL: gather_const_v2f64:
40 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
41 ; CHECK-NEXT: vlse64.v v8, (a0), zero
42 ; CHECK-NEXT: vse64.v v8, (a0)
44 %a = load <2 x double>, ptr %x
45 %b = extractelement <2 x double> %a, i32 0
46 %c = insertelement <2 x double> poison, double %b, i32 0
47 %d = shufflevector <2 x double> %c, <2 x double> poison, <2 x i32> zeroinitializer
48 store <2 x double> %d, ptr %x
52 define void @gather_const_v64f16(ptr %x) {
53 ; CHECK-LABEL: gather_const_v64f16:
55 ; CHECK-NEXT: li a1, 64
56 ; CHECK-NEXT: addi a2, a0, 94
57 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
58 ; CHECK-NEXT: vlse16.v v8, (a2), zero
59 ; CHECK-NEXT: vse16.v v8, (a0)
61 %a = load <64 x half>, ptr %x
62 %b = extractelement <64 x half> %a, i32 47
63 %c = insertelement <64 x half> poison, half %b, i32 0
64 %d = shufflevector <64 x half> %c, <64 x half> poison, <64 x i32> zeroinitializer
65 store <64 x half> %d, ptr %x
69 define void @gather_const_v32f32(ptr %x) {
70 ; CHECK-LABEL: gather_const_v32f32:
72 ; CHECK-NEXT: li a1, 32
73 ; CHECK-NEXT: addi a2, a0, 68
74 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
75 ; CHECK-NEXT: vlse32.v v8, (a2), zero
76 ; CHECK-NEXT: vse32.v v8, (a0)
78 %a = load <32 x float>, ptr %x
79 %b = extractelement <32 x float> %a, i32 17
80 %c = insertelement <32 x float> poison, float %b, i32 0
81 %d = shufflevector <32 x float> %c, <32 x float> poison, <32 x i32> zeroinitializer
82 store <32 x float> %d, ptr %x
86 define void @gather_const_v16f64(ptr %x) {
87 ; CHECK-LABEL: gather_const_v16f64:
89 ; CHECK-NEXT: addi a1, a0, 80
90 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
91 ; CHECK-NEXT: vlse64.v v8, (a1), zero
92 ; CHECK-NEXT: vse64.v v8, (a0)
94 %a = load <16 x double>, ptr %x
95 %b = extractelement <16 x double> %a, i32 10
96 %c = insertelement <16 x double> poison, double %b, i32 0
97 %d = shufflevector <16 x double> %c, <16 x double> poison, <16 x i32> zeroinitializer
98 store <16 x double> %d, ptr %x