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=thumbv8.1m.main-none-eabi < %s | FileCheck %s 3 4target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" 5 6define void @shl(i32 %a, i32 %b) { 7; CHECK-LABEL: 'shl' 8; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = shl i32 %a, 3 9; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ac = add i32 %b, %as 10; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ss = shl i32 %a, 3 11; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sc = sub i32 %b, %ss 12; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %xs = shl i32 %a, 3 13; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %xc = xor i32 %b, %xs 14; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ns = shl i32 %a, 3 15; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nc = and i32 %b, %ns 16; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %os = shl i32 %a, 3 17; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %oc = or i32 %b, %os 18; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %is = shl i32 %a, 3 19; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ic = icmp eq i32 %b, %is 20; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 21; 22 %as = shl i32 %a, 3 23 %ac = add i32 %b, %as 24 %ss = shl i32 %a, 3 25 %sc = sub i32 %b, %ss 26 %xs = shl i32 %a, 3 27 %xc = xor i32 %b, %xs 28 %ns = shl i32 %a, 3 29 %nc = and i32 %b, %ns 30 %os = shl i32 %a, 3 31 %oc = or i32 %b, %os 32 %is = shl i32 %a, 3 33 %ic = icmp eq i32 %b, %is 34 ret void 35} 36 37define void @ashr(i32 %a, i32 %b) { 38; CHECK-LABEL: 'ashr' 39; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = ashr i32 %a, 3 40; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ac = add i32 %b, %as 41; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ss = ashr i32 %a, 3 42; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sc = sub i32 %b, %ss 43; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %xs = ashr i32 %a, 3 44; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %xc = xor i32 %b, %xs 45; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ns = ashr i32 %a, 3 46; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nc = and i32 %b, %ns 47; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %os = ashr i32 %a, 3 48; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %oc = or i32 %b, %os 49; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %is = ashr i32 %a, 3 50; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ic = icmp eq i32 %b, %is 51; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 52; 53 %as = ashr i32 %a, 3 54 %ac = add i32 %b, %as 55 %ss = ashr i32 %a, 3 56 %sc = sub i32 %b, %ss 57 %xs = ashr i32 %a, 3 58 %xc = xor i32 %b, %xs 59 %ns = ashr i32 %a, 3 60 %nc = and i32 %b, %ns 61 %os = ashr i32 %a, 3 62 %oc = or i32 %b, %os 63 %is = ashr i32 %a, 3 64 %ic = icmp eq i32 %b, %is 65 ret void 66} 67 68define void @lshr(i32 %a, i32 %b) { 69; CHECK-LABEL: 'lshr' 70; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = lshr i32 %a, 3 71; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ac = add i32 %b, %as 72; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ss = lshr i32 %a, 3 73; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sc = sub i32 %b, %ss 74; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %xs = lshr i32 %a, 3 75; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %xc = xor i32 %b, %xs 76; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ns = lshr i32 %a, 3 77; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nc = and i32 %b, %ns 78; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %os = lshr i32 %a, 3 79; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %oc = or i32 %b, %os 80; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %is = lshr i32 %a, 3 81; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ic = icmp eq i32 %b, %is 82; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void 83; 84 %as = lshr i32 %a, 3 85 %ac = add i32 %b, %as 86 %ss = lshr i32 %a, 3 87 %sc = sub i32 %b, %ss 88 %xs = lshr i32 %a, 3 89 %xc = xor i32 %b, %xs 90 %ns = lshr i32 %a, 3 91 %nc = and i32 %b, %ns 92 %os = lshr i32 %a, 3 93 %oc = or i32 %b, %os 94 %is = lshr i32 %a, 3 95 %ic = icmp eq i32 %b, %is 96 ret void 97} 98 99