From 707aaef99d13174f2836372236e3ba99a62f13e2 Mon Sep 17 00:00:00 2001 From: Aaron En Ye Shi Date: Tue, 5 Dec 2017 23:14:10 +0000 Subject: [PATCH] Fix ilogb/ilogbf functions to return int This patch will fix hipDoublePrecisionMathDevice test on ThinLTO, which uncovered that hip math_function's ilogb/ilogbf should return type int instead of double. This will match rocdl. --- include/hip/hcc_detail/math_functions.h | 4 ++-- src/math_functions.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hip/hcc_detail/math_functions.h b/include/hip/hcc_detail/math_functions.h index efc15ea70c..7272639d70 100644 --- a/include/hip/hcc_detail/math_functions.h +++ b/include/hip/hcc_detail/math_functions.h @@ -67,7 +67,7 @@ __device__ float fminf(float x, float y); __device__ float fmodf(float x, float y); __device__ float frexpf(float x, int* nptr); __device__ float hypotf(float x, float y); -__device__ float ilogbf(float x); +__device__ int ilogbf(float x); __device__ int isfinite(float a); __device__ unsigned isinf(float a); __device__ unsigned isnan(float a); @@ -153,7 +153,7 @@ __device__ double fmin(double x, double y); __device__ double fmod(double x, double y); __device__ double frexp(double x, int *nptr); __device__ double hypot(double x, double y); -__device__ double ilogb(double x); +__device__ int ilogb(double x); __device__ int isfinite(double x); __device__ unsigned isinf(double x); __device__ unsigned isnan(double x); diff --git a/src/math_functions.cpp b/src/math_functions.cpp index 80ccece1a3..d75ca9005a 100644 --- a/src/math_functions.cpp +++ b/src/math_functions.cpp @@ -158,7 +158,7 @@ __device__ float hypotf(float x, float y) { return hc::precise_math::hypotf(x, y); } -__device__ float ilogbf(float x) +__device__ int ilogbf(float x) { return hc::precise_math::ilogbf(x); } @@ -544,7 +544,7 @@ __device__ double hypot(double x, double y) { return hc::precise_math::hypot(x, y); } -__device__ double ilogb(double x) +__device__ int ilogb(double x) { return hc::precise_math::ilogb(x); }