72 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes="require<profile-summary>,function(codegenprepare)" < %s | FileCheck %s --check-prefix=SLOW3; RUN: opt -S -passes="require<profile-summary>,function(codegenprepare)" -mattr=+bmi < %s | FileCheck %s --check-prefix=FAST_TZ4; RUN: opt -S -passes="require<profile-summary>,function(codegenprepare)" -mattr=+lzcnt < %s | FileCheck %s --check-prefix=FAST_LZ5 6; RUN: opt -S -enable-debugify -passes="require<profile-summary>,function(codegenprepare)" < %s | FileCheck %s --check-prefix=DEBUGINFO7 8target triple = "x86_64-unknown-unknown"9target datalayout = "e-n32:64"10 11; If the intrinsic is cheap, nothing should change.12; If the intrinsic is expensive, check if the input is zero to avoid the call.13; This is undoing speculation that may have been created by SimplifyCFG + InstCombine.14 15define i64 @cttz(i64 %A) {16; SLOW-LABEL: @cttz(17; SLOW-NEXT: entry:18; SLOW-NEXT: [[Z:%.*]] = call i64 @llvm.cttz.i64(i64 [[A:%.*]], i1 false)19; SLOW-NEXT: ret i64 [[Z]]20;21; FAST_TZ-LABEL: @cttz(22; FAST_TZ-NEXT: entry:23; FAST_TZ-NEXT: [[Z:%.*]] = call i64 @llvm.cttz.i64(i64 [[A:%.*]], i1 false)24; FAST_TZ-NEXT: ret i64 [[Z]]25;26; FAST_LZ-LABEL: @cttz(27; FAST_LZ-NEXT: entry:28; FAST_LZ-NEXT: [[Z:%.*]] = call i64 @llvm.cttz.i64(i64 [[A:%.*]], i1 false)29; FAST_LZ-NEXT: ret i64 [[Z]]30;31; DEBUGINFO-LABEL: @cttz(32; DEBUGINFO-NEXT: entry:33; DEBUGINFO-NEXT: [[Z:%.*]] = call i64 @llvm.cttz.i64(i64 [[A:%.*]], i1 false), !dbg [[DBG11:![0-9]+]]34; DEBUGINFO-NEXT: #dbg_value(i64 [[Z]], [[META9:![0-9]+]], !DIExpression(), [[DBG11]])35; DEBUGINFO-NEXT: ret i64 [[Z]], !dbg [[DBG12:![0-9]+]]36;37entry:38 %z = call i64 @llvm.cttz.i64(i64 %A, i1 false)39 ret i64 %z40}41 42define i64 @ctlz(i64 %A) {43; SLOW-LABEL: @ctlz(44; SLOW-NEXT: entry:45; SLOW-NEXT: [[Z:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A:%.*]], i1 false)46; SLOW-NEXT: ret i64 [[Z]]47;48; FAST_TZ-LABEL: @ctlz(49; FAST_TZ-NEXT: entry:50; FAST_TZ-NEXT: [[Z:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A:%.*]], i1 false)51; FAST_TZ-NEXT: ret i64 [[Z]]52;53; FAST_LZ-LABEL: @ctlz(54; FAST_LZ-NEXT: entry:55; FAST_LZ-NEXT: [[Z:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A:%.*]], i1 false)56; FAST_LZ-NEXT: ret i64 [[Z]]57;58; DEBUGINFO-LABEL: @ctlz(59; DEBUGINFO-NEXT: entry:60; DEBUGINFO-NEXT: [[Z:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A:%.*]], i1 false), !dbg [[DBG16:![0-9]+]]61; DEBUGINFO-NEXT: #dbg_value(i64 [[Z]], [[META15:![0-9]+]], !DIExpression(), [[DBG16]])62; DEBUGINFO-NEXT: ret i64 [[Z]], !dbg [[DBG17:![0-9]+]]63;64entry:65 %z = call i64 @llvm.ctlz.i64(i64 %A, i1 false)66 ret i64 %z67}68 69declare i64 @llvm.cttz.i64(i64, i1)70declare i64 @llvm.ctlz.i64(i64, i1)71 72