Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h =================================================================== --- llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ 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]; Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp =================================================================== --- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -420,6 +420,12 @@ } break; } + case Intrinsic::fshl: + case Intrinsic::fshr: + // Match legacy behavior - this is probably not the right costing here + if (isa(RetTy)) + return 1; + break; default: break; } Index: llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll =================================================================== --- llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll +++ 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)