Kaydet (Commit) b09356c2 authored tarafından I-Jui (Ray) Sung's avatar I-Jui (Ray) Sung

GPU Calc: add compile time option for using fmin/fmax intrinsics

Change-Id: I791d6c8f4335ab2c2618529f2e3d22d59c4f0b5a
üst 0e52d87c
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "op_logical.hxx" #include "op_logical.hxx"
#include "op_statistical.hxx" #include "op_statistical.hxx"
#include "op_array.hxx" #include "op_array.hxx"
// Comment out this to turn off FMIN and FMAX intrinsics
#define USE_FMIN_FMAX 1
#include "formulagroupcl_public.hxx" #include "formulagroupcl_public.hxx"
#include <list> #include <list>
...@@ -1038,7 +1040,7 @@ public: ...@@ -1038,7 +1040,7 @@ public:
virtual std::string GetBottom(void) { return "MAXFLOAT"; } virtual std::string GetBottom(void) { return "MAXFLOAT"; }
virtual std::string Gen2(const std::string &lhs, const std::string &rhs) const virtual std::string Gen2(const std::string &lhs, const std::string &rhs) const
{ {
return "fmin("+lhs + "," + rhs +")"; return "mcw_fmin("+lhs + "," + rhs +")";
} }
virtual std::string BinFuncName(void) const { return "min"; } virtual std::string BinFuncName(void) const { return "min"; }
}; };
...@@ -1048,7 +1050,7 @@ public: ...@@ -1048,7 +1050,7 @@ public:
virtual std::string GetBottom(void) { return "-MAXFLOAT"; } virtual std::string GetBottom(void) { return "-MAXFLOAT"; }
virtual std::string Gen2(const std::string &lhs, const std::string &rhs) const virtual std::string Gen2(const std::string &lhs, const std::string &rhs) const
{ {
return "fmax("+lhs + "," + rhs +")"; return "mcw_fmax("+lhs + "," + rhs +")";
} }
virtual std::string BinFuncName(void) const { return "max"; } virtual std::string BinFuncName(void) const { return "max"; }
}; };
......
...@@ -16,6 +16,14 @@ const char* publicFunc = ...@@ -16,6 +16,14 @@ const char* publicFunc =
"double fsub(double a, double b) { return a-b; }\n" "double fsub(double a, double b) { return a-b; }\n"
"double fdiv(double a, double b) { return a/b; }\n" "double fdiv(double a, double b) { return a/b; }\n"
"double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n" "double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n"
#ifdef USE_FMIN_FMAX
"double mcw_fmin(double a, double b) { return fmin(a, b); }\n"
"double mcw_fmax(double a, double b) { return fmax(a, b); }\n"
#else
"double mcw_fmin(double a, double b) { return a>b?b:a; }\n"
"double mcw_fmax(double a, double b) { return a>b?a:b; }\n"
#endif
; ;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment