[llvm] [KnownFPClass] Add support for non-intrinsic math libcalls (PR #216234)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 22 00:46:26 PDT 2026
================
@@ -0,0 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -S < %s | FileCheck %s
+
+declare float @acoshf(float)
+
+; acosh is never negative.
+define float @ret_acosh(float %arg) {
+; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_acosh(
+; CHECK-SAME: float [[ARG:%.*]]) {
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @acoshf(float [[ARG]])
+; CHECK-NEXT: ret float [[CALL]]
+;
+ %call = call float @acoshf(float %arg)
+ ret float %call
+}
+
+; A non-NaN input below 1 can still produce a quiet NaN.
+define float @ret_acosh_nonnan(float nofpclass(nan) %arg) {
+; CHECK-LABEL: define nofpclass(snan ninf nzero nsub nnorm) float @ret_acosh_nonnan(
+; CHECK-SAME: float nofpclass(nan) [[ARG:%.*]]) {
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nzero nsub nnorm) float @acoshf(float nofpclass(nan) [[ARG]])
+; CHECK-NEXT: ret float [[CALL]]
+;
+ %call = call float @acoshf(float %arg)
+ ret float %call
+}
+
+define float @ret_acosh_nonsnan(float nofpclass(snan) %arg) {
+; CHECK-LABEL: define nofpclass(snan ninf nzero nsub nnorm) float @ret_acosh_nonsnan(
+; CHECK-SAME: float nofpclass(snan) [[ARG:%.*]]) {
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nzero nsub nnorm) float @acoshf(float nofpclass(snan) [[ARG]])
+; CHECK-NEXT: ret float [[CALL]]
+;
+ %call = call float @acoshf(float %arg)
+ ret float %call
+}
----------------
arsenm wrote:
Have a basic tests for each of the FP types
https://github.com/llvm/llvm-project/pull/216234
More information about the llvm-commits
mailing list