1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v -verify-machineinstrs < %s | FileCheck %s
3 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v -verify-machineinstrs < %s | FileCheck %s
5 define void @sext_v4i8_v4i32(ptr %x, ptr %z) {
6 ; CHECK-LABEL: sext_v4i8_v4i32:
8 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
9 ; CHECK-NEXT: vle8.v v8, (a0)
10 ; CHECK-NEXT: vsext.vf4 v9, v8
11 ; CHECK-NEXT: vse32.v v9, (a1)
13 %a = load <4 x i8>, ptr %x
14 %b = sext <4 x i8> %a to <4 x i32>
15 store <4 x i32> %b, ptr %z
19 define void @zext_v4i8_v4i32(ptr %x, ptr %z) {
20 ; CHECK-LABEL: zext_v4i8_v4i32:
22 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
23 ; CHECK-NEXT: vle8.v v8, (a0)
24 ; CHECK-NEXT: vzext.vf4 v9, v8
25 ; CHECK-NEXT: vse32.v v9, (a1)
27 %a = load <4 x i8>, ptr %x
28 %b = zext <4 x i8> %a to <4 x i32>
29 store <4 x i32> %b, ptr %z
33 define void @sext_v8i8_v8i32(ptr %x, ptr %z) {
34 ; CHECK-LABEL: sext_v8i8_v8i32:
36 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
37 ; CHECK-NEXT: vle8.v v8, (a0)
38 ; CHECK-NEXT: vsext.vf4 v10, v8
39 ; CHECK-NEXT: vse32.v v10, (a1)
41 %a = load <8 x i8>, ptr %x
42 %b = sext <8 x i8> %a to <8 x i32>
43 store <8 x i32> %b, ptr %z
47 define void @sext_v32i8_v32i32(ptr %x, ptr %z) {
48 ; CHECK-LABEL: sext_v32i8_v32i32:
50 ; CHECK-NEXT: li a2, 32
51 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, ma
52 ; CHECK-NEXT: vle8.v v8, (a0)
53 ; CHECK-NEXT: vsext.vf4 v16, v8
54 ; CHECK-NEXT: vse32.v v16, (a1)
56 %a = load <32 x i8>, ptr %x
57 %b = sext <32 x i8> %a to <32 x i32>
58 store <32 x i32> %b, ptr %z
62 define void @trunc_v4i8_v4i32(ptr %x, ptr %z) {
63 ; CHECK-LABEL: trunc_v4i8_v4i32:
65 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
66 ; CHECK-NEXT: vle32.v v8, (a0)
67 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
68 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
69 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
70 ; CHECK-NEXT: vse8.v v8, (a1)
72 %a = load <4 x i32>, ptr %x
73 %b = trunc <4 x i32> %a to <4 x i8>
74 store <4 x i8> %b, ptr %z
78 define void @trunc_v8i8_v8i32(ptr %x, ptr %z) {
79 ; CHECK-LABEL: trunc_v8i8_v8i32:
81 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
82 ; CHECK-NEXT: vle32.v v8, (a0)
83 ; CHECK-NEXT: vnsrl.wi v10, v8, 0
84 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
85 ; CHECK-NEXT: vnsrl.wi v8, v10, 0
86 ; CHECK-NEXT: vse8.v v8, (a1)
88 %a = load <8 x i32>, ptr %x
89 %b = trunc <8 x i32> %a to <8 x i8>
90 store <8 x i8> %b, ptr %z