1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc < %s -mtriple=riscv64 -mattr=+v | FileCheck %s
4 define <vscale x 4 x i8> @foo(ptr %p) {
7 ; CHECK-NEXT: vl1re16.v v8, (a0)
8 ; CHECK-NEXT: lui a0, 4
9 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
10 ; CHECK-NEXT: vmv.v.x v10, a0
11 ; CHECK-NEXT: li a0, 248
12 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
13 ; CHECK-NEXT: vsll.vi v8, v8, 3
14 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
15 ; CHECK-NEXT: vzext.vf2 v12, v8
16 ; CHECK-NEXT: vand.vx v8, v12, a0
17 ; CHECK-NEXT: lui a0, 1
18 ; CHECK-NEXT: addi a0, a0, -361
19 ; CHECK-NEXT: vmacc.vx v10, a0, v8
20 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
21 ; CHECK-NEXT: vnsrl.wi v8, v10, 15
22 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
23 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
25 %i13 = load <vscale x 4 x i16>, ptr %p, align 2
26 %i14 = zext <vscale x 4 x i16> %i13 to <vscale x 4 x i32>
27 %i15 = shl nuw nsw <vscale x 4 x i32> %i14, splat (i32 3)
28 %i16 = and <vscale x 4 x i32> %i15, splat (i32 248)
29 %i17 = mul nuw nsw <vscale x 4 x i32> %i16, splat (i32 3735)
30 %i18 = add nuw nsw <vscale x 4 x i32> %i17, splat (i32 16384)
31 %i21 = lshr <vscale x 4 x i32> %i18, splat (i32 15)
32 %i22 = trunc <vscale x 4 x i32> %i21 to <vscale x 4 x i8>
33 ret <vscale x 4 x i8> %i22