[llvm] [InstCombine] Preserve profile metadata when folding fneg selects (PR #228754)
Alok Kumar Sharma via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 4 22:35:52 PDT 2026
https://github.com/alokkrsharma updated https://github.com/llvm/llvm-project/pull/228754
>From d7ec3f6dd87a650cf741dd3875f8c6e957c0021d Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma at amd.com>
Date: Sat, 3 Oct 2026 23:29:07 +0530
Subject: [PATCH 1/2] [InstCombine] Preserve profile metadata when folding fneg
selects
Reuse select metadata in the fneg transformations when profile metadata
fixes are enabled.
Remove obsolete profcheck XFAIL entries for the now-passing InstCombine tests.
---
.../InstCombine/InstCombineAddSub.cpp | 16 ++++++++--
llvm/test/Transforms/InstCombine/fneg.ll | 31 ++++++++++++++-----
llvm/utils/profcheck-xfail.txt | 2 --
3 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
index 281e3b353f6dd..3ebcbe44c4c3d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -39,6 +39,10 @@ using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
+namespace llvm {
+extern cl::opt<bool> ProfcheckDisableMetadataFixes;
+}
+
namespace {
/// Class representing coefficient of floating-point addend.
@@ -3244,14 +3248,18 @@ Instruction *InstCombinerImpl::visitFNeg(UnaryOperator &I) {
Value *P;
if (match(X, m_FNeg(m_Value(P)))) {
Value *NegY = Builder.CreateFNegFMF(Y, &I, Y->getName() + ".neg");
- SelectInst *NewSel = SelectInst::Create(Cond, P, NegY);
+ SelectInst *NewSel = SelectInst::Create(
+ Cond, P, NegY, "", nullptr,
+ ProfcheckDisableMetadataFixes ? nullptr : cast<SelectInst>(Op));
propagateSelectFMF(NewSel, P == Y);
return NewSel;
}
// -(Cond ? X : -P) --> Cond ? -X : P
if (match(Y, m_FNeg(m_Value(P)))) {
Value *NegX = Builder.CreateFNegFMF(X, &I, X->getName() + ".neg");
- SelectInst *NewSel = SelectInst::Create(Cond, NegX, P);
+ SelectInst *NewSel = SelectInst::Create(
+ Cond, NegX, P, "", nullptr,
+ ProfcheckDisableMetadataFixes ? nullptr : cast<SelectInst>(Op));
propagateSelectFMF(NewSel, P == X);
return NewSel;
}
@@ -3261,7 +3269,9 @@ Instruction *InstCombinerImpl::visitFNeg(UnaryOperator &I) {
if (match(X, m_ImmConstant()) || match(Y, m_ImmConstant())) {
Value *NegX = Builder.CreateFNegFMF(X, &I, X->getName() + ".neg");
Value *NegY = Builder.CreateFNegFMF(Y, &I, Y->getName() + ".neg");
- SelectInst *NewSel = SelectInst::Create(Cond, NegX, NegY);
+ SelectInst *NewSel = SelectInst::Create(
+ Cond, NegX, NegY, "", nullptr,
+ ProfcheckDisableMetadataFixes ? nullptr : cast<SelectInst>(Op));
propagateSelectFMF(NewSel, /*CommonOperand=*/true);
return NewSel;
}
diff --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll
index d863871eb3fc8..2a8985a793397 100644
--- a/llvm/test/Transforms/InstCombine/fneg.ll
+++ b/llvm/test/Transforms/InstCombine/fneg.ll
@@ -1,10 +1,13 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
declare float @llvm.ldexp.f32.i32(float, i32)
declare <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float>, <2 x i32>)
declare void @use(float)
+;.
+; CHECK: @g = external global i16, align 1
+;.
define float @fneg_fneg(float %a) {
;
; CHECK-LABEL: @fneg_fneg(
@@ -696,11 +699,11 @@ define float @fake_fneg_nsz_fadd_constant_expr(float %x) {
define float @select_fneg_true(float %x, float %y, i1 %b) {
; CHECK-LABEL: @select_fneg_true(
; CHECK-NEXT: [[Y_NEG:%.*]] = fneg float [[Y:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], float [[X:%.*]], float [[Y_NEG]]
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], float [[X:%.*]], float [[Y_NEG]], !prof [[PROF1:![0-9]+]]
; CHECK-NEXT: ret float [[R]]
;
%nx = fneg float %x
- %s = select i1 %b, float %nx, float %y
+ %s = select i1 %b, float %nx, float %y, !prof !1
%r = fneg float %s
ret float %r
}
@@ -720,11 +723,11 @@ define <2 x float> @select_fneg_false(<2 x float> %x, <2 x float> %y, <2 x i1> %
define float @select_fneg_false_no_nsz(float %x, float %y, i1 %b) {
; CHECK-LABEL: @select_fneg_false_no_nsz(
; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select nnan ninf i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]]
+; CHECK-NEXT: [[R:%.*]] = select nnan ninf i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]], !prof [[PROF2:![0-9]+]]
; CHECK-NEXT: ret float [[R]]
;
%ny = fneg float %y
- %s = select i1 %b, float %x, float %ny
+ %s = select i1 %b, float %x, float %ny, !prof !2
%r = fneg ninf nnan nsz float %s
ret float %r
}
@@ -1057,7 +1060,7 @@ define float @fneg_ldexp_contract(float %x, i32 %n) {
define float @fneg_ldexp_metadata(float %x, i32 %n) {
; CHECK-LABEL: @fneg_ldexp_metadata(
; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]]), !arst [[META1:![0-9]+]]
+; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]]), !arst [[META3:![0-9]+]]
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n), !arst !0
@@ -1088,10 +1091,10 @@ define <2 x float> @test_fneg_vec(<2 x i1> %cond) {
define float @test_fneg_select_var_constant(i1 %cond, float %x) {
; CHECK-LABEL: @test_fneg_select_var_constant(
; CHECK-NEXT: [[X_NEG:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND:%.*]], float [[X_NEG]], float 0.000000e+00
+; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND:%.*]], float [[X_NEG]], float 0.000000e+00, !prof [[PROF4:![0-9]+]]
; CHECK-NEXT: ret float [[NEG]]
;
- %sel1 = select i1 %cond, float %x, float -0.0
+ %sel1 = select i1 %cond, float %x, float -0.0, !prof !3
%neg = fneg float %sel1
ret float %neg
}
@@ -1381,3 +1384,15 @@ define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const3(<2 x flo
}
!0 = !{}
+!1 = !{!"branch_weights", i32 8, i32 2}
+!2 = !{!"branch_weights", i32 3, i32 7}
+!3 = !{!"branch_weights", i32 5, i32 5}
+;.
+; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
+;.
+; CHECK: [[META0]] = !{float 2.500000e+00}
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 8, i32 2}
+; CHECK: [[PROF2]] = !{!"branch_weights", i32 3, i32 7}
+; CHECK: [[META3]] = !{}
+; CHECK: [[PROF4]] = !{!"branch_weights", i32 5, i32 5}
+;.
diff --git a/llvm/utils/profcheck-xfail.txt b/llvm/utils/profcheck-xfail.txt
index 5beac19c039d5..ef83dde73bdf4 100644
--- a/llvm/utils/profcheck-xfail.txt
+++ b/llvm/utils/profcheck-xfail.txt
@@ -36,7 +36,6 @@ Transforms/InstCombine/fcmp-select.ll
Transforms/InstCombine/ffs-1.ll
Transforms/InstCombine/ffs-i16.ll
Transforms/InstCombine/fmul.ll
-Transforms/InstCombine/fneg.ll
Transforms/InstCombine/ldexp-ext.ll
Transforms/InstCombine/ldexp.ll
Transforms/InstCombine/logical-select.ll
@@ -56,7 +55,6 @@ Transforms/InstCombine/select-factorize.ll
Transforms/InstCombine/select-min-max.ll
Transforms/InstCombine/select-of-symmetric-selects.ll
Transforms/InstCombine/select-select.ll
-Transforms/InstCombine/simplify-demanded-fpclass.ll
Transforms/InstCombine/sink-not-into-another-hand-of-logical-and.ll
Transforms/InstCombine/sink-not-into-another-hand-of-logical-or.ll
Transforms/InstCombine/strrchr-3.ll
>From ec5bc1dcee041e52b66372e4e754187dea9ca5d9 Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma at amd.com>
Date: Mon, 5 Oct 2026 10:57:26 +0530
Subject: [PATCH 2/2] Review comment.
---
llvm/test/Transforms/InstCombine/fneg.ll | 661 +++++++++++++----------
1 file changed, 386 insertions(+), 275 deletions(-)
diff --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll
index 2a8985a793397..4392eeeeacdf9 100644
--- a/llvm/test/Transforms/InstCombine/fneg.ll
+++ b/llvm/test/Transforms/InstCombine/fneg.ll
@@ -1,17 +1,15 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
declare float @llvm.ldexp.f32.i32(float, i32)
declare <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float>, <2 x i32>)
declare void @use(float)
-;.
-; CHECK: @g = external global i16, align 1
-;.
define float @fneg_fneg(float %a) {
;
-; CHECK-LABEL: @fneg_fneg(
-; CHECK-NEXT: ret float [[A:%.*]]
+; CHECK-LABEL: define float @fneg_fneg(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: ret float [[A]]
;
%f = fneg float %a
%r = fneg float %f
@@ -21,8 +19,9 @@ define float @fneg_fneg(float %a) {
; -(X * C) --> X * (-C)
define float @fmul_fsub(float %x) {
-; CHECK-LABEL: @fmul_fsub(
-; CHECK-NEXT: [[R:%.*]] = fmul float [[X:%.*]], -4.200000e+01
+; CHECK-LABEL: define float @fmul_fsub(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fmul float [[X]], -4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%m = fmul float %x, 42.0
@@ -31,8 +30,9 @@ define float @fmul_fsub(float %x) {
}
define float @fmul_fneg(float %x) {
-; CHECK-LABEL: @fmul_fneg(
-; CHECK-NEXT: [[R:%.*]] = fmul float [[X:%.*]], -4.200000e+01
+; CHECK-LABEL: define float @fmul_fneg(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fmul float [[X]], -4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%m = fmul float %x, 42.0
@@ -43,8 +43,9 @@ define float @fmul_fneg(float %x) {
; Fast math is not required, but it should be propagated.
define float @fmul_fsub_fmf(float %x) {
-; CHECK-LABEL: @fmul_fsub_fmf(
-; CHECK-NEXT: [[R:%.*]] = fmul nsz float [[X:%.*]], -4.200000e+01
+; CHECK-LABEL: define float @fmul_fsub_fmf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fmul nsz float [[X]], -4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%m = fmul float %x, 42.0
@@ -53,8 +54,9 @@ define float @fmul_fsub_fmf(float %x) {
}
define float @fmul_fneg_fmf(float %x) {
-; CHECK-LABEL: @fmul_fneg_fmf(
-; CHECK-NEXT: [[R:%.*]] = fmul nsz float [[X:%.*]], -4.200000e+01
+; CHECK-LABEL: define float @fmul_fneg_fmf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fmul nsz float [[X]], -4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%m = fmul float %x, 42.0
@@ -65,8 +67,9 @@ define float @fmul_fneg_fmf(float %x) {
; Extra use prevents the fold. We don't want to replace the fneg with an fmul.
define float @fmul_fsub_extra_use(float %x) {
-; CHECK-LABEL: @fmul_fsub_extra_use(
-; CHECK-NEXT: [[M:%.*]] = fmul float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fmul_fsub_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[M:%.*]] = fmul float [[X]], 4.200000e+01
; CHECK-NEXT: [[R:%.*]] = fneg float [[M]]
; CHECK-NEXT: call void @use(float [[M]])
; CHECK-NEXT: ret float [[R]]
@@ -78,8 +81,9 @@ define float @fmul_fsub_extra_use(float %x) {
}
define float @fmul_fneg_extra_use(float %x) {
-; CHECK-LABEL: @fmul_fneg_extra_use(
-; CHECK-NEXT: [[M:%.*]] = fmul float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fmul_fneg_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[M:%.*]] = fmul float [[X]], 4.200000e+01
; CHECK-NEXT: [[R:%.*]] = fneg float [[M]]
; CHECK-NEXT: call void @use(float [[M]])
; CHECK-NEXT: ret float [[R]]
@@ -93,8 +97,9 @@ define float @fmul_fneg_extra_use(float %x) {
; Try a vector. Use special constants (NaN, INF, poison) because they don't change anything.
define <4 x double> @fmul_fsub_vec(<4 x double> %x) {
-; CHECK-LABEL: @fmul_fsub_vec(
-; CHECK-NEXT: [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double -qnan, double -inf, double poison>
+; CHECK-LABEL: define <4 x double> @fmul_fsub_vec(
+; CHECK-SAME: <4 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fmul <4 x double> [[X]], <double -4.200000e+01, double -qnan, double -inf, double poison>
; CHECK-NEXT: ret <4 x double> [[R]]
;
%m = fmul <4 x double> %x, <double 42.0, double +qnan, double +inf, double poison>
@@ -103,8 +108,9 @@ define <4 x double> @fmul_fsub_vec(<4 x double> %x) {
}
define <4 x double> @fmul_fneg_vec(<4 x double> %x) {
-; CHECK-LABEL: @fmul_fneg_vec(
-; CHECK-NEXT: [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double -qnan, double -inf, double poison>
+; CHECK-LABEL: define <4 x double> @fmul_fneg_vec(
+; CHECK-SAME: <4 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fmul <4 x double> [[X]], <double -4.200000e+01, double -qnan, double -inf, double poison>
; CHECK-NEXT: ret <4 x double> [[R]]
;
%m = fmul <4 x double> %x, <double 42.0, double +qnan, double +inf, double poison>
@@ -115,9 +121,10 @@ define <4 x double> @fmul_fneg_vec(<4 x double> %x) {
; -(X / Y) --> (-X) / Y
define float @fdiv_fneg_fpmath(float %x, float %y) {
-; CHECK-LABEL: @fdiv_fneg_fpmath(
-; CHECK-NEXT: [[NEG:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = fdiv float [[NEG]], [[Y:%.*]], !fpmath [[META0:![0-9]+]]
+; CHECK-LABEL: define float @fdiv_fneg_fpmath(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) {
+; CHECK-NEXT: [[NEG:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[R:%.*]] = fdiv float [[NEG]], [[Y]], !fpmath [[META0:![0-9]+]]
; CHECK-NEXT: ret float [[R]]
;
%z = fdiv arcp float %x, %y, !fpmath !{float 2.5}
@@ -128,8 +135,9 @@ define float @fdiv_fneg_fpmath(float %x, float %y) {
; -(X / C) --> X / (-C)
define float @fdiv_op1_constant_fsub(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fsub(
-; CHECK-NEXT: [[R:%.*]] = fdiv float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fdiv_op1_constant_fsub(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float [[X]], 4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float %x, -42.0
@@ -138,8 +146,9 @@ define float @fdiv_op1_constant_fsub(float %x) {
}
define float @fdiv_op1_constant_fneg(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fneg(
-; CHECK-NEXT: [[R:%.*]] = fdiv float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fdiv_op1_constant_fneg(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float [[X]], 4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float %x, -42.0
@@ -150,8 +159,9 @@ define float @fdiv_op1_constant_fneg(float %x) {
; Fast math is not required, but it should be propagated.
define float @fdiv_op1_constant_fsub_fmf(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fsub_fmf(
-; CHECK-NEXT: [[R:%.*]] = fdiv nnan float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fdiv_op1_constant_fsub_fmf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv nnan float [[X]], 4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float %x, -42.0
@@ -160,8 +170,9 @@ define float @fdiv_op1_constant_fsub_fmf(float %x) {
}
define float @fdiv_op1_constant_fneg_fmf(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fneg_fmf(
-; CHECK-NEXT: [[R:%.*]] = fdiv nnan float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fdiv_op1_constant_fneg_fmf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv nnan float [[X]], 4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float %x, -42.0
@@ -172,8 +183,9 @@ define float @fdiv_op1_constant_fneg_fmf(float %x) {
; Don't propagate ninf if it is unavailable on fdiv
define float @fdiv_op1_constant_fneg_ninf(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fneg_ninf(
-; CHECK-NEXT: [[R:%.*]] = fdiv float [[X:%.*]], -inf
+; CHECK-LABEL: define float @fdiv_op1_constant_fneg_ninf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float [[X]], -inf
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float %x, +inf
@@ -182,8 +194,9 @@ define float @fdiv_op1_constant_fneg_ninf(float %x) {
}
define float @fdiv_ninf_op1_constant_fneg_ninf(float %x) {
-; CHECK-LABEL: @fdiv_ninf_op1_constant_fneg_ninf(
-; CHECK-NEXT: [[R:%.*]] = fdiv ninf float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fdiv_ninf_op1_constant_fneg_ninf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv ninf float [[X]], 4.200000e+01
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv ninf float %x, -42.0
@@ -194,8 +207,9 @@ define float @fdiv_ninf_op1_constant_fneg_ninf(float %x) {
; Don't propagate nsz if it is unavailable on fdiv
define float @fdiv_op1_constant_fneg_nsz(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fneg_nsz(
-; CHECK-NEXT: [[R:%.*]] = fdiv float [[X:%.*]], -0.000000e+00
+; CHECK-LABEL: define float @fdiv_op1_constant_fneg_nsz(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float [[X]], -0.000000e+00
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float %x, 0.0
@@ -204,8 +218,9 @@ define float @fdiv_op1_constant_fneg_nsz(float %x) {
}
define float @fdiv_nsz_op1_constant_fneg_nsz(float %x) {
-; CHECK-LABEL: @fdiv_nsz_op1_constant_fneg_nsz(
-; CHECK-NEXT: [[R:%.*]] = fdiv nsz float [[X:%.*]], -0.000000e+00
+; CHECK-LABEL: define float @fdiv_nsz_op1_constant_fneg_nsz(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv nsz float [[X]], -0.000000e+00
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv nsz float %x, 0.0
@@ -216,8 +231,9 @@ define float @fdiv_nsz_op1_constant_fneg_nsz(float %x) {
; Extra use prevents the fold. We don't want to replace the fneg with an fdiv.
define float @fdiv_op1_constant_fsub_extra_use(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fsub_extra_use(
-; CHECK-NEXT: [[D:%.*]] = fdiv float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fdiv_op1_constant_fsub_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[D:%.*]] = fdiv float [[X]], 4.200000e+01
; CHECK-NEXT: [[R:%.*]] = fneg float [[D]]
; CHECK-NEXT: call void @use(float [[D]])
; CHECK-NEXT: ret float [[R]]
@@ -229,8 +245,9 @@ define float @fdiv_op1_constant_fsub_extra_use(float %x) {
}
define float @fdiv_op1_constant_fneg_extra_use(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fneg_extra_use(
-; CHECK-NEXT: [[D:%.*]] = fdiv float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fdiv_op1_constant_fneg_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[D:%.*]] = fdiv float [[X]], 4.200000e+01
; CHECK-NEXT: [[R:%.*]] = fneg float [[D]]
; CHECK-NEXT: call void @use(float [[D]])
; CHECK-NEXT: ret float [[R]]
@@ -244,8 +261,9 @@ define float @fdiv_op1_constant_fneg_extra_use(float %x) {
; Try a vector. Use special constants (NaN, INF, poison) because they don't change anything.
define <4 x double> @fdiv_op1_constant_fsub_vec(<4 x double> %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fsub_vec(
-; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double +nan(0xABCD000), double +inf, double poison>
+; CHECK-LABEL: define <4 x double> @fdiv_op1_constant_fsub_vec(
+; CHECK-SAME: <4 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> [[X]], <double 4.200000e+01, double +nan(0xABCD000), double +inf, double poison>
; CHECK-NEXT: ret <4 x double> [[R]]
;
%d = fdiv <4 x double> %x, <double -42.0, double 0xFFF800000ABCD000, double -inf, double poison>
@@ -254,8 +272,9 @@ define <4 x double> @fdiv_op1_constant_fsub_vec(<4 x double> %x) {
}
define <4 x double> @fdiv_op1_constant_fneg_vec(<4 x double> %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fneg_vec(
-; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double +nan(0xABCD000), double +inf, double poison>
+; CHECK-LABEL: define <4 x double> @fdiv_op1_constant_fneg_vec(
+; CHECK-SAME: <4 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> [[X]], <double 4.200000e+01, double +nan(0xABCD000), double +inf, double poison>
; CHECK-NEXT: ret <4 x double> [[R]]
;
%d = fdiv <4 x double> %x, <double -42.0, double 0xFFF800000ABCD000, double -inf, double poison>
@@ -264,8 +283,9 @@ define <4 x double> @fdiv_op1_constant_fneg_vec(<4 x double> %x) {
}
define float @fdiv_op1_constant_fneg_fpmath(float %x) {
-; CHECK-LABEL: @fdiv_op1_constant_fneg_fpmath(
-; CHECK-NEXT: [[R:%.*]] = fdiv float [[X:%.*]], 4.200000e+01, !fpmath [[META0]]
+; CHECK-LABEL: define float @fdiv_op1_constant_fneg_fpmath(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float [[X]], 4.200000e+01, !fpmath [[META0]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float %x, -42.0, !fpmath !{float 2.5}
@@ -276,8 +296,9 @@ define float @fdiv_op1_constant_fneg_fpmath(float %x) {
; -(C / X) --> (-C) / X
define float @fdiv_op0_constant_fsub(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fsub(
-; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fsub(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
@@ -286,8 +307,9 @@ define float @fdiv_op0_constant_fsub(float %x) {
}
define float @fdiv_op0_constant_fneg(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg(
-; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
@@ -298,8 +320,9 @@ define float @fdiv_op0_constant_fneg(float %x) {
; Fast math is not required, but it should be propagated.
define float @fdiv_op0_constant_fneg_fast_fast(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_fast_fast(
-; CHECK-NEXT: [[R:%.*]] = fdiv fast float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_fast_fast(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv fast float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv fast float 42.0, %x
@@ -308,8 +331,9 @@ define float @fdiv_op0_constant_fneg_fast_fast(float %x) {
}
define float @fdiv_op0_constant_fneg_fast(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_fast(
-; CHECK-NEXT: [[R:%.*]] = fdiv reassoc nnan arcp contract afn float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_fast(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv reassoc nnan arcp contract afn float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
@@ -318,8 +342,9 @@ define float @fdiv_op0_constant_fneg_fast(float %x) {
}
define float @fdiv_op0_constant_fneg_nsz_nsz(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_nsz_nsz(
-; CHECK-NEXT: [[R:%.*]] = fdiv nsz float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_nsz_nsz(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv nsz float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv nsz float 42.0, %x
@@ -328,8 +353,9 @@ define float @fdiv_op0_constant_fneg_nsz_nsz(float %x) {
}
define float @fdiv_op0_constant_fneg_nsz(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_nsz(
-; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_nsz(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
@@ -338,8 +364,9 @@ define float @fdiv_op0_constant_fneg_nsz(float %x) {
}
define float @fdiv_op0_constant_fneg_ninf_ninf(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_ninf_ninf(
-; CHECK-NEXT: [[R:%.*]] = fdiv ninf float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_ninf_ninf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv ninf float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv ninf float 42.0, %x
@@ -348,8 +375,9 @@ define float @fdiv_op0_constant_fneg_ninf_ninf(float %x) {
}
define float @fdiv_op0_constant_fneg_ninf(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_ninf(
-; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_ninf(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
@@ -358,8 +386,9 @@ define float @fdiv_op0_constant_fneg_ninf(float %x) {
}
define float @fdiv_op0_constant_fneg_nnan_nnan(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_nnan_nnan(
-; CHECK-NEXT: [[R:%.*]] = fdiv nnan float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_nnan_nnan(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv nnan float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv nnan float 42.0, %x
@@ -368,8 +397,9 @@ define float @fdiv_op0_constant_fneg_nnan_nnan(float %x) {
}
define float @fdiv_op0_constant_fneg_nnan(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_nnan(
-; CHECK-NEXT: [[R:%.*]] = fdiv nnan float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_nnan(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv nnan float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
@@ -378,8 +408,9 @@ define float @fdiv_op0_constant_fneg_nnan(float %x) {
}
define float @fdiv_op0_constant_fneg_fpmath(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_fpmath(
-; CHECK-NEXT: [[R:%.*]] = fdiv float -1.000000e+00, [[X:%.*]], !fpmath [[META0]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_fpmath(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv float -1.000000e+00, [[X]], !fpmath [[META0]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 1.0, %x, !fpmath !{float 2.5}
@@ -390,8 +421,9 @@ define float @fdiv_op0_constant_fneg_fpmath(float %x) {
; Extra use prevents the fold. We don't want to replace the fneg with an fdiv.
define float @fdiv_op0_constant_fsub_extra_use(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fsub_extra_use(
-; CHECK-NEXT: [[D:%.*]] = fdiv float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fsub_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[D:%.*]] = fdiv float -4.200000e+01, [[X]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[D]]
; CHECK-NEXT: call void @use(float [[D]])
; CHECK-NEXT: ret float [[R]]
@@ -403,8 +435,9 @@ define float @fdiv_op0_constant_fsub_extra_use(float %x) {
}
define float @fdiv_op0_constant_fneg_extra_use(float %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_extra_use(
-; CHECK-NEXT: [[D:%.*]] = fdiv float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fdiv_op0_constant_fneg_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[D:%.*]] = fdiv float -4.200000e+01, [[X]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[D]]
; CHECK-NEXT: call void @use(float [[D]])
; CHECK-NEXT: ret float [[R]]
@@ -418,8 +451,9 @@ define float @fdiv_op0_constant_fneg_extra_use(float %x) {
; Try a vector. Use special constants (NaN, INF, poison) because they don't change anything.
define <4 x double> @fdiv_op0_constant_fsub_vec(<4 x double> %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fsub_vec(
-; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double -qnan, double +inf, double poison>, [[X:%.*]]
+; CHECK-LABEL: define <4 x double> @fdiv_op0_constant_fsub_vec(
+; CHECK-SAME: <4 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double -qnan, double +inf, double poison>, [[X]]
; CHECK-NEXT: ret <4 x double> [[R]]
;
%d = fdiv <4 x double> <double -42.0, double +qnan, double -inf, double poison>, %x
@@ -428,8 +462,9 @@ define <4 x double> @fdiv_op0_constant_fsub_vec(<4 x double> %x) {
}
define <4 x double> @fdiv_op0_constant_fneg_vec(<4 x double> %x) {
-; CHECK-LABEL: @fdiv_op0_constant_fneg_vec(
-; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double -qnan, double +inf, double poison>, [[X:%.*]]
+; CHECK-LABEL: define <4 x double> @fdiv_op0_constant_fneg_vec(
+; CHECK-SAME: <4 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double -qnan, double +inf, double poison>, [[X]]
; CHECK-NEXT: ret <4 x double> [[R]]
;
%d = fdiv <4 x double> <double -42.0, double +qnan, double -inf, double poison>, %x
@@ -441,8 +476,9 @@ define <4 x double> @fdiv_op0_constant_fneg_vec(<4 x double> %x) {
; c ? -x : -y --> -(c ? x : y)
define <2 x double> @fneg_fneg_sel(<2 x double> %x, <2 x double> %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel(
-; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], <2 x double> [[X:%.*]], <2 x double> [[Y:%.*]]
+; CHECK-LABEL: define <2 x double> @fneg_fneg_sel(
+; CHECK-SAME: <2 x double> [[X:%.*]], <2 x double> [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND]], <2 x double> [[X]], <2 x double> [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg <2 x double> [[SEL_V]]
; CHECK-NEXT: ret <2 x double> [[SEL]]
;
@@ -455,10 +491,11 @@ define <2 x double> @fneg_fneg_sel(<2 x double> %x, <2 x double> %y, i1 %cond) {
; An extra use is allowed.
define float @fneg_fneg_sel_extra_use1(float %x, float %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel_extra_use1(
-; CHECK-NEXT: [[N1:%.*]] = fneg float [[X:%.*]]
+; CHECK-LABEL: define float @fneg_fneg_sel_extra_use1(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[N1:%.*]] = fneg float [[X]]
; CHECK-NEXT: call void @use(float [[N1]])
-; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], float [[X]], float [[Y:%.*]]
+; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND]], float [[X]], float [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg float [[SEL_V]]
; CHECK-NEXT: ret float [[SEL]]
;
@@ -470,10 +507,11 @@ define float @fneg_fneg_sel_extra_use1(float %x, float %y, i1 %cond) {
}
define float @fneg_fneg_sel_extra_use2(float %x, float %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel_extra_use2(
-; CHECK-NEXT: [[N2:%.*]] = fneg float [[Y:%.*]]
+; CHECK-LABEL: define float @fneg_fneg_sel_extra_use2(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[N2:%.*]] = fneg float [[Y]]
; CHECK-NEXT: call void @use(float [[N2]])
-; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], float [[X:%.*]], float [[Y]]
+; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND]], float [[X]], float [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg float [[SEL_V]]
; CHECK-NEXT: ret float [[SEL]]
;
@@ -487,10 +525,11 @@ define float @fneg_fneg_sel_extra_use2(float %x, float %y, i1 %cond) {
; Legacy form of fneg should work too.
define float @fsub_fsub_sel_extra_use1(float %x, float %y, i1 %cond) {
-; CHECK-LABEL: @fsub_fsub_sel_extra_use1(
-; CHECK-NEXT: [[N1:%.*]] = fneg float [[X:%.*]]
+; CHECK-LABEL: define float @fsub_fsub_sel_extra_use1(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[N1:%.*]] = fneg float [[X]]
; CHECK-NEXT: call void @use(float [[N1]])
-; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], float [[X]], float [[Y:%.*]]
+; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND]], float [[X]], float [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg float [[SEL_V]]
; CHECK-NEXT: ret float [[SEL]]
;
@@ -504,12 +543,13 @@ define float @fsub_fsub_sel_extra_use1(float %x, float %y, i1 %cond) {
; Negative test: but 2 extra uses would require an extra instruction.
define float @fneg_fneg_sel_extra_use3(float %x, float %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel_extra_use3(
-; CHECK-NEXT: [[N1:%.*]] = fneg float [[X:%.*]]
+; CHECK-LABEL: define float @fneg_fneg_sel_extra_use3(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[N1:%.*]] = fneg float [[X]]
; CHECK-NEXT: call void @use(float [[N1]])
-; CHECK-NEXT: [[N2:%.*]] = fneg float [[Y:%.*]]
+; CHECK-NEXT: [[N2:%.*]] = fneg float [[Y]]
; CHECK-NEXT: call void @use(float [[N2]])
-; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], float [[N1]], float [[N2]]
+; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND]], float [[N1]], float [[N2]]
; CHECK-NEXT: ret float [[SEL]]
;
%n1 = fneg float %x
@@ -521,8 +561,9 @@ define float @fneg_fneg_sel_extra_use3(float %x, float %y, i1 %cond) {
}
define double @fneg_fneg_sel_fmf1(double %x, double %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel_fmf1(
-; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]]
+; CHECK-LABEL: define double @fneg_fneg_sel_fmf1(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND]], double [[X]], double [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg double [[SEL_V]]
; CHECK-NEXT: ret double [[SEL]]
;
@@ -533,8 +574,9 @@ define double @fneg_fneg_sel_fmf1(double %x, double %y, i1 %cond) {
}
define double @fneg_fneg_sel_fmf2(double %x, double %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel_fmf2(
-; CHECK-NEXT: [[SEL_V:%.*]] = select ninf i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]]
+; CHECK-LABEL: define double @fneg_fneg_sel_fmf2(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[SEL_V:%.*]] = select ninf i1 [[COND]], double [[X]], double [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg ninf double [[SEL_V]]
; CHECK-NEXT: ret double [[SEL]]
;
@@ -545,8 +587,9 @@ define double @fneg_fneg_sel_fmf2(double %x, double %y, i1 %cond) {
}
define double @fneg_fneg_sel_fmf3(double %x, double %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel_fmf3(
-; CHECK-NEXT: [[SEL_V:%.*]] = select ninf i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]]
+; CHECK-LABEL: define double @fneg_fneg_sel_fmf3(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[SEL_V:%.*]] = select ninf i1 [[COND]], double [[X]], double [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg ninf double [[SEL_V]]
; CHECK-NEXT: ret double [[SEL]]
;
@@ -557,8 +600,9 @@ define double @fneg_fneg_sel_fmf3(double %x, double %y, i1 %cond) {
}
define double @fneg_fneg_sel_fmf4(double %x, double %y, i1 %cond) {
-; CHECK-LABEL: @fneg_fneg_sel_fmf4(
-; CHECK-NEXT: [[SEL_V:%.*]] = select nnan ninf nsz i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]]
+; CHECK-LABEL: define double @fneg_fneg_sel_fmf4(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]], i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[SEL_V:%.*]] = select nnan ninf nsz i1 [[COND]], double [[X]], double [[Y]]
; CHECK-NEXT: [[SEL:%.*]] = fneg nnan ninf nsz double [[SEL_V]]
; CHECK-NEXT: ret double [[SEL]]
;
@@ -571,8 +615,9 @@ define double @fneg_fneg_sel_fmf4(double %x, double %y, i1 %cond) {
; Negative test
define float @fneg_fadd_constant(float %x) {
-; CHECK-LABEL: @fneg_fadd_constant(
-; CHECK-NEXT: [[A:%.*]] = fadd float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fneg_fadd_constant(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = fadd float [[X]], 4.200000e+01
; CHECK-NEXT: [[R:%.*]] = fneg float [[A]]
; CHECK-NEXT: ret float [[R]]
;
@@ -584,8 +629,9 @@ define float @fneg_fadd_constant(float %x) {
; Negative test
define float @fake_nsz_fadd_constant(float %x) {
-; CHECK-LABEL: @fake_nsz_fadd_constant(
-; CHECK-NEXT: [[A:%.*]] = fadd float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fake_nsz_fadd_constant(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = fadd float [[X]], 4.200000e+01
; CHECK-NEXT: [[R:%.*]] = fneg float [[A]]
; CHECK-NEXT: ret float [[R]]
;
@@ -597,8 +643,9 @@ define float @fake_nsz_fadd_constant(float %x) {
; -(X + C) --> -C - X
define float @fneg_nsz_fadd_constant(float %x) {
-; CHECK-LABEL: @fneg_nsz_fadd_constant(
-; CHECK-NEXT: [[R:%.*]] = fsub nsz float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fneg_nsz_fadd_constant(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fsub nsz float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%a = fadd float %x, 42.0
@@ -609,8 +656,9 @@ define float @fneg_nsz_fadd_constant(float %x) {
; -(X + C) --> -C - X
define float @fake_fneg_nsz_fadd_constant(float %x) {
-; CHECK-LABEL: @fake_fneg_nsz_fadd_constant(
-; CHECK-NEXT: [[R:%.*]] = fsub fast float -4.200000e+01, [[X:%.*]]
+; CHECK-LABEL: define float @fake_fneg_nsz_fadd_constant(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fsub fast float -4.200000e+01, [[X]]
; CHECK-NEXT: ret float [[R]]
;
%a = fadd float %x, 42.0
@@ -621,8 +669,9 @@ define float @fake_fneg_nsz_fadd_constant(float %x) {
; Negative test
define float @fneg_nsz_fadd_constant_extra_use(float %x) {
-; CHECK-LABEL: @fneg_nsz_fadd_constant_extra_use(
-; CHECK-NEXT: [[A:%.*]] = fadd float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fneg_nsz_fadd_constant_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = fadd float [[X]], 4.200000e+01
; CHECK-NEXT: call void @use(float [[A]])
; CHECK-NEXT: [[R:%.*]] = fneg nsz float [[A]]
; CHECK-NEXT: ret float [[R]]
@@ -636,8 +685,9 @@ define float @fneg_nsz_fadd_constant_extra_use(float %x) {
; Negative test
define float @fake_fneg_nsz_fadd_constant_extra_use(float %x) {
-; CHECK-LABEL: @fake_fneg_nsz_fadd_constant_extra_use(
-; CHECK-NEXT: [[A:%.*]] = fadd float [[X:%.*]], 4.200000e+01
+; CHECK-LABEL: define float @fake_fneg_nsz_fadd_constant_extra_use(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = fadd float [[X]], 4.200000e+01
; CHECK-NEXT: call void @use(float [[A]])
; CHECK-NEXT: [[R:%.*]] = fneg fast float [[A]]
; CHECK-NEXT: ret float [[R]]
@@ -651,8 +701,9 @@ define float @fake_fneg_nsz_fadd_constant_extra_use(float %x) {
; -(X + C) --> -C - X
define <2 x float> @fneg_nsz_fadd_constant_vec(<2 x float> %x) {
-; CHECK-LABEL: @fneg_nsz_fadd_constant_vec(
-; CHECK-NEXT: [[R:%.*]] = fsub reassoc nnan nsz <2 x float> <float -4.200000e+01, float -4.300000e+01>, [[X:%.*]]
+; CHECK-LABEL: define <2 x float> @fneg_nsz_fadd_constant_vec(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fsub reassoc nnan nsz <2 x float> <float -4.200000e+01, float -4.300000e+01>, [[X]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%a = fadd <2 x float> %x, <float 42.0, float 43.0>
@@ -663,8 +714,9 @@ define <2 x float> @fneg_nsz_fadd_constant_vec(<2 x float> %x) {
; -(X + C) --> -C - X
define <2 x float> @fake_fneg_nsz_fadd_constant_vec(<2 x float> %x) {
-; CHECK-LABEL: @fake_fneg_nsz_fadd_constant_vec(
-; CHECK-NEXT: [[R:%.*]] = fsub nsz <2 x float> <float -4.200000e+01, float poison>, [[X:%.*]]
+; CHECK-LABEL: define <2 x float> @fake_fneg_nsz_fadd_constant_vec(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = fsub nsz <2 x float> <float -4.200000e+01, float poison>, [[X]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%a = fadd <2 x float> %x, <float 42.0, float poison>
@@ -675,8 +727,9 @@ define <2 x float> @fake_fneg_nsz_fadd_constant_vec(<2 x float> %x) {
@g = external global i16, align 1
define float @fneg_nsz_fadd_constant_expr(float %x) {
-; CHECK-LABEL: @fneg_nsz_fadd_constant_expr(
-; CHECK-NEXT: [[A:%.*]] = fadd float [[X:%.*]], bitcast (i32 ptrtoint (ptr @g to i32) to float)
+; CHECK-LABEL: define float @fneg_nsz_fadd_constant_expr(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = fadd float [[X]], bitcast (i32 ptrtoint (ptr @g to i32) to float)
; CHECK-NEXT: [[R:%.*]] = fneg nsz float [[A]]
; CHECK-NEXT: ret float [[R]]
;
@@ -686,8 +739,9 @@ define float @fneg_nsz_fadd_constant_expr(float %x) {
}
define float @fake_fneg_nsz_fadd_constant_expr(float %x) {
-; CHECK-LABEL: @fake_fneg_nsz_fadd_constant_expr(
-; CHECK-NEXT: [[A:%.*]] = fadd float [[X:%.*]], bitcast (i32 ptrtoint (ptr @g to i32) to float)
+; CHECK-LABEL: define float @fake_fneg_nsz_fadd_constant_expr(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = fadd float [[X]], bitcast (i32 ptrtoint (ptr @g to i32) to float)
; CHECK-NEXT: [[R:%.*]] = fneg nsz float [[A]]
; CHECK-NEXT: ret float [[R]]
;
@@ -697,9 +751,10 @@ define float @fake_fneg_nsz_fadd_constant_expr(float %x) {
}
define float @select_fneg_true(float %x, float %y, i1 %b) {
-; CHECK-LABEL: @select_fneg_true(
-; CHECK-NEXT: [[Y_NEG:%.*]] = fneg float [[Y:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], float [[X:%.*]], float [[Y_NEG]], !prof [[PROF1:![0-9]+]]
+; CHECK-LABEL: define float @select_fneg_true(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[Y_NEG:%.*]] = fneg float [[Y]]
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B]], float [[X]], float [[Y_NEG]], !prof [[PROF1:![0-9]+]]
; CHECK-NEXT: ret float [[R]]
;
%nx = fneg float %x
@@ -709,9 +764,10 @@ define float @select_fneg_true(float %x, float %y, i1 %b) {
}
define <2 x float> @select_fneg_false(<2 x float> %x, <2 x float> %y, <2 x i1> %b) {
-; CHECK-LABEL: @select_fneg_false(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan nsz <2 x float> [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select nnan ninf <2 x i1> [[B:%.*]], <2 x float> [[X_NEG]], <2 x float> [[Y:%.*]]
+; CHECK-LABEL: define <2 x float> @select_fneg_false(
+; CHECK-SAME: <2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x i1> [[B:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan nsz <2 x float> [[X]]
+; CHECK-NEXT: [[R:%.*]] = select nnan ninf <2 x i1> [[B]], <2 x float> [[X_NEG]], <2 x float> [[Y]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%ny = fneg nnan <2 x float> %y
@@ -721,9 +777,10 @@ define <2 x float> @select_fneg_false(<2 x float> %x, <2 x float> %y, <2 x i1> %
}
define float @select_fneg_false_no_nsz(float %x, float %y, i1 %b) {
-; CHECK-LABEL: @select_fneg_false_no_nsz(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select nnan ninf i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]], !prof [[PROF2:![0-9]+]]
+; CHECK-LABEL: define float @select_fneg_false_no_nsz(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X]]
+; CHECK-NEXT: [[R:%.*]] = select nnan ninf i1 [[B]], float [[X_NEG]], float [[Y]], !prof [[PROF2:![0-9]+]]
; CHECK-NEXT: ret float [[R]]
;
%ny = fneg float %y
@@ -735,9 +792,10 @@ define float @select_fneg_false_no_nsz(float %x, float %y, i1 %b) {
; The removal of nsz in this pattern is not needed if the select condition can't be poison.
define float @select_fneg_false_nsz_ok(float %x, float %y, i1 noundef %b) {
-; CHECK-LABEL: @select_fneg_false_nsz_ok(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]]
+; CHECK-LABEL: define float @select_fneg_false_nsz_ok(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 noundef [[B:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X]]
+; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B]], float [[X_NEG]], float [[Y]]
; CHECK-NEXT: ret float [[R]]
;
%ny = fneg float %y
@@ -747,9 +805,10 @@ define float @select_fneg_false_nsz_ok(float %x, float %y, i1 noundef %b) {
}
define float @select_fneg_false_nsz(float %x, float %y, i1 %b) {
-; CHECK-LABEL: @select_fneg_false_nsz(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]]
+; CHECK-LABEL: define float @select_fneg_false_nsz(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X]]
+; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B]], float [[X_NEG]], float [[Y]]
; CHECK-NEXT: ret float [[R]]
;
%ny = fneg float %y
@@ -761,9 +820,10 @@ define float @select_fneg_false_nsz(float %x, float %y, i1 %b) {
; Special-case for propagating nsz: it's ok when selecting between an operand and its negation.
define float @select_common_op_fneg_true(float %x, i1 %b) {
-; CHECK-LABEL: @select_common_op_fneg_true(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B:%.*]], float [[X_NEG]], float [[X]]
+; CHECK-LABEL: define float @select_common_op_fneg_true(
+; CHECK-SAME: float [[X:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X]]
+; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B]], float [[X_NEG]], float [[X]]
; CHECK-NEXT: ret float [[R]]
;
%nx = fneg float %x
@@ -773,9 +833,10 @@ define float @select_common_op_fneg_true(float %x, i1 %b) {
}
define float @select_common_op_fneg_false(float %x, i1 %b) {
-; CHECK-LABEL: @select_common_op_fneg_false(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B:%.*]], float [[X_NEG]], float [[X]]
+; CHECK-LABEL: define float @select_common_op_fneg_false(
+; CHECK-SAME: float [[X:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X]]
+; CHECK-NEXT: [[R:%.*]] = select nnan ninf nsz i1 [[B]], float [[X_NEG]], float [[X]]
; CHECK-NEXT: ret float [[R]]
;
%nx = fneg float %x
@@ -787,8 +848,9 @@ define float @select_common_op_fneg_false(float %x, i1 %b) {
; The transform above allows follow-on folds to convert to fabs.
define float @fabs(float %a) {
-; CHECK-LABEL: @fabs(
-; CHECK-NEXT: [[FNEG1:%.*]] = call float @llvm.fabs.f32(float [[A:%.*]])
+; CHECK-LABEL: define float @fabs(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[FNEG1:%.*]] = call float @llvm.fabs.f32(float [[A]])
; CHECK-NEXT: ret float [[FNEG1]]
;
%fneg = fneg float %a
@@ -799,8 +861,9 @@ define float @fabs(float %a) {
}
define float @fnabs(float %a) {
-; CHECK-LABEL: @fnabs(
-; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A:%.*]])
+; CHECK-LABEL: define float @fnabs(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A]])
; CHECK-NEXT: [[FNEG1:%.*]] = fneg fast float [[TMP1]]
; CHECK-NEXT: ret float [[FNEG1]]
;
@@ -812,8 +875,9 @@ define float @fnabs(float %a) {
}
define float @fnabs_1(float %a) {
-; CHECK-LABEL: @fnabs_1(
-; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A:%.*]])
+; CHECK-LABEL: define float @fnabs_1(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A]])
; CHECK-NEXT: [[FNEG1:%.*]] = fneg fast float [[TMP1]]
; CHECK-NEXT: ret float [[FNEG1]]
;
@@ -828,8 +892,9 @@ define float @fnabs_1(float %a) {
; PR59279
define float @fnabs_2_nsz(float %a) {
-; CHECK-LABEL: @fnabs_2_nsz(
-; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
+; CHECK-LABEL: define float @fnabs_2_nsz(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[A]], 0.000000e+00
; CHECK-NEXT: [[A_NEG:%.*]] = fneg float [[A]]
; CHECK-NEXT: [[FNEG1:%.*]] = select nsz i1 [[CMP]], float [[A]], float [[A_NEG]]
; CHECK-NEXT: ret float [[FNEG1]]
@@ -842,8 +907,9 @@ define float @fnabs_2_nsz(float %a) {
}
define float @fnabs_2_nsz_nnan(float %a) {
-; CHECK-LABEL: @fnabs_2_nsz_nnan(
-; CHECK-NEXT: [[SEL:%.*]] = call nnan nsz float @llvm.fabs.f32(float [[A:%.*]])
+; CHECK-LABEL: define float @fnabs_2_nsz_nnan(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[SEL:%.*]] = call nnan nsz float @llvm.fabs.f32(float [[A]])
; CHECK-NEXT: [[FNEG1:%.*]] = fneg float [[SEL]]
; CHECK-NEXT: ret float [[FNEG1]]
;
@@ -855,8 +921,9 @@ define float @fnabs_2_nsz_nnan(float %a) {
}
define float @select_fneg_both(float %x, float %y, i1 %b) {
-; CHECK-LABEL: @select_fneg_both(
-; CHECK-NEXT: [[S_V:%.*]] = select i1 [[B:%.*]], float [[X:%.*]], float [[Y:%.*]]
+; CHECK-LABEL: define float @select_fneg_both(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[S_V:%.*]] = select i1 [[B]], float [[X]], float [[Y]]
; CHECK-NEXT: ret float [[S_V]]
;
%nx = fneg float %x
@@ -867,11 +934,12 @@ define float @select_fneg_both(float %x, float %y, i1 %b) {
}
define float @select_fneg_use1(float %x, float %y, i1 %b) {
-; CHECK-LABEL: @select_fneg_use1(
-; CHECK-NEXT: [[NX:%.*]] = fneg ninf float [[X:%.*]]
+; CHECK-LABEL: define float @select_fneg_use1(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[NX:%.*]] = fneg ninf float [[X]]
; CHECK-NEXT: call void @use(float [[NX]])
-; CHECK-NEXT: [[Y_NEG:%.*]] = fneg float [[Y:%.*]]
-; CHECK-NEXT: [[R:%.*]] = select fast i1 [[B:%.*]], float [[X]], float [[Y_NEG]]
+; CHECK-NEXT: [[Y_NEG:%.*]] = fneg float [[Y]]
+; CHECK-NEXT: [[R:%.*]] = select fast i1 [[B]], float [[X]], float [[Y_NEG]]
; CHECK-NEXT: ret float [[R]]
;
%nx = fneg ninf float %x
@@ -882,10 +950,11 @@ define float @select_fneg_use1(float %x, float %y, i1 %b) {
}
define float @select_fneg_use2(float %x, float %y, i1 %b) {
-; CHECK-LABEL: @select_fneg_use2(
-; CHECK-NEXT: call void @use(float [[Y:%.*]])
+; CHECK-LABEL: define float @select_fneg_use2(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: call void @use(float [[Y]])
; CHECK-NEXT: [[Y_NEG:%.*]] = fneg fast float [[Y]]
-; CHECK-NEXT: [[R:%.*]] = select reassoc nnan ninf arcp contract afn i1 [[B:%.*]], float [[X:%.*]], float [[Y_NEG]]
+; CHECK-NEXT: [[R:%.*]] = select reassoc nnan ninf arcp contract afn i1 [[B]], float [[X]], float [[Y_NEG]]
; CHECK-NEXT: ret float [[R]]
;
call void @use(float %y)
@@ -898,9 +967,10 @@ define float @select_fneg_use2(float %x, float %y, i1 %b) {
; Negative test
define float @select_fneg_use3(float %x, float %y, i1 %b) {
-; CHECK-LABEL: @select_fneg_use3(
-; CHECK-NEXT: [[NX:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[S:%.*]] = select i1 [[B:%.*]], float [[NX]], float [[Y:%.*]]
+; CHECK-LABEL: define float @select_fneg_use3(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[NX:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[S:%.*]] = select i1 [[B]], float [[NX]], float [[Y]]
; CHECK-NEXT: call void @use(float [[S]])
; CHECK-NEXT: [[R:%.*]] = fneg float [[S]]
; CHECK-NEXT: ret float [[R]]
@@ -913,9 +983,10 @@ define float @select_fneg_use3(float %x, float %y, i1 %b) {
}
define float @fneg_ldexp(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fneg_ldexp(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -924,9 +995,10 @@ define float @fneg_ldexp(float %x, i32 %n) {
}
define float @fsub_fneg_ldexp(float %x, i32 %n) {
-; CHECK-LABEL: @fsub_fneg_ldexp(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fsub_fneg_ldexp(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -935,9 +1007,10 @@ define float @fsub_fneg_ldexp(float %x, i32 %n) {
}
define float @fsub_fneg_ldexp_nsz(float %x, i32 %n) {
-; CHECK-LABEL: @fsub_fneg_ldexp_nsz(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg nsz float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call nsz float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fsub_fneg_ldexp_nsz(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg nsz float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call nsz float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -946,9 +1019,10 @@ define float @fsub_fneg_ldexp_nsz(float %x, i32 %n) {
}
define float @fsub_fneg_ldexp_p0_nsz(float %x, i32 %n) {
-; CHECK-LABEL: @fsub_fneg_ldexp_p0_nsz(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg nsz float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call nsz float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fsub_fneg_ldexp_p0_nsz(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg nsz float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call nsz float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -957,8 +1031,9 @@ define float @fsub_fneg_ldexp_p0_nsz(float %x, i32 %n) {
}
define float @fsub_fneg_ldexp_p0(float %x, i32 %n) {
-; CHECK-LABEL: @fsub_fneg_ldexp_p0(
-; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fsub_fneg_ldexp_p0(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 [[N]])
; CHECK-NEXT: [[NEG:%.*]] = fsub float 0.000000e+00, [[LDEXP]]
; CHECK-NEXT: ret float [[NEG]]
;
@@ -968,9 +1043,10 @@ define float @fsub_fneg_ldexp_p0(float %x, i32 %n) {
}
define <2 x float> @fneg_ldexp_vector(<2 x float> %x, <2 x i32> %n) {
-; CHECK-LABEL: @fneg_ldexp_vector(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg <2 x float> [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> [[TMP1]], <2 x i32> [[N:%.*]])
+; CHECK-LABEL: define <2 x float> @fneg_ldexp_vector(
+; CHECK-SAME: <2 x float> [[X:%.*]], <2 x i32> [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg <2 x float> [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> [[TMP1]], <2 x i32> [[N]])
; CHECK-NEXT: ret <2 x float> [[NEG]]
;
%ldexp = call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> %x, <2 x i32> %n)
@@ -979,9 +1055,10 @@ define <2 x float> @fneg_ldexp_vector(<2 x float> %x, <2 x i32> %n) {
}
define float @fneg_ldexp_multiuse(float %x, i32 %n, ptr %ptr) {
-; CHECK-LABEL: @fneg_ldexp_multiuse(
-; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[N:%.*]])
-; CHECK-NEXT: store float [[LDEXP]], ptr [[PTR:%.*]], align 4
+; CHECK-LABEL: define float @fneg_ldexp_multiuse(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 [[N]])
+; CHECK-NEXT: store float [[LDEXP]], ptr [[PTR]], align 4
; CHECK-NEXT: [[NEG:%.*]] = fneg float [[LDEXP]]
; CHECK-NEXT: ret float [[NEG]]
;
@@ -992,9 +1069,10 @@ define float @fneg_ldexp_multiuse(float %x, i32 %n, ptr %ptr) {
}
define float @fneg_ldexp_fmf_ldexp(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp_fmf_ldexp(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call nnan float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fneg_ldexp_fmf_ldexp(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call nnan float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call nnan float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -1003,9 +1081,10 @@ define float @fneg_ldexp_fmf_ldexp(float %x, i32 %n) {
}
define float @fneg_ldexp_fmf_neg(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp_fmf_neg(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call nnan float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fneg_ldexp_fmf_neg(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call nnan float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -1014,9 +1093,10 @@ define float @fneg_ldexp_fmf_neg(float %x, i32 %n) {
}
define float @fneg_ldexp_fmf(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp_fmf(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan ninf float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call nnan ninf float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fneg_ldexp_fmf(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan ninf float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call nnan ninf float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call ninf float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -1025,9 +1105,10 @@ define float @fneg_ldexp_fmf(float %x, i32 %n) {
}
define float @fneg_ldexp_contract0(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp_contract0(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg contract float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call contract float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fneg_ldexp_contract0(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg contract float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call contract float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call contract float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -1036,9 +1117,10 @@ define float @fneg_ldexp_contract0(float %x, i32 %n) {
}
define float @fneg_ldexp_contract1(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp_contract1(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg contract float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call contract float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fneg_ldexp_contract1(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg contract float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call contract float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -1047,9 +1129,10 @@ define float @fneg_ldexp_contract1(float %x, i32 %n) {
}
define float @fneg_ldexp_contract(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp_contract(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg contract float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call contract float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]])
+; CHECK-LABEL: define float @fneg_ldexp_contract(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg contract float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call contract float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]])
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call contract float @llvm.ldexp.f32.i32(float %x, i32 %n)
@@ -1058,9 +1141,10 @@ define float @fneg_ldexp_contract(float %x, i32 %n) {
}
define float @fneg_ldexp_metadata(float %x, i32 %n) {
-; CHECK-LABEL: @fneg_ldexp_metadata(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N:%.*]]), !arst [[META3:![0-9]+]]
+; CHECK-LABEL: define float @fneg_ldexp_metadata(
+; CHECK-SAME: float [[X:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = call float @llvm.ldexp.f32.i32(float [[TMP1]], i32 [[N]]), !arst [[META3:![0-9]+]]
; CHECK-NEXT: ret float [[NEG]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %n), !arst !0
@@ -1069,8 +1153,9 @@ define float @fneg_ldexp_metadata(float %x, i32 %n) {
}
define float @test_fneg_select_constants(i1 %cond) {
-; CHECK-LABEL: @test_fneg_select_constants(
-; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND:%.*]], float -0.000000e+00, float 0.000000e+00
+; CHECK-LABEL: define float @test_fneg_select_constants(
+; CHECK-SAME: i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND]], float -0.000000e+00, float 0.000000e+00
; CHECK-NEXT: ret float [[NEG]]
;
%sel1 = select i1 %cond, float 0.0, float -0.0
@@ -1079,8 +1164,9 @@ define float @test_fneg_select_constants(i1 %cond) {
}
define <2 x float> @test_fneg_vec(<2 x i1> %cond) {
-; CHECK-LABEL: @test_fneg_vec(
-; CHECK-NEXT: [[NEG:%.*]] = select <2 x i1> [[COND:%.*]], <2 x float> <float -0.000000e+00, float 0.000000e+00>, <2 x float> <float 0.000000e+00, float -0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_vec(
+; CHECK-SAME: <2 x i1> [[COND:%.*]]) {
+; CHECK-NEXT: [[NEG:%.*]] = select <2 x i1> [[COND]], <2 x float> <float -0.000000e+00, float 0.000000e+00>, <2 x float> <float 0.000000e+00, float -0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[NEG]]
;
%sel1 = select <2 x i1> %cond, <2 x float> <float 0.0, float -0.0>, <2 x float> <float -0.0, float 0.0>
@@ -1089,9 +1175,10 @@ define <2 x float> @test_fneg_vec(<2 x i1> %cond) {
}
define float @test_fneg_select_var_constant(i1 %cond, float %x) {
-; CHECK-LABEL: @test_fneg_select_var_constant(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND:%.*]], float [[X_NEG]], float 0.000000e+00, !prof [[PROF4:![0-9]+]]
+; CHECK-LABEL: define float @test_fneg_select_var_constant(
+; CHECK-SAME: i1 [[COND:%.*]], float [[X:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND]], float [[X_NEG]], float 0.000000e+00, !prof [[PROF4:![0-9]+]]
; CHECK-NEXT: ret float [[NEG]]
;
%sel1 = select i1 %cond, float %x, float -0.0, !prof !3
@@ -1102,9 +1189,10 @@ define float @test_fneg_select_var_constant(i1 %cond, float %x) {
; nsz can be preserved.
define float @test_fneg_select_var_constant_fmf1(i1 %cond, float %x) {
-; CHECK-LABEL: @test_fneg_select_var_constant_fmf1(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = select nnan ninf nsz i1 [[COND:%.*]], float [[X_NEG]], float -1.000000e+00
+; CHECK-LABEL: define float @test_fneg_select_var_constant_fmf1(
+; CHECK-SAME: i1 [[COND:%.*]], float [[X:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = select nnan ninf nsz i1 [[COND]], float [[X_NEG]], float -1.000000e+00
; CHECK-NEXT: ret float [[NEG]]
;
%sel1 = select nnan ninf nsz i1 %cond, float %x, float 1.0
@@ -1113,9 +1201,10 @@ define float @test_fneg_select_var_constant_fmf1(i1 %cond, float %x) {
}
define float @test_fneg_select_var_constant_fmf2(i1 %cond, float %x) {
-; CHECK-LABEL: @test_fneg_select_var_constant_fmf2(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = select nnan ninf nsz i1 [[COND:%.*]], float [[X_NEG]], float -1.000000e+00
+; CHECK-LABEL: define float @test_fneg_select_var_constant_fmf2(
+; CHECK-SAME: i1 [[COND:%.*]], float [[X:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = select nnan ninf nsz i1 [[COND]], float [[X_NEG]], float -1.000000e+00
; CHECK-NEXT: ret float [[NEG]]
;
%sel1 = select i1 %cond, float %x, float 1.0
@@ -1124,9 +1213,10 @@ define float @test_fneg_select_var_constant_fmf2(i1 %cond, float %x) {
}
define float @test_fneg_select_constant_var(i1 %cond, float %x) {
-; CHECK-LABEL: @test_fneg_select_constant_var(
-; CHECK-NEXT: [[X_NEG:%.*]] = fneg float [[X:%.*]]
-; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND:%.*]], float -0.000000e+00, float [[X_NEG]]
+; CHECK-LABEL: define float @test_fneg_select_constant_var(
+; CHECK-SAME: i1 [[COND:%.*]], float [[X:%.*]]) {
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg float [[X]]
+; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND]], float -0.000000e+00, float [[X_NEG]]
; CHECK-NEXT: ret float [[NEG]]
;
%sel1 = select i1 %cond, float 0.0, float %x
@@ -1137,10 +1227,11 @@ define float @test_fneg_select_constant_var(i1 %cond, float %x) {
; Make sure nabs is generated.
define float @test_fneg_select_abs(i1 %cond, float %x) {
-; CHECK-LABEL: @test_fneg_select_abs(
-; CHECK-NEXT: [[ABSX:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
+; CHECK-LABEL: define float @test_fneg_select_abs(
+; CHECK-SAME: i1 [[COND:%.*]], float [[X:%.*]]) {
+; CHECK-NEXT: [[ABSX:%.*]] = call float @llvm.fabs.f32(float [[X]])
; CHECK-NEXT: [[ABSX_NEG:%.*]] = fneg float [[ABSX]]
-; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND:%.*]], float -0.000000e+00, float [[ABSX_NEG]]
+; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND]], float -0.000000e+00, float [[ABSX_NEG]]
; CHECK-NEXT: ret float [[NEG]]
;
%absx = call float @llvm.fabs.f32(float %x)
@@ -1150,10 +1241,11 @@ define float @test_fneg_select_abs(i1 %cond, float %x) {
}
define float @test_fneg_fabs_select(i1 %cond, float %x) {
-; CHECK-LABEL: @test_fneg_fabs_select(
-; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
+; CHECK-LABEL: define float @test_fneg_fabs_select(
+; CHECK-SAME: i1 [[COND:%.*]], float [[X:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
; CHECK-NEXT: [[DOTNEG:%.*]] = fneg float [[TMP1]]
-; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND:%.*]], float -0.000000e+00, float [[DOTNEG]]
+; CHECK-NEXT: [[NEG:%.*]] = select i1 [[COND]], float -0.000000e+00, float [[DOTNEG]]
; CHECK-NEXT: ret float [[NEG]]
;
%sel1 = select i1 %cond, float 0.0, float %x
@@ -1163,8 +1255,9 @@ define float @test_fneg_fabs_select(i1 %cond, float %x) {
}
define float @test_fneg_select_constant_var_multiuse(i1 %cond, float %x) {
-; CHECK-LABEL: @test_fneg_select_constant_var_multiuse(
-; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[COND:%.*]], float 0.000000e+00, float [[X:%.*]]
+; CHECK-LABEL: define float @test_fneg_select_constant_var_multiuse(
+; CHECK-SAME: i1 [[COND:%.*]], float [[X:%.*]]) {
+; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[COND]], float 0.000000e+00, float [[X]]
; CHECK-NEXT: call void @use(float [[SEL1]])
; CHECK-NEXT: [[NEG:%.*]] = fneg float [[SEL1]]
; CHECK-NEXT: ret float [[NEG]]
@@ -1178,8 +1271,9 @@ define float @test_fneg_select_constant_var_multiuse(i1 %cond, float %x) {
; Don't break fmax idioms.
define float @test_fneg_select_maxnum(float %x) {
-; CHECK-LABEL: @test_fneg_select_maxnum(
-; CHECK-NEXT: [[SEL1:%.*]] = call nnan nsz float @llvm.maxnum.f32(float [[X:%.*]], float 1.000000e+00)
+; CHECK-LABEL: define float @test_fneg_select_maxnum(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT: [[SEL1:%.*]] = call nnan nsz float @llvm.maxnum.f32(float [[X]], float 1.000000e+00)
; CHECK-NEXT: [[NEG:%.*]] = fneg float [[SEL1]]
; CHECK-NEXT: ret float [[NEG]]
;
@@ -1191,9 +1285,10 @@ define float @test_fneg_select_maxnum(float %x) {
; Check that there's no infinite loop.
define <vscale x 2 x double> @test_fneg_select_svec(<vscale x 2 x i1> %cond, <vscale x 2 x double> %b) {
-; CHECK-LABEL: @test_fneg_select_svec(
-; CHECK-NEXT: [[TMP2:%.*]] = fneg fast <vscale x 2 x double> [[TMP1:%.*]]
-; CHECK-NEXT: [[TMP3:%.*]] = select fast <vscale x 2 x i1> [[COND:%.*]], <vscale x 2 x double> splat (double -0.000000e+00), <vscale x 2 x double> [[TMP2]]
+; CHECK-LABEL: define <vscale x 2 x double> @test_fneg_select_svec(
+; CHECK-SAME: <vscale x 2 x i1> [[COND:%.*]], <vscale x 2 x double> [[B:%.*]]) {
+; CHECK-NEXT: [[TMP2:%.*]] = fneg fast <vscale x 2 x double> [[B]]
+; CHECK-NEXT: [[TMP3:%.*]] = select fast <vscale x 2 x i1> [[COND]], <vscale x 2 x double> splat (double -0.000000e+00), <vscale x 2 x double> [[TMP2]]
; CHECK-NEXT: ret <vscale x 2 x double> [[TMP3]]
;
%1 = select <vscale x 2 x i1> %cond, <vscale x 2 x double> zeroinitializer, <vscale x 2 x double> %b
@@ -1202,9 +1297,10 @@ define <vscale x 2 x double> @test_fneg_select_svec(<vscale x 2 x i1> %cond, <vs
}
define <vscale x 2 x double> @test_fneg_select_svec_2(<vscale x 2 x i1> %cond, <vscale x 2 x double> %a) {
-; CHECK-LABEL: @test_fneg_select_svec_2(
-; CHECK-NEXT: [[A_NEG:%.*]] = fneg fast <vscale x 2 x double> [[A:%.*]]
-; CHECK-NEXT: [[TMP1:%.*]] = select fast <vscale x 2 x i1> [[COND:%.*]], <vscale x 2 x double> [[A_NEG]], <vscale x 2 x double> splat (double -0.000000e+00)
+; CHECK-LABEL: define <vscale x 2 x double> @test_fneg_select_svec_2(
+; CHECK-SAME: <vscale x 2 x i1> [[COND:%.*]], <vscale x 2 x double> [[A:%.*]]) {
+; CHECK-NEXT: [[A_NEG:%.*]] = fneg fast <vscale x 2 x double> [[A]]
+; CHECK-NEXT: [[TMP1:%.*]] = select fast <vscale x 2 x i1> [[COND]], <vscale x 2 x double> [[A_NEG]], <vscale x 2 x double> splat (double -0.000000e+00)
; CHECK-NEXT: ret <vscale x 2 x double> [[TMP1]]
;
%1 = select <vscale x 2 x i1> %cond, <vscale x 2 x double> %a, <vscale x 2 x double> zeroinitializer
@@ -1213,7 +1309,8 @@ define <vscale x 2 x double> @test_fneg_select_svec_2(<vscale x 2 x i1> %cond, <
}
define <vscale x 2 x double> @test_fneg_select_svec_3(<vscale x 2 x i1> %cond, <vscale x 2 x double> %b) {
-; CHECK-LABEL: @test_fneg_select_svec_3(
+; CHECK-LABEL: define <vscale x 2 x double> @test_fneg_select_svec_3(
+; CHECK-SAME: <vscale x 2 x i1> [[COND:%.*]], <vscale x 2 x double> [[B:%.*]]) {
; CHECK-NEXT: ret <vscale x 2 x double> splat (double -0.000000e+00)
;
%1 = select <vscale x 2 x i1> %cond, <vscale x 2 x double> zeroinitializer, <vscale x 2 x double> zeroinitializer
@@ -1222,8 +1319,9 @@ define <vscale x 2 x double> @test_fneg_select_svec_3(<vscale x 2 x i1> %cond, <
}
define float @test_fneg_ninf_mul_with_anyzero(float %a) {
-; CHECK-LABEL: @test_fneg_ninf_mul_with_anyzero(
-; CHECK-NEXT: [[F:%.*]] = fmul float [[A:%.*]], -0.000000e+00
+; CHECK-LABEL: define float @test_fneg_ninf_mul_with_anyzero(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[F:%.*]] = fmul float [[A]], -0.000000e+00
; CHECK-NEXT: ret float [[F]]
;
%mul = fmul float %a, 0.0
@@ -1232,8 +1330,9 @@ define float @test_fneg_ninf_mul_with_anyzero(float %a) {
}
define float @test_fsub_ninf_mul_with_anyzero(float %a) {
-; CHECK-LABEL: @test_fsub_ninf_mul_with_anyzero(
-; CHECK-NEXT: [[F2:%.*]] = fmul nsz float [[A:%.*]], -0.000000e+00
+; CHECK-LABEL: define float @test_fsub_ninf_mul_with_anyzero(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul nsz float [[A]], -0.000000e+00
; CHECK-NEXT: ret float [[F2]]
;
%f1 = fmul nsz float %a, 0.000000
@@ -1242,8 +1341,9 @@ define float @test_fsub_ninf_mul_with_anyzero(float %a) {
}
define float @test_fneg_nnan_mul_with_anyzero(float %a) {
-; CHECK-LABEL: @test_fneg_nnan_mul_with_anyzero(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan float [[A:%.*]]
+; CHECK-LABEL: define float @test_fneg_nnan_mul_with_anyzero(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg nnan float [[A]]
; CHECK-NEXT: [[F2:%.*]] = call nnan float @llvm.copysign.f32(float 0.000000e+00, float [[TMP1]])
; CHECK-NEXT: ret float [[F2]]
;
@@ -1253,8 +1353,9 @@ define float @test_fneg_nnan_mul_with_anyzero(float %a) {
}
define float @test_fneg_nsz_mul_with_anyzero(float %a) {
-; CHECK-LABEL: @test_fneg_nsz_mul_with_anyzero(
-; CHECK-NEXT: [[F2:%.*]] = fmul nsz float [[A:%.*]], -0.000000e+00
+; CHECK-LABEL: define float @test_fneg_nsz_mul_with_anyzero(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul nsz float [[A]], -0.000000e+00
; CHECK-NEXT: ret float [[F2]]
;
%f1 = fmul ninf float %a, 0.000000
@@ -1263,8 +1364,9 @@ define float @test_fneg_nsz_mul_with_anyzero(float %a) {
}
define float @test_fneg_ninf_mul_nnan_with_const(float %a) {
-; CHECK-LABEL: @test_fneg_ninf_mul_nnan_with_const(
-; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[A:%.*]]
+; CHECK-LABEL: define float @test_fneg_ninf_mul_nnan_with_const(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = fneg float [[A]]
; CHECK-NEXT: [[F2:%.*]] = call float @llvm.copysign.f32(float 0.000000e+00, float [[TMP1]])
; CHECK-NEXT: ret float [[F2]]
;
@@ -1274,8 +1376,9 @@ define float @test_fneg_ninf_mul_nnan_with_const(float %a) {
}
define float @test_fneg_ninf_mul_nsz_with_const(float %a) {
-; CHECK-LABEL: @test_fneg_ninf_mul_nsz_with_const(
-; CHECK-NEXT: [[F2:%.*]] = fmul nsz float [[A:%.*]], -0.000000e+00
+; CHECK-LABEL: define float @test_fneg_ninf_mul_nsz_with_const(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul nsz float [[A]], -0.000000e+00
; CHECK-NEXT: ret float [[F2]]
;
%f1 = fmul nsz float %a, 0.000000
@@ -1284,8 +1387,9 @@ define float @test_fneg_ninf_mul_nsz_with_const(float %a) {
}
define <2 x float> @test_fneg_mul_combine_nnan_ninf_with_vec_const(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_nnan_ninf_with_vec_const(
-; CHECK-NEXT: [[F2:%.*]] = fmul nnan <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_nnan_ninf_with_vec_const(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul nnan <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul nnan <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1294,8 +1398,9 @@ define <2 x float> @test_fneg_mul_combine_nnan_ninf_with_vec_const(<2 x float> %
}
define <2 x float> @test_fneg_mul_combine_nsz_ninf_with_vec_const(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_nsz_ninf_with_vec_const(
-; CHECK-NEXT: [[F2:%.*]] = fmul nsz <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_nsz_ninf_with_vec_const(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul nsz <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul nsz <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1304,8 +1409,9 @@ define <2 x float> @test_fneg_mul_combine_nsz_ninf_with_vec_const(<2 x float> %a
}
define <2 x float> @test_fneg_ninf_nnan_mul_with_vec_const(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_ninf_nnan_mul_with_vec_const(
-; CHECK-NEXT: [[F2:%.*]] = fmul nnan <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_ninf_nnan_mul_with_vec_const(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul nnan <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1314,8 +1420,9 @@ define <2 x float> @test_fneg_ninf_nnan_mul_with_vec_const(<2 x float> %a) {
}
define <2 x float> @test_fneg_mul_combine_nnan_ninf_with_vec_const2(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_nnan_ninf_with_vec_const2(
-; CHECK-NEXT: [[F2:%.*]] = fmul nnan ninf <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_nnan_ninf_with_vec_const2(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul nnan ninf <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul ninf <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1324,8 +1431,9 @@ define <2 x float> @test_fneg_mul_combine_nnan_ninf_with_vec_const2(<2 x float>
}
define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const1(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_reassoc_ninf_with_vec_const1(
-; CHECK-NEXT: [[F2:%.*]] = fmul <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const1(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul reassoc <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1334,8 +1442,9 @@ define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const1(<2 x floa
}
define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const2(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_reassoc_ninf_with_vec_const2(
-; CHECK-NEXT: [[F2:%.*]] = fmul ninf <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const2(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul ninf <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul ninf <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1344,8 +1453,9 @@ define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const2(<2 x floa
}
define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const3(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_reassoc_ninf_with_vec_const3(
-; CHECK-NEXT: [[F2:%.*]] = fmul reassoc <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const3(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul reassoc <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul reassoc <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1354,8 +1464,9 @@ define <2 x float> @test_fneg_mul_combine_reassoc_ninf_with_vec_const3(<2 x floa
}
define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const1(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_contract_ninf_with_vec_const1(
-; CHECK-NEXT: [[F2:%.*]] = fmul <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const1(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul contract <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1364,8 +1475,9 @@ define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const1(<2 x flo
}
define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const2(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_contract_ninf_with_vec_const2(
-; CHECK-NEXT: [[F2:%.*]] = fmul ninf <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const2(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul ninf <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul ninf <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1374,8 +1486,9 @@ define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const2(<2 x flo
}
define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const3(<2 x float> %a) {
-; CHECK-LABEL: @test_fneg_mul_combine_contract_ninf_with_vec_const3(
-; CHECK-NEXT: [[F2:%.*]] = fmul contract <2 x float> [[A:%.*]], <float -0.000000e+00, float 0.000000e+00>
+; CHECK-LABEL: define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const3(
+; CHECK-SAME: <2 x float> [[A:%.*]]) {
+; CHECK-NEXT: [[F2:%.*]] = fmul contract <2 x float> [[A]], <float -0.000000e+00, float 0.000000e+00>
; CHECK-NEXT: ret <2 x float> [[F2]]
;
%f1 = fmul contract <2 x float> %a, <float 0.000000, float -0.000000>
@@ -1388,8 +1501,6 @@ define <2 x float> @test_fneg_mul_combine_contract_ninf_with_vec_const3(<2 x flo
!2 = !{!"branch_weights", i32 3, i32 7}
!3 = !{!"branch_weights", i32 5, i32 5}
;.
-; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
-;.
; CHECK: [[META0]] = !{float 2.500000e+00}
; CHECK: [[PROF1]] = !{!"branch_weights", i32 8, i32 2}
; CHECK: [[PROF2]] = !{!"branch_weights", i32 3, i32 7}
More information about the llvm-commits
mailing list