1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 ; Check that DAGCombiner is not asserting with mis-matched vector element count, "Vector element counts must match in SIGN_EXTEND_INREG".
5 ; Also no warning message of "warning: Possible incorrect use of EVT::getVectorNumElements() for scalable vector.".
7 define <vscale x 4 x i32> @sext_inreg(<vscale x 4 x i32> %a) {
8 ; CHECK-LABEL: sext_inreg:
10 ; CHECK-NEXT: ptrue p0.s
11 ; CHECK-NEXT: sxth z0.s, p0/m, z0.s
13 %in = insertelement <vscale x 4 x i32> undef, i32 16, i32 0
14 %splat = shufflevector <vscale x 4 x i32> %in, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
15 %sext = shl <vscale x 4 x i32> %a, %splat
16 %conv = ashr <vscale x 4 x i32> %sext, %splat
17 ret <vscale x 4 x i32> %conv
20 define <vscale x 4 x i32> @ashr_shl(<vscale x 4 x i32> %a) {
21 ; CHECK-LABEL: ashr_shl:
23 ; CHECK-NEXT: lsl z0.s, z0.s, #8
24 ; CHECK-NEXT: asr z0.s, z0.s, #16
26 %in1 = insertelement <vscale x 4 x i32> undef, i32 8, i32 0
27 %splat1 = shufflevector <vscale x 4 x i32> %in1, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
28 %in2 = insertelement <vscale x 4 x i32> undef, i32 16, i32 0
29 %splat2 = shufflevector <vscale x 4 x i32> %in2, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
30 %shl = shl <vscale x 4 x i32> %a, %splat1
31 %r = ashr <vscale x 4 x i32> %shl, %splat2
32 ret <vscale x 4 x i32> %r
35 define <vscale x 4 x i32> @ashr_shl_illegal_trunc_vec_ty(<vscale x 4 x i32> %a) {
36 ; CHECK-LABEL: ashr_shl_illegal_trunc_vec_ty:
38 ; CHECK-NEXT: lsl z0.s, z0.s, #8
39 ; CHECK-NEXT: asr z0.s, z0.s, #11
41 %in1 = insertelement <vscale x 4 x i32> undef, i32 8, i32 0
42 %splat1 = shufflevector <vscale x 4 x i32> %in1, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
43 %in2 = insertelement <vscale x 4 x i32> undef, i32 11, i32 0
44 %splat2 = shufflevector <vscale x 4 x i32> %in2, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
45 %shl = shl <vscale x 4 x i32> %a, %splat1
46 %r = ashr <vscale x 4 x i32> %shl, %splat2
47 ret <vscale x 4 x i32> %r
50 define <vscale x 4 x i32> @ashr_add_shl_nxv4i8(<vscale x 4 x i32> %a) {
51 ; CHECK-LABEL: ashr_add_shl_nxv4i8:
53 ; CHECK-NEXT: mov z1.s, #0x1000000
54 ; CHECK-NEXT: lsl z0.s, z0.s, #24
55 ; CHECK-NEXT: add z0.s, z0.s, z1.s
56 ; CHECK-NEXT: asr z0.s, z0.s, #24
58 %in1 = insertelement <vscale x 4 x i32> undef, i32 24, i32 0
59 %splat1 = shufflevector <vscale x 4 x i32> %in1, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
60 %in2 = insertelement <vscale x 4 x i32> undef, i32 16777216, i32 0
61 %splat2 = shufflevector <vscale x 4 x i32> %in2, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
62 %conv = shl <vscale x 4 x i32> %a, %splat1
63 %sext = add <vscale x 4 x i32> %conv, %splat2
64 %conv1 = ashr <vscale x 4 x i32> %sext, %splat1
65 ret <vscale x 4 x i32> %conv1