Index: docs/StackMaps.rst =================================================================== --- docs/StackMaps.rst +++ docs/StackMaps.rst @@ -192,6 +192,9 @@ declare i64 @llvm.experimental.patchpoint.i64(i64 , i32 , i8* , i32 , ...) + declare double + @llvm.experimental.patchpoint.double(i64 , i32 , + i8* , i32 , ...) Overview: """"""""" Index: include/llvm/IR/Intrinsics.td =================================================================== --- include/llvm/IR/Intrinsics.td +++ include/llvm/IR/Intrinsics.td @@ -490,6 +490,11 @@ llvm_ptr_ty, llvm_i32_ty, llvm_vararg_ty], [Throws]>; +def int_experimental_patchpoint_double : Intrinsic<[llvm_double_ty], + [llvm_i64_ty, llvm_i32_ty, + llvm_ptr_ty, llvm_i32_ty, + llvm_vararg_ty], + [Throws]>; //===-------------------------- Other Intrinsics --------------------------===// // Index: lib/CodeGen/SelectionDAG/FastISel.cpp =================================================================== --- lib/CodeGen/SelectionDAG/FastISel.cpp +++ lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1205,6 +1205,7 @@ return selectStackmap(II); case Intrinsic::experimental_patchpoint_void: case Intrinsic::experimental_patchpoint_i64: + case Intrinsic::experimental_patchpoint_double: return selectPatchpoint(II); } Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2026,6 +2026,7 @@ break; case Intrinsic::experimental_patchpoint_void: case Intrinsic::experimental_patchpoint_i64: + case Intrinsic::experimental_patchpoint_double: visitPatchpoint(ImmutableCallSite(&I), LandingPad); break; } @@ -5536,7 +5537,8 @@ return nullptr; } case Intrinsic::experimental_patchpoint_void: - case Intrinsic::experimental_patchpoint_i64: { + case Intrinsic::experimental_patchpoint_i64: + case Intrinsic::experimental_patchpoint_double: { visitPatchpoint(ImmutableCallSite(&I), nullptr); return nullptr; } Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1014,6 +1014,7 @@ NumFastIselFailStackMap++; return; case Intrinsic::experimental_patchpoint_void: // fall-through case Intrinsic::experimental_patchpoint_i64: + case Intrinsic::experimental_patchpoint_double: NumFastIselFailPatchPoint++; return; } } Index: lib/IR/Verifier.cpp =================================================================== --- lib/IR/Verifier.cpp +++ lib/IR/Verifier.cpp @@ -2218,7 +2218,8 @@ Assert1(!F->isIntrinsic() || isa(I) || F->getIntrinsicID() == Intrinsic::donothing || F->getIntrinsicID() == Intrinsic::experimental_patchpoint_void || - F->getIntrinsicID() == Intrinsic::experimental_patchpoint_i64, + F->getIntrinsicID() == Intrinsic::experimental_patchpoint_i64 || + F->getIntrinsicID() == Intrinsic::experimental_patchpoint_double, "Cannot invoke an intrinsinc other than" " donothing or patchpoint", &I); Assert1(F->getParent() == M, "Referencing function in another module!", Index: lib/Target/AArch64/AArch64TargetTransformInfo.cpp =================================================================== --- lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -280,6 +280,7 @@ break; case Intrinsic::experimental_patchpoint_void: case Intrinsic::experimental_patchpoint_i64: + case Intrinsic::experimental_patchpoint_double: if ((Idx < 4) || (Imm.getBitWidth() <= 64 && isInt<64>(Imm.getSExtValue()))) return TCC_Free; break; Index: lib/Target/X86/X86TargetTransformInfo.cpp =================================================================== --- lib/Target/X86/X86TargetTransformInfo.cpp +++ lib/Target/X86/X86TargetTransformInfo.cpp @@ -1141,6 +1141,7 @@ break; case Intrinsic::experimental_patchpoint_void: case Intrinsic::experimental_patchpoint_i64: + case Intrinsic::experimental_patchpoint_double: if ((Idx < 4) || (Imm.getBitWidth() <= 64 && isInt<64>(Imm.getSExtValue()))) return TCC_Free; break; Index: test/CodeGen/X86/patchpoint.ll =================================================================== --- test/CodeGen/X86/patchpoint.ll +++ test/CodeGen/X86/patchpoint.ll @@ -21,6 +21,23 @@ ret i64 %result } +define double @double_patchpoint(double %p1, double %p2, double %p3, double %p4) { +entry: +; CHECK-LABEL: double_patchpoint: +; CHECK: movabsq $-559038736, %r11 +; CHECK-NEXT: callq *%r11 +; CHECK-NEXT: xchgw %ax, %ax +; CHECK: movsd %xmm0, [[SPILL:[^ ]+]] +; CHECK: callq *%r11 +; CHECK-NEXT: xchgw %ax, %ax +; CHECK: movsd [[SPILL]], %xmm0 +; CHECK: ret + %resolveCall2 = inttoptr i64 -559038736 to i8* + %result = tail call double (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.double(i64 2, i32 15, i8* %resolveCall2, i32 4, double %p1, double %p2, double %p3, double %p4) + %result2 = tail call double (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.double(i64 2, i32 15, i8* %resolveCall2, i32 4, double %p1, double %p2, double %p3, double %p4) + ret double %result +} + ; Caller frame metadata with stackmaps. This should not be optimized ; as a leaf function. ; @@ -85,3 +102,4 @@ declare void @llvm.experimental.stackmap(i64, i32, ...) declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...) declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...) +declare double @llvm.experimental.patchpoint.double(i64, i32, i8*, i32, ...)