brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 22fa8b1 Raw
65 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -select-optimize -mtriple=aarch64-linux-gnu -mcpu=generic -S < %s | FileCheck %s --check-prefix=CHECK-GENERIC3; RUN: opt -select-optimize -mtriple=aarch64-linux-gnu -mcpu=neoverse-n1 -S < %s | FileCheck %s4; RUN: opt -select-optimize -mtriple=aarch64-linux-gnu -mcpu=neoverse-v2 -S < %s | FileCheck %s5; RUN: opt -select-optimize -mtriple=aarch64-linux-gnu -mcpu=cortex-a72 -S < %s | FileCheck %s6; RUN: opt -passes='require<profile-summary>,function(select-optimize)' -mtriple=aarch64-linux-gnu -mcpu=generic -S < %s | FileCheck %s --check-prefix=CHECK-GENERIC7; RUN: opt -passes='require<profile-summary>,function(select-optimize)' -mtriple=aarch64-linux-gnu -mcpu=neoverse-n1 -S < %s | FileCheck %s8; RUN: opt -passes='require<profile-summary>,function(select-optimize)' -mtriple=aarch64-linux-gnu -mcpu=neoverse-v2 -S < %s | FileCheck %s9; RUN: opt -passes='require<profile-summary>,function(select-optimize)' -mtriple=aarch64-linux-gnu -mcpu=cortex-a72 -S < %s | FileCheck %s10 11; Test has not predictable select, which should not be transformed to a branch12define i32 @test1(i32 %a) {13; CHECK-GENERIC-LABEL: @test1(14; CHECK-GENERIC-NEXT:  entry:15; CHECK-GENERIC-NEXT:    [[CMP:%.*]] = icmp slt i32 [[A:%.*]], 116; CHECK-GENERIC-NEXT:    [[DEC:%.*]] = sub i32 [[A]], 117; CHECK-GENERIC-NEXT:    [[RES:%.*]] = select i1 [[CMP]], i32 0, i32 [[DEC]], !prof [[PROF0:![0-9]+]]18; CHECK-GENERIC-NEXT:    ret i32 [[RES]]19;20; CHECK-LABEL: @test1(21; CHECK-NEXT:  entry:22; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[A:%.*]], 123; CHECK-NEXT:    [[DEC:%.*]] = sub i32 [[A]], 124; CHECK-NEXT:    [[RES:%.*]] = select i1 [[CMP]], i32 0, i32 [[DEC]], !prof [[PROF0:![0-9]+]]25; CHECK-NEXT:    ret i32 [[RES]]26;27entry:28  %cmp = icmp slt i32 %a, 129  %dec = sub i32 %a, 130  %res = select i1 %cmp, i32 0, i32 %dec, !prof !031  ret i32 %res32}33 34; Test has highly predictable select according to profile data,35; which should be transformed to a branch on cores with enabled FeaturePredictableSelectIsExpensive36define i32 @test2(i32 %a) {37; CHECK-GENERIC-LABEL: @test2(38; CHECK-GENERIC-NEXT:  entry:39; CHECK-GENERIC-NEXT:    [[CMP:%.*]] = icmp slt i32 [[A:%.*]], 140; CHECK-GENERIC-NEXT:    [[DEC:%.*]] = sub i32 [[A]], 141; CHECK-GENERIC-NEXT:    [[RES:%.*]] = select i1 [[CMP]], i32 0, i32 [[DEC]], !prof [[PROF1:![0-9]+]]42; CHECK-GENERIC-NEXT:    ret i32 [[RES]]43;44; CHECK-LABEL: @test2(45; CHECK-NEXT:  entry:46; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[A:%.*]], 147; CHECK-NEXT:    [[RES_FROZEN:%.*]] = freeze i1 [[CMP]]48; CHECK-NEXT:    br i1 [[RES_FROZEN]], label [[SELECT_END:%.*]], label [[SELECT_FALSE_SINK:%.*]], !prof [[PROF1:![0-9]+]]49; CHECK:       select.false.sink:50; CHECK-NEXT:    [[DEC:%.*]] = sub i32 [[A]], 151; CHECK-NEXT:    br label [[SELECT_END]]52; CHECK:       select.end:53; CHECK-NEXT:    [[RES:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[DEC]], [[SELECT_FALSE_SINK]] ]54; CHECK-NEXT:    ret i32 [[RES]]55;56entry:57  %cmp = icmp slt i32 %a, 158  %dec = sub i32 %a, 159  %res = select i1 %cmp, i32 0, i32 %dec, !prof !160  ret i32 %res61}62 63!0 = !{!"branch_weights", i32 1, i32 1}64!1 = !{!"branch_weights", i32 1, i32 1000}65