File tree Expand file tree Collapse file tree 7 files changed +74
-46
lines changed Expand file tree Collapse file tree 7 files changed +74
-46
lines changed Original file line number Diff line number Diff line change 66// 
77//===----------------------------------------------------------------------===// 
88
9- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fract (__CLC_GENTYPE x, global __CLC_GENTYPE *iptr);
10- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fract (__CLC_GENTYPE x, local __CLC_GENTYPE *iptr);
11- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fract (__CLC_GENTYPE x, private __CLC_GENTYPE *iptr);
9+ #ifndef  __CLC_MATH_CLC_FRACT_H__ 
10+ #define  __CLC_MATH_CLC_FRACT_H__ 
11+ 
12+ #define  __CLC_FUNCTION  __clc_fract
13+ #define  __CLC_BODY  <clc/math/unary_decl_with_ptr.inc>
14+ 
15+ #include  <clc/math/gentype.inc> 
16+ 
17+ #undef  __CLC_BODY
18+ #undef  __CLC_FUNCTION
19+ 
20+ #endif  // __CLC_MATH_CLC_FRACT_H__ 
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ math/clc_fmax.cl
4646math/clc_fmin.cl
4747math/clc_floor.cl
4848math/clc_fmod.cl
49+ math/clc_fract.cl
4950math/clc_frexp.cl
5051math/clc_hypot.cl
5152math/clc_ldexp.cl
Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===// 
2+ // 
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 
4+ // See https://llvm.org/LICENSE.txt for license information. 
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 
6+ // 
7+ //===----------------------------------------------------------------------===// 
8+ 
9+ #include  <clc/clcmacro.h> 
10+ #include  <clc/internal/clc.h> 
11+ #include  <clc/math/clc_floor.h> 
12+ #include  <clc/math/clc_fmin.h> 
13+ #include  <clc/relational/clc_isinf.h> 
14+ #include  <clc/relational/clc_isnan.h> 
15+ 
16+ #define  __CLC_BODY  <clc_fract.inc>
17+ #include  <clc/math/gentype.inc> 
Original file line number Diff line number Diff line change 1+ // ===----------------------------------------------------------------------===//
2+ // 
3+ //  Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ //  See https://llvm.org/LICENSE.txt for license information.
5+ //  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ // 
7+ // ===----------------------------------------------------------------------===//
8+ 
9+ #if  __CLC_FPSIZE == 64
10+ #define  MIN_CONSTANT  0x1 .fffffffffffffp-1 
11+ #elif  __CLC_FPSIZE == 32
12+ #define  MIN_CONSTANT  0x1 .fffffep-1f 
13+ #elif  __CLC_FPSIZE == 16
14+ #define  MIN_CONSTANT  0x1 .ffcp-1h
15+ #endif 
16+ 
17+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fract (__CLC_GENTYPE x,
18+                                                  private __CLC_GENTYPE *iptr) {
19+   *iptr = __clc_floor (x);
20+   __CLC_GENTYPE r = __clc_fmin (x - *iptr, MIN_CONSTANT);
21+   r = __clc_isinf (x) ? __CLC_FP_LIT (0.0 ) : r;
22+   r = __clc_isnan (x) ? x : r;
23+   return  r;
24+ }
25+ 
26+ #define  FRACT_DEF (addrspace )                                                   \
27+   _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fract (                            \
28+       __CLC_GENTYPE x, addrspace __CLC_GENTYPE *iptr) {                        \
29+     __CLC_GENTYPE private_iptr;                                                \
30+     __CLC_GENTYPE ret = __clc_fract (x, &private_iptr);                         \
31+     *iptr = private_iptr;                                                      \
32+     return  ret;                                                                \
33+   }
34+ 
35+ FRACT_DEF (local);
36+ FRACT_DEF (global);
37+ 
38+ #undef  MIN_CONSTANT
Original file line number Diff line number Diff line change 66// 
77//===----------------------------------------------------------------------===// 
88
9- #define  __CLC_BODY  <clc/math/fract.inc>
9+ #define  __CLC_FUNCTION  fract
10+ #define  __CLC_BODY  <clc/math/unary_decl_with_ptr.inc>
1011#include  <clc/math/gentype.inc> 
12+ #undef  __CLC_FUNCTION
Original file line number Diff line number Diff line change 77//===----------------------------------------------------------------------===// 
88
99#include  <clc/clc.h> 
10+ #include  <clc/math/clc_fract.h> 
1011
11- #define  __CLC_BODY  <fract.inc>
12+ #define  FUNCTION  fract
13+ #define  __CLC_BODY  <clc/math/unary_def_with_ptr.inc>
1214#include  <clc/math/gentype.inc> 
  Load Diff This file was deleted. 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments