1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -mattr=+experimental-v -verify-machineinstrs < %s | FileCheck %s
3
4; Test that the prepareSREMEqFold optimization doesn't crash on scalable
5; vector types.
6define <vscale x 4 x i1> @srem_eq_fold_nxv4i8(<vscale x 4 x i8> %va) {
7; CHECK-LABEL: srem_eq_fold_nxv4i8:
8; CHECK:       # %bb.0:
9; CHECK-NEXT:    addi a0, zero, 42
10; CHECK-NEXT:    vsetvli a1, zero, e8, mf2, ta, mu
11; CHECK-NEXT:    vmv.v.x v25, a0
12; CHECK-NEXT:    addi a1, zero, -85
13; CHECK-NEXT:    vmacc.vx v25, a1, v8
14; CHECK-NEXT:    vsll.vi v26, v25, 7
15; CHECK-NEXT:    vsrl.vi v25, v25, 1
16; CHECK-NEXT:    vor.vv v25, v25, v26
17; CHECK-NEXT:    vmsleu.vx v0, v25, a0
18; CHECK-NEXT:    ret
19  %head_six = insertelement <vscale x 4 x i8> undef, i8 6, i32 0
20  %splat_six = shufflevector <vscale x 4 x i8> %head_six, <vscale x 4 x i8> undef, <vscale x 4 x i32> zeroinitializer
21  %rem = srem <vscale x 4 x i8> %va, %splat_six
22
23  %cc = icmp eq <vscale x 4 x i8> %rem, zeroinitializer
24  ret <vscale x 4 x i1> %cc
25}
26