1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2; RUN: opt -mtriple=riscv32 -passes="print<cost-model>" 2>&1 -disable-output < %s \ 3; RUN: | FileCheck %s --check-prefix=CHECK-THROUGHPUT 4; RUN: opt -mtriple=riscv64 -passes="print<cost-model>" 2>&1 -disable-output < %s \ 5; RUN: | FileCheck %s --check-prefix=CHECK-THROUGHPUT 6 7; RUN: opt -mtriple=riscv32 -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size < %s \ 8; RUN: | FileCheck %s --check-prefix=CHECK-SIZE 9; RUN: opt -mtriple=riscv64 -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size < %s \ 10; RUN: | FileCheck %s --check-prefix=CHECK-SIZE 11 12 13define void @op() { 14 ; Logical and/or - select's cost must be equivalent to that of binop 15; CHECK-THROUGHPUT-LABEL: 'op' 16; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sand = select i1 undef, i1 undef, i1 false 17; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %band = and i1 undef, undef 18; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sor = select i1 undef, i1 true, i1 undef 19; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bor = or i1 undef, undef 20; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 21; 22; CHECK-SIZE-LABEL: 'op' 23; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sand = select i1 undef, i1 undef, i1 false 24; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %band = and i1 undef, undef 25; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sor = select i1 undef, i1 true, i1 undef 26; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bor = or i1 undef, undef 27; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 28; 29 %sand = select i1 undef, i1 undef, i1 false 30 %band = and i1 undef, undef 31 %sor = select i1 undef, i1 true, i1 undef 32 %bor = or i1 undef, undef 33 34 ret void 35} 36 37define void @vecop() { 38; CHECK-THROUGHPUT-LABEL: 'vecop' 39; 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 40; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %band = and <4 x i1> undef, undef 41; 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 42; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bor = or <4 x i1> undef, undef 43; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 44; 45; CHECK-SIZE-LABEL: 'vecop' 46; 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 47; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %band = and <4 x i1> undef, undef 48; 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 49; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bor = or <4 x i1> undef, undef 50; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 51; 52 %sand = select <4 x i1> undef, <4 x i1> undef, <4 x i1> <i1 false, i1 false, i1 false, i1 false> 53 %band = and <4 x i1> undef, undef 54 %sor = select <4 x i1> undef, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> undef 55 %bor = or <4 x i1> undef, undef 56 57 ret void 58} 59