Author: tstellar Date: Fri Jul 24 13:07:06 2015 New Revision: 243130 URL: http://llvm.org/viewvc/llvm-project?rev=243130&view=rev Log: Use llvm intrinsics for native_log and native_log2
Added: libclc/trunk/generic/include/clc/math/native_log.inc libclc/trunk/generic/include/clc/math/native_log2.inc libclc/trunk/generic/lib/math/native_log.cl libclc/trunk/generic/lib/math/native_log.inc libclc/trunk/generic/lib/math/native_log2.cl libclc/trunk/generic/lib/math/native_log2.inc Modified: libclc/trunk/generic/include/clc/math/native_log.h libclc/trunk/generic/include/clc/math/native_log2.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/native_log.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log.h?rev=243130&r1=243129&r2=243130&view=diff ============================================================================== --- libclc/trunk/generic/include/clc/math/native_log.h (original) +++ libclc/trunk/generic/include/clc/math/native_log.h Fri Jul 24 13:07:06 2015 @@ -1 +1,27 @@ -#define native_log log +/* + * Copyright (c) 2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#define __CLC_BODY <clc/math/native_log.inc> +#define __FLOAT_ONLY +#include <clc/math/gentype.inc> +#undef __CLC_BODY +#undef __FLOAT_ONLY Added: libclc/trunk/generic/include/clc/math/native_log.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log.inc?rev=243130&view=auto ============================================================================== --- libclc/trunk/generic/include/clc/math/native_log.inc (added) +++ libclc/trunk/generic/include/clc/math/native_log.inc Fri Jul 24 13:07:06 2015 @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE native_log(__CLC_GENTYPE a); Modified: libclc/trunk/generic/include/clc/math/native_log2.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log2.h?rev=243130&r1=243129&r2=243130&view=diff ============================================================================== --- libclc/trunk/generic/include/clc/math/native_log2.h (original) +++ libclc/trunk/generic/include/clc/math/native_log2.h Fri Jul 24 13:07:06 2015 @@ -1 +1,27 @@ -#define native_log2 log2 +/* + * Copyright (c) 2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#define __CLC_BODY <clc/math/native_log2.inc> +#define __FLOAT_ONLY +#include <clc/math/gentype.inc> +#undef __CLC_BODY +#undef __FLOAT_ONLY Added: libclc/trunk/generic/include/clc/math/native_log2.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log2.inc?rev=243130&view=auto ============================================================================== --- libclc/trunk/generic/include/clc/math/native_log2.inc (added) +++ libclc/trunk/generic/include/clc/math/native_log2.inc Fri Jul 24 13:07:06 2015 @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE native_log2(__CLC_GENTYPE a); Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=243130&r1=243129&r2=243130&view=diff ============================================================================== --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Jul 24 13:07:06 2015 @@ -94,6 +94,8 @@ math/ldexp.cl math/log10.cl math/log1p.cl math/mad.cl +math/native_log.cl +math/native_log2.cl math/tables.cl math/clc_nextafter.cl math/nextafter.cl Added: libclc/trunk/generic/lib/math/native_log.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log.cl?rev=243130&view=auto ============================================================================== --- libclc/trunk/generic/lib/math/native_log.cl (added) +++ libclc/trunk/generic/lib/math/native_log.cl Fri Jul 24 13:07:06 2015 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include <clc/clc.h> + +#define __CLC_FUNCTION __clc_native_log +#define __CLC_INTRINSIC "llvm.log" +#undef cl_khr_fp64 +#include <clc/math/unary_intrin.inc> + +#define __CLC_BODY <native_log.inc> +#define __FLOAT_ONLY +#include <clc/math/gentype.inc> Added: libclc/trunk/generic/lib/math/native_log.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log.inc?rev=243130&view=auto ============================================================================== --- libclc/trunk/generic/lib/math/native_log.inc (added) +++ libclc/trunk/generic/lib/math/native_log.inc Fri Jul 24 13:07:06 2015 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log(__CLC_GENTYPE val) { + return __clc_native_log(val); +} Added: libclc/trunk/generic/lib/math/native_log2.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log2.cl?rev=243130&view=auto ============================================================================== --- libclc/trunk/generic/lib/math/native_log2.cl (added) +++ libclc/trunk/generic/lib/math/native_log2.cl Fri Jul 24 13:07:06 2015 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include <clc/clc.h> + +#define __CLC_FUNCTION __clc_native_log2 +#define __CLC_INTRINSIC "llvm.log2" +#undef cl_khr_fp64 +#include <clc/math/unary_intrin.inc> + +#define __CLC_BODY <native_log2.inc> +#define __FLOAT_ONLY +#include <clc/math/gentype.inc> Added: libclc/trunk/generic/lib/math/native_log2.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log2.inc?rev=243130&view=auto ============================================================================== --- libclc/trunk/generic/lib/math/native_log2.inc (added) +++ libclc/trunk/generic/lib/math/native_log2.inc Fri Jul 24 13:07:06 2015 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log2(__CLC_GENTYPE val) { + return __clc_native_log2(val); +} _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits