1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv64 -mattr=+v -verify-machineinstrs | FileCheck %s
4 define void @foo_1(ptr nocapture noundef writeonly %t) {
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: lui a1, %hi(.LCPI0_0)
8 ; CHECK-NEXT: addi a1, a1, %lo(.LCPI0_0)
9 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
10 ; CHECK-NEXT: vle32.v v8, (a1)
11 ; CHECK-NEXT: vse32.v v8, (a0)
14 store <4 x float> <float -2147483648.0, float -2147483520.0, float -2147483392.0, float -2147483264.0>, ptr %t, align 16
18 define void @foo_2(ptr nocapture noundef writeonly %t) {
20 ; CHECK: # %bb.0: # %entry
21 ; CHECK-NEXT: lui a1, %hi(.LCPI1_0)
22 ; CHECK-NEXT: addi a1, a1, %lo(.LCPI1_0)
23 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
24 ; CHECK-NEXT: vle32.v v8, (a1)
25 ; CHECK-NEXT: vse32.v v8, (a0)
28 store <4 x float> <float 2147483136.0, float 2147483264.0, float 2147483392.0, float 2147483520.0>, ptr %t, align 16
32 define void @foo_3(ptr nocapture noundef writeonly %t) {
34 ; CHECK: # %bb.0: # %entry
35 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
36 ; CHECK-NEXT: vid.v v8
37 ; CHECK-NEXT: vadd.vi v8, v8, -1
38 ; CHECK-NEXT: vfcvt.f.x.v v8, v8
39 ; CHECK-NEXT: vse32.v v8, (a0)
42 store <4 x float> <float -1.0, float 0.0, float 1.0, float 2.0>, ptr %t, align 16
46 define void @foo_4(ptr nocapture noundef writeonly %t) {
48 ; CHECK: # %bb.0: # %entry
49 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
50 ; CHECK-NEXT: vid.v v8
51 ; CHECK-NEXT: vsll.vi v8, v8, 10
52 ; CHECK-NEXT: vadd.vi v8, v8, -16
53 ; CHECK-NEXT: vfcvt.f.x.v v8, v8
54 ; CHECK-NEXT: vse32.v v8, (a0)
57 store <4 x float> <float -16.0, float 1008.0, float 2032.0, float 3056.0>, ptr %t, align 16
61 define void @foo_5(ptr nocapture noundef writeonly %t) {
63 ; CHECK: # %bb.0: # %entry
64 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
65 ; CHECK-NEXT: vid.v v8
66 ; CHECK-NEXT: vfcvt.f.x.v v8, v8
67 ; CHECK-NEXT: vse32.v v8, (a0)
70 store <4 x float> <float 0.0, float 1.0, float 2.0, float 3.0>, ptr %t, align 16
74 define void @foo_6(ptr nocapture noundef writeonly %t) {
76 ; CHECK: # %bb.0: # %entry
77 ; CHECK-NEXT: lui a1, %hi(.LCPI5_0)
78 ; CHECK-NEXT: addi a1, a1, %lo(.LCPI5_0)
79 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
80 ; CHECK-NEXT: vle32.v v8, (a1)
81 ; CHECK-NEXT: vse32.v v8, (a0)
84 store <4 x float> <float -0.0, float 1.0, float 2.0, float 3.0>, ptr %t, align 16
88 define void @foo_7(ptr nocapture noundef writeonly %t) {
90 ; CHECK: # %bb.0: # %entry
91 ; CHECK-NEXT: lui a1, %hi(.LCPI6_0)
92 ; CHECK-NEXT: addi a1, a1, %lo(.LCPI6_0)
93 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
94 ; CHECK-NEXT: vle32.v v8, (a1)
95 ; CHECK-NEXT: vse32.v v8, (a0)
98 store <4 x float> <float -3.0, float -2.0, float -1.0, float -0.0>, ptr %t, align 16
102 define void @foo_8(ptr nocapture noundef writeonly %t) {
103 ; CHECK-LABEL: foo_8:
104 ; CHECK: # %bb.0: # %entry
105 ; CHECK-NEXT: lui a1, %hi(.LCPI7_0)
106 ; CHECK-NEXT: addi a1, a1, %lo(.LCPI7_0)
107 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
108 ; CHECK-NEXT: vle32.v v8, (a1)
109 ; CHECK-NEXT: vse32.v v8, (a0)
112 store <4 x float> <float 1.5, float 2.5, float 3.5, float 4.5>, ptr %t, align 16
116 ; Make sure we don't try to use vid+vsll+vfcvt. We previously flipped the sign
118 define void @foo_9(ptr nocapture noundef writeonly %t) {
119 ; CHECK-LABEL: foo_9:
120 ; CHECK: # %bb.0: # %entry
121 ; CHECK-NEXT: lui a1, %hi(.LCPI8_0)
122 ; CHECK-NEXT: addi a1, a1, %lo(.LCPI8_0)
123 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
124 ; CHECK-NEXT: vle32.v v8, (a1)
125 ; CHECK-NEXT: vse32.v v8, (a0)
128 store <4 x float> <float 0.0, float -2147483648.0, float 0.0, float 2147483648.0>, ptr %t, align 16