ValueTracking: Add baseline test for trunc computeKnownFPClass handling
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 9 Apr 2023 10:49:48 +0000 (06:49 -0400)
committerMatt Arsenault <arsenm2@gmail.com>
Fri, 14 Apr 2023 21:41:26 +0000 (17:41 -0400)
llvm/test/Transforms/Attributor/nofpclass-trunc.ll [new file with mode: 0644]

diff --git a/llvm/test/Transforms/Attributor/nofpclass-trunc.ll b/llvm/test/Transforms/Attributor/nofpclass-trunc.ll
new file mode 100644 (file)
index 0000000..37f128a
--- /dev/null
@@ -0,0 +1,167 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
+
+declare float @llvm.trunc.f32(float)
+declare ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128)
+
+define float @ret_trunc(float %arg0) {
+; CHECK-LABEL: define float @ret_trunc
+; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_noinf(float nofpclass(inf) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_noinf
+; CHECK-SAME: (float nofpclass(inf) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_nopinf(float nofpclass(pinf) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_nopinf
+; CHECK-SAME: (float nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_noninf(float nofpclass(ninf) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_noninf
+; CHECK-SAME: (float nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_nonan(float nofpclass(nan) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_nonan
+; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_noqnan(float nofpclass(qnan) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_noqnan
+; CHECK-SAME: (float nofpclass(qnan) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_nosnan(float nofpclass(snan) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_nosnan
+; CHECK-SAME: (float nofpclass(snan) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_nozero(float nofpclass(zero) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_nozero
+; CHECK-SAME: (float nofpclass(zero) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_nopzero(float nofpclass(pzero) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_nopzero
+; CHECK-SAME: (float nofpclass(pzero) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_nonzero(float nofpclass(nzero) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_nonzero
+; CHECK-SAME: (float nofpclass(nzero) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define float @ret_trunc_nonorm(float nofpclass(norm) %arg0) {
+; CHECK-LABEL: define float @ret_trunc_nonorm
+; CHECK-SAME: (float nofpclass(norm) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.trunc.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret float [[CALL]]
+;
+  %call = call float @llvm.trunc.f32(float %arg0)
+  ret float %call
+}
+
+define ppc_fp128 @ret_trunc_ppcf128(ppc_fp128 %arg0) {
+; CHECK-LABEL: define ppc_fp128 @ret_trunc_ppcf128
+; CHECK-SAME: (ppc_fp128 [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret ppc_fp128 [[CALL]]
+;
+  %call = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 %arg0)
+  ret ppc_fp128 %call
+}
+
+define ppc_fp128 @ret_trunc_noinf_ppcf128(ppc_fp128 nofpclass(inf) %arg0) {
+; CHECK-LABEL: define ppc_fp128 @ret_trunc_noinf_ppcf128
+; CHECK-SAME: (ppc_fp128 nofpclass(inf) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret ppc_fp128 [[CALL]]
+;
+  %call = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 %arg0)
+  ret ppc_fp128 %call
+}
+
+define ppc_fp128 @ret_trunc_nopinf_ppcf128(ppc_fp128 nofpclass(pinf) %arg0) {
+; CHECK-LABEL: define ppc_fp128 @ret_trunc_nopinf_ppcf128
+; CHECK-SAME: (ppc_fp128 nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret ppc_fp128 [[CALL]]
+;
+  %call = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 %arg0)
+  ret ppc_fp128 %call
+}
+
+define ppc_fp128 @ret_trunc_noninf_ppcf128(ppc_fp128 nofpclass(ninf) %arg0) {
+; CHECK-LABEL: define ppc_fp128 @ret_trunc_noninf_ppcf128
+; CHECK-SAME: (ppc_fp128 nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret ppc_fp128 [[CALL]]
+;
+  %call = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 %arg0)
+  ret ppc_fp128 %call
+}
+
+define ppc_fp128 @ret_trunc_nonan_ppcf128(ppc_fp128 nofpclass(nan) %arg0) {
+; CHECK-LABEL: define ppc_fp128 @ret_trunc_nonan_ppcf128
+; CHECK-SAME: (ppc_fp128 nofpclass(nan) [[ARG0:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT:    [[CALL:%.*]] = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    ret ppc_fp128 [[CALL]]
+;
+  %call = call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 %arg0)
+  ret ppc_fp128 %call
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; TUNIT: {{.*}}