xref: /llvm-project/llvm/test/Analysis/CostModel/RISCV/logicalop.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
1c89d9d8aSJuneyoung Lee; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
24178e334SSimon Pilgrim; RUN: opt -mtriple=riscv32 -passes="print<cost-model>" 2>&1 -disable-output < %s \
3c89d9d8aSJuneyoung Lee; RUN:   | FileCheck %s --check-prefix=CHECK-THROUGHPUT
44178e334SSimon Pilgrim; RUN: opt -mtriple=riscv64 -passes="print<cost-model>" 2>&1 -disable-output < %s \
5c89d9d8aSJuneyoung Lee; RUN:   | FileCheck %s --check-prefix=CHECK-THROUGHPUT
6c89d9d8aSJuneyoung Lee
74178e334SSimon Pilgrim; RUN: opt -mtriple=riscv32 -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size < %s \
8c89d9d8aSJuneyoung Lee; RUN:   | FileCheck %s --check-prefix=CHECK-SIZE
94178e334SSimon Pilgrim; RUN: opt -mtriple=riscv64 -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size < %s \
10c89d9d8aSJuneyoung Lee; RUN:   | FileCheck %s --check-prefix=CHECK-SIZE
11c89d9d8aSJuneyoung Lee
12c89d9d8aSJuneyoung Lee
13c89d9d8aSJuneyoung Leedefine void @op() {
14c89d9d8aSJuneyoung Lee  ; Logical and/or - select's cost must be equivalent to that of binop
15c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-LABEL: 'op'
16c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sand = select i1 undef, i1 undef, i1 false
17c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %band = and i1 undef, undef
18c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sor = select i1 undef, i1 true, i1 undef
19c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bor = or i1 undef, undef
200a5d52a7SSergey Kachkov; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
21c89d9d8aSJuneyoung Lee;
22c89d9d8aSJuneyoung Lee; CHECK-SIZE-LABEL: 'op'
23c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sand = select i1 undef, i1 undef, i1 false
24c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %band = and i1 undef, undef
25c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sor = select i1 undef, i1 true, i1 undef
26c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bor = or i1 undef, undef
27c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
28c89d9d8aSJuneyoung Lee;
29c89d9d8aSJuneyoung Lee  %sand = select i1 undef, i1 undef, i1 false
30c89d9d8aSJuneyoung Lee  %band = and i1 undef, undef
31c89d9d8aSJuneyoung Lee  %sor = select i1 undef, i1 true, i1 undef
32c89d9d8aSJuneyoung Lee  %bor = or i1 undef, undef
33c89d9d8aSJuneyoung Lee
34c89d9d8aSJuneyoung Lee  ret void
35c89d9d8aSJuneyoung Lee}
36c89d9d8aSJuneyoung Lee
37c89d9d8aSJuneyoung Leedefine void @vecop() {
38c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-LABEL: 'vecop'
39c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sand = select <4 x i1> undef, <4 x i1> undef, <4 x i1> zeroinitializer
40c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %band = and <4 x i1> undef, undef
41*38fffa63SPaul Walker; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sor = select <4 x i1> undef, <4 x i1> splat (i1 true), <4 x i1> undef
42c89d9d8aSJuneyoung Lee; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bor = or <4 x i1> undef, undef
430a5d52a7SSergey Kachkov; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
44c89d9d8aSJuneyoung Lee;
45c89d9d8aSJuneyoung Lee; CHECK-SIZE-LABEL: 'vecop'
46c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sand = select <4 x i1> undef, <4 x i1> undef, <4 x i1> zeroinitializer
47c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %band = and <4 x i1> undef, undef
48*38fffa63SPaul Walker; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sor = select <4 x i1> undef, <4 x i1> splat (i1 true), <4 x i1> undef
49c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bor = or <4 x i1> undef, undef
50c89d9d8aSJuneyoung Lee; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
51c89d9d8aSJuneyoung Lee;
52c89d9d8aSJuneyoung Lee  %sand = select <4 x i1> undef, <4 x i1> undef, <4 x i1> <i1 false, i1 false, i1 false, i1 false>
53c89d9d8aSJuneyoung Lee  %band = and <4 x i1> undef, undef
54c89d9d8aSJuneyoung Lee  %sor = select <4 x i1> undef, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> undef
55c89d9d8aSJuneyoung Lee  %bor = or <4 x i1> undef, undef
56c89d9d8aSJuneyoung Lee
57c89d9d8aSJuneyoung Lee  ret void
58c89d9d8aSJuneyoung Lee}
59