[libc] Add diff and perf targets for more math functions

Comparing the run time of math functions from LLVM libc
with the MSVCRT libc:
|function	|perf-LLVM libc		    |perf-MSVCRT
|ceilf		|2.36 mins (141491389600 ns)|47.10 sec (47100940100 ns)
|exp2f             |6.37 mins (358441794700 ns)|12.39 mins (719404388300 ns)
|expf		|6.35 mins (381204661800 ns)|6.17 mins (346150163200 ns)
|fabsf		|1.18 mins (78425546600 ns) |53.75 sec (53745301900 ns)
|floorf		|3.15 mins (164770963800 ns)|45.94 sec (45935988400 ns)
|logbf		|4.38 mins (262508058800 ns)|55.47 sec (55466377700 ns)
|nearbyintf	|3.20 mins (167972868000 ns)|9.13 mins (523822963600 ns)
|rintf		|3.20 mins (168001498700 ns)|22.35 mins (1341266448800 ns)
|roundf		|2.35 mins (141151500600 ns)|1.42 mins (85326429800 ns)
|truncf		|2.31 mins (114846424000 ns)|59.41 sec (59414309100 ns)

Evaluating the number of differing results in Windows:
|function	|diff
|ceilf          |8388606 differing results
|exp2f         |213303887 differing results
|expf           |193922 differing results
|fabsf          |8388606 differing results
|floorf         |8388606 differing results
|logbf          |0 differing results
|nearbyintf     |0 differing results
|rintf          |0 differing results
|roundf         |0 differing results
|truncf 	|0 differing results

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D107462
This commit is contained in:
Hedin Garca 2021-08-04 13:49:41 +00:00 committed by Hedin García
parent fec8f1a008
commit a9628e96ca
23 changed files with 522 additions and 4 deletions

View File

@ -127,6 +127,186 @@ add_diff_binary(
-fno-builtin
)
add_diff_binary(
ceilf_diff
SRCS
ceilf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.ceilf
)
add_diff_binary(
ceilf_perf
SRCS
ceilf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.ceilf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
exp2f_diff
SRCS
exp2f_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.exp2f
)
add_diff_binary(
exp2f_perf
SRCS
exp2f_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.exp2f
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
expf_diff
SRCS
expf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.expf
)
add_diff_binary(
expf_perf
SRCS
expf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.expf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
fabsf_diff
SRCS
fabsf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.fabsf
)
add_diff_binary(
fabsf_perf
SRCS
fabsf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.fabsf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
floorf_diff
SRCS
floorf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.floorf
)
add_diff_binary(
floorf_perf
SRCS
floorf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.floorf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
logbf_diff
SRCS
logbf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.logbf
)
add_diff_binary(
logbf_perf
SRCS
logbf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.logbf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
nearbyintf_diff
SRCS
nearbyintf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.nearbyintf
)
add_diff_binary(
nearbyintf_perf
SRCS
nearbyintf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.nearbyintf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
rintf_diff
SRCS
rintf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.rintf
)
add_diff_binary(
rintf_perf
SRCS
rintf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.rintf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
roundf_diff
SRCS
roundf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.roundf
)
add_diff_binary(
roundf_perf
SRCS
roundf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.roundf
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
sqrtf_diff
SRCS
@ -146,3 +326,23 @@ add_diff_binary(
COMPILE_OPTIONS
-fno-builtin
)
add_diff_binary(
truncf_diff
SRCS
truncf_diff.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.truncf
)
add_diff_binary(
truncf_perf
SRCS
truncf_perf.cpp
DEPENDS
.single_input_single_output_diff
libc.src.math.truncf
COMPILE_OPTIONS
-fno-builtin
)

View File

@ -0,0 +1,16 @@
//===-- Differential test for ceilf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/ceilf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::ceilf, ::ceilf,
"ceilf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for ceilf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/ceilf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::ceilf, ::ceilf,
"ceilf_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for exp2f----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/exp2f.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::exp2f, ::exp2f,
"exp2f_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for exp2f----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/exp2f.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::exp2f, ::exp2f,
"exp2f_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for expf ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/expf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::expf, ::expf,
"expf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for expf ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/expf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::expf, ::expf,
"expf_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for fabsf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/fabsf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::fabsf, ::fabsf,
"fabsf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for fabsf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/fabsf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::fabsf, ::fabsf,
"fabsf_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for floorf---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/floorf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::floorf, ::floorf,
"floorf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for floorf---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/floorf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::floorf, ::floorf,
"floorf_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for logbf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/logbf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::logbf, ::logbf,
"logbf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for logbf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/logbf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::logbf, ::logbf,
"logbf_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for nearbyintf-----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/nearbyintf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::nearbyintf, ::nearbyintf,
"nearbyintf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for nearbyintf-----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/nearbyintf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::nearbyintf, ::nearbyintf,
"nearbyintf_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for rintf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/rintf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::rintf, ::rintf,
"rintf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for rintf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/rintf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::rintf, ::rintf,
"rintf_perf.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for roundf---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/roundf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::roundf, ::roundf,
"roundf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for roundf---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/roundf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::roundf, ::roundf,
"roundf_perf.log")

View File

@ -1,5 +1,4 @@
//===-- Differential test for sqrtf
//----------------------------------------===//
//===-- Differential test for sqrtf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.

View File

@ -1,5 +1,4 @@
//===-- Differential test for sqrtf
//----------------------------------------===//
//===-- Differential test for sqrtf----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.

View File

@ -0,0 +1,16 @@
//===-- Differential test for truncf---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/truncf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::truncf, ::truncf,
"truncf_diff.log")

View File

@ -0,0 +1,16 @@
//===-- Differential test for truncf---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SingleInputSingleOutputDiff.h"
#include "src/math/truncf.h"
#include <math.h>
SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::truncf, ::truncf,
"truncf_perf.log")