41 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=slp-vectorizer -mcpu=corei7-avx -mtriple=x86_64-unknown-linux -S | FileCheck %s3 4; This test checks whether the cost of the vector max intrinsic is calculated5; correctly. A max vector intrinsic combines the select and icmp instructions.6; This maps to a single PMAX instruction in x86.7define void @smax_intrinsic_cost(i64 %arg0, i64 %arg1) {8; CHECK-LABEL: @smax_intrinsic_cost(9; CHECK-NEXT: [[ICMP0:%.*]] = icmp sgt i64 [[ARG0:%.*]], 12310; CHECK-NEXT: [[ICMP1:%.*]] = icmp sgt i64 [[ARG1:%.*]], 45611; CHECK-NEXT: [[SELECT0:%.*]] = select i1 [[ICMP0]], i64 [[ARG0]], i64 12312; CHECK-NEXT: [[SELECT1:%.*]] = select i1 [[ICMP1]], i64 [[ARG1]], i64 45613; CHECK-NEXT: [[ROOT:%.*]] = icmp sle i64 [[SELECT0]], [[SELECT1]]14; CHECK-NEXT: ret void15;16 %icmp0 = icmp sgt i64 %arg0, 12317 %icmp1 = icmp sgt i64 %arg1, 45618 %select0 = select i1 %icmp0, i64 %arg0, i64 12319 %select1 = select i1 %icmp1, i64 %arg1, i64 45620 %root = icmp sle i64 %select0, %select121 ret void22}23 24 25define void @umax_intrinsic_cost(i64 %arg0, i64 %arg1) {26; CHECK-LABEL: @umax_intrinsic_cost(27; CHECK-NEXT: [[ICMP0:%.*]] = icmp ugt i64 [[ARG0:%.*]], 12328; CHECK-NEXT: [[ICMP1:%.*]] = icmp ugt i64 [[ARG1:%.*]], 45629; CHECK-NEXT: [[SELECT0:%.*]] = select i1 [[ICMP0]], i64 [[ARG0]], i64 12330; CHECK-NEXT: [[SELECT1:%.*]] = select i1 [[ICMP1]], i64 [[ARG1]], i64 45631; CHECK-NEXT: [[ROOT:%.*]] = icmp sle i64 [[SELECT0]], [[SELECT1]]32; CHECK-NEXT: ret void33;34 %icmp0 = icmp ugt i64 %arg0, 12335 %icmp1 = icmp ugt i64 %arg1, 45636 %select0 = select i1 %icmp0, i64 %arg0, i64 12337 %select1 = select i1 %icmp1, i64 %arg1, i64 45638 %root = icmp sle i64 %select0, %select139 ret void40}41