[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-24 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 41e89afe22ef9263ddab2e502fb2181b350cb20a Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-24 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 41e89afe22ef9263ddab2e502fb2181b350cb20a Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-22 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From da42c4d269ebfe23bcdf401b54883256728e78a0 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-22 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From da42c4d269ebfe23bcdf401b54883256728e78a0 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-21 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From a36f61bb94c91e4c47ff38200c9000f8de6a002f Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-21 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From a36f61bb94c91e4c47ff38200c9000f8de6a002f Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-15 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 579934b84301666599564fd1946b69119516657c Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-15 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 579934b84301666599564fd1946b69119516657c Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-15 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 5ca79336a85a87a26b7ce7b936427c9ce4972391 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-15 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 5ca79336a85a87a26b7ce7b936427c9ce4972391 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-14 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 657e09c998cdffe17748cc2b0121a33825243136 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-14 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 657e09c998cdffe17748cc2b0121a33825243136 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-14 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From ffe0e46782d830ad63c5f0c18788786fa44cdfae Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-14 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From ffe0e46782d830ad63c5f0c18788786fa44cdfae Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-13 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 57541feb2a83ce2f5c9b310a28ec16f050d643b2 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-13 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 57541feb2a83ce2f5c9b310a28ec16f050d643b2 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-12 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 9cdb3b41f7d47f6a4196246ba2a2926ad7fc0dd8 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-12 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175615

>From 9cdb3b41f7d47f6a4196246ba2a2926ad7fc0dd8 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 12 Jan 2026 15:00:04 +0100
Subject: [PATCH] InstCombine: Add baseline fma tests for
 SimplifyDemandedFPClass

---
 .../simplify-demanded-fpclass-fma.ll  | 316 ++
 1 file changed, 316 insertions(+)
 create mode 100644 
llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll

diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll 
b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
new file mode 100644
index 0..3309a475bbf80
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fma.ll
@@ -0,0 +1,316 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+declare nofpclass(inf norm sub zero) half @returns_nan()
+
+define nofpclass(inf norm sub zero) half @ret_only_nan(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) half @ret_only_nan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero) <2 x half> @ret_only_nan_vec(<2 x half> 
%x, <2 x half> %y, <2 x half> %z) {
+; CHECK-LABEL: define nofpclass(inf zero sub norm) <2 x half> 
@ret_only_nan_vec(
+; CHECK-SAME: <2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> 
[[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call <2 x half> @llvm.fma.v2f16(<2 x half> 
[[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:ret <2 x half> [[RESULT]]
+;
+  %result = call <2 x half> @llvm.fma.v2f16(<2 x half> %x, <2 x half> %y, <2 x 
half> %z)
+  ret <2 x half> %result
+}
+
+define nofpclass(inf norm sub zero qnan) half @ret_only_snan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(qnan inf zero sub norm) half @ret_only_snan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf norm sub zero snan) half @ret_only_qnan(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan norm sub zero) half @ret_only_inf(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan zero sub norm) half @ret_only_inf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan pinf norm sub zero) half @ret_only_ninf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) half @ret_only_ninf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xHFC00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(nan ninf norm sub zero) half @ret_only_pinf(half %x, half %y, 
half %z) {
+; CHECK-LABEL: define nofpclass(nan ninf zero sub norm) half @ret_only_pinf(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH7C00
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub) half @ret_only_zero(half %x, half %y, half 
%z) {
+; CHECK-LABEL: define nofpclass(nan inf sub norm) half @ret_only_zero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:[[RESULT:%.*]] = call half @llvm.fma.f16(half [[X]], half 
[[Y]], half [[Z]])
+; CHECK-NEXT:ret half [[RESULT]]
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub nzero) half @ret_only_pzero(half %x, half 
%y, half %z) {
+; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) half @ret_only_pzero(
+; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
+; CHECK-NEXT:ret half 0xH
+;
+  %result = call half @llvm.fma.f16(half %x, half %y, half %z)
+  ret half %result
+}
+
+define nofpclass(inf nan norm sub pzero) half 

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-12 Thread via llvm-branch-commits

github-actions[bot] wrote:


# :penguin: Linux x64 Test Results

* 167926 tests passed
* 2989 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM

LLVM.CodeGen/PowerPC/peephole-mma-phi-liveness.ll

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc 
-verify-machineinstrs -mcpu=ppc -mtriple=powerpc64-ibm-aix < 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/PowerPC/peephole-mma-phi-liveness.ll
 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/PowerPC/peephole-mma-phi-liveness.ll
# executed command: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc 
-verify-machineinstrs -mcpu=ppc -mtriple=powerpc64-ibm-aix
# note: command had no output on stdout or stderr
# executed command: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/PowerPC/peephole-mma-phi-liveness.ll
# .---command stderr
# | 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/PowerPC/peephole-mma-phi-liveness.ll:36:15:
 error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: xxlxor 2, 2, 2
# |   ^
# | :39:16: note: scanning from here
# |  xxlxor 0, 0, 0
# |^
# | :40:2: note: possible intended match here
# |  xvsubdp 1, 0, 1
# |  ^
# | 
# | Input file: 
# | Check file: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/PowerPC/peephole-mma-phi-liveness.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<
# |.
# |.
# |.
# |   34: L..BB0_3: # %bb13 
# |   35:  # =>This Inner Loop Header: Depth=1 
# |   36:  bc 4, 2, L..BB0_3 
# |   37: # %bb.4: # %bb14 
# |   38:  xxmfacc 0 
# |   39:  xxlxor 0, 0, 0 
# | next:36'0X error: no match found
# |   40:  xvsubdp 1, 0, 1 
# | next:36'0 ~
# | next:36'1  ?possible intended match
# |   41:  xvmaddadp 0, 1, 0 
# | next:36'0 ~~~
# |   42:  xxswapd 0, 0 
# | next:36'0 ~~
# |   43:  stxv 0, 0(3) 
# | next:36'0 ~~
# |   44:  blr 
# | next:36'0 ~
# |   45: L..baz0: 
# | next:36'0 ~
# |.
# |.
# |.
# | >>
# `-
# error: command failed with exit status: 1

--

```


LLVM.Transforms/InstCombine/fabs.ll

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt 
-mtriple=x86_64-unknown-linux-gnu < 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fabs.ll
 -passes=instcombine -S | 
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fabs.ll
# executed command: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt 
-mtriple=x86_64-unknown-linux-gnu -passes=instcombine -S
# note: command had no output on stdout or stderr
# executed command: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fabs.ll
# .---command stderr
# | 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fabs.ll:210:15:
 error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: ret float [[FMA]]
# |   ^
# | :125:78: note: scanning from here
# |  %fma = call nnan float @llvm.fma.f32(float %x, float %x, float 
1.00e+00)
# | 
 ^
# | :125:78: note: with "FMA" equal to "%fma"
# |  %fma = call nnan float @llvm.fma.f32(float %x, float %x, float 
1.00e+00)
# | 
 ^
# | :127:2: note: possible intended match here
# |  ret float %fabsf
# |  ^
# | 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fabs.ll:231:15:
 error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: ret float [[FMULADD]]
# |   ^
# | :137:86: note: scanning from here
# |  %fmuladd = call nnan float @llvm.fmuladd.f32(float %x, float %x, float 
1.00e+00)
# | 
 ^
# | :137:86: note: with "FMULADD" equal to "%fmuladd"
# |  %fmuladd = call nnan float @llvm.fmuladd.f32(float %x, float %x, float 
1.00e+

[llvm-branch-commits] [llvm] InstCombine: Add baseline fma tests for SimplifyDemandedFPClass (PR #175615)

2026-01-12 Thread via llvm-branch-commits

github-actions[bot] wrote:


# :window: Windows x64 Test Results

* 129353 tests passed
* 2860 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM

LLVM.CodeGen/PowerPC/peephole-mma-phi-liveness.ll

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -verify-machineinstrs 
-mcpu=ppc -mtriple=powerpc64-ibm-aix < 
C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\PowerPC\peephole-mma-phi-liveness.ll
 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe 
C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\PowerPC\peephole-mma-phi-liveness.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' 
-verify-machineinstrs -mcpu=ppc -mtriple=powerpc64-ibm-aix
# note: command had no output on stdout or stderr
# executed command: 
'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 
'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\PowerPC\peephole-mma-phi-liveness.ll'
# .---command stderr
# | 
C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\PowerPC\peephole-mma-phi-liveness.ll:36:15:
 error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: xxlxor 2, 2, 2
# |   ^
# | :39:16: note: scanning from here
# |  xxlxor 0, 0, 0
# |^
# | :40:2: note: possible intended match here
# |  xvsubdp 1, 0, 1
# |  ^
# | 
# | Input file: 
# | Check file: 
C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\PowerPC\peephole-mma-phi-liveness.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<
# |.
# |.
# |.
# |   34: L..BB0_3: # %bb13 
# |   35:  # =>This Inner Loop Header: Depth=1 
# |   36:  bc 4, 2, L..BB0_3 
# |   37: # %bb.4: # %bb14 
# |   38:  xxmfacc 0 
# |   39:  xxlxor 0, 0, 0 
# | next:36'0X error: no match found
# |   40:  xvsubdp 1, 0, 1 
# | next:36'0 ~
# | next:36'1  ?possible intended match
# |   41:  xvmaddadp 0, 1, 0 
# | next:36'0 ~~~
# |   42:  xxswapd 0, 0 
# | next:36'0 ~~
# |   43:  stxv 0, 0(3) 
# | next:36'0 ~~
# |   44:  blr 
# | next:36'0 ~
# |   45: L..baz0: 
# | next:36'0 ~
# |.
# |.
# |.
# | >>
# `-
# error: command failed with exit status: 1

--

```


LLVM.Transforms/InstCombine/fabs.ll

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\opt.exe 
-mtriple=x86_64-unknown-linux-gnu < 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\fabs.ll 
-passes=instcombine -S | 
c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\fabs.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' 
-mtriple=x86_64-unknown-linux-gnu -passes=instcombine -S
# note: command had no output on stdout or stderr
# executed command: 
'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 
'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\fabs.ll'
# .---command stderr
# | 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\fabs.ll:210:15:
 error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: ret float [[FMA]]
# |   ^
# | :125:78: note: scanning from here
# |  %fma = call nnan float @llvm.fma.f32(float %x, float %x, float 
1.00e+00)
# | 
 ^
# | :125:78: note: with "FMA" equal to "%fma"
# |  %fma = call nnan float @llvm.fma.f32(float %x, float %x, float 
1.00e+00)
# | 
 ^
# | :127:2: note: possible intended match here
# |  ret float %fabsf
# |  ^
# | 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\fabs.ll:231:15:
 error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: ret float [[FMULADD]]
# |   ^
# | :137:86: note: scanning from here
# |  %fmuladd = call nnan float @llvm.fmuladd.f32(float %x, float %x, float 
1.00e+00)
# | 
 ^
# | :137:86: note: with "FMULADD" equal to "%fmuladd"
# |  %fmuladd = call nnan float @llvm.fmuladd.f32(float %x, float %x, float 
1.00e+00)
# | 
 ^
# | :139:2: note: possible intended match here
# |  ret float %fabsf
# |  ^
# | 
# | Input file: 
# | Check file: 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\fabs.ll
# | 
# | -dump-input=help explains the following input dump.
# |