Skip to content

Commit 6ab5927

Browse files
committed
[SLP][NFC]Add a test with the incorrect vectorization of smax with unsigned arg.
1 parent 9ce74d6 commit 6ab5927

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2+
; RUN: opt -S --passes=slp-vectorizer -mtriple=riscv64-unknown-linux-gnu -mattr=+v < %s | FileCheck %s
3+
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
4+
target triple = "riscv64-unknown-linux-gnu"
5+
6+
@e = global [2 x i8] zeroinitializer
7+
8+
define void @main(ptr noalias %p) {
9+
; CHECK-LABEL: define void @main(
10+
; CHECK-SAME: ptr noalias [[P:%.*]]) #[[ATTR0:[0-9]+]] {
11+
; CHECK-NEXT: bb:
12+
; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[P]], align 4
13+
; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> <i32 0, i32 poison>, i32 [[TMP0]], i32 1
14+
; CHECK-NEXT: [[TMP2:%.*]] = call <2 x i32> @llvm.smax.v2i32(<2 x i32> [[TMP1]], <2 x i32> <i32 0, i32 1>)
15+
; CHECK-NEXT: [[TMP3:%.*]] = trunc <2 x i32> [[TMP2]] to <2 x i8>
16+
; CHECK-NEXT: store <2 x i8> [[TMP3]], ptr getelementptr inbounds ([11 x i8], ptr @e, i64 0, i64 4), align 1
17+
; CHECK-NEXT: ret void
18+
;
19+
bb:
20+
%conv.4 = zext i32 0 to i64
21+
%cond.4 = tail call i64 @llvm.smax.i64(i64 %conv.4, i64 0)
22+
%conv5.4 = trunc i64 %cond.4 to i8
23+
store i8 %conv5.4, ptr getelementptr inbounds ([11 x i8], ptr @e, i64 0, i64 4), align 1
24+
%0 = load i32, ptr %p, align 4
25+
%conv.5 = zext i32 %0 to i64
26+
%cond.5 = tail call i64 @llvm.smax.i64(i64 %conv.5, i64 1)
27+
%conv5.5 = trunc i64 %cond.5 to i8
28+
store i8 %conv5.5, ptr getelementptr inbounds ([11 x i8], ptr @e, i64 0, i64 5), align 1
29+
ret void
30+
}
31+

0 commit comments

Comments
 (0)