1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -S --passes=slp-vectorizer -mtriple=riscv64-unknown-linux-gnu -mattr=+v -slp-threshold=-20 < %s | FileCheck %s
7 ; CHECK-LABEL: define i16 @test
8 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
10 ; CHECK-NEXT: [[PPREV_058_I:%.*]] = getelementptr [[S:%.*]], ptr null, i64 -1
11 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x ptr> <ptr null, ptr poison>, ptr [[PPREV_058_I]], i32 1
12 ; CHECK-NEXT: br label [[WHILE_BODY_I:%.*]]
13 ; CHECK: while.body.i:
14 ; CHECK-NEXT: [[TMP1:%.*]] = phi i16 [ 0, [[WHILE_BODY_I]] ], [ 0, [[ENTRY:%.*]] ]
15 ; CHECK-NEXT: [[TMP2:%.*]] = phi <2 x ptr> [ [[TMP3:%.*]], [[WHILE_BODY_I]] ], [ [[TMP0]], [[ENTRY]] ]
16 ; CHECK-NEXT: [[TMP3]] = getelementptr [[S]], <2 x ptr> [[TMP2]], <2 x i64> <i64 -1, i64 -1>
17 ; CHECK-NEXT: [[TMP4:%.*]] = call <2 x i16> @llvm.masked.gather.v2i16.v2p0(<2 x ptr> [[TMP3]], i32 2, <2 x i1> <i1 true, i1 true>, <2 x i16> poison)
18 ; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x i16> [[TMP4]], i32 0
19 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i16> [[TMP4]], i32 1
20 ; CHECK-NEXT: [[CMP_I178:%.*]] = icmp ult i16 [[TMP5]], [[TMP6]]
21 ; CHECK-NEXT: br label [[WHILE_BODY_I]]
24 %pPrev.058.i = getelementptr %S, ptr null, i64 -1
25 br label %while.body.i
28 %0 = phi i16 [ 0, %while.body.i ], [ 0, %entry ]
29 %pPrev.062.i = phi ptr [ %pPrev.0.i, %while.body.i ], [ %pPrev.058.i, %entry ]
30 %pEdge.061.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ null, %entry ]
31 %incdec.ptr.i = getelementptr %S, ptr %pEdge.061.i, i64 -1
32 %pPrev.0.i = getelementptr %S, ptr %pPrev.062.i, i64 -1
33 %1 = load i16, ptr %incdec.ptr.i, align 2
34 %2 = load i16, ptr %pPrev.0.i, align 2
35 %cmp.i178 = icmp ult i16 %1, %2
36 br label %while.body.i