blob: 67f7088f97f57fc3698a992a8808bea2921c85a0 [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt -cost-model -analyze -mtriple=thumbv8.1m.main-none-eabi < %s | FileCheck %s
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
define void @shl(i32 %a, i32 %b) {
; CHECK-LABEL: 'shl'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = shl i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ac = add i32 %b, %as
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ss = shl i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sc = sub i32 %b, %ss
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %xs = shl i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %xc = xor i32 %b, %xs
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ns = shl i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nc = and i32 %b, %ns
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %os = shl i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %oc = or i32 %b, %os
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %is = shl i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ic = icmp eq i32 %b, %is
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
%as = shl i32 %a, 3
%ac = add i32 %b, %as
%ss = shl i32 %a, 3
%sc = sub i32 %b, %ss
%xs = shl i32 %a, 3
%xc = xor i32 %b, %xs
%ns = shl i32 %a, 3
%nc = and i32 %b, %ns
%os = shl i32 %a, 3
%oc = or i32 %b, %os
%is = shl i32 %a, 3
%ic = icmp eq i32 %b, %is
ret void
}
define void @ashr(i32 %a, i32 %b) {
; CHECK-LABEL: 'ashr'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = ashr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ac = add i32 %b, %as
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ss = ashr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sc = sub i32 %b, %ss
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %xs = ashr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %xc = xor i32 %b, %xs
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ns = ashr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nc = and i32 %b, %ns
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %os = ashr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %oc = or i32 %b, %os
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %is = ashr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ic = icmp eq i32 %b, %is
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
%as = ashr i32 %a, 3
%ac = add i32 %b, %as
%ss = ashr i32 %a, 3
%sc = sub i32 %b, %ss
%xs = ashr i32 %a, 3
%xc = xor i32 %b, %xs
%ns = ashr i32 %a, 3
%nc = and i32 %b, %ns
%os = ashr i32 %a, 3
%oc = or i32 %b, %os
%is = ashr i32 %a, 3
%ic = icmp eq i32 %b, %is
ret void
}
define void @lshr(i32 %a, i32 %b) {
; CHECK-LABEL: 'lshr'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = lshr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ac = add i32 %b, %as
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ss = lshr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sc = sub i32 %b, %ss
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %xs = lshr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %xc = xor i32 %b, %xs
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %ns = lshr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %nc = and i32 %b, %ns
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %os = lshr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %oc = or i32 %b, %os
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %is = lshr i32 %a, 3
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ic = icmp eq i32 %b, %is
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
%as = lshr i32 %a, 3
%ac = add i32 %b, %as
%ss = lshr i32 %a, 3
%sc = sub i32 %b, %ss
%xs = lshr i32 %a, 3
%xc = xor i32 %b, %xs
%ns = lshr i32 %a, 3
%nc = and i32 %b, %ns
%os = lshr i32 %a, 3
%oc = or i32 %b, %os
%is = lshr i32 %a, 3
%ic = icmp eq i32 %b, %is
ret void
}