xref: /llvm-project/llvm/test/Transforms/SLPVectorizer/RISCV/reduction-extension-after-bitwidth.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2; RUN: opt -S -mtriple=riscv64-unknown-linux-gnu -mattr="+v" --passes=slp-vectorizer < %s | FileCheck %s
3
4define i32 @test(ptr %0, ptr %1) {
5; CHECK-LABEL: define i32 @test(
6; CHECK-SAME: ptr [[TMP0:%.*]], ptr [[TMP1:%.*]]) #[[ATTR0:[0-9]+]] {
7; CHECK-NEXT:  entry:
8; CHECK-NEXT:    [[LOAD_5:%.*]] = load i32, ptr [[TMP1]], align 4
9; CHECK-NEXT:    [[TMP2:%.*]] = call i8 @llvm.vector.reduce.and.v4i8(<4 x i8> splat (i8 1))
10; CHECK-NEXT:    [[TMP3:%.*]] = sext i8 [[TMP2]] to i32
11; CHECK-NEXT:    [[OP_RDX:%.*]] = and i32 [[TMP3]], [[LOAD_5]]
12; CHECK-NEXT:    ret i32 [[OP_RDX]]
13;
14entry:
15  %zext.0 = zext i8 1 to i32
16  %zext.1 = zext i8 1 to i32
17  %zext.2 = zext i8 1 to i32
18  %zext.3 = zext i8 1 to i32
19  %select.zext.0 = select i1 false, i32 -1, i32 %zext.0
20  %select.zext.1 = select i1 false, i32 0, i32 %zext.1
21  %select.zext.2 = select i1 false, i32 0, i32 %zext.2
22  %select.zext.3 = select i1 false, i32 0, i32 %zext.3
23
24  %load.5 = load i32, ptr %1, align 4
25
26  %and.0 = and i32 %load.5, %select.zext.0
27  %and.1 = and i32 %and.0, %select.zext.1
28  %and.2 = and i32 %and.1, %select.zext.2
29  %and.3 = and i32 %and.2, %select.zext.3
30
31  ret i32 %and.3
32}
33
34