1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2; RUN: opt < %s -cost-model -cost-kind=code-size -analyze -mtriple=x86_64-- | FileCheck %s 3 4define i8 @trunc_i64_i8(i64 %x) { 5; CHECK-LABEL: 'trunc_i64_i8' 6; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = trunc i64 %x to i8 7; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r 8; 9 %r = trunc i64 %x to i8 10 ret i8 %r 11} 12 13define i64 @sext_i8_i64(i8 %x) { 14; CHECK-LABEL: 'sext_i8_i64' 15; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = sext i8 %x to i64 16; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 17; 18 %r = sext i8 %x to i64 19 ret i64 %r 20} 21 22define i64 @zext_i8_i64(i8 %x) { 23; CHECK-LABEL: 'zext_i8_i64' 24; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = zext i8 %x to i64 25; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 26; 27 %r = zext i8 %x to i64 28 ret i64 %r 29} 30 31define i64 @bitcast_f64_i64(double %x) { 32; CHECK-LABEL: 'bitcast_f64_i64' 33; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = bitcast double %x to i64 34; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 35; 36 %r = bitcast double %x to i64 37 ret i64 %r 38} 39 40define double @bitcast_i64_f64(i64 %x) { 41; CHECK-LABEL: 'bitcast_i64_f64' 42; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = bitcast i64 %x to double 43; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r 44; 45 %r = bitcast i64 %x to double 46 ret double %r 47} 48 49define i64* @inttoptr_i64_p64(i64 %x) { 50; CHECK-LABEL: 'inttoptr_i64_p64' 51; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = inttoptr i64 %x to i64* 52; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64* %r 53; 54 %r = inttoptr i64 %x to i64* 55 ret i64* %r 56} 57 58define i64 @ptrtoint_p64_i64(i64* %x) { 59; CHECK-LABEL: 'ptrtoint_p64_i64' 60; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = ptrtoint i64* %x to i64 61; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 62; 63 %r = ptrtoint i64* %x to i64 64 ret i64 %r 65} 66 67define i64 @add_i64(i64 %x, i64 %y) { 68; CHECK-LABEL: 'add_i64' 69; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = add i64 %x, %y 70; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 71; 72 %r = add i64 %x, %y 73 ret i64 %r 74} 75 76define i64 @sub_i64(i64 %x, i64 %y) { 77; CHECK-LABEL: 'sub_i64' 78; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = sub i64 %x, %y 79; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 80; 81 %r = sub i64 %x, %y 82 ret i64 %r 83} 84 85define i64 @mul_i64(i64 %x, i64 %y) { 86; CHECK-LABEL: 'mul_i64' 87; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = mul i64 %x, %y 88; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 89; 90 %r = mul i64 %x, %y 91 ret i64 %r 92} 93 94; FIXME: idiv is 1 instruction. 95 96define i64 @sdiv_i64(i64 %x, i64 %y) { 97; CHECK-LABEL: 'sdiv_i64' 98; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %x, %y 99; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 100; 101 %r = sdiv i64 %x, %y 102 ret i64 %r 103} 104 105; FIXME: div is 1 instruction. 106 107define i64 @udiv_i64(i64 %x, i64 %y) { 108; CHECK-LABEL: 'udiv_i64' 109; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = udiv i64 %x, %y 110; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 111; 112 %r = udiv i64 %x, %y 113 ret i64 %r 114} 115 116; FIXME: idiv is 1 instruction. 117 118define i64 @srem_i64(i64 %x, i64 %y) { 119; CHECK-LABEL: 'srem_i64' 120; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i64 %x, %y 121; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 122; 123 %r = srem i64 %x, %y 124 ret i64 %r 125} 126 127; FIXME: div is 1 instruction. 128 129define i64 @urem_i64(i64 %x, i64 %y) { 130; CHECK-LABEL: 'urem_i64' 131; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = urem i64 %x, %y 132; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 133; 134 %r = urem i64 %x, %y 135 ret i64 %r 136} 137 138define i64 @ashr_i64(i64 %x, i64 %y) { 139; CHECK-LABEL: 'ashr_i64' 140; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = ashr i64 %x, %y 141; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 142; 143 %r = ashr i64 %x, %y 144 ret i64 %r 145} 146 147define i64 @lshr_i64(i64 %x, i64 %y) { 148; CHECK-LABEL: 'lshr_i64' 149; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = lshr i64 %x, %y 150; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 151; 152 %r = lshr i64 %x, %y 153 ret i64 %r 154} 155 156define i64 @shl_i64(i64 %x, i64 %y) { 157; CHECK-LABEL: 'shl_i64' 158; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = shl i64 %x, %y 159; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 160; 161 %r = shl i64 %x, %y 162 ret i64 %r 163} 164 165define i64 @and_i64(i64 %x, i64 %y) { 166; CHECK-LABEL: 'and_i64' 167; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = and i64 %x, %y 168; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 169; 170 %r = and i64 %x, %y 171 ret i64 %r 172} 173 174define i64 @or_i64(i64 %x, i64 %y) { 175; CHECK-LABEL: 'or_i64' 176; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = or i64 %x, %y 177; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 178; 179 %r = or i64 %x, %y 180 ret i64 %r 181} 182 183define i64 @xor_i64(i64 %x, i64 %y) { 184; CHECK-LABEL: 'xor_i64' 185; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = xor i64 %x, %y 186; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r 187; 188 %r = xor i64 %x, %y 189 ret i64 %r 190} 191 192define double @fadd_f64(double %x, double %y) { 193; CHECK-LABEL: 'fadd_f64' 194; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fadd double %x, %y 195; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r 196; 197 %r = fadd double %x, %y 198 ret double %r 199} 200 201define double @fsub_f64(double %x, double %y) { 202; CHECK-LABEL: 'fsub_f64' 203; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fsub double %x, %y 204; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r 205; 206 %r = fsub double %x, %y 207 ret double %r 208} 209 210define double @fmul_f64(double %x, double %y) { 211; CHECK-LABEL: 'fmul_f64' 212; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fmul double %x, %y 213; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r 214; 215 %r = fmul double %x, %y 216 ret double %r 217} 218 219; FIXME: divsd is 1 instruction. 220 221define double @fdiv_f64(double %x, double %y) { 222; CHECK-LABEL: 'fdiv_f64' 223; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = fdiv double %x, %y 224; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r 225; 226 %r = fdiv double %x, %y 227 ret double %r 228} 229 230; TODO: How does this lower? 231 232define double @frem_f64(double %x, double %y) { 233; CHECK-LABEL: 'frem_f64' 234; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = frem double %x, %y 235; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r 236; 237 %r = frem double %x, %y 238 ret double %r 239} 240 241define double @fneg_f64(double %x) { 242; CHECK-LABEL: 'fneg_f64' 243; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fneg double %x 244; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r 245; 246 %r = fneg double %x 247 ret double %r 248} 249