[llvm] f5e2eb1 - Intrinsics: Make is_fpclass and arithmetic_fence speculatable
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 1 11:41:28 PST 2022
Author: Matt Arsenault
Date: 2022-12-01T14:41:21-05:00
New Revision: f5e2eb11d8c4f54e26aed442d5262396b4b327a7
URL: https://github.com/llvm/llvm-project/commit/f5e2eb11d8c4f54e26aed442d5262396b4b327a7
DIFF: https://github.com/llvm/llvm-project/commit/f5e2eb11d8c4f54e26aed442d5262396b4b327a7.diff
LOG: Intrinsics: Make is_fpclass and arithmetic_fence speculatable
Added:
Modified:
llvm/include/llvm/IR/Intrinsics.td
llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 608222350251c..982f3c985746f 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -710,6 +710,9 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrWillReturn] in {
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 @@ let IntrProperties = [IntrInaccessibleMemOnly, IntrWillReturn] in {
def int_is_fpclass
: DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
[llvm_anyfloat_ty, llvm_i32_ty],
- [IntrNoMem, IntrWillReturn, ImmArg<ArgIndex<1>>]>;
+ [IntrNoMem, IntrSpeculatable, ImmArg<ArgIndex<1>>]>;
//===--------------- Constrained Floating Point Intrinsics ----------------===//
//
@@ -1389,9 +1392,6 @@ def int_sideeffect : DefaultAttrsIntrinsic<[], [], [IntrInaccessibleMemOnly, Int
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]>;
diff --git a/llvm/test/Transforms/SpeculativeExecution/spec-calls.ll b/llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
index 0c43407acdab0..56d6637b33a6c 100644
--- a/llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
+++ b/llvm/test/Transforms/SpeculativeExecution/spec-calls.ll
@@ -62,3 +62,34 @@ a:
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: %fence = call float @llvm.arithmetic.fence.f32(float %x)
+; CHECK-NEXT: br i1 true
+define void @ifThen_arithmetic_fence(float %x) {
+ br i1 true, label %a, label %b
+
+a:
+ %fence = 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)
More information about the llvm-commits
mailing list