[llvm] InstCombine: Add a few more tests for SimplifyDemandedeFPClass exp handling (PR #178147)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 02:11:29 PST 2026


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/178147

These got lost in various merges. Test a few cases where flags are inferred
from context.

>From e8f9501c65ef8a3a7db1353278659531ba5b56c9 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 14 Jan 2026 20:30:52 +0100
Subject: [PATCH] InstCombine: Add a few more tests for
 SimplifyDemandedeFPClass exp handling

These got lost in various merges. Test a few cases where flags are inferred
from context.
---
 .../simplify-demanded-fpclass-exp.ll          | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll
index e026aab18df5b..f3c8abddda115 100644
--- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll
@@ -563,6 +563,46 @@ define nofpclass(inf zero sub norm) <2 x float> @ret_only_nan__exp2_vec_partiall
   ret <2 x float> %exp
 }
 
+define nofpclass(snan) float @ret_no_snan__exp__no_inf(float nofpclass(inf) %x) {
+; CHECK-LABEL: define nofpclass(snan) float @ret_no_snan__exp__no_inf(
+; CHECK-SAME: float nofpclass(inf) [[X:%.*]]) {
+; CHECK-NEXT:    [[EXP:%.*]] = call float @llvm.exp.f32(float [[X]])
+; CHECK-NEXT:    ret float [[EXP]]
+;
+  %exp = call float @llvm.exp.f32(float %x)
+  ret float %exp
+}
+
+define nofpclass(inf) float @ret_no_inf__exp__no_inf(float nofpclass(inf) %x) {
+; CHECK-LABEL: define nofpclass(inf) float @ret_no_inf__exp__no_inf(
+; CHECK-SAME: float nofpclass(inf) [[X:%.*]]) {
+; CHECK-NEXT:    [[EXP:%.*]] = call ninf float @llvm.exp.f32(float [[X]])
+; CHECK-NEXT:    ret float [[EXP]]
+;
+  %exp = call float @llvm.exp.f32(float %x)
+  ret float %exp
+}
+
+define nofpclass(pinf) float @ret_no_pinf__exp__no_pinf(float nofpclass(pinf) %x) {
+; CHECK-LABEL: define nofpclass(pinf) float @ret_no_pinf__exp__no_pinf(
+; CHECK-SAME: float nofpclass(pinf) [[X:%.*]]) {
+; CHECK-NEXT:    [[EXP:%.*]] = call float @llvm.exp.f32(float [[X]])
+; CHECK-NEXT:    ret float [[EXP]]
+;
+  %exp = call float @llvm.exp.f32(float %x)
+  ret float %exp
+}
+
+define nofpclass(nan inf) float @ret_no_inf_no_nan__exp__no_inf(float nofpclass(inf) %x) {
+; CHECK-LABEL: define nofpclass(nan inf) float @ret_no_inf_no_nan__exp__no_inf(
+; CHECK-SAME: float nofpclass(inf) [[X:%.*]]) {
+; CHECK-NEXT:    [[EXP:%.*]] = call nnan ninf float @llvm.exp.f32(float [[X]])
+; CHECK-NEXT:    ret float [[EXP]]
+;
+  %exp = call noundef float @llvm.exp.f32(float %x)
+  ret float %exp
+}
+
 !0 = !{!"function_entry_count", i64 1000}
 ;.
 ; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }



More information about the llvm-commits mailing list