47 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt < %s -passes="print<cost-model>" -cost-kind=latency 2>&1 -disable-output -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 | FileCheck %s --check-prefix=LATENCY3; RUN: opt < %s -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 | FileCheck %s --check-prefix=CODESIZE4 5; Tests if the interface TargetTransformInfo::getInstructionCost() works correctly.6 7target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"8 9declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32)10 11define i64 @foo(i64 %arg) {12; LATENCY-LABEL: 'foo'13; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %A1 = alloca i32, align 814; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = alloca i64, i64 undef, align 815; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = add i64 undef, undef16; LATENCY-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %1 = load i64, ptr undef, align 417; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %I2P = inttoptr i64 undef to ptr18; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %P2I = ptrtoint ptr undef to i6419; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %TC = trunc i64 undef to i3220; LATENCY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %uadd = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 undef, i32 undef)21; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void undef()22; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 undef23;24; CODESIZE-LABEL: 'foo'25; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %A1 = alloca i32, align 826; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = alloca i64, i64 undef, align 827; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = add i64 undef, undef28; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = load i64, ptr undef, align 429; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %I2P = inttoptr i64 undef to ptr30; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %P2I = ptrtoint ptr undef to i6431; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %TC = trunc i64 undef to i3232; CODESIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uadd = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 undef, i32 undef)33; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void undef()34; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 undef35;36 %A1 = alloca i32, align 837 %A2 = alloca i64, i64 undef, align 838 %I64 = add i64 undef, undef39 load i64, ptr undef, align 440 %I2P = inttoptr i64 undef to ptr41 %P2I = ptrtoint ptr undef to i6442 %TC = trunc i64 undef to i3243 %uadd = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 undef, i32 undef)44 call void undef()45 ret i64 undef46}47