[PATCH] D139008: Intrinsics: Make is_fpclass and arithmetic_fence speculatable
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 05:45:15 PST 2022
arsenm created this revision.
arsenm added a reviewer: jdoerfert.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
Mostly I'm not sure where the right place for the test is. I don't see an obvious test all these intrinsics are speculatable test
https://reviews.llvm.org/D139008
Files:
llvm/include/llvm/IR/Intrinsics.td
llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
Index: llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
===================================================================
--- llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
+++ llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
@@ -62,3 +62,34 @@
b:
ret void
}
+
+; CHECK-LABEL: @ifThen_fpclass(
+; CHECK: %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11)
+; CHECK-NEXT: br i1 true
+define void @ifThen_fpclass(float %x) {
+ br i1 true, label %a, label %b
+
+a:
+ %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11)
+ br label %b
+
+b:
+ ret void
+}
+
+; CHECK-LABEL: @ifThen_arithmetic_fence(
+; CHECK: %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11)
+; CHECK-NEXT: br i1 true
+define void @ifThen_arithmetic_fence(float %x) {
+ br i1 true, label %a, label %b
+
+a:
+ %canon = call float @llvm.arithmetic.fence.f32(float %x)
+ br label %b
+
+b:
+ ret void
+}
+
+declare i1 @llvm.is.fpclass.f32(float, i32)
+declare float @llvm.arithmetic.fence.f32(float)
Index: llvm/include/llvm/IR/Intrinsics.td
===================================================================
--- llvm/include/llvm/IR/Intrinsics.td
+++ llvm/include/llvm/IR/Intrinsics.td
@@ -710,6 +710,9 @@
def int_roundeven : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
def int_canonicalize : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>],
[IntrNoMem]>;
+ // Arithmetic fence intrinsic.
+ def int_arithmetic_fence : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>],
+ [IntrNoMem]>;
def int_lround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
def int_llround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
@@ -757,7 +760,7 @@
def int_is_fpclass
: DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
[llvm_anyfloat_ty, llvm_i32_ty],
- [IntrNoMem, IntrWillReturn, ImmArg<ArgIndex<1>>]>;
+ [IntrNoMem, IntrWillReturn, IntrSpeculatable, ImmArg<ArgIndex<1>>]>;
//===--------------- Constrained Floating Point Intrinsics ----------------===//
//
@@ -1389,9 +1392,6 @@
def int_pseudoprobe : DefaultAttrsIntrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty, llvm_i64_ty],
[IntrInaccessibleMemOnly, IntrWillReturn]>;
-// Arithmetic fence intrinsic.
-def int_arithmetic_fence : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
-
// Intrinsics to support half precision floating point format
let IntrProperties = [IntrNoMem, IntrWillReturn] in {
def int_convert_to_fp16 : DefaultAttrsIntrinsic<[llvm_i16_ty], [llvm_anyfloat_ty]>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139008.478920.patch
Type: text/x-patch
Size: 2796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221130/36181c04/attachment.bin>
More information about the llvm-commits
mailing list