1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=aarch64-- < %s | FileCheck %s --check-prefix=CHECK-THROUGHPUT 3; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=aarch64-- < %s | FileCheck %s --check-prefix=CHECK-SIZE 4 5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 6 7define void @cmps() { 8; CHECK-THROUGHPUT-LABEL: 'cmps' 9; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c8 = icmp slt i8 undef, undef 10; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c16 = icmp ult i16 undef, undef 11; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c32 = icmp sge i32 undef, undef 12; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c64 = icmp ne i64 undef, undef 13; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %c128 = icmp ult i128 undef, undef 14; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv16i8 = icmp slt <16 x i8> undef, undef 15; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv8i16 = icmp ult <8 x i16> undef, undef 16; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv4i32 = icmp sge <4 x i32> undef, undef 17; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cf16 = fcmp oge half undef, undef 18; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cf32 = fcmp ogt float undef, undef 19; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cf64 = fcmp ogt double undef, undef 20; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %cfv816 = fcmp olt <8 x half> undef, undef 21; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cfv432 = fcmp oge <4 x float> undef, undef 22; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cfv264 = fcmp oge <2 x double> undef, undef 23; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 24; 25; CHECK-SIZE-LABEL: 'cmps' 26; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c8 = icmp slt i8 undef, undef 27; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c16 = icmp ult i16 undef, undef 28; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c32 = icmp sge i32 undef, undef 29; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c64 = icmp ne i64 undef, undef 30; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c128 = icmp ult i128 undef, undef 31; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv16i8 = icmp slt <16 x i8> undef, undef 32; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv8i16 = icmp ult <8 x i16> undef, undef 33; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv4i32 = icmp sge <4 x i32> undef, undef 34; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cf16 = fcmp oge half undef, undef 35; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cf32 = fcmp ogt float undef, undef 36; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cf64 = fcmp ogt double undef, undef 37; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cfv816 = fcmp olt <8 x half> undef, undef 38; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cfv432 = fcmp oge <4 x float> undef, undef 39; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cfv264 = fcmp oge <2 x double> undef, undef 40; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 41; 42 %c8 = icmp slt i8 undef, undef 43 %c16 = icmp ult i16 undef, undef 44 %c32 = icmp sge i32 undef, undef 45 %c64 = icmp ne i64 undef, undef 46 %c128 = icmp ult i128 undef, undef 47 %cv16i8 = icmp slt <16 x i8> undef, undef 48 %cv8i16 = icmp ult <8 x i16> undef, undef 49 %cv4i32 = icmp sge <4 x i32> undef, undef 50 %cf16 = fcmp oge half undef, undef 51 %cf32 = fcmp ogt float undef, undef 52 %cf64 = fcmp ogt double undef, undef 53 %cfv816 = fcmp olt <8 x half> undef, undef 54 %cfv432 = fcmp oge <4 x float> undef, undef 55 %cfv264 = fcmp oge <2 x double> undef, undef 56 ret void 57} 58 59 60define void @andcmp() { 61; CHECK-THROUGHPUT-LABEL: 'andcmp' 62; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a8 = and i8 undef, undef 63; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c8 = icmp eq i8 %a8, 0 64; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a16 = and i16 undef, undef 65; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c16 = icmp ne i16 %a16, 0 66; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a32 = and i32 undef, undef 67; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %c32 = icmp eq i32 %a32, 0 68; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a64 = and i64 undef, undef 69; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %c64 = icmp ne i64 %a64, 0 70; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a128 = and i128 undef, undef 71; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %c128 = icmp eq i128 %a128, 0 72; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %av16i8 = and <16 x i8> undef, undef 73; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv16i8 = icmp ne <16 x i8> %av16i8, zeroinitializer 74; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %av8i16 = and <8 x i16> undef, undef 75; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv8i16 = icmp eq <8 x i16> %av8i16, zeroinitializer 76; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %av4i32 = and <4 x i32> undef, undef 77; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv4i32 = icmp ne <4 x i32> %av4i32, zeroinitializer 78; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c32not0 = icmp eq i32 %a32, 1 79; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c64sle = icmp sle i64 %a64, 0 80; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 81; 82; CHECK-SIZE-LABEL: 'andcmp' 83; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a8 = and i8 undef, undef 84; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c8 = icmp eq i8 %a8, 0 85; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a16 = and i16 undef, undef 86; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c16 = icmp ne i16 %a16, 0 87; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a32 = and i32 undef, undef 88; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c32 = icmp eq i32 %a32, 0 89; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a64 = and i64 undef, undef 90; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c64 = icmp ne i64 %a64, 0 91; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a128 = and i128 undef, undef 92; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c128 = icmp eq i128 %a128, 0 93; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %av16i8 = and <16 x i8> undef, undef 94; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv16i8 = icmp ne <16 x i8> %av16i8, zeroinitializer 95; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %av8i16 = and <8 x i16> undef, undef 96; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv8i16 = icmp eq <8 x i16> %av8i16, zeroinitializer 97; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %av4i32 = and <4 x i32> undef, undef 98; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %cv4i32 = icmp ne <4 x i32> %av4i32, zeroinitializer 99; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c32not0 = icmp eq i32 %a32, 1 100; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c64sle = icmp sle i64 %a64, 0 101; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 102; 103 %a8 = and i8 undef, undef 104 %c8 = icmp eq i8 %a8, 0 105 %a16 = and i16 undef, undef 106 %c16 = icmp ne i16 %a16, 0 107 %a32 = and i32 undef, undef 108 %c32 = icmp eq i32 %a32, 0 109 %a64 = and i64 undef, undef 110 %c64 = icmp ne i64 %a64, 0 111 %a128 = and i128 undef, undef 112 %c128 = icmp eq i128 %a128, zeroinitializer 113 %av16i8 = and <16 x i8> undef, undef 114 %cv16i8 = icmp ne <16 x i8> %av16i8, zeroinitializer 115 %av8i16 = and <8 x i16> undef, undef 116 %cv8i16 = icmp eq <8 x i16> %av8i16, zeroinitializer 117 %av4i32 = and <4 x i32> undef, undef 118 %cv4i32 = icmp ne <4 x i32> %av4i32, zeroinitializer 119 120 %c32not0 = icmp eq i32 %a32, 1 121 %c64sle = icmp sle i64 %a64, 0 122 ret void 123} 124 125define void @uscmp() { 126; CHECK-THROUGHPUT-LABEL: 'uscmp' 127; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u8 = call i8 @llvm.ucmp.i8.i8(i8 undef, i8 undef) 128; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u16 = call i16 @llvm.ucmp.i16.i16(i16 undef, i16 undef) 129; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u32 = call i32 @llvm.ucmp.i32.i32(i32 undef, i32 undef) 130; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u64 = call i64 @llvm.ucmp.i64.i64(i64 undef, i64 undef) 131; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %uv16i8 = call <16 x i8> @llvm.ucmp.v16i8.v16i8(<16 x i8> undef, <16 x i8> undef) 132; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %uv8i16 = call <8 x i16> @llvm.ucmp.v8i16.v8i16(<8 x i16> undef, <8 x i16> undef) 133; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %uv4i32 = call <4 x i32> @llvm.ucmp.v4i32.v4i32(<4 x i32> undef, <4 x i32> undef) 134; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s8 = call i8 @llvm.scmp.i8.i8(i8 undef, i8 undef) 135; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s16 = call i16 @llvm.scmp.i16.i16(i16 undef, i16 undef) 136; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s32 = call i32 @llvm.scmp.i32.i32(i32 undef, i32 undef) 137; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s64 = call i64 @llvm.scmp.i64.i64(i64 undef, i64 undef) 138; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %sv16i8 = call <16 x i8> @llvm.scmp.v16i8.v16i8(<16 x i8> undef, <16 x i8> undef) 139; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %sv8i16 = call <8 x i16> @llvm.scmp.v8i16.v8i16(<8 x i16> undef, <8 x i16> undef) 140; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %sv4i32 = call <4 x i32> @llvm.scmp.v4i32.v4i32(<4 x i32> undef, <4 x i32> undef) 141; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 142; 143; CHECK-SIZE-LABEL: 'uscmp' 144; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u8 = call i8 @llvm.ucmp.i8.i8(i8 undef, i8 undef) 145; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u16 = call i16 @llvm.ucmp.i16.i16(i16 undef, i16 undef) 146; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u32 = call i32 @llvm.ucmp.i32.i32(i32 undef, i32 undef) 147; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %u64 = call i64 @llvm.ucmp.i64.i64(i64 undef, i64 undef) 148; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %uv16i8 = call <16 x i8> @llvm.ucmp.v16i8.v16i8(<16 x i8> undef, <16 x i8> undef) 149; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %uv8i16 = call <8 x i16> @llvm.ucmp.v8i16.v8i16(<8 x i16> undef, <8 x i16> undef) 150; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %uv4i32 = call <4 x i32> @llvm.ucmp.v4i32.v4i32(<4 x i32> undef, <4 x i32> undef) 151; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s8 = call i8 @llvm.scmp.i8.i8(i8 undef, i8 undef) 152; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s16 = call i16 @llvm.scmp.i16.i16(i16 undef, i16 undef) 153; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s32 = call i32 @llvm.scmp.i32.i32(i32 undef, i32 undef) 154; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s64 = call i64 @llvm.scmp.i64.i64(i64 undef, i64 undef) 155; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %sv16i8 = call <16 x i8> @llvm.scmp.v16i8.v16i8(<16 x i8> undef, <16 x i8> undef) 156; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %sv8i16 = call <8 x i16> @llvm.scmp.v8i16.v8i16(<8 x i16> undef, <8 x i16> undef) 157; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %sv4i32 = call <4 x i32> @llvm.scmp.v4i32.v4i32(<4 x i32> undef, <4 x i32> undef) 158; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 159; 160 %u8 = call i8 @llvm.ucmp(i8 undef, i8 undef) 161 %u16 = call i16 @llvm.ucmp(i16 undef, i16 undef) 162 %u32 = call i32 @llvm.ucmp(i32 undef, i32 undef) 163 %u64 = call i64 @llvm.ucmp(i64 undef, i64 undef) 164 %uv16i8 = call <16 x i8> @llvm.ucmp(<16 x i8> undef, <16 x i8> undef) 165 %uv8i16 = call <8 x i16> @llvm.ucmp(<8 x i16> undef, <8 x i16> undef) 166 %uv4i32 = call <4 x i32> @llvm.ucmp(<4 x i32> undef, <4 x i32> undef) 167 %s8 = call i8 @llvm.scmp(i8 undef, i8 undef) 168 %s16 = call i16 @llvm.scmp(i16 undef, i16 undef) 169 %s32 = call i32 @llvm.scmp(i32 undef, i32 undef) 170 %s64 = call i64 @llvm.scmp(i64 undef, i64 undef) 171 %sv16i8 = call <16 x i8> @llvm.scmp(<16 x i8> undef, <16 x i8> undef) 172 %sv8i16 = call <8 x i16> @llvm.scmp(<8 x i16> undef, <8 x i16> undef) 173 %sv4i32 = call <4 x i32> @llvm.scmp(<4 x i32> undef, <4 x i32> undef) 174 ret void 175} 176