diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -1500,8 +1500,6 @@ } case Intrinsic::fshl: case Intrinsic::fshr: { - if (isa(RetTy)) - return BaseT::getIntrinsicInstrCost(ICA, CostKind); const Value *X = Args[0]; const Value *Y = Args[1]; const Value *Z = Args[2]; diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -420,6 +420,12 @@ } break; } + case Intrinsic::fshl: + case Intrinsic::fshr: + // FIXME: Match legacy behavior; this is probably not the right costing. + if (isa(RetTy)) + return 1; + break; default: break; } diff --git a/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll b/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll --- a/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll +++ b/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll @@ -33,7 +33,7 @@ define void @fshr( %a, %b, %c) { ; CHECK-LABEL: 'fshr' -; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call @llvm.fshr.nxv1i32( %a, %b, %c) +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %1 = call @llvm.fshr.nxv1i32( %a, %b, %c) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; call @llvm.fshr.nxv4i32( %a, %b, %c) @@ -42,7 +42,7 @@ define void @fshl( %a, %b, %c) { ; CHECK-LABEL: 'fshl' -; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call @llvm.fshl.nxv1i32( %a, %b, %c) +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %1 = call @llvm.fshl.nxv1i32( %a, %b, %c) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; call @llvm.fshl.nxv4i32( %a, %b, %c)