[llvm] Enable exp10 libcall on linux (PR #68736)
Krishna Narayanan via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 00:35:51 PST 2024
https://github.com/Krishna-13-cyber updated https://github.com/llvm/llvm-project/pull/68736
>From d342e99a8805502492c74b90ef86aedc81856438 Mon Sep 17 00:00:00 2001
From: Krishna-13-cyber <krishnanarayanan132002 at gmail.com>
Date: Tue, 10 Oct 2023 23:48:26 +0530
Subject: [PATCH 1/2] Enable exp10 libcall on linux
---
llvm/lib/Analysis/TargetLibraryInfo.cpp | 9 +++------
.../test/Transforms/InstCombine/double-float-shrink-1.ll | 6 ------
llvm/test/Transforms/InstCombine/pow-1.ll | 7 +++++--
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 7b38583e9bc75f..18f193f9775e01 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -562,12 +562,9 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
// or we have a reasonable detection strategy, we cannot use exp10 reliably
// on Linux.
//
- // Fall through to disable all of them.
- [[fallthrough]];
- default:
- TLI.setUnavailable(LibFunc_exp10);
- TLI.setUnavailable(LibFunc_exp10f);
- TLI.setUnavailable(LibFunc_exp10l);
+ TLI.setAvailableWithName(LibFunc_exp10, "__exp10");
+ TLI.setAvailableWithName(LibFunc_exp10f, "__exp10f");
+ break;
}
// ffsl is available on at least Darwin, Mac OS X, iOS, FreeBSD, and
diff --git a/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll b/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll
index 85c9a01e5fabab..e3c5f3c08efe93 100644
--- a/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll
+++ b/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll
@@ -224,12 +224,6 @@ define double @expm1_test2(float %f) {
; exp10f() doesn't exist for this triple, so it doesn't shrink.
define float @exp10_test1(float %f) {
-; CHECK-LABEL: @exp10_test1(
-; CHECK-NEXT: [[CONV:%.*]] = fpext float [[F:%.*]] to double
-; CHECK-NEXT: [[CALL:%.*]] = call fast double @exp10(double [[CONV]])
-; CHECK-NEXT: [[CONV1:%.*]] = fptrunc double [[CALL]] to float
-; CHECK-NEXT: ret float [[CONV1]]
-;
%conv = fpext float %f to double
%call = call fast double @exp10(double %conv)
%conv1 = fptrunc double %call to float
diff --git a/llvm/test/Transforms/InstCombine/pow-1.ll b/llvm/test/Transforms/InstCombine/pow-1.ll
index 16eca3d8f2d0f8..be259a217250f7 100644
--- a/llvm/test/Transforms/InstCombine/pow-1.ll
+++ b/llvm/test/Transforms/InstCombine/pow-1.ll
@@ -14,6 +14,7 @@
; RUN: opt -passes=instcombine -S < %s -mtriple=x86_64-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,LIB,MSVC,VC64,CHECK-NO-EXP10
; RUN: opt -passes=instcombine -S < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,LIB,MSVC,VC83,VC19,CHECK-NO-EXP10
; RUN: opt -passes=instcombine -S < %s -mtriple=amdgcn-- | FileCheck %s --check-prefixes=CHECK,NOLIB,CHECK-NO-EXP10
+; RUN: opt -passes=instcombine -S < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=CHECK,NOLIB,CHECK-NO-EXP10
; NOTE: The readonly attribute on the pow call should be preserved
; in the cases below where pow is transformed into another function call.
@@ -21,6 +22,8 @@
declare float @powf(float, float) nounwind readonly
declare float @llvm.pow.f32(float, float)
declare float @llvm.fabs.f32(float)
+declare float @exp10f(float) nounwind readonly
+declare double @exp10(double) nounwind readonly
declare double @pow(double, double) nounwind readonly
declare double @llvm.pow.f64(double, double)
declare <2 x float> @llvm.pow.v2f32(<2 x float>, <2 x float>) nounwind readonly
@@ -559,7 +562,7 @@ define double @pow_intrinsic_half_no_FMF(double %x) {
define float @test_simplify18(float %x) {
; CHECK-LABEL: @test_simplify18(
-; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @__exp10f(float [[X:%.*]])
+; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @exp10f(float [[X:%.*]])
; CHECK-EXP10-NEXT: ret float [[__EXP10F]]
; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X:%.*]])
; CHECK-NO-EXP10-NEXT: ret float [[RETVAL]]
@@ -570,7 +573,7 @@ define float @test_simplify18(float %x) {
define double @test_simplify19(double %x) {
; CHECK-LABEL: @test_simplify19(
-; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @__exp10(double [[X:%.*]])
+; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @exp10(double [[X:%.*]])
; CHECK-EXP10-NEXT: ret double [[__EXP10]]
; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+01, double [[X:%.*]])
; CHECK-NO-EXP10-NEXT: ret double [[RETVAL]]
>From 7a064ce0db6f4eb53e2fb3a33658c66cd0130ce8 Mon Sep 17 00:00:00 2001
From: Krishna-13-cyber <krishnanarayanan132002 at gmail.com>
Date: Tue, 9 Jan 2024 14:05:07 +0530
Subject: [PATCH 2/2] Update with testcases
---
llvm/lib/Analysis/TargetLibraryInfo.cpp | 3 +
.../InstCombine/double-float-shrink-1.ll | 15 +
llvm/test/Transforms/InstCombine/pow-1.ll | 759 ++++++++++++------
llvm/test/Transforms/InstCombine/pow-exp.ll | 37 +-
4 files changed, 573 insertions(+), 241 deletions(-)
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 18f193f9775e01..d9953449c014ed 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -831,6 +831,9 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
TLI.setUnavailable(LibFunc_strndup);
TLI.setUnavailable(LibFunc_strnlen);
TLI.setUnavailable(LibFunc_toascii);
+ TLI.setUnavailable(LibFunc_exp10);
+ TLI.setUnavailable(LibFunc_exp10f);
+ TLI.setUnavailable(LibFunc_exp10l);
}
// As currently implemented in clang, NVPTX code has no standard library to
diff --git a/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll b/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll
index e3c5f3c08efe93..693730256b6b0c 100644
--- a/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll
+++ b/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll
@@ -224,6 +224,21 @@ define double @expm1_test2(float %f) {
; exp10f() doesn't exist for this triple, so it doesn't shrink.
define float @exp10_test1(float %f) {
+; LINUX-LABEL: define float @exp10_test1(
+; LINUX-SAME: float [[F:%.*]]) {
+; LINUX-NEXT: [[EXP10F:%.*]] = call fast float @__exp10f(float [[F]])
+; LINUX-NEXT: ret float [[EXP10F]]
+;
+; MS64-LABEL: define float @exp10_test1(
+; MS64-SAME: float [[F:%.*]]) {
+; MS64-NEXT: [[EXP10F:%.*]] = call fast float @exp10f(float [[F]])
+; MS64-NEXT: ret float [[EXP10F]]
+;
+; MS32-LABEL: define float @exp10_test1(
+; MS32-SAME: float [[F:%.*]]) {
+; MS32-NEXT: [[EXP10F:%.*]] = call fast float @exp10f(float [[F]])
+; MS32-NEXT: ret float [[EXP10F]]
+;
%conv = fpext float %f to double
%call = call fast double @exp10(double %conv)
%conv1 = fptrunc double %call to float
diff --git a/llvm/test/Transforms/InstCombine/pow-1.ll b/llvm/test/Transforms/InstCombine/pow-1.ll
index be259a217250f7..3162d4385d59b2 100644
--- a/llvm/test/Transforms/InstCombine/pow-1.ll
+++ b/llvm/test/Transforms/InstCombine/pow-1.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; Test that the pow library call simplifier works correctly.
;
; RUN: opt -passes=instcombine -S < %s | FileCheck %s --check-prefixes=CHECK,LIB,ANY
@@ -14,7 +15,6 @@
; RUN: opt -passes=instcombine -S < %s -mtriple=x86_64-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,LIB,MSVC,VC64,CHECK-NO-EXP10
; RUN: opt -passes=instcombine -S < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,LIB,MSVC,VC83,VC19,CHECK-NO-EXP10
; RUN: opt -passes=instcombine -S < %s -mtriple=amdgcn-- | FileCheck %s --check-prefixes=CHECK,NOLIB,CHECK-NO-EXP10
-; RUN: opt -passes=instcombine -S < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=CHECK,NOLIB,CHECK-NO-EXP10
; NOTE: The readonly attribute on the pow call should be preserved
; in the cases below where pow is transformed into another function call.
@@ -22,8 +22,6 @@
declare float @powf(float, float) nounwind readonly
declare float @llvm.pow.f32(float, float)
declare float @llvm.fabs.f32(float)
-declare float @exp10f(float) nounwind readonly
-declare double @exp10(double) nounwind readonly
declare double @pow(double, double) nounwind readonly
declare double @llvm.pow.f64(double, double)
declare <2 x float> @llvm.pow.v2f32(<2 x float>, <2 x float>) nounwind readonly
@@ -33,20 +31,40 @@ declare void @llvm.assume(i1 noundef)
; Check pow(1.0, x) -> 1.0.
define float @test_simplify1(float %x) {
-; CHECK-LABEL: @test_simplify1(
+; ANY-LABEL: define float @test_simplify1(
+; ANY-SAME: float [[X:%.*]]) {
; ANY-NEXT: ret float 1.000000e+00
-; VC32-NEXT: [[POW:%.*]] = call float @powf(float 1.000000e+00, float [[X:%.*]])
-; VC32-NEXT: ret float [[POW]]
-; VC64-NEXT: ret float 1.000000e+00
-; NOLIB-NEXT: [[POW:%.*]] = call float @powf(float 1.000000e+00, float [[X:%.*]])
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @test_simplify1(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+00, float [[X]])
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @test_simplify1(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+00, float [[X]])
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @test_simplify1(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: ret float 1.000000e+00
+;
+; VC83-LABEL: define float @test_simplify1(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: ret float 1.000000e+00
+;
+; NOLIB-LABEL: define float @test_simplify1(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+00, float [[X]])
+; NOLIB-NEXT: ret float [[RETVAL]]
;
%retval = call float @powf(float 1.0, float %x)
ret float %retval
}
define <2 x float> @test_simplify1v(<2 x float> %x) {
-; CHECK-LABEL: @test_simplify1v(
+; CHECK-LABEL: define <2 x float> @test_simplify1v(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
; CHECK-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 1.0, float 1.0>, <2 x float> %x)
@@ -54,17 +72,22 @@ define <2 x float> @test_simplify1v(<2 x float> %x) {
}
define double @test_simplify2(double %x) {
-; CHECK-LABEL: @test_simplify2(
+; LIB-LABEL: define double @test_simplify2(
+; LIB-SAME: double [[X:%.*]]) {
; LIB-NEXT: ret double 1.000000e+00
-; NOLIB-NEXT: [[POW:%.*]] = call double @pow(double 1.000000e+00, double [[X:%.*]])
-; NOLIB-NEXT: ret double [[POW]]
+;
+; NOLIB-LABEL: define double @test_simplify2(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+00, double [[X]])
+; NOLIB-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double 1.0, double %x)
ret double %retval
}
define <2 x double> @test_simplify2v(<2 x double> %x) {
-; CHECK-LABEL: @test_simplify2v(
+; CHECK-LABEL: define <2 x double> @test_simplify2v(
+; CHECK-SAME: <2 x double> [[X:%.*]]) {
; CHECK-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 1.0, double 1.0>, <2 x double> %x)
@@ -74,135 +97,232 @@ define <2 x double> @test_simplify2v(<2 x double> %x) {
; Check pow(2.0 ** n, x) -> exp2(n * x).
define float @test_simplify3(float %x) {
-; CHECK-LABEL: @test_simplify3(
-; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]])
+; ANY-LABEL: define float @test_simplify3(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X]])
; ANY-NEXT: ret float [[EXP2F]]
-; VC32-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
-; VC64-NEXT: ret float [[POW]]
-; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]])
-; VC83-NEXT: ret float [[EXP2F]]
-; NOLIB-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @test_simplify3(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call float @powf(float 2.000000e+00, float [[X]])
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @test_simplify3(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = call float @powf(float 2.000000e+00, float [[X]])
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @test_simplify3(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[RETVAL:%.*]] = call float @powf(float 2.000000e+00, float [[X]])
+; VC64-NEXT: ret float [[RETVAL]]
+;
+; VC83-LABEL: define float @test_simplify3(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X]])
+; VC83-NEXT: ret float [[EXP2F]]
+;
+; NOLIB-LABEL: define float @test_simplify3(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call float @powf(float 2.000000e+00, float [[X]])
+; NOLIB-NEXT: ret float [[RETVAL]]
;
%retval = call float @powf(float 2.0, float %x)
ret float %retval
}
define double @test_simplify3n(double %x) {
-; CHECK-LABEL: @test_simplify3n(
-; ANY-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00
+; ANY-LABEL: define double @test_simplify3n(
+; ANY-SAME: double [[X:%.*]]) {
+; ANY-NEXT: [[MUL:%.*]] = fmul double [[X]], -2.000000e+00
; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]])
; ANY-NEXT: ret double [[EXP2]]
-; VC19-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00
-; VC19-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]])
-; VC19-NEXT: ret double [[EXP2]]
-; VC32-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
-; VC32-NEXT: ret double [[POW]]
-; VC64-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
-; VC64-NEXT: ret double [[POW]]
-; NOLIB-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
-; NOLIB-NEXT: ret double [[POW]]
+;
+; VC32-LABEL: define double @test_simplify3n(
+; VC32-SAME: double [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call double @pow(double 2.500000e-01, double [[X]])
+; VC32-NEXT: ret double [[RETVAL]]
+;
+; VC51-LABEL: define double @test_simplify3n(
+; VC51-SAME: double [[X:%.*]]) {
+; VC51-NEXT: [[MUL:%.*]] = fmul double [[X]], -2.000000e+00
+; VC51-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]])
+; VC51-NEXT: ret double [[EXP2]]
+;
+; VC64-LABEL: define double @test_simplify3n(
+; VC64-SAME: double [[X:%.*]]) {
+; VC64-NEXT: [[RETVAL:%.*]] = call double @pow(double 2.500000e-01, double [[X]])
+; VC64-NEXT: ret double [[RETVAL]]
+;
+; VC83-LABEL: define double @test_simplify3n(
+; VC83-SAME: double [[X:%.*]]) {
+; VC83-NEXT: [[MUL:%.*]] = fmul double [[X]], -2.000000e+00
+; VC83-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]])
+; VC83-NEXT: ret double [[EXP2]]
+;
+; NOLIB-LABEL: define double @test_simplify3n(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call double @pow(double 2.500000e-01, double [[X]])
+; NOLIB-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double 0.25, double %x)
ret double %retval
}
define <2 x float> @test_simplify3v(<2 x float> %x) {
-; CHECK-LABEL: @test_simplify3v(
-; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[X:%.*]])
+; ANY-LABEL: define <2 x float> @test_simplify3v(
+; ANY-SAME: <2 x float> [[X:%.*]]) {
+; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[X]])
; ANY-NEXT: ret <2 x float> [[EXP2]]
-; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X:%.*]])
-; MSVC-NEXT: ret <2 x float> [[POW]]
-; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
-; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X:%.*]])
-; NOLIB-NEXT: ret <2 x float> [[POW]]
;
+; MSVC-LABEL: define <2 x float> @test_simplify3v(
+; MSVC-SAME: <2 x float> [[X:%.*]]) {
+; MSVC-NEXT: [[RETVAL:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X]])
+; MSVC-NEXT: ret <2 x float> [[RETVAL]]
+;
+; NOLIB-LABEL: define <2 x float> @test_simplify3v(
+; NOLIB-SAME: <2 x float> [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X]])
+; NOLIB-NEXT: ret <2 x float> [[RETVAL]]
+;
+; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.0, float 2.0>, <2 x float> %x)
ret <2 x float> %retval
}
define <2 x double> @test_simplify3vn(<2 x double> %x) {
-; CHECK-LABEL: @test_simplify3vn(
-; ANY-NEXT: [[MUL:%.*]] = fmul <2 x double> [[X:%.*]], <double 2.000000e+00, double 2.000000e+00>
+; ANY-LABEL: define <2 x double> @test_simplify3vn(
+; ANY-SAME: <2 x double> [[X:%.*]]) {
+; ANY-NEXT: [[MUL:%.*]] = fmul <2 x double> [[X]], <double 2.000000e+00, double 2.000000e+00>
; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[MUL]])
; ANY-NEXT: ret <2 x double> [[EXP2]]
-; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X:%.*]])
-; MSVC-NEXT: ret <2 x double> [[POW]]
-; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
-; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X:%.*]])
-; NOLIB-NEXT: ret <2 x double> [[POW]]
;
+; MSVC-LABEL: define <2 x double> @test_simplify3vn(
+; MSVC-SAME: <2 x double> [[X:%.*]]) {
+; MSVC-NEXT: [[RETVAL:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X]])
+; MSVC-NEXT: ret <2 x double> [[RETVAL]]
+;
+; NOLIB-LABEL: define <2 x double> @test_simplify3vn(
+; NOLIB-SAME: <2 x double> [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X]])
+; NOLIB-NEXT: ret <2 x double> [[RETVAL]]
+;
+; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.0, double 4.0>, <2 x double> %x)
ret <2 x double> %retval
}
define double @test_simplify4(double %x) {
-; CHECK-LABEL: @test_simplify4(
-; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]])
+; ANY-LABEL: define double @test_simplify4(
+; ANY-SAME: double [[X:%.*]]) {
+; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X]])
; ANY-NEXT: ret double [[EXP2]]
-; VC19-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]])
-; VC19-NEXT: ret double [[EXP2]]
-; VC32-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]])
-; VC32-NEXT: ret double [[POW]]
-; VC64-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]])
-; VC64-NEXT: ret double [[POW]]
-; NOLIB-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]])
-; NOLIB-NEXT: ret double [[POW]]
+;
+; VC32-LABEL: define double @test_simplify4(
+; VC32-SAME: double [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call double @pow(double 2.000000e+00, double [[X]])
+; VC32-NEXT: ret double [[RETVAL]]
+;
+; VC51-LABEL: define double @test_simplify4(
+; VC51-SAME: double [[X:%.*]]) {
+; VC51-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X]])
+; VC51-NEXT: ret double [[EXP2]]
+;
+; VC64-LABEL: define double @test_simplify4(
+; VC64-SAME: double [[X:%.*]]) {
+; VC64-NEXT: [[RETVAL:%.*]] = call double @pow(double 2.000000e+00, double [[X]])
+; VC64-NEXT: ret double [[RETVAL]]
+;
+; VC83-LABEL: define double @test_simplify4(
+; VC83-SAME: double [[X:%.*]]) {
+; VC83-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X]])
+; VC83-NEXT: ret double [[EXP2]]
+;
+; NOLIB-LABEL: define double @test_simplify4(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call double @pow(double 2.000000e+00, double [[X]])
+; NOLIB-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double 2.0, double %x)
ret double %retval
}
define float @test_simplify4n(float %x) {
-; CHECK-LABEL: @test_simplify4n(
-; ANY-NEXT: [[MUL:%.*]] = fmul float [[X:%.*]], 3.000000e+00
+; ANY-LABEL: define float @test_simplify4n(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: [[MUL:%.*]] = fmul float [[X]], 3.000000e+00
; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]])
; ANY-NEXT: ret float [[EXP2F]]
-; VC32-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
-; VC64-NEXT: ret float [[POW]]
-; VC83-NEXT: [[MUL:%.*]] = fmul float [[X:%.*]], 3.000000e+00
-; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]])
-; VC83-NEXT: ret float [[EXP2F]]
-; NOLIB-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @test_simplify4n(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call float @powf(float 8.000000e+00, float [[X]])
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @test_simplify4n(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = call float @powf(float 8.000000e+00, float [[X]])
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @test_simplify4n(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[RETVAL:%.*]] = call float @powf(float 8.000000e+00, float [[X]])
+; VC64-NEXT: ret float [[RETVAL]]
+;
+; VC83-LABEL: define float @test_simplify4n(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[MUL:%.*]] = fmul float [[X]], 3.000000e+00
+; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]])
+; VC83-NEXT: ret float [[EXP2F]]
+;
+; NOLIB-LABEL: define float @test_simplify4n(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call float @powf(float 8.000000e+00, float [[X]])
+; NOLIB-NEXT: ret float [[RETVAL]]
;
%retval = call float @powf(float 8.0, float %x)
ret float %retval
}
define <2 x double> @test_simplify4v(<2 x double> %x) {
-; CHECK-LABEL: @test_simplify4v(
-; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[X:%.*]])
+; ANY-LABEL: define <2 x double> @test_simplify4v(
+; ANY-SAME: <2 x double> [[X:%.*]]) {
+; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[X]])
; ANY-NEXT: ret <2 x double> [[EXP2]]
-; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X:%.*]])
-; MSVC-NEXT: ret <2 x double> [[POW]]
-; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
-; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X:%.*]])
-; NOLIB-NEXT: ret <2 x double> [[POW]]
;
+; MSVC-LABEL: define <2 x double> @test_simplify4v(
+; MSVC-SAME: <2 x double> [[X:%.*]]) {
+; MSVC-NEXT: [[RETVAL:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X]])
+; MSVC-NEXT: ret <2 x double> [[RETVAL]]
+;
+; NOLIB-LABEL: define <2 x double> @test_simplify4v(
+; NOLIB-SAME: <2 x double> [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X]])
+; NOLIB-NEXT: ret <2 x double> [[RETVAL]]
+;
+; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.0, double 2.0>, <2 x double> %x)
ret <2 x double> %retval
}
define <2 x float> @test_simplify4vn(<2 x float> %x) {
-; CHECK-LABEL: @test_simplify4vn(
-; ANY-NEXT: [[MUL:%.*]] = fneg <2 x float> [[X:%.*]]
+; ANY-LABEL: define <2 x float> @test_simplify4vn(
+; ANY-SAME: <2 x float> [[X:%.*]]) {
+; ANY-NEXT: [[MUL:%.*]] = fneg <2 x float> [[X]]
; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[MUL]])
; ANY-NEXT: ret <2 x float> [[EXP2]]
-; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])
-; MSVC-NEXT: ret <2 x float> [[POW]]
-; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
-; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])
-; NOLIB-NEXT: ret <2 x float> [[POW]]
;
+; MSVC-LABEL: define <2 x float> @test_simplify4vn(
+; MSVC-SAME: <2 x float> [[X:%.*]]) {
+; MSVC-NEXT: [[RETVAL:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X]])
+; MSVC-NEXT: ret <2 x float> [[RETVAL]]
+;
+; NOLIB-LABEL: define <2 x float> @test_simplify4vn(
+; NOLIB-SAME: <2 x float> [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X]])
+; NOLIB-NEXT: ret <2 x float> [[RETVAL]]
+;
+; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 0.5, float 0.5>, <2 x float> %x)
ret <2 x float> %retval
}
@@ -210,23 +330,40 @@ define <2 x float> @test_simplify4vn(<2 x float> %x) {
; Check pow(x, 0.0) -> 1.0.
define float @test_simplify5(float %x) {
-; CHECK-LABEL: @test_simplify5(
+; ANY-LABEL: define float @test_simplify5(
+; ANY-SAME: float [[X:%.*]]) {
; ANY-NEXT: ret float 1.000000e+00
-; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 0.000000e+00)
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 0.000000e+00)
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: ret float 1.000000e+00
-; VC83-NEXT: ret float 1.000000e+00
-; NOLIB-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 0.000000e+00)
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @test_simplify5(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 0.000000e+00)
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @test_simplify5(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 0.000000e+00)
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @test_simplify5(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: ret float 1.000000e+00
+;
+; VC83-LABEL: define float @test_simplify5(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: ret float 1.000000e+00
+;
+; NOLIB-LABEL: define float @test_simplify5(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 0.000000e+00)
+; NOLIB-NEXT: ret float [[RETVAL]]
;
%retval = call float @powf(float %x, float 0.0)
ret float %retval
}
define <2 x float> @test_simplify5v(<2 x float> %x) {
-; CHECK-LABEL: @test_simplify5v(
+; CHECK-LABEL: define <2 x float> @test_simplify5v(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
; CHECK-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 0.0, float 0.0>)
@@ -234,17 +371,22 @@ define <2 x float> @test_simplify5v(<2 x float> %x) {
}
define double @test_simplify6(double %x) {
-; CHECK-LABEL: @test_simplify6(
+; LIB-LABEL: define double @test_simplify6(
+; LIB-SAME: double [[X:%.*]]) {
; LIB-NEXT: ret double 1.000000e+00
-; NOLIB-NEXT: [[POW:%.*]] = call double @pow(double [[X:%.*]], double 0.000000e+00)
-; NOLIB-NEXT: ret double [[POW]]
+;
+; NOLIB-LABEL: define double @test_simplify6(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call double @pow(double [[X]], double 0.000000e+00)
+; NOLIB-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double %x, double 0.0)
ret double %retval
}
define <2 x double> @test_simplify6v(<2 x double> %x) {
-; CHECK-LABEL: @test_simplify6v(
+; CHECK-LABEL: define <2 x double> @test_simplify6v(
+; CHECK-SAME: <2 x double> [[X:%.*]]) {
; CHECK-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 0.0, double 0.0>)
@@ -254,22 +396,38 @@ define <2 x double> @test_simplify6v(<2 x double> %x) {
; Check pow(x, 0.5) -> fabs(sqrt(x)), where x != -infinity.
define float @powf_libcall_half_ninf(float %x) {
-; CHECK-LABEL: @powf_libcall_half_ninf(
-; ANY-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X:%.*]])
+; ANY-LABEL: define float @powf_libcall_half_ninf(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X]])
; ANY-NEXT: [[ABS:%.*]] = call ninf float @llvm.fabs.f32(float [[SQRTF]])
; ANY-NEXT: ret float [[ABS]]
-; VC32-NEXT: [[POW:%.*]] = call ninf float @powf(float [[X:%.*]], float 5.000000e-01)
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call ninf float @powf(float [[X:%.*]], float 5.000000e-01)
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X:%.*]])
-; VC64-NEXT: [[ABS:%.*]] = call ninf float @llvm.fabs.f32(float [[SQRTF]])
-; VC64-NEXT: ret float [[ABS]]
-; VC83-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X:%.*]])
-; VC83-NEXT: [[ABS:%.*]] = call ninf float @llvm.fabs.f32(float [[SQRTF]])
-; VC83-NEXT: ret float [[ABS]]
-; NOLIB-NEXT: [[POW:%.*]] = call ninf float @powf(float [[X:%.*]], float 5.000000e-01)
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @powf_libcall_half_ninf(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call ninf float @powf(float [[X]], float 5.000000e-01)
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @powf_libcall_half_ninf(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = call ninf float @powf(float [[X]], float 5.000000e-01)
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @powf_libcall_half_ninf(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X]])
+; VC64-NEXT: [[ABS:%.*]] = call ninf float @llvm.fabs.f32(float [[SQRTF]])
+; VC64-NEXT: ret float [[ABS]]
+;
+; VC83-LABEL: define float @powf_libcall_half_ninf(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X]])
+; VC83-NEXT: [[ABS:%.*]] = call ninf float @llvm.fabs.f32(float [[SQRTF]])
+; VC83-NEXT: ret float [[ABS]]
+;
+; NOLIB-LABEL: define float @powf_libcall_half_ninf(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call ninf float @powf(float [[X]], float 5.000000e-01)
+; NOLIB-NEXT: ret float [[RETVAL]]
;
%retval = call ninf float @powf(float %x, float 0.5)
ret float %retval
@@ -277,8 +435,8 @@ define float @powf_libcall_half_ninf(float %x) {
; Make sure assume works when inferring no infinities
define float @powf_libcall_half_assume_ninf(float %x) {
-; ANY-LABEL: define float @powf_libcall_half_assume_ninf
-; ANY-SAME: (float [[X:%.*]]) {
+; ANY-LABEL: define float @powf_libcall_half_assume_ninf(
+; ANY-SAME: float [[X:%.*]]) {
; ANY-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
; ANY-NEXT: [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
; ANY-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
@@ -286,24 +444,24 @@ define float @powf_libcall_half_assume_ninf(float %x) {
; ANY-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
; ANY-NEXT: ret float [[ABS]]
;
-; VC32-LABEL: define float @powf_libcall_half_assume_ninf
-; VC32-SAME: (float [[X:%.*]]) {
+; VC32-LABEL: define float @powf_libcall_half_assume_ninf(
+; VC32-SAME: float [[X:%.*]]) {
; VC32-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
; VC32-NEXT: [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
; VC32-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
; VC32-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 5.000000e-01)
; VC32-NEXT: ret float [[RETVAL]]
;
-; VC51-LABEL: define float @powf_libcall_half_assume_ninf
-; VC51-SAME: (float [[X:%.*]]) {
+; VC51-LABEL: define float @powf_libcall_half_assume_ninf(
+; VC51-SAME: float [[X:%.*]]) {
; VC51-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
; VC51-NEXT: [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
; VC51-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
; VC51-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 5.000000e-01)
; VC51-NEXT: ret float [[RETVAL]]
;
-; VC64-LABEL: define float @powf_libcall_half_assume_ninf
-; VC64-SAME: (float [[X:%.*]]) {
+; VC64-LABEL: define float @powf_libcall_half_assume_ninf(
+; VC64-SAME: float [[X:%.*]]) {
; VC64-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
; VC64-NEXT: [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
; VC64-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
@@ -311,8 +469,8 @@ define float @powf_libcall_half_assume_ninf(float %x) {
; VC64-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
; VC64-NEXT: ret float [[ABS]]
;
-; VC83-LABEL: define float @powf_libcall_half_assume_ninf
-; VC83-SAME: (float [[X:%.*]]) {
+; VC83-LABEL: define float @powf_libcall_half_assume_ninf(
+; VC83-SAME: float [[X:%.*]]) {
; VC83-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
; VC83-NEXT: [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
; VC83-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
@@ -320,8 +478,8 @@ define float @powf_libcall_half_assume_ninf(float %x) {
; VC83-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
; VC83-NEXT: ret float [[ABS]]
;
-; NOLIB-LABEL: define float @powf_libcall_half_assume_ninf
-; NOLIB-SAME: (float [[X:%.*]]) {
+; NOLIB-LABEL: define float @powf_libcall_half_assume_ninf(
+; NOLIB-SAME: float [[X:%.*]]) {
; NOLIB-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
; NOLIB-NEXT: [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
; NOLIB-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
@@ -336,18 +494,49 @@ define float @powf_libcall_half_assume_ninf(float %x) {
}
define float @powf_libcall_half_ninf_tail(float %x) {
-; CHECK-LABEL: @powf_libcall_half_ninf_tail(
-; ANY-NEXT: %sqrtf = call ninf float @sqrtf(float %x)
-; ANY-NEXT: %abs = tail call ninf float @llvm.fabs.f32(float %sqrtf)
-; ANY-NEXT: ret float %abs
+; ANY-LABEL: define float @powf_libcall_half_ninf_tail(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X]])
+; ANY-NEXT: [[ABS:%.*]] = tail call ninf float @llvm.fabs.f32(float [[SQRTF]])
+; ANY-NEXT: ret float [[ABS]]
+;
+; VC32-LABEL: define float @powf_libcall_half_ninf_tail(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = tail call ninf float @powf(float [[X]], float 5.000000e-01)
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @powf_libcall_half_ninf_tail(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = tail call ninf float @powf(float [[X]], float 5.000000e-01)
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @powf_libcall_half_ninf_tail(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X]])
+; VC64-NEXT: [[ABS:%.*]] = tail call ninf float @llvm.fabs.f32(float [[SQRTF]])
+; VC64-NEXT: ret float [[ABS]]
+;
+; VC83-LABEL: define float @powf_libcall_half_ninf_tail(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[SQRTF:%.*]] = call ninf float @sqrtf(float [[X]])
+; VC83-NEXT: [[ABS:%.*]] = tail call ninf float @llvm.fabs.f32(float [[SQRTF]])
+; VC83-NEXT: ret float [[ABS]]
+;
+; NOLIB-LABEL: define float @powf_libcall_half_ninf_tail(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = tail call ninf float @powf(float [[X]], float 5.000000e-01)
+; NOLIB-NEXT: ret float [[RETVAL]]
+;
%retval = tail call ninf float @powf(float %x, float 0.5)
ret float %retval
}
define float @powf_libcall_half_ninf_musttail(float %x, float %y) {
-; CHECK-LABEL: @powf_libcall_half_ninf_musttail(
-; ANY-NEXT: %retval = musttail call ninf float @powf(float %x, float 5.000000e-01)
-; ANY-NEXT: ret float %retval
+; CHECK-LABEL: define float @powf_libcall_half_ninf_musttail(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) {
+; CHECK-NEXT: [[RETVAL:%.*]] = musttail call ninf float @powf(float [[X]], float 5.000000e-01)
+; CHECK-NEXT: ret float [[RETVAL]]
+;
%retval = musttail call ninf float @powf(float %x, float 0.5)
ret float %retval
}
@@ -355,9 +544,10 @@ define float @powf_libcall_half_ninf_musttail(float %x, float %y) {
; Check pow(x, 0.5) where x may be -infinity does not call a library sqrt function.
define double @pow_libcall_half_no_FMF(double %x) {
-; CHECK-LABEL: @pow_libcall_half_no_FMF(
-; CHECK-NEXT: [[POW:%.*]] = call double @pow(double [[X:%.*]], double 5.000000e-01)
-; CHECK-NEXT: ret double [[POW]]
+; CHECK-LABEL: define double @pow_libcall_half_no_FMF(
+; CHECK-SAME: double [[X:%.*]]) {
+; CHECK-NEXT: [[RETVAL:%.*]] = call double @pow(double [[X]], double 5.000000e-01)
+; CHECK-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double %x, double 0.5)
ret double %retval
@@ -366,7 +556,8 @@ define double @pow_libcall_half_no_FMF(double %x) {
; Check pow(-infinity, 0.5) -> +infinity.
define float @test_simplify9(float %x) {
-; CHECK-LABEL: @test_simplify9(
+; CHECK-LABEL: define float @test_simplify9(
+; CHECK-SAME: float [[X:%.*]]) {
; CHECK-NEXT: ret float 0x7FF0000000000000
;
%retval = call float @llvm.pow.f32(float 0xFFF0000000000000, float 0.5)
@@ -374,7 +565,8 @@ define float @test_simplify9(float %x) {
}
define double @test_simplify10(double %x) {
-; CHECK-LABEL: @test_simplify10(
+; CHECK-LABEL: define double @test_simplify10(
+; CHECK-SAME: double [[X:%.*]]) {
; CHECK-NEXT: ret double 0x7FF0000000000000
;
%retval = call double @llvm.pow.f64(double 0xFFF0000000000000, double 0.5)
@@ -384,42 +576,64 @@ define double @test_simplify10(double %x) {
; Check pow(x, 1.0) -> x.
define float @test_simplify11(float %x) {
-; CHECK-LABEL: @test_simplify11(
-; ANY-NEXT: ret float [[X:%.*]]
-; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 1.000000e+00)
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 1.000000e+00)
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: ret float [[X:%.*]]
-; VC83-NEXT: ret float [[X:%.*]]
-; NOLIB-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 1.000000e+00)
-; NOLIB-NEXT: ret float [[POW]]
+; ANY-LABEL: define float @test_simplify11(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: ret float [[X]]
+;
+; VC32-LABEL: define float @test_simplify11(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 1.000000e+00)
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @test_simplify11(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 1.000000e+00)
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @test_simplify11(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: ret float [[X]]
+;
+; VC83-LABEL: define float @test_simplify11(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: ret float [[X]]
+;
+; NOLIB-LABEL: define float @test_simplify11(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call float @powf(float [[X]], float 1.000000e+00)
+; NOLIB-NEXT: ret float [[RETVAL]]
;
%retval = call float @powf(float %x, float 1.0)
ret float %retval
}
define <2 x float> @test_simplify11v(<2 x float> %x) {
-; CHECK-LABEL: @test_simplify11v(
-; CHECK-NEXT: ret <2 x float> [[X:%.*]]
+; CHECK-LABEL: define <2 x float> @test_simplify11v(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
+; CHECK-NEXT: ret <2 x float> [[X]]
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 1.0, float 1.0>)
ret <2 x float> %retval
}
define double @test_simplify12(double %x) {
-; CHECK-LABEL: @test_simplify12(
-; LIB-NEXT: ret double [[X:%.*]]
-; NOLIB-NEXT: [[POW:%.*]] = call double @pow(double [[X:%.*]], double 1.000000e+00)
-; NOLIB-NEXT: ret double [[POW]]
+; LIB-LABEL: define double @test_simplify12(
+; LIB-SAME: double [[X:%.*]]) {
+; LIB-NEXT: ret double [[X]]
+;
+; NOLIB-LABEL: define double @test_simplify12(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call double @pow(double [[X]], double 1.000000e+00)
+; NOLIB-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double %x, double 1.0)
ret double %retval
}
define <2 x double> @test_simplify12v(<2 x double> %x) {
-; CHECK-LABEL: @test_simplify12v(
-; CHECK-NEXT: ret <2 x double> [[X:%.*]]
+; CHECK-LABEL: define <2 x double> @test_simplify12v(
+; CHECK-SAME: <2 x double> [[X:%.*]]) {
+; CHECK-NEXT: ret <2 x double> [[X]]
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 1.0, double 1.0>)
ret <2 x double> %retval
@@ -428,27 +642,44 @@ define <2 x double> @test_simplify12v(<2 x double> %x) {
; Check pow(x, 2.0) -> x*x.
define float @pow2_strict(float %x) {
-; CHECK-LABEL: @pow2_strict(
-; ANY-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
+; ANY-LABEL: define float @pow2_strict(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: [[SQUARE:%.*]] = fmul float [[X]], [[X]]
; ANY-NEXT: ret float [[SQUARE]]
-; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 2.000000e+00)
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 2.000000e+00)
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
-; VC64-NEXT: ret float [[SQUARE]]
-; VC83-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
-; VC83-NEXT: ret float [[SQUARE]]
-; NOLIB-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 2.000000e+00)
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @pow2_strict(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[R:%.*]] = call float @powf(float [[X]], float 2.000000e+00)
+; VC32-NEXT: ret float [[R]]
+;
+; VC51-LABEL: define float @pow2_strict(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[R:%.*]] = call float @powf(float [[X]], float 2.000000e+00)
+; VC51-NEXT: ret float [[R]]
+;
+; VC64-LABEL: define float @pow2_strict(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[SQUARE:%.*]] = fmul float [[X]], [[X]]
+; VC64-NEXT: ret float [[SQUARE]]
+;
+; VC83-LABEL: define float @pow2_strict(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[SQUARE:%.*]] = fmul float [[X]], [[X]]
+; VC83-NEXT: ret float [[SQUARE]]
+;
+; NOLIB-LABEL: define float @pow2_strict(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[R:%.*]] = call float @powf(float [[X]], float 2.000000e+00)
+; NOLIB-NEXT: ret float [[R]]
;
%r = call float @powf(float %x, float 2.0)
ret float %r
}
define <2 x float> @pow2_strictv(<2 x float> %x) {
-; CHECK-LABEL: @pow2_strictv(
-; CHECK-NEXT: [[SQUARE:%.*]] = fmul <2 x float> [[X:%.*]], [[X]]
+; CHECK-LABEL: define <2 x float> @pow2_strictv(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
+; CHECK-NEXT: [[SQUARE:%.*]] = fmul <2 x float> [[X]], [[X]]
; CHECK-NEXT: ret <2 x float> [[SQUARE]]
;
%r = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 2.0, float 2.0>)
@@ -456,19 +687,24 @@ define <2 x float> @pow2_strictv(<2 x float> %x) {
}
define double @pow2_double_strict(double %x) {
-; CHECK-LABEL: @pow2_double_strict(
-; LIB-NEXT: [[SQUARE:%.*]] = fmul double [[X:%.*]], [[X]]
+; LIB-LABEL: define double @pow2_double_strict(
+; LIB-SAME: double [[X:%.*]]) {
+; LIB-NEXT: [[SQUARE:%.*]] = fmul double [[X]], [[X]]
; LIB-NEXT: ret double [[SQUARE]]
-; NOLIB-NEXT: [[POW:%.*]] = call double @pow(double [[X:%.*]], double 2.000000e+00)
-; NOLIB-NEXT: ret double [[POW]]
+;
+; NOLIB-LABEL: define double @pow2_double_strict(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[R:%.*]] = call double @pow(double [[X]], double 2.000000e+00)
+; NOLIB-NEXT: ret double [[R]]
;
%r = call double @pow(double %x, double 2.0)
ret double %r
}
define <2 x double> @pow2_double_strictv(<2 x double> %x) {
-; CHECK-LABEL: @pow2_double_strictv(
-; CHECK-NEXT: [[SQUARE:%.*]] = fmul <2 x double> [[X:%.*]], [[X]]
+; CHECK-LABEL: define <2 x double> @pow2_double_strictv(
+; CHECK-SAME: <2 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[SQUARE:%.*]] = fmul <2 x double> [[X]], [[X]]
; CHECK-NEXT: ret <2 x double> [[SQUARE]]
;
%r = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 2.0, double 2.0>)
@@ -478,19 +714,35 @@ define <2 x double> @pow2_double_strictv(<2 x double> %x) {
; Don't drop the FMF - PR35601 ( https://bugs.llvm.org/show_bug.cgi?id=35601 )
define float @pow2_fast(float %x) {
-; CHECK-LABEL: @pow2_fast(
-; ANY-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
+; ANY-LABEL: define float @pow2_fast(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: [[SQUARE:%.*]] = fmul fast float [[X]], [[X]]
; ANY-NEXT: ret float [[SQUARE]]
-; VC32-NEXT: [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 2.000000e+00)
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 2.000000e+00)
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
-; VC64-NEXT: ret float [[SQUARE]]
-; VC83-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
-; VC83-NEXT: ret float [[SQUARE]]
-; NOLIB-NEXT: [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 2.000000e+00)
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @pow2_fast(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[R:%.*]] = call fast float @powf(float [[X]], float 2.000000e+00)
+; VC32-NEXT: ret float [[R]]
+;
+; VC51-LABEL: define float @pow2_fast(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[R:%.*]] = call fast float @powf(float [[X]], float 2.000000e+00)
+; VC51-NEXT: ret float [[R]]
+;
+; VC64-LABEL: define float @pow2_fast(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[SQUARE:%.*]] = fmul fast float [[X]], [[X]]
+; VC64-NEXT: ret float [[SQUARE]]
+;
+; VC83-LABEL: define float @pow2_fast(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[SQUARE:%.*]] = fmul fast float [[X]], [[X]]
+; VC83-NEXT: ret float [[SQUARE]]
+;
+; NOLIB-LABEL: define float @pow2_fast(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[R:%.*]] = call fast float @powf(float [[X]], float 2.000000e+00)
+; NOLIB-NEXT: ret float [[R]]
;
%r = call fast float @powf(float %x, float 2.0)
ret float %r
@@ -499,27 +751,44 @@ define float @pow2_fast(float %x) {
; Check pow(x, -1.0) -> 1.0/x.
define float @pow_neg1_strict(float %x) {
-; CHECK-LABEL: @pow_neg1_strict(
-; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
+; ANY-LABEL: define float @pow_neg1_strict(
+; ANY-SAME: float [[X:%.*]]) {
+; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X]]
; ANY-NEXT: ret float [[RECIPROCAL]]
-; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float -1.000000e+00)
-; VC32-NEXT: ret float [[POW]]
-; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float -1.000000e+00)
-; VC51-NEXT: ret float [[POW]]
-; VC64-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
-; VC64-NEXT: ret float [[RECIPROCAL]]
-; VC83-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
-; VC83-NEXT: ret float [[RECIPROCAL]]
-; NOLIB-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float -1.000000e+00)
-; NOLIB-NEXT: ret float [[POW]]
+;
+; VC32-LABEL: define float @pow_neg1_strict(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[R:%.*]] = call float @powf(float [[X]], float -1.000000e+00)
+; VC32-NEXT: ret float [[R]]
+;
+; VC51-LABEL: define float @pow_neg1_strict(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[R:%.*]] = call float @powf(float [[X]], float -1.000000e+00)
+; VC51-NEXT: ret float [[R]]
+;
+; VC64-LABEL: define float @pow_neg1_strict(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X]]
+; VC64-NEXT: ret float [[RECIPROCAL]]
+;
+; VC83-LABEL: define float @pow_neg1_strict(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X]]
+; VC83-NEXT: ret float [[RECIPROCAL]]
+;
+; NOLIB-LABEL: define float @pow_neg1_strict(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[R:%.*]] = call float @powf(float [[X]], float -1.000000e+00)
+; NOLIB-NEXT: ret float [[R]]
;
%r = call float @powf(float %x, float -1.0)
ret float %r
}
define <2 x float> @pow_neg1_strictv(<2 x float> %x) {
-; CHECK-LABEL: @pow_neg1_strictv(
-; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, [[X:%.*]]
+; CHECK-LABEL: define <2 x float> @pow_neg1_strictv(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
+; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, [[X]]
; CHECK-NEXT: ret <2 x float> [[RECIPROCAL]]
;
%r = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float -1.0, float -1.0>)
@@ -527,19 +796,24 @@ define <2 x float> @pow_neg1_strictv(<2 x float> %x) {
}
define double @pow_neg1_double_fast(double %x) {
-; CHECK-LABEL: @pow_neg1_double_fast(
-; LIB-NEXT: [[RECIPROCAL:%.*]] = fdiv fast double 1.000000e+00, [[X:%.*]]
+; LIB-LABEL: define double @pow_neg1_double_fast(
+; LIB-SAME: double [[X:%.*]]) {
+; LIB-NEXT: [[RECIPROCAL:%.*]] = fdiv fast double 1.000000e+00, [[X]]
; LIB-NEXT: ret double [[RECIPROCAL]]
-; NOLIB-NEXT: [[POW:%.*]] = call fast double @pow(double [[X:%.*]], double -1.000000e+00)
-; NOLIB-NEXT: ret double [[POW]]
+;
+; NOLIB-LABEL: define double @pow_neg1_double_fast(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[R:%.*]] = call fast double @pow(double [[X]], double -1.000000e+00)
+; NOLIB-NEXT: ret double [[R]]
;
%r = call fast double @pow(double %x, double -1.0)
ret double %r
}
define <2 x double> @pow_neg1_double_fastv(<2 x double> %x) {
-; CHECK-LABEL: @pow_neg1_double_fastv(
-; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[X:%.*]]
+; CHECK-LABEL: define <2 x double> @pow_neg1_double_fastv(
+; CHECK-SAME: <2 x double> [[X:%.*]]) {
+; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[X]]
; CHECK-NEXT: ret <2 x double> [[RECIPROCAL]]
;
%r = call fast <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double -1.0, double -1.0>)
@@ -547,12 +821,13 @@ define <2 x double> @pow_neg1_double_fastv(<2 x double> %x) {
}
define double @pow_intrinsic_half_no_FMF(double %x) {
-; CHECK-LABEL: @pow_intrinsic_half_no_FMF(
-; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
+; CHECK-LABEL: define double @pow_intrinsic_half_no_FMF(
+; CHECK-SAME: double [[X:%.*]]) {
+; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X]])
; CHECK-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
; CHECK-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
-; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
-; CHECK-NEXT: ret double [[TMP1]]
+; CHECK-NEXT: [[RETVAL:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
+; CHECK-NEXT: ret double [[RETVAL]]
;
%retval = call double @llvm.pow.f64(double %x, double 0.5)
ret double %retval
@@ -561,23 +836,59 @@ define double @pow_intrinsic_half_no_FMF(double %x) {
; Check pow(10.0, x) -> __exp10(x) on OS X 10.9+ and iOS 7.0+.
define float @test_simplify18(float %x) {
-; CHECK-LABEL: @test_simplify18(
-; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @exp10f(float [[X:%.*]])
-; CHECK-EXP10-NEXT: ret float [[__EXP10F]]
-; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X:%.*]])
-; CHECK-NO-EXP10-NEXT: ret float [[RETVAL]]
+; CHECK-EXP10-LABEL: define float @test_simplify18(
+; CHECK-EXP10-SAME: float [[X:%.*]]) {
+; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @__exp10f(float [[X]])
+; CHECK-EXP10-NEXT: ret float [[__EXP10F]]
+;
+; VC32-LABEL: define float @test_simplify18(
+; VC32-SAME: float [[X:%.*]]) {
+; VC32-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X]])
+; VC32-NEXT: ret float [[RETVAL]]
+;
+; VC51-LABEL: define float @test_simplify18(
+; VC51-SAME: float [[X:%.*]]) {
+; VC51-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X]])
+; VC51-NEXT: ret float [[RETVAL]]
+;
+; VC64-LABEL: define float @test_simplify18(
+; VC64-SAME: float [[X:%.*]]) {
+; VC64-NEXT: [[EXP10F:%.*]] = call float @exp10f(float [[X]])
+; VC64-NEXT: ret float [[EXP10F]]
+;
+; VC83-LABEL: define float @test_simplify18(
+; VC83-SAME: float [[X:%.*]]) {
+; VC83-NEXT: [[EXP10F:%.*]] = call float @exp10f(float [[X]])
+; VC83-NEXT: ret float [[EXP10F]]
+;
+; NOLIB-LABEL: define float @test_simplify18(
+; NOLIB-SAME: float [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X]])
+; NOLIB-NEXT: ret float [[RETVAL]]
;
%retval = call float @powf(float 10.0, float %x)
ret float %retval
}
define double @test_simplify19(double %x) {
-; CHECK-LABEL: @test_simplify19(
-; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @exp10(double [[X:%.*]])
-; CHECK-EXP10-NEXT: ret double [[__EXP10]]
-; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+01, double [[X:%.*]])
-; CHECK-NO-EXP10-NEXT: ret double [[RETVAL]]
+; CHECK-EXP10-LABEL: define double @test_simplify19(
+; CHECK-EXP10-SAME: double [[X:%.*]]) {
+; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @__exp10(double [[X]])
+; CHECK-EXP10-NEXT: ret double [[__EXP10]]
+;
+; MSVC-LABEL: define double @test_simplify19(
+; MSVC-SAME: double [[X:%.*]]) {
+; MSVC-NEXT: [[EXP10:%.*]] = call double @exp10(double [[X]])
+; MSVC-NEXT: ret double [[EXP10]]
+;
+; NOLIB-LABEL: define double @test_simplify19(
+; NOLIB-SAME: double [[X:%.*]]) {
+; NOLIB-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+01, double [[X]])
+; NOLIB-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double 10.0, double %x)
ret double %retval
}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK-NO-EXP10: {{.*}}
+; VC19: {{.*}}
diff --git a/llvm/test/Transforms/InstCombine/pow-exp.ll b/llvm/test/Transforms/InstCombine/pow-exp.ll
index 9d91ad2402eb1d..1271f02a67cc7d 100644
--- a/llvm/test/Transforms/InstCombine/pow-exp.ll
+++ b/llvm/test/Transforms/InstCombine/pow-exp.ll
@@ -139,9 +139,10 @@ define fp128 @powl_exp2l_not_fast(fp128 %x, fp128 %y) {
; TODO: exp10() is not widely enabled by many targets yet.
define float @powf_exp10f(float %x, float %y) {
-; CHECK-LABEL: @powf_exp10f(
-; CHECK-NEXT: [[CALL:%.*]] = call fast float @exp10f(float [[X:%.*]]) #[[ATTR1:[0-9]+]]
-; CHECK-NEXT: [[POW:%.*]] = call fast float @llvm.pow.f32(float [[CALL]], float [[Y:%.*]])
+; CHECK-LABEL: define float @powf_exp10f(
+; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) {
+; CHECK-NEXT: [[CALL:%.*]] = call fast float @exp10f(float [[X]]) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT: [[POW:%.*]] = call fast float @llvm.pow.f32(float [[CALL]], float [[Y]])
; CHECK-NEXT: ret float [[POW]]
;
%call = call fast float @exp10f(float %x) nounwind readnone
@@ -150,9 +151,10 @@ define float @powf_exp10f(float %x, float %y) {
}
define double @pow_exp10(double %x, double %y) {
-; CHECK-LABEL: @pow_exp10(
-; CHECK-NEXT: [[CALL:%.*]] = call fast double @exp10(double [[X:%.*]]) #[[ATTR1]]
-; CHECK-NEXT: [[POW:%.*]] = call fast double @llvm.pow.f64(double [[CALL]], double [[Y:%.*]])
+; CHECK-LABEL: define double @pow_exp10(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: [[CALL:%.*]] = call fast double @exp10(double [[X]]) #[[ATTR1]]
+; CHECK-NEXT: [[POW:%.*]] = call fast double @llvm.pow.f64(double [[CALL]], double [[Y]])
; CHECK-NEXT: ret double [[POW]]
;
%call = call fast double @exp10(double %x) nounwind readnone
@@ -161,9 +163,10 @@ define double @pow_exp10(double %x, double %y) {
}
define fp128 @pow_exp10l(fp128 %x, fp128 %y) {
-; CHECK-LABEL: @pow_exp10l(
-; CHECK-NEXT: [[CALL:%.*]] = call fast fp128 @exp10l(fp128 [[X:%.*]]) #[[ATTR1]]
-; CHECK-NEXT: [[POW:%.*]] = call fast fp128 @llvm.pow.f128(fp128 [[CALL]], fp128 [[Y:%.*]])
+; CHECK-LABEL: define fp128 @pow_exp10l(
+; CHECK-SAME: fp128 [[X:%.*]], fp128 [[Y:%.*]]) {
+; CHECK-NEXT: [[CALL:%.*]] = call fast fp128 @exp10l(fp128 [[X]]) #[[ATTR1]]
+; CHECK-NEXT: [[POW:%.*]] = call fast fp128 @llvm.pow.f128(fp128 [[CALL]], fp128 [[Y]])
; CHECK-NEXT: ret fp128 [[POW]]
;
%call = call fast fp128 @exp10l(fp128 %x) nounwind readnone
@@ -255,10 +258,10 @@ define double @pow_ok_base3(double %e) {
}
define double @pow_ok_ten_base(double %e) {
-; CHECK-LABEL: @pow_ok_ten_base(
-; CHECK-NEXT: [[MUL:%.*]] = fmul nnan ninf afn double [[E:%.*]], 0x400A934F{{.*}}
-; CHECK-NEXT: [[EXP2:%.*]] = tail call nnan ninf afn double @exp2(double [[MUL]])
-; CHECK-NEXT: ret double [[EXP2]]
+; CHECK-LABEL: define double @pow_ok_ten_base(
+; CHECK-SAME: double [[E:%.*]]) {
+; CHECK-NEXT: [[EXP10:%.*]] = tail call nnan ninf afn double @exp10(double [[E]])
+; CHECK-NEXT: ret double [[EXP10]]
;
%call = tail call afn nnan ninf double @pow(double 1.000000e+01, double %e)
ret double %call
@@ -305,10 +308,10 @@ define float @powf_ok_base3(float %e) {
}
define float @powf_ok_ten_base(float %e) {
-; CHECK-LABEL: @powf_ok_ten_base(
-; CHECK-NEXT: [[MUL:%.*]] = fmul nnan ninf afn float [[E:%.*]], 0x400A934{{.*}}
-; CHECK-NEXT: [[EXP2F:%.*]] = tail call nnan ninf afn float @exp2f(float [[MUL]])
-; CHECK-NEXT: ret float [[EXP2F]]
+; CHECK-LABEL: define float @powf_ok_ten_base(
+; CHECK-SAME: float [[E:%.*]]) {
+; CHECK-NEXT: [[EXP10F:%.*]] = tail call nnan ninf afn float @exp10f(float [[E]])
+; CHECK-NEXT: ret float [[EXP10F]]
;
%call = tail call afn nnan ninf float @powf(float 1.000000e+01, float %e)
ret float %call
More information about the llvm-commits
mailing list