Index: vendor/clang/dist-release_90/include/clang/Frontend/LangStandards.def =================================================================== --- vendor/clang/dist-release_90/include/clang/Frontend/LangStandards.def (revision 351710) +++ vendor/clang/dist-release_90/include/clang/Frontend/LangStandards.def (revision 351711) @@ -1,189 +1,189 @@ //===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// #ifndef LANGSTANDARD #error "LANGSTANDARD must be defined before including this file" #endif /// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES) /// /// \param IDENT - The name of the standard as a C++ identifier. /// \param NAME - The name of the standard. /// \param LANG - The InputKind::Language for which this is a standard. /// \param DESC - A short description of the standard. /// \param FEATURES - The standard features as flags, these are enums from the /// clang::frontend namespace, which is assumed to be be available. /// LANGSTANDARD_ALIAS(IDENT, ALIAS) /// \param IDENT - The name of the standard as a C++ identifier. /// \param ALIAS - The alias of the standard. /// LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) /// Same as LANGSTANDARD_ALIAS, but for a deprecated alias. #ifndef LANGSTANDARD_ALIAS #define LANGSTANDARD_ALIAS(IDENT, ALIAS) #endif #ifndef LANGSTANDARD_ALIAS_DEPR #define LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) LANGSTANDARD_ALIAS(IDENT, ALIAS) #endif // C89-ish modes. LANGSTANDARD(c89, "c89", C, "ISO C 1990", ImplicitInt) LANGSTANDARD_ALIAS(c89, "c90") LANGSTANDARD_ALIAS(c89, "iso9899:1990") LANGSTANDARD(c94, "iso9899:199409", C, "ISO C 1990 with amendment 1", Digraphs | ImplicitInt) LANGSTANDARD(gnu89, "gnu89", C, "ISO C 1990 with GNU extensions", LineComment | Digraphs | GNUMode | ImplicitInt) LANGSTANDARD_ALIAS(gnu89, "gnu90") // C99-ish modes LANGSTANDARD(c99, "c99", C, "ISO C 1999", LineComment | C99 | Digraphs | HexFloat) LANGSTANDARD_ALIAS(c99, "iso9899:1999") LANGSTANDARD_ALIAS_DEPR(c99, "c9x") LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x") LANGSTANDARD(gnu99, "gnu99", C, "ISO C 1999 with GNU extensions", LineComment | C99 | Digraphs | GNUMode | HexFloat) LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x") // C11 modes LANGSTANDARD(c11, "c11", C, "ISO C 2011", LineComment | C99 | C11 | Digraphs | HexFloat) LANGSTANDARD_ALIAS(c11, "iso9899:2011") LANGSTANDARD_ALIAS_DEPR(c11, "c1x") LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x") LANGSTANDARD(gnu11, "gnu11", C, "ISO C 2011 with GNU extensions", LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat) LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x") // C17 modes LANGSTANDARD(c17, "c17", C, "ISO C 2017", LineComment | C99 | C11 | C17 | Digraphs | HexFloat) LANGSTANDARD_ALIAS(c17, "iso9899:2017") LANGSTANDARD_ALIAS(c17, "c18") LANGSTANDARD_ALIAS(c17, "iso9899:2018") LANGSTANDARD(gnu17, "gnu17", C, "ISO C 2017 with GNU extensions", LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat) LANGSTANDARD_ALIAS(gnu17, "gnu18") // C2x modes LANGSTANDARD(c2x, "c2x", C, "Working Draft for ISO C2x", LineComment | C99 | C11 | C17 | C2x | Digraphs | HexFloat) LANGSTANDARD(gnu2x, "gnu2x", C, "Working Draft for ISO C2x with GNU extensions", LineComment | C99 | C11 | C17 | C2x | Digraphs | GNUMode | HexFloat) // C++ modes LANGSTANDARD(cxx98, "c++98", CXX, "ISO C++ 1998 with amendments", LineComment | CPlusPlus | Digraphs) LANGSTANDARD_ALIAS(cxx98, "c++03") LANGSTANDARD(gnucxx98, "gnu++98", CXX, "ISO C++ 1998 with amendments and GNU extensions", LineComment | CPlusPlus | Digraphs | GNUMode) LANGSTANDARD_ALIAS(gnucxx98, "gnu++03") LANGSTANDARD(cxx11, "c++11", CXX, "ISO C++ 2011 with amendments", LineComment | CPlusPlus | CPlusPlus11 | Digraphs) LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x") LANGSTANDARD(gnucxx11, "gnu++11", CXX, "ISO C++ 2011 with amendments and GNU extensions", LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode) LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x") LANGSTANDARD(cxx14, "c++14", CXX, "ISO C++ 2014 with amendments", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs) LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y") LANGSTANDARD(gnucxx14, "gnu++14", CXX, "ISO C++ 2014 with amendments and GNU extensions", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs | GNUMode) LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y") LANGSTANDARD(cxx17, "c++17", CXX, "ISO C++ 2017 with amendments", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | Digraphs | HexFloat) LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z") LANGSTANDARD(gnucxx17, "gnu++17", CXX, "ISO C++ 2017 with amendments and GNU extensions", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | Digraphs | HexFloat | GNUMode) LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z") LANGSTANDARD(cxx2a, "c++2a", CXX, "Working draft for ISO C++ 2020", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | CPlusPlus2a | Digraphs | HexFloat) LANGSTANDARD(gnucxx2a, "gnu++2a", CXX, "Working draft for ISO C++ 2020 with GNU extensions", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | CPlusPlus2a | Digraphs | HexFloat | GNUMode) // OpenCL LANGSTANDARD(opencl10, "cl1.0", OpenCL, "OpenCL 1.0", LineComment | C99 | Digraphs | HexFloat | OpenCL) LANGSTANDARD_ALIAS_DEPR(opencl10, "cl") LANGSTANDARD(opencl11, "cl1.1", OpenCL, "OpenCL 1.1", LineComment | C99 | Digraphs | HexFloat | OpenCL) LANGSTANDARD(opencl12, "cl1.2", OpenCL, "OpenCL 1.2", LineComment | C99 | Digraphs | HexFloat | OpenCL) LANGSTANDARD(opencl20, "cl2.0", OpenCL, "OpenCL 2.0", LineComment | C99 | Digraphs | HexFloat | OpenCL) -LANGSTANDARD(openclcpp, "c++", +LANGSTANDARD(openclcpp, "clc++", OpenCL, "C++ for OpenCL", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | Digraphs | HexFloat | OpenCL) LANGSTANDARD_ALIAS_DEPR(opencl10, "CL") LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1") LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2") LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0") LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++") // CUDA LANGSTANDARD(cuda, "cuda", CUDA, "NVIDIA CUDA(tm)", LineComment | CPlusPlus | Digraphs) // HIP LANGSTANDARD(hip, "hip", HIP, "HIP", LineComment | CPlusPlus | Digraphs) #undef LANGSTANDARD #undef LANGSTANDARD_ALIAS #undef LANGSTANDARD_ALIAS_DEPR Index: vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.cpp =================================================================== --- vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.cpp (revision 351710) +++ vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.cpp (revision 351711) @@ -1,136 +1,140 @@ //===--- RISCV.cpp - Implement RISCV target feature support ---------------===// // // 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 // //===----------------------------------------------------------------------===// // // This file implements RISCV TargetInfo objects. // //===----------------------------------------------------------------------===// #include "RISCV.h" #include "clang/Basic/MacroBuilder.h" #include "llvm/ADT/StringSwitch.h" using namespace clang; using namespace clang::targets; ArrayRef RISCVTargetInfo::getGCCRegNames() const { static const char *const GCCRegNames[] = { "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31"}; return llvm::makeArrayRef(GCCRegNames); } ArrayRef RISCVTargetInfo::getGCCRegAliases() const { static const TargetInfo::GCCRegAlias GCCRegAliases[] = { {{"zero"}, "x0"}, {{"ra"}, "x1"}, {{"sp"}, "x2"}, {{"gp"}, "x3"}, {{"tp"}, "x4"}, {{"t0"}, "x5"}, {{"t1"}, "x6"}, {{"t2"}, "x7"}, {{"s0"}, "x8"}, {{"s1"}, "x9"}, {{"a0"}, "x10"}, {{"a1"}, "x11"}, {{"a2"}, "x12"}, {{"a3"}, "x13"}, {{"a4"}, "x14"}, {{"a5"}, "x15"}, {{"a6"}, "x16"}, {{"a7"}, "x17"}, {{"s2"}, "x18"}, {{"s3"}, "x19"}, {{"s4"}, "x20"}, {{"s5"}, "x21"}, {{"s6"}, "x22"}, {{"s7"}, "x23"}, {{"s8"}, "x24"}, {{"s9"}, "x25"}, {{"s10"}, "x26"}, {{"s11"}, "x27"}, {{"t3"}, "x28"}, {{"t4"}, "x29"}, {{"t5"}, "x30"}, {{"t6"}, "x31"}}; return llvm::makeArrayRef(GCCRegAliases); } bool RISCVTargetInfo::validateAsmConstraint( const char *&Name, TargetInfo::ConstraintInfo &Info) const { switch (*Name) { default: return false; case 'I': // A 12-bit signed immediate. Info.setRequiresImmediate(-2048, 2047); return true; case 'J': // Integer zero. Info.setRequiresImmediate(0); return true; case 'K': // A 5-bit unsigned immediate for CSR access instructions. Info.setRequiresImmediate(0, 31); return true; case 'f': // A floating-point register. Info.setAllowsRegister(); return true; + case 'A': + // An address that is held in a general-purpose register. + Info.setAllowsMemory(); + return true; } } void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { Builder.defineMacro("__ELF__"); Builder.defineMacro("__riscv"); bool Is64Bit = getTriple().getArch() == llvm::Triple::riscv64; Builder.defineMacro("__riscv_xlen", Is64Bit ? "64" : "32"); // TODO: modify when more code models are supported. Builder.defineMacro("__riscv_cmodel_medlow"); StringRef ABIName = getABI(); if (ABIName == "ilp32f" || ABIName == "lp64f") Builder.defineMacro("__riscv_float_abi_single"); else if (ABIName == "ilp32d" || ABIName == "lp64d") Builder.defineMacro("__riscv_float_abi_double"); else if (ABIName == "ilp32e") Builder.defineMacro("__riscv_abi_rve"); else Builder.defineMacro("__riscv_float_abi_soft"); if (HasM) { Builder.defineMacro("__riscv_mul"); Builder.defineMacro("__riscv_div"); Builder.defineMacro("__riscv_muldiv"); } if (HasA) Builder.defineMacro("__riscv_atomic"); if (HasF || HasD) { Builder.defineMacro("__riscv_flen", HasD ? "64" : "32"); Builder.defineMacro("__riscv_fdiv"); Builder.defineMacro("__riscv_fsqrt"); } if (HasC) Builder.defineMacro("__riscv_compressed"); } /// Return true if has this feature, need to sync with handleTargetFeatures. bool RISCVTargetInfo::hasFeature(StringRef Feature) const { bool Is64Bit = getTriple().getArch() == llvm::Triple::riscv64; return llvm::StringSwitch(Feature) .Case("riscv", true) .Case("riscv32", !Is64Bit) .Case("riscv64", Is64Bit) .Case("m", HasM) .Case("a", HasA) .Case("f", HasF) .Case("d", HasD) .Case("c", HasC) .Default(false); } /// Perform initialization based on the user configured set of features. bool RISCVTargetInfo::handleTargetFeatures(std::vector &Features, DiagnosticsEngine &Diags) { for (const auto &Feature : Features) { if (Feature == "+m") HasM = true; else if (Feature == "+a") HasA = true; else if (Feature == "+f") HasF = true; else if (Feature == "+d") HasD = true; else if (Feature == "+c") HasC = true; } return true; } Index: vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.h =================================================================== --- vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.h (revision 351710) +++ vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.h (revision 351711) @@ -1,117 +1,131 @@ //===--- RISCV.h - Declare RISCV target feature support ---------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// // // This file declares RISCV TargetInfo objects. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_RISCV_H #define LLVM_CLANG_LIB_BASIC_TARGETS_RISCV_H #include "clang/Basic/TargetInfo.h" #include "clang/Basic/TargetOptions.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/Compiler.h" namespace clang { namespace targets { // RISC-V Target class RISCVTargetInfo : public TargetInfo { protected: std::string ABI; bool HasM; bool HasA; bool HasF; bool HasD; bool HasC; public: RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &) : TargetInfo(Triple), HasM(false), HasA(false), HasF(false), HasD(false), HasC(false) { LongDoubleWidth = 128; LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); SuitableAlign = 128; WCharType = SignedInt; WIntType = UnsignedInt; } StringRef getABI() const override { return ABI; } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override; ArrayRef getTargetBuiltins() const override { return None; } BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::VoidPtrBuiltinVaList; } const char *getClobbers() const override { return ""; } ArrayRef getGCCRegNames() const override; int getEHDataRegisterNumber(unsigned RegNo) const override { if (RegNo == 0) return 10; else if (RegNo == 1) return 11; else return -1; } ArrayRef getGCCRegAliases() const override; bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override; bool hasFeature(StringRef Feature) const override; bool handleTargetFeatures(std::vector &Features, DiagnosticsEngine &Diags) override; }; class LLVM_LIBRARY_VISIBILITY RISCV32TargetInfo : public RISCVTargetInfo { public: RISCV32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : RISCVTargetInfo(Triple, Opts) { IntPtrType = SignedInt; PtrDiffType = SignedInt; SizeType = UnsignedInt; resetDataLayout("e-m:e-p:32:32-i64:64-n32-S128"); } bool setABI(const std::string &Name) override { if (Name == "ilp32" || Name == "ilp32f" || Name == "ilp32d") { ABI = Name; return true; } return false; } + + void setMaxAtomicWidth() override { + MaxAtomicPromoteWidth = 128; + + if (HasA) + MaxAtomicInlineWidth = 32; + } }; class LLVM_LIBRARY_VISIBILITY RISCV64TargetInfo : public RISCVTargetInfo { public: RISCV64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : RISCVTargetInfo(Triple, Opts) { LongWidth = LongAlign = PointerWidth = PointerAlign = 64; IntMaxType = Int64Type = SignedLong; resetDataLayout("e-m:e-p:64:64-i64:64-i128:128-n64-S128"); } bool setABI(const std::string &Name) override { if (Name == "lp64" || Name == "lp64f" || Name == "lp64d") { ABI = Name; return true; } return false; + } + + void setMaxAtomicWidth() override { + MaxAtomicPromoteWidth = 128; + + if (HasA) + MaxAtomicInlineWidth = 64; } }; } // namespace targets } // namespace clang #endif // LLVM_CLANG_LIB_BASIC_TARGETS_RISCV_H Index: vendor/clang/dist-release_90/lib/Headers/opencl-c.h =================================================================== --- vendor/clang/dist-release_90/lib/Headers/opencl-c.h (revision 351710) +++ vendor/clang/dist-release_90/lib/Headers/opencl-c.h (revision 351711) @@ -1,16502 +1,16502 @@ //===--- opencl-c.h - OpenCL C language builtin function header -----------===// // // 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 // //===----------------------------------------------------------------------===// #ifndef _OPENCL_H_ #define _OPENCL_H_ #include "opencl-c-base.h" #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #ifndef cl_khr_depth_images #define cl_khr_depth_images #endif //cl_khr_depth_images #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 #ifdef cl_khr_3d_image_writes #pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable #endif //cl_khr_3d_image_writes #endif //__OPENCL_C_VERSION__ < CL_VERSION_2_0 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) #pragma OPENCL EXTENSION cl_intel_planar_yuv : begin #pragma OPENCL EXTENSION cl_intel_planar_yuv : end #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) #define __ovld __attribute__((overloadable)) #define __conv __attribute__((convergent)) // Optimizations #define __purefn __attribute__((pure)) #define __cnfn __attribute__((const)) // OpenCL v1.1/1.2/2.0 s6.2.3 - Explicit conversions char __ovld __cnfn convert_char_rte(char); char __ovld __cnfn convert_char_sat_rte(char); char __ovld __cnfn convert_char_rtz(char); char __ovld __cnfn convert_char_sat_rtz(char); char __ovld __cnfn convert_char_rtp(char); char __ovld __cnfn convert_char_sat_rtp(char); char __ovld __cnfn convert_char_rtn(char); char __ovld __cnfn convert_char_sat_rtn(char); char __ovld __cnfn convert_char(char); char __ovld __cnfn convert_char_sat(char); char __ovld __cnfn convert_char_rte(uchar); char __ovld __cnfn convert_char_sat_rte(uchar); char __ovld __cnfn convert_char_rtz(uchar); char __ovld __cnfn convert_char_sat_rtz(uchar); char __ovld __cnfn convert_char_rtp(uchar); char __ovld __cnfn convert_char_sat_rtp(uchar); char __ovld __cnfn convert_char_rtn(uchar); char __ovld __cnfn convert_char_sat_rtn(uchar); char __ovld __cnfn convert_char(uchar); char __ovld __cnfn convert_char_sat(uchar); char __ovld __cnfn convert_char_rte(short); char __ovld __cnfn convert_char_sat_rte(short); char __ovld __cnfn convert_char_rtz(short); char __ovld __cnfn convert_char_sat_rtz(short); char __ovld __cnfn convert_char_rtp(short); char __ovld __cnfn convert_char_sat_rtp(short); char __ovld __cnfn convert_char_rtn(short); char __ovld __cnfn convert_char_sat_rtn(short); char __ovld __cnfn convert_char(short); char __ovld __cnfn convert_char_sat(short); char __ovld __cnfn convert_char_rte(ushort); char __ovld __cnfn convert_char_sat_rte(ushort); char __ovld __cnfn convert_char_rtz(ushort); char __ovld __cnfn convert_char_sat_rtz(ushort); char __ovld __cnfn convert_char_rtp(ushort); char __ovld __cnfn convert_char_sat_rtp(ushort); char __ovld __cnfn convert_char_rtn(ushort); char __ovld __cnfn convert_char_sat_rtn(ushort); char __ovld __cnfn convert_char(ushort); char __ovld __cnfn convert_char_sat(ushort); char __ovld __cnfn convert_char_rte(int); char __ovld __cnfn convert_char_sat_rte(int); char __ovld __cnfn convert_char_rtz(int); char __ovld __cnfn convert_char_sat_rtz(int); char __ovld __cnfn convert_char_rtp(int); char __ovld __cnfn convert_char_sat_rtp(int); char __ovld __cnfn convert_char_rtn(int); char __ovld __cnfn convert_char_sat_rtn(int); char __ovld __cnfn convert_char(int); char __ovld __cnfn convert_char_sat(int); char __ovld __cnfn convert_char_rte(uint); char __ovld __cnfn convert_char_sat_rte(uint); char __ovld __cnfn convert_char_rtz(uint); char __ovld __cnfn convert_char_sat_rtz(uint); char __ovld __cnfn convert_char_rtp(uint); char __ovld __cnfn convert_char_sat_rtp(uint); char __ovld __cnfn convert_char_rtn(uint); char __ovld __cnfn convert_char_sat_rtn(uint); char __ovld __cnfn convert_char(uint); char __ovld __cnfn convert_char_sat(uint); char __ovld __cnfn convert_char_rte(long); char __ovld __cnfn convert_char_sat_rte(long); char __ovld __cnfn convert_char_rtz(long); char __ovld __cnfn convert_char_sat_rtz(long); char __ovld __cnfn convert_char_rtp(long); char __ovld __cnfn convert_char_sat_rtp(long); char __ovld __cnfn convert_char_rtn(long); char __ovld __cnfn convert_char_sat_rtn(long); char __ovld __cnfn convert_char(long); char __ovld __cnfn convert_char_sat(long); char __ovld __cnfn convert_char_rte(ulong); char __ovld __cnfn convert_char_sat_rte(ulong); char __ovld __cnfn convert_char_rtz(ulong); char __ovld __cnfn convert_char_sat_rtz(ulong); char __ovld __cnfn convert_char_rtp(ulong); char __ovld __cnfn convert_char_sat_rtp(ulong); char __ovld __cnfn convert_char_rtn(ulong); char __ovld __cnfn convert_char_sat_rtn(ulong); char __ovld __cnfn convert_char(ulong); char __ovld __cnfn convert_char_sat(ulong); char __ovld __cnfn convert_char_rte(float); char __ovld __cnfn convert_char_sat_rte(float); char __ovld __cnfn convert_char_rtz(float); char __ovld __cnfn convert_char_sat_rtz(float); char __ovld __cnfn convert_char_rtp(float); char __ovld __cnfn convert_char_sat_rtp(float); char __ovld __cnfn convert_char_rtn(float); char __ovld __cnfn convert_char_sat_rtn(float); char __ovld __cnfn convert_char(float); char __ovld __cnfn convert_char_sat(float); uchar __ovld __cnfn convert_uchar_rte(char); uchar __ovld __cnfn convert_uchar_sat_rte(char); uchar __ovld __cnfn convert_uchar_rtz(char); uchar __ovld __cnfn convert_uchar_sat_rtz(char); uchar __ovld __cnfn convert_uchar_rtp(char); uchar __ovld __cnfn convert_uchar_sat_rtp(char); uchar __ovld __cnfn convert_uchar_rtn(char); uchar __ovld __cnfn convert_uchar_sat_rtn(char); uchar __ovld __cnfn convert_uchar(char); uchar __ovld __cnfn convert_uchar_sat(char); uchar __ovld __cnfn convert_uchar_rte(uchar); uchar __ovld __cnfn convert_uchar_sat_rte(uchar); uchar __ovld __cnfn convert_uchar_rtz(uchar); uchar __ovld __cnfn convert_uchar_sat_rtz(uchar); uchar __ovld __cnfn convert_uchar_rtp(uchar); uchar __ovld __cnfn convert_uchar_sat_rtp(uchar); uchar __ovld __cnfn convert_uchar_rtn(uchar); uchar __ovld __cnfn convert_uchar_sat_rtn(uchar); uchar __ovld __cnfn convert_uchar(uchar); uchar __ovld __cnfn convert_uchar_sat(uchar); uchar __ovld __cnfn convert_uchar_rte(short); uchar __ovld __cnfn convert_uchar_sat_rte(short); uchar __ovld __cnfn convert_uchar_rtz(short); uchar __ovld __cnfn convert_uchar_sat_rtz(short); uchar __ovld __cnfn convert_uchar_rtp(short); uchar __ovld __cnfn convert_uchar_sat_rtp(short); uchar __ovld __cnfn convert_uchar_rtn(short); uchar __ovld __cnfn convert_uchar_sat_rtn(short); uchar __ovld __cnfn convert_uchar(short); uchar __ovld __cnfn convert_uchar_sat(short); uchar __ovld __cnfn convert_uchar_rte(ushort); uchar __ovld __cnfn convert_uchar_sat_rte(ushort); uchar __ovld __cnfn convert_uchar_rtz(ushort); uchar __ovld __cnfn convert_uchar_sat_rtz(ushort); uchar __ovld __cnfn convert_uchar_rtp(ushort); uchar __ovld __cnfn convert_uchar_sat_rtp(ushort); uchar __ovld __cnfn convert_uchar_rtn(ushort); uchar __ovld __cnfn convert_uchar_sat_rtn(ushort); uchar __ovld __cnfn convert_uchar(ushort); uchar __ovld __cnfn convert_uchar_sat(ushort); uchar __ovld __cnfn convert_uchar_rte(int); uchar __ovld __cnfn convert_uchar_sat_rte(int); uchar __ovld __cnfn convert_uchar_rtz(int); uchar __ovld __cnfn convert_uchar_sat_rtz(int); uchar __ovld __cnfn convert_uchar_rtp(int); uchar __ovld __cnfn convert_uchar_sat_rtp(int); uchar __ovld __cnfn convert_uchar_rtn(int); uchar __ovld __cnfn convert_uchar_sat_rtn(int); uchar __ovld __cnfn convert_uchar(int); uchar __ovld __cnfn convert_uchar_sat(int); uchar __ovld __cnfn convert_uchar_rte(uint); uchar __ovld __cnfn convert_uchar_sat_rte(uint); uchar __ovld __cnfn convert_uchar_rtz(uint); uchar __ovld __cnfn convert_uchar_sat_rtz(uint); uchar __ovld __cnfn convert_uchar_rtp(uint); uchar __ovld __cnfn convert_uchar_sat_rtp(uint); uchar __ovld __cnfn convert_uchar_rtn(uint); uchar __ovld __cnfn convert_uchar_sat_rtn(uint); uchar __ovld __cnfn convert_uchar(uint); uchar __ovld __cnfn convert_uchar_sat(uint); uchar __ovld __cnfn convert_uchar_rte(long); uchar __ovld __cnfn convert_uchar_sat_rte(long); uchar __ovld __cnfn convert_uchar_rtz(long); uchar __ovld __cnfn convert_uchar_sat_rtz(long); uchar __ovld __cnfn convert_uchar_rtp(long); uchar __ovld __cnfn convert_uchar_sat_rtp(long); uchar __ovld __cnfn convert_uchar_rtn(long); uchar __ovld __cnfn convert_uchar_sat_rtn(long); uchar __ovld __cnfn convert_uchar(long); uchar __ovld __cnfn convert_uchar_sat(long); uchar __ovld __cnfn convert_uchar_rte(ulong); uchar __ovld __cnfn convert_uchar_sat_rte(ulong); uchar __ovld __cnfn convert_uchar_rtz(ulong); uchar __ovld __cnfn convert_uchar_sat_rtz(ulong); uchar __ovld __cnfn convert_uchar_rtp(ulong); uchar __ovld __cnfn convert_uchar_sat_rtp(ulong); uchar __ovld __cnfn convert_uchar_rtn(ulong); uchar __ovld __cnfn convert_uchar_sat_rtn(ulong); uchar __ovld __cnfn convert_uchar(ulong); uchar __ovld __cnfn convert_uchar_sat(ulong); uchar __ovld __cnfn convert_uchar_rte(float); uchar __ovld __cnfn convert_uchar_sat_rte(float); uchar __ovld __cnfn convert_uchar_rtz(float); uchar __ovld __cnfn convert_uchar_sat_rtz(float); uchar __ovld __cnfn convert_uchar_rtp(float); uchar __ovld __cnfn convert_uchar_sat_rtp(float); uchar __ovld __cnfn convert_uchar_rtn(float); uchar __ovld __cnfn convert_uchar_sat_rtn(float); uchar __ovld __cnfn convert_uchar(float); uchar __ovld __cnfn convert_uchar_sat(float); short __ovld __cnfn convert_short_rte(char); short __ovld __cnfn convert_short_sat_rte(char); short __ovld __cnfn convert_short_rtz(char); short __ovld __cnfn convert_short_sat_rtz(char); short __ovld __cnfn convert_short_rtp(char); short __ovld __cnfn convert_short_sat_rtp(char); short __ovld __cnfn convert_short_rtn(char); short __ovld __cnfn convert_short_sat_rtn(char); short __ovld __cnfn convert_short(char); short __ovld __cnfn convert_short_sat(char); short __ovld __cnfn convert_short_rte(uchar); short __ovld __cnfn convert_short_sat_rte(uchar); short __ovld __cnfn convert_short_rtz(uchar); short __ovld __cnfn convert_short_sat_rtz(uchar); short __ovld __cnfn convert_short_rtp(uchar); short __ovld __cnfn convert_short_sat_rtp(uchar); short __ovld __cnfn convert_short_rtn(uchar); short __ovld __cnfn convert_short_sat_rtn(uchar); short __ovld __cnfn convert_short(uchar); short __ovld __cnfn convert_short_sat(uchar); short __ovld __cnfn convert_short_rte(short); short __ovld __cnfn convert_short_sat_rte(short); short __ovld __cnfn convert_short_rtz(short); short __ovld __cnfn convert_short_sat_rtz(short); short __ovld __cnfn convert_short_rtp(short); short __ovld __cnfn convert_short_sat_rtp(short); short __ovld __cnfn convert_short_rtn(short); short __ovld __cnfn convert_short_sat_rtn(short); short __ovld __cnfn convert_short(short); short __ovld __cnfn convert_short_sat(short); short __ovld __cnfn convert_short_rte(ushort); short __ovld __cnfn convert_short_sat_rte(ushort); short __ovld __cnfn convert_short_rtz(ushort); short __ovld __cnfn convert_short_sat_rtz(ushort); short __ovld __cnfn convert_short_rtp(ushort); short __ovld __cnfn convert_short_sat_rtp(ushort); short __ovld __cnfn convert_short_rtn(ushort); short __ovld __cnfn convert_short_sat_rtn(ushort); short __ovld __cnfn convert_short(ushort); short __ovld __cnfn convert_short_sat(ushort); short __ovld __cnfn convert_short_rte(int); short __ovld __cnfn convert_short_sat_rte(int); short __ovld __cnfn convert_short_rtz(int); short __ovld __cnfn convert_short_sat_rtz(int); short __ovld __cnfn convert_short_rtp(int); short __ovld __cnfn convert_short_sat_rtp(int); short __ovld __cnfn convert_short_rtn(int); short __ovld __cnfn convert_short_sat_rtn(int); short __ovld __cnfn convert_short(int); short __ovld __cnfn convert_short_sat(int); short __ovld __cnfn convert_short_rte(uint); short __ovld __cnfn convert_short_sat_rte(uint); short __ovld __cnfn convert_short_rtz(uint); short __ovld __cnfn convert_short_sat_rtz(uint); short __ovld __cnfn convert_short_rtp(uint); short __ovld __cnfn convert_short_sat_rtp(uint); short __ovld __cnfn convert_short_rtn(uint); short __ovld __cnfn convert_short_sat_rtn(uint); short __ovld __cnfn convert_short(uint); short __ovld __cnfn convert_short_sat(uint); short __ovld __cnfn convert_short_rte(long); short __ovld __cnfn convert_short_sat_rte(long); short __ovld __cnfn convert_short_rtz(long); short __ovld __cnfn convert_short_sat_rtz(long); short __ovld __cnfn convert_short_rtp(long); short __ovld __cnfn convert_short_sat_rtp(long); short __ovld __cnfn convert_short_rtn(long); short __ovld __cnfn convert_short_sat_rtn(long); short __ovld __cnfn convert_short(long); short __ovld __cnfn convert_short_sat(long); short __ovld __cnfn convert_short_rte(ulong); short __ovld __cnfn convert_short_sat_rte(ulong); short __ovld __cnfn convert_short_rtz(ulong); short __ovld __cnfn convert_short_sat_rtz(ulong); short __ovld __cnfn convert_short_rtp(ulong); short __ovld __cnfn convert_short_sat_rtp(ulong); short __ovld __cnfn convert_short_rtn(ulong); short __ovld __cnfn convert_short_sat_rtn(ulong); short __ovld __cnfn convert_short(ulong); short __ovld __cnfn convert_short_sat(ulong); short __ovld __cnfn convert_short_rte(float); short __ovld __cnfn convert_short_sat_rte(float); short __ovld __cnfn convert_short_rtz(float); short __ovld __cnfn convert_short_sat_rtz(float); short __ovld __cnfn convert_short_rtp(float); short __ovld __cnfn convert_short_sat_rtp(float); short __ovld __cnfn convert_short_rtn(float); short __ovld __cnfn convert_short_sat_rtn(float); short __ovld __cnfn convert_short(float); short __ovld __cnfn convert_short_sat(float); ushort __ovld __cnfn convert_ushort_rte(char); ushort __ovld __cnfn convert_ushort_sat_rte(char); ushort __ovld __cnfn convert_ushort_rtz(char); ushort __ovld __cnfn convert_ushort_sat_rtz(char); ushort __ovld __cnfn convert_ushort_rtp(char); ushort __ovld __cnfn convert_ushort_sat_rtp(char); ushort __ovld __cnfn convert_ushort_rtn(char); ushort __ovld __cnfn convert_ushort_sat_rtn(char); ushort __ovld __cnfn convert_ushort(char); ushort __ovld __cnfn convert_ushort_sat(char); ushort __ovld __cnfn convert_ushort_rte(uchar); ushort __ovld __cnfn convert_ushort_sat_rte(uchar); ushort __ovld __cnfn convert_ushort_rtz(uchar); ushort __ovld __cnfn convert_ushort_sat_rtz(uchar); ushort __ovld __cnfn convert_ushort_rtp(uchar); ushort __ovld __cnfn convert_ushort_sat_rtp(uchar); ushort __ovld __cnfn convert_ushort_rtn(uchar); ushort __ovld __cnfn convert_ushort_sat_rtn(uchar); ushort __ovld __cnfn convert_ushort(uchar); ushort __ovld __cnfn convert_ushort_sat(uchar); ushort __ovld __cnfn convert_ushort_rte(short); ushort __ovld __cnfn convert_ushort_sat_rte(short); ushort __ovld __cnfn convert_ushort_rtz(short); ushort __ovld __cnfn convert_ushort_sat_rtz(short); ushort __ovld __cnfn convert_ushort_rtp(short); ushort __ovld __cnfn convert_ushort_sat_rtp(short); ushort __ovld __cnfn convert_ushort_rtn(short); ushort __ovld __cnfn convert_ushort_sat_rtn(short); ushort __ovld __cnfn convert_ushort(short); ushort __ovld __cnfn convert_ushort_sat(short); ushort __ovld __cnfn convert_ushort_rte(ushort); ushort __ovld __cnfn convert_ushort_sat_rte(ushort); ushort __ovld __cnfn convert_ushort_rtz(ushort); ushort __ovld __cnfn convert_ushort_sat_rtz(ushort); ushort __ovld __cnfn convert_ushort_rtp(ushort); ushort __ovld __cnfn convert_ushort_sat_rtp(ushort); ushort __ovld __cnfn convert_ushort_rtn(ushort); ushort __ovld __cnfn convert_ushort_sat_rtn(ushort); ushort __ovld __cnfn convert_ushort(ushort); ushort __ovld __cnfn convert_ushort_sat(ushort); ushort __ovld __cnfn convert_ushort_rte(int); ushort __ovld __cnfn convert_ushort_sat_rte(int); ushort __ovld __cnfn convert_ushort_rtz(int); ushort __ovld __cnfn convert_ushort_sat_rtz(int); ushort __ovld __cnfn convert_ushort_rtp(int); ushort __ovld __cnfn convert_ushort_sat_rtp(int); ushort __ovld __cnfn convert_ushort_rtn(int); ushort __ovld __cnfn convert_ushort_sat_rtn(int); ushort __ovld __cnfn convert_ushort(int); ushort __ovld __cnfn convert_ushort_sat(int); ushort __ovld __cnfn convert_ushort_rte(uint); ushort __ovld __cnfn convert_ushort_sat_rte(uint); ushort __ovld __cnfn convert_ushort_rtz(uint); ushort __ovld __cnfn convert_ushort_sat_rtz(uint); ushort __ovld __cnfn convert_ushort_rtp(uint); ushort __ovld __cnfn convert_ushort_sat_rtp(uint); ushort __ovld __cnfn convert_ushort_rtn(uint); ushort __ovld __cnfn convert_ushort_sat_rtn(uint); ushort __ovld __cnfn convert_ushort(uint); ushort __ovld __cnfn convert_ushort_sat(uint); ushort __ovld __cnfn convert_ushort_rte(long); ushort __ovld __cnfn convert_ushort_sat_rte(long); ushort __ovld __cnfn convert_ushort_rtz(long); ushort __ovld __cnfn convert_ushort_sat_rtz(long); ushort __ovld __cnfn convert_ushort_rtp(long); ushort __ovld __cnfn convert_ushort_sat_rtp(long); ushort __ovld __cnfn convert_ushort_rtn(long); ushort __ovld __cnfn convert_ushort_sat_rtn(long); ushort __ovld __cnfn convert_ushort(long); ushort __ovld __cnfn convert_ushort_sat(long); ushort __ovld __cnfn convert_ushort_rte(ulong); ushort __ovld __cnfn convert_ushort_sat_rte(ulong); ushort __ovld __cnfn convert_ushort_rtz(ulong); ushort __ovld __cnfn convert_ushort_sat_rtz(ulong); ushort __ovld __cnfn convert_ushort_rtp(ulong); ushort __ovld __cnfn convert_ushort_sat_rtp(ulong); ushort __ovld __cnfn convert_ushort_rtn(ulong); ushort __ovld __cnfn convert_ushort_sat_rtn(ulong); ushort __ovld __cnfn convert_ushort(ulong); ushort __ovld __cnfn convert_ushort_sat(ulong); ushort __ovld __cnfn convert_ushort_rte(float); ushort __ovld __cnfn convert_ushort_sat_rte(float); ushort __ovld __cnfn convert_ushort_rtz(float); ushort __ovld __cnfn convert_ushort_sat_rtz(float); ushort __ovld __cnfn convert_ushort_rtp(float); ushort __ovld __cnfn convert_ushort_sat_rtp(float); ushort __ovld __cnfn convert_ushort_rtn(float); ushort __ovld __cnfn convert_ushort_sat_rtn(float); ushort __ovld __cnfn convert_ushort(float); ushort __ovld __cnfn convert_ushort_sat(float); int __ovld __cnfn convert_int_rte(char); int __ovld __cnfn convert_int_sat_rte(char); int __ovld __cnfn convert_int_rtz(char); int __ovld __cnfn convert_int_sat_rtz(char); int __ovld __cnfn convert_int_rtp(char); int __ovld __cnfn convert_int_sat_rtp(char); int __ovld __cnfn convert_int_rtn(char); int __ovld __cnfn convert_int_sat_rtn(char); int __ovld __cnfn convert_int(char); int __ovld __cnfn convert_int_sat(char); int __ovld __cnfn convert_int_rte(uchar); int __ovld __cnfn convert_int_sat_rte(uchar); int __ovld __cnfn convert_int_rtz(uchar); int __ovld __cnfn convert_int_sat_rtz(uchar); int __ovld __cnfn convert_int_rtp(uchar); int __ovld __cnfn convert_int_sat_rtp(uchar); int __ovld __cnfn convert_int_rtn(uchar); int __ovld __cnfn convert_int_sat_rtn(uchar); int __ovld __cnfn convert_int(uchar); int __ovld __cnfn convert_int_sat(uchar); int __ovld __cnfn convert_int_rte(short); int __ovld __cnfn convert_int_sat_rte(short); int __ovld __cnfn convert_int_rtz(short); int __ovld __cnfn convert_int_sat_rtz(short); int __ovld __cnfn convert_int_rtp(short); int __ovld __cnfn convert_int_sat_rtp(short); int __ovld __cnfn convert_int_rtn(short); int __ovld __cnfn convert_int_sat_rtn(short); int __ovld __cnfn convert_int(short); int __ovld __cnfn convert_int_sat(short); int __ovld __cnfn convert_int_rte(ushort); int __ovld __cnfn convert_int_sat_rte(ushort); int __ovld __cnfn convert_int_rtz(ushort); int __ovld __cnfn convert_int_sat_rtz(ushort); int __ovld __cnfn convert_int_rtp(ushort); int __ovld __cnfn convert_int_sat_rtp(ushort); int __ovld __cnfn convert_int_rtn(ushort); int __ovld __cnfn convert_int_sat_rtn(ushort); int __ovld __cnfn convert_int(ushort); int __ovld __cnfn convert_int_sat(ushort); int __ovld __cnfn convert_int_rte(int); int __ovld __cnfn convert_int_sat_rte(int); int __ovld __cnfn convert_int_rtz(int); int __ovld __cnfn convert_int_sat_rtz(int); int __ovld __cnfn convert_int_rtp(int); int __ovld __cnfn convert_int_sat_rtp(int); int __ovld __cnfn convert_int_rtn(int); int __ovld __cnfn convert_int_sat_rtn(int); int __ovld __cnfn convert_int(int); int __ovld __cnfn convert_int_sat(int); int __ovld __cnfn convert_int_rte(uint); int __ovld __cnfn convert_int_sat_rte(uint); int __ovld __cnfn convert_int_rtz(uint); int __ovld __cnfn convert_int_sat_rtz(uint); int __ovld __cnfn convert_int_rtp(uint); int __ovld __cnfn convert_int_sat_rtp(uint); int __ovld __cnfn convert_int_rtn(uint); int __ovld __cnfn convert_int_sat_rtn(uint); int __ovld __cnfn convert_int(uint); int __ovld __cnfn convert_int_sat(uint); int __ovld __cnfn convert_int_rte(long); int __ovld __cnfn convert_int_sat_rte(long); int __ovld __cnfn convert_int_rtz(long); int __ovld __cnfn convert_int_sat_rtz(long); int __ovld __cnfn convert_int_rtp(long); int __ovld __cnfn convert_int_sat_rtp(long); int __ovld __cnfn convert_int_rtn(long); int __ovld __cnfn convert_int_sat_rtn(long); int __ovld __cnfn convert_int(long); int __ovld __cnfn convert_int_sat(long); int __ovld __cnfn convert_int_rte(ulong); int __ovld __cnfn convert_int_sat_rte(ulong); int __ovld __cnfn convert_int_rtz(ulong); int __ovld __cnfn convert_int_sat_rtz(ulong); int __ovld __cnfn convert_int_rtp(ulong); int __ovld __cnfn convert_int_sat_rtp(ulong); int __ovld __cnfn convert_int_rtn(ulong); int __ovld __cnfn convert_int_sat_rtn(ulong); int __ovld __cnfn convert_int(ulong); int __ovld __cnfn convert_int_sat(ulong); int __ovld __cnfn convert_int_rte(float); int __ovld __cnfn convert_int_sat_rte(float); int __ovld __cnfn convert_int_rtz(float); int __ovld __cnfn convert_int_sat_rtz(float); int __ovld __cnfn convert_int_rtp(float); int __ovld __cnfn convert_int_sat_rtp(float); int __ovld __cnfn convert_int_rtn(float); int __ovld __cnfn convert_int_sat_rtn(float); int __ovld __cnfn convert_int(float); int __ovld __cnfn convert_int_sat(float); uint __ovld __cnfn convert_uint_rte(char); uint __ovld __cnfn convert_uint_sat_rte(char); uint __ovld __cnfn convert_uint_rtz(char); uint __ovld __cnfn convert_uint_sat_rtz(char); uint __ovld __cnfn convert_uint_rtp(char); uint __ovld __cnfn convert_uint_sat_rtp(char); uint __ovld __cnfn convert_uint_rtn(char); uint __ovld __cnfn convert_uint_sat_rtn(char); uint __ovld __cnfn convert_uint(char); uint __ovld __cnfn convert_uint_sat(char); uint __ovld __cnfn convert_uint_rte(uchar); uint __ovld __cnfn convert_uint_sat_rte(uchar); uint __ovld __cnfn convert_uint_rtz(uchar); uint __ovld __cnfn convert_uint_sat_rtz(uchar); uint __ovld __cnfn convert_uint_rtp(uchar); uint __ovld __cnfn convert_uint_sat_rtp(uchar); uint __ovld __cnfn convert_uint_rtn(uchar); uint __ovld __cnfn convert_uint_sat_rtn(uchar); uint __ovld __cnfn convert_uint(uchar); uint __ovld __cnfn convert_uint_sat(uchar); uint __ovld __cnfn convert_uint_rte(short); uint __ovld __cnfn convert_uint_sat_rte(short); uint __ovld __cnfn convert_uint_rtz(short); uint __ovld __cnfn convert_uint_sat_rtz(short); uint __ovld __cnfn convert_uint_rtp(short); uint __ovld __cnfn convert_uint_sat_rtp(short); uint __ovld __cnfn convert_uint_rtn(short); uint __ovld __cnfn convert_uint_sat_rtn(short); uint __ovld __cnfn convert_uint(short); uint __ovld __cnfn convert_uint_sat(short); uint __ovld __cnfn convert_uint_rte(ushort); uint __ovld __cnfn convert_uint_sat_rte(ushort); uint __ovld __cnfn convert_uint_rtz(ushort); uint __ovld __cnfn convert_uint_sat_rtz(ushort); uint __ovld __cnfn convert_uint_rtp(ushort); uint __ovld __cnfn convert_uint_sat_rtp(ushort); uint __ovld __cnfn convert_uint_rtn(ushort); uint __ovld __cnfn convert_uint_sat_rtn(ushort); uint __ovld __cnfn convert_uint(ushort); uint __ovld __cnfn convert_uint_sat(ushort); uint __ovld __cnfn convert_uint_rte(int); uint __ovld __cnfn convert_uint_sat_rte(int); uint __ovld __cnfn convert_uint_rtz(int); uint __ovld __cnfn convert_uint_sat_rtz(int); uint __ovld __cnfn convert_uint_rtp(int); uint __ovld __cnfn convert_uint_sat_rtp(int); uint __ovld __cnfn convert_uint_rtn(int); uint __ovld __cnfn convert_uint_sat_rtn(int); uint __ovld __cnfn convert_uint(int); uint __ovld __cnfn convert_uint_sat(int); uint __ovld __cnfn convert_uint_rte(uint); uint __ovld __cnfn convert_uint_sat_rte(uint); uint __ovld __cnfn convert_uint_rtz(uint); uint __ovld __cnfn convert_uint_sat_rtz(uint); uint __ovld __cnfn convert_uint_rtp(uint); uint __ovld __cnfn convert_uint_sat_rtp(uint); uint __ovld __cnfn convert_uint_rtn(uint); uint __ovld __cnfn convert_uint_sat_rtn(uint); uint __ovld __cnfn convert_uint(uint); uint __ovld __cnfn convert_uint_sat(uint); uint __ovld __cnfn convert_uint_rte(long); uint __ovld __cnfn convert_uint_sat_rte(long); uint __ovld __cnfn convert_uint_rtz(long); uint __ovld __cnfn convert_uint_sat_rtz(long); uint __ovld __cnfn convert_uint_rtp(long); uint __ovld __cnfn convert_uint_sat_rtp(long); uint __ovld __cnfn convert_uint_rtn(long); uint __ovld __cnfn convert_uint_sat_rtn(long); uint __ovld __cnfn convert_uint(long); uint __ovld __cnfn convert_uint_sat(long); uint __ovld __cnfn convert_uint_rte(ulong); uint __ovld __cnfn convert_uint_sat_rte(ulong); uint __ovld __cnfn convert_uint_rtz(ulong); uint __ovld __cnfn convert_uint_sat_rtz(ulong); uint __ovld __cnfn convert_uint_rtp(ulong); uint __ovld __cnfn convert_uint_sat_rtp(ulong); uint __ovld __cnfn convert_uint_rtn(ulong); uint __ovld __cnfn convert_uint_sat_rtn(ulong); uint __ovld __cnfn convert_uint(ulong); uint __ovld __cnfn convert_uint_sat(ulong); uint __ovld __cnfn convert_uint_rte(float); uint __ovld __cnfn convert_uint_sat_rte(float); uint __ovld __cnfn convert_uint_rtz(float); uint __ovld __cnfn convert_uint_sat_rtz(float); uint __ovld __cnfn convert_uint_rtp(float); uint __ovld __cnfn convert_uint_sat_rtp(float); uint __ovld __cnfn convert_uint_rtn(float); uint __ovld __cnfn convert_uint_sat_rtn(float); uint __ovld __cnfn convert_uint(float); uint __ovld __cnfn convert_uint_sat(float); long __ovld __cnfn convert_long_rte(char); long __ovld __cnfn convert_long_sat_rte(char); long __ovld __cnfn convert_long_rtz(char); long __ovld __cnfn convert_long_sat_rtz(char); long __ovld __cnfn convert_long_rtp(char); long __ovld __cnfn convert_long_sat_rtp(char); long __ovld __cnfn convert_long_rtn(char); long __ovld __cnfn convert_long_sat_rtn(char); long __ovld __cnfn convert_long(char); long __ovld __cnfn convert_long_sat(char); long __ovld __cnfn convert_long_rte(uchar); long __ovld __cnfn convert_long_sat_rte(uchar); long __ovld __cnfn convert_long_rtz(uchar); long __ovld __cnfn convert_long_sat_rtz(uchar); long __ovld __cnfn convert_long_rtp(uchar); long __ovld __cnfn convert_long_sat_rtp(uchar); long __ovld __cnfn convert_long_rtn(uchar); long __ovld __cnfn convert_long_sat_rtn(uchar); long __ovld __cnfn convert_long(uchar); long __ovld __cnfn convert_long_sat(uchar); long __ovld __cnfn convert_long_rte(short); long __ovld __cnfn convert_long_sat_rte(short); long __ovld __cnfn convert_long_rtz(short); long __ovld __cnfn convert_long_sat_rtz(short); long __ovld __cnfn convert_long_rtp(short); long __ovld __cnfn convert_long_sat_rtp(short); long __ovld __cnfn convert_long_rtn(short); long __ovld __cnfn convert_long_sat_rtn(short); long __ovld __cnfn convert_long(short); long __ovld __cnfn convert_long_sat(short); long __ovld __cnfn convert_long_rte(ushort); long __ovld __cnfn convert_long_sat_rte(ushort); long __ovld __cnfn convert_long_rtz(ushort); long __ovld __cnfn convert_long_sat_rtz(ushort); long __ovld __cnfn convert_long_rtp(ushort); long __ovld __cnfn convert_long_sat_rtp(ushort); long __ovld __cnfn convert_long_rtn(ushort); long __ovld __cnfn convert_long_sat_rtn(ushort); long __ovld __cnfn convert_long(ushort); long __ovld __cnfn convert_long_sat(ushort); long __ovld __cnfn convert_long_rte(int); long __ovld __cnfn convert_long_sat_rte(int); long __ovld __cnfn convert_long_rtz(int); long __ovld __cnfn convert_long_sat_rtz(int); long __ovld __cnfn convert_long_rtp(int); long __ovld __cnfn convert_long_sat_rtp(int); long __ovld __cnfn convert_long_rtn(int); long __ovld __cnfn convert_long_sat_rtn(int); long __ovld __cnfn convert_long(int); long __ovld __cnfn convert_long_sat(int); long __ovld __cnfn convert_long_rte(uint); long __ovld __cnfn convert_long_sat_rte(uint); long __ovld __cnfn convert_long_rtz(uint); long __ovld __cnfn convert_long_sat_rtz(uint); long __ovld __cnfn convert_long_rtp(uint); long __ovld __cnfn convert_long_sat_rtp(uint); long __ovld __cnfn convert_long_rtn(uint); long __ovld __cnfn convert_long_sat_rtn(uint); long __ovld __cnfn convert_long(uint); long __ovld __cnfn convert_long_sat(uint); long __ovld __cnfn convert_long_rte(long); long __ovld __cnfn convert_long_sat_rte(long); long __ovld __cnfn convert_long_rtz(long); long __ovld __cnfn convert_long_sat_rtz(long); long __ovld __cnfn convert_long_rtp(long); long __ovld __cnfn convert_long_sat_rtp(long); long __ovld __cnfn convert_long_rtn(long); long __ovld __cnfn convert_long_sat_rtn(long); long __ovld __cnfn convert_long(long); long __ovld __cnfn convert_long_sat(long); long __ovld __cnfn convert_long_rte(ulong); long __ovld __cnfn convert_long_sat_rte(ulong); long __ovld __cnfn convert_long_rtz(ulong); long __ovld __cnfn convert_long_sat_rtz(ulong); long __ovld __cnfn convert_long_rtp(ulong); long __ovld __cnfn convert_long_sat_rtp(ulong); long __ovld __cnfn convert_long_rtn(ulong); long __ovld __cnfn convert_long_sat_rtn(ulong); long __ovld __cnfn convert_long(ulong); long __ovld __cnfn convert_long_sat(ulong); long __ovld __cnfn convert_long_rte(float); long __ovld __cnfn convert_long_sat_rte(float); long __ovld __cnfn convert_long_rtz(float); long __ovld __cnfn convert_long_sat_rtz(float); long __ovld __cnfn convert_long_rtp(float); long __ovld __cnfn convert_long_sat_rtp(float); long __ovld __cnfn convert_long_rtn(float); long __ovld __cnfn convert_long_sat_rtn(float); long __ovld __cnfn convert_long(float); long __ovld __cnfn convert_long_sat(float); ulong __ovld __cnfn convert_ulong_rte(char); ulong __ovld __cnfn convert_ulong_sat_rte(char); ulong __ovld __cnfn convert_ulong_rtz(char); ulong __ovld __cnfn convert_ulong_sat_rtz(char); ulong __ovld __cnfn convert_ulong_rtp(char); ulong __ovld __cnfn convert_ulong_sat_rtp(char); ulong __ovld __cnfn convert_ulong_rtn(char); ulong __ovld __cnfn convert_ulong_sat_rtn(char); ulong __ovld __cnfn convert_ulong(char); ulong __ovld __cnfn convert_ulong_sat(char); ulong __ovld __cnfn convert_ulong_rte(uchar); ulong __ovld __cnfn convert_ulong_sat_rte(uchar); ulong __ovld __cnfn convert_ulong_rtz(uchar); ulong __ovld __cnfn convert_ulong_sat_rtz(uchar); ulong __ovld __cnfn convert_ulong_rtp(uchar); ulong __ovld __cnfn convert_ulong_sat_rtp(uchar); ulong __ovld __cnfn convert_ulong_rtn(uchar); ulong __ovld __cnfn convert_ulong_sat_rtn(uchar); ulong __ovld __cnfn convert_ulong(uchar); ulong __ovld __cnfn convert_ulong_sat(uchar); ulong __ovld __cnfn convert_ulong_rte(short); ulong __ovld __cnfn convert_ulong_sat_rte(short); ulong __ovld __cnfn convert_ulong_rtz(short); ulong __ovld __cnfn convert_ulong_sat_rtz(short); ulong __ovld __cnfn convert_ulong_rtp(short); ulong __ovld __cnfn convert_ulong_sat_rtp(short); ulong __ovld __cnfn convert_ulong_rtn(short); ulong __ovld __cnfn convert_ulong_sat_rtn(short); ulong __ovld __cnfn convert_ulong(short); ulong __ovld __cnfn convert_ulong_sat(short); ulong __ovld __cnfn convert_ulong_rte(ushort); ulong __ovld __cnfn convert_ulong_sat_rte(ushort); ulong __ovld __cnfn convert_ulong_rtz(ushort); ulong __ovld __cnfn convert_ulong_sat_rtz(ushort); ulong __ovld __cnfn convert_ulong_rtp(ushort); ulong __ovld __cnfn convert_ulong_sat_rtp(ushort); ulong __ovld __cnfn convert_ulong_rtn(ushort); ulong __ovld __cnfn convert_ulong_sat_rtn(ushort); ulong __ovld __cnfn convert_ulong(ushort); ulong __ovld __cnfn convert_ulong_sat(ushort); ulong __ovld __cnfn convert_ulong_rte(int); ulong __ovld __cnfn convert_ulong_sat_rte(int); ulong __ovld __cnfn convert_ulong_rtz(int); ulong __ovld __cnfn convert_ulong_sat_rtz(int); ulong __ovld __cnfn convert_ulong_rtp(int); ulong __ovld __cnfn convert_ulong_sat_rtp(int); ulong __ovld __cnfn convert_ulong_rtn(int); ulong __ovld __cnfn convert_ulong_sat_rtn(int); ulong __ovld __cnfn convert_ulong(int); ulong __ovld __cnfn convert_ulong_sat(int); ulong __ovld __cnfn convert_ulong_rte(uint); ulong __ovld __cnfn convert_ulong_sat_rte(uint); ulong __ovld __cnfn convert_ulong_rtz(uint); ulong __ovld __cnfn convert_ulong_sat_rtz(uint); ulong __ovld __cnfn convert_ulong_rtp(uint); ulong __ovld __cnfn convert_ulong_sat_rtp(uint); ulong __ovld __cnfn convert_ulong_rtn(uint); ulong __ovld __cnfn convert_ulong_sat_rtn(uint); ulong __ovld __cnfn convert_ulong(uint); ulong __ovld __cnfn convert_ulong_sat(uint); ulong __ovld __cnfn convert_ulong_rte(long); ulong __ovld __cnfn convert_ulong_sat_rte(long); ulong __ovld __cnfn convert_ulong_rtz(long); ulong __ovld __cnfn convert_ulong_sat_rtz(long); ulong __ovld __cnfn convert_ulong_rtp(long); ulong __ovld __cnfn convert_ulong_sat_rtp(long); ulong __ovld __cnfn convert_ulong_rtn(long); ulong __ovld __cnfn convert_ulong_sat_rtn(long); ulong __ovld __cnfn convert_ulong(long); ulong __ovld __cnfn convert_ulong_sat(long); ulong __ovld __cnfn convert_ulong_rte(ulong); ulong __ovld __cnfn convert_ulong_sat_rte(ulong); ulong __ovld __cnfn convert_ulong_rtz(ulong); ulong __ovld __cnfn convert_ulong_sat_rtz(ulong); ulong __ovld __cnfn convert_ulong_rtp(ulong); ulong __ovld __cnfn convert_ulong_sat_rtp(ulong); ulong __ovld __cnfn convert_ulong_rtn(ulong); ulong __ovld __cnfn convert_ulong_sat_rtn(ulong); ulong __ovld __cnfn convert_ulong(ulong); ulong __ovld __cnfn convert_ulong_sat(ulong); ulong __ovld __cnfn convert_ulong_rte(float); ulong __ovld __cnfn convert_ulong_sat_rte(float); ulong __ovld __cnfn convert_ulong_rtz(float); ulong __ovld __cnfn convert_ulong_sat_rtz(float); ulong __ovld __cnfn convert_ulong_rtp(float); ulong __ovld __cnfn convert_ulong_sat_rtp(float); ulong __ovld __cnfn convert_ulong_rtn(float); ulong __ovld __cnfn convert_ulong_sat_rtn(float); ulong __ovld __cnfn convert_ulong(float); ulong __ovld __cnfn convert_ulong_sat(float); float __ovld __cnfn convert_float_rte(char); float __ovld __cnfn convert_float_rtz(char); float __ovld __cnfn convert_float_rtp(char); float __ovld __cnfn convert_float_rtn(char); float __ovld __cnfn convert_float(char); float __ovld __cnfn convert_float_rte(uchar); float __ovld __cnfn convert_float_rtz(uchar); float __ovld __cnfn convert_float_rtp(uchar); float __ovld __cnfn convert_float_rtn(uchar); float __ovld __cnfn convert_float(uchar); float __ovld __cnfn convert_float_rte(short); float __ovld __cnfn convert_float_rtz(short); float __ovld __cnfn convert_float_rtp(short); float __ovld __cnfn convert_float_rtn(short); float __ovld __cnfn convert_float(short); float __ovld __cnfn convert_float_rte(ushort); float __ovld __cnfn convert_float_rtz(ushort); float __ovld __cnfn convert_float_rtp(ushort); float __ovld __cnfn convert_float_rtn(ushort); float __ovld __cnfn convert_float(ushort); float __ovld __cnfn convert_float_rte(int); float __ovld __cnfn convert_float_rtz(int); float __ovld __cnfn convert_float_rtp(int); float __ovld __cnfn convert_float_rtn(int); float __ovld __cnfn convert_float(int); float __ovld __cnfn convert_float_rte(uint); float __ovld __cnfn convert_float_rtz(uint); float __ovld __cnfn convert_float_rtp(uint); float __ovld __cnfn convert_float_rtn(uint); float __ovld __cnfn convert_float(uint); float __ovld __cnfn convert_float_rte(long); float __ovld __cnfn convert_float_rtz(long); float __ovld __cnfn convert_float_rtp(long); float __ovld __cnfn convert_float_rtn(long); float __ovld __cnfn convert_float(long); float __ovld __cnfn convert_float_rte(ulong); float __ovld __cnfn convert_float_rtz(ulong); float __ovld __cnfn convert_float_rtp(ulong); float __ovld __cnfn convert_float_rtn(ulong); float __ovld __cnfn convert_float(ulong); float __ovld __cnfn convert_float_rte(float); float __ovld __cnfn convert_float_rtz(float); float __ovld __cnfn convert_float_rtp(float); float __ovld __cnfn convert_float_rtn(float); float __ovld __cnfn convert_float(float); char2 __ovld __cnfn convert_char2_rte(char2); char2 __ovld __cnfn convert_char2_sat_rte(char2); char2 __ovld __cnfn convert_char2_rtz(char2); char2 __ovld __cnfn convert_char2_sat_rtz(char2); char2 __ovld __cnfn convert_char2_rtp(char2); char2 __ovld __cnfn convert_char2_sat_rtp(char2); char2 __ovld __cnfn convert_char2_rtn(char2); char2 __ovld __cnfn convert_char2_sat_rtn(char2); char2 __ovld __cnfn convert_char2(char2); char2 __ovld __cnfn convert_char2_sat(char2); char2 __ovld __cnfn convert_char2_rte(uchar2); char2 __ovld __cnfn convert_char2_sat_rte(uchar2); char2 __ovld __cnfn convert_char2_rtz(uchar2); char2 __ovld __cnfn convert_char2_sat_rtz(uchar2); char2 __ovld __cnfn convert_char2_rtp(uchar2); char2 __ovld __cnfn convert_char2_sat_rtp(uchar2); char2 __ovld __cnfn convert_char2_rtn(uchar2); char2 __ovld __cnfn convert_char2_sat_rtn(uchar2); char2 __ovld __cnfn convert_char2(uchar2); char2 __ovld __cnfn convert_char2_sat(uchar2); char2 __ovld __cnfn convert_char2_rte(short2); char2 __ovld __cnfn convert_char2_sat_rte(short2); char2 __ovld __cnfn convert_char2_rtz(short2); char2 __ovld __cnfn convert_char2_sat_rtz(short2); char2 __ovld __cnfn convert_char2_rtp(short2); char2 __ovld __cnfn convert_char2_sat_rtp(short2); char2 __ovld __cnfn convert_char2_rtn(short2); char2 __ovld __cnfn convert_char2_sat_rtn(short2); char2 __ovld __cnfn convert_char2(short2); char2 __ovld __cnfn convert_char2_sat(short2); char2 __ovld __cnfn convert_char2_rte(ushort2); char2 __ovld __cnfn convert_char2_sat_rte(ushort2); char2 __ovld __cnfn convert_char2_rtz(ushort2); char2 __ovld __cnfn convert_char2_sat_rtz(ushort2); char2 __ovld __cnfn convert_char2_rtp(ushort2); char2 __ovld __cnfn convert_char2_sat_rtp(ushort2); char2 __ovld __cnfn convert_char2_rtn(ushort2); char2 __ovld __cnfn convert_char2_sat_rtn(ushort2); char2 __ovld __cnfn convert_char2(ushort2); char2 __ovld __cnfn convert_char2_sat(ushort2); char2 __ovld __cnfn convert_char2_rte(int2); char2 __ovld __cnfn convert_char2_sat_rte(int2); char2 __ovld __cnfn convert_char2_rtz(int2); char2 __ovld __cnfn convert_char2_sat_rtz(int2); char2 __ovld __cnfn convert_char2_rtp(int2); char2 __ovld __cnfn convert_char2_sat_rtp(int2); char2 __ovld __cnfn convert_char2_rtn(int2); char2 __ovld __cnfn convert_char2_sat_rtn(int2); char2 __ovld __cnfn convert_char2(int2); char2 __ovld __cnfn convert_char2_sat(int2); char2 __ovld __cnfn convert_char2_rte(uint2); char2 __ovld __cnfn convert_char2_sat_rte(uint2); char2 __ovld __cnfn convert_char2_rtz(uint2); char2 __ovld __cnfn convert_char2_sat_rtz(uint2); char2 __ovld __cnfn convert_char2_rtp(uint2); char2 __ovld __cnfn convert_char2_sat_rtp(uint2); char2 __ovld __cnfn convert_char2_rtn(uint2); char2 __ovld __cnfn convert_char2_sat_rtn(uint2); char2 __ovld __cnfn convert_char2(uint2); char2 __ovld __cnfn convert_char2_sat(uint2); char2 __ovld __cnfn convert_char2_rte(long2); char2 __ovld __cnfn convert_char2_sat_rte(long2); char2 __ovld __cnfn convert_char2_rtz(long2); char2 __ovld __cnfn convert_char2_sat_rtz(long2); char2 __ovld __cnfn convert_char2_rtp(long2); char2 __ovld __cnfn convert_char2_sat_rtp(long2); char2 __ovld __cnfn convert_char2_rtn(long2); char2 __ovld __cnfn convert_char2_sat_rtn(long2); char2 __ovld __cnfn convert_char2(long2); char2 __ovld __cnfn convert_char2_sat(long2); char2 __ovld __cnfn convert_char2_rte(ulong2); char2 __ovld __cnfn convert_char2_sat_rte(ulong2); char2 __ovld __cnfn convert_char2_rtz(ulong2); char2 __ovld __cnfn convert_char2_sat_rtz(ulong2); char2 __ovld __cnfn convert_char2_rtp(ulong2); char2 __ovld __cnfn convert_char2_sat_rtp(ulong2); char2 __ovld __cnfn convert_char2_rtn(ulong2); char2 __ovld __cnfn convert_char2_sat_rtn(ulong2); char2 __ovld __cnfn convert_char2(ulong2); char2 __ovld __cnfn convert_char2_sat(ulong2); char2 __ovld __cnfn convert_char2_rte(float2); char2 __ovld __cnfn convert_char2_sat_rte(float2); char2 __ovld __cnfn convert_char2_rtz(float2); char2 __ovld __cnfn convert_char2_sat_rtz(float2); char2 __ovld __cnfn convert_char2_rtp(float2); char2 __ovld __cnfn convert_char2_sat_rtp(float2); char2 __ovld __cnfn convert_char2_rtn(float2); char2 __ovld __cnfn convert_char2_sat_rtn(float2); char2 __ovld __cnfn convert_char2(float2); char2 __ovld __cnfn convert_char2_sat(float2); uchar2 __ovld __cnfn convert_uchar2_rte(char2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(char2); uchar2 __ovld __cnfn convert_uchar2_rtz(char2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(char2); uchar2 __ovld __cnfn convert_uchar2_rtp(char2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(char2); uchar2 __ovld __cnfn convert_uchar2_rtn(char2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(char2); uchar2 __ovld __cnfn convert_uchar2(char2); uchar2 __ovld __cnfn convert_uchar2_sat(char2); uchar2 __ovld __cnfn convert_uchar2_rte(uchar2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(uchar2); uchar2 __ovld __cnfn convert_uchar2_rtz(uchar2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(uchar2); uchar2 __ovld __cnfn convert_uchar2_rtp(uchar2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(uchar2); uchar2 __ovld __cnfn convert_uchar2_rtn(uchar2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(uchar2); uchar2 __ovld __cnfn convert_uchar2(uchar2); uchar2 __ovld __cnfn convert_uchar2_sat(uchar2); uchar2 __ovld __cnfn convert_uchar2_rte(short2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(short2); uchar2 __ovld __cnfn convert_uchar2_rtz(short2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(short2); uchar2 __ovld __cnfn convert_uchar2_rtp(short2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(short2); uchar2 __ovld __cnfn convert_uchar2_rtn(short2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(short2); uchar2 __ovld __cnfn convert_uchar2(short2); uchar2 __ovld __cnfn convert_uchar2_sat(short2); uchar2 __ovld __cnfn convert_uchar2_rte(ushort2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(ushort2); uchar2 __ovld __cnfn convert_uchar2_rtz(ushort2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(ushort2); uchar2 __ovld __cnfn convert_uchar2_rtp(ushort2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(ushort2); uchar2 __ovld __cnfn convert_uchar2_rtn(ushort2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(ushort2); uchar2 __ovld __cnfn convert_uchar2(ushort2); uchar2 __ovld __cnfn convert_uchar2_sat(ushort2); uchar2 __ovld __cnfn convert_uchar2_rte(int2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(int2); uchar2 __ovld __cnfn convert_uchar2_rtz(int2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(int2); uchar2 __ovld __cnfn convert_uchar2_rtp(int2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(int2); uchar2 __ovld __cnfn convert_uchar2_rtn(int2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(int2); uchar2 __ovld __cnfn convert_uchar2(int2); uchar2 __ovld __cnfn convert_uchar2_sat(int2); uchar2 __ovld __cnfn convert_uchar2_rte(uint2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(uint2); uchar2 __ovld __cnfn convert_uchar2_rtz(uint2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(uint2); uchar2 __ovld __cnfn convert_uchar2_rtp(uint2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(uint2); uchar2 __ovld __cnfn convert_uchar2_rtn(uint2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(uint2); uchar2 __ovld __cnfn convert_uchar2(uint2); uchar2 __ovld __cnfn convert_uchar2_sat(uint2); uchar2 __ovld __cnfn convert_uchar2_rte(long2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(long2); uchar2 __ovld __cnfn convert_uchar2_rtz(long2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(long2); uchar2 __ovld __cnfn convert_uchar2_rtp(long2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(long2); uchar2 __ovld __cnfn convert_uchar2_rtn(long2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(long2); uchar2 __ovld __cnfn convert_uchar2(long2); uchar2 __ovld __cnfn convert_uchar2_sat(long2); uchar2 __ovld __cnfn convert_uchar2_rte(ulong2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(ulong2); uchar2 __ovld __cnfn convert_uchar2_rtz(ulong2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(ulong2); uchar2 __ovld __cnfn convert_uchar2_rtp(ulong2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(ulong2); uchar2 __ovld __cnfn convert_uchar2_rtn(ulong2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(ulong2); uchar2 __ovld __cnfn convert_uchar2(ulong2); uchar2 __ovld __cnfn convert_uchar2_sat(ulong2); uchar2 __ovld __cnfn convert_uchar2_rte(float2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(float2); uchar2 __ovld __cnfn convert_uchar2_rtz(float2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(float2); uchar2 __ovld __cnfn convert_uchar2_rtp(float2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(float2); uchar2 __ovld __cnfn convert_uchar2_rtn(float2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(float2); uchar2 __ovld __cnfn convert_uchar2(float2); uchar2 __ovld __cnfn convert_uchar2_sat(float2); short2 __ovld __cnfn convert_short2_rte(char2); short2 __ovld __cnfn convert_short2_sat_rte(char2); short2 __ovld __cnfn convert_short2_rtz(char2); short2 __ovld __cnfn convert_short2_sat_rtz(char2); short2 __ovld __cnfn convert_short2_rtp(char2); short2 __ovld __cnfn convert_short2_sat_rtp(char2); short2 __ovld __cnfn convert_short2_rtn(char2); short2 __ovld __cnfn convert_short2_sat_rtn(char2); short2 __ovld __cnfn convert_short2(char2); short2 __ovld __cnfn convert_short2_sat(char2); short2 __ovld __cnfn convert_short2_rte(uchar2); short2 __ovld __cnfn convert_short2_sat_rte(uchar2); short2 __ovld __cnfn convert_short2_rtz(uchar2); short2 __ovld __cnfn convert_short2_sat_rtz(uchar2); short2 __ovld __cnfn convert_short2_rtp(uchar2); short2 __ovld __cnfn convert_short2_sat_rtp(uchar2); short2 __ovld __cnfn convert_short2_rtn(uchar2); short2 __ovld __cnfn convert_short2_sat_rtn(uchar2); short2 __ovld __cnfn convert_short2(uchar2); short2 __ovld __cnfn convert_short2_sat(uchar2); short2 __ovld __cnfn convert_short2_rte(short2); short2 __ovld __cnfn convert_short2_sat_rte(short2); short2 __ovld __cnfn convert_short2_rtz(short2); short2 __ovld __cnfn convert_short2_sat_rtz(short2); short2 __ovld __cnfn convert_short2_rtp(short2); short2 __ovld __cnfn convert_short2_sat_rtp(short2); short2 __ovld __cnfn convert_short2_rtn(short2); short2 __ovld __cnfn convert_short2_sat_rtn(short2); short2 __ovld __cnfn convert_short2(short2); short2 __ovld __cnfn convert_short2_sat(short2); short2 __ovld __cnfn convert_short2_rte(ushort2); short2 __ovld __cnfn convert_short2_sat_rte(ushort2); short2 __ovld __cnfn convert_short2_rtz(ushort2); short2 __ovld __cnfn convert_short2_sat_rtz(ushort2); short2 __ovld __cnfn convert_short2_rtp(ushort2); short2 __ovld __cnfn convert_short2_sat_rtp(ushort2); short2 __ovld __cnfn convert_short2_rtn(ushort2); short2 __ovld __cnfn convert_short2_sat_rtn(ushort2); short2 __ovld __cnfn convert_short2(ushort2); short2 __ovld __cnfn convert_short2_sat(ushort2); short2 __ovld __cnfn convert_short2_rte(int2); short2 __ovld __cnfn convert_short2_sat_rte(int2); short2 __ovld __cnfn convert_short2_rtz(int2); short2 __ovld __cnfn convert_short2_sat_rtz(int2); short2 __ovld __cnfn convert_short2_rtp(int2); short2 __ovld __cnfn convert_short2_sat_rtp(int2); short2 __ovld __cnfn convert_short2_rtn(int2); short2 __ovld __cnfn convert_short2_sat_rtn(int2); short2 __ovld __cnfn convert_short2(int2); short2 __ovld __cnfn convert_short2_sat(int2); short2 __ovld __cnfn convert_short2_rte(uint2); short2 __ovld __cnfn convert_short2_sat_rte(uint2); short2 __ovld __cnfn convert_short2_rtz(uint2); short2 __ovld __cnfn convert_short2_sat_rtz(uint2); short2 __ovld __cnfn convert_short2_rtp(uint2); short2 __ovld __cnfn convert_short2_sat_rtp(uint2); short2 __ovld __cnfn convert_short2_rtn(uint2); short2 __ovld __cnfn convert_short2_sat_rtn(uint2); short2 __ovld __cnfn convert_short2(uint2); short2 __ovld __cnfn convert_short2_sat(uint2); short2 __ovld __cnfn convert_short2_rte(long2); short2 __ovld __cnfn convert_short2_sat_rte(long2); short2 __ovld __cnfn convert_short2_rtz(long2); short2 __ovld __cnfn convert_short2_sat_rtz(long2); short2 __ovld __cnfn convert_short2_rtp(long2); short2 __ovld __cnfn convert_short2_sat_rtp(long2); short2 __ovld __cnfn convert_short2_rtn(long2); short2 __ovld __cnfn convert_short2_sat_rtn(long2); short2 __ovld __cnfn convert_short2(long2); short2 __ovld __cnfn convert_short2_sat(long2); short2 __ovld __cnfn convert_short2_rte(ulong2); short2 __ovld __cnfn convert_short2_sat_rte(ulong2); short2 __ovld __cnfn convert_short2_rtz(ulong2); short2 __ovld __cnfn convert_short2_sat_rtz(ulong2); short2 __ovld __cnfn convert_short2_rtp(ulong2); short2 __ovld __cnfn convert_short2_sat_rtp(ulong2); short2 __ovld __cnfn convert_short2_rtn(ulong2); short2 __ovld __cnfn convert_short2_sat_rtn(ulong2); short2 __ovld __cnfn convert_short2(ulong2); short2 __ovld __cnfn convert_short2_sat(ulong2); short2 __ovld __cnfn convert_short2_rte(float2); short2 __ovld __cnfn convert_short2_sat_rte(float2); short2 __ovld __cnfn convert_short2_rtz(float2); short2 __ovld __cnfn convert_short2_sat_rtz(float2); short2 __ovld __cnfn convert_short2_rtp(float2); short2 __ovld __cnfn convert_short2_sat_rtp(float2); short2 __ovld __cnfn convert_short2_rtn(float2); short2 __ovld __cnfn convert_short2_sat_rtn(float2); short2 __ovld __cnfn convert_short2(float2); short2 __ovld __cnfn convert_short2_sat(float2); ushort2 __ovld __cnfn convert_ushort2_rte(char2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(char2); ushort2 __ovld __cnfn convert_ushort2_rtz(char2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(char2); ushort2 __ovld __cnfn convert_ushort2_rtp(char2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(char2); ushort2 __ovld __cnfn convert_ushort2_rtn(char2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(char2); ushort2 __ovld __cnfn convert_ushort2(char2); ushort2 __ovld __cnfn convert_ushort2_sat(char2); ushort2 __ovld __cnfn convert_ushort2_rte(uchar2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(uchar2); ushort2 __ovld __cnfn convert_ushort2_rtz(uchar2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(uchar2); ushort2 __ovld __cnfn convert_ushort2_rtp(uchar2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(uchar2); ushort2 __ovld __cnfn convert_ushort2_rtn(uchar2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(uchar2); ushort2 __ovld __cnfn convert_ushort2(uchar2); ushort2 __ovld __cnfn convert_ushort2_sat(uchar2); ushort2 __ovld __cnfn convert_ushort2_rte(short2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(short2); ushort2 __ovld __cnfn convert_ushort2_rtz(short2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(short2); ushort2 __ovld __cnfn convert_ushort2_rtp(short2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(short2); ushort2 __ovld __cnfn convert_ushort2_rtn(short2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(short2); ushort2 __ovld __cnfn convert_ushort2(short2); ushort2 __ovld __cnfn convert_ushort2_sat(short2); ushort2 __ovld __cnfn convert_ushort2_rte(ushort2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(ushort2); ushort2 __ovld __cnfn convert_ushort2_rtz(ushort2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(ushort2); ushort2 __ovld __cnfn convert_ushort2_rtp(ushort2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(ushort2); ushort2 __ovld __cnfn convert_ushort2_rtn(ushort2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(ushort2); ushort2 __ovld __cnfn convert_ushort2(ushort2); ushort2 __ovld __cnfn convert_ushort2_sat(ushort2); ushort2 __ovld __cnfn convert_ushort2_rte(int2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(int2); ushort2 __ovld __cnfn convert_ushort2_rtz(int2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(int2); ushort2 __ovld __cnfn convert_ushort2_rtp(int2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(int2); ushort2 __ovld __cnfn convert_ushort2_rtn(int2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(int2); ushort2 __ovld __cnfn convert_ushort2(int2); ushort2 __ovld __cnfn convert_ushort2_sat(int2); ushort2 __ovld __cnfn convert_ushort2_rte(uint2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(uint2); ushort2 __ovld __cnfn convert_ushort2_rtz(uint2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(uint2); ushort2 __ovld __cnfn convert_ushort2_rtp(uint2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(uint2); ushort2 __ovld __cnfn convert_ushort2_rtn(uint2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(uint2); ushort2 __ovld __cnfn convert_ushort2(uint2); ushort2 __ovld __cnfn convert_ushort2_sat(uint2); ushort2 __ovld __cnfn convert_ushort2_rte(long2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(long2); ushort2 __ovld __cnfn convert_ushort2_rtz(long2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(long2); ushort2 __ovld __cnfn convert_ushort2_rtp(long2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(long2); ushort2 __ovld __cnfn convert_ushort2_rtn(long2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(long2); ushort2 __ovld __cnfn convert_ushort2(long2); ushort2 __ovld __cnfn convert_ushort2_sat(long2); ushort2 __ovld __cnfn convert_ushort2_rte(ulong2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(ulong2); ushort2 __ovld __cnfn convert_ushort2_rtz(ulong2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(ulong2); ushort2 __ovld __cnfn convert_ushort2_rtp(ulong2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(ulong2); ushort2 __ovld __cnfn convert_ushort2_rtn(ulong2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(ulong2); ushort2 __ovld __cnfn convert_ushort2(ulong2); ushort2 __ovld __cnfn convert_ushort2_sat(ulong2); ushort2 __ovld __cnfn convert_ushort2_rte(float2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(float2); ushort2 __ovld __cnfn convert_ushort2_rtz(float2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(float2); ushort2 __ovld __cnfn convert_ushort2_rtp(float2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(float2); ushort2 __ovld __cnfn convert_ushort2_rtn(float2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(float2); ushort2 __ovld __cnfn convert_ushort2(float2); ushort2 __ovld __cnfn convert_ushort2_sat(float2); int2 __ovld __cnfn convert_int2_rte(char2); int2 __ovld __cnfn convert_int2_sat_rte(char2); int2 __ovld __cnfn convert_int2_rtz(char2); int2 __ovld __cnfn convert_int2_sat_rtz(char2); int2 __ovld __cnfn convert_int2_rtp(char2); int2 __ovld __cnfn convert_int2_sat_rtp(char2); int2 __ovld __cnfn convert_int2_rtn(char2); int2 __ovld __cnfn convert_int2_sat_rtn(char2); int2 __ovld __cnfn convert_int2(char2); int2 __ovld __cnfn convert_int2_sat(char2); int2 __ovld __cnfn convert_int2_rte(uchar2); int2 __ovld __cnfn convert_int2_sat_rte(uchar2); int2 __ovld __cnfn convert_int2_rtz(uchar2); int2 __ovld __cnfn convert_int2_sat_rtz(uchar2); int2 __ovld __cnfn convert_int2_rtp(uchar2); int2 __ovld __cnfn convert_int2_sat_rtp(uchar2); int2 __ovld __cnfn convert_int2_rtn(uchar2); int2 __ovld __cnfn convert_int2_sat_rtn(uchar2); int2 __ovld __cnfn convert_int2(uchar2); int2 __ovld __cnfn convert_int2_sat(uchar2); int2 __ovld __cnfn convert_int2_rte(short2); int2 __ovld __cnfn convert_int2_sat_rte(short2); int2 __ovld __cnfn convert_int2_rtz(short2); int2 __ovld __cnfn convert_int2_sat_rtz(short2); int2 __ovld __cnfn convert_int2_rtp(short2); int2 __ovld __cnfn convert_int2_sat_rtp(short2); int2 __ovld __cnfn convert_int2_rtn(short2); int2 __ovld __cnfn convert_int2_sat_rtn(short2); int2 __ovld __cnfn convert_int2(short2); int2 __ovld __cnfn convert_int2_sat(short2); int2 __ovld __cnfn convert_int2_rte(ushort2); int2 __ovld __cnfn convert_int2_sat_rte(ushort2); int2 __ovld __cnfn convert_int2_rtz(ushort2); int2 __ovld __cnfn convert_int2_sat_rtz(ushort2); int2 __ovld __cnfn convert_int2_rtp(ushort2); int2 __ovld __cnfn convert_int2_sat_rtp(ushort2); int2 __ovld __cnfn convert_int2_rtn(ushort2); int2 __ovld __cnfn convert_int2_sat_rtn(ushort2); int2 __ovld __cnfn convert_int2(ushort2); int2 __ovld __cnfn convert_int2_sat(ushort2); int2 __ovld __cnfn convert_int2_rte(int2); int2 __ovld __cnfn convert_int2_sat_rte(int2); int2 __ovld __cnfn convert_int2_rtz(int2); int2 __ovld __cnfn convert_int2_sat_rtz(int2); int2 __ovld __cnfn convert_int2_rtp(int2); int2 __ovld __cnfn convert_int2_sat_rtp(int2); int2 __ovld __cnfn convert_int2_rtn(int2); int2 __ovld __cnfn convert_int2_sat_rtn(int2); int2 __ovld __cnfn convert_int2(int2); int2 __ovld __cnfn convert_int2_sat(int2); int2 __ovld __cnfn convert_int2_rte(uint2); int2 __ovld __cnfn convert_int2_sat_rte(uint2); int2 __ovld __cnfn convert_int2_rtz(uint2); int2 __ovld __cnfn convert_int2_sat_rtz(uint2); int2 __ovld __cnfn convert_int2_rtp(uint2); int2 __ovld __cnfn convert_int2_sat_rtp(uint2); int2 __ovld __cnfn convert_int2_rtn(uint2); int2 __ovld __cnfn convert_int2_sat_rtn(uint2); int2 __ovld __cnfn convert_int2(uint2); int2 __ovld __cnfn convert_int2_sat(uint2); int2 __ovld __cnfn convert_int2_rte(long2); int2 __ovld __cnfn convert_int2_sat_rte(long2); int2 __ovld __cnfn convert_int2_rtz(long2); int2 __ovld __cnfn convert_int2_sat_rtz(long2); int2 __ovld __cnfn convert_int2_rtp(long2); int2 __ovld __cnfn convert_int2_sat_rtp(long2); int2 __ovld __cnfn convert_int2_rtn(long2); int2 __ovld __cnfn convert_int2_sat_rtn(long2); int2 __ovld __cnfn convert_int2(long2); int2 __ovld __cnfn convert_int2_sat(long2); int2 __ovld __cnfn convert_int2_rte(ulong2); int2 __ovld __cnfn convert_int2_sat_rte(ulong2); int2 __ovld __cnfn convert_int2_rtz(ulong2); int2 __ovld __cnfn convert_int2_sat_rtz(ulong2); int2 __ovld __cnfn convert_int2_rtp(ulong2); int2 __ovld __cnfn convert_int2_sat_rtp(ulong2); int2 __ovld __cnfn convert_int2_rtn(ulong2); int2 __ovld __cnfn convert_int2_sat_rtn(ulong2); int2 __ovld __cnfn convert_int2(ulong2); int2 __ovld __cnfn convert_int2_sat(ulong2); int2 __ovld __cnfn convert_int2_rte(float2); int2 __ovld __cnfn convert_int2_sat_rte(float2); int2 __ovld __cnfn convert_int2_rtz(float2); int2 __ovld __cnfn convert_int2_sat_rtz(float2); int2 __ovld __cnfn convert_int2_rtp(float2); int2 __ovld __cnfn convert_int2_sat_rtp(float2); int2 __ovld __cnfn convert_int2_rtn(float2); int2 __ovld __cnfn convert_int2_sat_rtn(float2); int2 __ovld __cnfn convert_int2(float2); int2 __ovld __cnfn convert_int2_sat(float2); uint2 __ovld __cnfn convert_uint2_rte(char2); uint2 __ovld __cnfn convert_uint2_sat_rte(char2); uint2 __ovld __cnfn convert_uint2_rtz(char2); uint2 __ovld __cnfn convert_uint2_sat_rtz(char2); uint2 __ovld __cnfn convert_uint2_rtp(char2); uint2 __ovld __cnfn convert_uint2_sat_rtp(char2); uint2 __ovld __cnfn convert_uint2_rtn(char2); uint2 __ovld __cnfn convert_uint2_sat_rtn(char2); uint2 __ovld __cnfn convert_uint2(char2); uint2 __ovld __cnfn convert_uint2_sat(char2); uint2 __ovld __cnfn convert_uint2_rte(uchar2); uint2 __ovld __cnfn convert_uint2_sat_rte(uchar2); uint2 __ovld __cnfn convert_uint2_rtz(uchar2); uint2 __ovld __cnfn convert_uint2_sat_rtz(uchar2); uint2 __ovld __cnfn convert_uint2_rtp(uchar2); uint2 __ovld __cnfn convert_uint2_sat_rtp(uchar2); uint2 __ovld __cnfn convert_uint2_rtn(uchar2); uint2 __ovld __cnfn convert_uint2_sat_rtn(uchar2); uint2 __ovld __cnfn convert_uint2(uchar2); uint2 __ovld __cnfn convert_uint2_sat(uchar2); uint2 __ovld __cnfn convert_uint2_rte(short2); uint2 __ovld __cnfn convert_uint2_sat_rte(short2); uint2 __ovld __cnfn convert_uint2_rtz(short2); uint2 __ovld __cnfn convert_uint2_sat_rtz(short2); uint2 __ovld __cnfn convert_uint2_rtp(short2); uint2 __ovld __cnfn convert_uint2_sat_rtp(short2); uint2 __ovld __cnfn convert_uint2_rtn(short2); uint2 __ovld __cnfn convert_uint2_sat_rtn(short2); uint2 __ovld __cnfn convert_uint2(short2); uint2 __ovld __cnfn convert_uint2_sat(short2); uint2 __ovld __cnfn convert_uint2_rte(ushort2); uint2 __ovld __cnfn convert_uint2_sat_rte(ushort2); uint2 __ovld __cnfn convert_uint2_rtz(ushort2); uint2 __ovld __cnfn convert_uint2_sat_rtz(ushort2); uint2 __ovld __cnfn convert_uint2_rtp(ushort2); uint2 __ovld __cnfn convert_uint2_sat_rtp(ushort2); uint2 __ovld __cnfn convert_uint2_rtn(ushort2); uint2 __ovld __cnfn convert_uint2_sat_rtn(ushort2); uint2 __ovld __cnfn convert_uint2(ushort2); uint2 __ovld __cnfn convert_uint2_sat(ushort2); uint2 __ovld __cnfn convert_uint2_rte(int2); uint2 __ovld __cnfn convert_uint2_sat_rte(int2); uint2 __ovld __cnfn convert_uint2_rtz(int2); uint2 __ovld __cnfn convert_uint2_sat_rtz(int2); uint2 __ovld __cnfn convert_uint2_rtp(int2); uint2 __ovld __cnfn convert_uint2_sat_rtp(int2); uint2 __ovld __cnfn convert_uint2_rtn(int2); uint2 __ovld __cnfn convert_uint2_sat_rtn(int2); uint2 __ovld __cnfn convert_uint2(int2); uint2 __ovld __cnfn convert_uint2_sat(int2); uint2 __ovld __cnfn convert_uint2_rte(uint2); uint2 __ovld __cnfn convert_uint2_sat_rte(uint2); uint2 __ovld __cnfn convert_uint2_rtz(uint2); uint2 __ovld __cnfn convert_uint2_sat_rtz(uint2); uint2 __ovld __cnfn convert_uint2_rtp(uint2); uint2 __ovld __cnfn convert_uint2_sat_rtp(uint2); uint2 __ovld __cnfn convert_uint2_rtn(uint2); uint2 __ovld __cnfn convert_uint2_sat_rtn(uint2); uint2 __ovld __cnfn convert_uint2(uint2); uint2 __ovld __cnfn convert_uint2_sat(uint2); uint2 __ovld __cnfn convert_uint2_rte(long2); uint2 __ovld __cnfn convert_uint2_sat_rte(long2); uint2 __ovld __cnfn convert_uint2_rtz(long2); uint2 __ovld __cnfn convert_uint2_sat_rtz(long2); uint2 __ovld __cnfn convert_uint2_rtp(long2); uint2 __ovld __cnfn convert_uint2_sat_rtp(long2); uint2 __ovld __cnfn convert_uint2_rtn(long2); uint2 __ovld __cnfn convert_uint2_sat_rtn(long2); uint2 __ovld __cnfn convert_uint2(long2); uint2 __ovld __cnfn convert_uint2_sat(long2); uint2 __ovld __cnfn convert_uint2_rte(ulong2); uint2 __ovld __cnfn convert_uint2_sat_rte(ulong2); uint2 __ovld __cnfn convert_uint2_rtz(ulong2); uint2 __ovld __cnfn convert_uint2_sat_rtz(ulong2); uint2 __ovld __cnfn convert_uint2_rtp(ulong2); uint2 __ovld __cnfn convert_uint2_sat_rtp(ulong2); uint2 __ovld __cnfn convert_uint2_rtn(ulong2); uint2 __ovld __cnfn convert_uint2_sat_rtn(ulong2); uint2 __ovld __cnfn convert_uint2(ulong2); uint2 __ovld __cnfn convert_uint2_sat(ulong2); uint2 __ovld __cnfn convert_uint2_rte(float2); uint2 __ovld __cnfn convert_uint2_sat_rte(float2); uint2 __ovld __cnfn convert_uint2_rtz(float2); uint2 __ovld __cnfn convert_uint2_sat_rtz(float2); uint2 __ovld __cnfn convert_uint2_rtp(float2); uint2 __ovld __cnfn convert_uint2_sat_rtp(float2); uint2 __ovld __cnfn convert_uint2_rtn(float2); uint2 __ovld __cnfn convert_uint2_sat_rtn(float2); uint2 __ovld __cnfn convert_uint2(float2); uint2 __ovld __cnfn convert_uint2_sat(float2); long2 __ovld __cnfn convert_long2_rte(char2); long2 __ovld __cnfn convert_long2_sat_rte(char2); long2 __ovld __cnfn convert_long2_rtz(char2); long2 __ovld __cnfn convert_long2_sat_rtz(char2); long2 __ovld __cnfn convert_long2_rtp(char2); long2 __ovld __cnfn convert_long2_sat_rtp(char2); long2 __ovld __cnfn convert_long2_rtn(char2); long2 __ovld __cnfn convert_long2_sat_rtn(char2); long2 __ovld __cnfn convert_long2(char2); long2 __ovld __cnfn convert_long2_sat(char2); long2 __ovld __cnfn convert_long2_rte(uchar2); long2 __ovld __cnfn convert_long2_sat_rte(uchar2); long2 __ovld __cnfn convert_long2_rtz(uchar2); long2 __ovld __cnfn convert_long2_sat_rtz(uchar2); long2 __ovld __cnfn convert_long2_rtp(uchar2); long2 __ovld __cnfn convert_long2_sat_rtp(uchar2); long2 __ovld __cnfn convert_long2_rtn(uchar2); long2 __ovld __cnfn convert_long2_sat_rtn(uchar2); long2 __ovld __cnfn convert_long2(uchar2); long2 __ovld __cnfn convert_long2_sat(uchar2); long2 __ovld __cnfn convert_long2_rte(short2); long2 __ovld __cnfn convert_long2_sat_rte(short2); long2 __ovld __cnfn convert_long2_rtz(short2); long2 __ovld __cnfn convert_long2_sat_rtz(short2); long2 __ovld __cnfn convert_long2_rtp(short2); long2 __ovld __cnfn convert_long2_sat_rtp(short2); long2 __ovld __cnfn convert_long2_rtn(short2); long2 __ovld __cnfn convert_long2_sat_rtn(short2); long2 __ovld __cnfn convert_long2(short2); long2 __ovld __cnfn convert_long2_sat(short2); long2 __ovld __cnfn convert_long2_rte(ushort2); long2 __ovld __cnfn convert_long2_sat_rte(ushort2); long2 __ovld __cnfn convert_long2_rtz(ushort2); long2 __ovld __cnfn convert_long2_sat_rtz(ushort2); long2 __ovld __cnfn convert_long2_rtp(ushort2); long2 __ovld __cnfn convert_long2_sat_rtp(ushort2); long2 __ovld __cnfn convert_long2_rtn(ushort2); long2 __ovld __cnfn convert_long2_sat_rtn(ushort2); long2 __ovld __cnfn convert_long2(ushort2); long2 __ovld __cnfn convert_long2_sat(ushort2); long2 __ovld __cnfn convert_long2_rte(int2); long2 __ovld __cnfn convert_long2_sat_rte(int2); long2 __ovld __cnfn convert_long2_rtz(int2); long2 __ovld __cnfn convert_long2_sat_rtz(int2); long2 __ovld __cnfn convert_long2_rtp(int2); long2 __ovld __cnfn convert_long2_sat_rtp(int2); long2 __ovld __cnfn convert_long2_rtn(int2); long2 __ovld __cnfn convert_long2_sat_rtn(int2); long2 __ovld __cnfn convert_long2(int2); long2 __ovld __cnfn convert_long2_sat(int2); long2 __ovld __cnfn convert_long2_rte(uint2); long2 __ovld __cnfn convert_long2_sat_rte(uint2); long2 __ovld __cnfn convert_long2_rtz(uint2); long2 __ovld __cnfn convert_long2_sat_rtz(uint2); long2 __ovld __cnfn convert_long2_rtp(uint2); long2 __ovld __cnfn convert_long2_sat_rtp(uint2); long2 __ovld __cnfn convert_long2_rtn(uint2); long2 __ovld __cnfn convert_long2_sat_rtn(uint2); long2 __ovld __cnfn convert_long2(uint2); long2 __ovld __cnfn convert_long2_sat(uint2); long2 __ovld __cnfn convert_long2_rte(long2); long2 __ovld __cnfn convert_long2_sat_rte(long2); long2 __ovld __cnfn convert_long2_rtz(long2); long2 __ovld __cnfn convert_long2_sat_rtz(long2); long2 __ovld __cnfn convert_long2_rtp(long2); long2 __ovld __cnfn convert_long2_sat_rtp(long2); long2 __ovld __cnfn convert_long2_rtn(long2); long2 __ovld __cnfn convert_long2_sat_rtn(long2); long2 __ovld __cnfn convert_long2(long2); long2 __ovld __cnfn convert_long2_sat(long2); long2 __ovld __cnfn convert_long2_rte(ulong2); long2 __ovld __cnfn convert_long2_sat_rte(ulong2); long2 __ovld __cnfn convert_long2_rtz(ulong2); long2 __ovld __cnfn convert_long2_sat_rtz(ulong2); long2 __ovld __cnfn convert_long2_rtp(ulong2); long2 __ovld __cnfn convert_long2_sat_rtp(ulong2); long2 __ovld __cnfn convert_long2_rtn(ulong2); long2 __ovld __cnfn convert_long2_sat_rtn(ulong2); long2 __ovld __cnfn convert_long2(ulong2); long2 __ovld __cnfn convert_long2_sat(ulong2); long2 __ovld __cnfn convert_long2_rte(float2); long2 __ovld __cnfn convert_long2_sat_rte(float2); long2 __ovld __cnfn convert_long2_rtz(float2); long2 __ovld __cnfn convert_long2_sat_rtz(float2); long2 __ovld __cnfn convert_long2_rtp(float2); long2 __ovld __cnfn convert_long2_sat_rtp(float2); long2 __ovld __cnfn convert_long2_rtn(float2); long2 __ovld __cnfn convert_long2_sat_rtn(float2); long2 __ovld __cnfn convert_long2(float2); long2 __ovld __cnfn convert_long2_sat(float2); ulong2 __ovld __cnfn convert_ulong2_rte(char2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(char2); ulong2 __ovld __cnfn convert_ulong2_rtz(char2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(char2); ulong2 __ovld __cnfn convert_ulong2_rtp(char2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(char2); ulong2 __ovld __cnfn convert_ulong2_rtn(char2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(char2); ulong2 __ovld __cnfn convert_ulong2(char2); ulong2 __ovld __cnfn convert_ulong2_sat(char2); ulong2 __ovld __cnfn convert_ulong2_rte(uchar2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(uchar2); ulong2 __ovld __cnfn convert_ulong2_rtz(uchar2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(uchar2); ulong2 __ovld __cnfn convert_ulong2_rtp(uchar2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(uchar2); ulong2 __ovld __cnfn convert_ulong2_rtn(uchar2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(uchar2); ulong2 __ovld __cnfn convert_ulong2(uchar2); ulong2 __ovld __cnfn convert_ulong2_sat(uchar2); ulong2 __ovld __cnfn convert_ulong2_rte(short2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(short2); ulong2 __ovld __cnfn convert_ulong2_rtz(short2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(short2); ulong2 __ovld __cnfn convert_ulong2_rtp(short2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(short2); ulong2 __ovld __cnfn convert_ulong2_rtn(short2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(short2); ulong2 __ovld __cnfn convert_ulong2(short2); ulong2 __ovld __cnfn convert_ulong2_sat(short2); ulong2 __ovld __cnfn convert_ulong2_rte(ushort2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(ushort2); ulong2 __ovld __cnfn convert_ulong2_rtz(ushort2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(ushort2); ulong2 __ovld __cnfn convert_ulong2_rtp(ushort2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(ushort2); ulong2 __ovld __cnfn convert_ulong2_rtn(ushort2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(ushort2); ulong2 __ovld __cnfn convert_ulong2(ushort2); ulong2 __ovld __cnfn convert_ulong2_sat(ushort2); ulong2 __ovld __cnfn convert_ulong2_rte(int2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(int2); ulong2 __ovld __cnfn convert_ulong2_rtz(int2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(int2); ulong2 __ovld __cnfn convert_ulong2_rtp(int2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(int2); ulong2 __ovld __cnfn convert_ulong2_rtn(int2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(int2); ulong2 __ovld __cnfn convert_ulong2(int2); ulong2 __ovld __cnfn convert_ulong2_sat(int2); ulong2 __ovld __cnfn convert_ulong2_rte(uint2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(uint2); ulong2 __ovld __cnfn convert_ulong2_rtz(uint2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(uint2); ulong2 __ovld __cnfn convert_ulong2_rtp(uint2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(uint2); ulong2 __ovld __cnfn convert_ulong2_rtn(uint2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(uint2); ulong2 __ovld __cnfn convert_ulong2(uint2); ulong2 __ovld __cnfn convert_ulong2_sat(uint2); ulong2 __ovld __cnfn convert_ulong2_rte(long2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(long2); ulong2 __ovld __cnfn convert_ulong2_rtz(long2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(long2); ulong2 __ovld __cnfn convert_ulong2_rtp(long2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(long2); ulong2 __ovld __cnfn convert_ulong2_rtn(long2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(long2); ulong2 __ovld __cnfn convert_ulong2(long2); ulong2 __ovld __cnfn convert_ulong2_sat(long2); ulong2 __ovld __cnfn convert_ulong2_rte(ulong2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(ulong2); ulong2 __ovld __cnfn convert_ulong2_rtz(ulong2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(ulong2); ulong2 __ovld __cnfn convert_ulong2_rtp(ulong2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(ulong2); ulong2 __ovld __cnfn convert_ulong2_rtn(ulong2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(ulong2); ulong2 __ovld __cnfn convert_ulong2(ulong2); ulong2 __ovld __cnfn convert_ulong2_sat(ulong2); ulong2 __ovld __cnfn convert_ulong2_rte(float2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(float2); ulong2 __ovld __cnfn convert_ulong2_rtz(float2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(float2); ulong2 __ovld __cnfn convert_ulong2_rtp(float2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(float2); ulong2 __ovld __cnfn convert_ulong2_rtn(float2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(float2); ulong2 __ovld __cnfn convert_ulong2(float2); ulong2 __ovld __cnfn convert_ulong2_sat(float2); float2 __ovld __cnfn convert_float2_rte(char2); float2 __ovld __cnfn convert_float2_rtz(char2); float2 __ovld __cnfn convert_float2_rtp(char2); float2 __ovld __cnfn convert_float2_rtn(char2); float2 __ovld __cnfn convert_float2(char2); float2 __ovld __cnfn convert_float2_rte(uchar2); float2 __ovld __cnfn convert_float2_rtz(uchar2); float2 __ovld __cnfn convert_float2_rtp(uchar2); float2 __ovld __cnfn convert_float2_rtn(uchar2); float2 __ovld __cnfn convert_float2(uchar2); float2 __ovld __cnfn convert_float2_rte(short2); float2 __ovld __cnfn convert_float2_rtz(short2); float2 __ovld __cnfn convert_float2_rtp(short2); float2 __ovld __cnfn convert_float2_rtn(short2); float2 __ovld __cnfn convert_float2(short2); float2 __ovld __cnfn convert_float2_rte(ushort2); float2 __ovld __cnfn convert_float2_rtz(ushort2); float2 __ovld __cnfn convert_float2_rtp(ushort2); float2 __ovld __cnfn convert_float2_rtn(ushort2); float2 __ovld __cnfn convert_float2(ushort2); float2 __ovld __cnfn convert_float2_rte(int2); float2 __ovld __cnfn convert_float2_rtz(int2); float2 __ovld __cnfn convert_float2_rtp(int2); float2 __ovld __cnfn convert_float2_rtn(int2); float2 __ovld __cnfn convert_float2(int2); float2 __ovld __cnfn convert_float2_rte(uint2); float2 __ovld __cnfn convert_float2_rtz(uint2); float2 __ovld __cnfn convert_float2_rtp(uint2); float2 __ovld __cnfn convert_float2_rtn(uint2); float2 __ovld __cnfn convert_float2(uint2); float2 __ovld __cnfn convert_float2_rte(long2); float2 __ovld __cnfn convert_float2_rtz(long2); float2 __ovld __cnfn convert_float2_rtp(long2); float2 __ovld __cnfn convert_float2_rtn(long2); float2 __ovld __cnfn convert_float2(long2); float2 __ovld __cnfn convert_float2_rte(ulong2); float2 __ovld __cnfn convert_float2_rtz(ulong2); float2 __ovld __cnfn convert_float2_rtp(ulong2); float2 __ovld __cnfn convert_float2_rtn(ulong2); float2 __ovld __cnfn convert_float2(ulong2); float2 __ovld __cnfn convert_float2_rte(float2); float2 __ovld __cnfn convert_float2_rtz(float2); float2 __ovld __cnfn convert_float2_rtp(float2); float2 __ovld __cnfn convert_float2_rtn(float2); float2 __ovld __cnfn convert_float2(float2); char3 __ovld __cnfn convert_char3_rte(char3); char3 __ovld __cnfn convert_char3_sat_rte(char3); char3 __ovld __cnfn convert_char3_rtz(char3); char3 __ovld __cnfn convert_char3_sat_rtz(char3); char3 __ovld __cnfn convert_char3_rtp(char3); char3 __ovld __cnfn convert_char3_sat_rtp(char3); char3 __ovld __cnfn convert_char3_rtn(char3); char3 __ovld __cnfn convert_char3_sat_rtn(char3); char3 __ovld __cnfn convert_char3(char3); char3 __ovld __cnfn convert_char3_sat(char3); char3 __ovld __cnfn convert_char3_rte(uchar3); char3 __ovld __cnfn convert_char3_sat_rte(uchar3); char3 __ovld __cnfn convert_char3_rtz(uchar3); char3 __ovld __cnfn convert_char3_sat_rtz(uchar3); char3 __ovld __cnfn convert_char3_rtp(uchar3); char3 __ovld __cnfn convert_char3_sat_rtp(uchar3); char3 __ovld __cnfn convert_char3_rtn(uchar3); char3 __ovld __cnfn convert_char3_sat_rtn(uchar3); char3 __ovld __cnfn convert_char3(uchar3); char3 __ovld __cnfn convert_char3_sat(uchar3); char3 __ovld __cnfn convert_char3_rte(short3); char3 __ovld __cnfn convert_char3_sat_rte(short3); char3 __ovld __cnfn convert_char3_rtz(short3); char3 __ovld __cnfn convert_char3_sat_rtz(short3); char3 __ovld __cnfn convert_char3_rtp(short3); char3 __ovld __cnfn convert_char3_sat_rtp(short3); char3 __ovld __cnfn convert_char3_rtn(short3); char3 __ovld __cnfn convert_char3_sat_rtn(short3); char3 __ovld __cnfn convert_char3(short3); char3 __ovld __cnfn convert_char3_sat(short3); char3 __ovld __cnfn convert_char3_rte(ushort3); char3 __ovld __cnfn convert_char3_sat_rte(ushort3); char3 __ovld __cnfn convert_char3_rtz(ushort3); char3 __ovld __cnfn convert_char3_sat_rtz(ushort3); char3 __ovld __cnfn convert_char3_rtp(ushort3); char3 __ovld __cnfn convert_char3_sat_rtp(ushort3); char3 __ovld __cnfn convert_char3_rtn(ushort3); char3 __ovld __cnfn convert_char3_sat_rtn(ushort3); char3 __ovld __cnfn convert_char3(ushort3); char3 __ovld __cnfn convert_char3_sat(ushort3); char3 __ovld __cnfn convert_char3_rte(int3); char3 __ovld __cnfn convert_char3_sat_rte(int3); char3 __ovld __cnfn convert_char3_rtz(int3); char3 __ovld __cnfn convert_char3_sat_rtz(int3); char3 __ovld __cnfn convert_char3_rtp(int3); char3 __ovld __cnfn convert_char3_sat_rtp(int3); char3 __ovld __cnfn convert_char3_rtn(int3); char3 __ovld __cnfn convert_char3_sat_rtn(int3); char3 __ovld __cnfn convert_char3(int3); char3 __ovld __cnfn convert_char3_sat(int3); char3 __ovld __cnfn convert_char3_rte(uint3); char3 __ovld __cnfn convert_char3_sat_rte(uint3); char3 __ovld __cnfn convert_char3_rtz(uint3); char3 __ovld __cnfn convert_char3_sat_rtz(uint3); char3 __ovld __cnfn convert_char3_rtp(uint3); char3 __ovld __cnfn convert_char3_sat_rtp(uint3); char3 __ovld __cnfn convert_char3_rtn(uint3); char3 __ovld __cnfn convert_char3_sat_rtn(uint3); char3 __ovld __cnfn convert_char3(uint3); char3 __ovld __cnfn convert_char3_sat(uint3); char3 __ovld __cnfn convert_char3_rte(long3); char3 __ovld __cnfn convert_char3_sat_rte(long3); char3 __ovld __cnfn convert_char3_rtz(long3); char3 __ovld __cnfn convert_char3_sat_rtz(long3); char3 __ovld __cnfn convert_char3_rtp(long3); char3 __ovld __cnfn convert_char3_sat_rtp(long3); char3 __ovld __cnfn convert_char3_rtn(long3); char3 __ovld __cnfn convert_char3_sat_rtn(long3); char3 __ovld __cnfn convert_char3(long3); char3 __ovld __cnfn convert_char3_sat(long3); char3 __ovld __cnfn convert_char3_rte(ulong3); char3 __ovld __cnfn convert_char3_sat_rte(ulong3); char3 __ovld __cnfn convert_char3_rtz(ulong3); char3 __ovld __cnfn convert_char3_sat_rtz(ulong3); char3 __ovld __cnfn convert_char3_rtp(ulong3); char3 __ovld __cnfn convert_char3_sat_rtp(ulong3); char3 __ovld __cnfn convert_char3_rtn(ulong3); char3 __ovld __cnfn convert_char3_sat_rtn(ulong3); char3 __ovld __cnfn convert_char3(ulong3); char3 __ovld __cnfn convert_char3_sat(ulong3); char3 __ovld __cnfn convert_char3_rte(float3); char3 __ovld __cnfn convert_char3_sat_rte(float3); char3 __ovld __cnfn convert_char3_rtz(float3); char3 __ovld __cnfn convert_char3_sat_rtz(float3); char3 __ovld __cnfn convert_char3_rtp(float3); char3 __ovld __cnfn convert_char3_sat_rtp(float3); char3 __ovld __cnfn convert_char3_rtn(float3); char3 __ovld __cnfn convert_char3_sat_rtn(float3); char3 __ovld __cnfn convert_char3(float3); char3 __ovld __cnfn convert_char3_sat(float3); uchar3 __ovld __cnfn convert_uchar3_rte(char3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(char3); uchar3 __ovld __cnfn convert_uchar3_rtz(char3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(char3); uchar3 __ovld __cnfn convert_uchar3_rtp(char3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(char3); uchar3 __ovld __cnfn convert_uchar3_rtn(char3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(char3); uchar3 __ovld __cnfn convert_uchar3(char3); uchar3 __ovld __cnfn convert_uchar3_sat(char3); uchar3 __ovld __cnfn convert_uchar3_rte(uchar3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(uchar3); uchar3 __ovld __cnfn convert_uchar3_rtz(uchar3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(uchar3); uchar3 __ovld __cnfn convert_uchar3_rtp(uchar3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(uchar3); uchar3 __ovld __cnfn convert_uchar3_rtn(uchar3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(uchar3); uchar3 __ovld __cnfn convert_uchar3(uchar3); uchar3 __ovld __cnfn convert_uchar3_sat(uchar3); uchar3 __ovld __cnfn convert_uchar3_rte(short3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(short3); uchar3 __ovld __cnfn convert_uchar3_rtz(short3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(short3); uchar3 __ovld __cnfn convert_uchar3_rtp(short3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(short3); uchar3 __ovld __cnfn convert_uchar3_rtn(short3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(short3); uchar3 __ovld __cnfn convert_uchar3(short3); uchar3 __ovld __cnfn convert_uchar3_sat(short3); uchar3 __ovld __cnfn convert_uchar3_rte(ushort3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(ushort3); uchar3 __ovld __cnfn convert_uchar3_rtz(ushort3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(ushort3); uchar3 __ovld __cnfn convert_uchar3_rtp(ushort3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(ushort3); uchar3 __ovld __cnfn convert_uchar3_rtn(ushort3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(ushort3); uchar3 __ovld __cnfn convert_uchar3(ushort3); uchar3 __ovld __cnfn convert_uchar3_sat(ushort3); uchar3 __ovld __cnfn convert_uchar3_rte(int3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(int3); uchar3 __ovld __cnfn convert_uchar3_rtz(int3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(int3); uchar3 __ovld __cnfn convert_uchar3_rtp(int3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(int3); uchar3 __ovld __cnfn convert_uchar3_rtn(int3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(int3); uchar3 __ovld __cnfn convert_uchar3(int3); uchar3 __ovld __cnfn convert_uchar3_sat(int3); uchar3 __ovld __cnfn convert_uchar3_rte(uint3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(uint3); uchar3 __ovld __cnfn convert_uchar3_rtz(uint3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(uint3); uchar3 __ovld __cnfn convert_uchar3_rtp(uint3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(uint3); uchar3 __ovld __cnfn convert_uchar3_rtn(uint3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(uint3); uchar3 __ovld __cnfn convert_uchar3(uint3); uchar3 __ovld __cnfn convert_uchar3_sat(uint3); uchar3 __ovld __cnfn convert_uchar3_rte(long3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(long3); uchar3 __ovld __cnfn convert_uchar3_rtz(long3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(long3); uchar3 __ovld __cnfn convert_uchar3_rtp(long3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(long3); uchar3 __ovld __cnfn convert_uchar3_rtn(long3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(long3); uchar3 __ovld __cnfn convert_uchar3(long3); uchar3 __ovld __cnfn convert_uchar3_sat(long3); uchar3 __ovld __cnfn convert_uchar3_rte(ulong3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(ulong3); uchar3 __ovld __cnfn convert_uchar3_rtz(ulong3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(ulong3); uchar3 __ovld __cnfn convert_uchar3_rtp(ulong3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(ulong3); uchar3 __ovld __cnfn convert_uchar3_rtn(ulong3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(ulong3); uchar3 __ovld __cnfn convert_uchar3(ulong3); uchar3 __ovld __cnfn convert_uchar3_sat(ulong3); uchar3 __ovld __cnfn convert_uchar3_rte(float3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(float3); uchar3 __ovld __cnfn convert_uchar3_rtz(float3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(float3); uchar3 __ovld __cnfn convert_uchar3_rtp(float3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(float3); uchar3 __ovld __cnfn convert_uchar3_rtn(float3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(float3); uchar3 __ovld __cnfn convert_uchar3(float3); uchar3 __ovld __cnfn convert_uchar3_sat(float3); short3 __ovld __cnfn convert_short3_rte(char3); short3 __ovld __cnfn convert_short3_sat_rte(char3); short3 __ovld __cnfn convert_short3_rtz(char3); short3 __ovld __cnfn convert_short3_sat_rtz(char3); short3 __ovld __cnfn convert_short3_rtp(char3); short3 __ovld __cnfn convert_short3_sat_rtp(char3); short3 __ovld __cnfn convert_short3_rtn(char3); short3 __ovld __cnfn convert_short3_sat_rtn(char3); short3 __ovld __cnfn convert_short3(char3); short3 __ovld __cnfn convert_short3_sat(char3); short3 __ovld __cnfn convert_short3_rte(uchar3); short3 __ovld __cnfn convert_short3_sat_rte(uchar3); short3 __ovld __cnfn convert_short3_rtz(uchar3); short3 __ovld __cnfn convert_short3_sat_rtz(uchar3); short3 __ovld __cnfn convert_short3_rtp(uchar3); short3 __ovld __cnfn convert_short3_sat_rtp(uchar3); short3 __ovld __cnfn convert_short3_rtn(uchar3); short3 __ovld __cnfn convert_short3_sat_rtn(uchar3); short3 __ovld __cnfn convert_short3(uchar3); short3 __ovld __cnfn convert_short3_sat(uchar3); short3 __ovld __cnfn convert_short3_rte(short3); short3 __ovld __cnfn convert_short3_sat_rte(short3); short3 __ovld __cnfn convert_short3_rtz(short3); short3 __ovld __cnfn convert_short3_sat_rtz(short3); short3 __ovld __cnfn convert_short3_rtp(short3); short3 __ovld __cnfn convert_short3_sat_rtp(short3); short3 __ovld __cnfn convert_short3_rtn(short3); short3 __ovld __cnfn convert_short3_sat_rtn(short3); short3 __ovld __cnfn convert_short3(short3); short3 __ovld __cnfn convert_short3_sat(short3); short3 __ovld __cnfn convert_short3_rte(ushort3); short3 __ovld __cnfn convert_short3_sat_rte(ushort3); short3 __ovld __cnfn convert_short3_rtz(ushort3); short3 __ovld __cnfn convert_short3_sat_rtz(ushort3); short3 __ovld __cnfn convert_short3_rtp(ushort3); short3 __ovld __cnfn convert_short3_sat_rtp(ushort3); short3 __ovld __cnfn convert_short3_rtn(ushort3); short3 __ovld __cnfn convert_short3_sat_rtn(ushort3); short3 __ovld __cnfn convert_short3(ushort3); short3 __ovld __cnfn convert_short3_sat(ushort3); short3 __ovld __cnfn convert_short3_rte(int3); short3 __ovld __cnfn convert_short3_sat_rte(int3); short3 __ovld __cnfn convert_short3_rtz(int3); short3 __ovld __cnfn convert_short3_sat_rtz(int3); short3 __ovld __cnfn convert_short3_rtp(int3); short3 __ovld __cnfn convert_short3_sat_rtp(int3); short3 __ovld __cnfn convert_short3_rtn(int3); short3 __ovld __cnfn convert_short3_sat_rtn(int3); short3 __ovld __cnfn convert_short3(int3); short3 __ovld __cnfn convert_short3_sat(int3); short3 __ovld __cnfn convert_short3_rte(uint3); short3 __ovld __cnfn convert_short3_sat_rte(uint3); short3 __ovld __cnfn convert_short3_rtz(uint3); short3 __ovld __cnfn convert_short3_sat_rtz(uint3); short3 __ovld __cnfn convert_short3_rtp(uint3); short3 __ovld __cnfn convert_short3_sat_rtp(uint3); short3 __ovld __cnfn convert_short3_rtn(uint3); short3 __ovld __cnfn convert_short3_sat_rtn(uint3); short3 __ovld __cnfn convert_short3(uint3); short3 __ovld __cnfn convert_short3_sat(uint3); short3 __ovld __cnfn convert_short3_rte(long3); short3 __ovld __cnfn convert_short3_sat_rte(long3); short3 __ovld __cnfn convert_short3_rtz(long3); short3 __ovld __cnfn convert_short3_sat_rtz(long3); short3 __ovld __cnfn convert_short3_rtp(long3); short3 __ovld __cnfn convert_short3_sat_rtp(long3); short3 __ovld __cnfn convert_short3_rtn(long3); short3 __ovld __cnfn convert_short3_sat_rtn(long3); short3 __ovld __cnfn convert_short3(long3); short3 __ovld __cnfn convert_short3_sat(long3); short3 __ovld __cnfn convert_short3_rte(ulong3); short3 __ovld __cnfn convert_short3_sat_rte(ulong3); short3 __ovld __cnfn convert_short3_rtz(ulong3); short3 __ovld __cnfn convert_short3_sat_rtz(ulong3); short3 __ovld __cnfn convert_short3_rtp(ulong3); short3 __ovld __cnfn convert_short3_sat_rtp(ulong3); short3 __ovld __cnfn convert_short3_rtn(ulong3); short3 __ovld __cnfn convert_short3_sat_rtn(ulong3); short3 __ovld __cnfn convert_short3(ulong3); short3 __ovld __cnfn convert_short3_sat(ulong3); short3 __ovld __cnfn convert_short3_rte(float3); short3 __ovld __cnfn convert_short3_sat_rte(float3); short3 __ovld __cnfn convert_short3_rtz(float3); short3 __ovld __cnfn convert_short3_sat_rtz(float3); short3 __ovld __cnfn convert_short3_rtp(float3); short3 __ovld __cnfn convert_short3_sat_rtp(float3); short3 __ovld __cnfn convert_short3_rtn(float3); short3 __ovld __cnfn convert_short3_sat_rtn(float3); short3 __ovld __cnfn convert_short3(float3); short3 __ovld __cnfn convert_short3_sat(float3); ushort3 __ovld __cnfn convert_ushort3_rte(char3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(char3); ushort3 __ovld __cnfn convert_ushort3_rtz(char3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(char3); ushort3 __ovld __cnfn convert_ushort3_rtp(char3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(char3); ushort3 __ovld __cnfn convert_ushort3_rtn(char3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(char3); ushort3 __ovld __cnfn convert_ushort3(char3); ushort3 __ovld __cnfn convert_ushort3_sat(char3); ushort3 __ovld __cnfn convert_ushort3_rte(uchar3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(uchar3); ushort3 __ovld __cnfn convert_ushort3_rtz(uchar3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(uchar3); ushort3 __ovld __cnfn convert_ushort3_rtp(uchar3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(uchar3); ushort3 __ovld __cnfn convert_ushort3_rtn(uchar3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(uchar3); ushort3 __ovld __cnfn convert_ushort3(uchar3); ushort3 __ovld __cnfn convert_ushort3_sat(uchar3); ushort3 __ovld __cnfn convert_ushort3_rte(short3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(short3); ushort3 __ovld __cnfn convert_ushort3_rtz(short3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(short3); ushort3 __ovld __cnfn convert_ushort3_rtp(short3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(short3); ushort3 __ovld __cnfn convert_ushort3_rtn(short3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(short3); ushort3 __ovld __cnfn convert_ushort3(short3); ushort3 __ovld __cnfn convert_ushort3_sat(short3); ushort3 __ovld __cnfn convert_ushort3_rte(ushort3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(ushort3); ushort3 __ovld __cnfn convert_ushort3_rtz(ushort3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(ushort3); ushort3 __ovld __cnfn convert_ushort3_rtp(ushort3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(ushort3); ushort3 __ovld __cnfn convert_ushort3_rtn(ushort3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(ushort3); ushort3 __ovld __cnfn convert_ushort3(ushort3); ushort3 __ovld __cnfn convert_ushort3_sat(ushort3); ushort3 __ovld __cnfn convert_ushort3_rte(int3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(int3); ushort3 __ovld __cnfn convert_ushort3_rtz(int3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(int3); ushort3 __ovld __cnfn convert_ushort3_rtp(int3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(int3); ushort3 __ovld __cnfn convert_ushort3_rtn(int3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(int3); ushort3 __ovld __cnfn convert_ushort3(int3); ushort3 __ovld __cnfn convert_ushort3_sat(int3); ushort3 __ovld __cnfn convert_ushort3_rte(uint3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(uint3); ushort3 __ovld __cnfn convert_ushort3_rtz(uint3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(uint3); ushort3 __ovld __cnfn convert_ushort3_rtp(uint3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(uint3); ushort3 __ovld __cnfn convert_ushort3_rtn(uint3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(uint3); ushort3 __ovld __cnfn convert_ushort3(uint3); ushort3 __ovld __cnfn convert_ushort3_sat(uint3); ushort3 __ovld __cnfn convert_ushort3_rte(long3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(long3); ushort3 __ovld __cnfn convert_ushort3_rtz(long3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(long3); ushort3 __ovld __cnfn convert_ushort3_rtp(long3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(long3); ushort3 __ovld __cnfn convert_ushort3_rtn(long3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(long3); ushort3 __ovld __cnfn convert_ushort3(long3); ushort3 __ovld __cnfn convert_ushort3_sat(long3); ushort3 __ovld __cnfn convert_ushort3_rte(ulong3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(ulong3); ushort3 __ovld __cnfn convert_ushort3_rtz(ulong3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(ulong3); ushort3 __ovld __cnfn convert_ushort3_rtp(ulong3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(ulong3); ushort3 __ovld __cnfn convert_ushort3_rtn(ulong3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(ulong3); ushort3 __ovld __cnfn convert_ushort3(ulong3); ushort3 __ovld __cnfn convert_ushort3_sat(ulong3); ushort3 __ovld __cnfn convert_ushort3_rte(float3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(float3); ushort3 __ovld __cnfn convert_ushort3_rtz(float3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(float3); ushort3 __ovld __cnfn convert_ushort3_rtp(float3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(float3); ushort3 __ovld __cnfn convert_ushort3_rtn(float3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(float3); ushort3 __ovld __cnfn convert_ushort3(float3); ushort3 __ovld __cnfn convert_ushort3_sat(float3); int3 __ovld __cnfn convert_int3_rte(char3); int3 __ovld __cnfn convert_int3_sat_rte(char3); int3 __ovld __cnfn convert_int3_rtz(char3); int3 __ovld __cnfn convert_int3_sat_rtz(char3); int3 __ovld __cnfn convert_int3_rtp(char3); int3 __ovld __cnfn convert_int3_sat_rtp(char3); int3 __ovld __cnfn convert_int3_rtn(char3); int3 __ovld __cnfn convert_int3_sat_rtn(char3); int3 __ovld __cnfn convert_int3(char3); int3 __ovld __cnfn convert_int3_sat(char3); int3 __ovld __cnfn convert_int3_rte(uchar3); int3 __ovld __cnfn convert_int3_sat_rte(uchar3); int3 __ovld __cnfn convert_int3_rtz(uchar3); int3 __ovld __cnfn convert_int3_sat_rtz(uchar3); int3 __ovld __cnfn convert_int3_rtp(uchar3); int3 __ovld __cnfn convert_int3_sat_rtp(uchar3); int3 __ovld __cnfn convert_int3_rtn(uchar3); int3 __ovld __cnfn convert_int3_sat_rtn(uchar3); int3 __ovld __cnfn convert_int3(uchar3); int3 __ovld __cnfn convert_int3_sat(uchar3); int3 __ovld __cnfn convert_int3_rte(short3); int3 __ovld __cnfn convert_int3_sat_rte(short3); int3 __ovld __cnfn convert_int3_rtz(short3); int3 __ovld __cnfn convert_int3_sat_rtz(short3); int3 __ovld __cnfn convert_int3_rtp(short3); int3 __ovld __cnfn convert_int3_sat_rtp(short3); int3 __ovld __cnfn convert_int3_rtn(short3); int3 __ovld __cnfn convert_int3_sat_rtn(short3); int3 __ovld __cnfn convert_int3(short3); int3 __ovld __cnfn convert_int3_sat(short3); int3 __ovld __cnfn convert_int3_rte(ushort3); int3 __ovld __cnfn convert_int3_sat_rte(ushort3); int3 __ovld __cnfn convert_int3_rtz(ushort3); int3 __ovld __cnfn convert_int3_sat_rtz(ushort3); int3 __ovld __cnfn convert_int3_rtp(ushort3); int3 __ovld __cnfn convert_int3_sat_rtp(ushort3); int3 __ovld __cnfn convert_int3_rtn(ushort3); int3 __ovld __cnfn convert_int3_sat_rtn(ushort3); int3 __ovld __cnfn convert_int3(ushort3); int3 __ovld __cnfn convert_int3_sat(ushort3); int3 __ovld __cnfn convert_int3_rte(int3); int3 __ovld __cnfn convert_int3_sat_rte(int3); int3 __ovld __cnfn convert_int3_rtz(int3); int3 __ovld __cnfn convert_int3_sat_rtz(int3); int3 __ovld __cnfn convert_int3_rtp(int3); int3 __ovld __cnfn convert_int3_sat_rtp(int3); int3 __ovld __cnfn convert_int3_rtn(int3); int3 __ovld __cnfn convert_int3_sat_rtn(int3); int3 __ovld __cnfn convert_int3(int3); int3 __ovld __cnfn convert_int3_sat(int3); int3 __ovld __cnfn convert_int3_rte(uint3); int3 __ovld __cnfn convert_int3_sat_rte(uint3); int3 __ovld __cnfn convert_int3_rtz(uint3); int3 __ovld __cnfn convert_int3_sat_rtz(uint3); int3 __ovld __cnfn convert_int3_rtp(uint3); int3 __ovld __cnfn convert_int3_sat_rtp(uint3); int3 __ovld __cnfn convert_int3_rtn(uint3); int3 __ovld __cnfn convert_int3_sat_rtn(uint3); int3 __ovld __cnfn convert_int3(uint3); int3 __ovld __cnfn convert_int3_sat(uint3); int3 __ovld __cnfn convert_int3_rte(long3); int3 __ovld __cnfn convert_int3_sat_rte(long3); int3 __ovld __cnfn convert_int3_rtz(long3); int3 __ovld __cnfn convert_int3_sat_rtz(long3); int3 __ovld __cnfn convert_int3_rtp(long3); int3 __ovld __cnfn convert_int3_sat_rtp(long3); int3 __ovld __cnfn convert_int3_rtn(long3); int3 __ovld __cnfn convert_int3_sat_rtn(long3); int3 __ovld __cnfn convert_int3(long3); int3 __ovld __cnfn convert_int3_sat(long3); int3 __ovld __cnfn convert_int3_rte(ulong3); int3 __ovld __cnfn convert_int3_sat_rte(ulong3); int3 __ovld __cnfn convert_int3_rtz(ulong3); int3 __ovld __cnfn convert_int3_sat_rtz(ulong3); int3 __ovld __cnfn convert_int3_rtp(ulong3); int3 __ovld __cnfn convert_int3_sat_rtp(ulong3); int3 __ovld __cnfn convert_int3_rtn(ulong3); int3 __ovld __cnfn convert_int3_sat_rtn(ulong3); int3 __ovld __cnfn convert_int3(ulong3); int3 __ovld __cnfn convert_int3_sat(ulong3); int3 __ovld __cnfn convert_int3_rte(float3); int3 __ovld __cnfn convert_int3_sat_rte(float3); int3 __ovld __cnfn convert_int3_rtz(float3); int3 __ovld __cnfn convert_int3_sat_rtz(float3); int3 __ovld __cnfn convert_int3_rtp(float3); int3 __ovld __cnfn convert_int3_sat_rtp(float3); int3 __ovld __cnfn convert_int3_rtn(float3); int3 __ovld __cnfn convert_int3_sat_rtn(float3); int3 __ovld __cnfn convert_int3(float3); int3 __ovld __cnfn convert_int3_sat(float3); uint3 __ovld __cnfn convert_uint3_rte(char3); uint3 __ovld __cnfn convert_uint3_sat_rte(char3); uint3 __ovld __cnfn convert_uint3_rtz(char3); uint3 __ovld __cnfn convert_uint3_sat_rtz(char3); uint3 __ovld __cnfn convert_uint3_rtp(char3); uint3 __ovld __cnfn convert_uint3_sat_rtp(char3); uint3 __ovld __cnfn convert_uint3_rtn(char3); uint3 __ovld __cnfn convert_uint3_sat_rtn(char3); uint3 __ovld __cnfn convert_uint3(char3); uint3 __ovld __cnfn convert_uint3_sat(char3); uint3 __ovld __cnfn convert_uint3_rte(uchar3); uint3 __ovld __cnfn convert_uint3_sat_rte(uchar3); uint3 __ovld __cnfn convert_uint3_rtz(uchar3); uint3 __ovld __cnfn convert_uint3_sat_rtz(uchar3); uint3 __ovld __cnfn convert_uint3_rtp(uchar3); uint3 __ovld __cnfn convert_uint3_sat_rtp(uchar3); uint3 __ovld __cnfn convert_uint3_rtn(uchar3); uint3 __ovld __cnfn convert_uint3_sat_rtn(uchar3); uint3 __ovld __cnfn convert_uint3(uchar3); uint3 __ovld __cnfn convert_uint3_sat(uchar3); uint3 __ovld __cnfn convert_uint3_rte(short3); uint3 __ovld __cnfn convert_uint3_sat_rte(short3); uint3 __ovld __cnfn convert_uint3_rtz(short3); uint3 __ovld __cnfn convert_uint3_sat_rtz(short3); uint3 __ovld __cnfn convert_uint3_rtp(short3); uint3 __ovld __cnfn convert_uint3_sat_rtp(short3); uint3 __ovld __cnfn convert_uint3_rtn(short3); uint3 __ovld __cnfn convert_uint3_sat_rtn(short3); uint3 __ovld __cnfn convert_uint3(short3); uint3 __ovld __cnfn convert_uint3_sat(short3); uint3 __ovld __cnfn convert_uint3_rte(ushort3); uint3 __ovld __cnfn convert_uint3_sat_rte(ushort3); uint3 __ovld __cnfn convert_uint3_rtz(ushort3); uint3 __ovld __cnfn convert_uint3_sat_rtz(ushort3); uint3 __ovld __cnfn convert_uint3_rtp(ushort3); uint3 __ovld __cnfn convert_uint3_sat_rtp(ushort3); uint3 __ovld __cnfn convert_uint3_rtn(ushort3); uint3 __ovld __cnfn convert_uint3_sat_rtn(ushort3); uint3 __ovld __cnfn convert_uint3(ushort3); uint3 __ovld __cnfn convert_uint3_sat(ushort3); uint3 __ovld __cnfn convert_uint3_rte(int3); uint3 __ovld __cnfn convert_uint3_sat_rte(int3); uint3 __ovld __cnfn convert_uint3_rtz(int3); uint3 __ovld __cnfn convert_uint3_sat_rtz(int3); uint3 __ovld __cnfn convert_uint3_rtp(int3); uint3 __ovld __cnfn convert_uint3_sat_rtp(int3); uint3 __ovld __cnfn convert_uint3_rtn(int3); uint3 __ovld __cnfn convert_uint3_sat_rtn(int3); uint3 __ovld __cnfn convert_uint3(int3); uint3 __ovld __cnfn convert_uint3_sat(int3); uint3 __ovld __cnfn convert_uint3_rte(uint3); uint3 __ovld __cnfn convert_uint3_sat_rte(uint3); uint3 __ovld __cnfn convert_uint3_rtz(uint3); uint3 __ovld __cnfn convert_uint3_sat_rtz(uint3); uint3 __ovld __cnfn convert_uint3_rtp(uint3); uint3 __ovld __cnfn convert_uint3_sat_rtp(uint3); uint3 __ovld __cnfn convert_uint3_rtn(uint3); uint3 __ovld __cnfn convert_uint3_sat_rtn(uint3); uint3 __ovld __cnfn convert_uint3(uint3); uint3 __ovld __cnfn convert_uint3_sat(uint3); uint3 __ovld __cnfn convert_uint3_rte(long3); uint3 __ovld __cnfn convert_uint3_sat_rte(long3); uint3 __ovld __cnfn convert_uint3_rtz(long3); uint3 __ovld __cnfn convert_uint3_sat_rtz(long3); uint3 __ovld __cnfn convert_uint3_rtp(long3); uint3 __ovld __cnfn convert_uint3_sat_rtp(long3); uint3 __ovld __cnfn convert_uint3_rtn(long3); uint3 __ovld __cnfn convert_uint3_sat_rtn(long3); uint3 __ovld __cnfn convert_uint3(long3); uint3 __ovld __cnfn convert_uint3_sat(long3); uint3 __ovld __cnfn convert_uint3_rte(ulong3); uint3 __ovld __cnfn convert_uint3_sat_rte(ulong3); uint3 __ovld __cnfn convert_uint3_rtz(ulong3); uint3 __ovld __cnfn convert_uint3_sat_rtz(ulong3); uint3 __ovld __cnfn convert_uint3_rtp(ulong3); uint3 __ovld __cnfn convert_uint3_sat_rtp(ulong3); uint3 __ovld __cnfn convert_uint3_rtn(ulong3); uint3 __ovld __cnfn convert_uint3_sat_rtn(ulong3); uint3 __ovld __cnfn convert_uint3(ulong3); uint3 __ovld __cnfn convert_uint3_sat(ulong3); uint3 __ovld __cnfn convert_uint3_rte(float3); uint3 __ovld __cnfn convert_uint3_sat_rte(float3); uint3 __ovld __cnfn convert_uint3_rtz(float3); uint3 __ovld __cnfn convert_uint3_sat_rtz(float3); uint3 __ovld __cnfn convert_uint3_rtp(float3); uint3 __ovld __cnfn convert_uint3_sat_rtp(float3); uint3 __ovld __cnfn convert_uint3_rtn(float3); uint3 __ovld __cnfn convert_uint3_sat_rtn(float3); uint3 __ovld __cnfn convert_uint3(float3); uint3 __ovld __cnfn convert_uint3_sat(float3); long3 __ovld __cnfn convert_long3_rte(char3); long3 __ovld __cnfn convert_long3_sat_rte(char3); long3 __ovld __cnfn convert_long3_rtz(char3); long3 __ovld __cnfn convert_long3_sat_rtz(char3); long3 __ovld __cnfn convert_long3_rtp(char3); long3 __ovld __cnfn convert_long3_sat_rtp(char3); long3 __ovld __cnfn convert_long3_rtn(char3); long3 __ovld __cnfn convert_long3_sat_rtn(char3); long3 __ovld __cnfn convert_long3(char3); long3 __ovld __cnfn convert_long3_sat(char3); long3 __ovld __cnfn convert_long3_rte(uchar3); long3 __ovld __cnfn convert_long3_sat_rte(uchar3); long3 __ovld __cnfn convert_long3_rtz(uchar3); long3 __ovld __cnfn convert_long3_sat_rtz(uchar3); long3 __ovld __cnfn convert_long3_rtp(uchar3); long3 __ovld __cnfn convert_long3_sat_rtp(uchar3); long3 __ovld __cnfn convert_long3_rtn(uchar3); long3 __ovld __cnfn convert_long3_sat_rtn(uchar3); long3 __ovld __cnfn convert_long3(uchar3); long3 __ovld __cnfn convert_long3_sat(uchar3); long3 __ovld __cnfn convert_long3_rte(short3); long3 __ovld __cnfn convert_long3_sat_rte(short3); long3 __ovld __cnfn convert_long3_rtz(short3); long3 __ovld __cnfn convert_long3_sat_rtz(short3); long3 __ovld __cnfn convert_long3_rtp(short3); long3 __ovld __cnfn convert_long3_sat_rtp(short3); long3 __ovld __cnfn convert_long3_rtn(short3); long3 __ovld __cnfn convert_long3_sat_rtn(short3); long3 __ovld __cnfn convert_long3(short3); long3 __ovld __cnfn convert_long3_sat(short3); long3 __ovld __cnfn convert_long3_rte(ushort3); long3 __ovld __cnfn convert_long3_sat_rte(ushort3); long3 __ovld __cnfn convert_long3_rtz(ushort3); long3 __ovld __cnfn convert_long3_sat_rtz(ushort3); long3 __ovld __cnfn convert_long3_rtp(ushort3); long3 __ovld __cnfn convert_long3_sat_rtp(ushort3); long3 __ovld __cnfn convert_long3_rtn(ushort3); long3 __ovld __cnfn convert_long3_sat_rtn(ushort3); long3 __ovld __cnfn convert_long3(ushort3); long3 __ovld __cnfn convert_long3_sat(ushort3); long3 __ovld __cnfn convert_long3_rte(int3); long3 __ovld __cnfn convert_long3_sat_rte(int3); long3 __ovld __cnfn convert_long3_rtz(int3); long3 __ovld __cnfn convert_long3_sat_rtz(int3); long3 __ovld __cnfn convert_long3_rtp(int3); long3 __ovld __cnfn convert_long3_sat_rtp(int3); long3 __ovld __cnfn convert_long3_rtn(int3); long3 __ovld __cnfn convert_long3_sat_rtn(int3); long3 __ovld __cnfn convert_long3(int3); long3 __ovld __cnfn convert_long3_sat(int3); long3 __ovld __cnfn convert_long3_rte(uint3); long3 __ovld __cnfn convert_long3_sat_rte(uint3); long3 __ovld __cnfn convert_long3_rtz(uint3); long3 __ovld __cnfn convert_long3_sat_rtz(uint3); long3 __ovld __cnfn convert_long3_rtp(uint3); long3 __ovld __cnfn convert_long3_sat_rtp(uint3); long3 __ovld __cnfn convert_long3_rtn(uint3); long3 __ovld __cnfn convert_long3_sat_rtn(uint3); long3 __ovld __cnfn convert_long3(uint3); long3 __ovld __cnfn convert_long3_sat(uint3); long3 __ovld __cnfn convert_long3_rte(long3); long3 __ovld __cnfn convert_long3_sat_rte(long3); long3 __ovld __cnfn convert_long3_rtz(long3); long3 __ovld __cnfn convert_long3_sat_rtz(long3); long3 __ovld __cnfn convert_long3_rtp(long3); long3 __ovld __cnfn convert_long3_sat_rtp(long3); long3 __ovld __cnfn convert_long3_rtn(long3); long3 __ovld __cnfn convert_long3_sat_rtn(long3); long3 __ovld __cnfn convert_long3(long3); long3 __ovld __cnfn convert_long3_sat(long3); long3 __ovld __cnfn convert_long3_rte(ulong3); long3 __ovld __cnfn convert_long3_sat_rte(ulong3); long3 __ovld __cnfn convert_long3_rtz(ulong3); long3 __ovld __cnfn convert_long3_sat_rtz(ulong3); long3 __ovld __cnfn convert_long3_rtp(ulong3); long3 __ovld __cnfn convert_long3_sat_rtp(ulong3); long3 __ovld __cnfn convert_long3_rtn(ulong3); long3 __ovld __cnfn convert_long3_sat_rtn(ulong3); long3 __ovld __cnfn convert_long3(ulong3); long3 __ovld __cnfn convert_long3_sat(ulong3); long3 __ovld __cnfn convert_long3_rte(float3); long3 __ovld __cnfn convert_long3_sat_rte(float3); long3 __ovld __cnfn convert_long3_rtz(float3); long3 __ovld __cnfn convert_long3_sat_rtz(float3); long3 __ovld __cnfn convert_long3_rtp(float3); long3 __ovld __cnfn convert_long3_sat_rtp(float3); long3 __ovld __cnfn convert_long3_rtn(float3); long3 __ovld __cnfn convert_long3_sat_rtn(float3); long3 __ovld __cnfn convert_long3(float3); long3 __ovld __cnfn convert_long3_sat(float3); ulong3 __ovld __cnfn convert_ulong3_rte(char3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(char3); ulong3 __ovld __cnfn convert_ulong3_rtz(char3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(char3); ulong3 __ovld __cnfn convert_ulong3_rtp(char3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(char3); ulong3 __ovld __cnfn convert_ulong3_rtn(char3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(char3); ulong3 __ovld __cnfn convert_ulong3(char3); ulong3 __ovld __cnfn convert_ulong3_sat(char3); ulong3 __ovld __cnfn convert_ulong3_rte(uchar3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(uchar3); ulong3 __ovld __cnfn convert_ulong3_rtz(uchar3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(uchar3); ulong3 __ovld __cnfn convert_ulong3_rtp(uchar3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(uchar3); ulong3 __ovld __cnfn convert_ulong3_rtn(uchar3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(uchar3); ulong3 __ovld __cnfn convert_ulong3(uchar3); ulong3 __ovld __cnfn convert_ulong3_sat(uchar3); ulong3 __ovld __cnfn convert_ulong3_rte(short3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(short3); ulong3 __ovld __cnfn convert_ulong3_rtz(short3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(short3); ulong3 __ovld __cnfn convert_ulong3_rtp(short3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(short3); ulong3 __ovld __cnfn convert_ulong3_rtn(short3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(short3); ulong3 __ovld __cnfn convert_ulong3(short3); ulong3 __ovld __cnfn convert_ulong3_sat(short3); ulong3 __ovld __cnfn convert_ulong3_rte(ushort3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(ushort3); ulong3 __ovld __cnfn convert_ulong3_rtz(ushort3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(ushort3); ulong3 __ovld __cnfn convert_ulong3_rtp(ushort3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(ushort3); ulong3 __ovld __cnfn convert_ulong3_rtn(ushort3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(ushort3); ulong3 __ovld __cnfn convert_ulong3(ushort3); ulong3 __ovld __cnfn convert_ulong3_sat(ushort3); ulong3 __ovld __cnfn convert_ulong3_rte(int3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(int3); ulong3 __ovld __cnfn convert_ulong3_rtz(int3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(int3); ulong3 __ovld __cnfn convert_ulong3_rtp(int3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(int3); ulong3 __ovld __cnfn convert_ulong3_rtn(int3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(int3); ulong3 __ovld __cnfn convert_ulong3(int3); ulong3 __ovld __cnfn convert_ulong3_sat(int3); ulong3 __ovld __cnfn convert_ulong3_rte(uint3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(uint3); ulong3 __ovld __cnfn convert_ulong3_rtz(uint3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(uint3); ulong3 __ovld __cnfn convert_ulong3_rtp(uint3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(uint3); ulong3 __ovld __cnfn convert_ulong3_rtn(uint3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(uint3); ulong3 __ovld __cnfn convert_ulong3(uint3); ulong3 __ovld __cnfn convert_ulong3_sat(uint3); ulong3 __ovld __cnfn convert_ulong3_rte(long3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(long3); ulong3 __ovld __cnfn convert_ulong3_rtz(long3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(long3); ulong3 __ovld __cnfn convert_ulong3_rtp(long3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(long3); ulong3 __ovld __cnfn convert_ulong3_rtn(long3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(long3); ulong3 __ovld __cnfn convert_ulong3(long3); ulong3 __ovld __cnfn convert_ulong3_sat(long3); ulong3 __ovld __cnfn convert_ulong3_rte(ulong3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(ulong3); ulong3 __ovld __cnfn convert_ulong3_rtz(ulong3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(ulong3); ulong3 __ovld __cnfn convert_ulong3_rtp(ulong3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(ulong3); ulong3 __ovld __cnfn convert_ulong3_rtn(ulong3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(ulong3); ulong3 __ovld __cnfn convert_ulong3(ulong3); ulong3 __ovld __cnfn convert_ulong3_sat(ulong3); ulong3 __ovld __cnfn convert_ulong3_rte(float3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(float3); ulong3 __ovld __cnfn convert_ulong3_rtz(float3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(float3); ulong3 __ovld __cnfn convert_ulong3_rtp(float3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(float3); ulong3 __ovld __cnfn convert_ulong3_rtn(float3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(float3); ulong3 __ovld __cnfn convert_ulong3(float3); ulong3 __ovld __cnfn convert_ulong3_sat(float3); float3 __ovld __cnfn convert_float3_rte(char3); float3 __ovld __cnfn convert_float3_rtz(char3); float3 __ovld __cnfn convert_float3_rtp(char3); float3 __ovld __cnfn convert_float3_rtn(char3); float3 __ovld __cnfn convert_float3(char3); float3 __ovld __cnfn convert_float3_rte(uchar3); float3 __ovld __cnfn convert_float3_rtz(uchar3); float3 __ovld __cnfn convert_float3_rtp(uchar3); float3 __ovld __cnfn convert_float3_rtn(uchar3); float3 __ovld __cnfn convert_float3(uchar3); float3 __ovld __cnfn convert_float3_rte(short3); float3 __ovld __cnfn convert_float3_rtz(short3); float3 __ovld __cnfn convert_float3_rtp(short3); float3 __ovld __cnfn convert_float3_rtn(short3); float3 __ovld __cnfn convert_float3(short3); float3 __ovld __cnfn convert_float3_rte(ushort3); float3 __ovld __cnfn convert_float3_rtz(ushort3); float3 __ovld __cnfn convert_float3_rtp(ushort3); float3 __ovld __cnfn convert_float3_rtn(ushort3); float3 __ovld __cnfn convert_float3(ushort3); float3 __ovld __cnfn convert_float3_rte(int3); float3 __ovld __cnfn convert_float3_rtz(int3); float3 __ovld __cnfn convert_float3_rtp(int3); float3 __ovld __cnfn convert_float3_rtn(int3); float3 __ovld __cnfn convert_float3(int3); float3 __ovld __cnfn convert_float3_rte(uint3); float3 __ovld __cnfn convert_float3_rtz(uint3); float3 __ovld __cnfn convert_float3_rtp(uint3); float3 __ovld __cnfn convert_float3_rtn(uint3); float3 __ovld __cnfn convert_float3(uint3); float3 __ovld __cnfn convert_float3_rte(long3); float3 __ovld __cnfn convert_float3_rtz(long3); float3 __ovld __cnfn convert_float3_rtp(long3); float3 __ovld __cnfn convert_float3_rtn(long3); float3 __ovld __cnfn convert_float3(long3); float3 __ovld __cnfn convert_float3_rte(ulong3); float3 __ovld __cnfn convert_float3_rtz(ulong3); float3 __ovld __cnfn convert_float3_rtp(ulong3); float3 __ovld __cnfn convert_float3_rtn(ulong3); float3 __ovld __cnfn convert_float3(ulong3); float3 __ovld __cnfn convert_float3_rte(float3); float3 __ovld __cnfn convert_float3_rtz(float3); float3 __ovld __cnfn convert_float3_rtp(float3); float3 __ovld __cnfn convert_float3_rtn(float3); float3 __ovld __cnfn convert_float3(float3); char4 __ovld __cnfn convert_char4_rte(char4); char4 __ovld __cnfn convert_char4_sat_rte(char4); char4 __ovld __cnfn convert_char4_rtz(char4); char4 __ovld __cnfn convert_char4_sat_rtz(char4); char4 __ovld __cnfn convert_char4_rtp(char4); char4 __ovld __cnfn convert_char4_sat_rtp(char4); char4 __ovld __cnfn convert_char4_rtn(char4); char4 __ovld __cnfn convert_char4_sat_rtn(char4); char4 __ovld __cnfn convert_char4(char4); char4 __ovld __cnfn convert_char4_sat(char4); char4 __ovld __cnfn convert_char4_rte(uchar4); char4 __ovld __cnfn convert_char4_sat_rte(uchar4); char4 __ovld __cnfn convert_char4_rtz(uchar4); char4 __ovld __cnfn convert_char4_sat_rtz(uchar4); char4 __ovld __cnfn convert_char4_rtp(uchar4); char4 __ovld __cnfn convert_char4_sat_rtp(uchar4); char4 __ovld __cnfn convert_char4_rtn(uchar4); char4 __ovld __cnfn convert_char4_sat_rtn(uchar4); char4 __ovld __cnfn convert_char4(uchar4); char4 __ovld __cnfn convert_char4_sat(uchar4); char4 __ovld __cnfn convert_char4_rte(short4); char4 __ovld __cnfn convert_char4_sat_rte(short4); char4 __ovld __cnfn convert_char4_rtz(short4); char4 __ovld __cnfn convert_char4_sat_rtz(short4); char4 __ovld __cnfn convert_char4_rtp(short4); char4 __ovld __cnfn convert_char4_sat_rtp(short4); char4 __ovld __cnfn convert_char4_rtn(short4); char4 __ovld __cnfn convert_char4_sat_rtn(short4); char4 __ovld __cnfn convert_char4(short4); char4 __ovld __cnfn convert_char4_sat(short4); char4 __ovld __cnfn convert_char4_rte(ushort4); char4 __ovld __cnfn convert_char4_sat_rte(ushort4); char4 __ovld __cnfn convert_char4_rtz(ushort4); char4 __ovld __cnfn convert_char4_sat_rtz(ushort4); char4 __ovld __cnfn convert_char4_rtp(ushort4); char4 __ovld __cnfn convert_char4_sat_rtp(ushort4); char4 __ovld __cnfn convert_char4_rtn(ushort4); char4 __ovld __cnfn convert_char4_sat_rtn(ushort4); char4 __ovld __cnfn convert_char4(ushort4); char4 __ovld __cnfn convert_char4_sat(ushort4); char4 __ovld __cnfn convert_char4_rte(int4); char4 __ovld __cnfn convert_char4_sat_rte(int4); char4 __ovld __cnfn convert_char4_rtz(int4); char4 __ovld __cnfn convert_char4_sat_rtz(int4); char4 __ovld __cnfn convert_char4_rtp(int4); char4 __ovld __cnfn convert_char4_sat_rtp(int4); char4 __ovld __cnfn convert_char4_rtn(int4); char4 __ovld __cnfn convert_char4_sat_rtn(int4); char4 __ovld __cnfn convert_char4(int4); char4 __ovld __cnfn convert_char4_sat(int4); char4 __ovld __cnfn convert_char4_rte(uint4); char4 __ovld __cnfn convert_char4_sat_rte(uint4); char4 __ovld __cnfn convert_char4_rtz(uint4); char4 __ovld __cnfn convert_char4_sat_rtz(uint4); char4 __ovld __cnfn convert_char4_rtp(uint4); char4 __ovld __cnfn convert_char4_sat_rtp(uint4); char4 __ovld __cnfn convert_char4_rtn(uint4); char4 __ovld __cnfn convert_char4_sat_rtn(uint4); char4 __ovld __cnfn convert_char4(uint4); char4 __ovld __cnfn convert_char4_sat(uint4); char4 __ovld __cnfn convert_char4_rte(long4); char4 __ovld __cnfn convert_char4_sat_rte(long4); char4 __ovld __cnfn convert_char4_rtz(long4); char4 __ovld __cnfn convert_char4_sat_rtz(long4); char4 __ovld __cnfn convert_char4_rtp(long4); char4 __ovld __cnfn convert_char4_sat_rtp(long4); char4 __ovld __cnfn convert_char4_rtn(long4); char4 __ovld __cnfn convert_char4_sat_rtn(long4); char4 __ovld __cnfn convert_char4(long4); char4 __ovld __cnfn convert_char4_sat(long4); char4 __ovld __cnfn convert_char4_rte(ulong4); char4 __ovld __cnfn convert_char4_sat_rte(ulong4); char4 __ovld __cnfn convert_char4_rtz(ulong4); char4 __ovld __cnfn convert_char4_sat_rtz(ulong4); char4 __ovld __cnfn convert_char4_rtp(ulong4); char4 __ovld __cnfn convert_char4_sat_rtp(ulong4); char4 __ovld __cnfn convert_char4_rtn(ulong4); char4 __ovld __cnfn convert_char4_sat_rtn(ulong4); char4 __ovld __cnfn convert_char4(ulong4); char4 __ovld __cnfn convert_char4_sat(ulong4); char4 __ovld __cnfn convert_char4_rte(float4); char4 __ovld __cnfn convert_char4_sat_rte(float4); char4 __ovld __cnfn convert_char4_rtz(float4); char4 __ovld __cnfn convert_char4_sat_rtz(float4); char4 __ovld __cnfn convert_char4_rtp(float4); char4 __ovld __cnfn convert_char4_sat_rtp(float4); char4 __ovld __cnfn convert_char4_rtn(float4); char4 __ovld __cnfn convert_char4_sat_rtn(float4); char4 __ovld __cnfn convert_char4(float4); char4 __ovld __cnfn convert_char4_sat(float4); uchar4 __ovld __cnfn convert_uchar4_rte(char4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(char4); uchar4 __ovld __cnfn convert_uchar4_rtz(char4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(char4); uchar4 __ovld __cnfn convert_uchar4_rtp(char4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(char4); uchar4 __ovld __cnfn convert_uchar4_rtn(char4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(char4); uchar4 __ovld __cnfn convert_uchar4(char4); uchar4 __ovld __cnfn convert_uchar4_sat(char4); uchar4 __ovld __cnfn convert_uchar4_rte(uchar4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(uchar4); uchar4 __ovld __cnfn convert_uchar4_rtz(uchar4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(uchar4); uchar4 __ovld __cnfn convert_uchar4_rtp(uchar4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(uchar4); uchar4 __ovld __cnfn convert_uchar4_rtn(uchar4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(uchar4); uchar4 __ovld __cnfn convert_uchar4(uchar4); uchar4 __ovld __cnfn convert_uchar4_sat(uchar4); uchar4 __ovld __cnfn convert_uchar4_rte(short4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(short4); uchar4 __ovld __cnfn convert_uchar4_rtz(short4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(short4); uchar4 __ovld __cnfn convert_uchar4_rtp(short4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(short4); uchar4 __ovld __cnfn convert_uchar4_rtn(short4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(short4); uchar4 __ovld __cnfn convert_uchar4(short4); uchar4 __ovld __cnfn convert_uchar4_sat(short4); uchar4 __ovld __cnfn convert_uchar4_rte(ushort4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(ushort4); uchar4 __ovld __cnfn convert_uchar4_rtz(ushort4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(ushort4); uchar4 __ovld __cnfn convert_uchar4_rtp(ushort4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(ushort4); uchar4 __ovld __cnfn convert_uchar4_rtn(ushort4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(ushort4); uchar4 __ovld __cnfn convert_uchar4(ushort4); uchar4 __ovld __cnfn convert_uchar4_sat(ushort4); uchar4 __ovld __cnfn convert_uchar4_rte(int4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(int4); uchar4 __ovld __cnfn convert_uchar4_rtz(int4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(int4); uchar4 __ovld __cnfn convert_uchar4_rtp(int4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(int4); uchar4 __ovld __cnfn convert_uchar4_rtn(int4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(int4); uchar4 __ovld __cnfn convert_uchar4(int4); uchar4 __ovld __cnfn convert_uchar4_sat(int4); uchar4 __ovld __cnfn convert_uchar4_rte(uint4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(uint4); uchar4 __ovld __cnfn convert_uchar4_rtz(uint4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(uint4); uchar4 __ovld __cnfn convert_uchar4_rtp(uint4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(uint4); uchar4 __ovld __cnfn convert_uchar4_rtn(uint4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(uint4); uchar4 __ovld __cnfn convert_uchar4(uint4); uchar4 __ovld __cnfn convert_uchar4_sat(uint4); uchar4 __ovld __cnfn convert_uchar4_rte(long4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(long4); uchar4 __ovld __cnfn convert_uchar4_rtz(long4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(long4); uchar4 __ovld __cnfn convert_uchar4_rtp(long4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(long4); uchar4 __ovld __cnfn convert_uchar4_rtn(long4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(long4); uchar4 __ovld __cnfn convert_uchar4(long4); uchar4 __ovld __cnfn convert_uchar4_sat(long4); uchar4 __ovld __cnfn convert_uchar4_rte(ulong4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(ulong4); uchar4 __ovld __cnfn convert_uchar4_rtz(ulong4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(ulong4); uchar4 __ovld __cnfn convert_uchar4_rtp(ulong4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(ulong4); uchar4 __ovld __cnfn convert_uchar4_rtn(ulong4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(ulong4); uchar4 __ovld __cnfn convert_uchar4(ulong4); uchar4 __ovld __cnfn convert_uchar4_sat(ulong4); uchar4 __ovld __cnfn convert_uchar4_rte(float4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(float4); uchar4 __ovld __cnfn convert_uchar4_rtz(float4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(float4); uchar4 __ovld __cnfn convert_uchar4_rtp(float4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(float4); uchar4 __ovld __cnfn convert_uchar4_rtn(float4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(float4); uchar4 __ovld __cnfn convert_uchar4(float4); uchar4 __ovld __cnfn convert_uchar4_sat(float4); short4 __ovld __cnfn convert_short4_rte(char4); short4 __ovld __cnfn convert_short4_sat_rte(char4); short4 __ovld __cnfn convert_short4_rtz(char4); short4 __ovld __cnfn convert_short4_sat_rtz(char4); short4 __ovld __cnfn convert_short4_rtp(char4); short4 __ovld __cnfn convert_short4_sat_rtp(char4); short4 __ovld __cnfn convert_short4_rtn(char4); short4 __ovld __cnfn convert_short4_sat_rtn(char4); short4 __ovld __cnfn convert_short4(char4); short4 __ovld __cnfn convert_short4_sat(char4); short4 __ovld __cnfn convert_short4_rte(uchar4); short4 __ovld __cnfn convert_short4_sat_rte(uchar4); short4 __ovld __cnfn convert_short4_rtz(uchar4); short4 __ovld __cnfn convert_short4_sat_rtz(uchar4); short4 __ovld __cnfn convert_short4_rtp(uchar4); short4 __ovld __cnfn convert_short4_sat_rtp(uchar4); short4 __ovld __cnfn convert_short4_rtn(uchar4); short4 __ovld __cnfn convert_short4_sat_rtn(uchar4); short4 __ovld __cnfn convert_short4(uchar4); short4 __ovld __cnfn convert_short4_sat(uchar4); short4 __ovld __cnfn convert_short4_rte(short4); short4 __ovld __cnfn convert_short4_sat_rte(short4); short4 __ovld __cnfn convert_short4_rtz(short4); short4 __ovld __cnfn convert_short4_sat_rtz(short4); short4 __ovld __cnfn convert_short4_rtp(short4); short4 __ovld __cnfn convert_short4_sat_rtp(short4); short4 __ovld __cnfn convert_short4_rtn(short4); short4 __ovld __cnfn convert_short4_sat_rtn(short4); short4 __ovld __cnfn convert_short4(short4); short4 __ovld __cnfn convert_short4_sat(short4); short4 __ovld __cnfn convert_short4_rte(ushort4); short4 __ovld __cnfn convert_short4_sat_rte(ushort4); short4 __ovld __cnfn convert_short4_rtz(ushort4); short4 __ovld __cnfn convert_short4_sat_rtz(ushort4); short4 __ovld __cnfn convert_short4_rtp(ushort4); short4 __ovld __cnfn convert_short4_sat_rtp(ushort4); short4 __ovld __cnfn convert_short4_rtn(ushort4); short4 __ovld __cnfn convert_short4_sat_rtn(ushort4); short4 __ovld __cnfn convert_short4(ushort4); short4 __ovld __cnfn convert_short4_sat(ushort4); short4 __ovld __cnfn convert_short4_rte(int4); short4 __ovld __cnfn convert_short4_sat_rte(int4); short4 __ovld __cnfn convert_short4_rtz(int4); short4 __ovld __cnfn convert_short4_sat_rtz(int4); short4 __ovld __cnfn convert_short4_rtp(int4); short4 __ovld __cnfn convert_short4_sat_rtp(int4); short4 __ovld __cnfn convert_short4_rtn(int4); short4 __ovld __cnfn convert_short4_sat_rtn(int4); short4 __ovld __cnfn convert_short4(int4); short4 __ovld __cnfn convert_short4_sat(int4); short4 __ovld __cnfn convert_short4_rte(uint4); short4 __ovld __cnfn convert_short4_sat_rte(uint4); short4 __ovld __cnfn convert_short4_rtz(uint4); short4 __ovld __cnfn convert_short4_sat_rtz(uint4); short4 __ovld __cnfn convert_short4_rtp(uint4); short4 __ovld __cnfn convert_short4_sat_rtp(uint4); short4 __ovld __cnfn convert_short4_rtn(uint4); short4 __ovld __cnfn convert_short4_sat_rtn(uint4); short4 __ovld __cnfn convert_short4(uint4); short4 __ovld __cnfn convert_short4_sat(uint4); short4 __ovld __cnfn convert_short4_rte(long4); short4 __ovld __cnfn convert_short4_sat_rte(long4); short4 __ovld __cnfn convert_short4_rtz(long4); short4 __ovld __cnfn convert_short4_sat_rtz(long4); short4 __ovld __cnfn convert_short4_rtp(long4); short4 __ovld __cnfn convert_short4_sat_rtp(long4); short4 __ovld __cnfn convert_short4_rtn(long4); short4 __ovld __cnfn convert_short4_sat_rtn(long4); short4 __ovld __cnfn convert_short4(long4); short4 __ovld __cnfn convert_short4_sat(long4); short4 __ovld __cnfn convert_short4_rte(ulong4); short4 __ovld __cnfn convert_short4_sat_rte(ulong4); short4 __ovld __cnfn convert_short4_rtz(ulong4); short4 __ovld __cnfn convert_short4_sat_rtz(ulong4); short4 __ovld __cnfn convert_short4_rtp(ulong4); short4 __ovld __cnfn convert_short4_sat_rtp(ulong4); short4 __ovld __cnfn convert_short4_rtn(ulong4); short4 __ovld __cnfn convert_short4_sat_rtn(ulong4); short4 __ovld __cnfn convert_short4(ulong4); short4 __ovld __cnfn convert_short4_sat(ulong4); short4 __ovld __cnfn convert_short4_rte(float4); short4 __ovld __cnfn convert_short4_sat_rte(float4); short4 __ovld __cnfn convert_short4_rtz(float4); short4 __ovld __cnfn convert_short4_sat_rtz(float4); short4 __ovld __cnfn convert_short4_rtp(float4); short4 __ovld __cnfn convert_short4_sat_rtp(float4); short4 __ovld __cnfn convert_short4_rtn(float4); short4 __ovld __cnfn convert_short4_sat_rtn(float4); short4 __ovld __cnfn convert_short4(float4); short4 __ovld __cnfn convert_short4_sat(float4); ushort4 __ovld __cnfn convert_ushort4_rte(char4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(char4); ushort4 __ovld __cnfn convert_ushort4_rtz(char4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(char4); ushort4 __ovld __cnfn convert_ushort4_rtp(char4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(char4); ushort4 __ovld __cnfn convert_ushort4_rtn(char4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(char4); ushort4 __ovld __cnfn convert_ushort4(char4); ushort4 __ovld __cnfn convert_ushort4_sat(char4); ushort4 __ovld __cnfn convert_ushort4_rte(uchar4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(uchar4); ushort4 __ovld __cnfn convert_ushort4_rtz(uchar4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(uchar4); ushort4 __ovld __cnfn convert_ushort4_rtp(uchar4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(uchar4); ushort4 __ovld __cnfn convert_ushort4_rtn(uchar4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(uchar4); ushort4 __ovld __cnfn convert_ushort4(uchar4); ushort4 __ovld __cnfn convert_ushort4_sat(uchar4); ushort4 __ovld __cnfn convert_ushort4_rte(short4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(short4); ushort4 __ovld __cnfn convert_ushort4_rtz(short4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(short4); ushort4 __ovld __cnfn convert_ushort4_rtp(short4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(short4); ushort4 __ovld __cnfn convert_ushort4_rtn(short4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(short4); ushort4 __ovld __cnfn convert_ushort4(short4); ushort4 __ovld __cnfn convert_ushort4_sat(short4); ushort4 __ovld __cnfn convert_ushort4_rte(ushort4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(ushort4); ushort4 __ovld __cnfn convert_ushort4_rtz(ushort4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(ushort4); ushort4 __ovld __cnfn convert_ushort4_rtp(ushort4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(ushort4); ushort4 __ovld __cnfn convert_ushort4_rtn(ushort4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(ushort4); ushort4 __ovld __cnfn convert_ushort4(ushort4); ushort4 __ovld __cnfn convert_ushort4_sat(ushort4); ushort4 __ovld __cnfn convert_ushort4_rte(int4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(int4); ushort4 __ovld __cnfn convert_ushort4_rtz(int4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(int4); ushort4 __ovld __cnfn convert_ushort4_rtp(int4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(int4); ushort4 __ovld __cnfn convert_ushort4_rtn(int4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(int4); ushort4 __ovld __cnfn convert_ushort4(int4); ushort4 __ovld __cnfn convert_ushort4_sat(int4); ushort4 __ovld __cnfn convert_ushort4_rte(uint4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(uint4); ushort4 __ovld __cnfn convert_ushort4_rtz(uint4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(uint4); ushort4 __ovld __cnfn convert_ushort4_rtp(uint4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(uint4); ushort4 __ovld __cnfn convert_ushort4_rtn(uint4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(uint4); ushort4 __ovld __cnfn convert_ushort4(uint4); ushort4 __ovld __cnfn convert_ushort4_sat(uint4); ushort4 __ovld __cnfn convert_ushort4_rte(long4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(long4); ushort4 __ovld __cnfn convert_ushort4_rtz(long4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(long4); ushort4 __ovld __cnfn convert_ushort4_rtp(long4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(long4); ushort4 __ovld __cnfn convert_ushort4_rtn(long4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(long4); ushort4 __ovld __cnfn convert_ushort4(long4); ushort4 __ovld __cnfn convert_ushort4_sat(long4); ushort4 __ovld __cnfn convert_ushort4_rte(ulong4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(ulong4); ushort4 __ovld __cnfn convert_ushort4_rtz(ulong4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(ulong4); ushort4 __ovld __cnfn convert_ushort4_rtp(ulong4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(ulong4); ushort4 __ovld __cnfn convert_ushort4_rtn(ulong4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(ulong4); ushort4 __ovld __cnfn convert_ushort4(ulong4); ushort4 __ovld __cnfn convert_ushort4_sat(ulong4); ushort4 __ovld __cnfn convert_ushort4_rte(float4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(float4); ushort4 __ovld __cnfn convert_ushort4_rtz(float4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(float4); ushort4 __ovld __cnfn convert_ushort4_rtp(float4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(float4); ushort4 __ovld __cnfn convert_ushort4_rtn(float4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(float4); ushort4 __ovld __cnfn convert_ushort4(float4); ushort4 __ovld __cnfn convert_ushort4_sat(float4); int4 __ovld __cnfn convert_int4_rte(char4); int4 __ovld __cnfn convert_int4_sat_rte(char4); int4 __ovld __cnfn convert_int4_rtz(char4); int4 __ovld __cnfn convert_int4_sat_rtz(char4); int4 __ovld __cnfn convert_int4_rtp(char4); int4 __ovld __cnfn convert_int4_sat_rtp(char4); int4 __ovld __cnfn convert_int4_rtn(char4); int4 __ovld __cnfn convert_int4_sat_rtn(char4); int4 __ovld __cnfn convert_int4(char4); int4 __ovld __cnfn convert_int4_sat(char4); int4 __ovld __cnfn convert_int4_rte(uchar4); int4 __ovld __cnfn convert_int4_sat_rte(uchar4); int4 __ovld __cnfn convert_int4_rtz(uchar4); int4 __ovld __cnfn convert_int4_sat_rtz(uchar4); int4 __ovld __cnfn convert_int4_rtp(uchar4); int4 __ovld __cnfn convert_int4_sat_rtp(uchar4); int4 __ovld __cnfn convert_int4_rtn(uchar4); int4 __ovld __cnfn convert_int4_sat_rtn(uchar4); int4 __ovld __cnfn convert_int4(uchar4); int4 __ovld __cnfn convert_int4_sat(uchar4); int4 __ovld __cnfn convert_int4_rte(short4); int4 __ovld __cnfn convert_int4_sat_rte(short4); int4 __ovld __cnfn convert_int4_rtz(short4); int4 __ovld __cnfn convert_int4_sat_rtz(short4); int4 __ovld __cnfn convert_int4_rtp(short4); int4 __ovld __cnfn convert_int4_sat_rtp(short4); int4 __ovld __cnfn convert_int4_rtn(short4); int4 __ovld __cnfn convert_int4_sat_rtn(short4); int4 __ovld __cnfn convert_int4(short4); int4 __ovld __cnfn convert_int4_sat(short4); int4 __ovld __cnfn convert_int4_rte(ushort4); int4 __ovld __cnfn convert_int4_sat_rte(ushort4); int4 __ovld __cnfn convert_int4_rtz(ushort4); int4 __ovld __cnfn convert_int4_sat_rtz(ushort4); int4 __ovld __cnfn convert_int4_rtp(ushort4); int4 __ovld __cnfn convert_int4_sat_rtp(ushort4); int4 __ovld __cnfn convert_int4_rtn(ushort4); int4 __ovld __cnfn convert_int4_sat_rtn(ushort4); int4 __ovld __cnfn convert_int4(ushort4); int4 __ovld __cnfn convert_int4_sat(ushort4); int4 __ovld __cnfn convert_int4_rte(int4); int4 __ovld __cnfn convert_int4_sat_rte(int4); int4 __ovld __cnfn convert_int4_rtz(int4); int4 __ovld __cnfn convert_int4_sat_rtz(int4); int4 __ovld __cnfn convert_int4_rtp(int4); int4 __ovld __cnfn convert_int4_sat_rtp(int4); int4 __ovld __cnfn convert_int4_rtn(int4); int4 __ovld __cnfn convert_int4_sat_rtn(int4); int4 __ovld __cnfn convert_int4(int4); int4 __ovld __cnfn convert_int4_sat(int4); int4 __ovld __cnfn convert_int4_rte(uint4); int4 __ovld __cnfn convert_int4_sat_rte(uint4); int4 __ovld __cnfn convert_int4_rtz(uint4); int4 __ovld __cnfn convert_int4_sat_rtz(uint4); int4 __ovld __cnfn convert_int4_rtp(uint4); int4 __ovld __cnfn convert_int4_sat_rtp(uint4); int4 __ovld __cnfn convert_int4_rtn(uint4); int4 __ovld __cnfn convert_int4_sat_rtn(uint4); int4 __ovld __cnfn convert_int4(uint4); int4 __ovld __cnfn convert_int4_sat(uint4); int4 __ovld __cnfn convert_int4_rte(long4); int4 __ovld __cnfn convert_int4_sat_rte(long4); int4 __ovld __cnfn convert_int4_rtz(long4); int4 __ovld __cnfn convert_int4_sat_rtz(long4); int4 __ovld __cnfn convert_int4_rtp(long4); int4 __ovld __cnfn convert_int4_sat_rtp(long4); int4 __ovld __cnfn convert_int4_rtn(long4); int4 __ovld __cnfn convert_int4_sat_rtn(long4); int4 __ovld __cnfn convert_int4(long4); int4 __ovld __cnfn convert_int4_sat(long4); int4 __ovld __cnfn convert_int4_rte(ulong4); int4 __ovld __cnfn convert_int4_sat_rte(ulong4); int4 __ovld __cnfn convert_int4_rtz(ulong4); int4 __ovld __cnfn convert_int4_sat_rtz(ulong4); int4 __ovld __cnfn convert_int4_rtp(ulong4); int4 __ovld __cnfn convert_int4_sat_rtp(ulong4); int4 __ovld __cnfn convert_int4_rtn(ulong4); int4 __ovld __cnfn convert_int4_sat_rtn(ulong4); int4 __ovld __cnfn convert_int4(ulong4); int4 __ovld __cnfn convert_int4_sat(ulong4); int4 __ovld __cnfn convert_int4_rte(float4); int4 __ovld __cnfn convert_int4_sat_rte(float4); int4 __ovld __cnfn convert_int4_rtz(float4); int4 __ovld __cnfn convert_int4_sat_rtz(float4); int4 __ovld __cnfn convert_int4_rtp(float4); int4 __ovld __cnfn convert_int4_sat_rtp(float4); int4 __ovld __cnfn convert_int4_rtn(float4); int4 __ovld __cnfn convert_int4_sat_rtn(float4); int4 __ovld __cnfn convert_int4(float4); int4 __ovld __cnfn convert_int4_sat(float4); uint4 __ovld __cnfn convert_uint4_rte(char4); uint4 __ovld __cnfn convert_uint4_sat_rte(char4); uint4 __ovld __cnfn convert_uint4_rtz(char4); uint4 __ovld __cnfn convert_uint4_sat_rtz(char4); uint4 __ovld __cnfn convert_uint4_rtp(char4); uint4 __ovld __cnfn convert_uint4_sat_rtp(char4); uint4 __ovld __cnfn convert_uint4_rtn(char4); uint4 __ovld __cnfn convert_uint4_sat_rtn(char4); uint4 __ovld __cnfn convert_uint4(char4); uint4 __ovld __cnfn convert_uint4_sat(char4); uint4 __ovld __cnfn convert_uint4_rte(uchar4); uint4 __ovld __cnfn convert_uint4_sat_rte(uchar4); uint4 __ovld __cnfn convert_uint4_rtz(uchar4); uint4 __ovld __cnfn convert_uint4_sat_rtz(uchar4); uint4 __ovld __cnfn convert_uint4_rtp(uchar4); uint4 __ovld __cnfn convert_uint4_sat_rtp(uchar4); uint4 __ovld __cnfn convert_uint4_rtn(uchar4); uint4 __ovld __cnfn convert_uint4_sat_rtn(uchar4); uint4 __ovld __cnfn convert_uint4(uchar4); uint4 __ovld __cnfn convert_uint4_sat(uchar4); uint4 __ovld __cnfn convert_uint4_rte(short4); uint4 __ovld __cnfn convert_uint4_sat_rte(short4); uint4 __ovld __cnfn convert_uint4_rtz(short4); uint4 __ovld __cnfn convert_uint4_sat_rtz(short4); uint4 __ovld __cnfn convert_uint4_rtp(short4); uint4 __ovld __cnfn convert_uint4_sat_rtp(short4); uint4 __ovld __cnfn convert_uint4_rtn(short4); uint4 __ovld __cnfn convert_uint4_sat_rtn(short4); uint4 __ovld __cnfn convert_uint4(short4); uint4 __ovld __cnfn convert_uint4_sat(short4); uint4 __ovld __cnfn convert_uint4_rte(ushort4); uint4 __ovld __cnfn convert_uint4_sat_rte(ushort4); uint4 __ovld __cnfn convert_uint4_rtz(ushort4); uint4 __ovld __cnfn convert_uint4_sat_rtz(ushort4); uint4 __ovld __cnfn convert_uint4_rtp(ushort4); uint4 __ovld __cnfn convert_uint4_sat_rtp(ushort4); uint4 __ovld __cnfn convert_uint4_rtn(ushort4); uint4 __ovld __cnfn convert_uint4_sat_rtn(ushort4); uint4 __ovld __cnfn convert_uint4(ushort4); uint4 __ovld __cnfn convert_uint4_sat(ushort4); uint4 __ovld __cnfn convert_uint4_rte(int4); uint4 __ovld __cnfn convert_uint4_sat_rte(int4); uint4 __ovld __cnfn convert_uint4_rtz(int4); uint4 __ovld __cnfn convert_uint4_sat_rtz(int4); uint4 __ovld __cnfn convert_uint4_rtp(int4); uint4 __ovld __cnfn convert_uint4_sat_rtp(int4); uint4 __ovld __cnfn convert_uint4_rtn(int4); uint4 __ovld __cnfn convert_uint4_sat_rtn(int4); uint4 __ovld __cnfn convert_uint4(int4); uint4 __ovld __cnfn convert_uint4_sat(int4); uint4 __ovld __cnfn convert_uint4_rte(uint4); uint4 __ovld __cnfn convert_uint4_sat_rte(uint4); uint4 __ovld __cnfn convert_uint4_rtz(uint4); uint4 __ovld __cnfn convert_uint4_sat_rtz(uint4); uint4 __ovld __cnfn convert_uint4_rtp(uint4); uint4 __ovld __cnfn convert_uint4_sat_rtp(uint4); uint4 __ovld __cnfn convert_uint4_rtn(uint4); uint4 __ovld __cnfn convert_uint4_sat_rtn(uint4); uint4 __ovld __cnfn convert_uint4(uint4); uint4 __ovld __cnfn convert_uint4_sat(uint4); uint4 __ovld __cnfn convert_uint4_rte(long4); uint4 __ovld __cnfn convert_uint4_sat_rte(long4); uint4 __ovld __cnfn convert_uint4_rtz(long4); uint4 __ovld __cnfn convert_uint4_sat_rtz(long4); uint4 __ovld __cnfn convert_uint4_rtp(long4); uint4 __ovld __cnfn convert_uint4_sat_rtp(long4); uint4 __ovld __cnfn convert_uint4_rtn(long4); uint4 __ovld __cnfn convert_uint4_sat_rtn(long4); uint4 __ovld __cnfn convert_uint4(long4); uint4 __ovld __cnfn convert_uint4_sat(long4); uint4 __ovld __cnfn convert_uint4_rte(ulong4); uint4 __ovld __cnfn convert_uint4_sat_rte(ulong4); uint4 __ovld __cnfn convert_uint4_rtz(ulong4); uint4 __ovld __cnfn convert_uint4_sat_rtz(ulong4); uint4 __ovld __cnfn convert_uint4_rtp(ulong4); uint4 __ovld __cnfn convert_uint4_sat_rtp(ulong4); uint4 __ovld __cnfn convert_uint4_rtn(ulong4); uint4 __ovld __cnfn convert_uint4_sat_rtn(ulong4); uint4 __ovld __cnfn convert_uint4(ulong4); uint4 __ovld __cnfn convert_uint4_sat(ulong4); uint4 __ovld __cnfn convert_uint4_rte(float4); uint4 __ovld __cnfn convert_uint4_sat_rte(float4); uint4 __ovld __cnfn convert_uint4_rtz(float4); uint4 __ovld __cnfn convert_uint4_sat_rtz(float4); uint4 __ovld __cnfn convert_uint4_rtp(float4); uint4 __ovld __cnfn convert_uint4_sat_rtp(float4); uint4 __ovld __cnfn convert_uint4_rtn(float4); uint4 __ovld __cnfn convert_uint4_sat_rtn(float4); uint4 __ovld __cnfn convert_uint4(float4); uint4 __ovld __cnfn convert_uint4_sat(float4); long4 __ovld __cnfn convert_long4_rte(char4); long4 __ovld __cnfn convert_long4_sat_rte(char4); long4 __ovld __cnfn convert_long4_rtz(char4); long4 __ovld __cnfn convert_long4_sat_rtz(char4); long4 __ovld __cnfn convert_long4_rtp(char4); long4 __ovld __cnfn convert_long4_sat_rtp(char4); long4 __ovld __cnfn convert_long4_rtn(char4); long4 __ovld __cnfn convert_long4_sat_rtn(char4); long4 __ovld __cnfn convert_long4(char4); long4 __ovld __cnfn convert_long4_sat(char4); long4 __ovld __cnfn convert_long4_rte(uchar4); long4 __ovld __cnfn convert_long4_sat_rte(uchar4); long4 __ovld __cnfn convert_long4_rtz(uchar4); long4 __ovld __cnfn convert_long4_sat_rtz(uchar4); long4 __ovld __cnfn convert_long4_rtp(uchar4); long4 __ovld __cnfn convert_long4_sat_rtp(uchar4); long4 __ovld __cnfn convert_long4_rtn(uchar4); long4 __ovld __cnfn convert_long4_sat_rtn(uchar4); long4 __ovld __cnfn convert_long4(uchar4); long4 __ovld __cnfn convert_long4_sat(uchar4); long4 __ovld __cnfn convert_long4_rte(short4); long4 __ovld __cnfn convert_long4_sat_rte(short4); long4 __ovld __cnfn convert_long4_rtz(short4); long4 __ovld __cnfn convert_long4_sat_rtz(short4); long4 __ovld __cnfn convert_long4_rtp(short4); long4 __ovld __cnfn convert_long4_sat_rtp(short4); long4 __ovld __cnfn convert_long4_rtn(short4); long4 __ovld __cnfn convert_long4_sat_rtn(short4); long4 __ovld __cnfn convert_long4(short4); long4 __ovld __cnfn convert_long4_sat(short4); long4 __ovld __cnfn convert_long4_rte(ushort4); long4 __ovld __cnfn convert_long4_sat_rte(ushort4); long4 __ovld __cnfn convert_long4_rtz(ushort4); long4 __ovld __cnfn convert_long4_sat_rtz(ushort4); long4 __ovld __cnfn convert_long4_rtp(ushort4); long4 __ovld __cnfn convert_long4_sat_rtp(ushort4); long4 __ovld __cnfn convert_long4_rtn(ushort4); long4 __ovld __cnfn convert_long4_sat_rtn(ushort4); long4 __ovld __cnfn convert_long4(ushort4); long4 __ovld __cnfn convert_long4_sat(ushort4); long4 __ovld __cnfn convert_long4_rte(int4); long4 __ovld __cnfn convert_long4_sat_rte(int4); long4 __ovld __cnfn convert_long4_rtz(int4); long4 __ovld __cnfn convert_long4_sat_rtz(int4); long4 __ovld __cnfn convert_long4_rtp(int4); long4 __ovld __cnfn convert_long4_sat_rtp(int4); long4 __ovld __cnfn convert_long4_rtn(int4); long4 __ovld __cnfn convert_long4_sat_rtn(int4); long4 __ovld __cnfn convert_long4(int4); long4 __ovld __cnfn convert_long4_sat(int4); long4 __ovld __cnfn convert_long4_rte(uint4); long4 __ovld __cnfn convert_long4_sat_rte(uint4); long4 __ovld __cnfn convert_long4_rtz(uint4); long4 __ovld __cnfn convert_long4_sat_rtz(uint4); long4 __ovld __cnfn convert_long4_rtp(uint4); long4 __ovld __cnfn convert_long4_sat_rtp(uint4); long4 __ovld __cnfn convert_long4_rtn(uint4); long4 __ovld __cnfn convert_long4_sat_rtn(uint4); long4 __ovld __cnfn convert_long4(uint4); long4 __ovld __cnfn convert_long4_sat(uint4); long4 __ovld __cnfn convert_long4_rte(long4); long4 __ovld __cnfn convert_long4_sat_rte(long4); long4 __ovld __cnfn convert_long4_rtz(long4); long4 __ovld __cnfn convert_long4_sat_rtz(long4); long4 __ovld __cnfn convert_long4_rtp(long4); long4 __ovld __cnfn convert_long4_sat_rtp(long4); long4 __ovld __cnfn convert_long4_rtn(long4); long4 __ovld __cnfn convert_long4_sat_rtn(long4); long4 __ovld __cnfn convert_long4(long4); long4 __ovld __cnfn convert_long4_sat(long4); long4 __ovld __cnfn convert_long4_rte(ulong4); long4 __ovld __cnfn convert_long4_sat_rte(ulong4); long4 __ovld __cnfn convert_long4_rtz(ulong4); long4 __ovld __cnfn convert_long4_sat_rtz(ulong4); long4 __ovld __cnfn convert_long4_rtp(ulong4); long4 __ovld __cnfn convert_long4_sat_rtp(ulong4); long4 __ovld __cnfn convert_long4_rtn(ulong4); long4 __ovld __cnfn convert_long4_sat_rtn(ulong4); long4 __ovld __cnfn convert_long4(ulong4); long4 __ovld __cnfn convert_long4_sat(ulong4); long4 __ovld __cnfn convert_long4_rte(float4); long4 __ovld __cnfn convert_long4_sat_rte(float4); long4 __ovld __cnfn convert_long4_rtz(float4); long4 __ovld __cnfn convert_long4_sat_rtz(float4); long4 __ovld __cnfn convert_long4_rtp(float4); long4 __ovld __cnfn convert_long4_sat_rtp(float4); long4 __ovld __cnfn convert_long4_rtn(float4); long4 __ovld __cnfn convert_long4_sat_rtn(float4); long4 __ovld __cnfn convert_long4(float4); long4 __ovld __cnfn convert_long4_sat(float4); ulong4 __ovld __cnfn convert_ulong4_rte(char4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(char4); ulong4 __ovld __cnfn convert_ulong4_rtz(char4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(char4); ulong4 __ovld __cnfn convert_ulong4_rtp(char4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(char4); ulong4 __ovld __cnfn convert_ulong4_rtn(char4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(char4); ulong4 __ovld __cnfn convert_ulong4(char4); ulong4 __ovld __cnfn convert_ulong4_sat(char4); ulong4 __ovld __cnfn convert_ulong4_rte(uchar4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(uchar4); ulong4 __ovld __cnfn convert_ulong4_rtz(uchar4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(uchar4); ulong4 __ovld __cnfn convert_ulong4_rtp(uchar4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(uchar4); ulong4 __ovld __cnfn convert_ulong4_rtn(uchar4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(uchar4); ulong4 __ovld __cnfn convert_ulong4(uchar4); ulong4 __ovld __cnfn convert_ulong4_sat(uchar4); ulong4 __ovld __cnfn convert_ulong4_rte(short4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(short4); ulong4 __ovld __cnfn convert_ulong4_rtz(short4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(short4); ulong4 __ovld __cnfn convert_ulong4_rtp(short4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(short4); ulong4 __ovld __cnfn convert_ulong4_rtn(short4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(short4); ulong4 __ovld __cnfn convert_ulong4(short4); ulong4 __ovld __cnfn convert_ulong4_sat(short4); ulong4 __ovld __cnfn convert_ulong4_rte(ushort4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(ushort4); ulong4 __ovld __cnfn convert_ulong4_rtz(ushort4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(ushort4); ulong4 __ovld __cnfn convert_ulong4_rtp(ushort4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(ushort4); ulong4 __ovld __cnfn convert_ulong4_rtn(ushort4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(ushort4); ulong4 __ovld __cnfn convert_ulong4(ushort4); ulong4 __ovld __cnfn convert_ulong4_sat(ushort4); ulong4 __ovld __cnfn convert_ulong4_rte(int4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(int4); ulong4 __ovld __cnfn convert_ulong4_rtz(int4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(int4); ulong4 __ovld __cnfn convert_ulong4_rtp(int4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(int4); ulong4 __ovld __cnfn convert_ulong4_rtn(int4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(int4); ulong4 __ovld __cnfn convert_ulong4(int4); ulong4 __ovld __cnfn convert_ulong4_sat(int4); ulong4 __ovld __cnfn convert_ulong4_rte(uint4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(uint4); ulong4 __ovld __cnfn convert_ulong4_rtz(uint4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(uint4); ulong4 __ovld __cnfn convert_ulong4_rtp(uint4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(uint4); ulong4 __ovld __cnfn convert_ulong4_rtn(uint4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(uint4); ulong4 __ovld __cnfn convert_ulong4(uint4); ulong4 __ovld __cnfn convert_ulong4_sat(uint4); ulong4 __ovld __cnfn convert_ulong4_rte(long4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(long4); ulong4 __ovld __cnfn convert_ulong4_rtz(long4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(long4); ulong4 __ovld __cnfn convert_ulong4_rtp(long4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(long4); ulong4 __ovld __cnfn convert_ulong4_rtn(long4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(long4); ulong4 __ovld __cnfn convert_ulong4(long4); ulong4 __ovld __cnfn convert_ulong4_sat(long4); ulong4 __ovld __cnfn convert_ulong4_rte(ulong4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(ulong4); ulong4 __ovld __cnfn convert_ulong4_rtz(ulong4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(ulong4); ulong4 __ovld __cnfn convert_ulong4_rtp(ulong4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(ulong4); ulong4 __ovld __cnfn convert_ulong4_rtn(ulong4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(ulong4); ulong4 __ovld __cnfn convert_ulong4(ulong4); ulong4 __ovld __cnfn convert_ulong4_sat(ulong4); ulong4 __ovld __cnfn convert_ulong4_rte(float4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(float4); ulong4 __ovld __cnfn convert_ulong4_rtz(float4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(float4); ulong4 __ovld __cnfn convert_ulong4_rtp(float4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(float4); ulong4 __ovld __cnfn convert_ulong4_rtn(float4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(float4); ulong4 __ovld __cnfn convert_ulong4(float4); ulong4 __ovld __cnfn convert_ulong4_sat(float4); float4 __ovld __cnfn convert_float4_rte(char4); float4 __ovld __cnfn convert_float4_rtz(char4); float4 __ovld __cnfn convert_float4_rtp(char4); float4 __ovld __cnfn convert_float4_rtn(char4); float4 __ovld __cnfn convert_float4(char4); float4 __ovld __cnfn convert_float4_rte(uchar4); float4 __ovld __cnfn convert_float4_rtz(uchar4); float4 __ovld __cnfn convert_float4_rtp(uchar4); float4 __ovld __cnfn convert_float4_rtn(uchar4); float4 __ovld __cnfn convert_float4(uchar4); float4 __ovld __cnfn convert_float4_rte(short4); float4 __ovld __cnfn convert_float4_rtz(short4); float4 __ovld __cnfn convert_float4_rtp(short4); float4 __ovld __cnfn convert_float4_rtn(short4); float4 __ovld __cnfn convert_float4(short4); float4 __ovld __cnfn convert_float4_rte(ushort4); float4 __ovld __cnfn convert_float4_rtz(ushort4); float4 __ovld __cnfn convert_float4_rtp(ushort4); float4 __ovld __cnfn convert_float4_rtn(ushort4); float4 __ovld __cnfn convert_float4(ushort4); float4 __ovld __cnfn convert_float4_rte(int4); float4 __ovld __cnfn convert_float4_rtz(int4); float4 __ovld __cnfn convert_float4_rtp(int4); float4 __ovld __cnfn convert_float4_rtn(int4); float4 __ovld __cnfn convert_float4(int4); float4 __ovld __cnfn convert_float4_rte(uint4); float4 __ovld __cnfn convert_float4_rtz(uint4); float4 __ovld __cnfn convert_float4_rtp(uint4); float4 __ovld __cnfn convert_float4_rtn(uint4); float4 __ovld __cnfn convert_float4(uint4); float4 __ovld __cnfn convert_float4_rte(long4); float4 __ovld __cnfn convert_float4_rtz(long4); float4 __ovld __cnfn convert_float4_rtp(long4); float4 __ovld __cnfn convert_float4_rtn(long4); float4 __ovld __cnfn convert_float4(long4); float4 __ovld __cnfn convert_float4_rte(ulong4); float4 __ovld __cnfn convert_float4_rtz(ulong4); float4 __ovld __cnfn convert_float4_rtp(ulong4); float4 __ovld __cnfn convert_float4_rtn(ulong4); float4 __ovld __cnfn convert_float4(ulong4); float4 __ovld __cnfn convert_float4_rte(float4); float4 __ovld __cnfn convert_float4_rtz(float4); float4 __ovld __cnfn convert_float4_rtp(float4); float4 __ovld __cnfn convert_float4_rtn(float4); float4 __ovld __cnfn convert_float4(float4); char8 __ovld __cnfn convert_char8_rte(char8); char8 __ovld __cnfn convert_char8_sat_rte(char8); char8 __ovld __cnfn convert_char8_rtz(char8); char8 __ovld __cnfn convert_char8_sat_rtz(char8); char8 __ovld __cnfn convert_char8_rtp(char8); char8 __ovld __cnfn convert_char8_sat_rtp(char8); char8 __ovld __cnfn convert_char8_rtn(char8); char8 __ovld __cnfn convert_char8_sat_rtn(char8); char8 __ovld __cnfn convert_char8(char8); char8 __ovld __cnfn convert_char8_sat(char8); char8 __ovld __cnfn convert_char8_rte(uchar8); char8 __ovld __cnfn convert_char8_sat_rte(uchar8); char8 __ovld __cnfn convert_char8_rtz(uchar8); char8 __ovld __cnfn convert_char8_sat_rtz(uchar8); char8 __ovld __cnfn convert_char8_rtp(uchar8); char8 __ovld __cnfn convert_char8_sat_rtp(uchar8); char8 __ovld __cnfn convert_char8_rtn(uchar8); char8 __ovld __cnfn convert_char8_sat_rtn(uchar8); char8 __ovld __cnfn convert_char8(uchar8); char8 __ovld __cnfn convert_char8_sat(uchar8); char8 __ovld __cnfn convert_char8_rte(short8); char8 __ovld __cnfn convert_char8_sat_rte(short8); char8 __ovld __cnfn convert_char8_rtz(short8); char8 __ovld __cnfn convert_char8_sat_rtz(short8); char8 __ovld __cnfn convert_char8_rtp(short8); char8 __ovld __cnfn convert_char8_sat_rtp(short8); char8 __ovld __cnfn convert_char8_rtn(short8); char8 __ovld __cnfn convert_char8_sat_rtn(short8); char8 __ovld __cnfn convert_char8(short8); char8 __ovld __cnfn convert_char8_sat(short8); char8 __ovld __cnfn convert_char8_rte(ushort8); char8 __ovld __cnfn convert_char8_sat_rte(ushort8); char8 __ovld __cnfn convert_char8_rtz(ushort8); char8 __ovld __cnfn convert_char8_sat_rtz(ushort8); char8 __ovld __cnfn convert_char8_rtp(ushort8); char8 __ovld __cnfn convert_char8_sat_rtp(ushort8); char8 __ovld __cnfn convert_char8_rtn(ushort8); char8 __ovld __cnfn convert_char8_sat_rtn(ushort8); char8 __ovld __cnfn convert_char8(ushort8); char8 __ovld __cnfn convert_char8_sat(ushort8); char8 __ovld __cnfn convert_char8_rte(int8); char8 __ovld __cnfn convert_char8_sat_rte(int8); char8 __ovld __cnfn convert_char8_rtz(int8); char8 __ovld __cnfn convert_char8_sat_rtz(int8); char8 __ovld __cnfn convert_char8_rtp(int8); char8 __ovld __cnfn convert_char8_sat_rtp(int8); char8 __ovld __cnfn convert_char8_rtn(int8); char8 __ovld __cnfn convert_char8_sat_rtn(int8); char8 __ovld __cnfn convert_char8(int8); char8 __ovld __cnfn convert_char8_sat(int8); char8 __ovld __cnfn convert_char8_rte(uint8); char8 __ovld __cnfn convert_char8_sat_rte(uint8); char8 __ovld __cnfn convert_char8_rtz(uint8); char8 __ovld __cnfn convert_char8_sat_rtz(uint8); char8 __ovld __cnfn convert_char8_rtp(uint8); char8 __ovld __cnfn convert_char8_sat_rtp(uint8); char8 __ovld __cnfn convert_char8_rtn(uint8); char8 __ovld __cnfn convert_char8_sat_rtn(uint8); char8 __ovld __cnfn convert_char8(uint8); char8 __ovld __cnfn convert_char8_sat(uint8); char8 __ovld __cnfn convert_char8_rte(long8); char8 __ovld __cnfn convert_char8_sat_rte(long8); char8 __ovld __cnfn convert_char8_rtz(long8); char8 __ovld __cnfn convert_char8_sat_rtz(long8); char8 __ovld __cnfn convert_char8_rtp(long8); char8 __ovld __cnfn convert_char8_sat_rtp(long8); char8 __ovld __cnfn convert_char8_rtn(long8); char8 __ovld __cnfn convert_char8_sat_rtn(long8); char8 __ovld __cnfn convert_char8(long8); char8 __ovld __cnfn convert_char8_sat(long8); char8 __ovld __cnfn convert_char8_rte(ulong8); char8 __ovld __cnfn convert_char8_sat_rte(ulong8); char8 __ovld __cnfn convert_char8_rtz(ulong8); char8 __ovld __cnfn convert_char8_sat_rtz(ulong8); char8 __ovld __cnfn convert_char8_rtp(ulong8); char8 __ovld __cnfn convert_char8_sat_rtp(ulong8); char8 __ovld __cnfn convert_char8_rtn(ulong8); char8 __ovld __cnfn convert_char8_sat_rtn(ulong8); char8 __ovld __cnfn convert_char8(ulong8); char8 __ovld __cnfn convert_char8_sat(ulong8); char8 __ovld __cnfn convert_char8_rte(float8); char8 __ovld __cnfn convert_char8_sat_rte(float8); char8 __ovld __cnfn convert_char8_rtz(float8); char8 __ovld __cnfn convert_char8_sat_rtz(float8); char8 __ovld __cnfn convert_char8_rtp(float8); char8 __ovld __cnfn convert_char8_sat_rtp(float8); char8 __ovld __cnfn convert_char8_rtn(float8); char8 __ovld __cnfn convert_char8_sat_rtn(float8); char8 __ovld __cnfn convert_char8(float8); char8 __ovld __cnfn convert_char8_sat(float8); uchar8 __ovld __cnfn convert_uchar8_rte(char8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(char8); uchar8 __ovld __cnfn convert_uchar8_rtz(char8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(char8); uchar8 __ovld __cnfn convert_uchar8_rtp(char8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(char8); uchar8 __ovld __cnfn convert_uchar8_rtn(char8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(char8); uchar8 __ovld __cnfn convert_uchar8(char8); uchar8 __ovld __cnfn convert_uchar8_sat(char8); uchar8 __ovld __cnfn convert_uchar8_rte(uchar8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(uchar8); uchar8 __ovld __cnfn convert_uchar8_rtz(uchar8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(uchar8); uchar8 __ovld __cnfn convert_uchar8_rtp(uchar8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(uchar8); uchar8 __ovld __cnfn convert_uchar8_rtn(uchar8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(uchar8); uchar8 __ovld __cnfn convert_uchar8(uchar8); uchar8 __ovld __cnfn convert_uchar8_sat(uchar8); uchar8 __ovld __cnfn convert_uchar8_rte(short8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(short8); uchar8 __ovld __cnfn convert_uchar8_rtz(short8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(short8); uchar8 __ovld __cnfn convert_uchar8_rtp(short8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(short8); uchar8 __ovld __cnfn convert_uchar8_rtn(short8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(short8); uchar8 __ovld __cnfn convert_uchar8(short8); uchar8 __ovld __cnfn convert_uchar8_sat(short8); uchar8 __ovld __cnfn convert_uchar8_rte(ushort8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(ushort8); uchar8 __ovld __cnfn convert_uchar8_rtz(ushort8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(ushort8); uchar8 __ovld __cnfn convert_uchar8_rtp(ushort8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(ushort8); uchar8 __ovld __cnfn convert_uchar8_rtn(ushort8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(ushort8); uchar8 __ovld __cnfn convert_uchar8(ushort8); uchar8 __ovld __cnfn convert_uchar8_sat(ushort8); uchar8 __ovld __cnfn convert_uchar8_rte(int8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(int8); uchar8 __ovld __cnfn convert_uchar8_rtz(int8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(int8); uchar8 __ovld __cnfn convert_uchar8_rtp(int8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(int8); uchar8 __ovld __cnfn convert_uchar8_rtn(int8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(int8); uchar8 __ovld __cnfn convert_uchar8(int8); uchar8 __ovld __cnfn convert_uchar8_sat(int8); uchar8 __ovld __cnfn convert_uchar8_rte(uint8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(uint8); uchar8 __ovld __cnfn convert_uchar8_rtz(uint8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(uint8); uchar8 __ovld __cnfn convert_uchar8_rtp(uint8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(uint8); uchar8 __ovld __cnfn convert_uchar8_rtn(uint8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(uint8); uchar8 __ovld __cnfn convert_uchar8(uint8); uchar8 __ovld __cnfn convert_uchar8_sat(uint8); uchar8 __ovld __cnfn convert_uchar8_rte(long8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(long8); uchar8 __ovld __cnfn convert_uchar8_rtz(long8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(long8); uchar8 __ovld __cnfn convert_uchar8_rtp(long8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(long8); uchar8 __ovld __cnfn convert_uchar8_rtn(long8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(long8); uchar8 __ovld __cnfn convert_uchar8(long8); uchar8 __ovld __cnfn convert_uchar8_sat(long8); uchar8 __ovld __cnfn convert_uchar8_rte(ulong8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(ulong8); uchar8 __ovld __cnfn convert_uchar8_rtz(ulong8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(ulong8); uchar8 __ovld __cnfn convert_uchar8_rtp(ulong8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(ulong8); uchar8 __ovld __cnfn convert_uchar8_rtn(ulong8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(ulong8); uchar8 __ovld __cnfn convert_uchar8(ulong8); uchar8 __ovld __cnfn convert_uchar8_sat(ulong8); uchar8 __ovld __cnfn convert_uchar8_rte(float8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(float8); uchar8 __ovld __cnfn convert_uchar8_rtz(float8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(float8); uchar8 __ovld __cnfn convert_uchar8_rtp(float8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(float8); uchar8 __ovld __cnfn convert_uchar8_rtn(float8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(float8); uchar8 __ovld __cnfn convert_uchar8(float8); uchar8 __ovld __cnfn convert_uchar8_sat(float8); short8 __ovld __cnfn convert_short8_rte(char8); short8 __ovld __cnfn convert_short8_sat_rte(char8); short8 __ovld __cnfn convert_short8_rtz(char8); short8 __ovld __cnfn convert_short8_sat_rtz(char8); short8 __ovld __cnfn convert_short8_rtp(char8); short8 __ovld __cnfn convert_short8_sat_rtp(char8); short8 __ovld __cnfn convert_short8_rtn(char8); short8 __ovld __cnfn convert_short8_sat_rtn(char8); short8 __ovld __cnfn convert_short8(char8); short8 __ovld __cnfn convert_short8_sat(char8); short8 __ovld __cnfn convert_short8_rte(uchar8); short8 __ovld __cnfn convert_short8_sat_rte(uchar8); short8 __ovld __cnfn convert_short8_rtz(uchar8); short8 __ovld __cnfn convert_short8_sat_rtz(uchar8); short8 __ovld __cnfn convert_short8_rtp(uchar8); short8 __ovld __cnfn convert_short8_sat_rtp(uchar8); short8 __ovld __cnfn convert_short8_rtn(uchar8); short8 __ovld __cnfn convert_short8_sat_rtn(uchar8); short8 __ovld __cnfn convert_short8(uchar8); short8 __ovld __cnfn convert_short8_sat(uchar8); short8 __ovld __cnfn convert_short8_rte(short8); short8 __ovld __cnfn convert_short8_sat_rte(short8); short8 __ovld __cnfn convert_short8_rtz(short8); short8 __ovld __cnfn convert_short8_sat_rtz(short8); short8 __ovld __cnfn convert_short8_rtp(short8); short8 __ovld __cnfn convert_short8_sat_rtp(short8); short8 __ovld __cnfn convert_short8_rtn(short8); short8 __ovld __cnfn convert_short8_sat_rtn(short8); short8 __ovld __cnfn convert_short8(short8); short8 __ovld __cnfn convert_short8_sat(short8); short8 __ovld __cnfn convert_short8_rte(ushort8); short8 __ovld __cnfn convert_short8_sat_rte(ushort8); short8 __ovld __cnfn convert_short8_rtz(ushort8); short8 __ovld __cnfn convert_short8_sat_rtz(ushort8); short8 __ovld __cnfn convert_short8_rtp(ushort8); short8 __ovld __cnfn convert_short8_sat_rtp(ushort8); short8 __ovld __cnfn convert_short8_rtn(ushort8); short8 __ovld __cnfn convert_short8_sat_rtn(ushort8); short8 __ovld __cnfn convert_short8(ushort8); short8 __ovld __cnfn convert_short8_sat(ushort8); short8 __ovld __cnfn convert_short8_rte(int8); short8 __ovld __cnfn convert_short8_sat_rte(int8); short8 __ovld __cnfn convert_short8_rtz(int8); short8 __ovld __cnfn convert_short8_sat_rtz(int8); short8 __ovld __cnfn convert_short8_rtp(int8); short8 __ovld __cnfn convert_short8_sat_rtp(int8); short8 __ovld __cnfn convert_short8_rtn(int8); short8 __ovld __cnfn convert_short8_sat_rtn(int8); short8 __ovld __cnfn convert_short8(int8); short8 __ovld __cnfn convert_short8_sat(int8); short8 __ovld __cnfn convert_short8_rte(uint8); short8 __ovld __cnfn convert_short8_sat_rte(uint8); short8 __ovld __cnfn convert_short8_rtz(uint8); short8 __ovld __cnfn convert_short8_sat_rtz(uint8); short8 __ovld __cnfn convert_short8_rtp(uint8); short8 __ovld __cnfn convert_short8_sat_rtp(uint8); short8 __ovld __cnfn convert_short8_rtn(uint8); short8 __ovld __cnfn convert_short8_sat_rtn(uint8); short8 __ovld __cnfn convert_short8(uint8); short8 __ovld __cnfn convert_short8_sat(uint8); short8 __ovld __cnfn convert_short8_rte(long8); short8 __ovld __cnfn convert_short8_sat_rte(long8); short8 __ovld __cnfn convert_short8_rtz(long8); short8 __ovld __cnfn convert_short8_sat_rtz(long8); short8 __ovld __cnfn convert_short8_rtp(long8); short8 __ovld __cnfn convert_short8_sat_rtp(long8); short8 __ovld __cnfn convert_short8_rtn(long8); short8 __ovld __cnfn convert_short8_sat_rtn(long8); short8 __ovld __cnfn convert_short8(long8); short8 __ovld __cnfn convert_short8_sat(long8); short8 __ovld __cnfn convert_short8_rte(ulong8); short8 __ovld __cnfn convert_short8_sat_rte(ulong8); short8 __ovld __cnfn convert_short8_rtz(ulong8); short8 __ovld __cnfn convert_short8_sat_rtz(ulong8); short8 __ovld __cnfn convert_short8_rtp(ulong8); short8 __ovld __cnfn convert_short8_sat_rtp(ulong8); short8 __ovld __cnfn convert_short8_rtn(ulong8); short8 __ovld __cnfn convert_short8_sat_rtn(ulong8); short8 __ovld __cnfn convert_short8(ulong8); short8 __ovld __cnfn convert_short8_sat(ulong8); short8 __ovld __cnfn convert_short8_rte(float8); short8 __ovld __cnfn convert_short8_sat_rte(float8); short8 __ovld __cnfn convert_short8_rtz(float8); short8 __ovld __cnfn convert_short8_sat_rtz(float8); short8 __ovld __cnfn convert_short8_rtp(float8); short8 __ovld __cnfn convert_short8_sat_rtp(float8); short8 __ovld __cnfn convert_short8_rtn(float8); short8 __ovld __cnfn convert_short8_sat_rtn(float8); short8 __ovld __cnfn convert_short8(float8); short8 __ovld __cnfn convert_short8_sat(float8); ushort8 __ovld __cnfn convert_ushort8_rte(char8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(char8); ushort8 __ovld __cnfn convert_ushort8_rtz(char8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(char8); ushort8 __ovld __cnfn convert_ushort8_rtp(char8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(char8); ushort8 __ovld __cnfn convert_ushort8_rtn(char8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(char8); ushort8 __ovld __cnfn convert_ushort8(char8); ushort8 __ovld __cnfn convert_ushort8_sat(char8); ushort8 __ovld __cnfn convert_ushort8_rte(uchar8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(uchar8); ushort8 __ovld __cnfn convert_ushort8_rtz(uchar8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(uchar8); ushort8 __ovld __cnfn convert_ushort8_rtp(uchar8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(uchar8); ushort8 __ovld __cnfn convert_ushort8_rtn(uchar8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(uchar8); ushort8 __ovld __cnfn convert_ushort8(uchar8); ushort8 __ovld __cnfn convert_ushort8_sat(uchar8); ushort8 __ovld __cnfn convert_ushort8_rte(short8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(short8); ushort8 __ovld __cnfn convert_ushort8_rtz(short8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(short8); ushort8 __ovld __cnfn convert_ushort8_rtp(short8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(short8); ushort8 __ovld __cnfn convert_ushort8_rtn(short8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(short8); ushort8 __ovld __cnfn convert_ushort8(short8); ushort8 __ovld __cnfn convert_ushort8_sat(short8); ushort8 __ovld __cnfn convert_ushort8_rte(ushort8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(ushort8); ushort8 __ovld __cnfn convert_ushort8_rtz(ushort8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(ushort8); ushort8 __ovld __cnfn convert_ushort8_rtp(ushort8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(ushort8); ushort8 __ovld __cnfn convert_ushort8_rtn(ushort8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(ushort8); ushort8 __ovld __cnfn convert_ushort8(ushort8); ushort8 __ovld __cnfn convert_ushort8_sat(ushort8); ushort8 __ovld __cnfn convert_ushort8_rte(int8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(int8); ushort8 __ovld __cnfn convert_ushort8_rtz(int8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(int8); ushort8 __ovld __cnfn convert_ushort8_rtp(int8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(int8); ushort8 __ovld __cnfn convert_ushort8_rtn(int8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(int8); ushort8 __ovld __cnfn convert_ushort8(int8); ushort8 __ovld __cnfn convert_ushort8_sat(int8); ushort8 __ovld __cnfn convert_ushort8_rte(uint8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(uint8); ushort8 __ovld __cnfn convert_ushort8_rtz(uint8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(uint8); ushort8 __ovld __cnfn convert_ushort8_rtp(uint8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(uint8); ushort8 __ovld __cnfn convert_ushort8_rtn(uint8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(uint8); ushort8 __ovld __cnfn convert_ushort8(uint8); ushort8 __ovld __cnfn convert_ushort8_sat(uint8); ushort8 __ovld __cnfn convert_ushort8_rte(long8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(long8); ushort8 __ovld __cnfn convert_ushort8_rtz(long8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(long8); ushort8 __ovld __cnfn convert_ushort8_rtp(long8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(long8); ushort8 __ovld __cnfn convert_ushort8_rtn(long8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(long8); ushort8 __ovld __cnfn convert_ushort8(long8); ushort8 __ovld __cnfn convert_ushort8_sat(long8); ushort8 __ovld __cnfn convert_ushort8_rte(ulong8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(ulong8); ushort8 __ovld __cnfn convert_ushort8_rtz(ulong8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(ulong8); ushort8 __ovld __cnfn convert_ushort8_rtp(ulong8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(ulong8); ushort8 __ovld __cnfn convert_ushort8_rtn(ulong8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(ulong8); ushort8 __ovld __cnfn convert_ushort8(ulong8); ushort8 __ovld __cnfn convert_ushort8_sat(ulong8); ushort8 __ovld __cnfn convert_ushort8_rte(float8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(float8); ushort8 __ovld __cnfn convert_ushort8_rtz(float8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(float8); ushort8 __ovld __cnfn convert_ushort8_rtp(float8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(float8); ushort8 __ovld __cnfn convert_ushort8_rtn(float8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(float8); ushort8 __ovld __cnfn convert_ushort8(float8); ushort8 __ovld __cnfn convert_ushort8_sat(float8); int8 __ovld __cnfn convert_int8_rte(char8); int8 __ovld __cnfn convert_int8_sat_rte(char8); int8 __ovld __cnfn convert_int8_rtz(char8); int8 __ovld __cnfn convert_int8_sat_rtz(char8); int8 __ovld __cnfn convert_int8_rtp(char8); int8 __ovld __cnfn convert_int8_sat_rtp(char8); int8 __ovld __cnfn convert_int8_rtn(char8); int8 __ovld __cnfn convert_int8_sat_rtn(char8); int8 __ovld __cnfn convert_int8(char8); int8 __ovld __cnfn convert_int8_sat(char8); int8 __ovld __cnfn convert_int8_rte(uchar8); int8 __ovld __cnfn convert_int8_sat_rte(uchar8); int8 __ovld __cnfn convert_int8_rtz(uchar8); int8 __ovld __cnfn convert_int8_sat_rtz(uchar8); int8 __ovld __cnfn convert_int8_rtp(uchar8); int8 __ovld __cnfn convert_int8_sat_rtp(uchar8); int8 __ovld __cnfn convert_int8_rtn(uchar8); int8 __ovld __cnfn convert_int8_sat_rtn(uchar8); int8 __ovld __cnfn convert_int8(uchar8); int8 __ovld __cnfn convert_int8_sat(uchar8); int8 __ovld __cnfn convert_int8_rte(short8); int8 __ovld __cnfn convert_int8_sat_rte(short8); int8 __ovld __cnfn convert_int8_rtz(short8); int8 __ovld __cnfn convert_int8_sat_rtz(short8); int8 __ovld __cnfn convert_int8_rtp(short8); int8 __ovld __cnfn convert_int8_sat_rtp(short8); int8 __ovld __cnfn convert_int8_rtn(short8); int8 __ovld __cnfn convert_int8_sat_rtn(short8); int8 __ovld __cnfn convert_int8(short8); int8 __ovld __cnfn convert_int8_sat(short8); int8 __ovld __cnfn convert_int8_rte(ushort8); int8 __ovld __cnfn convert_int8_sat_rte(ushort8); int8 __ovld __cnfn convert_int8_rtz(ushort8); int8 __ovld __cnfn convert_int8_sat_rtz(ushort8); int8 __ovld __cnfn convert_int8_rtp(ushort8); int8 __ovld __cnfn convert_int8_sat_rtp(ushort8); int8 __ovld __cnfn convert_int8_rtn(ushort8); int8 __ovld __cnfn convert_int8_sat_rtn(ushort8); int8 __ovld __cnfn convert_int8(ushort8); int8 __ovld __cnfn convert_int8_sat(ushort8); int8 __ovld __cnfn convert_int8_rte(int8); int8 __ovld __cnfn convert_int8_sat_rte(int8); int8 __ovld __cnfn convert_int8_rtz(int8); int8 __ovld __cnfn convert_int8_sat_rtz(int8); int8 __ovld __cnfn convert_int8_rtp(int8); int8 __ovld __cnfn convert_int8_sat_rtp(int8); int8 __ovld __cnfn convert_int8_rtn(int8); int8 __ovld __cnfn convert_int8_sat_rtn(int8); int8 __ovld __cnfn convert_int8(int8); int8 __ovld __cnfn convert_int8_sat(int8); int8 __ovld __cnfn convert_int8_rte(uint8); int8 __ovld __cnfn convert_int8_sat_rte(uint8); int8 __ovld __cnfn convert_int8_rtz(uint8); int8 __ovld __cnfn convert_int8_sat_rtz(uint8); int8 __ovld __cnfn convert_int8_rtp(uint8); int8 __ovld __cnfn convert_int8_sat_rtp(uint8); int8 __ovld __cnfn convert_int8_rtn(uint8); int8 __ovld __cnfn convert_int8_sat_rtn(uint8); int8 __ovld __cnfn convert_int8(uint8); int8 __ovld __cnfn convert_int8_sat(uint8); int8 __ovld __cnfn convert_int8_rte(long8); int8 __ovld __cnfn convert_int8_sat_rte(long8); int8 __ovld __cnfn convert_int8_rtz(long8); int8 __ovld __cnfn convert_int8_sat_rtz(long8); int8 __ovld __cnfn convert_int8_rtp(long8); int8 __ovld __cnfn convert_int8_sat_rtp(long8); int8 __ovld __cnfn convert_int8_rtn(long8); int8 __ovld __cnfn convert_int8_sat_rtn(long8); int8 __ovld __cnfn convert_int8(long8); int8 __ovld __cnfn convert_int8_sat(long8); int8 __ovld __cnfn convert_int8_rte(ulong8); int8 __ovld __cnfn convert_int8_sat_rte(ulong8); int8 __ovld __cnfn convert_int8_rtz(ulong8); int8 __ovld __cnfn convert_int8_sat_rtz(ulong8); int8 __ovld __cnfn convert_int8_rtp(ulong8); int8 __ovld __cnfn convert_int8_sat_rtp(ulong8); int8 __ovld __cnfn convert_int8_rtn(ulong8); int8 __ovld __cnfn convert_int8_sat_rtn(ulong8); int8 __ovld __cnfn convert_int8(ulong8); int8 __ovld __cnfn convert_int8_sat(ulong8); int8 __ovld __cnfn convert_int8_rte(float8); int8 __ovld __cnfn convert_int8_sat_rte(float8); int8 __ovld __cnfn convert_int8_rtz(float8); int8 __ovld __cnfn convert_int8_sat_rtz(float8); int8 __ovld __cnfn convert_int8_rtp(float8); int8 __ovld __cnfn convert_int8_sat_rtp(float8); int8 __ovld __cnfn convert_int8_rtn(float8); int8 __ovld __cnfn convert_int8_sat_rtn(float8); int8 __ovld __cnfn convert_int8(float8); int8 __ovld __cnfn convert_int8_sat(float8); uint8 __ovld __cnfn convert_uint8_rte(char8); uint8 __ovld __cnfn convert_uint8_sat_rte(char8); uint8 __ovld __cnfn convert_uint8_rtz(char8); uint8 __ovld __cnfn convert_uint8_sat_rtz(char8); uint8 __ovld __cnfn convert_uint8_rtp(char8); uint8 __ovld __cnfn convert_uint8_sat_rtp(char8); uint8 __ovld __cnfn convert_uint8_rtn(char8); uint8 __ovld __cnfn convert_uint8_sat_rtn(char8); uint8 __ovld __cnfn convert_uint8(char8); uint8 __ovld __cnfn convert_uint8_sat(char8); uint8 __ovld __cnfn convert_uint8_rte(uchar8); uint8 __ovld __cnfn convert_uint8_sat_rte(uchar8); uint8 __ovld __cnfn convert_uint8_rtz(uchar8); uint8 __ovld __cnfn convert_uint8_sat_rtz(uchar8); uint8 __ovld __cnfn convert_uint8_rtp(uchar8); uint8 __ovld __cnfn convert_uint8_sat_rtp(uchar8); uint8 __ovld __cnfn convert_uint8_rtn(uchar8); uint8 __ovld __cnfn convert_uint8_sat_rtn(uchar8); uint8 __ovld __cnfn convert_uint8(uchar8); uint8 __ovld __cnfn convert_uint8_sat(uchar8); uint8 __ovld __cnfn convert_uint8_rte(short8); uint8 __ovld __cnfn convert_uint8_sat_rte(short8); uint8 __ovld __cnfn convert_uint8_rtz(short8); uint8 __ovld __cnfn convert_uint8_sat_rtz(short8); uint8 __ovld __cnfn convert_uint8_rtp(short8); uint8 __ovld __cnfn convert_uint8_sat_rtp(short8); uint8 __ovld __cnfn convert_uint8_rtn(short8); uint8 __ovld __cnfn convert_uint8_sat_rtn(short8); uint8 __ovld __cnfn convert_uint8(short8); uint8 __ovld __cnfn convert_uint8_sat(short8); uint8 __ovld __cnfn convert_uint8_rte(ushort8); uint8 __ovld __cnfn convert_uint8_sat_rte(ushort8); uint8 __ovld __cnfn convert_uint8_rtz(ushort8); uint8 __ovld __cnfn convert_uint8_sat_rtz(ushort8); uint8 __ovld __cnfn convert_uint8_rtp(ushort8); uint8 __ovld __cnfn convert_uint8_sat_rtp(ushort8); uint8 __ovld __cnfn convert_uint8_rtn(ushort8); uint8 __ovld __cnfn convert_uint8_sat_rtn(ushort8); uint8 __ovld __cnfn convert_uint8(ushort8); uint8 __ovld __cnfn convert_uint8_sat(ushort8); uint8 __ovld __cnfn convert_uint8_rte(int8); uint8 __ovld __cnfn convert_uint8_sat_rte(int8); uint8 __ovld __cnfn convert_uint8_rtz(int8); uint8 __ovld __cnfn convert_uint8_sat_rtz(int8); uint8 __ovld __cnfn convert_uint8_rtp(int8); uint8 __ovld __cnfn convert_uint8_sat_rtp(int8); uint8 __ovld __cnfn convert_uint8_rtn(int8); uint8 __ovld __cnfn convert_uint8_sat_rtn(int8); uint8 __ovld __cnfn convert_uint8(int8); uint8 __ovld __cnfn convert_uint8_sat(int8); uint8 __ovld __cnfn convert_uint8_rte(uint8); uint8 __ovld __cnfn convert_uint8_sat_rte(uint8); uint8 __ovld __cnfn convert_uint8_rtz(uint8); uint8 __ovld __cnfn convert_uint8_sat_rtz(uint8); uint8 __ovld __cnfn convert_uint8_rtp(uint8); uint8 __ovld __cnfn convert_uint8_sat_rtp(uint8); uint8 __ovld __cnfn convert_uint8_rtn(uint8); uint8 __ovld __cnfn convert_uint8_sat_rtn(uint8); uint8 __ovld __cnfn convert_uint8(uint8); uint8 __ovld __cnfn convert_uint8_sat(uint8); uint8 __ovld __cnfn convert_uint8_rte(long8); uint8 __ovld __cnfn convert_uint8_sat_rte(long8); uint8 __ovld __cnfn convert_uint8_rtz(long8); uint8 __ovld __cnfn convert_uint8_sat_rtz(long8); uint8 __ovld __cnfn convert_uint8_rtp(long8); uint8 __ovld __cnfn convert_uint8_sat_rtp(long8); uint8 __ovld __cnfn convert_uint8_rtn(long8); uint8 __ovld __cnfn convert_uint8_sat_rtn(long8); uint8 __ovld __cnfn convert_uint8(long8); uint8 __ovld __cnfn convert_uint8_sat(long8); uint8 __ovld __cnfn convert_uint8_rte(ulong8); uint8 __ovld __cnfn convert_uint8_sat_rte(ulong8); uint8 __ovld __cnfn convert_uint8_rtz(ulong8); uint8 __ovld __cnfn convert_uint8_sat_rtz(ulong8); uint8 __ovld __cnfn convert_uint8_rtp(ulong8); uint8 __ovld __cnfn convert_uint8_sat_rtp(ulong8); uint8 __ovld __cnfn convert_uint8_rtn(ulong8); uint8 __ovld __cnfn convert_uint8_sat_rtn(ulong8); uint8 __ovld __cnfn convert_uint8(ulong8); uint8 __ovld __cnfn convert_uint8_sat(ulong8); uint8 __ovld __cnfn convert_uint8_rte(float8); uint8 __ovld __cnfn convert_uint8_sat_rte(float8); uint8 __ovld __cnfn convert_uint8_rtz(float8); uint8 __ovld __cnfn convert_uint8_sat_rtz(float8); uint8 __ovld __cnfn convert_uint8_rtp(float8); uint8 __ovld __cnfn convert_uint8_sat_rtp(float8); uint8 __ovld __cnfn convert_uint8_rtn(float8); uint8 __ovld __cnfn convert_uint8_sat_rtn(float8); uint8 __ovld __cnfn convert_uint8(float8); uint8 __ovld __cnfn convert_uint8_sat(float8); long8 __ovld __cnfn convert_long8_rte(char8); long8 __ovld __cnfn convert_long8_sat_rte(char8); long8 __ovld __cnfn convert_long8_rtz(char8); long8 __ovld __cnfn convert_long8_sat_rtz(char8); long8 __ovld __cnfn convert_long8_rtp(char8); long8 __ovld __cnfn convert_long8_sat_rtp(char8); long8 __ovld __cnfn convert_long8_rtn(char8); long8 __ovld __cnfn convert_long8_sat_rtn(char8); long8 __ovld __cnfn convert_long8(char8); long8 __ovld __cnfn convert_long8_sat(char8); long8 __ovld __cnfn convert_long8_rte(uchar8); long8 __ovld __cnfn convert_long8_sat_rte(uchar8); long8 __ovld __cnfn convert_long8_rtz(uchar8); long8 __ovld __cnfn convert_long8_sat_rtz(uchar8); long8 __ovld __cnfn convert_long8_rtp(uchar8); long8 __ovld __cnfn convert_long8_sat_rtp(uchar8); long8 __ovld __cnfn convert_long8_rtn(uchar8); long8 __ovld __cnfn convert_long8_sat_rtn(uchar8); long8 __ovld __cnfn convert_long8(uchar8); long8 __ovld __cnfn convert_long8_sat(uchar8); long8 __ovld __cnfn convert_long8_rte(short8); long8 __ovld __cnfn convert_long8_sat_rte(short8); long8 __ovld __cnfn convert_long8_rtz(short8); long8 __ovld __cnfn convert_long8_sat_rtz(short8); long8 __ovld __cnfn convert_long8_rtp(short8); long8 __ovld __cnfn convert_long8_sat_rtp(short8); long8 __ovld __cnfn convert_long8_rtn(short8); long8 __ovld __cnfn convert_long8_sat_rtn(short8); long8 __ovld __cnfn convert_long8(short8); long8 __ovld __cnfn convert_long8_sat(short8); long8 __ovld __cnfn convert_long8_rte(ushort8); long8 __ovld __cnfn convert_long8_sat_rte(ushort8); long8 __ovld __cnfn convert_long8_rtz(ushort8); long8 __ovld __cnfn convert_long8_sat_rtz(ushort8); long8 __ovld __cnfn convert_long8_rtp(ushort8); long8 __ovld __cnfn convert_long8_sat_rtp(ushort8); long8 __ovld __cnfn convert_long8_rtn(ushort8); long8 __ovld __cnfn convert_long8_sat_rtn(ushort8); long8 __ovld __cnfn convert_long8(ushort8); long8 __ovld __cnfn convert_long8_sat(ushort8); long8 __ovld __cnfn convert_long8_rte(int8); long8 __ovld __cnfn convert_long8_sat_rte(int8); long8 __ovld __cnfn convert_long8_rtz(int8); long8 __ovld __cnfn convert_long8_sat_rtz(int8); long8 __ovld __cnfn convert_long8_rtp(int8); long8 __ovld __cnfn convert_long8_sat_rtp(int8); long8 __ovld __cnfn convert_long8_rtn(int8); long8 __ovld __cnfn convert_long8_sat_rtn(int8); long8 __ovld __cnfn convert_long8(int8); long8 __ovld __cnfn convert_long8_sat(int8); long8 __ovld __cnfn convert_long8_rte(uint8); long8 __ovld __cnfn convert_long8_sat_rte(uint8); long8 __ovld __cnfn convert_long8_rtz(uint8); long8 __ovld __cnfn convert_long8_sat_rtz(uint8); long8 __ovld __cnfn convert_long8_rtp(uint8); long8 __ovld __cnfn convert_long8_sat_rtp(uint8); long8 __ovld __cnfn convert_long8_rtn(uint8); long8 __ovld __cnfn convert_long8_sat_rtn(uint8); long8 __ovld __cnfn convert_long8(uint8); long8 __ovld __cnfn convert_long8_sat(uint8); long8 __ovld __cnfn convert_long8_rte(long8); long8 __ovld __cnfn convert_long8_sat_rte(long8); long8 __ovld __cnfn convert_long8_rtz(long8); long8 __ovld __cnfn convert_long8_sat_rtz(long8); long8 __ovld __cnfn convert_long8_rtp(long8); long8 __ovld __cnfn convert_long8_sat_rtp(long8); long8 __ovld __cnfn convert_long8_rtn(long8); long8 __ovld __cnfn convert_long8_sat_rtn(long8); long8 __ovld __cnfn convert_long8(long8); long8 __ovld __cnfn convert_long8_sat(long8); long8 __ovld __cnfn convert_long8_rte(ulong8); long8 __ovld __cnfn convert_long8_sat_rte(ulong8); long8 __ovld __cnfn convert_long8_rtz(ulong8); long8 __ovld __cnfn convert_long8_sat_rtz(ulong8); long8 __ovld __cnfn convert_long8_rtp(ulong8); long8 __ovld __cnfn convert_long8_sat_rtp(ulong8); long8 __ovld __cnfn convert_long8_rtn(ulong8); long8 __ovld __cnfn convert_long8_sat_rtn(ulong8); long8 __ovld __cnfn convert_long8(ulong8); long8 __ovld __cnfn convert_long8_sat(ulong8); long8 __ovld __cnfn convert_long8_rte(float8); long8 __ovld __cnfn convert_long8_sat_rte(float8); long8 __ovld __cnfn convert_long8_rtz(float8); long8 __ovld __cnfn convert_long8_sat_rtz(float8); long8 __ovld __cnfn convert_long8_rtp(float8); long8 __ovld __cnfn convert_long8_sat_rtp(float8); long8 __ovld __cnfn convert_long8_rtn(float8); long8 __ovld __cnfn convert_long8_sat_rtn(float8); long8 __ovld __cnfn convert_long8(float8); long8 __ovld __cnfn convert_long8_sat(float8); ulong8 __ovld __cnfn convert_ulong8_rte(char8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(char8); ulong8 __ovld __cnfn convert_ulong8_rtz(char8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(char8); ulong8 __ovld __cnfn convert_ulong8_rtp(char8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(char8); ulong8 __ovld __cnfn convert_ulong8_rtn(char8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(char8); ulong8 __ovld __cnfn convert_ulong8(char8); ulong8 __ovld __cnfn convert_ulong8_sat(char8); ulong8 __ovld __cnfn convert_ulong8_rte(uchar8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(uchar8); ulong8 __ovld __cnfn convert_ulong8_rtz(uchar8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(uchar8); ulong8 __ovld __cnfn convert_ulong8_rtp(uchar8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(uchar8); ulong8 __ovld __cnfn convert_ulong8_rtn(uchar8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(uchar8); ulong8 __ovld __cnfn convert_ulong8(uchar8); ulong8 __ovld __cnfn convert_ulong8_sat(uchar8); ulong8 __ovld __cnfn convert_ulong8_rte(short8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(short8); ulong8 __ovld __cnfn convert_ulong8_rtz(short8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(short8); ulong8 __ovld __cnfn convert_ulong8_rtp(short8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(short8); ulong8 __ovld __cnfn convert_ulong8_rtn(short8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(short8); ulong8 __ovld __cnfn convert_ulong8(short8); ulong8 __ovld __cnfn convert_ulong8_sat(short8); ulong8 __ovld __cnfn convert_ulong8_rte(ushort8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(ushort8); ulong8 __ovld __cnfn convert_ulong8_rtz(ushort8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(ushort8); ulong8 __ovld __cnfn convert_ulong8_rtp(ushort8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(ushort8); ulong8 __ovld __cnfn convert_ulong8_rtn(ushort8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(ushort8); ulong8 __ovld __cnfn convert_ulong8(ushort8); ulong8 __ovld __cnfn convert_ulong8_sat(ushort8); ulong8 __ovld __cnfn convert_ulong8_rte(int8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(int8); ulong8 __ovld __cnfn convert_ulong8_rtz(int8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(int8); ulong8 __ovld __cnfn convert_ulong8_rtp(int8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(int8); ulong8 __ovld __cnfn convert_ulong8_rtn(int8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(int8); ulong8 __ovld __cnfn convert_ulong8(int8); ulong8 __ovld __cnfn convert_ulong8_sat(int8); ulong8 __ovld __cnfn convert_ulong8_rte(uint8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(uint8); ulong8 __ovld __cnfn convert_ulong8_rtz(uint8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(uint8); ulong8 __ovld __cnfn convert_ulong8_rtp(uint8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(uint8); ulong8 __ovld __cnfn convert_ulong8_rtn(uint8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(uint8); ulong8 __ovld __cnfn convert_ulong8(uint8); ulong8 __ovld __cnfn convert_ulong8_sat(uint8); ulong8 __ovld __cnfn convert_ulong8_rte(long8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(long8); ulong8 __ovld __cnfn convert_ulong8_rtz(long8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(long8); ulong8 __ovld __cnfn convert_ulong8_rtp(long8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(long8); ulong8 __ovld __cnfn convert_ulong8_rtn(long8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(long8); ulong8 __ovld __cnfn convert_ulong8(long8); ulong8 __ovld __cnfn convert_ulong8_sat(long8); ulong8 __ovld __cnfn convert_ulong8_rte(ulong8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(ulong8); ulong8 __ovld __cnfn convert_ulong8_rtz(ulong8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(ulong8); ulong8 __ovld __cnfn convert_ulong8_rtp(ulong8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(ulong8); ulong8 __ovld __cnfn convert_ulong8_rtn(ulong8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(ulong8); ulong8 __ovld __cnfn convert_ulong8(ulong8); ulong8 __ovld __cnfn convert_ulong8_sat(ulong8); ulong8 __ovld __cnfn convert_ulong8_rte(float8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(float8); ulong8 __ovld __cnfn convert_ulong8_rtz(float8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(float8); ulong8 __ovld __cnfn convert_ulong8_rtp(float8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(float8); ulong8 __ovld __cnfn convert_ulong8_rtn(float8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(float8); ulong8 __ovld __cnfn convert_ulong8(float8); ulong8 __ovld __cnfn convert_ulong8_sat(float8); float8 __ovld __cnfn convert_float8_rte(char8); float8 __ovld __cnfn convert_float8_rtz(char8); float8 __ovld __cnfn convert_float8_rtp(char8); float8 __ovld __cnfn convert_float8_rtn(char8); float8 __ovld __cnfn convert_float8(char8); float8 __ovld __cnfn convert_float8_rte(uchar8); float8 __ovld __cnfn convert_float8_rtz(uchar8); float8 __ovld __cnfn convert_float8_rtp(uchar8); float8 __ovld __cnfn convert_float8_rtn(uchar8); float8 __ovld __cnfn convert_float8(uchar8); float8 __ovld __cnfn convert_float8_rte(short8); float8 __ovld __cnfn convert_float8_rtz(short8); float8 __ovld __cnfn convert_float8_rtp(short8); float8 __ovld __cnfn convert_float8_rtn(short8); float8 __ovld __cnfn convert_float8(short8); float8 __ovld __cnfn convert_float8_rte(ushort8); float8 __ovld __cnfn convert_float8_rtz(ushort8); float8 __ovld __cnfn convert_float8_rtp(ushort8); float8 __ovld __cnfn convert_float8_rtn(ushort8); float8 __ovld __cnfn convert_float8(ushort8); float8 __ovld __cnfn convert_float8_rte(int8); float8 __ovld __cnfn convert_float8_rtz(int8); float8 __ovld __cnfn convert_float8_rtp(int8); float8 __ovld __cnfn convert_float8_rtn(int8); float8 __ovld __cnfn convert_float8(int8); float8 __ovld __cnfn convert_float8_rte(uint8); float8 __ovld __cnfn convert_float8_rtz(uint8); float8 __ovld __cnfn convert_float8_rtp(uint8); float8 __ovld __cnfn convert_float8_rtn(uint8); float8 __ovld __cnfn convert_float8(uint8); float8 __ovld __cnfn convert_float8_rte(long8); float8 __ovld __cnfn convert_float8_rtz(long8); float8 __ovld __cnfn convert_float8_rtp(long8); float8 __ovld __cnfn convert_float8_rtn(long8); float8 __ovld __cnfn convert_float8(long8); float8 __ovld __cnfn convert_float8_rte(ulong8); float8 __ovld __cnfn convert_float8_rtz(ulong8); float8 __ovld __cnfn convert_float8_rtp(ulong8); float8 __ovld __cnfn convert_float8_rtn(ulong8); float8 __ovld __cnfn convert_float8(ulong8); float8 __ovld __cnfn convert_float8_rte(float8); float8 __ovld __cnfn convert_float8_rtz(float8); float8 __ovld __cnfn convert_float8_rtp(float8); float8 __ovld __cnfn convert_float8_rtn(float8); float8 __ovld __cnfn convert_float8(float8); char16 __ovld __cnfn convert_char16_rte(char16); char16 __ovld __cnfn convert_char16_sat_rte(char16); char16 __ovld __cnfn convert_char16_rtz(char16); char16 __ovld __cnfn convert_char16_sat_rtz(char16); char16 __ovld __cnfn convert_char16_rtp(char16); char16 __ovld __cnfn convert_char16_sat_rtp(char16); char16 __ovld __cnfn convert_char16_rtn(char16); char16 __ovld __cnfn convert_char16_sat_rtn(char16); char16 __ovld __cnfn convert_char16(char16); char16 __ovld __cnfn convert_char16_sat(char16); char16 __ovld __cnfn convert_char16_rte(uchar16); char16 __ovld __cnfn convert_char16_sat_rte(uchar16); char16 __ovld __cnfn convert_char16_rtz(uchar16); char16 __ovld __cnfn convert_char16_sat_rtz(uchar16); char16 __ovld __cnfn convert_char16_rtp(uchar16); char16 __ovld __cnfn convert_char16_sat_rtp(uchar16); char16 __ovld __cnfn convert_char16_rtn(uchar16); char16 __ovld __cnfn convert_char16_sat_rtn(uchar16); char16 __ovld __cnfn convert_char16(uchar16); char16 __ovld __cnfn convert_char16_sat(uchar16); char16 __ovld __cnfn convert_char16_rte(short16); char16 __ovld __cnfn convert_char16_sat_rte(short16); char16 __ovld __cnfn convert_char16_rtz(short16); char16 __ovld __cnfn convert_char16_sat_rtz(short16); char16 __ovld __cnfn convert_char16_rtp(short16); char16 __ovld __cnfn convert_char16_sat_rtp(short16); char16 __ovld __cnfn convert_char16_rtn(short16); char16 __ovld __cnfn convert_char16_sat_rtn(short16); char16 __ovld __cnfn convert_char16(short16); char16 __ovld __cnfn convert_char16_sat(short16); char16 __ovld __cnfn convert_char16_rte(ushort16); char16 __ovld __cnfn convert_char16_sat_rte(ushort16); char16 __ovld __cnfn convert_char16_rtz(ushort16); char16 __ovld __cnfn convert_char16_sat_rtz(ushort16); char16 __ovld __cnfn convert_char16_rtp(ushort16); char16 __ovld __cnfn convert_char16_sat_rtp(ushort16); char16 __ovld __cnfn convert_char16_rtn(ushort16); char16 __ovld __cnfn convert_char16_sat_rtn(ushort16); char16 __ovld __cnfn convert_char16(ushort16); char16 __ovld __cnfn convert_char16_sat(ushort16); char16 __ovld __cnfn convert_char16_rte(int16); char16 __ovld __cnfn convert_char16_sat_rte(int16); char16 __ovld __cnfn convert_char16_rtz(int16); char16 __ovld __cnfn convert_char16_sat_rtz(int16); char16 __ovld __cnfn convert_char16_rtp(int16); char16 __ovld __cnfn convert_char16_sat_rtp(int16); char16 __ovld __cnfn convert_char16_rtn(int16); char16 __ovld __cnfn convert_char16_sat_rtn(int16); char16 __ovld __cnfn convert_char16(int16); char16 __ovld __cnfn convert_char16_sat(int16); char16 __ovld __cnfn convert_char16_rte(uint16); char16 __ovld __cnfn convert_char16_sat_rte(uint16); char16 __ovld __cnfn convert_char16_rtz(uint16); char16 __ovld __cnfn convert_char16_sat_rtz(uint16); char16 __ovld __cnfn convert_char16_rtp(uint16); char16 __ovld __cnfn convert_char16_sat_rtp(uint16); char16 __ovld __cnfn convert_char16_rtn(uint16); char16 __ovld __cnfn convert_char16_sat_rtn(uint16); char16 __ovld __cnfn convert_char16(uint16); char16 __ovld __cnfn convert_char16_sat(uint16); char16 __ovld __cnfn convert_char16_rte(long16); char16 __ovld __cnfn convert_char16_sat_rte(long16); char16 __ovld __cnfn convert_char16_rtz(long16); char16 __ovld __cnfn convert_char16_sat_rtz(long16); char16 __ovld __cnfn convert_char16_rtp(long16); char16 __ovld __cnfn convert_char16_sat_rtp(long16); char16 __ovld __cnfn convert_char16_rtn(long16); char16 __ovld __cnfn convert_char16_sat_rtn(long16); char16 __ovld __cnfn convert_char16(long16); char16 __ovld __cnfn convert_char16_sat(long16); char16 __ovld __cnfn convert_char16_rte(ulong16); char16 __ovld __cnfn convert_char16_sat_rte(ulong16); char16 __ovld __cnfn convert_char16_rtz(ulong16); char16 __ovld __cnfn convert_char16_sat_rtz(ulong16); char16 __ovld __cnfn convert_char16_rtp(ulong16); char16 __ovld __cnfn convert_char16_sat_rtp(ulong16); char16 __ovld __cnfn convert_char16_rtn(ulong16); char16 __ovld __cnfn convert_char16_sat_rtn(ulong16); char16 __ovld __cnfn convert_char16(ulong16); char16 __ovld __cnfn convert_char16_sat(ulong16); char16 __ovld __cnfn convert_char16_rte(float16); char16 __ovld __cnfn convert_char16_sat_rte(float16); char16 __ovld __cnfn convert_char16_rtz(float16); char16 __ovld __cnfn convert_char16_sat_rtz(float16); char16 __ovld __cnfn convert_char16_rtp(float16); char16 __ovld __cnfn convert_char16_sat_rtp(float16); char16 __ovld __cnfn convert_char16_rtn(float16); char16 __ovld __cnfn convert_char16_sat_rtn(float16); char16 __ovld __cnfn convert_char16(float16); char16 __ovld __cnfn convert_char16_sat(float16); uchar16 __ovld __cnfn convert_uchar16_rte(char16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(char16); uchar16 __ovld __cnfn convert_uchar16_rtz(char16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(char16); uchar16 __ovld __cnfn convert_uchar16_rtp(char16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(char16); uchar16 __ovld __cnfn convert_uchar16_rtn(char16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(char16); uchar16 __ovld __cnfn convert_uchar16(char16); uchar16 __ovld __cnfn convert_uchar16_sat(char16); uchar16 __ovld __cnfn convert_uchar16_rte(uchar16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(uchar16); uchar16 __ovld __cnfn convert_uchar16_rtz(uchar16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(uchar16); uchar16 __ovld __cnfn convert_uchar16_rtp(uchar16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(uchar16); uchar16 __ovld __cnfn convert_uchar16_rtn(uchar16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(uchar16); uchar16 __ovld __cnfn convert_uchar16(uchar16); uchar16 __ovld __cnfn convert_uchar16_sat(uchar16); uchar16 __ovld __cnfn convert_uchar16_rte(short16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(short16); uchar16 __ovld __cnfn convert_uchar16_rtz(short16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(short16); uchar16 __ovld __cnfn convert_uchar16_rtp(short16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(short16); uchar16 __ovld __cnfn convert_uchar16_rtn(short16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(short16); uchar16 __ovld __cnfn convert_uchar16(short16); uchar16 __ovld __cnfn convert_uchar16_sat(short16); uchar16 __ovld __cnfn convert_uchar16_rte(ushort16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(ushort16); uchar16 __ovld __cnfn convert_uchar16_rtz(ushort16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(ushort16); uchar16 __ovld __cnfn convert_uchar16_rtp(ushort16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(ushort16); uchar16 __ovld __cnfn convert_uchar16_rtn(ushort16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(ushort16); uchar16 __ovld __cnfn convert_uchar16(ushort16); uchar16 __ovld __cnfn convert_uchar16_sat(ushort16); uchar16 __ovld __cnfn convert_uchar16_rte(int16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(int16); uchar16 __ovld __cnfn convert_uchar16_rtz(int16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(int16); uchar16 __ovld __cnfn convert_uchar16_rtp(int16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(int16); uchar16 __ovld __cnfn convert_uchar16_rtn(int16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(int16); uchar16 __ovld __cnfn convert_uchar16(int16); uchar16 __ovld __cnfn convert_uchar16_sat(int16); uchar16 __ovld __cnfn convert_uchar16_rte(uint16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(uint16); uchar16 __ovld __cnfn convert_uchar16_rtz(uint16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(uint16); uchar16 __ovld __cnfn convert_uchar16_rtp(uint16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(uint16); uchar16 __ovld __cnfn convert_uchar16_rtn(uint16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(uint16); uchar16 __ovld __cnfn convert_uchar16(uint16); uchar16 __ovld __cnfn convert_uchar16_sat(uint16); uchar16 __ovld __cnfn convert_uchar16_rte(long16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(long16); uchar16 __ovld __cnfn convert_uchar16_rtz(long16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(long16); uchar16 __ovld __cnfn convert_uchar16_rtp(long16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(long16); uchar16 __ovld __cnfn convert_uchar16_rtn(long16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(long16); uchar16 __ovld __cnfn convert_uchar16(long16); uchar16 __ovld __cnfn convert_uchar16_sat(long16); uchar16 __ovld __cnfn convert_uchar16_rte(ulong16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(ulong16); uchar16 __ovld __cnfn convert_uchar16_rtz(ulong16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(ulong16); uchar16 __ovld __cnfn convert_uchar16_rtp(ulong16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(ulong16); uchar16 __ovld __cnfn convert_uchar16_rtn(ulong16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(ulong16); uchar16 __ovld __cnfn convert_uchar16(ulong16); uchar16 __ovld __cnfn convert_uchar16_sat(ulong16); uchar16 __ovld __cnfn convert_uchar16_rte(float16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(float16); uchar16 __ovld __cnfn convert_uchar16_rtz(float16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(float16); uchar16 __ovld __cnfn convert_uchar16_rtp(float16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(float16); uchar16 __ovld __cnfn convert_uchar16_rtn(float16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(float16); uchar16 __ovld __cnfn convert_uchar16(float16); uchar16 __ovld __cnfn convert_uchar16_sat(float16); short16 __ovld __cnfn convert_short16_rte(char16); short16 __ovld __cnfn convert_short16_sat_rte(char16); short16 __ovld __cnfn convert_short16_rtz(char16); short16 __ovld __cnfn convert_short16_sat_rtz(char16); short16 __ovld __cnfn convert_short16_rtp(char16); short16 __ovld __cnfn convert_short16_sat_rtp(char16); short16 __ovld __cnfn convert_short16_rtn(char16); short16 __ovld __cnfn convert_short16_sat_rtn(char16); short16 __ovld __cnfn convert_short16(char16); short16 __ovld __cnfn convert_short16_sat(char16); short16 __ovld __cnfn convert_short16_rte(uchar16); short16 __ovld __cnfn convert_short16_sat_rte(uchar16); short16 __ovld __cnfn convert_short16_rtz(uchar16); short16 __ovld __cnfn convert_short16_sat_rtz(uchar16); short16 __ovld __cnfn convert_short16_rtp(uchar16); short16 __ovld __cnfn convert_short16_sat_rtp(uchar16); short16 __ovld __cnfn convert_short16_rtn(uchar16); short16 __ovld __cnfn convert_short16_sat_rtn(uchar16); short16 __ovld __cnfn convert_short16(uchar16); short16 __ovld __cnfn convert_short16_sat(uchar16); short16 __ovld __cnfn convert_short16_rte(short16); short16 __ovld __cnfn convert_short16_sat_rte(short16); short16 __ovld __cnfn convert_short16_rtz(short16); short16 __ovld __cnfn convert_short16_sat_rtz(short16); short16 __ovld __cnfn convert_short16_rtp(short16); short16 __ovld __cnfn convert_short16_sat_rtp(short16); short16 __ovld __cnfn convert_short16_rtn(short16); short16 __ovld __cnfn convert_short16_sat_rtn(short16); short16 __ovld __cnfn convert_short16(short16); short16 __ovld __cnfn convert_short16_sat(short16); short16 __ovld __cnfn convert_short16_rte(ushort16); short16 __ovld __cnfn convert_short16_sat_rte(ushort16); short16 __ovld __cnfn convert_short16_rtz(ushort16); short16 __ovld __cnfn convert_short16_sat_rtz(ushort16); short16 __ovld __cnfn convert_short16_rtp(ushort16); short16 __ovld __cnfn convert_short16_sat_rtp(ushort16); short16 __ovld __cnfn convert_short16_rtn(ushort16); short16 __ovld __cnfn convert_short16_sat_rtn(ushort16); short16 __ovld __cnfn convert_short16(ushort16); short16 __ovld __cnfn convert_short16_sat(ushort16); short16 __ovld __cnfn convert_short16_rte(int16); short16 __ovld __cnfn convert_short16_sat_rte(int16); short16 __ovld __cnfn convert_short16_rtz(int16); short16 __ovld __cnfn convert_short16_sat_rtz(int16); short16 __ovld __cnfn convert_short16_rtp(int16); short16 __ovld __cnfn convert_short16_sat_rtp(int16); short16 __ovld __cnfn convert_short16_rtn(int16); short16 __ovld __cnfn convert_short16_sat_rtn(int16); short16 __ovld __cnfn convert_short16(int16); short16 __ovld __cnfn convert_short16_sat(int16); short16 __ovld __cnfn convert_short16_rte(uint16); short16 __ovld __cnfn convert_short16_sat_rte(uint16); short16 __ovld __cnfn convert_short16_rtz(uint16); short16 __ovld __cnfn convert_short16_sat_rtz(uint16); short16 __ovld __cnfn convert_short16_rtp(uint16); short16 __ovld __cnfn convert_short16_sat_rtp(uint16); short16 __ovld __cnfn convert_short16_rtn(uint16); short16 __ovld __cnfn convert_short16_sat_rtn(uint16); short16 __ovld __cnfn convert_short16(uint16); short16 __ovld __cnfn convert_short16_sat(uint16); short16 __ovld __cnfn convert_short16_rte(long16); short16 __ovld __cnfn convert_short16_sat_rte(long16); short16 __ovld __cnfn convert_short16_rtz(long16); short16 __ovld __cnfn convert_short16_sat_rtz(long16); short16 __ovld __cnfn convert_short16_rtp(long16); short16 __ovld __cnfn convert_short16_sat_rtp(long16); short16 __ovld __cnfn convert_short16_rtn(long16); short16 __ovld __cnfn convert_short16_sat_rtn(long16); short16 __ovld __cnfn convert_short16(long16); short16 __ovld __cnfn convert_short16_sat(long16); short16 __ovld __cnfn convert_short16_rte(ulong16); short16 __ovld __cnfn convert_short16_sat_rte(ulong16); short16 __ovld __cnfn convert_short16_rtz(ulong16); short16 __ovld __cnfn convert_short16_sat_rtz(ulong16); short16 __ovld __cnfn convert_short16_rtp(ulong16); short16 __ovld __cnfn convert_short16_sat_rtp(ulong16); short16 __ovld __cnfn convert_short16_rtn(ulong16); short16 __ovld __cnfn convert_short16_sat_rtn(ulong16); short16 __ovld __cnfn convert_short16(ulong16); short16 __ovld __cnfn convert_short16_sat(ulong16); short16 __ovld __cnfn convert_short16_rte(float16); short16 __ovld __cnfn convert_short16_sat_rte(float16); short16 __ovld __cnfn convert_short16_rtz(float16); short16 __ovld __cnfn convert_short16_sat_rtz(float16); short16 __ovld __cnfn convert_short16_rtp(float16); short16 __ovld __cnfn convert_short16_sat_rtp(float16); short16 __ovld __cnfn convert_short16_rtn(float16); short16 __ovld __cnfn convert_short16_sat_rtn(float16); short16 __ovld __cnfn convert_short16(float16); short16 __ovld __cnfn convert_short16_sat(float16); ushort16 __ovld __cnfn convert_ushort16_rte(char16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(char16); ushort16 __ovld __cnfn convert_ushort16_rtz(char16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(char16); ushort16 __ovld __cnfn convert_ushort16_rtp(char16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(char16); ushort16 __ovld __cnfn convert_ushort16_rtn(char16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(char16); ushort16 __ovld __cnfn convert_ushort16(char16); ushort16 __ovld __cnfn convert_ushort16_sat(char16); ushort16 __ovld __cnfn convert_ushort16_rte(uchar16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(uchar16); ushort16 __ovld __cnfn convert_ushort16_rtz(uchar16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(uchar16); ushort16 __ovld __cnfn convert_ushort16_rtp(uchar16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(uchar16); ushort16 __ovld __cnfn convert_ushort16_rtn(uchar16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(uchar16); ushort16 __ovld __cnfn convert_ushort16(uchar16); ushort16 __ovld __cnfn convert_ushort16_sat(uchar16); ushort16 __ovld __cnfn convert_ushort16_rte(short16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(short16); ushort16 __ovld __cnfn convert_ushort16_rtz(short16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(short16); ushort16 __ovld __cnfn convert_ushort16_rtp(short16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(short16); ushort16 __ovld __cnfn convert_ushort16_rtn(short16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(short16); ushort16 __ovld __cnfn convert_ushort16(short16); ushort16 __ovld __cnfn convert_ushort16_sat(short16); ushort16 __ovld __cnfn convert_ushort16_rte(ushort16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(ushort16); ushort16 __ovld __cnfn convert_ushort16_rtz(ushort16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(ushort16); ushort16 __ovld __cnfn convert_ushort16_rtp(ushort16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(ushort16); ushort16 __ovld __cnfn convert_ushort16_rtn(ushort16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(ushort16); ushort16 __ovld __cnfn convert_ushort16(ushort16); ushort16 __ovld __cnfn convert_ushort16_sat(ushort16); ushort16 __ovld __cnfn convert_ushort16_rte(int16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(int16); ushort16 __ovld __cnfn convert_ushort16_rtz(int16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(int16); ushort16 __ovld __cnfn convert_ushort16_rtp(int16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(int16); ushort16 __ovld __cnfn convert_ushort16_rtn(int16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(int16); ushort16 __ovld __cnfn convert_ushort16(int16); ushort16 __ovld __cnfn convert_ushort16_sat(int16); ushort16 __ovld __cnfn convert_ushort16_rte(uint16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(uint16); ushort16 __ovld __cnfn convert_ushort16_rtz(uint16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(uint16); ushort16 __ovld __cnfn convert_ushort16_rtp(uint16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(uint16); ushort16 __ovld __cnfn convert_ushort16_rtn(uint16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(uint16); ushort16 __ovld __cnfn convert_ushort16(uint16); ushort16 __ovld __cnfn convert_ushort16_sat(uint16); ushort16 __ovld __cnfn convert_ushort16_rte(long16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(long16); ushort16 __ovld __cnfn convert_ushort16_rtz(long16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(long16); ushort16 __ovld __cnfn convert_ushort16_rtp(long16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(long16); ushort16 __ovld __cnfn convert_ushort16_rtn(long16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(long16); ushort16 __ovld __cnfn convert_ushort16(long16); ushort16 __ovld __cnfn convert_ushort16_sat(long16); ushort16 __ovld __cnfn convert_ushort16_rte(ulong16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(ulong16); ushort16 __ovld __cnfn convert_ushort16_rtz(ulong16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(ulong16); ushort16 __ovld __cnfn convert_ushort16_rtp(ulong16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(ulong16); ushort16 __ovld __cnfn convert_ushort16_rtn(ulong16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(ulong16); ushort16 __ovld __cnfn convert_ushort16(ulong16); ushort16 __ovld __cnfn convert_ushort16_sat(ulong16); ushort16 __ovld __cnfn convert_ushort16_rte(float16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(float16); ushort16 __ovld __cnfn convert_ushort16_rtz(float16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(float16); ushort16 __ovld __cnfn convert_ushort16_rtp(float16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(float16); ushort16 __ovld __cnfn convert_ushort16_rtn(float16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(float16); ushort16 __ovld __cnfn convert_ushort16(float16); ushort16 __ovld __cnfn convert_ushort16_sat(float16); int16 __ovld __cnfn convert_int16_rte(char16); int16 __ovld __cnfn convert_int16_sat_rte(char16); int16 __ovld __cnfn convert_int16_rtz(char16); int16 __ovld __cnfn convert_int16_sat_rtz(char16); int16 __ovld __cnfn convert_int16_rtp(char16); int16 __ovld __cnfn convert_int16_sat_rtp(char16); int16 __ovld __cnfn convert_int16_rtn(char16); int16 __ovld __cnfn convert_int16_sat_rtn(char16); int16 __ovld __cnfn convert_int16(char16); int16 __ovld __cnfn convert_int16_sat(char16); int16 __ovld __cnfn convert_int16_rte(uchar16); int16 __ovld __cnfn convert_int16_sat_rte(uchar16); int16 __ovld __cnfn convert_int16_rtz(uchar16); int16 __ovld __cnfn convert_int16_sat_rtz(uchar16); int16 __ovld __cnfn convert_int16_rtp(uchar16); int16 __ovld __cnfn convert_int16_sat_rtp(uchar16); int16 __ovld __cnfn convert_int16_rtn(uchar16); int16 __ovld __cnfn convert_int16_sat_rtn(uchar16); int16 __ovld __cnfn convert_int16(uchar16); int16 __ovld __cnfn convert_int16_sat(uchar16); int16 __ovld __cnfn convert_int16_rte(short16); int16 __ovld __cnfn convert_int16_sat_rte(short16); int16 __ovld __cnfn convert_int16_rtz(short16); int16 __ovld __cnfn convert_int16_sat_rtz(short16); int16 __ovld __cnfn convert_int16_rtp(short16); int16 __ovld __cnfn convert_int16_sat_rtp(short16); int16 __ovld __cnfn convert_int16_rtn(short16); int16 __ovld __cnfn convert_int16_sat_rtn(short16); int16 __ovld __cnfn convert_int16(short16); int16 __ovld __cnfn convert_int16_sat(short16); int16 __ovld __cnfn convert_int16_rte(ushort16); int16 __ovld __cnfn convert_int16_sat_rte(ushort16); int16 __ovld __cnfn convert_int16_rtz(ushort16); int16 __ovld __cnfn convert_int16_sat_rtz(ushort16); int16 __ovld __cnfn convert_int16_rtp(ushort16); int16 __ovld __cnfn convert_int16_sat_rtp(ushort16); int16 __ovld __cnfn convert_int16_rtn(ushort16); int16 __ovld __cnfn convert_int16_sat_rtn(ushort16); int16 __ovld __cnfn convert_int16(ushort16); int16 __ovld __cnfn convert_int16_sat(ushort16); int16 __ovld __cnfn convert_int16_rte(int16); int16 __ovld __cnfn convert_int16_sat_rte(int16); int16 __ovld __cnfn convert_int16_rtz(int16); int16 __ovld __cnfn convert_int16_sat_rtz(int16); int16 __ovld __cnfn convert_int16_rtp(int16); int16 __ovld __cnfn convert_int16_sat_rtp(int16); int16 __ovld __cnfn convert_int16_rtn(int16); int16 __ovld __cnfn convert_int16_sat_rtn(int16); int16 __ovld __cnfn convert_int16(int16); int16 __ovld __cnfn convert_int16_sat(int16); int16 __ovld __cnfn convert_int16_rte(uint16); int16 __ovld __cnfn convert_int16_sat_rte(uint16); int16 __ovld __cnfn convert_int16_rtz(uint16); int16 __ovld __cnfn convert_int16_sat_rtz(uint16); int16 __ovld __cnfn convert_int16_rtp(uint16); int16 __ovld __cnfn convert_int16_sat_rtp(uint16); int16 __ovld __cnfn convert_int16_rtn(uint16); int16 __ovld __cnfn convert_int16_sat_rtn(uint16); int16 __ovld __cnfn convert_int16(uint16); int16 __ovld __cnfn convert_int16_sat(uint16); int16 __ovld __cnfn convert_int16_rte(long16); int16 __ovld __cnfn convert_int16_sat_rte(long16); int16 __ovld __cnfn convert_int16_rtz(long16); int16 __ovld __cnfn convert_int16_sat_rtz(long16); int16 __ovld __cnfn convert_int16_rtp(long16); int16 __ovld __cnfn convert_int16_sat_rtp(long16); int16 __ovld __cnfn convert_int16_rtn(long16); int16 __ovld __cnfn convert_int16_sat_rtn(long16); int16 __ovld __cnfn convert_int16(long16); int16 __ovld __cnfn convert_int16_sat(long16); int16 __ovld __cnfn convert_int16_rte(ulong16); int16 __ovld __cnfn convert_int16_sat_rte(ulong16); int16 __ovld __cnfn convert_int16_rtz(ulong16); int16 __ovld __cnfn convert_int16_sat_rtz(ulong16); int16 __ovld __cnfn convert_int16_rtp(ulong16); int16 __ovld __cnfn convert_int16_sat_rtp(ulong16); int16 __ovld __cnfn convert_int16_rtn(ulong16); int16 __ovld __cnfn convert_int16_sat_rtn(ulong16); int16 __ovld __cnfn convert_int16(ulong16); int16 __ovld __cnfn convert_int16_sat(ulong16); int16 __ovld __cnfn convert_int16_rte(float16); int16 __ovld __cnfn convert_int16_sat_rte(float16); int16 __ovld __cnfn convert_int16_rtz(float16); int16 __ovld __cnfn convert_int16_sat_rtz(float16); int16 __ovld __cnfn convert_int16_rtp(float16); int16 __ovld __cnfn convert_int16_sat_rtp(float16); int16 __ovld __cnfn convert_int16_rtn(float16); int16 __ovld __cnfn convert_int16_sat_rtn(float16); int16 __ovld __cnfn convert_int16(float16); int16 __ovld __cnfn convert_int16_sat(float16); uint16 __ovld __cnfn convert_uint16_rte(char16); uint16 __ovld __cnfn convert_uint16_sat_rte(char16); uint16 __ovld __cnfn convert_uint16_rtz(char16); uint16 __ovld __cnfn convert_uint16_sat_rtz(char16); uint16 __ovld __cnfn convert_uint16_rtp(char16); uint16 __ovld __cnfn convert_uint16_sat_rtp(char16); uint16 __ovld __cnfn convert_uint16_rtn(char16); uint16 __ovld __cnfn convert_uint16_sat_rtn(char16); uint16 __ovld __cnfn convert_uint16(char16); uint16 __ovld __cnfn convert_uint16_sat(char16); uint16 __ovld __cnfn convert_uint16_rte(uchar16); uint16 __ovld __cnfn convert_uint16_sat_rte(uchar16); uint16 __ovld __cnfn convert_uint16_rtz(uchar16); uint16 __ovld __cnfn convert_uint16_sat_rtz(uchar16); uint16 __ovld __cnfn convert_uint16_rtp(uchar16); uint16 __ovld __cnfn convert_uint16_sat_rtp(uchar16); uint16 __ovld __cnfn convert_uint16_rtn(uchar16); uint16 __ovld __cnfn convert_uint16_sat_rtn(uchar16); uint16 __ovld __cnfn convert_uint16(uchar16); uint16 __ovld __cnfn convert_uint16_sat(uchar16); uint16 __ovld __cnfn convert_uint16_rte(short16); uint16 __ovld __cnfn convert_uint16_sat_rte(short16); uint16 __ovld __cnfn convert_uint16_rtz(short16); uint16 __ovld __cnfn convert_uint16_sat_rtz(short16); uint16 __ovld __cnfn convert_uint16_rtp(short16); uint16 __ovld __cnfn convert_uint16_sat_rtp(short16); uint16 __ovld __cnfn convert_uint16_rtn(short16); uint16 __ovld __cnfn convert_uint16_sat_rtn(short16); uint16 __ovld __cnfn convert_uint16(short16); uint16 __ovld __cnfn convert_uint16_sat(short16); uint16 __ovld __cnfn convert_uint16_rte(ushort16); uint16 __ovld __cnfn convert_uint16_sat_rte(ushort16); uint16 __ovld __cnfn convert_uint16_rtz(ushort16); uint16 __ovld __cnfn convert_uint16_sat_rtz(ushort16); uint16 __ovld __cnfn convert_uint16_rtp(ushort16); uint16 __ovld __cnfn convert_uint16_sat_rtp(ushort16); uint16 __ovld __cnfn convert_uint16_rtn(ushort16); uint16 __ovld __cnfn convert_uint16_sat_rtn(ushort16); uint16 __ovld __cnfn convert_uint16(ushort16); uint16 __ovld __cnfn convert_uint16_sat(ushort16); uint16 __ovld __cnfn convert_uint16_rte(int16); uint16 __ovld __cnfn convert_uint16_sat_rte(int16); uint16 __ovld __cnfn convert_uint16_rtz(int16); uint16 __ovld __cnfn convert_uint16_sat_rtz(int16); uint16 __ovld __cnfn convert_uint16_rtp(int16); uint16 __ovld __cnfn convert_uint16_sat_rtp(int16); uint16 __ovld __cnfn convert_uint16_rtn(int16); uint16 __ovld __cnfn convert_uint16_sat_rtn(int16); uint16 __ovld __cnfn convert_uint16(int16); uint16 __ovld __cnfn convert_uint16_sat(int16); uint16 __ovld __cnfn convert_uint16_rte(uint16); uint16 __ovld __cnfn convert_uint16_sat_rte(uint16); uint16 __ovld __cnfn convert_uint16_rtz(uint16); uint16 __ovld __cnfn convert_uint16_sat_rtz(uint16); uint16 __ovld __cnfn convert_uint16_rtp(uint16); uint16 __ovld __cnfn convert_uint16_sat_rtp(uint16); uint16 __ovld __cnfn convert_uint16_rtn(uint16); uint16 __ovld __cnfn convert_uint16_sat_rtn(uint16); uint16 __ovld __cnfn convert_uint16(uint16); uint16 __ovld __cnfn convert_uint16_sat(uint16); uint16 __ovld __cnfn convert_uint16_rte(long16); uint16 __ovld __cnfn convert_uint16_sat_rte(long16); uint16 __ovld __cnfn convert_uint16_rtz(long16); uint16 __ovld __cnfn convert_uint16_sat_rtz(long16); uint16 __ovld __cnfn convert_uint16_rtp(long16); uint16 __ovld __cnfn convert_uint16_sat_rtp(long16); uint16 __ovld __cnfn convert_uint16_rtn(long16); uint16 __ovld __cnfn convert_uint16_sat_rtn(long16); uint16 __ovld __cnfn convert_uint16(long16); uint16 __ovld __cnfn convert_uint16_sat(long16); uint16 __ovld __cnfn convert_uint16_rte(ulong16); uint16 __ovld __cnfn convert_uint16_sat_rte(ulong16); uint16 __ovld __cnfn convert_uint16_rtz(ulong16); uint16 __ovld __cnfn convert_uint16_sat_rtz(ulong16); uint16 __ovld __cnfn convert_uint16_rtp(ulong16); uint16 __ovld __cnfn convert_uint16_sat_rtp(ulong16); uint16 __ovld __cnfn convert_uint16_rtn(ulong16); uint16 __ovld __cnfn convert_uint16_sat_rtn(ulong16); uint16 __ovld __cnfn convert_uint16(ulong16); uint16 __ovld __cnfn convert_uint16_sat(ulong16); uint16 __ovld __cnfn convert_uint16_rte(float16); uint16 __ovld __cnfn convert_uint16_sat_rte(float16); uint16 __ovld __cnfn convert_uint16_rtz(float16); uint16 __ovld __cnfn convert_uint16_sat_rtz(float16); uint16 __ovld __cnfn convert_uint16_rtp(float16); uint16 __ovld __cnfn convert_uint16_sat_rtp(float16); uint16 __ovld __cnfn convert_uint16_rtn(float16); uint16 __ovld __cnfn convert_uint16_sat_rtn(float16); uint16 __ovld __cnfn convert_uint16(float16); uint16 __ovld __cnfn convert_uint16_sat(float16); long16 __ovld __cnfn convert_long16_rte(char16); long16 __ovld __cnfn convert_long16_sat_rte(char16); long16 __ovld __cnfn convert_long16_rtz(char16); long16 __ovld __cnfn convert_long16_sat_rtz(char16); long16 __ovld __cnfn convert_long16_rtp(char16); long16 __ovld __cnfn convert_long16_sat_rtp(char16); long16 __ovld __cnfn convert_long16_rtn(char16); long16 __ovld __cnfn convert_long16_sat_rtn(char16); long16 __ovld __cnfn convert_long16(char16); long16 __ovld __cnfn convert_long16_sat(char16); long16 __ovld __cnfn convert_long16_rte(uchar16); long16 __ovld __cnfn convert_long16_sat_rte(uchar16); long16 __ovld __cnfn convert_long16_rtz(uchar16); long16 __ovld __cnfn convert_long16_sat_rtz(uchar16); long16 __ovld __cnfn convert_long16_rtp(uchar16); long16 __ovld __cnfn convert_long16_sat_rtp(uchar16); long16 __ovld __cnfn convert_long16_rtn(uchar16); long16 __ovld __cnfn convert_long16_sat_rtn(uchar16); long16 __ovld __cnfn convert_long16(uchar16); long16 __ovld __cnfn convert_long16_sat(uchar16); long16 __ovld __cnfn convert_long16_rte(short16); long16 __ovld __cnfn convert_long16_sat_rte(short16); long16 __ovld __cnfn convert_long16_rtz(short16); long16 __ovld __cnfn convert_long16_sat_rtz(short16); long16 __ovld __cnfn convert_long16_rtp(short16); long16 __ovld __cnfn convert_long16_sat_rtp(short16); long16 __ovld __cnfn convert_long16_rtn(short16); long16 __ovld __cnfn convert_long16_sat_rtn(short16); long16 __ovld __cnfn convert_long16(short16); long16 __ovld __cnfn convert_long16_sat(short16); long16 __ovld __cnfn convert_long16_rte(ushort16); long16 __ovld __cnfn convert_long16_sat_rte(ushort16); long16 __ovld __cnfn convert_long16_rtz(ushort16); long16 __ovld __cnfn convert_long16_sat_rtz(ushort16); long16 __ovld __cnfn convert_long16_rtp(ushort16); long16 __ovld __cnfn convert_long16_sat_rtp(ushort16); long16 __ovld __cnfn convert_long16_rtn(ushort16); long16 __ovld __cnfn convert_long16_sat_rtn(ushort16); long16 __ovld __cnfn convert_long16(ushort16); long16 __ovld __cnfn convert_long16_sat(ushort16); long16 __ovld __cnfn convert_long16_rte(int16); long16 __ovld __cnfn convert_long16_sat_rte(int16); long16 __ovld __cnfn convert_long16_rtz(int16); long16 __ovld __cnfn convert_long16_sat_rtz(int16); long16 __ovld __cnfn convert_long16_rtp(int16); long16 __ovld __cnfn convert_long16_sat_rtp(int16); long16 __ovld __cnfn convert_long16_rtn(int16); long16 __ovld __cnfn convert_long16_sat_rtn(int16); long16 __ovld __cnfn convert_long16(int16); long16 __ovld __cnfn convert_long16_sat(int16); long16 __ovld __cnfn convert_long16_rte(uint16); long16 __ovld __cnfn convert_long16_sat_rte(uint16); long16 __ovld __cnfn convert_long16_rtz(uint16); long16 __ovld __cnfn convert_long16_sat_rtz(uint16); long16 __ovld __cnfn convert_long16_rtp(uint16); long16 __ovld __cnfn convert_long16_sat_rtp(uint16); long16 __ovld __cnfn convert_long16_rtn(uint16); long16 __ovld __cnfn convert_long16_sat_rtn(uint16); long16 __ovld __cnfn convert_long16(uint16); long16 __ovld __cnfn convert_long16_sat(uint16); long16 __ovld __cnfn convert_long16_rte(long16); long16 __ovld __cnfn convert_long16_sat_rte(long16); long16 __ovld __cnfn convert_long16_rtz(long16); long16 __ovld __cnfn convert_long16_sat_rtz(long16); long16 __ovld __cnfn convert_long16_rtp(long16); long16 __ovld __cnfn convert_long16_sat_rtp(long16); long16 __ovld __cnfn convert_long16_rtn(long16); long16 __ovld __cnfn convert_long16_sat_rtn(long16); long16 __ovld __cnfn convert_long16(long16); long16 __ovld __cnfn convert_long16_sat(long16); long16 __ovld __cnfn convert_long16_rte(ulong16); long16 __ovld __cnfn convert_long16_sat_rte(ulong16); long16 __ovld __cnfn convert_long16_rtz(ulong16); long16 __ovld __cnfn convert_long16_sat_rtz(ulong16); long16 __ovld __cnfn convert_long16_rtp(ulong16); long16 __ovld __cnfn convert_long16_sat_rtp(ulong16); long16 __ovld __cnfn convert_long16_rtn(ulong16); long16 __ovld __cnfn convert_long16_sat_rtn(ulong16); long16 __ovld __cnfn convert_long16(ulong16); long16 __ovld __cnfn convert_long16_sat(ulong16); long16 __ovld __cnfn convert_long16_rte(float16); long16 __ovld __cnfn convert_long16_sat_rte(float16); long16 __ovld __cnfn convert_long16_rtz(float16); long16 __ovld __cnfn convert_long16_sat_rtz(float16); long16 __ovld __cnfn convert_long16_rtp(float16); long16 __ovld __cnfn convert_long16_sat_rtp(float16); long16 __ovld __cnfn convert_long16_rtn(float16); long16 __ovld __cnfn convert_long16_sat_rtn(float16); long16 __ovld __cnfn convert_long16(float16); long16 __ovld __cnfn convert_long16_sat(float16); ulong16 __ovld __cnfn convert_ulong16_rte(char16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(char16); ulong16 __ovld __cnfn convert_ulong16_rtz(char16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(char16); ulong16 __ovld __cnfn convert_ulong16_rtp(char16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(char16); ulong16 __ovld __cnfn convert_ulong16_rtn(char16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(char16); ulong16 __ovld __cnfn convert_ulong16(char16); ulong16 __ovld __cnfn convert_ulong16_sat(char16); ulong16 __ovld __cnfn convert_ulong16_rte(uchar16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(uchar16); ulong16 __ovld __cnfn convert_ulong16_rtz(uchar16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(uchar16); ulong16 __ovld __cnfn convert_ulong16_rtp(uchar16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(uchar16); ulong16 __ovld __cnfn convert_ulong16_rtn(uchar16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(uchar16); ulong16 __ovld __cnfn convert_ulong16(uchar16); ulong16 __ovld __cnfn convert_ulong16_sat(uchar16); ulong16 __ovld __cnfn convert_ulong16_rte(short16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(short16); ulong16 __ovld __cnfn convert_ulong16_rtz(short16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(short16); ulong16 __ovld __cnfn convert_ulong16_rtp(short16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(short16); ulong16 __ovld __cnfn convert_ulong16_rtn(short16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(short16); ulong16 __ovld __cnfn convert_ulong16(short16); ulong16 __ovld __cnfn convert_ulong16_sat(short16); ulong16 __ovld __cnfn convert_ulong16_rte(ushort16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(ushort16); ulong16 __ovld __cnfn convert_ulong16_rtz(ushort16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(ushort16); ulong16 __ovld __cnfn convert_ulong16_rtp(ushort16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(ushort16); ulong16 __ovld __cnfn convert_ulong16_rtn(ushort16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(ushort16); ulong16 __ovld __cnfn convert_ulong16(ushort16); ulong16 __ovld __cnfn convert_ulong16_sat(ushort16); ulong16 __ovld __cnfn convert_ulong16_rte(int16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(int16); ulong16 __ovld __cnfn convert_ulong16_rtz(int16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(int16); ulong16 __ovld __cnfn convert_ulong16_rtp(int16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(int16); ulong16 __ovld __cnfn convert_ulong16_rtn(int16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(int16); ulong16 __ovld __cnfn convert_ulong16(int16); ulong16 __ovld __cnfn convert_ulong16_sat(int16); ulong16 __ovld __cnfn convert_ulong16_rte(uint16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(uint16); ulong16 __ovld __cnfn convert_ulong16_rtz(uint16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(uint16); ulong16 __ovld __cnfn convert_ulong16_rtp(uint16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(uint16); ulong16 __ovld __cnfn convert_ulong16_rtn(uint16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(uint16); ulong16 __ovld __cnfn convert_ulong16(uint16); ulong16 __ovld __cnfn convert_ulong16_sat(uint16); ulong16 __ovld __cnfn convert_ulong16_rte(long16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(long16); ulong16 __ovld __cnfn convert_ulong16_rtz(long16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(long16); ulong16 __ovld __cnfn convert_ulong16_rtp(long16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(long16); ulong16 __ovld __cnfn convert_ulong16_rtn(long16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(long16); ulong16 __ovld __cnfn convert_ulong16(long16); ulong16 __ovld __cnfn convert_ulong16_sat(long16); ulong16 __ovld __cnfn convert_ulong16_rte(ulong16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(ulong16); ulong16 __ovld __cnfn convert_ulong16_rtz(ulong16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(ulong16); ulong16 __ovld __cnfn convert_ulong16_rtp(ulong16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(ulong16); ulong16 __ovld __cnfn convert_ulong16_rtn(ulong16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(ulong16); ulong16 __ovld __cnfn convert_ulong16(ulong16); ulong16 __ovld __cnfn convert_ulong16_sat(ulong16); ulong16 __ovld __cnfn convert_ulong16_rte(float16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(float16); ulong16 __ovld __cnfn convert_ulong16_rtz(float16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(float16); ulong16 __ovld __cnfn convert_ulong16_rtp(float16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(float16); ulong16 __ovld __cnfn convert_ulong16_rtn(float16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(float16); ulong16 __ovld __cnfn convert_ulong16(float16); ulong16 __ovld __cnfn convert_ulong16_sat(float16); float16 __ovld __cnfn convert_float16_rte(char16); float16 __ovld __cnfn convert_float16_rtz(char16); float16 __ovld __cnfn convert_float16_rtp(char16); float16 __ovld __cnfn convert_float16_rtn(char16); float16 __ovld __cnfn convert_float16(char16); float16 __ovld __cnfn convert_float16_rte(uchar16); float16 __ovld __cnfn convert_float16_rtz(uchar16); float16 __ovld __cnfn convert_float16_rtp(uchar16); float16 __ovld __cnfn convert_float16_rtn(uchar16); float16 __ovld __cnfn convert_float16(uchar16); float16 __ovld __cnfn convert_float16_rte(short16); float16 __ovld __cnfn convert_float16_rtz(short16); float16 __ovld __cnfn convert_float16_rtp(short16); float16 __ovld __cnfn convert_float16_rtn(short16); float16 __ovld __cnfn convert_float16(short16); float16 __ovld __cnfn convert_float16_rte(ushort16); float16 __ovld __cnfn convert_float16_rtz(ushort16); float16 __ovld __cnfn convert_float16_rtp(ushort16); float16 __ovld __cnfn convert_float16_rtn(ushort16); float16 __ovld __cnfn convert_float16(ushort16); float16 __ovld __cnfn convert_float16_rte(int16); float16 __ovld __cnfn convert_float16_rtz(int16); float16 __ovld __cnfn convert_float16_rtp(int16); float16 __ovld __cnfn convert_float16_rtn(int16); float16 __ovld __cnfn convert_float16(int16); float16 __ovld __cnfn convert_float16_rte(uint16); float16 __ovld __cnfn convert_float16_rtz(uint16); float16 __ovld __cnfn convert_float16_rtp(uint16); float16 __ovld __cnfn convert_float16_rtn(uint16); float16 __ovld __cnfn convert_float16(uint16); float16 __ovld __cnfn convert_float16_rte(long16); float16 __ovld __cnfn convert_float16_rtz(long16); float16 __ovld __cnfn convert_float16_rtp(long16); float16 __ovld __cnfn convert_float16_rtn(long16); float16 __ovld __cnfn convert_float16(long16); float16 __ovld __cnfn convert_float16_rte(ulong16); float16 __ovld __cnfn convert_float16_rtz(ulong16); float16 __ovld __cnfn convert_float16_rtp(ulong16); float16 __ovld __cnfn convert_float16_rtn(ulong16); float16 __ovld __cnfn convert_float16(ulong16); float16 __ovld __cnfn convert_float16_rte(float16); float16 __ovld __cnfn convert_float16_rtz(float16); float16 __ovld __cnfn convert_float16_rtp(float16); float16 __ovld __cnfn convert_float16_rtn(float16); float16 __ovld __cnfn convert_float16(float16); // Conversions with double data type parameters or return value. #ifdef cl_khr_fp64 char __ovld __cnfn convert_char(double); char __ovld __cnfn convert_char_rte(double); char __ovld __cnfn convert_char_rtn(double); char __ovld __cnfn convert_char_rtp(double); char __ovld __cnfn convert_char_rtz(double); char __ovld __cnfn convert_char_sat(double); char __ovld __cnfn convert_char_sat_rte(double); char __ovld __cnfn convert_char_sat_rtn(double); char __ovld __cnfn convert_char_sat_rtp(double); char __ovld __cnfn convert_char_sat_rtz(double); char2 __ovld __cnfn convert_char2(double2); char2 __ovld __cnfn convert_char2_rte(double2); char2 __ovld __cnfn convert_char2_rtn(double2); char2 __ovld __cnfn convert_char2_rtp(double2); char2 __ovld __cnfn convert_char2_rtz(double2); char2 __ovld __cnfn convert_char2_sat(double2); char2 __ovld __cnfn convert_char2_sat_rte(double2); char2 __ovld __cnfn convert_char2_sat_rtn(double2); char2 __ovld __cnfn convert_char2_sat_rtp(double2); char2 __ovld __cnfn convert_char2_sat_rtz(double2); char3 __ovld __cnfn convert_char3(double3); char3 __ovld __cnfn convert_char3_rte(double3); char3 __ovld __cnfn convert_char3_rtn(double3); char3 __ovld __cnfn convert_char3_rtp(double3); char3 __ovld __cnfn convert_char3_rtz(double3); char3 __ovld __cnfn convert_char3_sat(double3); char3 __ovld __cnfn convert_char3_sat_rte(double3); char3 __ovld __cnfn convert_char3_sat_rtn(double3); char3 __ovld __cnfn convert_char3_sat_rtp(double3); char3 __ovld __cnfn convert_char3_sat_rtz(double3); char4 __ovld __cnfn convert_char4(double4); char4 __ovld __cnfn convert_char4_rte(double4); char4 __ovld __cnfn convert_char4_rtn(double4); char4 __ovld __cnfn convert_char4_rtp(double4); char4 __ovld __cnfn convert_char4_rtz(double4); char4 __ovld __cnfn convert_char4_sat(double4); char4 __ovld __cnfn convert_char4_sat_rte(double4); char4 __ovld __cnfn convert_char4_sat_rtn(double4); char4 __ovld __cnfn convert_char4_sat_rtp(double4); char4 __ovld __cnfn convert_char4_sat_rtz(double4); char8 __ovld __cnfn convert_char8(double8); char8 __ovld __cnfn convert_char8_rte(double8); char8 __ovld __cnfn convert_char8_rtn(double8); char8 __ovld __cnfn convert_char8_rtp(double8); char8 __ovld __cnfn convert_char8_rtz(double8); char8 __ovld __cnfn convert_char8_sat(double8); char8 __ovld __cnfn convert_char8_sat_rte(double8); char8 __ovld __cnfn convert_char8_sat_rtn(double8); char8 __ovld __cnfn convert_char8_sat_rtp(double8); char8 __ovld __cnfn convert_char8_sat_rtz(double8); char16 __ovld __cnfn convert_char16(double16); char16 __ovld __cnfn convert_char16_rte(double16); char16 __ovld __cnfn convert_char16_rtn(double16); char16 __ovld __cnfn convert_char16_rtp(double16); char16 __ovld __cnfn convert_char16_rtz(double16); char16 __ovld __cnfn convert_char16_sat(double16); char16 __ovld __cnfn convert_char16_sat_rte(double16); char16 __ovld __cnfn convert_char16_sat_rtn(double16); char16 __ovld __cnfn convert_char16_sat_rtp(double16); char16 __ovld __cnfn convert_char16_sat_rtz(double16); uchar __ovld __cnfn convert_uchar(double); uchar __ovld __cnfn convert_uchar_rte(double); uchar __ovld __cnfn convert_uchar_rtn(double); uchar __ovld __cnfn convert_uchar_rtp(double); uchar __ovld __cnfn convert_uchar_rtz(double); uchar __ovld __cnfn convert_uchar_sat(double); uchar __ovld __cnfn convert_uchar_sat_rte(double); uchar __ovld __cnfn convert_uchar_sat_rtn(double); uchar __ovld __cnfn convert_uchar_sat_rtp(double); uchar __ovld __cnfn convert_uchar_sat_rtz(double); uchar2 __ovld __cnfn convert_uchar2(double2); uchar2 __ovld __cnfn convert_uchar2_rte(double2); uchar2 __ovld __cnfn convert_uchar2_rtn(double2); uchar2 __ovld __cnfn convert_uchar2_rtp(double2); uchar2 __ovld __cnfn convert_uchar2_rtz(double2); uchar2 __ovld __cnfn convert_uchar2_sat(double2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(double2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(double2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(double2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(double2); uchar3 __ovld __cnfn convert_uchar3(double3); uchar3 __ovld __cnfn convert_uchar3_rte(double3); uchar3 __ovld __cnfn convert_uchar3_rtn(double3); uchar3 __ovld __cnfn convert_uchar3_rtp(double3); uchar3 __ovld __cnfn convert_uchar3_rtz(double3); uchar3 __ovld __cnfn convert_uchar3_sat(double3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(double3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(double3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(double3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(double3); uchar4 __ovld __cnfn convert_uchar4(double4); uchar4 __ovld __cnfn convert_uchar4_rte(double4); uchar4 __ovld __cnfn convert_uchar4_rtn(double4); uchar4 __ovld __cnfn convert_uchar4_rtp(double4); uchar4 __ovld __cnfn convert_uchar4_rtz(double4); uchar4 __ovld __cnfn convert_uchar4_sat(double4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(double4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(double4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(double4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(double4); uchar8 __ovld __cnfn convert_uchar8(double8); uchar8 __ovld __cnfn convert_uchar8_rte(double8); uchar8 __ovld __cnfn convert_uchar8_rtn(double8); uchar8 __ovld __cnfn convert_uchar8_rtp(double8); uchar8 __ovld __cnfn convert_uchar8_rtz(double8); uchar8 __ovld __cnfn convert_uchar8_sat(double8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(double8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(double8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(double8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(double8); uchar16 __ovld __cnfn convert_uchar16(double16); uchar16 __ovld __cnfn convert_uchar16_rte(double16); uchar16 __ovld __cnfn convert_uchar16_rtn(double16); uchar16 __ovld __cnfn convert_uchar16_rtp(double16); uchar16 __ovld __cnfn convert_uchar16_rtz(double16); uchar16 __ovld __cnfn convert_uchar16_sat(double16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(double16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(double16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(double16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(double16); short __ovld __cnfn convert_short(double); short __ovld __cnfn convert_short_rte(double); short __ovld __cnfn convert_short_rtn(double); short __ovld __cnfn convert_short_rtp(double); short __ovld __cnfn convert_short_rtz(double); short __ovld __cnfn convert_short_sat(double); short __ovld __cnfn convert_short_sat_rte(double); short __ovld __cnfn convert_short_sat_rtn(double); short __ovld __cnfn convert_short_sat_rtp(double); short __ovld __cnfn convert_short_sat_rtz(double); short2 __ovld __cnfn convert_short2(double2); short2 __ovld __cnfn convert_short2_rte(double2); short2 __ovld __cnfn convert_short2_rtn(double2); short2 __ovld __cnfn convert_short2_rtp(double2); short2 __ovld __cnfn convert_short2_rtz(double2); short2 __ovld __cnfn convert_short2_sat(double2); short2 __ovld __cnfn convert_short2_sat_rte(double2); short2 __ovld __cnfn convert_short2_sat_rtn(double2); short2 __ovld __cnfn convert_short2_sat_rtp(double2); short2 __ovld __cnfn convert_short2_sat_rtz(double2); short3 __ovld __cnfn convert_short3(double3); short3 __ovld __cnfn convert_short3_rte(double3); short3 __ovld __cnfn convert_short3_rtn(double3); short3 __ovld __cnfn convert_short3_rtp(double3); short3 __ovld __cnfn convert_short3_rtz(double3); short3 __ovld __cnfn convert_short3_sat(double3); short3 __ovld __cnfn convert_short3_sat_rte(double3); short3 __ovld __cnfn convert_short3_sat_rtn(double3); short3 __ovld __cnfn convert_short3_sat_rtp(double3); short3 __ovld __cnfn convert_short3_sat_rtz(double3); short4 __ovld __cnfn convert_short4(double4); short4 __ovld __cnfn convert_short4_rte(double4); short4 __ovld __cnfn convert_short4_rtn(double4); short4 __ovld __cnfn convert_short4_rtp(double4); short4 __ovld __cnfn convert_short4_rtz(double4); short4 __ovld __cnfn convert_short4_sat(double4); short4 __ovld __cnfn convert_short4_sat_rte(double4); short4 __ovld __cnfn convert_short4_sat_rtn(double4); short4 __ovld __cnfn convert_short4_sat_rtp(double4); short4 __ovld __cnfn convert_short4_sat_rtz(double4); short8 __ovld __cnfn convert_short8(double8); short8 __ovld __cnfn convert_short8_rte(double8); short8 __ovld __cnfn convert_short8_rtn(double8); short8 __ovld __cnfn convert_short8_rtp(double8); short8 __ovld __cnfn convert_short8_rtz(double8); short8 __ovld __cnfn convert_short8_sat(double8); short8 __ovld __cnfn convert_short8_sat_rte(double8); short8 __ovld __cnfn convert_short8_sat_rtn(double8); short8 __ovld __cnfn convert_short8_sat_rtp(double8); short8 __ovld __cnfn convert_short8_sat_rtz(double8); short16 __ovld __cnfn convert_short16(double16); short16 __ovld __cnfn convert_short16_rte(double16); short16 __ovld __cnfn convert_short16_rtn(double16); short16 __ovld __cnfn convert_short16_rtp(double16); short16 __ovld __cnfn convert_short16_rtz(double16); short16 __ovld __cnfn convert_short16_sat(double16); short16 __ovld __cnfn convert_short16_sat_rte(double16); short16 __ovld __cnfn convert_short16_sat_rtn(double16); short16 __ovld __cnfn convert_short16_sat_rtp(double16); short16 __ovld __cnfn convert_short16_sat_rtz(double16); ushort __ovld __cnfn convert_ushort(double); ushort __ovld __cnfn convert_ushort_rte(double); ushort __ovld __cnfn convert_ushort_rtn(double); ushort __ovld __cnfn convert_ushort_rtp(double); ushort __ovld __cnfn convert_ushort_rtz(double); ushort __ovld __cnfn convert_ushort_sat(double); ushort __ovld __cnfn convert_ushort_sat_rte(double); ushort __ovld __cnfn convert_ushort_sat_rtn(double); ushort __ovld __cnfn convert_ushort_sat_rtp(double); ushort __ovld __cnfn convert_ushort_sat_rtz(double); ushort2 __ovld __cnfn convert_ushort2(double2); ushort2 __ovld __cnfn convert_ushort2_rte(double2); ushort2 __ovld __cnfn convert_ushort2_rtn(double2); ushort2 __ovld __cnfn convert_ushort2_rtp(double2); ushort2 __ovld __cnfn convert_ushort2_rtz(double2); ushort2 __ovld __cnfn convert_ushort2_sat(double2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(double2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(double2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(double2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(double2); ushort3 __ovld __cnfn convert_ushort3(double3); ushort3 __ovld __cnfn convert_ushort3_rte(double3); ushort3 __ovld __cnfn convert_ushort3_rtn(double3); ushort3 __ovld __cnfn convert_ushort3_rtp(double3); ushort3 __ovld __cnfn convert_ushort3_rtz(double3); ushort3 __ovld __cnfn convert_ushort3_sat(double3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(double3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(double3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(double3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(double3); ushort4 __ovld __cnfn convert_ushort4(double4); ushort4 __ovld __cnfn convert_ushort4_rte(double4); ushort4 __ovld __cnfn convert_ushort4_rtn(double4); ushort4 __ovld __cnfn convert_ushort4_rtp(double4); ushort4 __ovld __cnfn convert_ushort4_rtz(double4); ushort4 __ovld __cnfn convert_ushort4_sat(double4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(double4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(double4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(double4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(double4); ushort8 __ovld __cnfn convert_ushort8(double8); ushort8 __ovld __cnfn convert_ushort8_rte(double8); ushort8 __ovld __cnfn convert_ushort8_rtn(double8); ushort8 __ovld __cnfn convert_ushort8_rtp(double8); ushort8 __ovld __cnfn convert_ushort8_rtz(double8); ushort8 __ovld __cnfn convert_ushort8_sat(double8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(double8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(double8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(double8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(double8); ushort16 __ovld __cnfn convert_ushort16(double16); ushort16 __ovld __cnfn convert_ushort16_rte(double16); ushort16 __ovld __cnfn convert_ushort16_rtn(double16); ushort16 __ovld __cnfn convert_ushort16_rtp(double16); ushort16 __ovld __cnfn convert_ushort16_rtz(double16); ushort16 __ovld __cnfn convert_ushort16_sat(double16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(double16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(double16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(double16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(double16); int __ovld __cnfn convert_int(double); int __ovld __cnfn convert_int_rte(double); int __ovld __cnfn convert_int_rtn(double); int __ovld __cnfn convert_int_rtp(double); int __ovld __cnfn convert_int_rtz(double); int __ovld __cnfn convert_int_sat(double); int __ovld __cnfn convert_int_sat_rte(double); int __ovld __cnfn convert_int_sat_rtn(double); int __ovld __cnfn convert_int_sat_rtp(double); int __ovld __cnfn convert_int_sat_rtz(double); int2 __ovld __cnfn convert_int2(double2); int2 __ovld __cnfn convert_int2_rte(double2); int2 __ovld __cnfn convert_int2_rtn(double2); int2 __ovld __cnfn convert_int2_rtp(double2); int2 __ovld __cnfn convert_int2_rtz(double2); int2 __ovld __cnfn convert_int2_sat(double2); int2 __ovld __cnfn convert_int2_sat_rte(double2); int2 __ovld __cnfn convert_int2_sat_rtn(double2); int2 __ovld __cnfn convert_int2_sat_rtp(double2); int2 __ovld __cnfn convert_int2_sat_rtz(double2); int3 __ovld __cnfn convert_int3(double3); int3 __ovld __cnfn convert_int3_rte(double3); int3 __ovld __cnfn convert_int3_rtn(double3); int3 __ovld __cnfn convert_int3_rtp(double3); int3 __ovld __cnfn convert_int3_rtz(double3); int3 __ovld __cnfn convert_int3_sat(double3); int3 __ovld __cnfn convert_int3_sat_rte(double3); int3 __ovld __cnfn convert_int3_sat_rtn(double3); int3 __ovld __cnfn convert_int3_sat_rtp(double3); int3 __ovld __cnfn convert_int3_sat_rtz(double3); int4 __ovld __cnfn convert_int4(double4); int4 __ovld __cnfn convert_int4_rte(double4); int4 __ovld __cnfn convert_int4_rtn(double4); int4 __ovld __cnfn convert_int4_rtp(double4); int4 __ovld __cnfn convert_int4_rtz(double4); int4 __ovld __cnfn convert_int4_sat(double4); int4 __ovld __cnfn convert_int4_sat_rte(double4); int4 __ovld __cnfn convert_int4_sat_rtn(double4); int4 __ovld __cnfn convert_int4_sat_rtp(double4); int4 __ovld __cnfn convert_int4_sat_rtz(double4); int8 __ovld __cnfn convert_int8(double8); int8 __ovld __cnfn convert_int8_rte(double8); int8 __ovld __cnfn convert_int8_rtn(double8); int8 __ovld __cnfn convert_int8_rtp(double8); int8 __ovld __cnfn convert_int8_rtz(double8); int8 __ovld __cnfn convert_int8_sat(double8); int8 __ovld __cnfn convert_int8_sat_rte(double8); int8 __ovld __cnfn convert_int8_sat_rtn(double8); int8 __ovld __cnfn convert_int8_sat_rtp(double8); int8 __ovld __cnfn convert_int8_sat_rtz(double8); int16 __ovld __cnfn convert_int16(double16); int16 __ovld __cnfn convert_int16_rte(double16); int16 __ovld __cnfn convert_int16_rtn(double16); int16 __ovld __cnfn convert_int16_rtp(double16); int16 __ovld __cnfn convert_int16_rtz(double16); int16 __ovld __cnfn convert_int16_sat(double16); int16 __ovld __cnfn convert_int16_sat_rte(double16); int16 __ovld __cnfn convert_int16_sat_rtn(double16); int16 __ovld __cnfn convert_int16_sat_rtp(double16); int16 __ovld __cnfn convert_int16_sat_rtz(double16); uint __ovld __cnfn convert_uint(double); uint __ovld __cnfn convert_uint_rte(double); uint __ovld __cnfn convert_uint_rtn(double); uint __ovld __cnfn convert_uint_rtp(double); uint __ovld __cnfn convert_uint_rtz(double); uint __ovld __cnfn convert_uint_sat(double); uint __ovld __cnfn convert_uint_sat_rte(double); uint __ovld __cnfn convert_uint_sat_rtn(double); uint __ovld __cnfn convert_uint_sat_rtp(double); uint __ovld __cnfn convert_uint_sat_rtz(double); uint2 __ovld __cnfn convert_uint2(double2); uint2 __ovld __cnfn convert_uint2_rte(double2); uint2 __ovld __cnfn convert_uint2_rtn(double2); uint2 __ovld __cnfn convert_uint2_rtp(double2); uint2 __ovld __cnfn convert_uint2_rtz(double2); uint2 __ovld __cnfn convert_uint2_sat(double2); uint2 __ovld __cnfn convert_uint2_sat_rte(double2); uint2 __ovld __cnfn convert_uint2_sat_rtn(double2); uint2 __ovld __cnfn convert_uint2_sat_rtp(double2); uint2 __ovld __cnfn convert_uint2_sat_rtz(double2); uint3 __ovld __cnfn convert_uint3(double3); uint3 __ovld __cnfn convert_uint3_rte(double3); uint3 __ovld __cnfn convert_uint3_rtn(double3); uint3 __ovld __cnfn convert_uint3_rtp(double3); uint3 __ovld __cnfn convert_uint3_rtz(double3); uint3 __ovld __cnfn convert_uint3_sat(double3); uint3 __ovld __cnfn convert_uint3_sat_rte(double3); uint3 __ovld __cnfn convert_uint3_sat_rtn(double3); uint3 __ovld __cnfn convert_uint3_sat_rtp(double3); uint3 __ovld __cnfn convert_uint3_sat_rtz(double3); uint4 __ovld __cnfn convert_uint4(double4); uint4 __ovld __cnfn convert_uint4_rte(double4); uint4 __ovld __cnfn convert_uint4_rtn(double4); uint4 __ovld __cnfn convert_uint4_rtp(double4); uint4 __ovld __cnfn convert_uint4_rtz(double4); uint4 __ovld __cnfn convert_uint4_sat(double4); uint4 __ovld __cnfn convert_uint4_sat_rte(double4); uint4 __ovld __cnfn convert_uint4_sat_rtn(double4); uint4 __ovld __cnfn convert_uint4_sat_rtp(double4); uint4 __ovld __cnfn convert_uint4_sat_rtz(double4); uint8 __ovld __cnfn convert_uint8(double8); uint8 __ovld __cnfn convert_uint8_rte(double8); uint8 __ovld __cnfn convert_uint8_rtn(double8); uint8 __ovld __cnfn convert_uint8_rtp(double8); uint8 __ovld __cnfn convert_uint8_rtz(double8); uint8 __ovld __cnfn convert_uint8_sat(double8); uint8 __ovld __cnfn convert_uint8_sat_rte(double8); uint8 __ovld __cnfn convert_uint8_sat_rtn(double8); uint8 __ovld __cnfn convert_uint8_sat_rtp(double8); uint8 __ovld __cnfn convert_uint8_sat_rtz(double8); uint16 __ovld __cnfn convert_uint16(double16); uint16 __ovld __cnfn convert_uint16_rte(double16); uint16 __ovld __cnfn convert_uint16_rtn(double16); uint16 __ovld __cnfn convert_uint16_rtp(double16); uint16 __ovld __cnfn convert_uint16_rtz(double16); uint16 __ovld __cnfn convert_uint16_sat(double16); uint16 __ovld __cnfn convert_uint16_sat_rte(double16); uint16 __ovld __cnfn convert_uint16_sat_rtn(double16); uint16 __ovld __cnfn convert_uint16_sat_rtp(double16); uint16 __ovld __cnfn convert_uint16_sat_rtz(double16); long __ovld __cnfn convert_long(double); long __ovld __cnfn convert_long_rte(double); long __ovld __cnfn convert_long_rtn(double); long __ovld __cnfn convert_long_rtp(double); long __ovld __cnfn convert_long_rtz(double); long __ovld __cnfn convert_long_sat(double); long __ovld __cnfn convert_long_sat_rte(double); long __ovld __cnfn convert_long_sat_rtn(double); long __ovld __cnfn convert_long_sat_rtp(double); long __ovld __cnfn convert_long_sat_rtz(double); long2 __ovld __cnfn convert_long2(double2); long2 __ovld __cnfn convert_long2_rte(double2); long2 __ovld __cnfn convert_long2_rtn(double2); long2 __ovld __cnfn convert_long2_rtp(double2); long2 __ovld __cnfn convert_long2_rtz(double2); long2 __ovld __cnfn convert_long2_sat(double2); long2 __ovld __cnfn convert_long2_sat_rte(double2); long2 __ovld __cnfn convert_long2_sat_rtn(double2); long2 __ovld __cnfn convert_long2_sat_rtp(double2); long2 __ovld __cnfn convert_long2_sat_rtz(double2); long3 __ovld __cnfn convert_long3(double3); long3 __ovld __cnfn convert_long3_rte(double3); long3 __ovld __cnfn convert_long3_rtn(double3); long3 __ovld __cnfn convert_long3_rtp(double3); long3 __ovld __cnfn convert_long3_rtz(double3); long3 __ovld __cnfn convert_long3_sat(double3); long3 __ovld __cnfn convert_long3_sat_rte(double3); long3 __ovld __cnfn convert_long3_sat_rtn(double3); long3 __ovld __cnfn convert_long3_sat_rtp(double3); long3 __ovld __cnfn convert_long3_sat_rtz(double3); long4 __ovld __cnfn convert_long4(double4); long4 __ovld __cnfn convert_long4_rte(double4); long4 __ovld __cnfn convert_long4_rtn(double4); long4 __ovld __cnfn convert_long4_rtp(double4); long4 __ovld __cnfn convert_long4_rtz(double4); long4 __ovld __cnfn convert_long4_sat(double4); long4 __ovld __cnfn convert_long4_sat_rte(double4); long4 __ovld __cnfn convert_long4_sat_rtn(double4); long4 __ovld __cnfn convert_long4_sat_rtp(double4); long4 __ovld __cnfn convert_long4_sat_rtz(double4); long8 __ovld __cnfn convert_long8(double8); long8 __ovld __cnfn convert_long8_rte(double8); long8 __ovld __cnfn convert_long8_rtn(double8); long8 __ovld __cnfn convert_long8_rtp(double8); long8 __ovld __cnfn convert_long8_rtz(double8); long8 __ovld __cnfn convert_long8_sat(double8); long8 __ovld __cnfn convert_long8_sat_rte(double8); long8 __ovld __cnfn convert_long8_sat_rtn(double8); long8 __ovld __cnfn convert_long8_sat_rtp(double8); long8 __ovld __cnfn convert_long8_sat_rtz(double8); long16 __ovld __cnfn convert_long16(double16); long16 __ovld __cnfn convert_long16_rte(double16); long16 __ovld __cnfn convert_long16_rtn(double16); long16 __ovld __cnfn convert_long16_rtp(double16); long16 __ovld __cnfn convert_long16_rtz(double16); long16 __ovld __cnfn convert_long16_sat(double16); long16 __ovld __cnfn convert_long16_sat_rte(double16); long16 __ovld __cnfn convert_long16_sat_rtn(double16); long16 __ovld __cnfn convert_long16_sat_rtp(double16); long16 __ovld __cnfn convert_long16_sat_rtz(double16); ulong __ovld __cnfn convert_ulong(double); ulong __ovld __cnfn convert_ulong_rte(double); ulong __ovld __cnfn convert_ulong_rtn(double); ulong __ovld __cnfn convert_ulong_rtp(double); ulong __ovld __cnfn convert_ulong_rtz(double); ulong __ovld __cnfn convert_ulong_sat(double); ulong __ovld __cnfn convert_ulong_sat_rte(double); ulong __ovld __cnfn convert_ulong_sat_rtn(double); ulong __ovld __cnfn convert_ulong_sat_rtp(double); ulong __ovld __cnfn convert_ulong_sat_rtz(double); ulong2 __ovld __cnfn convert_ulong2(double2); ulong2 __ovld __cnfn convert_ulong2_rte(double2); ulong2 __ovld __cnfn convert_ulong2_rtn(double2); ulong2 __ovld __cnfn convert_ulong2_rtp(double2); ulong2 __ovld __cnfn convert_ulong2_rtz(double2); ulong2 __ovld __cnfn convert_ulong2_sat(double2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(double2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(double2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(double2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(double2); ulong3 __ovld __cnfn convert_ulong3(double3); ulong3 __ovld __cnfn convert_ulong3_rte(double3); ulong3 __ovld __cnfn convert_ulong3_rtn(double3); ulong3 __ovld __cnfn convert_ulong3_rtp(double3); ulong3 __ovld __cnfn convert_ulong3_rtz(double3); ulong3 __ovld __cnfn convert_ulong3_sat(double3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(double3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(double3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(double3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(double3); ulong4 __ovld __cnfn convert_ulong4(double4); ulong4 __ovld __cnfn convert_ulong4_rte(double4); ulong4 __ovld __cnfn convert_ulong4_rtn(double4); ulong4 __ovld __cnfn convert_ulong4_rtp(double4); ulong4 __ovld __cnfn convert_ulong4_rtz(double4); ulong4 __ovld __cnfn convert_ulong4_sat(double4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(double4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(double4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(double4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(double4); ulong8 __ovld __cnfn convert_ulong8(double8); ulong8 __ovld __cnfn convert_ulong8_rte(double8); ulong8 __ovld __cnfn convert_ulong8_rtn(double8); ulong8 __ovld __cnfn convert_ulong8_rtp(double8); ulong8 __ovld __cnfn convert_ulong8_rtz(double8); ulong8 __ovld __cnfn convert_ulong8_sat(double8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(double8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(double8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(double8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(double8); ulong16 __ovld __cnfn convert_ulong16(double16); ulong16 __ovld __cnfn convert_ulong16_rte(double16); ulong16 __ovld __cnfn convert_ulong16_rtn(double16); ulong16 __ovld __cnfn convert_ulong16_rtp(double16); ulong16 __ovld __cnfn convert_ulong16_rtz(double16); ulong16 __ovld __cnfn convert_ulong16_sat(double16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(double16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(double16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(double16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(double16); float __ovld __cnfn convert_float(double); float __ovld __cnfn convert_float_rte(double); float __ovld __cnfn convert_float_rtn(double); float __ovld __cnfn convert_float_rtp(double); float __ovld __cnfn convert_float_rtz(double); float2 __ovld __cnfn convert_float2(double2); float2 __ovld __cnfn convert_float2_rte(double2); float2 __ovld __cnfn convert_float2_rtn(double2); float2 __ovld __cnfn convert_float2_rtp(double2); float2 __ovld __cnfn convert_float2_rtz(double2); float3 __ovld __cnfn convert_float3(double3); float3 __ovld __cnfn convert_float3_rte(double3); float3 __ovld __cnfn convert_float3_rtn(double3); float3 __ovld __cnfn convert_float3_rtp(double3); float3 __ovld __cnfn convert_float3_rtz(double3); float4 __ovld __cnfn convert_float4(double4); float4 __ovld __cnfn convert_float4_rte(double4); float4 __ovld __cnfn convert_float4_rtn(double4); float4 __ovld __cnfn convert_float4_rtp(double4); float4 __ovld __cnfn convert_float4_rtz(double4); float8 __ovld __cnfn convert_float8(double8); float8 __ovld __cnfn convert_float8_rte(double8); float8 __ovld __cnfn convert_float8_rtn(double8); float8 __ovld __cnfn convert_float8_rtp(double8); float8 __ovld __cnfn convert_float8_rtz(double8); float16 __ovld __cnfn convert_float16(double16); float16 __ovld __cnfn convert_float16_rte(double16); float16 __ovld __cnfn convert_float16_rtn(double16); float16 __ovld __cnfn convert_float16_rtp(double16); float16 __ovld __cnfn convert_float16_rtz(double16); double __ovld __cnfn convert_double(char); double __ovld __cnfn convert_double(double); double __ovld __cnfn convert_double(float); double __ovld __cnfn convert_double(int); double __ovld __cnfn convert_double(long); double __ovld __cnfn convert_double(short); double __ovld __cnfn convert_double(uchar); double __ovld __cnfn convert_double(uint); double __ovld __cnfn convert_double(ulong); double __ovld __cnfn convert_double(ushort); double __ovld __cnfn convert_double_rte(char); double __ovld __cnfn convert_double_rte(double); double __ovld __cnfn convert_double_rte(float); double __ovld __cnfn convert_double_rte(int); double __ovld __cnfn convert_double_rte(long); double __ovld __cnfn convert_double_rte(short); double __ovld __cnfn convert_double_rte(uchar); double __ovld __cnfn convert_double_rte(uint); double __ovld __cnfn convert_double_rte(ulong); double __ovld __cnfn convert_double_rte(ushort); double __ovld __cnfn convert_double_rtn(char); double __ovld __cnfn convert_double_rtn(double); double __ovld __cnfn convert_double_rtn(float); double __ovld __cnfn convert_double_rtn(int); double __ovld __cnfn convert_double_rtn(long); double __ovld __cnfn convert_double_rtn(short); double __ovld __cnfn convert_double_rtn(uchar); double __ovld __cnfn convert_double_rtn(uint); double __ovld __cnfn convert_double_rtn(ulong); double __ovld __cnfn convert_double_rtn(ushort); double __ovld __cnfn convert_double_rtp(char); double __ovld __cnfn convert_double_rtp(double); double __ovld __cnfn convert_double_rtp(float); double __ovld __cnfn convert_double_rtp(int); double __ovld __cnfn convert_double_rtp(long); double __ovld __cnfn convert_double_rtp(short); double __ovld __cnfn convert_double_rtp(uchar); double __ovld __cnfn convert_double_rtp(uint); double __ovld __cnfn convert_double_rtp(ulong); double __ovld __cnfn convert_double_rtp(ushort); double __ovld __cnfn convert_double_rtz(char); double __ovld __cnfn convert_double_rtz(double); double __ovld __cnfn convert_double_rtz(float); double __ovld __cnfn convert_double_rtz(int); double __ovld __cnfn convert_double_rtz(long); double __ovld __cnfn convert_double_rtz(short); double __ovld __cnfn convert_double_rtz(uchar); double __ovld __cnfn convert_double_rtz(uint); double __ovld __cnfn convert_double_rtz(ulong); double __ovld __cnfn convert_double_rtz(ushort); double2 __ovld __cnfn convert_double2(char2); double2 __ovld __cnfn convert_double2(double2); double2 __ovld __cnfn convert_double2(float2); double2 __ovld __cnfn convert_double2(int2); double2 __ovld __cnfn convert_double2(long2); double2 __ovld __cnfn convert_double2(short2); double2 __ovld __cnfn convert_double2(uchar2); double2 __ovld __cnfn convert_double2(uint2); double2 __ovld __cnfn convert_double2(ulong2); double2 __ovld __cnfn convert_double2(ushort2); double2 __ovld __cnfn convert_double2_rte(char2); double2 __ovld __cnfn convert_double2_rte(double2); double2 __ovld __cnfn convert_double2_rte(float2); double2 __ovld __cnfn convert_double2_rte(int2); double2 __ovld __cnfn convert_double2_rte(long2); double2 __ovld __cnfn convert_double2_rte(short2); double2 __ovld __cnfn convert_double2_rte(uchar2); double2 __ovld __cnfn convert_double2_rte(uint2); double2 __ovld __cnfn convert_double2_rte(ulong2); double2 __ovld __cnfn convert_double2_rte(ushort2); double2 __ovld __cnfn convert_double2_rtn(char2); double2 __ovld __cnfn convert_double2_rtn(double2); double2 __ovld __cnfn convert_double2_rtn(float2); double2 __ovld __cnfn convert_double2_rtn(int2); double2 __ovld __cnfn convert_double2_rtn(long2); double2 __ovld __cnfn convert_double2_rtn(short2); double2 __ovld __cnfn convert_double2_rtn(uchar2); double2 __ovld __cnfn convert_double2_rtn(uint2); double2 __ovld __cnfn convert_double2_rtn(ulong2); double2 __ovld __cnfn convert_double2_rtn(ushort2); double2 __ovld __cnfn convert_double2_rtp(char2); double2 __ovld __cnfn convert_double2_rtp(double2); double2 __ovld __cnfn convert_double2_rtp(float2); double2 __ovld __cnfn convert_double2_rtp(int2); double2 __ovld __cnfn convert_double2_rtp(long2); double2 __ovld __cnfn convert_double2_rtp(short2); double2 __ovld __cnfn convert_double2_rtp(uchar2); double2 __ovld __cnfn convert_double2_rtp(uint2); double2 __ovld __cnfn convert_double2_rtp(ulong2); double2 __ovld __cnfn convert_double2_rtp(ushort2); double2 __ovld __cnfn convert_double2_rtz(char2); double2 __ovld __cnfn convert_double2_rtz(double2); double2 __ovld __cnfn convert_double2_rtz(float2); double2 __ovld __cnfn convert_double2_rtz(int2); double2 __ovld __cnfn convert_double2_rtz(long2); double2 __ovld __cnfn convert_double2_rtz(short2); double2 __ovld __cnfn convert_double2_rtz(uchar2); double2 __ovld __cnfn convert_double2_rtz(uint2); double2 __ovld __cnfn convert_double2_rtz(ulong2); double2 __ovld __cnfn convert_double2_rtz(ushort2); double3 __ovld __cnfn convert_double3(char3); double3 __ovld __cnfn convert_double3(double3); double3 __ovld __cnfn convert_double3(float3); double3 __ovld __cnfn convert_double3(int3); double3 __ovld __cnfn convert_double3(long3); double3 __ovld __cnfn convert_double3(short3); double3 __ovld __cnfn convert_double3(uchar3); double3 __ovld __cnfn convert_double3(uint3); double3 __ovld __cnfn convert_double3(ulong3); double3 __ovld __cnfn convert_double3(ushort3); double3 __ovld __cnfn convert_double3_rte(char3); double3 __ovld __cnfn convert_double3_rte(double3); double3 __ovld __cnfn convert_double3_rte(float3); double3 __ovld __cnfn convert_double3_rte(int3); double3 __ovld __cnfn convert_double3_rte(long3); double3 __ovld __cnfn convert_double3_rte(short3); double3 __ovld __cnfn convert_double3_rte(uchar3); double3 __ovld __cnfn convert_double3_rte(uint3); double3 __ovld __cnfn convert_double3_rte(ulong3); double3 __ovld __cnfn convert_double3_rte(ushort3); double3 __ovld __cnfn convert_double3_rtn(char3); double3 __ovld __cnfn convert_double3_rtn(double3); double3 __ovld __cnfn convert_double3_rtn(float3); double3 __ovld __cnfn convert_double3_rtn(int3); double3 __ovld __cnfn convert_double3_rtn(long3); double3 __ovld __cnfn convert_double3_rtn(short3); double3 __ovld __cnfn convert_double3_rtn(uchar3); double3 __ovld __cnfn convert_double3_rtn(uint3); double3 __ovld __cnfn convert_double3_rtn(ulong3); double3 __ovld __cnfn convert_double3_rtn(ushort3); double3 __ovld __cnfn convert_double3_rtp(char3); double3 __ovld __cnfn convert_double3_rtp(double3); double3 __ovld __cnfn convert_double3_rtp(float3); double3 __ovld __cnfn convert_double3_rtp(int3); double3 __ovld __cnfn convert_double3_rtp(long3); double3 __ovld __cnfn convert_double3_rtp(short3); double3 __ovld __cnfn convert_double3_rtp(uchar3); double3 __ovld __cnfn convert_double3_rtp(uint3); double3 __ovld __cnfn convert_double3_rtp(ulong3); double3 __ovld __cnfn convert_double3_rtp(ushort3); double3 __ovld __cnfn convert_double3_rtz(char3); double3 __ovld __cnfn convert_double3_rtz(double3); double3 __ovld __cnfn convert_double3_rtz(float3); double3 __ovld __cnfn convert_double3_rtz(int3); double3 __ovld __cnfn convert_double3_rtz(long3); double3 __ovld __cnfn convert_double3_rtz(short3); double3 __ovld __cnfn convert_double3_rtz(uchar3); double3 __ovld __cnfn convert_double3_rtz(uint3); double3 __ovld __cnfn convert_double3_rtz(ulong3); double3 __ovld __cnfn convert_double3_rtz(ushort3); double4 __ovld __cnfn convert_double4(char4); double4 __ovld __cnfn convert_double4(double4); double4 __ovld __cnfn convert_double4(float4); double4 __ovld __cnfn convert_double4(int4); double4 __ovld __cnfn convert_double4(long4); double4 __ovld __cnfn convert_double4(short4); double4 __ovld __cnfn convert_double4(uchar4); double4 __ovld __cnfn convert_double4(uint4); double4 __ovld __cnfn convert_double4(ulong4); double4 __ovld __cnfn convert_double4(ushort4); double4 __ovld __cnfn convert_double4_rte(char4); double4 __ovld __cnfn convert_double4_rte(double4); double4 __ovld __cnfn convert_double4_rte(float4); double4 __ovld __cnfn convert_double4_rte(int4); double4 __ovld __cnfn convert_double4_rte(long4); double4 __ovld __cnfn convert_double4_rte(short4); double4 __ovld __cnfn convert_double4_rte(uchar4); double4 __ovld __cnfn convert_double4_rte(uint4); double4 __ovld __cnfn convert_double4_rte(ulong4); double4 __ovld __cnfn convert_double4_rte(ushort4); double4 __ovld __cnfn convert_double4_rtn(char4); double4 __ovld __cnfn convert_double4_rtn(double4); double4 __ovld __cnfn convert_double4_rtn(float4); double4 __ovld __cnfn convert_double4_rtn(int4); double4 __ovld __cnfn convert_double4_rtn(long4); double4 __ovld __cnfn convert_double4_rtn(short4); double4 __ovld __cnfn convert_double4_rtn(uchar4); double4 __ovld __cnfn convert_double4_rtn(uint4); double4 __ovld __cnfn convert_double4_rtn(ulong4); double4 __ovld __cnfn convert_double4_rtn(ushort4); double4 __ovld __cnfn convert_double4_rtp(char4); double4 __ovld __cnfn convert_double4_rtp(double4); double4 __ovld __cnfn convert_double4_rtp(float4); double4 __ovld __cnfn convert_double4_rtp(int4); double4 __ovld __cnfn convert_double4_rtp(long4); double4 __ovld __cnfn convert_double4_rtp(short4); double4 __ovld __cnfn convert_double4_rtp(uchar4); double4 __ovld __cnfn convert_double4_rtp(uint4); double4 __ovld __cnfn convert_double4_rtp(ulong4); double4 __ovld __cnfn convert_double4_rtp(ushort4); double4 __ovld __cnfn convert_double4_rtz(char4); double4 __ovld __cnfn convert_double4_rtz(double4); double4 __ovld __cnfn convert_double4_rtz(float4); double4 __ovld __cnfn convert_double4_rtz(int4); double4 __ovld __cnfn convert_double4_rtz(long4); double4 __ovld __cnfn convert_double4_rtz(short4); double4 __ovld __cnfn convert_double4_rtz(uchar4); double4 __ovld __cnfn convert_double4_rtz(uint4); double4 __ovld __cnfn convert_double4_rtz(ulong4); double4 __ovld __cnfn convert_double4_rtz(ushort4); double8 __ovld __cnfn convert_double8(char8); double8 __ovld __cnfn convert_double8(double8); double8 __ovld __cnfn convert_double8(float8); double8 __ovld __cnfn convert_double8(int8); double8 __ovld __cnfn convert_double8(long8); double8 __ovld __cnfn convert_double8(short8); double8 __ovld __cnfn convert_double8(uchar8); double8 __ovld __cnfn convert_double8(uint8); double8 __ovld __cnfn convert_double8(ulong8); double8 __ovld __cnfn convert_double8(ushort8); double8 __ovld __cnfn convert_double8_rte(char8); double8 __ovld __cnfn convert_double8_rte(double8); double8 __ovld __cnfn convert_double8_rte(float8); double8 __ovld __cnfn convert_double8_rte(int8); double8 __ovld __cnfn convert_double8_rte(long8); double8 __ovld __cnfn convert_double8_rte(short8); double8 __ovld __cnfn convert_double8_rte(uchar8); double8 __ovld __cnfn convert_double8_rte(uint8); double8 __ovld __cnfn convert_double8_rte(ulong8); double8 __ovld __cnfn convert_double8_rte(ushort8); double8 __ovld __cnfn convert_double8_rtn(char8); double8 __ovld __cnfn convert_double8_rtn(double8); double8 __ovld __cnfn convert_double8_rtn(float8); double8 __ovld __cnfn convert_double8_rtn(int8); double8 __ovld __cnfn convert_double8_rtn(long8); double8 __ovld __cnfn convert_double8_rtn(short8); double8 __ovld __cnfn convert_double8_rtn(uchar8); double8 __ovld __cnfn convert_double8_rtn(uint8); double8 __ovld __cnfn convert_double8_rtn(ulong8); double8 __ovld __cnfn convert_double8_rtn(ushort8); double8 __ovld __cnfn convert_double8_rtp(char8); double8 __ovld __cnfn convert_double8_rtp(double8); double8 __ovld __cnfn convert_double8_rtp(float8); double8 __ovld __cnfn convert_double8_rtp(int8); double8 __ovld __cnfn convert_double8_rtp(long8); double8 __ovld __cnfn convert_double8_rtp(short8); double8 __ovld __cnfn convert_double8_rtp(uchar8); double8 __ovld __cnfn convert_double8_rtp(uint8); double8 __ovld __cnfn convert_double8_rtp(ulong8); double8 __ovld __cnfn convert_double8_rtp(ushort8); double8 __ovld __cnfn convert_double8_rtz(char8); double8 __ovld __cnfn convert_double8_rtz(double8); double8 __ovld __cnfn convert_double8_rtz(float8); double8 __ovld __cnfn convert_double8_rtz(int8); double8 __ovld __cnfn convert_double8_rtz(long8); double8 __ovld __cnfn convert_double8_rtz(short8); double8 __ovld __cnfn convert_double8_rtz(uchar8); double8 __ovld __cnfn convert_double8_rtz(uint8); double8 __ovld __cnfn convert_double8_rtz(ulong8); double8 __ovld __cnfn convert_double8_rtz(ushort8); double16 __ovld __cnfn convert_double16(char16); double16 __ovld __cnfn convert_double16(double16); double16 __ovld __cnfn convert_double16(float16); double16 __ovld __cnfn convert_double16(int16); double16 __ovld __cnfn convert_double16(long16); double16 __ovld __cnfn convert_double16(short16); double16 __ovld __cnfn convert_double16(uchar16); double16 __ovld __cnfn convert_double16(uint16); double16 __ovld __cnfn convert_double16(ulong16); double16 __ovld __cnfn convert_double16(ushort16); double16 __ovld __cnfn convert_double16_rte(char16); double16 __ovld __cnfn convert_double16_rte(double16); double16 __ovld __cnfn convert_double16_rte(float16); double16 __ovld __cnfn convert_double16_rte(int16); double16 __ovld __cnfn convert_double16_rte(long16); double16 __ovld __cnfn convert_double16_rte(short16); double16 __ovld __cnfn convert_double16_rte(uchar16); double16 __ovld __cnfn convert_double16_rte(uint16); double16 __ovld __cnfn convert_double16_rte(ulong16); double16 __ovld __cnfn convert_double16_rte(ushort16); double16 __ovld __cnfn convert_double16_rtn(char16); double16 __ovld __cnfn convert_double16_rtn(double16); double16 __ovld __cnfn convert_double16_rtn(float16); double16 __ovld __cnfn convert_double16_rtn(int16); double16 __ovld __cnfn convert_double16_rtn(long16); double16 __ovld __cnfn convert_double16_rtn(short16); double16 __ovld __cnfn convert_double16_rtn(uchar16); double16 __ovld __cnfn convert_double16_rtn(uint16); double16 __ovld __cnfn convert_double16_rtn(ulong16); double16 __ovld __cnfn convert_double16_rtn(ushort16); double16 __ovld __cnfn convert_double16_rtp(char16); double16 __ovld __cnfn convert_double16_rtp(double16); double16 __ovld __cnfn convert_double16_rtp(float16); double16 __ovld __cnfn convert_double16_rtp(int16); double16 __ovld __cnfn convert_double16_rtp(long16); double16 __ovld __cnfn convert_double16_rtp(short16); double16 __ovld __cnfn convert_double16_rtp(uchar16); double16 __ovld __cnfn convert_double16_rtp(uint16); double16 __ovld __cnfn convert_double16_rtp(ulong16); double16 __ovld __cnfn convert_double16_rtp(ushort16); double16 __ovld __cnfn convert_double16_rtz(char16); double16 __ovld __cnfn convert_double16_rtz(double16); double16 __ovld __cnfn convert_double16_rtz(float16); double16 __ovld __cnfn convert_double16_rtz(int16); double16 __ovld __cnfn convert_double16_rtz(long16); double16 __ovld __cnfn convert_double16_rtz(short16); double16 __ovld __cnfn convert_double16_rtz(uchar16); double16 __ovld __cnfn convert_double16_rtz(uint16); double16 __ovld __cnfn convert_double16_rtz(ulong16); double16 __ovld __cnfn convert_double16_rtz(ushort16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 // Convert half types to non-double types. uchar __ovld __cnfn convert_uchar(half); uchar __ovld __cnfn convert_uchar_rte(half); uchar __ovld __cnfn convert_uchar_rtp(half); uchar __ovld __cnfn convert_uchar_rtn(half); uchar __ovld __cnfn convert_uchar_rtz(half); uchar __ovld __cnfn convert_uchar_sat(half); uchar __ovld __cnfn convert_uchar_sat_rte(half); uchar __ovld __cnfn convert_uchar_sat_rtp(half); uchar __ovld __cnfn convert_uchar_sat_rtn(half); uchar __ovld __cnfn convert_uchar_sat_rtz(half); uchar2 __ovld __cnfn convert_uchar2(half2); uchar2 __ovld __cnfn convert_uchar2_rte(half2); uchar2 __ovld __cnfn convert_uchar2_rtp(half2); uchar2 __ovld __cnfn convert_uchar2_rtn(half2); uchar2 __ovld __cnfn convert_uchar2_rtz(half2); uchar2 __ovld __cnfn convert_uchar2_sat(half2); uchar2 __ovld __cnfn convert_uchar2_sat_rte(half2); uchar2 __ovld __cnfn convert_uchar2_sat_rtp(half2); uchar2 __ovld __cnfn convert_uchar2_sat_rtn(half2); uchar2 __ovld __cnfn convert_uchar2_sat_rtz(half2); uchar3 __ovld __cnfn convert_uchar3(half3); uchar3 __ovld __cnfn convert_uchar3_rte(half3); uchar3 __ovld __cnfn convert_uchar3_rtp(half3); uchar3 __ovld __cnfn convert_uchar3_rtn(half3); uchar3 __ovld __cnfn convert_uchar3_rtz(half3); uchar3 __ovld __cnfn convert_uchar3_sat(half3); uchar3 __ovld __cnfn convert_uchar3_sat_rte(half3); uchar3 __ovld __cnfn convert_uchar3_sat_rtp(half3); uchar3 __ovld __cnfn convert_uchar3_sat_rtn(half3); uchar3 __ovld __cnfn convert_uchar3_sat_rtz(half3); uchar4 __ovld __cnfn convert_uchar4(half4); uchar4 __ovld __cnfn convert_uchar4_rte(half4); uchar4 __ovld __cnfn convert_uchar4_rtp(half4); uchar4 __ovld __cnfn convert_uchar4_rtn(half4); uchar4 __ovld __cnfn convert_uchar4_rtz(half4); uchar4 __ovld __cnfn convert_uchar4_sat(half4); uchar4 __ovld __cnfn convert_uchar4_sat_rte(half4); uchar4 __ovld __cnfn convert_uchar4_sat_rtp(half4); uchar4 __ovld __cnfn convert_uchar4_sat_rtn(half4); uchar4 __ovld __cnfn convert_uchar4_sat_rtz(half4); uchar8 __ovld __cnfn convert_uchar8(half8); uchar8 __ovld __cnfn convert_uchar8_rte(half8); uchar8 __ovld __cnfn convert_uchar8_rtp(half8); uchar8 __ovld __cnfn convert_uchar8_rtn(half8); uchar8 __ovld __cnfn convert_uchar8_rtz(half8); uchar8 __ovld __cnfn convert_uchar8_sat(half8); uchar8 __ovld __cnfn convert_uchar8_sat_rte(half8); uchar8 __ovld __cnfn convert_uchar8_sat_rtp(half8); uchar8 __ovld __cnfn convert_uchar8_sat_rtn(half8); uchar8 __ovld __cnfn convert_uchar8_sat_rtz(half8); uchar16 __ovld __cnfn convert_uchar16(half16); uchar16 __ovld __cnfn convert_uchar16_rte(half16); uchar16 __ovld __cnfn convert_uchar16_rtp(half16); uchar16 __ovld __cnfn convert_uchar16_rtn(half16); uchar16 __ovld __cnfn convert_uchar16_rtz(half16); uchar16 __ovld __cnfn convert_uchar16_sat(half16); uchar16 __ovld __cnfn convert_uchar16_sat_rte(half16); uchar16 __ovld __cnfn convert_uchar16_sat_rtp(half16); uchar16 __ovld __cnfn convert_uchar16_sat_rtn(half16); uchar16 __ovld __cnfn convert_uchar16_sat_rtz(half16); ushort __ovld __cnfn convert_ushort(half); ushort __ovld __cnfn convert_ushort_rte(half); ushort __ovld __cnfn convert_ushort_rtp(half); ushort __ovld __cnfn convert_ushort_rtn(half); ushort __ovld __cnfn convert_ushort_rtz(half); ushort __ovld __cnfn convert_ushort_sat(half); ushort __ovld __cnfn convert_ushort_sat_rte(half); ushort __ovld __cnfn convert_ushort_sat_rtp(half); ushort __ovld __cnfn convert_ushort_sat_rtn(half); ushort __ovld __cnfn convert_ushort_sat_rtz(half); ushort2 __ovld __cnfn convert_ushort2(half2); ushort2 __ovld __cnfn convert_ushort2_rte(half2); ushort2 __ovld __cnfn convert_ushort2_rtp(half2); ushort2 __ovld __cnfn convert_ushort2_rtn(half2); ushort2 __ovld __cnfn convert_ushort2_rtz(half2); ushort2 __ovld __cnfn convert_ushort2_sat(half2); ushort2 __ovld __cnfn convert_ushort2_sat_rte(half2); ushort2 __ovld __cnfn convert_ushort2_sat_rtp(half2); ushort2 __ovld __cnfn convert_ushort2_sat_rtn(half2); ushort2 __ovld __cnfn convert_ushort2_sat_rtz(half2); ushort3 __ovld __cnfn convert_ushort3(half3); ushort3 __ovld __cnfn convert_ushort3_rte(half3); ushort3 __ovld __cnfn convert_ushort3_rtp(half3); ushort3 __ovld __cnfn convert_ushort3_rtn(half3); ushort3 __ovld __cnfn convert_ushort3_rtz(half3); ushort3 __ovld __cnfn convert_ushort3_sat(half3); ushort3 __ovld __cnfn convert_ushort3_sat_rte(half3); ushort3 __ovld __cnfn convert_ushort3_sat_rtp(half3); ushort3 __ovld __cnfn convert_ushort3_sat_rtn(half3); ushort3 __ovld __cnfn convert_ushort3_sat_rtz(half3); ushort4 __ovld __cnfn convert_ushort4(half4); ushort4 __ovld __cnfn convert_ushort4_rte(half4); ushort4 __ovld __cnfn convert_ushort4_rtp(half4); ushort4 __ovld __cnfn convert_ushort4_rtn(half4); ushort4 __ovld __cnfn convert_ushort4_rtz(half4); ushort4 __ovld __cnfn convert_ushort4_sat(half4); ushort4 __ovld __cnfn convert_ushort4_sat_rte(half4); ushort4 __ovld __cnfn convert_ushort4_sat_rtp(half4); ushort4 __ovld __cnfn convert_ushort4_sat_rtn(half4); ushort4 __ovld __cnfn convert_ushort4_sat_rtz(half4); ushort8 __ovld __cnfn convert_ushort8(half8); ushort8 __ovld __cnfn convert_ushort8_rte(half8); ushort8 __ovld __cnfn convert_ushort8_rtp(half8); ushort8 __ovld __cnfn convert_ushort8_rtn(half8); ushort8 __ovld __cnfn convert_ushort8_rtz(half8); ushort8 __ovld __cnfn convert_ushort8_sat(half8); ushort8 __ovld __cnfn convert_ushort8_sat_rte(half8); ushort8 __ovld __cnfn convert_ushort8_sat_rtp(half8); ushort8 __ovld __cnfn convert_ushort8_sat_rtn(half8); ushort8 __ovld __cnfn convert_ushort8_sat_rtz(half8); ushort16 __ovld __cnfn convert_ushort16(half16); ushort16 __ovld __cnfn convert_ushort16_rte(half16); ushort16 __ovld __cnfn convert_ushort16_rtp(half16); ushort16 __ovld __cnfn convert_ushort16_rtn(half16); ushort16 __ovld __cnfn convert_ushort16_rtz(half16); ushort16 __ovld __cnfn convert_ushort16_sat(half16); ushort16 __ovld __cnfn convert_ushort16_sat_rte(half16); ushort16 __ovld __cnfn convert_ushort16_sat_rtp(half16); ushort16 __ovld __cnfn convert_ushort16_sat_rtn(half16); ushort16 __ovld __cnfn convert_ushort16_sat_rtz(half16); uint __ovld __cnfn convert_uint(half); uint __ovld __cnfn convert_uint_rte(half); uint __ovld __cnfn convert_uint_rtp(half); uint __ovld __cnfn convert_uint_rtn(half); uint __ovld __cnfn convert_uint_rtz(half); uint __ovld __cnfn convert_uint_sat(half); uint __ovld __cnfn convert_uint_sat_rte(half); uint __ovld __cnfn convert_uint_sat_rtp(half); uint __ovld __cnfn convert_uint_sat_rtn(half); uint __ovld __cnfn convert_uint_sat_rtz(half); uint2 __ovld __cnfn convert_uint2(half2); uint2 __ovld __cnfn convert_uint2_rte(half2); uint2 __ovld __cnfn convert_uint2_rtp(half2); uint2 __ovld __cnfn convert_uint2_rtn(half2); uint2 __ovld __cnfn convert_uint2_rtz(half2); uint2 __ovld __cnfn convert_uint2_sat(half2); uint2 __ovld __cnfn convert_uint2_sat_rte(half2); uint2 __ovld __cnfn convert_uint2_sat_rtp(half2); uint2 __ovld __cnfn convert_uint2_sat_rtn(half2); uint2 __ovld __cnfn convert_uint2_sat_rtz(half2); uint3 __ovld __cnfn convert_uint3(half3); uint3 __ovld __cnfn convert_uint3_rte(half3); uint3 __ovld __cnfn convert_uint3_rtp(half3); uint3 __ovld __cnfn convert_uint3_rtn(half3); uint3 __ovld __cnfn convert_uint3_rtz(half3); uint3 __ovld __cnfn convert_uint3_sat(half3); uint3 __ovld __cnfn convert_uint3_sat_rte(half3); uint3 __ovld __cnfn convert_uint3_sat_rtp(half3); uint3 __ovld __cnfn convert_uint3_sat_rtn(half3); uint3 __ovld __cnfn convert_uint3_sat_rtz(half3); uint4 __ovld __cnfn convert_uint4(half4); uint4 __ovld __cnfn convert_uint4_rte(half4); uint4 __ovld __cnfn convert_uint4_rtp(half4); uint4 __ovld __cnfn convert_uint4_rtn(half4); uint4 __ovld __cnfn convert_uint4_rtz(half4); uint4 __ovld __cnfn convert_uint4_sat(half4); uint4 __ovld __cnfn convert_uint4_sat_rte(half4); uint4 __ovld __cnfn convert_uint4_sat_rtp(half4); uint4 __ovld __cnfn convert_uint4_sat_rtn(half4); uint4 __ovld __cnfn convert_uint4_sat_rtz(half4); uint8 __ovld __cnfn convert_uint8(half8); uint8 __ovld __cnfn convert_uint8_rte(half8); uint8 __ovld __cnfn convert_uint8_rtp(half8); uint8 __ovld __cnfn convert_uint8_rtn(half8); uint8 __ovld __cnfn convert_uint8_rtz(half8); uint8 __ovld __cnfn convert_uint8_sat(half8); uint8 __ovld __cnfn convert_uint8_sat_rte(half8); uint8 __ovld __cnfn convert_uint8_sat_rtp(half8); uint8 __ovld __cnfn convert_uint8_sat_rtn(half8); uint8 __ovld __cnfn convert_uint8_sat_rtz(half8); uint16 __ovld __cnfn convert_uint16(half16); uint16 __ovld __cnfn convert_uint16_rte(half16); uint16 __ovld __cnfn convert_uint16_rtp(half16); uint16 __ovld __cnfn convert_uint16_rtn(half16); uint16 __ovld __cnfn convert_uint16_rtz(half16); uint16 __ovld __cnfn convert_uint16_sat(half16); uint16 __ovld __cnfn convert_uint16_sat_rte(half16); uint16 __ovld __cnfn convert_uint16_sat_rtp(half16); uint16 __ovld __cnfn convert_uint16_sat_rtn(half16); uint16 __ovld __cnfn convert_uint16_sat_rtz(half16); ulong __ovld __cnfn convert_ulong(half); ulong __ovld __cnfn convert_ulong_rte(half); ulong __ovld __cnfn convert_ulong_rtp(half); ulong __ovld __cnfn convert_ulong_rtn(half); ulong __ovld __cnfn convert_ulong_rtz(half); ulong __ovld __cnfn convert_ulong_sat(half); ulong __ovld __cnfn convert_ulong_sat_rte(half); ulong __ovld __cnfn convert_ulong_sat_rtp(half); ulong __ovld __cnfn convert_ulong_sat_rtn(half); ulong __ovld __cnfn convert_ulong_sat_rtz(half); ulong2 __ovld __cnfn convert_ulong2(half2); ulong2 __ovld __cnfn convert_ulong2_rte(half2); ulong2 __ovld __cnfn convert_ulong2_rtp(half2); ulong2 __ovld __cnfn convert_ulong2_rtn(half2); ulong2 __ovld __cnfn convert_ulong2_rtz(half2); ulong2 __ovld __cnfn convert_ulong2_sat(half2); ulong2 __ovld __cnfn convert_ulong2_sat_rte(half2); ulong2 __ovld __cnfn convert_ulong2_sat_rtp(half2); ulong2 __ovld __cnfn convert_ulong2_sat_rtn(half2); ulong2 __ovld __cnfn convert_ulong2_sat_rtz(half2); ulong3 __ovld __cnfn convert_ulong3(half3); ulong3 __ovld __cnfn convert_ulong3_rte(half3); ulong3 __ovld __cnfn convert_ulong3_rtp(half3); ulong3 __ovld __cnfn convert_ulong3_rtn(half3); ulong3 __ovld __cnfn convert_ulong3_rtz(half3); ulong3 __ovld __cnfn convert_ulong3_sat(half3); ulong3 __ovld __cnfn convert_ulong3_sat_rte(half3); ulong3 __ovld __cnfn convert_ulong3_sat_rtp(half3); ulong3 __ovld __cnfn convert_ulong3_sat_rtn(half3); ulong3 __ovld __cnfn convert_ulong3_sat_rtz(half3); ulong4 __ovld __cnfn convert_ulong4(half4); ulong4 __ovld __cnfn convert_ulong4_rte(half4); ulong4 __ovld __cnfn convert_ulong4_rtp(half4); ulong4 __ovld __cnfn convert_ulong4_rtn(half4); ulong4 __ovld __cnfn convert_ulong4_rtz(half4); ulong4 __ovld __cnfn convert_ulong4_sat(half4); ulong4 __ovld __cnfn convert_ulong4_sat_rte(half4); ulong4 __ovld __cnfn convert_ulong4_sat_rtp(half4); ulong4 __ovld __cnfn convert_ulong4_sat_rtn(half4); ulong4 __ovld __cnfn convert_ulong4_sat_rtz(half4); ulong8 __ovld __cnfn convert_ulong8(half8); ulong8 __ovld __cnfn convert_ulong8_rte(half8); ulong8 __ovld __cnfn convert_ulong8_rtp(half8); ulong8 __ovld __cnfn convert_ulong8_rtn(half8); ulong8 __ovld __cnfn convert_ulong8_rtz(half8); ulong8 __ovld __cnfn convert_ulong8_sat(half8); ulong8 __ovld __cnfn convert_ulong8_sat_rte(half8); ulong8 __ovld __cnfn convert_ulong8_sat_rtp(half8); ulong8 __ovld __cnfn convert_ulong8_sat_rtn(half8); ulong8 __ovld __cnfn convert_ulong8_sat_rtz(half8); ulong16 __ovld __cnfn convert_ulong16(half16); ulong16 __ovld __cnfn convert_ulong16_rte(half16); ulong16 __ovld __cnfn convert_ulong16_rtp(half16); ulong16 __ovld __cnfn convert_ulong16_rtn(half16); ulong16 __ovld __cnfn convert_ulong16_rtz(half16); ulong16 __ovld __cnfn convert_ulong16_sat(half16); ulong16 __ovld __cnfn convert_ulong16_sat_rte(half16); ulong16 __ovld __cnfn convert_ulong16_sat_rtp(half16); ulong16 __ovld __cnfn convert_ulong16_sat_rtn(half16); ulong16 __ovld __cnfn convert_ulong16_sat_rtz(half16); char __ovld __cnfn convert_char(half); char __ovld __cnfn convert_char_rte(half); char __ovld __cnfn convert_char_rtp(half); char __ovld __cnfn convert_char_rtn(half); char __ovld __cnfn convert_char_rtz(half); char __ovld __cnfn convert_char_sat(half); char __ovld __cnfn convert_char_sat_rte(half); char __ovld __cnfn convert_char_sat_rtp(half); char __ovld __cnfn convert_char_sat_rtn(half); char __ovld __cnfn convert_char_sat_rtz(half); char2 __ovld __cnfn convert_char2(half2); char2 __ovld __cnfn convert_char2_rte(half2); char2 __ovld __cnfn convert_char2_rtp(half2); char2 __ovld __cnfn convert_char2_rtn(half2); char2 __ovld __cnfn convert_char2_rtz(half2); char2 __ovld __cnfn convert_char2_sat(half2); char2 __ovld __cnfn convert_char2_sat_rte(half2); char2 __ovld __cnfn convert_char2_sat_rtp(half2); char2 __ovld __cnfn convert_char2_sat_rtn(half2); char2 __ovld __cnfn convert_char2_sat_rtz(half2); char3 __ovld __cnfn convert_char3(half3); char3 __ovld __cnfn convert_char3_rte(half3); char3 __ovld __cnfn convert_char3_rtp(half3); char3 __ovld __cnfn convert_char3_rtn(half3); char3 __ovld __cnfn convert_char3_rtz(half3); char3 __ovld __cnfn convert_char3_sat(half3); char3 __ovld __cnfn convert_char3_sat_rte(half3); char3 __ovld __cnfn convert_char3_sat_rtp(half3); char3 __ovld __cnfn convert_char3_sat_rtn(half3); char3 __ovld __cnfn convert_char3_sat_rtz(half3); char4 __ovld __cnfn convert_char4(half4); char4 __ovld __cnfn convert_char4_rte(half4); char4 __ovld __cnfn convert_char4_rtp(half4); char4 __ovld __cnfn convert_char4_rtn(half4); char4 __ovld __cnfn convert_char4_rtz(half4); char4 __ovld __cnfn convert_char4_sat(half4); char4 __ovld __cnfn convert_char4_sat_rte(half4); char4 __ovld __cnfn convert_char4_sat_rtp(half4); char4 __ovld __cnfn convert_char4_sat_rtn(half4); char4 __ovld __cnfn convert_char4_sat_rtz(half4); char8 __ovld __cnfn convert_char8(half8); char8 __ovld __cnfn convert_char8_rte(half8); char8 __ovld __cnfn convert_char8_rtp(half8); char8 __ovld __cnfn convert_char8_rtn(half8); char8 __ovld __cnfn convert_char8_rtz(half8); char8 __ovld __cnfn convert_char8_sat(half8); char8 __ovld __cnfn convert_char8_sat_rte(half8); char8 __ovld __cnfn convert_char8_sat_rtp(half8); char8 __ovld __cnfn convert_char8_sat_rtn(half8); char8 __ovld __cnfn convert_char8_sat_rtz(half8); char16 __ovld __cnfn convert_char16(half16); char16 __ovld __cnfn convert_char16_rte(half16); char16 __ovld __cnfn convert_char16_rtp(half16); char16 __ovld __cnfn convert_char16_rtn(half16); char16 __ovld __cnfn convert_char16_rtz(half16); char16 __ovld __cnfn convert_char16_sat(half16); char16 __ovld __cnfn convert_char16_sat_rte(half16); char16 __ovld __cnfn convert_char16_sat_rtp(half16); char16 __ovld __cnfn convert_char16_sat_rtn(half16); char16 __ovld __cnfn convert_char16_sat_rtz(half16); short __ovld __cnfn convert_short(half); short __ovld __cnfn convert_short_rte(half); short __ovld __cnfn convert_short_rtp(half); short __ovld __cnfn convert_short_rtn(half); short __ovld __cnfn convert_short_rtz(half); short __ovld __cnfn convert_short_sat(half); short __ovld __cnfn convert_short_sat_rte(half); short __ovld __cnfn convert_short_sat_rtp(half); short __ovld __cnfn convert_short_sat_rtn(half); short __ovld __cnfn convert_short_sat_rtz(half); short2 __ovld __cnfn convert_short2(half2); short2 __ovld __cnfn convert_short2_rte(half2); short2 __ovld __cnfn convert_short2_rtp(half2); short2 __ovld __cnfn convert_short2_rtn(half2); short2 __ovld __cnfn convert_short2_rtz(half2); short2 __ovld __cnfn convert_short2_sat(half2); short2 __ovld __cnfn convert_short2_sat_rte(half2); short2 __ovld __cnfn convert_short2_sat_rtp(half2); short2 __ovld __cnfn convert_short2_sat_rtn(half2); short2 __ovld __cnfn convert_short2_sat_rtz(half2); short3 __ovld __cnfn convert_short3(half3); short3 __ovld __cnfn convert_short3_rte(half3); short3 __ovld __cnfn convert_short3_rtp(half3); short3 __ovld __cnfn convert_short3_rtn(half3); short3 __ovld __cnfn convert_short3_rtz(half3); short3 __ovld __cnfn convert_short3_sat(half3); short3 __ovld __cnfn convert_short3_sat_rte(half3); short3 __ovld __cnfn convert_short3_sat_rtp(half3); short3 __ovld __cnfn convert_short3_sat_rtn(half3); short3 __ovld __cnfn convert_short3_sat_rtz(half3); short4 __ovld __cnfn convert_short4(half4); short4 __ovld __cnfn convert_short4_rte(half4); short4 __ovld __cnfn convert_short4_rtp(half4); short4 __ovld __cnfn convert_short4_rtn(half4); short4 __ovld __cnfn convert_short4_rtz(half4); short4 __ovld __cnfn convert_short4_sat(half4); short4 __ovld __cnfn convert_short4_sat_rte(half4); short4 __ovld __cnfn convert_short4_sat_rtp(half4); short4 __ovld __cnfn convert_short4_sat_rtn(half4); short4 __ovld __cnfn convert_short4_sat_rtz(half4); short8 __ovld __cnfn convert_short8(half8); short8 __ovld __cnfn convert_short8_rte(half8); short8 __ovld __cnfn convert_short8_rtp(half8); short8 __ovld __cnfn convert_short8_rtn(half8); short8 __ovld __cnfn convert_short8_rtz(half8); short8 __ovld __cnfn convert_short8_sat(half8); short8 __ovld __cnfn convert_short8_sat_rte(half8); short8 __ovld __cnfn convert_short8_sat_rtp(half8); short8 __ovld __cnfn convert_short8_sat_rtn(half8); short8 __ovld __cnfn convert_short8_sat_rtz(half8); short16 __ovld __cnfn convert_short16(half16); short16 __ovld __cnfn convert_short16_rte(half16); short16 __ovld __cnfn convert_short16_rtp(half16); short16 __ovld __cnfn convert_short16_rtn(half16); short16 __ovld __cnfn convert_short16_rtz(half16); short16 __ovld __cnfn convert_short16_sat(half16); short16 __ovld __cnfn convert_short16_sat_rte(half16); short16 __ovld __cnfn convert_short16_sat_rtp(half16); short16 __ovld __cnfn convert_short16_sat_rtn(half16); short16 __ovld __cnfn convert_short16_sat_rtz(half16); int __ovld __cnfn convert_int(half); int __ovld __cnfn convert_int_rte(half); int __ovld __cnfn convert_int_rtp(half); int __ovld __cnfn convert_int_rtn(half); int __ovld __cnfn convert_int_rtz(half); int __ovld __cnfn convert_int_sat(half); int __ovld __cnfn convert_int_sat_rte(half); int __ovld __cnfn convert_int_sat_rtp(half); int __ovld __cnfn convert_int_sat_rtn(half); int __ovld __cnfn convert_int_sat_rtz(half); int2 __ovld __cnfn convert_int2(half2); int2 __ovld __cnfn convert_int2_rte(half2); int2 __ovld __cnfn convert_int2_rtp(half2); int2 __ovld __cnfn convert_int2_rtn(half2); int2 __ovld __cnfn convert_int2_rtz(half2); int2 __ovld __cnfn convert_int2_sat(half2); int2 __ovld __cnfn convert_int2_sat_rte(half2); int2 __ovld __cnfn convert_int2_sat_rtp(half2); int2 __ovld __cnfn convert_int2_sat_rtn(half2); int2 __ovld __cnfn convert_int2_sat_rtz(half2); int3 __ovld __cnfn convert_int3(half3); int3 __ovld __cnfn convert_int3_rte(half3); int3 __ovld __cnfn convert_int3_rtp(half3); int3 __ovld __cnfn convert_int3_rtn(half3); int3 __ovld __cnfn convert_int3_rtz(half3); int3 __ovld __cnfn convert_int3_sat(half3); int3 __ovld __cnfn convert_int3_sat_rte(half3); int3 __ovld __cnfn convert_int3_sat_rtp(half3); int3 __ovld __cnfn convert_int3_sat_rtn(half3); int3 __ovld __cnfn convert_int3_sat_rtz(half3); int4 __ovld __cnfn convert_int4(half4); int4 __ovld __cnfn convert_int4_rte(half4); int4 __ovld __cnfn convert_int4_rtp(half4); int4 __ovld __cnfn convert_int4_rtn(half4); int4 __ovld __cnfn convert_int4_rtz(half4); int4 __ovld __cnfn convert_int4_sat(half4); int4 __ovld __cnfn convert_int4_sat_rte(half4); int4 __ovld __cnfn convert_int4_sat_rtp(half4); int4 __ovld __cnfn convert_int4_sat_rtn(half4); int4 __ovld __cnfn convert_int4_sat_rtz(half4); int8 __ovld __cnfn convert_int8(half8); int8 __ovld __cnfn convert_int8_rte(half8); int8 __ovld __cnfn convert_int8_rtp(half8); int8 __ovld __cnfn convert_int8_rtn(half8); int8 __ovld __cnfn convert_int8_rtz(half8); int8 __ovld __cnfn convert_int8_sat(half8); int8 __ovld __cnfn convert_int8_sat_rte(half8); int8 __ovld __cnfn convert_int8_sat_rtp(half8); int8 __ovld __cnfn convert_int8_sat_rtn(half8); int8 __ovld __cnfn convert_int8_sat_rtz(half8); int16 __ovld __cnfn convert_int16(half16); int16 __ovld __cnfn convert_int16_rte(half16); int16 __ovld __cnfn convert_int16_rtp(half16); int16 __ovld __cnfn convert_int16_rtn(half16); int16 __ovld __cnfn convert_int16_rtz(half16); int16 __ovld __cnfn convert_int16_sat(half16); int16 __ovld __cnfn convert_int16_sat_rte(half16); int16 __ovld __cnfn convert_int16_sat_rtp(half16); int16 __ovld __cnfn convert_int16_sat_rtn(half16); int16 __ovld __cnfn convert_int16_sat_rtz(half16); long __ovld __cnfn convert_long(half); long __ovld __cnfn convert_long_rte(half); long __ovld __cnfn convert_long_rtp(half); long __ovld __cnfn convert_long_rtn(half); long __ovld __cnfn convert_long_rtz(half); long __ovld __cnfn convert_long_sat(half); long __ovld __cnfn convert_long_sat_rte(half); long __ovld __cnfn convert_long_sat_rtp(half); long __ovld __cnfn convert_long_sat_rtn(half); long __ovld __cnfn convert_long_sat_rtz(half); long2 __ovld __cnfn convert_long2(half2); long2 __ovld __cnfn convert_long2_rte(half2); long2 __ovld __cnfn convert_long2_rtp(half2); long2 __ovld __cnfn convert_long2_rtn(half2); long2 __ovld __cnfn convert_long2_rtz(half2); long2 __ovld __cnfn convert_long2_sat(half2); long2 __ovld __cnfn convert_long2_sat_rte(half2); long2 __ovld __cnfn convert_long2_sat_rtp(half2); long2 __ovld __cnfn convert_long2_sat_rtn(half2); long2 __ovld __cnfn convert_long2_sat_rtz(half2); long3 __ovld __cnfn convert_long3(half3); long3 __ovld __cnfn convert_long3_rte(half3); long3 __ovld __cnfn convert_long3_rtp(half3); long3 __ovld __cnfn convert_long3_rtn(half3); long3 __ovld __cnfn convert_long3_rtz(half3); long3 __ovld __cnfn convert_long3_sat(half3); long3 __ovld __cnfn convert_long3_sat_rte(half3); long3 __ovld __cnfn convert_long3_sat_rtp(half3); long3 __ovld __cnfn convert_long3_sat_rtn(half3); long3 __ovld __cnfn convert_long3_sat_rtz(half3); long4 __ovld __cnfn convert_long4(half4); long4 __ovld __cnfn convert_long4_rte(half4); long4 __ovld __cnfn convert_long4_rtp(half4); long4 __ovld __cnfn convert_long4_rtn(half4); long4 __ovld __cnfn convert_long4_rtz(half4); long4 __ovld __cnfn convert_long4_sat(half4); long4 __ovld __cnfn convert_long4_sat_rte(half4); long4 __ovld __cnfn convert_long4_sat_rtp(half4); long4 __ovld __cnfn convert_long4_sat_rtn(half4); long4 __ovld __cnfn convert_long4_sat_rtz(half4); long8 __ovld __cnfn convert_long8(half8); long8 __ovld __cnfn convert_long8_rte(half8); long8 __ovld __cnfn convert_long8_rtp(half8); long8 __ovld __cnfn convert_long8_rtn(half8); long8 __ovld __cnfn convert_long8_rtz(half8); long8 __ovld __cnfn convert_long8_sat(half8); long8 __ovld __cnfn convert_long8_sat_rte(half8); long8 __ovld __cnfn convert_long8_sat_rtp(half8); long8 __ovld __cnfn convert_long8_sat_rtn(half8); long8 __ovld __cnfn convert_long8_sat_rtz(half8); long16 __ovld __cnfn convert_long16(half16); long16 __ovld __cnfn convert_long16_rte(half16); long16 __ovld __cnfn convert_long16_rtp(half16); long16 __ovld __cnfn convert_long16_rtn(half16); long16 __ovld __cnfn convert_long16_rtz(half16); long16 __ovld __cnfn convert_long16_sat(half16); long16 __ovld __cnfn convert_long16_sat_rte(half16); long16 __ovld __cnfn convert_long16_sat_rtp(half16); long16 __ovld __cnfn convert_long16_sat_rtn(half16); long16 __ovld __cnfn convert_long16_sat_rtz(half16); float __ovld __cnfn convert_float(half); float __ovld __cnfn convert_float_rte(half); float __ovld __cnfn convert_float_rtp(half); float __ovld __cnfn convert_float_rtn(half); float __ovld __cnfn convert_float_rtz(half); float2 __ovld __cnfn convert_float2(half2); float2 __ovld __cnfn convert_float2_rte(half2); float2 __ovld __cnfn convert_float2_rtp(half2); float2 __ovld __cnfn convert_float2_rtn(half2); float2 __ovld __cnfn convert_float2_rtz(half2); float3 __ovld __cnfn convert_float3(half3); float3 __ovld __cnfn convert_float3_rte(half3); float3 __ovld __cnfn convert_float3_rtp(half3); float3 __ovld __cnfn convert_float3_rtn(half3); float3 __ovld __cnfn convert_float3_rtz(half3); float4 __ovld __cnfn convert_float4(half4); float4 __ovld __cnfn convert_float4_rte(half4); float4 __ovld __cnfn convert_float4_rtp(half4); float4 __ovld __cnfn convert_float4_rtn(half4); float4 __ovld __cnfn convert_float4_rtz(half4); float8 __ovld __cnfn convert_float8(half8); float8 __ovld __cnfn convert_float8_rte(half8); float8 __ovld __cnfn convert_float8_rtp(half8); float8 __ovld __cnfn convert_float8_rtn(half8); float8 __ovld __cnfn convert_float8_rtz(half8); float16 __ovld __cnfn convert_float16(half16); float16 __ovld __cnfn convert_float16_rte(half16); float16 __ovld __cnfn convert_float16_rtp(half16); float16 __ovld __cnfn convert_float16_rtn(half16); float16 __ovld __cnfn convert_float16_rtz(half16); // Convert non-double types to half types. half __ovld __cnfn convert_half(uchar); half __ovld __cnfn convert_half(ushort); half __ovld __cnfn convert_half(uint); half __ovld __cnfn convert_half(ulong); half __ovld __cnfn convert_half(char); half __ovld __cnfn convert_half(short); half __ovld __cnfn convert_half(int); half __ovld __cnfn convert_half(long); half __ovld __cnfn convert_half(float); half __ovld __cnfn convert_half(half); half __ovld __cnfn convert_half_rte(uchar); half __ovld __cnfn convert_half_rte(ushort); half __ovld __cnfn convert_half_rte(uint); half __ovld __cnfn convert_half_rte(ulong); half __ovld __cnfn convert_half_rte(char); half __ovld __cnfn convert_half_rte(short); half __ovld __cnfn convert_half_rte(int); half __ovld __cnfn convert_half_rte(long); half __ovld __cnfn convert_half_rte(float); half __ovld __cnfn convert_half_rte(half); half __ovld __cnfn convert_half_rtp(uchar); half __ovld __cnfn convert_half_rtp(ushort); half __ovld __cnfn convert_half_rtp(uint); half __ovld __cnfn convert_half_rtp(ulong); half __ovld __cnfn convert_half_rtp(char); half __ovld __cnfn convert_half_rtp(short); half __ovld __cnfn convert_half_rtp(int); half __ovld __cnfn convert_half_rtp(long); half __ovld __cnfn convert_half_rtp(float); half __ovld __cnfn convert_half_rtp(half); half __ovld __cnfn convert_half_rtn(uchar); half __ovld __cnfn convert_half_rtn(ushort); half __ovld __cnfn convert_half_rtn(uint); half __ovld __cnfn convert_half_rtn(ulong); half __ovld __cnfn convert_half_rtn(char); half __ovld __cnfn convert_half_rtn(short); half __ovld __cnfn convert_half_rtn(int); half __ovld __cnfn convert_half_rtn(long); half __ovld __cnfn convert_half_rtn(float); half __ovld __cnfn convert_half_rtn(half); half __ovld __cnfn convert_half_rtz(uchar); half __ovld __cnfn convert_half_rtz(ushort); half __ovld __cnfn convert_half_rtz(uint); half __ovld __cnfn convert_half_rtz(ulong); half __ovld __cnfn convert_half_rtz(char); half __ovld __cnfn convert_half_rtz(short); half __ovld __cnfn convert_half_rtz(int); half __ovld __cnfn convert_half_rtz(long); half __ovld __cnfn convert_half_rtz(float); half __ovld __cnfn convert_half_rtz(half); half2 __ovld __cnfn convert_half2(char2); half2 __ovld __cnfn convert_half2(uchar2); half2 __ovld __cnfn convert_half2(short2); half2 __ovld __cnfn convert_half2(ushort2); half2 __ovld __cnfn convert_half2(int2); half2 __ovld __cnfn convert_half2(uint2); half2 __ovld __cnfn convert_half2(long2); half2 __ovld __cnfn convert_half2(ulong2); half2 __ovld __cnfn convert_half2(float2); half2 __ovld __cnfn convert_half2(half2); half2 __ovld __cnfn convert_half2_rte(char2); half2 __ovld __cnfn convert_half2_rte(uchar2); half2 __ovld __cnfn convert_half2_rte(short2); half2 __ovld __cnfn convert_half2_rte(ushort2); half2 __ovld __cnfn convert_half2_rte(int2); half2 __ovld __cnfn convert_half2_rte(uint2); half2 __ovld __cnfn convert_half2_rte(long2); half2 __ovld __cnfn convert_half2_rte(ulong2); half2 __ovld __cnfn convert_half2_rte(float2); half2 __ovld __cnfn convert_half2_rte(half2); half2 __ovld __cnfn convert_half2_rtp(char2); half2 __ovld __cnfn convert_half2_rtp(uchar2); half2 __ovld __cnfn convert_half2_rtp(short2); half2 __ovld __cnfn convert_half2_rtp(ushort2); half2 __ovld __cnfn convert_half2_rtp(int2); half2 __ovld __cnfn convert_half2_rtp(uint2); half2 __ovld __cnfn convert_half2_rtp(long2); half2 __ovld __cnfn convert_half2_rtp(ulong2); half2 __ovld __cnfn convert_half2_rtp(float2); half2 __ovld __cnfn convert_half2_rtp(half2); half2 __ovld __cnfn convert_half2_rtn(char2); half2 __ovld __cnfn convert_half2_rtn(uchar2); half2 __ovld __cnfn convert_half2_rtn(short2); half2 __ovld __cnfn convert_half2_rtn(ushort2); half2 __ovld __cnfn convert_half2_rtn(int2); half2 __ovld __cnfn convert_half2_rtn(uint2); half2 __ovld __cnfn convert_half2_rtn(long2); half2 __ovld __cnfn convert_half2_rtn(ulong2); half2 __ovld __cnfn convert_half2_rtn(float2); half2 __ovld __cnfn convert_half2_rtn(half2); half2 __ovld __cnfn convert_half2_rtz(char2); half2 __ovld __cnfn convert_half2_rtz(uchar2); half2 __ovld __cnfn convert_half2_rtz(short2); half2 __ovld __cnfn convert_half2_rtz(ushort2); half2 __ovld __cnfn convert_half2_rtz(int2); half2 __ovld __cnfn convert_half2_rtz(uint2); half2 __ovld __cnfn convert_half2_rtz(long2); half2 __ovld __cnfn convert_half2_rtz(ulong2); half2 __ovld __cnfn convert_half2_rtz(float2); half2 __ovld __cnfn convert_half2_rtz(half2); half3 __ovld __cnfn convert_half3(char3); half3 __ovld __cnfn convert_half3(uchar3); half3 __ovld __cnfn convert_half3(short3); half3 __ovld __cnfn convert_half3(ushort3); half3 __ovld __cnfn convert_half3(int3); half3 __ovld __cnfn convert_half3(uint3); half3 __ovld __cnfn convert_half3(long3); half3 __ovld __cnfn convert_half3(ulong3); half3 __ovld __cnfn convert_half3(float3); half3 __ovld __cnfn convert_half3(half3); half3 __ovld __cnfn convert_half3_rte(char3); half3 __ovld __cnfn convert_half3_rte(uchar3); half3 __ovld __cnfn convert_half3_rte(short3); half3 __ovld __cnfn convert_half3_rte(ushort3); half3 __ovld __cnfn convert_half3_rte(int3); half3 __ovld __cnfn convert_half3_rte(uint3); half3 __ovld __cnfn convert_half3_rte(long3); half3 __ovld __cnfn convert_half3_rte(ulong3); half3 __ovld __cnfn convert_half3_rte(float3); half3 __ovld __cnfn convert_half3_rte(half3); half3 __ovld __cnfn convert_half3_rtp(char3); half3 __ovld __cnfn convert_half3_rtp(uchar3); half3 __ovld __cnfn convert_half3_rtp(short3); half3 __ovld __cnfn convert_half3_rtp(ushort3); half3 __ovld __cnfn convert_half3_rtp(int3); half3 __ovld __cnfn convert_half3_rtp(uint3); half3 __ovld __cnfn convert_half3_rtp(long3); half3 __ovld __cnfn convert_half3_rtp(ulong3); half3 __ovld __cnfn convert_half3_rtp(float3); half3 __ovld __cnfn convert_half3_rtp(half3); half3 __ovld __cnfn convert_half3_rtn(char3); half3 __ovld __cnfn convert_half3_rtn(uchar3); half3 __ovld __cnfn convert_half3_rtn(short3); half3 __ovld __cnfn convert_half3_rtn(ushort3); half3 __ovld __cnfn convert_half3_rtn(int3); half3 __ovld __cnfn convert_half3_rtn(uint3); half3 __ovld __cnfn convert_half3_rtn(long3); half3 __ovld __cnfn convert_half3_rtn(ulong3); half3 __ovld __cnfn convert_half3_rtn(float3); half3 __ovld __cnfn convert_half3_rtn(half3); half3 __ovld __cnfn convert_half3_rtz(char3); half3 __ovld __cnfn convert_half3_rtz(uchar3); half3 __ovld __cnfn convert_half3_rtz(short3); half3 __ovld __cnfn convert_half3_rtz(ushort3); half3 __ovld __cnfn convert_half3_rtz(int3); half3 __ovld __cnfn convert_half3_rtz(uint3); half3 __ovld __cnfn convert_half3_rtz(long3); half3 __ovld __cnfn convert_half3_rtz(ulong3); half3 __ovld __cnfn convert_half3_rtz(float3); half3 __ovld __cnfn convert_half3_rtz(half3); half4 __ovld __cnfn convert_half4(char4); half4 __ovld __cnfn convert_half4(uchar4); half4 __ovld __cnfn convert_half4(short4); half4 __ovld __cnfn convert_half4(ushort4); half4 __ovld __cnfn convert_half4(int4); half4 __ovld __cnfn convert_half4(uint4); half4 __ovld __cnfn convert_half4(long4); half4 __ovld __cnfn convert_half4(ulong4); half4 __ovld __cnfn convert_half4(float4); half4 __ovld __cnfn convert_half4(half4); half4 __ovld __cnfn convert_half4_rte(char4); half4 __ovld __cnfn convert_half4_rte(uchar4); half4 __ovld __cnfn convert_half4_rte(short4); half4 __ovld __cnfn convert_half4_rte(ushort4); half4 __ovld __cnfn convert_half4_rte(int4); half4 __ovld __cnfn convert_half4_rte(uint4); half4 __ovld __cnfn convert_half4_rte(long4); half4 __ovld __cnfn convert_half4_rte(ulong4); half4 __ovld __cnfn convert_half4_rte(float4); half4 __ovld __cnfn convert_half4_rte(half4); half4 __ovld __cnfn convert_half4_rtp(char4); half4 __ovld __cnfn convert_half4_rtp(uchar4); half4 __ovld __cnfn convert_half4_rtp(short4); half4 __ovld __cnfn convert_half4_rtp(ushort4); half4 __ovld __cnfn convert_half4_rtp(int4); half4 __ovld __cnfn convert_half4_rtp(uint4); half4 __ovld __cnfn convert_half4_rtp(long4); half4 __ovld __cnfn convert_half4_rtp(ulong4); half4 __ovld __cnfn convert_half4_rtp(float4); half4 __ovld __cnfn convert_half4_rtp(half4); half4 __ovld __cnfn convert_half4_rtn(char4); half4 __ovld __cnfn convert_half4_rtn(uchar4); half4 __ovld __cnfn convert_half4_rtn(short4); half4 __ovld __cnfn convert_half4_rtn(ushort4); half4 __ovld __cnfn convert_half4_rtn(int4); half4 __ovld __cnfn convert_half4_rtn(uint4); half4 __ovld __cnfn convert_half4_rtn(long4); half4 __ovld __cnfn convert_half4_rtn(ulong4); half4 __ovld __cnfn convert_half4_rtn(float4); half4 __ovld __cnfn convert_half4_rtn(half4); half4 __ovld __cnfn convert_half4_rtz(char4); half4 __ovld __cnfn convert_half4_rtz(uchar4); half4 __ovld __cnfn convert_half4_rtz(short4); half4 __ovld __cnfn convert_half4_rtz(ushort4); half4 __ovld __cnfn convert_half4_rtz(int4); half4 __ovld __cnfn convert_half4_rtz(uint4); half4 __ovld __cnfn convert_half4_rtz(long4); half4 __ovld __cnfn convert_half4_rtz(ulong4); half4 __ovld __cnfn convert_half4_rtz(float4); half4 __ovld __cnfn convert_half4_rtz(half4); half8 __ovld __cnfn convert_half8(char8); half8 __ovld __cnfn convert_half8(uchar8); half8 __ovld __cnfn convert_half8(short8); half8 __ovld __cnfn convert_half8(ushort8); half8 __ovld __cnfn convert_half8(int8); half8 __ovld __cnfn convert_half8(uint8); half8 __ovld __cnfn convert_half8(long8); half8 __ovld __cnfn convert_half8(ulong8); half8 __ovld __cnfn convert_half8(float8); half8 __ovld __cnfn convert_half8(half8); half8 __ovld __cnfn convert_half8_rte(char8); half8 __ovld __cnfn convert_half8_rte(uchar8); half8 __ovld __cnfn convert_half8_rte(short8); half8 __ovld __cnfn convert_half8_rte(ushort8); half8 __ovld __cnfn convert_half8_rte(int8); half8 __ovld __cnfn convert_half8_rte(uint8); half8 __ovld __cnfn convert_half8_rte(long8); half8 __ovld __cnfn convert_half8_rte(ulong8); half8 __ovld __cnfn convert_half8_rte(float8); half8 __ovld __cnfn convert_half8_rte(half8); half8 __ovld __cnfn convert_half8_rtp(char8); half8 __ovld __cnfn convert_half8_rtp(uchar8); half8 __ovld __cnfn convert_half8_rtp(short8); half8 __ovld __cnfn convert_half8_rtp(ushort8); half8 __ovld __cnfn convert_half8_rtp(int8); half8 __ovld __cnfn convert_half8_rtp(uint8); half8 __ovld __cnfn convert_half8_rtp(long8); half8 __ovld __cnfn convert_half8_rtp(ulong8); half8 __ovld __cnfn convert_half8_rtp(float8); half8 __ovld __cnfn convert_half8_rtp(half8); half8 __ovld __cnfn convert_half8_rtn(char8); half8 __ovld __cnfn convert_half8_rtn(uchar8); half8 __ovld __cnfn convert_half8_rtn(short8); half8 __ovld __cnfn convert_half8_rtn(ushort8); half8 __ovld __cnfn convert_half8_rtn(int8); half8 __ovld __cnfn convert_half8_rtn(uint8); half8 __ovld __cnfn convert_half8_rtn(long8); half8 __ovld __cnfn convert_half8_rtn(ulong8); half8 __ovld __cnfn convert_half8_rtn(float8); half8 __ovld __cnfn convert_half8_rtn(half8); half8 __ovld __cnfn convert_half8_rtz(char8); half8 __ovld __cnfn convert_half8_rtz(uchar8); half8 __ovld __cnfn convert_half8_rtz(short8); half8 __ovld __cnfn convert_half8_rtz(ushort8); half8 __ovld __cnfn convert_half8_rtz(int8); half8 __ovld __cnfn convert_half8_rtz(uint8); half8 __ovld __cnfn convert_half8_rtz(long8); half8 __ovld __cnfn convert_half8_rtz(ulong8); half8 __ovld __cnfn convert_half8_rtz(float8); half8 __ovld __cnfn convert_half8_rtz(half8); half16 __ovld __cnfn convert_half16(char16); half16 __ovld __cnfn convert_half16(uchar16); half16 __ovld __cnfn convert_half16(short16); half16 __ovld __cnfn convert_half16(ushort16); half16 __ovld __cnfn convert_half16(int16); half16 __ovld __cnfn convert_half16(uint16); half16 __ovld __cnfn convert_half16(long16); half16 __ovld __cnfn convert_half16(ulong16); half16 __ovld __cnfn convert_half16(float16); half16 __ovld __cnfn convert_half16(half16); half16 __ovld __cnfn convert_half16_rte(char16); half16 __ovld __cnfn convert_half16_rte(uchar16); half16 __ovld __cnfn convert_half16_rte(short16); half16 __ovld __cnfn convert_half16_rte(ushort16); half16 __ovld __cnfn convert_half16_rte(int16); half16 __ovld __cnfn convert_half16_rte(uint16); half16 __ovld __cnfn convert_half16_rte(long16); half16 __ovld __cnfn convert_half16_rte(ulong16); half16 __ovld __cnfn convert_half16_rte(float16); half16 __ovld __cnfn convert_half16_rte(half16); half16 __ovld __cnfn convert_half16_rtp(char16); half16 __ovld __cnfn convert_half16_rtp(uchar16); half16 __ovld __cnfn convert_half16_rtp(short16); half16 __ovld __cnfn convert_half16_rtp(ushort16); half16 __ovld __cnfn convert_half16_rtp(int16); half16 __ovld __cnfn convert_half16_rtp(uint16); half16 __ovld __cnfn convert_half16_rtp(long16); half16 __ovld __cnfn convert_half16_rtp(ulong16); half16 __ovld __cnfn convert_half16_rtp(float16); half16 __ovld __cnfn convert_half16_rtp(half16); half16 __ovld __cnfn convert_half16_rtn(char16); half16 __ovld __cnfn convert_half16_rtn(uchar16); half16 __ovld __cnfn convert_half16_rtn(short16); half16 __ovld __cnfn convert_half16_rtn(ushort16); half16 __ovld __cnfn convert_half16_rtn(int16); half16 __ovld __cnfn convert_half16_rtn(uint16); half16 __ovld __cnfn convert_half16_rtn(long16); half16 __ovld __cnfn convert_half16_rtn(ulong16); half16 __ovld __cnfn convert_half16_rtn(float16); half16 __ovld __cnfn convert_half16_rtn(half16); half16 __ovld __cnfn convert_half16_rtz(char16); half16 __ovld __cnfn convert_half16_rtz(uchar16); half16 __ovld __cnfn convert_half16_rtz(short16); half16 __ovld __cnfn convert_half16_rtz(ushort16); half16 __ovld __cnfn convert_half16_rtz(int16); half16 __ovld __cnfn convert_half16_rtz(uint16); half16 __ovld __cnfn convert_half16_rtz(long16); half16 __ovld __cnfn convert_half16_rtz(ulong16); half16 __ovld __cnfn convert_half16_rtz(float16); half16 __ovld __cnfn convert_half16_rtz(half16); // Convert half types to double types. #ifdef cl_khr_fp64 double __ovld __cnfn convert_double(half); double __ovld __cnfn convert_double_rte(half); double __ovld __cnfn convert_double_rtp(half); double __ovld __cnfn convert_double_rtn(half); double __ovld __cnfn convert_double_rtz(half); double2 __ovld __cnfn convert_double2(half2); double2 __ovld __cnfn convert_double2_rte(half2); double2 __ovld __cnfn convert_double2_rtp(half2); double2 __ovld __cnfn convert_double2_rtn(half2); double2 __ovld __cnfn convert_double2_rtz(half2); double3 __ovld __cnfn convert_double3(half3); double3 __ovld __cnfn convert_double3_rte(half3); double3 __ovld __cnfn convert_double3_rtp(half3); double3 __ovld __cnfn convert_double3_rtn(half3); double3 __ovld __cnfn convert_double3_rtz(half3); double4 __ovld __cnfn convert_double4(half4); double4 __ovld __cnfn convert_double4_rte(half4); double4 __ovld __cnfn convert_double4_rtp(half4); double4 __ovld __cnfn convert_double4_rtn(half4); double4 __ovld __cnfn convert_double4_rtz(half4); double8 __ovld __cnfn convert_double8(half8); double8 __ovld __cnfn convert_double8_rte(half8); double8 __ovld __cnfn convert_double8_rtp(half8); double8 __ovld __cnfn convert_double8_rtn(half8); double8 __ovld __cnfn convert_double8_rtz(half8); double16 __ovld __cnfn convert_double16(half16); double16 __ovld __cnfn convert_double16_rte(half16); double16 __ovld __cnfn convert_double16_rtp(half16); double16 __ovld __cnfn convert_double16_rtn(half16); double16 __ovld __cnfn convert_double16_rtz(half16); // Convert double types to half types. half __ovld __cnfn convert_half(double); half __ovld __cnfn convert_half_rte(double); half __ovld __cnfn convert_half_rtp(double); half __ovld __cnfn convert_half_rtn(double); half __ovld __cnfn convert_half_rtz(double); half2 __ovld __cnfn convert_half2(double2); half2 __ovld __cnfn convert_half2_rte(double2); half2 __ovld __cnfn convert_half2_rtp(double2); half2 __ovld __cnfn convert_half2_rtn(double2); half2 __ovld __cnfn convert_half2_rtz(double2); half3 __ovld __cnfn convert_half3(double3); half3 __ovld __cnfn convert_half3_rte(double3); half3 __ovld __cnfn convert_half3_rtp(double3); half3 __ovld __cnfn convert_half3_rtn(double3); half3 __ovld __cnfn convert_half3_rtz(double3); half4 __ovld __cnfn convert_half4(double4); half4 __ovld __cnfn convert_half4_rte(double4); half4 __ovld __cnfn convert_half4_rtp(double4); half4 __ovld __cnfn convert_half4_rtn(double4); half4 __ovld __cnfn convert_half4_rtz(double4); half8 __ovld __cnfn convert_half8(double8); half8 __ovld __cnfn convert_half8_rte(double8); half8 __ovld __cnfn convert_half8_rtp(double8); half8 __ovld __cnfn convert_half8_rtn(double8); half8 __ovld __cnfn convert_half8_rtz(double8); half16 __ovld __cnfn convert_half16(double16); half16 __ovld __cnfn convert_half16_rte(double16); half16 __ovld __cnfn convert_half16_rtp(double16); half16 __ovld __cnfn convert_half16_rtn(double16); half16 __ovld __cnfn convert_half16_rtz(double16); #endif //cl_khr_fp64 #endif // cl_khr_fp16 /** * OpenCL v1.1/1.2/2.0 s6.2.4.2 - as_type operators * Reinterprets a data type as another data type of the same size */ #define as_char(x) __builtin_astype((x), char) #define as_char2(x) __builtin_astype((x), char2) #define as_char3(x) __builtin_astype((x), char3) #define as_char4(x) __builtin_astype((x), char4) #define as_char8(x) __builtin_astype((x), char8) #define as_char16(x) __builtin_astype((x), char16) #define as_uchar(x) __builtin_astype((x), uchar) #define as_uchar2(x) __builtin_astype((x), uchar2) #define as_uchar3(x) __builtin_astype((x), uchar3) #define as_uchar4(x) __builtin_astype((x), uchar4) #define as_uchar8(x) __builtin_astype((x), uchar8) #define as_uchar16(x) __builtin_astype((x), uchar16) #define as_short(x) __builtin_astype((x), short) #define as_short2(x) __builtin_astype((x), short2) #define as_short3(x) __builtin_astype((x), short3) #define as_short4(x) __builtin_astype((x), short4) #define as_short8(x) __builtin_astype((x), short8) #define as_short16(x) __builtin_astype((x), short16) #define as_ushort(x) __builtin_astype((x), ushort) #define as_ushort2(x) __builtin_astype((x), ushort2) #define as_ushort3(x) __builtin_astype((x), ushort3) #define as_ushort4(x) __builtin_astype((x), ushort4) #define as_ushort8(x) __builtin_astype((x), ushort8) #define as_ushort16(x) __builtin_astype((x), ushort16) #define as_int(x) __builtin_astype((x), int) #define as_int2(x) __builtin_astype((x), int2) #define as_int3(x) __builtin_astype((x), int3) #define as_int4(x) __builtin_astype((x), int4) #define as_int8(x) __builtin_astype((x), int8) #define as_int16(x) __builtin_astype((x), int16) #define as_uint(x) __builtin_astype((x), uint) #define as_uint2(x) __builtin_astype((x), uint2) #define as_uint3(x) __builtin_astype((x), uint3) #define as_uint4(x) __builtin_astype((x), uint4) #define as_uint8(x) __builtin_astype((x), uint8) #define as_uint16(x) __builtin_astype((x), uint16) #define as_long(x) __builtin_astype((x), long) #define as_long2(x) __builtin_astype((x), long2) #define as_long3(x) __builtin_astype((x), long3) #define as_long4(x) __builtin_astype((x), long4) #define as_long8(x) __builtin_astype((x), long8) #define as_long16(x) __builtin_astype((x), long16) #define as_ulong(x) __builtin_astype((x), ulong) #define as_ulong2(x) __builtin_astype((x), ulong2) #define as_ulong3(x) __builtin_astype((x), ulong3) #define as_ulong4(x) __builtin_astype((x), ulong4) #define as_ulong8(x) __builtin_astype((x), ulong8) #define as_ulong16(x) __builtin_astype((x), ulong16) #define as_float(x) __builtin_astype((x), float) #define as_float2(x) __builtin_astype((x), float2) #define as_float3(x) __builtin_astype((x), float3) #define as_float4(x) __builtin_astype((x), float4) #define as_float8(x) __builtin_astype((x), float8) #define as_float16(x) __builtin_astype((x), float16) #ifdef cl_khr_fp64 #define as_double(x) __builtin_astype((x), double) #define as_double2(x) __builtin_astype((x), double2) #define as_double3(x) __builtin_astype((x), double3) #define as_double4(x) __builtin_astype((x), double4) #define as_double8(x) __builtin_astype((x), double8) #define as_double16(x) __builtin_astype((x), double16) #endif //cl_khr_fp64 #ifdef cl_khr_fp16 #define as_half(x) __builtin_astype((x), half) #define as_half2(x) __builtin_astype((x), half2) #define as_half3(x) __builtin_astype((x), half3) #define as_half4(x) __builtin_astype((x), half4) #define as_half8(x) __builtin_astype((x), half8) #define as_half16(x) __builtin_astype((x), half16) #endif //cl_khr_fp16 // OpenCL v1.1 s6.9, v1.2/2.0 s6.10 - Function qualifiers #define __kernel_exec(X, typen) __kernel \ __attribute__((work_group_size_hint(X, 1, 1))) \ __attribute__((vec_type_hint(typen))) #define kernel_exec(X, typen) __kernel \ __attribute__((work_group_size_hint(X, 1, 1))) \ __attribute__((vec_type_hint(typen))) // OpenCL v1.1 s6.11.1, v1.2 s6.12.1, v2.0 s6.13.1 - Work-item Functions /** * Returns the number of dimensions in use. This is the * value given to the work_dim argument specified in * clEnqueueNDRangeKernel. * For clEnqueueTask, this returns 1. */ uint __ovld __cnfn get_work_dim(void); /** * Returns the number of global work-items specified for * dimension identified by dimindx. This value is given by * the global_work_size argument to * clEnqueueNDRangeKernel. Valid values of dimindx * are 0 to get_work_dim() - 1. For other values of * dimindx, get_global_size() returns 1. * For clEnqueueTask, this always returns 1. */ size_t __ovld __cnfn get_global_size(uint dimindx); /** * Returns the unique global work-item ID value for * dimension identified by dimindx. The global work-item * ID specifies the work-item ID based on the number of * global work-items specified to execute the kernel. Valid * values of dimindx are 0 to get_work_dim() - 1. For * other values of dimindx, get_global_id() returns 0. * For clEnqueueTask, this returns 0. */ size_t __ovld __cnfn get_global_id(uint dimindx); /** * Returns the number of local work-items specified in * dimension identified by dimindx. This value is given by * the local_work_size argument to * clEnqueueNDRangeKernel if local_work_size is not * NULL; otherwise the OpenCL implementation chooses * an appropriate local_work_size value which is returned * by this function. Valid values of dimindx are 0 to * get_work_dim() - 1. For other values of dimindx, * get_local_size() returns 1. * For clEnqueueTask, this always returns 1. */ size_t __ovld __cnfn get_local_size(uint dimindx); /** * Returns the unique local work-item ID i.e. a work-item * within a specific work-group for dimension identified by * dimindx. Valid values of dimindx are 0 to * get_work_dim() - 1. For other values of dimindx, * get_local_id() returns 0. * For clEnqueueTask, this returns 0. */ size_t __ovld __cnfn get_local_id(uint dimindx); /** * Returns the number of work-groups that will execute a * kernel for dimension identified by dimindx. * Valid values of dimindx are 0 to get_work_dim() - 1. * For other values of dimindx, get_num_groups () returns * 1. * For clEnqueueTask, this always returns 1. */ size_t __ovld __cnfn get_num_groups(uint dimindx); /** * get_group_id returns the work-group ID which is a * number from 0 .. get_num_groups(dimindx) - 1. * Valid values of dimindx are 0 to get_work_dim() - 1. * For other values, get_group_id() returns 0. * For clEnqueueTask, this returns 0. */ size_t __ovld __cnfn get_group_id(uint dimindx); /** * get_global_offset returns the offset values specified in * global_work_offset argument to * clEnqueueNDRangeKernel. * Valid values of dimindx are 0 to get_work_dim() - 1. * For other values, get_global_offset() returns 0. * For clEnqueueTask, this returns 0. */ size_t __ovld __cnfn get_global_offset(uint dimindx); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) size_t __ovld get_enqueued_local_size(uint dimindx); size_t __ovld get_global_linear_id(void); size_t __ovld get_local_linear_id(void); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL v1.1 s6.11.2, v1.2 s6.12.2, v2.0 s6.13.2 - Math functions /** * Arc cosine function. */ float __ovld __cnfn acos(float); float2 __ovld __cnfn acos(float2); float3 __ovld __cnfn acos(float3); float4 __ovld __cnfn acos(float4); float8 __ovld __cnfn acos(float8); float16 __ovld __cnfn acos(float16); #ifdef cl_khr_fp64 double __ovld __cnfn acos(double); double2 __ovld __cnfn acos(double2); double3 __ovld __cnfn acos(double3); double4 __ovld __cnfn acos(double4); double8 __ovld __cnfn acos(double8); double16 __ovld __cnfn acos(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn acos(half); half2 __ovld __cnfn acos(half2); half3 __ovld __cnfn acos(half3); half4 __ovld __cnfn acos(half4); half8 __ovld __cnfn acos(half8); half16 __ovld __cnfn acos(half16); #endif //cl_khr_fp16 /** * Inverse hyperbolic cosine. */ float __ovld __cnfn acosh(float); float2 __ovld __cnfn acosh(float2); float3 __ovld __cnfn acosh(float3); float4 __ovld __cnfn acosh(float4); float8 __ovld __cnfn acosh(float8); float16 __ovld __cnfn acosh(float16); #ifdef cl_khr_fp64 double __ovld __cnfn acosh(double); double2 __ovld __cnfn acosh(double2); double3 __ovld __cnfn acosh(double3); double4 __ovld __cnfn acosh(double4); double8 __ovld __cnfn acosh(double8); double16 __ovld __cnfn acosh(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn acosh(half); half2 __ovld __cnfn acosh(half2); half3 __ovld __cnfn acosh(half3); half4 __ovld __cnfn acosh(half4); half8 __ovld __cnfn acosh(half8); half16 __ovld __cnfn acosh(half16); #endif //cl_khr_fp16 /** * Compute acos (x) / PI. */ float __ovld __cnfn acospi(float x); float2 __ovld __cnfn acospi(float2 x); float3 __ovld __cnfn acospi(float3 x); float4 __ovld __cnfn acospi(float4 x); float8 __ovld __cnfn acospi(float8 x); float16 __ovld __cnfn acospi(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn acospi(double x); double2 __ovld __cnfn acospi(double2 x); double3 __ovld __cnfn acospi(double3 x); double4 __ovld __cnfn acospi(double4 x); double8 __ovld __cnfn acospi(double8 x); double16 __ovld __cnfn acospi(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn acospi(half x); half2 __ovld __cnfn acospi(half2 x); half3 __ovld __cnfn acospi(half3 x); half4 __ovld __cnfn acospi(half4 x); half8 __ovld __cnfn acospi(half8 x); half16 __ovld __cnfn acospi(half16 x); #endif //cl_khr_fp16 /** * Arc sine function. */ float __ovld __cnfn asin(float); float2 __ovld __cnfn asin(float2); float3 __ovld __cnfn asin(float3); float4 __ovld __cnfn asin(float4); float8 __ovld __cnfn asin(float8); float16 __ovld __cnfn asin(float16); #ifdef cl_khr_fp64 double __ovld __cnfn asin(double); double2 __ovld __cnfn asin(double2); double3 __ovld __cnfn asin(double3); double4 __ovld __cnfn asin(double4); double8 __ovld __cnfn asin(double8); double16 __ovld __cnfn asin(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn asin(half); half2 __ovld __cnfn asin(half2); half3 __ovld __cnfn asin(half3); half4 __ovld __cnfn asin(half4); half8 __ovld __cnfn asin(half8); half16 __ovld __cnfn asin(half16); #endif //cl_khr_fp16 /** * Inverse hyperbolic sine. */ float __ovld __cnfn asinh(float); float2 __ovld __cnfn asinh(float2); float3 __ovld __cnfn asinh(float3); float4 __ovld __cnfn asinh(float4); float8 __ovld __cnfn asinh(float8); float16 __ovld __cnfn asinh(float16); #ifdef cl_khr_fp64 double __ovld __cnfn asinh(double); double2 __ovld __cnfn asinh(double2); double3 __ovld __cnfn asinh(double3); double4 __ovld __cnfn asinh(double4); double8 __ovld __cnfn asinh(double8); double16 __ovld __cnfn asinh(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn asinh(half); half2 __ovld __cnfn asinh(half2); half3 __ovld __cnfn asinh(half3); half4 __ovld __cnfn asinh(half4); half8 __ovld __cnfn asinh(half8); half16 __ovld __cnfn asinh(half16); #endif //cl_khr_fp16 /** * Compute asin (x) / PI. */ float __ovld __cnfn asinpi(float x); float2 __ovld __cnfn asinpi(float2 x); float3 __ovld __cnfn asinpi(float3 x); float4 __ovld __cnfn asinpi(float4 x); float8 __ovld __cnfn asinpi(float8 x); float16 __ovld __cnfn asinpi(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn asinpi(double x); double2 __ovld __cnfn asinpi(double2 x); double3 __ovld __cnfn asinpi(double3 x); double4 __ovld __cnfn asinpi(double4 x); double8 __ovld __cnfn asinpi(double8 x); double16 __ovld __cnfn asinpi(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn asinpi(half x); half2 __ovld __cnfn asinpi(half2 x); half3 __ovld __cnfn asinpi(half3 x); half4 __ovld __cnfn asinpi(half4 x); half8 __ovld __cnfn asinpi(half8 x); half16 __ovld __cnfn asinpi(half16 x); #endif //cl_khr_fp16 /** * Arc tangent function. */ float __ovld __cnfn atan(float y_over_x); float2 __ovld __cnfn atan(float2 y_over_x); float3 __ovld __cnfn atan(float3 y_over_x); float4 __ovld __cnfn atan(float4 y_over_x); float8 __ovld __cnfn atan(float8 y_over_x); float16 __ovld __cnfn atan(float16 y_over_x); #ifdef cl_khr_fp64 double __ovld __cnfn atan(double y_over_x); double2 __ovld __cnfn atan(double2 y_over_x); double3 __ovld __cnfn atan(double3 y_over_x); double4 __ovld __cnfn atan(double4 y_over_x); double8 __ovld __cnfn atan(double8 y_over_x); double16 __ovld __cnfn atan(double16 y_over_x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn atan(half y_over_x); half2 __ovld __cnfn atan(half2 y_over_x); half3 __ovld __cnfn atan(half3 y_over_x); half4 __ovld __cnfn atan(half4 y_over_x); half8 __ovld __cnfn atan(half8 y_over_x); half16 __ovld __cnfn atan(half16 y_over_x); #endif //cl_khr_fp16 /** * Arc tangent of y / x. */ float __ovld __cnfn atan2(float y, float x); float2 __ovld __cnfn atan2(float2 y, float2 x); float3 __ovld __cnfn atan2(float3 y, float3 x); float4 __ovld __cnfn atan2(float4 y, float4 x); float8 __ovld __cnfn atan2(float8 y, float8 x); float16 __ovld __cnfn atan2(float16 y, float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn atan2(double y, double x); double2 __ovld __cnfn atan2(double2 y, double2 x); double3 __ovld __cnfn atan2(double3 y, double3 x); double4 __ovld __cnfn atan2(double4 y, double4 x); double8 __ovld __cnfn atan2(double8 y, double8 x); double16 __ovld __cnfn atan2(double16 y, double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn atan2(half y, half x); half2 __ovld __cnfn atan2(half2 y, half2 x); half3 __ovld __cnfn atan2(half3 y, half3 x); half4 __ovld __cnfn atan2(half4 y, half4 x); half8 __ovld __cnfn atan2(half8 y, half8 x); half16 __ovld __cnfn atan2(half16 y, half16 x); #endif //cl_khr_fp16 /** * Hyperbolic arc tangent. */ float __ovld __cnfn atanh(float); float2 __ovld __cnfn atanh(float2); float3 __ovld __cnfn atanh(float3); float4 __ovld __cnfn atanh(float4); float8 __ovld __cnfn atanh(float8); float16 __ovld __cnfn atanh(float16); #ifdef cl_khr_fp64 double __ovld __cnfn atanh(double); double2 __ovld __cnfn atanh(double2); double3 __ovld __cnfn atanh(double3); double4 __ovld __cnfn atanh(double4); double8 __ovld __cnfn atanh(double8); double16 __ovld __cnfn atanh(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn atanh(half); half2 __ovld __cnfn atanh(half2); half3 __ovld __cnfn atanh(half3); half4 __ovld __cnfn atanh(half4); half8 __ovld __cnfn atanh(half8); half16 __ovld __cnfn atanh(half16); #endif //cl_khr_fp16 /** * Compute atan (x) / PI. */ float __ovld __cnfn atanpi(float x); float2 __ovld __cnfn atanpi(float2 x); float3 __ovld __cnfn atanpi(float3 x); float4 __ovld __cnfn atanpi(float4 x); float8 __ovld __cnfn atanpi(float8 x); float16 __ovld __cnfn atanpi(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn atanpi(double x); double2 __ovld __cnfn atanpi(double2 x); double3 __ovld __cnfn atanpi(double3 x); double4 __ovld __cnfn atanpi(double4 x); double8 __ovld __cnfn atanpi(double8 x); double16 __ovld __cnfn atanpi(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn atanpi(half x); half2 __ovld __cnfn atanpi(half2 x); half3 __ovld __cnfn atanpi(half3 x); half4 __ovld __cnfn atanpi(half4 x); half8 __ovld __cnfn atanpi(half8 x); half16 __ovld __cnfn atanpi(half16 x); #endif //cl_khr_fp16 /** * Compute atan2 (y, x) / PI. */ float __ovld __cnfn atan2pi(float y, float x); float2 __ovld __cnfn atan2pi(float2 y, float2 x); float3 __ovld __cnfn atan2pi(float3 y, float3 x); float4 __ovld __cnfn atan2pi(float4 y, float4 x); float8 __ovld __cnfn atan2pi(float8 y, float8 x); float16 __ovld __cnfn atan2pi(float16 y, float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn atan2pi(double y, double x); double2 __ovld __cnfn atan2pi(double2 y, double2 x); double3 __ovld __cnfn atan2pi(double3 y, double3 x); double4 __ovld __cnfn atan2pi(double4 y, double4 x); double8 __ovld __cnfn atan2pi(double8 y, double8 x); double16 __ovld __cnfn atan2pi(double16 y, double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn atan2pi(half y, half x); half2 __ovld __cnfn atan2pi(half2 y, half2 x); half3 __ovld __cnfn atan2pi(half3 y, half3 x); half4 __ovld __cnfn atan2pi(half4 y, half4 x); half8 __ovld __cnfn atan2pi(half8 y, half8 x); half16 __ovld __cnfn atan2pi(half16 y, half16 x); #endif //cl_khr_fp16 /** * Compute cube-root. */ float __ovld __cnfn cbrt(float); float2 __ovld __cnfn cbrt(float2); float3 __ovld __cnfn cbrt(float3); float4 __ovld __cnfn cbrt(float4); float8 __ovld __cnfn cbrt(float8); float16 __ovld __cnfn cbrt(float16); #ifdef cl_khr_fp64 double __ovld __cnfn cbrt(double); double2 __ovld __cnfn cbrt(double2); double3 __ovld __cnfn cbrt(double3); double4 __ovld __cnfn cbrt(double4); double8 __ovld __cnfn cbrt(double8); double16 __ovld __cnfn cbrt(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn cbrt(half); half2 __ovld __cnfn cbrt(half2); half3 __ovld __cnfn cbrt(half3); half4 __ovld __cnfn cbrt(half4); half8 __ovld __cnfn cbrt(half8); half16 __ovld __cnfn cbrt(half16); #endif //cl_khr_fp16 /** * Round to integral value using the round to positive * infinity rounding mode. */ float __ovld __cnfn ceil(float); float2 __ovld __cnfn ceil(float2); float3 __ovld __cnfn ceil(float3); float4 __ovld __cnfn ceil(float4); float8 __ovld __cnfn ceil(float8); float16 __ovld __cnfn ceil(float16); #ifdef cl_khr_fp64 double __ovld __cnfn ceil(double); double2 __ovld __cnfn ceil(double2); double3 __ovld __cnfn ceil(double3); double4 __ovld __cnfn ceil(double4); double8 __ovld __cnfn ceil(double8); double16 __ovld __cnfn ceil(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn ceil(half); half2 __ovld __cnfn ceil(half2); half3 __ovld __cnfn ceil(half3); half4 __ovld __cnfn ceil(half4); half8 __ovld __cnfn ceil(half8); half16 __ovld __cnfn ceil(half16); #endif //cl_khr_fp16 /** * Returns x with its sign changed to match the sign of y. */ float __ovld __cnfn copysign(float x, float y); float2 __ovld __cnfn copysign(float2 x, float2 y); float3 __ovld __cnfn copysign(float3 x, float3 y); float4 __ovld __cnfn copysign(float4 x, float4 y); float8 __ovld __cnfn copysign(float8 x, float8 y); float16 __ovld __cnfn copysign(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn copysign(double x, double y); double2 __ovld __cnfn copysign(double2 x, double2 y); double3 __ovld __cnfn copysign(double3 x, double3 y); double4 __ovld __cnfn copysign(double4 x, double4 y); double8 __ovld __cnfn copysign(double8 x, double8 y); double16 __ovld __cnfn copysign(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn copysign(half x, half y); half2 __ovld __cnfn copysign(half2 x, half2 y); half3 __ovld __cnfn copysign(half3 x, half3 y); half4 __ovld __cnfn copysign(half4 x, half4 y); half8 __ovld __cnfn copysign(half8 x, half8 y); half16 __ovld __cnfn copysign(half16 x, half16 y); #endif //cl_khr_fp16 /** * Compute cosine. */ float __ovld __cnfn cos(float); float2 __ovld __cnfn cos(float2); float3 __ovld __cnfn cos(float3); float4 __ovld __cnfn cos(float4); float8 __ovld __cnfn cos(float8); float16 __ovld __cnfn cos(float16); #ifdef cl_khr_fp64 double __ovld __cnfn cos(double); double2 __ovld __cnfn cos(double2); double3 __ovld __cnfn cos(double3); double4 __ovld __cnfn cos(double4); double8 __ovld __cnfn cos(double8); double16 __ovld __cnfn cos(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn cos(half); half2 __ovld __cnfn cos(half2); half3 __ovld __cnfn cos(half3); half4 __ovld __cnfn cos(half4); half8 __ovld __cnfn cos(half8); half16 __ovld __cnfn cos(half16); #endif //cl_khr_fp16 /** * Compute hyperbolic cosine. */ float __ovld __cnfn cosh(float); float2 __ovld __cnfn cosh(float2); float3 __ovld __cnfn cosh(float3); float4 __ovld __cnfn cosh(float4); float8 __ovld __cnfn cosh(float8); float16 __ovld __cnfn cosh(float16); #ifdef cl_khr_fp64 double __ovld __cnfn cosh(double); double2 __ovld __cnfn cosh(double2); double3 __ovld __cnfn cosh(double3); double4 __ovld __cnfn cosh(double4); double8 __ovld __cnfn cosh(double8); double16 __ovld __cnfn cosh(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn cosh(half); half2 __ovld __cnfn cosh(half2); half3 __ovld __cnfn cosh(half3); half4 __ovld __cnfn cosh(half4); half8 __ovld __cnfn cosh(half8); half16 __ovld __cnfn cosh(half16); #endif //cl_khr_fp16 /** * Compute cos (PI * x). */ float __ovld __cnfn cospi(float x); float2 __ovld __cnfn cospi(float2 x); float3 __ovld __cnfn cospi(float3 x); float4 __ovld __cnfn cospi(float4 x); float8 __ovld __cnfn cospi(float8 x); float16 __ovld __cnfn cospi(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn cospi(double x); double2 __ovld __cnfn cospi(double2 x); double3 __ovld __cnfn cospi(double3 x); double4 __ovld __cnfn cospi(double4 x); double8 __ovld __cnfn cospi(double8 x); double16 __ovld __cnfn cospi(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn cospi(half x); half2 __ovld __cnfn cospi(half2 x); half3 __ovld __cnfn cospi(half3 x); half4 __ovld __cnfn cospi(half4 x); half8 __ovld __cnfn cospi(half8 x); half16 __ovld __cnfn cospi(half16 x); #endif //cl_khr_fp16 /** * Complementary error function. */ float __ovld __cnfn erfc(float); float2 __ovld __cnfn erfc(float2); float3 __ovld __cnfn erfc(float3); float4 __ovld __cnfn erfc(float4); float8 __ovld __cnfn erfc(float8); float16 __ovld __cnfn erfc(float16); #ifdef cl_khr_fp64 double __ovld __cnfn erfc(double); double2 __ovld __cnfn erfc(double2); double3 __ovld __cnfn erfc(double3); double4 __ovld __cnfn erfc(double4); double8 __ovld __cnfn erfc(double8); double16 __ovld __cnfn erfc(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn erfc(half); half2 __ovld __cnfn erfc(half2); half3 __ovld __cnfn erfc(half3); half4 __ovld __cnfn erfc(half4); half8 __ovld __cnfn erfc(half8); half16 __ovld __cnfn erfc(half16); #endif //cl_khr_fp16 /** * Error function encountered in integrating the * normal distribution. */ float __ovld __cnfn erf(float); float2 __ovld __cnfn erf(float2); float3 __ovld __cnfn erf(float3); float4 __ovld __cnfn erf(float4); float8 __ovld __cnfn erf(float8); float16 __ovld __cnfn erf(float16); #ifdef cl_khr_fp64 double __ovld __cnfn erf(double); double2 __ovld __cnfn erf(double2); double3 __ovld __cnfn erf(double3); double4 __ovld __cnfn erf(double4); double8 __ovld __cnfn erf(double8); double16 __ovld __cnfn erf(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn erf(half); half2 __ovld __cnfn erf(half2); half3 __ovld __cnfn erf(half3); half4 __ovld __cnfn erf(half4); half8 __ovld __cnfn erf(half8); half16 __ovld __cnfn erf(half16); #endif //cl_khr_fp16 /** * Compute the base e exponential function of x. */ float __ovld __cnfn exp(float x); float2 __ovld __cnfn exp(float2 x); float3 __ovld __cnfn exp(float3 x); float4 __ovld __cnfn exp(float4 x); float8 __ovld __cnfn exp(float8 x); float16 __ovld __cnfn exp(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn exp(double x); double2 __ovld __cnfn exp(double2 x); double3 __ovld __cnfn exp(double3 x); double4 __ovld __cnfn exp(double4 x); double8 __ovld __cnfn exp(double8 x); double16 __ovld __cnfn exp(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn exp(half x); half2 __ovld __cnfn exp(half2 x); half3 __ovld __cnfn exp(half3 x); half4 __ovld __cnfn exp(half4 x); half8 __ovld __cnfn exp(half8 x); half16 __ovld __cnfn exp(half16 x); #endif //cl_khr_fp16 /** * Exponential base 2 function. */ float __ovld __cnfn exp2(float); float2 __ovld __cnfn exp2(float2); float3 __ovld __cnfn exp2(float3); float4 __ovld __cnfn exp2(float4); float8 __ovld __cnfn exp2(float8); float16 __ovld __cnfn exp2(float16); #ifdef cl_khr_fp64 double __ovld __cnfn exp2(double); double2 __ovld __cnfn exp2(double2); double3 __ovld __cnfn exp2(double3); double4 __ovld __cnfn exp2(double4); double8 __ovld __cnfn exp2(double8); double16 __ovld __cnfn exp2(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn exp2(half); half2 __ovld __cnfn exp2(half2); half3 __ovld __cnfn exp2(half3); half4 __ovld __cnfn exp2(half4); half8 __ovld __cnfn exp2(half8); half16 __ovld __cnfn exp2(half16); #endif //cl_khr_fp16 /** * Exponential base 10 function. */ float __ovld __cnfn exp10(float); float2 __ovld __cnfn exp10(float2); float3 __ovld __cnfn exp10(float3); float4 __ovld __cnfn exp10(float4); float8 __ovld __cnfn exp10(float8); float16 __ovld __cnfn exp10(float16); #ifdef cl_khr_fp64 double __ovld __cnfn exp10(double); double2 __ovld __cnfn exp10(double2); double3 __ovld __cnfn exp10(double3); double4 __ovld __cnfn exp10(double4); double8 __ovld __cnfn exp10(double8); double16 __ovld __cnfn exp10(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn exp10(half); half2 __ovld __cnfn exp10(half2); half3 __ovld __cnfn exp10(half3); half4 __ovld __cnfn exp10(half4); half8 __ovld __cnfn exp10(half8); half16 __ovld __cnfn exp10(half16); #endif //cl_khr_fp16 /** * Compute e^x- 1.0. */ float __ovld __cnfn expm1(float x); float2 __ovld __cnfn expm1(float2 x); float3 __ovld __cnfn expm1(float3 x); float4 __ovld __cnfn expm1(float4 x); float8 __ovld __cnfn expm1(float8 x); float16 __ovld __cnfn expm1(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn expm1(double x); double2 __ovld __cnfn expm1(double2 x); double3 __ovld __cnfn expm1(double3 x); double4 __ovld __cnfn expm1(double4 x); double8 __ovld __cnfn expm1(double8 x); double16 __ovld __cnfn expm1(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn expm1(half x); half2 __ovld __cnfn expm1(half2 x); half3 __ovld __cnfn expm1(half3 x); half4 __ovld __cnfn expm1(half4 x); half8 __ovld __cnfn expm1(half8 x); half16 __ovld __cnfn expm1(half16 x); #endif //cl_khr_fp16 /** * Compute absolute value of a floating-point number. */ float __ovld __cnfn fabs(float); float2 __ovld __cnfn fabs(float2); float3 __ovld __cnfn fabs(float3); float4 __ovld __cnfn fabs(float4); float8 __ovld __cnfn fabs(float8); float16 __ovld __cnfn fabs(float16); #ifdef cl_khr_fp64 double __ovld __cnfn fabs(double); double2 __ovld __cnfn fabs(double2); double3 __ovld __cnfn fabs(double3); double4 __ovld __cnfn fabs(double4); double8 __ovld __cnfn fabs(double8); double16 __ovld __cnfn fabs(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn fabs(half); half2 __ovld __cnfn fabs(half2); half3 __ovld __cnfn fabs(half3); half4 __ovld __cnfn fabs(half4); half8 __ovld __cnfn fabs(half8); half16 __ovld __cnfn fabs(half16); #endif //cl_khr_fp16 /** * x - y if x > y, +0 if x is less than or equal to y. */ float __ovld __cnfn fdim(float x, float y); float2 __ovld __cnfn fdim(float2 x, float2 y); float3 __ovld __cnfn fdim(float3 x, float3 y); float4 __ovld __cnfn fdim(float4 x, float4 y); float8 __ovld __cnfn fdim(float8 x, float8 y); float16 __ovld __cnfn fdim(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn fdim(double x, double y); double2 __ovld __cnfn fdim(double2 x, double2 y); double3 __ovld __cnfn fdim(double3 x, double3 y); double4 __ovld __cnfn fdim(double4 x, double4 y); double8 __ovld __cnfn fdim(double8 x, double8 y); double16 __ovld __cnfn fdim(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn fdim(half x, half y); half2 __ovld __cnfn fdim(half2 x, half2 y); half3 __ovld __cnfn fdim(half3 x, half3 y); half4 __ovld __cnfn fdim(half4 x, half4 y); half8 __ovld __cnfn fdim(half8 x, half8 y); half16 __ovld __cnfn fdim(half16 x, half16 y); #endif //cl_khr_fp16 /** * Round to integral value using the round to -ve * infinity rounding mode. */ float __ovld __cnfn floor(float); float2 __ovld __cnfn floor(float2); float3 __ovld __cnfn floor(float3); float4 __ovld __cnfn floor(float4); float8 __ovld __cnfn floor(float8); float16 __ovld __cnfn floor(float16); #ifdef cl_khr_fp64 double __ovld __cnfn floor(double); double2 __ovld __cnfn floor(double2); double3 __ovld __cnfn floor(double3); double4 __ovld __cnfn floor(double4); double8 __ovld __cnfn floor(double8); double16 __ovld __cnfn floor(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn floor(half); half2 __ovld __cnfn floor(half2); half3 __ovld __cnfn floor(half3); half4 __ovld __cnfn floor(half4); half8 __ovld __cnfn floor(half8); half16 __ovld __cnfn floor(half16); #endif //cl_khr_fp16 /** * Returns the correctly rounded floating-point * representation of the sum of c with the infinitely * precise product of a and b. Rounding of * intermediate products shall not occur. Edge case * behavior is per the IEEE 754-2008 standard. */ float __ovld __cnfn fma(float a, float b, float c); float2 __ovld __cnfn fma(float2 a, float2 b, float2 c); float3 __ovld __cnfn fma(float3 a, float3 b, float3 c); float4 __ovld __cnfn fma(float4 a, float4 b, float4 c); float8 __ovld __cnfn fma(float8 a, float8 b, float8 c); float16 __ovld __cnfn fma(float16 a, float16 b, float16 c); #ifdef cl_khr_fp64 double __ovld __cnfn fma(double a, double b, double c); double2 __ovld __cnfn fma(double2 a, double2 b, double2 c); double3 __ovld __cnfn fma(double3 a, double3 b, double3 c); double4 __ovld __cnfn fma(double4 a, double4 b, double4 c); double8 __ovld __cnfn fma(double8 a, double8 b, double8 c); double16 __ovld __cnfn fma(double16 a, double16 b, double16 c); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn fma(half a, half b, half c); half2 __ovld __cnfn fma(half2 a, half2 b, half2 c); half3 __ovld __cnfn fma(half3 a, half3 b, half3 c); half4 __ovld __cnfn fma(half4 a, half4 b, half4 c); half8 __ovld __cnfn fma(half8 a, half8 b, half8 c); half16 __ovld __cnfn fma(half16 a, half16 b, half16 c); #endif //cl_khr_fp16 /** * Returns y if x < y, otherwise it returns x. If one * argument is a NaN, fmax() returns the other * argument. If both arguments are NaNs, fmax() * returns a NaN. */ float __ovld __cnfn fmax(float x, float y); float2 __ovld __cnfn fmax(float2 x, float2 y); float3 __ovld __cnfn fmax(float3 x, float3 y); float4 __ovld __cnfn fmax(float4 x, float4 y); float8 __ovld __cnfn fmax(float8 x, float8 y); float16 __ovld __cnfn fmax(float16 x, float16 y); float2 __ovld __cnfn fmax(float2 x, float y); float3 __ovld __cnfn fmax(float3 x, float y); float4 __ovld __cnfn fmax(float4 x, float y); float8 __ovld __cnfn fmax(float8 x, float y); float16 __ovld __cnfn fmax(float16 x, float y); #ifdef cl_khr_fp64 double __ovld __cnfn fmax(double x, double y); double2 __ovld __cnfn fmax(double2 x, double2 y); double3 __ovld __cnfn fmax(double3 x, double3 y); double4 __ovld __cnfn fmax(double4 x, double4 y); double8 __ovld __cnfn fmax(double8 x, double8 y); double16 __ovld __cnfn fmax(double16 x, double16 y); double2 __ovld __cnfn fmax(double2 x, double y); double3 __ovld __cnfn fmax(double3 x, double y); double4 __ovld __cnfn fmax(double4 x, double y); double8 __ovld __cnfn fmax(double8 x, double y); double16 __ovld __cnfn fmax(double16 x, double y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn fmax(half x, half y); half2 __ovld __cnfn fmax(half2 x, half2 y); half3 __ovld __cnfn fmax(half3 x, half3 y); half4 __ovld __cnfn fmax(half4 x, half4 y); half8 __ovld __cnfn fmax(half8 x, half8 y); half16 __ovld __cnfn fmax(half16 x, half16 y); half2 __ovld __cnfn fmax(half2 x, half y); half3 __ovld __cnfn fmax(half3 x, half y); half4 __ovld __cnfn fmax(half4 x, half y); half8 __ovld __cnfn fmax(half8 x, half y); half16 __ovld __cnfn fmax(half16 x, half y); #endif //cl_khr_fp16 /** * Returns y if y < x, otherwise it returns x. If one * argument is a NaN, fmin() returns the other * argument. If both arguments are NaNs, fmin() * returns a NaN. */ float __ovld __cnfn fmin(float x, float y); float2 __ovld __cnfn fmin(float2 x, float2 y); float3 __ovld __cnfn fmin(float3 x, float3 y); float4 __ovld __cnfn fmin(float4 x, float4 y); float8 __ovld __cnfn fmin(float8 x, float8 y); float16 __ovld __cnfn fmin(float16 x, float16 y); float2 __ovld __cnfn fmin(float2 x, float y); float3 __ovld __cnfn fmin(float3 x, float y); float4 __ovld __cnfn fmin(float4 x, float y); float8 __ovld __cnfn fmin(float8 x, float y); float16 __ovld __cnfn fmin(float16 x, float y); #ifdef cl_khr_fp64 double __ovld __cnfn fmin(double x, double y); double2 __ovld __cnfn fmin(double2 x, double2 y); double3 __ovld __cnfn fmin(double3 x, double3 y); double4 __ovld __cnfn fmin(double4 x, double4 y); double8 __ovld __cnfn fmin(double8 x, double8 y); double16 __ovld __cnfn fmin(double16 x, double16 y); double2 __ovld __cnfn fmin(double2 x, double y); double3 __ovld __cnfn fmin(double3 x, double y); double4 __ovld __cnfn fmin(double4 x, double y); double8 __ovld __cnfn fmin(double8 x, double y); double16 __ovld __cnfn fmin(double16 x, double y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn fmin(half x, half y); half2 __ovld __cnfn fmin(half2 x, half2 y); half3 __ovld __cnfn fmin(half3 x, half3 y); half4 __ovld __cnfn fmin(half4 x, half4 y); half8 __ovld __cnfn fmin(half8 x, half8 y); half16 __ovld __cnfn fmin(half16 x, half16 y); half2 __ovld __cnfn fmin(half2 x, half y); half3 __ovld __cnfn fmin(half3 x, half y); half4 __ovld __cnfn fmin(half4 x, half y); half8 __ovld __cnfn fmin(half8 x, half y); half16 __ovld __cnfn fmin(half16 x, half y); #endif //cl_khr_fp16 /** * Modulus. Returns x - y * trunc (x/y). */ float __ovld __cnfn fmod(float x, float y); float2 __ovld __cnfn fmod(float2 x, float2 y); float3 __ovld __cnfn fmod(float3 x, float3 y); float4 __ovld __cnfn fmod(float4 x, float4 y); float8 __ovld __cnfn fmod(float8 x, float8 y); float16 __ovld __cnfn fmod(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn fmod(double x, double y); double2 __ovld __cnfn fmod(double2 x, double2 y); double3 __ovld __cnfn fmod(double3 x, double3 y); double4 __ovld __cnfn fmod(double4 x, double4 y); double8 __ovld __cnfn fmod(double8 x, double8 y); double16 __ovld __cnfn fmod(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn fmod(half x, half y); half2 __ovld __cnfn fmod(half2 x, half2 y); half3 __ovld __cnfn fmod(half3 x, half3 y); half4 __ovld __cnfn fmod(half4 x, half4 y); half8 __ovld __cnfn fmod(half8 x, half8 y); half16 __ovld __cnfn fmod(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns fmin(x - floor (x), 0x1.fffffep-1f ). * floor(x) is returned in iptr. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld fract(float x, float *iptr); float2 __ovld fract(float2 x, float2 *iptr); float3 __ovld fract(float3 x, float3 *iptr); float4 __ovld fract(float4 x, float4 *iptr); float8 __ovld fract(float8 x, float8 *iptr); float16 __ovld fract(float16 x, float16 *iptr); #ifdef cl_khr_fp64 double __ovld fract(double x, double *iptr); double2 __ovld fract(double2 x, double2 *iptr); double3 __ovld fract(double3 x, double3 *iptr); double4 __ovld fract(double4 x, double4 *iptr); double8 __ovld fract(double8 x, double8 *iptr); double16 __ovld fract(double16 x, double16 *iptr); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld fract(half x, half *iptr); half2 __ovld fract(half2 x, half2 *iptr); half3 __ovld fract(half3 x, half3 *iptr); half4 __ovld fract(half4 x, half4 *iptr); half8 __ovld fract(half8 x, half8 *iptr); half16 __ovld fract(half16 x, half16 *iptr); #endif //cl_khr_fp16 #else float __ovld fract(float x, __global float *iptr); float2 __ovld fract(float2 x, __global float2 *iptr); float3 __ovld fract(float3 x, __global float3 *iptr); float4 __ovld fract(float4 x, __global float4 *iptr); float8 __ovld fract(float8 x, __global float8 *iptr); float16 __ovld fract(float16 x, __global float16 *iptr); float __ovld fract(float x, __local float *iptr); float2 __ovld fract(float2 x, __local float2 *iptr); float3 __ovld fract(float3 x, __local float3 *iptr); float4 __ovld fract(float4 x, __local float4 *iptr); float8 __ovld fract(float8 x, __local float8 *iptr); float16 __ovld fract(float16 x, __local float16 *iptr); float __ovld fract(float x, __private float *iptr); float2 __ovld fract(float2 x, __private float2 *iptr); float3 __ovld fract(float3 x, __private float3 *iptr); float4 __ovld fract(float4 x, __private float4 *iptr); float8 __ovld fract(float8 x, __private float8 *iptr); float16 __ovld fract(float16 x, __private float16 *iptr); #ifdef cl_khr_fp64 double __ovld fract(double x, __global double *iptr); double2 __ovld fract(double2 x, __global double2 *iptr); double3 __ovld fract(double3 x, __global double3 *iptr); double4 __ovld fract(double4 x, __global double4 *iptr); double8 __ovld fract(double8 x, __global double8 *iptr); double16 __ovld fract(double16 x, __global double16 *iptr); double __ovld fract(double x, __local double *iptr); double2 __ovld fract(double2 x, __local double2 *iptr); double3 __ovld fract(double3 x, __local double3 *iptr); double4 __ovld fract(double4 x, __local double4 *iptr); double8 __ovld fract(double8 x, __local double8 *iptr); double16 __ovld fract(double16 x, __local double16 *iptr); double __ovld fract(double x, __private double *iptr); double2 __ovld fract(double2 x, __private double2 *iptr); double3 __ovld fract(double3 x, __private double3 *iptr); double4 __ovld fract(double4 x, __private double4 *iptr); double8 __ovld fract(double8 x, __private double8 *iptr); double16 __ovld fract(double16 x, __private double16 *iptr); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld fract(half x, __global half *iptr); half2 __ovld fract(half2 x, __global half2 *iptr); half3 __ovld fract(half3 x, __global half3 *iptr); half4 __ovld fract(half4 x, __global half4 *iptr); half8 __ovld fract(half8 x, __global half8 *iptr); half16 __ovld fract(half16 x, __global half16 *iptr); half __ovld fract(half x, __local half *iptr); half2 __ovld fract(half2 x, __local half2 *iptr); half3 __ovld fract(half3 x, __local half3 *iptr); half4 __ovld fract(half4 x, __local half4 *iptr); half8 __ovld fract(half8 x, __local half8 *iptr); half16 __ovld fract(half16 x, __local half16 *iptr); half __ovld fract(half x, __private half *iptr); half2 __ovld fract(half2 x, __private half2 *iptr); half3 __ovld fract(half3 x, __private half3 *iptr); half4 __ovld fract(half4 x, __private half4 *iptr); half8 __ovld fract(half8 x, __private half8 *iptr); half16 __ovld fract(half16 x, __private half16 *iptr); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Extract mantissa and exponent from x. For each * component the mantissa returned is a float with * magnitude in the interval [1/2, 1) or 0. Each * component of x equals mantissa returned * 2^exp. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld frexp(float x, int *exp); float2 __ovld frexp(float2 x, int2 *exp); float3 __ovld frexp(float3 x, int3 *exp); float4 __ovld frexp(float4 x, int4 *exp); float8 __ovld frexp(float8 x, int8 *exp); float16 __ovld frexp(float16 x, int16 *exp); #ifdef cl_khr_fp64 double __ovld frexp(double x, int *exp); double2 __ovld frexp(double2 x, int2 *exp); double3 __ovld frexp(double3 x, int3 *exp); double4 __ovld frexp(double4 x, int4 *exp); double8 __ovld frexp(double8 x, int8 *exp); double16 __ovld frexp(double16 x, int16 *exp); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld frexp(half x, int *exp); half2 __ovld frexp(half2 x, int2 *exp); half3 __ovld frexp(half3 x, int3 *exp); half4 __ovld frexp(half4 x, int4 *exp); half8 __ovld frexp(half8 x, int8 *exp); half16 __ovld frexp(half16 x, int16 *exp); #endif //cl_khr_fp16 #else float __ovld frexp(float x, __global int *exp); float2 __ovld frexp(float2 x, __global int2 *exp); float3 __ovld frexp(float3 x, __global int3 *exp); float4 __ovld frexp(float4 x, __global int4 *exp); float8 __ovld frexp(float8 x, __global int8 *exp); float16 __ovld frexp(float16 x, __global int16 *exp); float __ovld frexp(float x, __local int *exp); float2 __ovld frexp(float2 x, __local int2 *exp); float3 __ovld frexp(float3 x, __local int3 *exp); float4 __ovld frexp(float4 x, __local int4 *exp); float8 __ovld frexp(float8 x, __local int8 *exp); float16 __ovld frexp(float16 x, __local int16 *exp); float __ovld frexp(float x, __private int *exp); float2 __ovld frexp(float2 x, __private int2 *exp); float3 __ovld frexp(float3 x, __private int3 *exp); float4 __ovld frexp(float4 x, __private int4 *exp); float8 __ovld frexp(float8 x, __private int8 *exp); float16 __ovld frexp(float16 x, __private int16 *exp); #ifdef cl_khr_fp64 double __ovld frexp(double x, __global int *exp); double2 __ovld frexp(double2 x, __global int2 *exp); double3 __ovld frexp(double3 x, __global int3 *exp); double4 __ovld frexp(double4 x, __global int4 *exp); double8 __ovld frexp(double8 x, __global int8 *exp); double16 __ovld frexp(double16 x, __global int16 *exp); double __ovld frexp(double x, __local int *exp); double2 __ovld frexp(double2 x, __local int2 *exp); double3 __ovld frexp(double3 x, __local int3 *exp); double4 __ovld frexp(double4 x, __local int4 *exp); double8 __ovld frexp(double8 x, __local int8 *exp); double16 __ovld frexp(double16 x, __local int16 *exp); double __ovld frexp(double x, __private int *exp); double2 __ovld frexp(double2 x, __private int2 *exp); double3 __ovld frexp(double3 x, __private int3 *exp); double4 __ovld frexp(double4 x, __private int4 *exp); double8 __ovld frexp(double8 x, __private int8 *exp); double16 __ovld frexp(double16 x, __private int16 *exp); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld frexp(half x, __global int *exp); half2 __ovld frexp(half2 x, __global int2 *exp); half3 __ovld frexp(half3 x, __global int3 *exp); half4 __ovld frexp(half4 x, __global int4 *exp); half8 __ovld frexp(half8 x, __global int8 *exp); half16 __ovld frexp(half16 x, __global int16 *exp); half __ovld frexp(half x, __local int *exp); half2 __ovld frexp(half2 x, __local int2 *exp); half3 __ovld frexp(half3 x, __local int3 *exp); half4 __ovld frexp(half4 x, __local int4 *exp); half8 __ovld frexp(half8 x, __local int8 *exp); half16 __ovld frexp(half16 x, __local int16 *exp); half __ovld frexp(half x, __private int *exp); half2 __ovld frexp(half2 x, __private int2 *exp); half3 __ovld frexp(half3 x, __private int3 *exp); half4 __ovld frexp(half4 x, __private int4 *exp); half8 __ovld frexp(half8 x, __private int8 *exp); half16 __ovld frexp(half16 x, __private int16 *exp); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Compute the value of the square root of x^2 + y^2 * without undue overflow or underflow. */ float __ovld __cnfn hypot(float x, float y); float2 __ovld __cnfn hypot(float2 x, float2 y); float3 __ovld __cnfn hypot(float3 x, float3 y); float4 __ovld __cnfn hypot(float4 x, float4 y); float8 __ovld __cnfn hypot(float8 x, float8 y); float16 __ovld __cnfn hypot(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn hypot(double x, double y); double2 __ovld __cnfn hypot(double2 x, double2 y); double3 __ovld __cnfn hypot(double3 x, double3 y); double4 __ovld __cnfn hypot(double4 x, double4 y); double8 __ovld __cnfn hypot(double8 x, double8 y); double16 __ovld __cnfn hypot(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn hypot(half x, half y); half2 __ovld __cnfn hypot(half2 x, half2 y); half3 __ovld __cnfn hypot(half3 x, half3 y); half4 __ovld __cnfn hypot(half4 x, half4 y); half8 __ovld __cnfn hypot(half8 x, half8 y); half16 __ovld __cnfn hypot(half16 x, half16 y); #endif //cl_khr_fp16 /** * Return the exponent as an integer value. */ int __ovld __cnfn ilogb(float x); int2 __ovld __cnfn ilogb(float2 x); int3 __ovld __cnfn ilogb(float3 x); int4 __ovld __cnfn ilogb(float4 x); int8 __ovld __cnfn ilogb(float8 x); int16 __ovld __cnfn ilogb(float16 x); #ifdef cl_khr_fp64 int __ovld __cnfn ilogb(double x); int2 __ovld __cnfn ilogb(double2 x); int3 __ovld __cnfn ilogb(double3 x); int4 __ovld __cnfn ilogb(double4 x); int8 __ovld __cnfn ilogb(double8 x); int16 __ovld __cnfn ilogb(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn ilogb(half x); int2 __ovld __cnfn ilogb(half2 x); int3 __ovld __cnfn ilogb(half3 x); int4 __ovld __cnfn ilogb(half4 x); int8 __ovld __cnfn ilogb(half8 x); int16 __ovld __cnfn ilogb(half16 x); #endif //cl_khr_fp16 /** * Multiply x by 2 to the power n. */ float __ovld __cnfn ldexp(float x, int n); float2 __ovld __cnfn ldexp(float2 x, int2 n); float3 __ovld __cnfn ldexp(float3 x, int3 n); float4 __ovld __cnfn ldexp(float4 x, int4 n); float8 __ovld __cnfn ldexp(float8 x, int8 n); float16 __ovld __cnfn ldexp(float16 x, int16 n); float2 __ovld __cnfn ldexp(float2 x, int n); float3 __ovld __cnfn ldexp(float3 x, int n); float4 __ovld __cnfn ldexp(float4 x, int n); float8 __ovld __cnfn ldexp(float8 x, int n); float16 __ovld __cnfn ldexp(float16 x, int n); #ifdef cl_khr_fp64 double __ovld __cnfn ldexp(double x, int n); double2 __ovld __cnfn ldexp(double2 x, int2 n); double3 __ovld __cnfn ldexp(double3 x, int3 n); double4 __ovld __cnfn ldexp(double4 x, int4 n); double8 __ovld __cnfn ldexp(double8 x, int8 n); double16 __ovld __cnfn ldexp(double16 x, int16 n); double2 __ovld __cnfn ldexp(double2 x, int n); double3 __ovld __cnfn ldexp(double3 x, int n); double4 __ovld __cnfn ldexp(double4 x, int n); double8 __ovld __cnfn ldexp(double8 x, int n); double16 __ovld __cnfn ldexp(double16 x, int n); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn ldexp(half x, int n); half2 __ovld __cnfn ldexp(half2 x, int2 n); half3 __ovld __cnfn ldexp(half3 x, int3 n); half4 __ovld __cnfn ldexp(half4 x, int4 n); half8 __ovld __cnfn ldexp(half8 x, int8 n); half16 __ovld __cnfn ldexp(half16 x, int16 n); half2 __ovld __cnfn ldexp(half2 x, int n); half3 __ovld __cnfn ldexp(half3 x, int n); half4 __ovld __cnfn ldexp(half4 x, int n); half8 __ovld __cnfn ldexp(half8 x, int n); half16 __ovld __cnfn ldexp(half16 x, int n); #endif //cl_khr_fp16 /** * Log gamma function. Returns the natural * logarithm of the absolute value of the gamma * function. The sign of the gamma function is * returned in the signp argument of lgamma_r. */ float __ovld __cnfn lgamma(float x); float2 __ovld __cnfn lgamma(float2 x); float3 __ovld __cnfn lgamma(float3 x); float4 __ovld __cnfn lgamma(float4 x); float8 __ovld __cnfn lgamma(float8 x); float16 __ovld __cnfn lgamma(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn lgamma(double x); double2 __ovld __cnfn lgamma(double2 x); double3 __ovld __cnfn lgamma(double3 x); double4 __ovld __cnfn lgamma(double4 x); double8 __ovld __cnfn lgamma(double8 x); double16 __ovld __cnfn lgamma(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn lgamma(half x); half2 __ovld __cnfn lgamma(half2 x); half3 __ovld __cnfn lgamma(half3 x); half4 __ovld __cnfn lgamma(half4 x); half8 __ovld __cnfn lgamma(half8 x); half16 __ovld __cnfn lgamma(half16 x); #endif //cl_khr_fp16 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld lgamma_r(float x, int *signp); float2 __ovld lgamma_r(float2 x, int2 *signp); float3 __ovld lgamma_r(float3 x, int3 *signp); float4 __ovld lgamma_r(float4 x, int4 *signp); float8 __ovld lgamma_r(float8 x, int8 *signp); float16 __ovld lgamma_r(float16 x, int16 *signp); #ifdef cl_khr_fp64 double __ovld lgamma_r(double x, int *signp); double2 __ovld lgamma_r(double2 x, int2 *signp); double3 __ovld lgamma_r(double3 x, int3 *signp); double4 __ovld lgamma_r(double4 x, int4 *signp); double8 __ovld lgamma_r(double8 x, int8 *signp); double16 __ovld lgamma_r(double16 x, int16 *signp); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld lgamma_r(half x, int *signp); half2 __ovld lgamma_r(half2 x, int2 *signp); half3 __ovld lgamma_r(half3 x, int3 *signp); half4 __ovld lgamma_r(half4 x, int4 *signp); half8 __ovld lgamma_r(half8 x, int8 *signp); half16 __ovld lgamma_r(half16 x, int16 *signp); #endif //cl_khr_fp16 #else float __ovld lgamma_r(float x, __global int *signp); float2 __ovld lgamma_r(float2 x, __global int2 *signp); float3 __ovld lgamma_r(float3 x, __global int3 *signp); float4 __ovld lgamma_r(float4 x, __global int4 *signp); float8 __ovld lgamma_r(float8 x, __global int8 *signp); float16 __ovld lgamma_r(float16 x, __global int16 *signp); float __ovld lgamma_r(float x, __local int *signp); float2 __ovld lgamma_r(float2 x, __local int2 *signp); float3 __ovld lgamma_r(float3 x, __local int3 *signp); float4 __ovld lgamma_r(float4 x, __local int4 *signp); float8 __ovld lgamma_r(float8 x, __local int8 *signp); float16 __ovld lgamma_r(float16 x, __local int16 *signp); float __ovld lgamma_r(float x, __private int *signp); float2 __ovld lgamma_r(float2 x, __private int2 *signp); float3 __ovld lgamma_r(float3 x, __private int3 *signp); float4 __ovld lgamma_r(float4 x, __private int4 *signp); float8 __ovld lgamma_r(float8 x, __private int8 *signp); float16 __ovld lgamma_r(float16 x, __private int16 *signp); #ifdef cl_khr_fp64 double __ovld lgamma_r(double x, __global int *signp); double2 __ovld lgamma_r(double2 x, __global int2 *signp); double3 __ovld lgamma_r(double3 x, __global int3 *signp); double4 __ovld lgamma_r(double4 x, __global int4 *signp); double8 __ovld lgamma_r(double8 x, __global int8 *signp); double16 __ovld lgamma_r(double16 x, __global int16 *signp); double __ovld lgamma_r(double x, __local int *signp); double2 __ovld lgamma_r(double2 x, __local int2 *signp); double3 __ovld lgamma_r(double3 x, __local int3 *signp); double4 __ovld lgamma_r(double4 x, __local int4 *signp); double8 __ovld lgamma_r(double8 x, __local int8 *signp); double16 __ovld lgamma_r(double16 x, __local int16 *signp); double __ovld lgamma_r(double x, __private int *signp); double2 __ovld lgamma_r(double2 x, __private int2 *signp); double3 __ovld lgamma_r(double3 x, __private int3 *signp); double4 __ovld lgamma_r(double4 x, __private int4 *signp); double8 __ovld lgamma_r(double8 x, __private int8 *signp); double16 __ovld lgamma_r(double16 x, __private int16 *signp); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld lgamma_r(half x, __global int *signp); half2 __ovld lgamma_r(half2 x, __global int2 *signp); half3 __ovld lgamma_r(half3 x, __global int3 *signp); half4 __ovld lgamma_r(half4 x, __global int4 *signp); half8 __ovld lgamma_r(half8 x, __global int8 *signp); half16 __ovld lgamma_r(half16 x, __global int16 *signp); half __ovld lgamma_r(half x, __local int *signp); half2 __ovld lgamma_r(half2 x, __local int2 *signp); half3 __ovld lgamma_r(half3 x, __local int3 *signp); half4 __ovld lgamma_r(half4 x, __local int4 *signp); half8 __ovld lgamma_r(half8 x, __local int8 *signp); half16 __ovld lgamma_r(half16 x, __local int16 *signp); half __ovld lgamma_r(half x, __private int *signp); half2 __ovld lgamma_r(half2 x, __private int2 *signp); half3 __ovld lgamma_r(half3 x, __private int3 *signp); half4 __ovld lgamma_r(half4 x, __private int4 *signp); half8 __ovld lgamma_r(half8 x, __private int8 *signp); half16 __ovld lgamma_r(half16 x, __private int16 *signp); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Compute natural logarithm. */ float __ovld __cnfn log(float); float2 __ovld __cnfn log(float2); float3 __ovld __cnfn log(float3); float4 __ovld __cnfn log(float4); float8 __ovld __cnfn log(float8); float16 __ovld __cnfn log(float16); #ifdef cl_khr_fp64 double __ovld __cnfn log(double); double2 __ovld __cnfn log(double2); double3 __ovld __cnfn log(double3); double4 __ovld __cnfn log(double4); double8 __ovld __cnfn log(double8); double16 __ovld __cnfn log(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn log(half); half2 __ovld __cnfn log(half2); half3 __ovld __cnfn log(half3); half4 __ovld __cnfn log(half4); half8 __ovld __cnfn log(half8); half16 __ovld __cnfn log(half16); #endif //cl_khr_fp16 /** * Compute a base 2 logarithm. */ float __ovld __cnfn log2(float); float2 __ovld __cnfn log2(float2); float3 __ovld __cnfn log2(float3); float4 __ovld __cnfn log2(float4); float8 __ovld __cnfn log2(float8); float16 __ovld __cnfn log2(float16); #ifdef cl_khr_fp64 double __ovld __cnfn log2(double); double2 __ovld __cnfn log2(double2); double3 __ovld __cnfn log2(double3); double4 __ovld __cnfn log2(double4); double8 __ovld __cnfn log2(double8); double16 __ovld __cnfn log2(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn log2(half); half2 __ovld __cnfn log2(half2); half3 __ovld __cnfn log2(half3); half4 __ovld __cnfn log2(half4); half8 __ovld __cnfn log2(half8); half16 __ovld __cnfn log2(half16); #endif //cl_khr_fp16 /** * Compute a base 10 logarithm. */ float __ovld __cnfn log10(float); float2 __ovld __cnfn log10(float2); float3 __ovld __cnfn log10(float3); float4 __ovld __cnfn log10(float4); float8 __ovld __cnfn log10(float8); float16 __ovld __cnfn log10(float16); #ifdef cl_khr_fp64 double __ovld __cnfn log10(double); double2 __ovld __cnfn log10(double2); double3 __ovld __cnfn log10(double3); double4 __ovld __cnfn log10(double4); double8 __ovld __cnfn log10(double8); double16 __ovld __cnfn log10(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn log10(half); half2 __ovld __cnfn log10(half2); half3 __ovld __cnfn log10(half3); half4 __ovld __cnfn log10(half4); half8 __ovld __cnfn log10(half8); half16 __ovld __cnfn log10(half16); #endif //cl_khr_fp16 /** * Compute a base e logarithm of (1.0 + x). */ float __ovld __cnfn log1p(float x); float2 __ovld __cnfn log1p(float2 x); float3 __ovld __cnfn log1p(float3 x); float4 __ovld __cnfn log1p(float4 x); float8 __ovld __cnfn log1p(float8 x); float16 __ovld __cnfn log1p(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn log1p(double x); double2 __ovld __cnfn log1p(double2 x); double3 __ovld __cnfn log1p(double3 x); double4 __ovld __cnfn log1p(double4 x); double8 __ovld __cnfn log1p(double8 x); double16 __ovld __cnfn log1p(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn log1p(half x); half2 __ovld __cnfn log1p(half2 x); half3 __ovld __cnfn log1p(half3 x); half4 __ovld __cnfn log1p(half4 x); half8 __ovld __cnfn log1p(half8 x); half16 __ovld __cnfn log1p(half16 x); #endif //cl_khr_fp16 /** * Compute the exponent of x, which is the integral * part of logr | x |. */ float __ovld __cnfn logb(float x); float2 __ovld __cnfn logb(float2 x); float3 __ovld __cnfn logb(float3 x); float4 __ovld __cnfn logb(float4 x); float8 __ovld __cnfn logb(float8 x); float16 __ovld __cnfn logb(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn logb(double x); double2 __ovld __cnfn logb(double2 x); double3 __ovld __cnfn logb(double3 x); double4 __ovld __cnfn logb(double4 x); double8 __ovld __cnfn logb(double8 x); double16 __ovld __cnfn logb(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn logb(half x); half2 __ovld __cnfn logb(half2 x); half3 __ovld __cnfn logb(half3 x); half4 __ovld __cnfn logb(half4 x); half8 __ovld __cnfn logb(half8 x); half16 __ovld __cnfn logb(half16 x); #endif //cl_khr_fp16 /** * mad approximates a * b + c. Whether or how the * product of a * b is rounded and how supernormal or * subnormal intermediate products are handled is not * defined. mad is intended to be used where speed is * preferred over accuracy. */ float __ovld __cnfn mad(float a, float b, float c); float2 __ovld __cnfn mad(float2 a, float2 b, float2 c); float3 __ovld __cnfn mad(float3 a, float3 b, float3 c); float4 __ovld __cnfn mad(float4 a, float4 b, float4 c); float8 __ovld __cnfn mad(float8 a, float8 b, float8 c); float16 __ovld __cnfn mad(float16 a, float16 b, float16 c); #ifdef cl_khr_fp64 double __ovld __cnfn mad(double a, double b, double c); double2 __ovld __cnfn mad(double2 a, double2 b, double2 c); double3 __ovld __cnfn mad(double3 a, double3 b, double3 c); double4 __ovld __cnfn mad(double4 a, double4 b, double4 c); double8 __ovld __cnfn mad(double8 a, double8 b, double8 c); double16 __ovld __cnfn mad(double16 a, double16 b, double16 c); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn mad(half a, half b, half c); half2 __ovld __cnfn mad(half2 a, half2 b, half2 c); half3 __ovld __cnfn mad(half3 a, half3 b, half3 c); half4 __ovld __cnfn mad(half4 a, half4 b, half4 c); half8 __ovld __cnfn mad(half8 a, half8 b, half8 c); half16 __ovld __cnfn mad(half16 a, half16 b, half16 c); #endif //cl_khr_fp16 /** * Returns x if | x | > | y |, y if | y | > | x |, otherwise * fmax(x, y). */ float __ovld __cnfn maxmag(float x, float y); float2 __ovld __cnfn maxmag(float2 x, float2 y); float3 __ovld __cnfn maxmag(float3 x, float3 y); float4 __ovld __cnfn maxmag(float4 x, float4 y); float8 __ovld __cnfn maxmag(float8 x, float8 y); float16 __ovld __cnfn maxmag(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn maxmag(double x, double y); double2 __ovld __cnfn maxmag(double2 x, double2 y); double3 __ovld __cnfn maxmag(double3 x, double3 y); double4 __ovld __cnfn maxmag(double4 x, double4 y); double8 __ovld __cnfn maxmag(double8 x, double8 y); double16 __ovld __cnfn maxmag(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn maxmag(half x, half y); half2 __ovld __cnfn maxmag(half2 x, half2 y); half3 __ovld __cnfn maxmag(half3 x, half3 y); half4 __ovld __cnfn maxmag(half4 x, half4 y); half8 __ovld __cnfn maxmag(half8 x, half8 y); half16 __ovld __cnfn maxmag(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns x if | x | < | y |, y if | y | < | x |, otherwise * fmin(x, y). */ float __ovld __cnfn minmag(float x, float y); float2 __ovld __cnfn minmag(float2 x, float2 y); float3 __ovld __cnfn minmag(float3 x, float3 y); float4 __ovld __cnfn minmag(float4 x, float4 y); float8 __ovld __cnfn minmag(float8 x, float8 y); float16 __ovld __cnfn minmag(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn minmag(double x, double y); double2 __ovld __cnfn minmag(double2 x, double2 y); double3 __ovld __cnfn minmag(double3 x, double3 y); double4 __ovld __cnfn minmag(double4 x, double4 y); double8 __ovld __cnfn minmag(double8 x, double8 y); double16 __ovld __cnfn minmag(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn minmag(half x, half y); half2 __ovld __cnfn minmag(half2 x, half2 y); half3 __ovld __cnfn minmag(half3 x, half3 y); half4 __ovld __cnfn minmag(half4 x, half4 y); half8 __ovld __cnfn minmag(half8 x, half8 y); half16 __ovld __cnfn minmag(half16 x, half16 y); #endif //cl_khr_fp16 /** * Decompose a floating-point number. The modf * function breaks the argument x into integral and * fractional parts, each of which has the same sign as * the argument. It stores the integral part in the object * pointed to by iptr. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld modf(float x, float *iptr); float2 __ovld modf(float2 x, float2 *iptr); float3 __ovld modf(float3 x, float3 *iptr); float4 __ovld modf(float4 x, float4 *iptr); float8 __ovld modf(float8 x, float8 *iptr); float16 __ovld modf(float16 x, float16 *iptr); #ifdef cl_khr_fp64 double __ovld modf(double x, double *iptr); double2 __ovld modf(double2 x, double2 *iptr); double3 __ovld modf(double3 x, double3 *iptr); double4 __ovld modf(double4 x, double4 *iptr); double8 __ovld modf(double8 x, double8 *iptr); double16 __ovld modf(double16 x, double16 *iptr); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld modf(half x, half *iptr); half2 __ovld modf(half2 x, half2 *iptr); half3 __ovld modf(half3 x, half3 *iptr); half4 __ovld modf(half4 x, half4 *iptr); half8 __ovld modf(half8 x, half8 *iptr); half16 __ovld modf(half16 x, half16 *iptr); #endif //cl_khr_fp16 #else float __ovld modf(float x, __global float *iptr); float2 __ovld modf(float2 x, __global float2 *iptr); float3 __ovld modf(float3 x, __global float3 *iptr); float4 __ovld modf(float4 x, __global float4 *iptr); float8 __ovld modf(float8 x, __global float8 *iptr); float16 __ovld modf(float16 x, __global float16 *iptr); float __ovld modf(float x, __local float *iptr); float2 __ovld modf(float2 x, __local float2 *iptr); float3 __ovld modf(float3 x, __local float3 *iptr); float4 __ovld modf(float4 x, __local float4 *iptr); float8 __ovld modf(float8 x, __local float8 *iptr); float16 __ovld modf(float16 x, __local float16 *iptr); float __ovld modf(float x, __private float *iptr); float2 __ovld modf(float2 x, __private float2 *iptr); float3 __ovld modf(float3 x, __private float3 *iptr); float4 __ovld modf(float4 x, __private float4 *iptr); float8 __ovld modf(float8 x, __private float8 *iptr); float16 __ovld modf(float16 x, __private float16 *iptr); #ifdef cl_khr_fp64 double __ovld modf(double x, __global double *iptr); double2 __ovld modf(double2 x, __global double2 *iptr); double3 __ovld modf(double3 x, __global double3 *iptr); double4 __ovld modf(double4 x, __global double4 *iptr); double8 __ovld modf(double8 x, __global double8 *iptr); double16 __ovld modf(double16 x, __global double16 *iptr); double __ovld modf(double x, __local double *iptr); double2 __ovld modf(double2 x, __local double2 *iptr); double3 __ovld modf(double3 x, __local double3 *iptr); double4 __ovld modf(double4 x, __local double4 *iptr); double8 __ovld modf(double8 x, __local double8 *iptr); double16 __ovld modf(double16 x, __local double16 *iptr); double __ovld modf(double x, __private double *iptr); double2 __ovld modf(double2 x, __private double2 *iptr); double3 __ovld modf(double3 x, __private double3 *iptr); double4 __ovld modf(double4 x, __private double4 *iptr); double8 __ovld modf(double8 x, __private double8 *iptr); double16 __ovld modf(double16 x, __private double16 *iptr); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld modf(half x, __global half *iptr); half2 __ovld modf(half2 x, __global half2 *iptr); half3 __ovld modf(half3 x, __global half3 *iptr); half4 __ovld modf(half4 x, __global half4 *iptr); half8 __ovld modf(half8 x, __global half8 *iptr); half16 __ovld modf(half16 x, __global half16 *iptr); half __ovld modf(half x, __local half *iptr); half2 __ovld modf(half2 x, __local half2 *iptr); half3 __ovld modf(half3 x, __local half3 *iptr); half4 __ovld modf(half4 x, __local half4 *iptr); half8 __ovld modf(half8 x, __local half8 *iptr); half16 __ovld modf(half16 x, __local half16 *iptr); half __ovld modf(half x, __private half *iptr); half2 __ovld modf(half2 x, __private half2 *iptr); half3 __ovld modf(half3 x, __private half3 *iptr); half4 __ovld modf(half4 x, __private half4 *iptr); half8 __ovld modf(half8 x, __private half8 *iptr); half16 __ovld modf(half16 x, __private half16 *iptr); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Returns a quiet NaN. The nancode may be placed * in the significand of the resulting NaN. */ float __ovld __cnfn nan(uint nancode); float2 __ovld __cnfn nan(uint2 nancode); float3 __ovld __cnfn nan(uint3 nancode); float4 __ovld __cnfn nan(uint4 nancode); float8 __ovld __cnfn nan(uint8 nancode); float16 __ovld __cnfn nan(uint16 nancode); #ifdef cl_khr_fp64 double __ovld __cnfn nan(ulong nancode); double2 __ovld __cnfn nan(ulong2 nancode); double3 __ovld __cnfn nan(ulong3 nancode); double4 __ovld __cnfn nan(ulong4 nancode); double8 __ovld __cnfn nan(ulong8 nancode); double16 __ovld __cnfn nan(ulong16 nancode); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn nan(ushort nancode); half2 __ovld __cnfn nan(ushort2 nancode); half3 __ovld __cnfn nan(ushort3 nancode); half4 __ovld __cnfn nan(ushort4 nancode); half8 __ovld __cnfn nan(ushort8 nancode); half16 __ovld __cnfn nan(ushort16 nancode); #endif //cl_khr_fp16 /** * Computes the next representable single-precision * floating-point value following x in the direction of * y. Thus, if y is less than x, nextafter() returns the * largest representable floating-point number less * than x. */ float __ovld __cnfn nextafter(float x, float y); float2 __ovld __cnfn nextafter(float2 x, float2 y); float3 __ovld __cnfn nextafter(float3 x, float3 y); float4 __ovld __cnfn nextafter(float4 x, float4 y); float8 __ovld __cnfn nextafter(float8 x, float8 y); float16 __ovld __cnfn nextafter(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn nextafter(double x, double y); double2 __ovld __cnfn nextafter(double2 x, double2 y); double3 __ovld __cnfn nextafter(double3 x, double3 y); double4 __ovld __cnfn nextafter(double4 x, double4 y); double8 __ovld __cnfn nextafter(double8 x, double8 y); double16 __ovld __cnfn nextafter(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn nextafter(half x, half y); half2 __ovld __cnfn nextafter(half2 x, half2 y); half3 __ovld __cnfn nextafter(half3 x, half3 y); half4 __ovld __cnfn nextafter(half4 x, half4 y); half8 __ovld __cnfn nextafter(half8 x, half8 y); half16 __ovld __cnfn nextafter(half16 x, half16 y); #endif //cl_khr_fp16 /** * Compute x to the power y. */ float __ovld __cnfn pow(float x, float y); float2 __ovld __cnfn pow(float2 x, float2 y); float3 __ovld __cnfn pow(float3 x, float3 y); float4 __ovld __cnfn pow(float4 x, float4 y); float8 __ovld __cnfn pow(float8 x, float8 y); float16 __ovld __cnfn pow(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn pow(double x, double y); double2 __ovld __cnfn pow(double2 x, double2 y); double3 __ovld __cnfn pow(double3 x, double3 y); double4 __ovld __cnfn pow(double4 x, double4 y); double8 __ovld __cnfn pow(double8 x, double8 y); double16 __ovld __cnfn pow(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn pow(half x, half y); half2 __ovld __cnfn pow(half2 x, half2 y); half3 __ovld __cnfn pow(half3 x, half3 y); half4 __ovld __cnfn pow(half4 x, half4 y); half8 __ovld __cnfn pow(half8 x, half8 y); half16 __ovld __cnfn pow(half16 x, half16 y); #endif //cl_khr_fp16 /** * Compute x to the power y, where y is an integer. */ float __ovld __cnfn pown(float x, int y); float2 __ovld __cnfn pown(float2 x, int2 y); float3 __ovld __cnfn pown(float3 x, int3 y); float4 __ovld __cnfn pown(float4 x, int4 y); float8 __ovld __cnfn pown(float8 x, int8 y); float16 __ovld __cnfn pown(float16 x, int16 y); #ifdef cl_khr_fp64 double __ovld __cnfn pown(double x, int y); double2 __ovld __cnfn pown(double2 x, int2 y); double3 __ovld __cnfn pown(double3 x, int3 y); double4 __ovld __cnfn pown(double4 x, int4 y); double8 __ovld __cnfn pown(double8 x, int8 y); double16 __ovld __cnfn pown(double16 x, int16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn pown(half x, int y); half2 __ovld __cnfn pown(half2 x, int2 y); half3 __ovld __cnfn pown(half3 x, int3 y); half4 __ovld __cnfn pown(half4 x, int4 y); half8 __ovld __cnfn pown(half8 x, int8 y); half16 __ovld __cnfn pown(half16 x, int16 y); #endif //cl_khr_fp16 /** * Compute x to the power y, where x is >= 0. */ float __ovld __cnfn powr(float x, float y); float2 __ovld __cnfn powr(float2 x, float2 y); float3 __ovld __cnfn powr(float3 x, float3 y); float4 __ovld __cnfn powr(float4 x, float4 y); float8 __ovld __cnfn powr(float8 x, float8 y); float16 __ovld __cnfn powr(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn powr(double x, double y); double2 __ovld __cnfn powr(double2 x, double2 y); double3 __ovld __cnfn powr(double3 x, double3 y); double4 __ovld __cnfn powr(double4 x, double4 y); double8 __ovld __cnfn powr(double8 x, double8 y); double16 __ovld __cnfn powr(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn powr(half x, half y); half2 __ovld __cnfn powr(half2 x, half2 y); half3 __ovld __cnfn powr(half3 x, half3 y); half4 __ovld __cnfn powr(half4 x, half4 y); half8 __ovld __cnfn powr(half8 x, half8 y); half16 __ovld __cnfn powr(half16 x, half16 y); #endif //cl_khr_fp16 /** * Compute the value r such that r = x - n*y, where n * is the integer nearest the exact value of x/y. If there * are two integers closest to x/y, n shall be the even * one. If r is zero, it is given the same sign as x. */ float __ovld __cnfn remainder(float x, float y); float2 __ovld __cnfn remainder(float2 x, float2 y); float3 __ovld __cnfn remainder(float3 x, float3 y); float4 __ovld __cnfn remainder(float4 x, float4 y); float8 __ovld __cnfn remainder(float8 x, float8 y); float16 __ovld __cnfn remainder(float16 x, float16 y); #ifdef cl_khr_fp64 double __ovld __cnfn remainder(double x, double y); double2 __ovld __cnfn remainder(double2 x, double2 y); double3 __ovld __cnfn remainder(double3 x, double3 y); double4 __ovld __cnfn remainder(double4 x, double4 y); double8 __ovld __cnfn remainder(double8 x, double8 y); double16 __ovld __cnfn remainder(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn remainder(half x, half y); half2 __ovld __cnfn remainder(half2 x, half2 y); half3 __ovld __cnfn remainder(half3 x, half3 y); half4 __ovld __cnfn remainder(half4 x, half4 y); half8 __ovld __cnfn remainder(half8 x, half8 y); half16 __ovld __cnfn remainder(half16 x, half16 y); #endif //cl_khr_fp16 /** * The remquo function computes the value r such * that r = x - n*y, where n is the integer nearest the * exact value of x/y. If there are two integers closest * to x/y, n shall be the even one. If r is zero, it is * given the same sign as x. This is the same value * that is returned by the remainder function. * remquo also calculates the lower seven bits of the * integral quotient x/y, and gives that value the same * sign as x/y. It stores this signed value in the object * pointed to by quo. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld remquo(float x, float y, int *quo); float2 __ovld remquo(float2 x, float2 y, int2 *quo); float3 __ovld remquo(float3 x, float3 y, int3 *quo); float4 __ovld remquo(float4 x, float4 y, int4 *quo); float8 __ovld remquo(float8 x, float8 y, int8 *quo); float16 __ovld remquo(float16 x, float16 y, int16 *quo); #ifdef cl_khr_fp64 double __ovld remquo(double x, double y, int *quo); double2 __ovld remquo(double2 x, double2 y, int2 *quo); double3 __ovld remquo(double3 x, double3 y, int3 *quo); double4 __ovld remquo(double4 x, double4 y, int4 *quo); double8 __ovld remquo(double8 x, double8 y, int8 *quo); double16 __ovld remquo(double16 x, double16 y, int16 *quo); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld remquo(half x, half y, int *quo); half2 __ovld remquo(half2 x, half2 y, int2 *quo); half3 __ovld remquo(half3 x, half3 y, int3 *quo); half4 __ovld remquo(half4 x, half4 y, int4 *quo); half8 __ovld remquo(half8 x, half8 y, int8 *quo); half16 __ovld remquo(half16 x, half16 y, int16 *quo); #endif //cl_khr_fp16 #else float __ovld remquo(float x, float y, __global int *quo); float2 __ovld remquo(float2 x, float2 y, __global int2 *quo); float3 __ovld remquo(float3 x, float3 y, __global int3 *quo); float4 __ovld remquo(float4 x, float4 y, __global int4 *quo); float8 __ovld remquo(float8 x, float8 y, __global int8 *quo); float16 __ovld remquo(float16 x, float16 y, __global int16 *quo); float __ovld remquo(float x, float y, __local int *quo); float2 __ovld remquo(float2 x, float2 y, __local int2 *quo); float3 __ovld remquo(float3 x, float3 y, __local int3 *quo); float4 __ovld remquo(float4 x, float4 y, __local int4 *quo); float8 __ovld remquo(float8 x, float8 y, __local int8 *quo); float16 __ovld remquo(float16 x, float16 y, __local int16 *quo); float __ovld remquo(float x, float y, __private int *quo); float2 __ovld remquo(float2 x, float2 y, __private int2 *quo); float3 __ovld remquo(float3 x, float3 y, __private int3 *quo); float4 __ovld remquo(float4 x, float4 y, __private int4 *quo); float8 __ovld remquo(float8 x, float8 y, __private int8 *quo); float16 __ovld remquo(float16 x, float16 y, __private int16 *quo); #ifdef cl_khr_fp64 double __ovld remquo(double x, double y, __global int *quo); double2 __ovld remquo(double2 x, double2 y, __global int2 *quo); double3 __ovld remquo(double3 x, double3 y, __global int3 *quo); double4 __ovld remquo(double4 x, double4 y, __global int4 *quo); double8 __ovld remquo(double8 x, double8 y, __global int8 *quo); double16 __ovld remquo(double16 x, double16 y, __global int16 *quo); double __ovld remquo(double x, double y, __local int *quo); double2 __ovld remquo(double2 x, double2 y, __local int2 *quo); double3 __ovld remquo(double3 x, double3 y, __local int3 *quo); double4 __ovld remquo(double4 x, double4 y, __local int4 *quo); double8 __ovld remquo(double8 x, double8 y, __local int8 *quo); double16 __ovld remquo(double16 x, double16 y, __local int16 *quo); double __ovld remquo(double x, double y, __private int *quo); double2 __ovld remquo(double2 x, double2 y, __private int2 *quo); double3 __ovld remquo(double3 x, double3 y, __private int3 *quo); double4 __ovld remquo(double4 x, double4 y, __private int4 *quo); double8 __ovld remquo(double8 x, double8 y, __private int8 *quo); double16 __ovld remquo(double16 x, double16 y, __private int16 *quo); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld remquo(half x, half y, __global int *quo); half2 __ovld remquo(half2 x, half2 y, __global int2 *quo); half3 __ovld remquo(half3 x, half3 y, __global int3 *quo); half4 __ovld remquo(half4 x, half4 y, __global int4 *quo); half8 __ovld remquo(half8 x, half8 y, __global int8 *quo); half16 __ovld remquo(half16 x, half16 y, __global int16 *quo); half __ovld remquo(half x, half y, __local int *quo); half2 __ovld remquo(half2 x, half2 y, __local int2 *quo); half3 __ovld remquo(half3 x, half3 y, __local int3 *quo); half4 __ovld remquo(half4 x, half4 y, __local int4 *quo); half8 __ovld remquo(half8 x, half8 y, __local int8 *quo); half16 __ovld remquo(half16 x, half16 y, __local int16 *quo); half __ovld remquo(half x, half y, __private int *quo); half2 __ovld remquo(half2 x, half2 y, __private int2 *quo); half3 __ovld remquo(half3 x, half3 y, __private int3 *quo); half4 __ovld remquo(half4 x, half4 y, __private int4 *quo); half8 __ovld remquo(half8 x, half8 y, __private int8 *quo); half16 __ovld remquo(half16 x, half16 y, __private int16 *quo); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Round to integral value (using round to nearest * even rounding mode) in floating-point format. * Refer to section 7.1 for description of rounding * modes. */ float __ovld __cnfn rint(float); float2 __ovld __cnfn rint(float2); float3 __ovld __cnfn rint(float3); float4 __ovld __cnfn rint(float4); float8 __ovld __cnfn rint(float8); float16 __ovld __cnfn rint(float16); #ifdef cl_khr_fp64 double __ovld __cnfn rint(double); double2 __ovld __cnfn rint(double2); double3 __ovld __cnfn rint(double3); double4 __ovld __cnfn rint(double4); double8 __ovld __cnfn rint(double8); double16 __ovld __cnfn rint(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn rint(half); half2 __ovld __cnfn rint(half2); half3 __ovld __cnfn rint(half3); half4 __ovld __cnfn rint(half4); half8 __ovld __cnfn rint(half8); half16 __ovld __cnfn rint(half16); #endif //cl_khr_fp16 /** * Compute x to the power 1/y. */ float __ovld __cnfn rootn(float x, int y); float2 __ovld __cnfn rootn(float2 x, int2 y); float3 __ovld __cnfn rootn(float3 x, int3 y); float4 __ovld __cnfn rootn(float4 x, int4 y); float8 __ovld __cnfn rootn(float8 x, int8 y); float16 __ovld __cnfn rootn(float16 x, int16 y); #ifdef cl_khr_fp64 double __ovld __cnfn rootn(double x, int y); double2 __ovld __cnfn rootn(double2 x, int2 y); double3 __ovld __cnfn rootn(double3 x, int3 y); double4 __ovld __cnfn rootn(double4 x, int4 y); double8 __ovld __cnfn rootn(double8 x, int8 y); double16 __ovld __cnfn rootn(double16 x, int16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn rootn(half x, int y); half2 __ovld __cnfn rootn(half2 x, int2 y); half3 __ovld __cnfn rootn(half3 x, int3 y); half4 __ovld __cnfn rootn(half4 x, int4 y); half8 __ovld __cnfn rootn(half8 x, int8 y); half16 __ovld __cnfn rootn(half16 x, int16 y); #endif //cl_khr_fp16 /** * Return the integral value nearest to x rounding * halfway cases away from zero, regardless of the * current rounding direction. */ float __ovld __cnfn round(float x); float2 __ovld __cnfn round(float2 x); float3 __ovld __cnfn round(float3 x); float4 __ovld __cnfn round(float4 x); float8 __ovld __cnfn round(float8 x); float16 __ovld __cnfn round(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn round(double x); double2 __ovld __cnfn round(double2 x); double3 __ovld __cnfn round(double3 x); double4 __ovld __cnfn round(double4 x); double8 __ovld __cnfn round(double8 x); double16 __ovld __cnfn round(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn round(half x); half2 __ovld __cnfn round(half2 x); half3 __ovld __cnfn round(half3 x); half4 __ovld __cnfn round(half4 x); half8 __ovld __cnfn round(half8 x); half16 __ovld __cnfn round(half16 x); #endif //cl_khr_fp16 /** * Compute inverse square root. */ float __ovld __cnfn rsqrt(float); float2 __ovld __cnfn rsqrt(float2); float3 __ovld __cnfn rsqrt(float3); float4 __ovld __cnfn rsqrt(float4); float8 __ovld __cnfn rsqrt(float8); float16 __ovld __cnfn rsqrt(float16); #ifdef cl_khr_fp64 double __ovld __cnfn rsqrt(double); double2 __ovld __cnfn rsqrt(double2); double3 __ovld __cnfn rsqrt(double3); double4 __ovld __cnfn rsqrt(double4); double8 __ovld __cnfn rsqrt(double8); double16 __ovld __cnfn rsqrt(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn rsqrt(half); half2 __ovld __cnfn rsqrt(half2); half3 __ovld __cnfn rsqrt(half3); half4 __ovld __cnfn rsqrt(half4); half8 __ovld __cnfn rsqrt(half8); half16 __ovld __cnfn rsqrt(half16); #endif //cl_khr_fp16 /** * Compute sine. */ float __ovld __cnfn sin(float); float2 __ovld __cnfn sin(float2); float3 __ovld __cnfn sin(float3); float4 __ovld __cnfn sin(float4); float8 __ovld __cnfn sin(float8); float16 __ovld __cnfn sin(float16); #ifdef cl_khr_fp64 double __ovld __cnfn sin(double); double2 __ovld __cnfn sin(double2); double3 __ovld __cnfn sin(double3); double4 __ovld __cnfn sin(double4); double8 __ovld __cnfn sin(double8); double16 __ovld __cnfn sin(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn sin(half); half2 __ovld __cnfn sin(half2); half3 __ovld __cnfn sin(half3); half4 __ovld __cnfn sin(half4); half8 __ovld __cnfn sin(half8); half16 __ovld __cnfn sin(half16); #endif //cl_khr_fp16 /** * Compute sine and cosine of x. The computed sine * is the return value and computed cosine is returned * in cosval. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld sincos(float x, float *cosval); float2 __ovld sincos(float2 x, float2 *cosval); float3 __ovld sincos(float3 x, float3 *cosval); float4 __ovld sincos(float4 x, float4 *cosval); float8 __ovld sincos(float8 x, float8 *cosval); float16 __ovld sincos(float16 x, float16 *cosval); #ifdef cl_khr_fp64 double __ovld sincos(double x, double *cosval); double2 __ovld sincos(double2 x, double2 *cosval); double3 __ovld sincos(double3 x, double3 *cosval); double4 __ovld sincos(double4 x, double4 *cosval); double8 __ovld sincos(double8 x, double8 *cosval); double16 __ovld sincos(double16 x, double16 *cosval); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld sincos(half x, half *cosval); half2 __ovld sincos(half2 x, half2 *cosval); half3 __ovld sincos(half3 x, half3 *cosval); half4 __ovld sincos(half4 x, half4 *cosval); half8 __ovld sincos(half8 x, half8 *cosval); half16 __ovld sincos(half16 x, half16 *cosval); #endif //cl_khr_fp16 #else float __ovld sincos(float x, __global float *cosval); float2 __ovld sincos(float2 x, __global float2 *cosval); float3 __ovld sincos(float3 x, __global float3 *cosval); float4 __ovld sincos(float4 x, __global float4 *cosval); float8 __ovld sincos(float8 x, __global float8 *cosval); float16 __ovld sincos(float16 x, __global float16 *cosval); float __ovld sincos(float x, __local float *cosval); float2 __ovld sincos(float2 x, __local float2 *cosval); float3 __ovld sincos(float3 x, __local float3 *cosval); float4 __ovld sincos(float4 x, __local float4 *cosval); float8 __ovld sincos(float8 x, __local float8 *cosval); float16 __ovld sincos(float16 x, __local float16 *cosval); float __ovld sincos(float x, __private float *cosval); float2 __ovld sincos(float2 x, __private float2 *cosval); float3 __ovld sincos(float3 x, __private float3 *cosval); float4 __ovld sincos(float4 x, __private float4 *cosval); float8 __ovld sincos(float8 x, __private float8 *cosval); float16 __ovld sincos(float16 x, __private float16 *cosval); #ifdef cl_khr_fp64 double __ovld sincos(double x, __global double *cosval); double2 __ovld sincos(double2 x, __global double2 *cosval); double3 __ovld sincos(double3 x, __global double3 *cosval); double4 __ovld sincos(double4 x, __global double4 *cosval); double8 __ovld sincos(double8 x, __global double8 *cosval); double16 __ovld sincos(double16 x, __global double16 *cosval); double __ovld sincos(double x, __local double *cosval); double2 __ovld sincos(double2 x, __local double2 *cosval); double3 __ovld sincos(double3 x, __local double3 *cosval); double4 __ovld sincos(double4 x, __local double4 *cosval); double8 __ovld sincos(double8 x, __local double8 *cosval); double16 __ovld sincos(double16 x, __local double16 *cosval); double __ovld sincos(double x, __private double *cosval); double2 __ovld sincos(double2 x, __private double2 *cosval); double3 __ovld sincos(double3 x, __private double3 *cosval); double4 __ovld sincos(double4 x, __private double4 *cosval); double8 __ovld sincos(double8 x, __private double8 *cosval); double16 __ovld sincos(double16 x, __private double16 *cosval); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld sincos(half x, __global half *cosval); half2 __ovld sincos(half2 x, __global half2 *cosval); half3 __ovld sincos(half3 x, __global half3 *cosval); half4 __ovld sincos(half4 x, __global half4 *cosval); half8 __ovld sincos(half8 x, __global half8 *cosval); half16 __ovld sincos(half16 x, __global half16 *cosval); half __ovld sincos(half x, __local half *cosval); half2 __ovld sincos(half2 x, __local half2 *cosval); half3 __ovld sincos(half3 x, __local half3 *cosval); half4 __ovld sincos(half4 x, __local half4 *cosval); half8 __ovld sincos(half8 x, __local half8 *cosval); half16 __ovld sincos(half16 x, __local half16 *cosval); half __ovld sincos(half x, __private half *cosval); half2 __ovld sincos(half2 x, __private half2 *cosval); half3 __ovld sincos(half3 x, __private half3 *cosval); half4 __ovld sincos(half4 x, __private half4 *cosval); half8 __ovld sincos(half8 x, __private half8 *cosval); half16 __ovld sincos(half16 x, __private half16 *cosval); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Compute hyperbolic sine. */ float __ovld __cnfn sinh(float); float2 __ovld __cnfn sinh(float2); float3 __ovld __cnfn sinh(float3); float4 __ovld __cnfn sinh(float4); float8 __ovld __cnfn sinh(float8); float16 __ovld __cnfn sinh(float16); #ifdef cl_khr_fp64 double __ovld __cnfn sinh(double); double2 __ovld __cnfn sinh(double2); double3 __ovld __cnfn sinh(double3); double4 __ovld __cnfn sinh(double4); double8 __ovld __cnfn sinh(double8); double16 __ovld __cnfn sinh(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn sinh(half); half2 __ovld __cnfn sinh(half2); half3 __ovld __cnfn sinh(half3); half4 __ovld __cnfn sinh(half4); half8 __ovld __cnfn sinh(half8); half16 __ovld __cnfn sinh(half16); #endif //cl_khr_fp16 /** * Compute sin (PI * x). */ float __ovld __cnfn sinpi(float x); float2 __ovld __cnfn sinpi(float2 x); float3 __ovld __cnfn sinpi(float3 x); float4 __ovld __cnfn sinpi(float4 x); float8 __ovld __cnfn sinpi(float8 x); float16 __ovld __cnfn sinpi(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn sinpi(double x); double2 __ovld __cnfn sinpi(double2 x); double3 __ovld __cnfn sinpi(double3 x); double4 __ovld __cnfn sinpi(double4 x); double8 __ovld __cnfn sinpi(double8 x); double16 __ovld __cnfn sinpi(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn sinpi(half x); half2 __ovld __cnfn sinpi(half2 x); half3 __ovld __cnfn sinpi(half3 x); half4 __ovld __cnfn sinpi(half4 x); half8 __ovld __cnfn sinpi(half8 x); half16 __ovld __cnfn sinpi(half16 x); #endif //cl_khr_fp16 /** * Compute square root. */ float __ovld __cnfn sqrt(float); float2 __ovld __cnfn sqrt(float2); float3 __ovld __cnfn sqrt(float3); float4 __ovld __cnfn sqrt(float4); float8 __ovld __cnfn sqrt(float8); float16 __ovld __cnfn sqrt(float16); #ifdef cl_khr_fp64 double __ovld __cnfn sqrt(double); double2 __ovld __cnfn sqrt(double2); double3 __ovld __cnfn sqrt(double3); double4 __ovld __cnfn sqrt(double4); double8 __ovld __cnfn sqrt(double8); double16 __ovld __cnfn sqrt(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn sqrt(half); half2 __ovld __cnfn sqrt(half2); half3 __ovld __cnfn sqrt(half3); half4 __ovld __cnfn sqrt(half4); half8 __ovld __cnfn sqrt(half8); half16 __ovld __cnfn sqrt(half16); #endif //cl_khr_fp16 /** * Compute tangent. */ float __ovld __cnfn tan(float); float2 __ovld __cnfn tan(float2); float3 __ovld __cnfn tan(float3); float4 __ovld __cnfn tan(float4); float8 __ovld __cnfn tan(float8); float16 __ovld __cnfn tan(float16); #ifdef cl_khr_fp64 double __ovld __cnfn tan(double); double2 __ovld __cnfn tan(double2); double3 __ovld __cnfn tan(double3); double4 __ovld __cnfn tan(double4); double8 __ovld __cnfn tan(double8); double16 __ovld __cnfn tan(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn tan(half); half2 __ovld __cnfn tan(half2); half3 __ovld __cnfn tan(half3); half4 __ovld __cnfn tan(half4); half8 __ovld __cnfn tan(half8); half16 __ovld __cnfn tan(half16); #endif //cl_khr_fp16 /** * Compute hyperbolic tangent. */ float __ovld __cnfn tanh(float); float2 __ovld __cnfn tanh(float2); float3 __ovld __cnfn tanh(float3); float4 __ovld __cnfn tanh(float4); float8 __ovld __cnfn tanh(float8); float16 __ovld __cnfn tanh(float16); #ifdef cl_khr_fp64 double __ovld __cnfn tanh(double); double2 __ovld __cnfn tanh(double2); double3 __ovld __cnfn tanh(double3); double4 __ovld __cnfn tanh(double4); double8 __ovld __cnfn tanh(double8); double16 __ovld __cnfn tanh(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn tanh(half); half2 __ovld __cnfn tanh(half2); half3 __ovld __cnfn tanh(half3); half4 __ovld __cnfn tanh(half4); half8 __ovld __cnfn tanh(half8); half16 __ovld __cnfn tanh(half16); #endif //cl_khr_fp16 /** * Compute tan (PI * x). */ float __ovld __cnfn tanpi(float x); float2 __ovld __cnfn tanpi(float2 x); float3 __ovld __cnfn tanpi(float3 x); float4 __ovld __cnfn tanpi(float4 x); float8 __ovld __cnfn tanpi(float8 x); float16 __ovld __cnfn tanpi(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn tanpi(double x); double2 __ovld __cnfn tanpi(double2 x); double3 __ovld __cnfn tanpi(double3 x); double4 __ovld __cnfn tanpi(double4 x); double8 __ovld __cnfn tanpi(double8 x); double16 __ovld __cnfn tanpi(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn tanpi(half x); half2 __ovld __cnfn tanpi(half2 x); half3 __ovld __cnfn tanpi(half3 x); half4 __ovld __cnfn tanpi(half4 x); half8 __ovld __cnfn tanpi(half8 x); half16 __ovld __cnfn tanpi(half16 x); #endif //cl_khr_fp16 /** * Compute the gamma function. */ float __ovld __cnfn tgamma(float); float2 __ovld __cnfn tgamma(float2); float3 __ovld __cnfn tgamma(float3); float4 __ovld __cnfn tgamma(float4); float8 __ovld __cnfn tgamma(float8); float16 __ovld __cnfn tgamma(float16); #ifdef cl_khr_fp64 double __ovld __cnfn tgamma(double); double2 __ovld __cnfn tgamma(double2); double3 __ovld __cnfn tgamma(double3); double4 __ovld __cnfn tgamma(double4); double8 __ovld __cnfn tgamma(double8); double16 __ovld __cnfn tgamma(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn tgamma(half); half2 __ovld __cnfn tgamma(half2); half3 __ovld __cnfn tgamma(half3); half4 __ovld __cnfn tgamma(half4); half8 __ovld __cnfn tgamma(half8); half16 __ovld __cnfn tgamma(half16); #endif //cl_khr_fp16 /** * Round to integral value using the round to zero * rounding mode. */ float __ovld __cnfn trunc(float); float2 __ovld __cnfn trunc(float2); float3 __ovld __cnfn trunc(float3); float4 __ovld __cnfn trunc(float4); float8 __ovld __cnfn trunc(float8); float16 __ovld __cnfn trunc(float16); #ifdef cl_khr_fp64 double __ovld __cnfn trunc(double); double2 __ovld __cnfn trunc(double2); double3 __ovld __cnfn trunc(double3); double4 __ovld __cnfn trunc(double4); double8 __ovld __cnfn trunc(double8); double16 __ovld __cnfn trunc(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn trunc(half); half2 __ovld __cnfn trunc(half2); half3 __ovld __cnfn trunc(half3); half4 __ovld __cnfn trunc(half4); half8 __ovld __cnfn trunc(half8); half16 __ovld __cnfn trunc(half16); #endif //cl_khr_fp16 /** * Compute cosine. x must be in the range -2^16 ... +2^16. */ float __ovld __cnfn half_cos(float x); float2 __ovld __cnfn half_cos(float2 x); float3 __ovld __cnfn half_cos(float3 x); float4 __ovld __cnfn half_cos(float4 x); float8 __ovld __cnfn half_cos(float8 x); float16 __ovld __cnfn half_cos(float16 x); /** * Compute x / y. */ float __ovld __cnfn half_divide(float x, float y); float2 __ovld __cnfn half_divide(float2 x, float2 y); float3 __ovld __cnfn half_divide(float3 x, float3 y); float4 __ovld __cnfn half_divide(float4 x, float4 y); float8 __ovld __cnfn half_divide(float8 x, float8 y); float16 __ovld __cnfn half_divide(float16 x, float16 y); /** * Compute the base- e exponential of x. */ float __ovld __cnfn half_exp(float x); float2 __ovld __cnfn half_exp(float2 x); float3 __ovld __cnfn half_exp(float3 x); float4 __ovld __cnfn half_exp(float4 x); float8 __ovld __cnfn half_exp(float8 x); float16 __ovld __cnfn half_exp(float16 x); /** * Compute the base- 2 exponential of x. */ float __ovld __cnfn half_exp2(float x); float2 __ovld __cnfn half_exp2(float2 x); float3 __ovld __cnfn half_exp2(float3 x); float4 __ovld __cnfn half_exp2(float4 x); float8 __ovld __cnfn half_exp2(float8 x); float16 __ovld __cnfn half_exp2(float16 x); /** * Compute the base- 10 exponential of x. */ float __ovld __cnfn half_exp10(float x); float2 __ovld __cnfn half_exp10(float2 x); float3 __ovld __cnfn half_exp10(float3 x); float4 __ovld __cnfn half_exp10(float4 x); float8 __ovld __cnfn half_exp10(float8 x); float16 __ovld __cnfn half_exp10(float16 x); /** * Compute natural logarithm. */ float __ovld __cnfn half_log(float x); float2 __ovld __cnfn half_log(float2 x); float3 __ovld __cnfn half_log(float3 x); float4 __ovld __cnfn half_log(float4 x); float8 __ovld __cnfn half_log(float8 x); float16 __ovld __cnfn half_log(float16 x); /** * Compute a base 2 logarithm. */ float __ovld __cnfn half_log2(float x); float2 __ovld __cnfn half_log2(float2 x); float3 __ovld __cnfn half_log2(float3 x); float4 __ovld __cnfn half_log2(float4 x); float8 __ovld __cnfn half_log2(float8 x); float16 __ovld __cnfn half_log2(float16 x); /** * Compute a base 10 logarithm. */ float __ovld __cnfn half_log10(float x); float2 __ovld __cnfn half_log10(float2 x); float3 __ovld __cnfn half_log10(float3 x); float4 __ovld __cnfn half_log10(float4 x); float8 __ovld __cnfn half_log10(float8 x); float16 __ovld __cnfn half_log10(float16 x); /** * Compute x to the power y, where x is >= 0. */ float __ovld __cnfn half_powr(float x, float y); float2 __ovld __cnfn half_powr(float2 x, float2 y); float3 __ovld __cnfn half_powr(float3 x, float3 y); float4 __ovld __cnfn half_powr(float4 x, float4 y); float8 __ovld __cnfn half_powr(float8 x, float8 y); float16 __ovld __cnfn half_powr(float16 x, float16 y); /** * Compute reciprocal. */ float __ovld __cnfn half_recip(float x); float2 __ovld __cnfn half_recip(float2 x); float3 __ovld __cnfn half_recip(float3 x); float4 __ovld __cnfn half_recip(float4 x); float8 __ovld __cnfn half_recip(float8 x); float16 __ovld __cnfn half_recip(float16 x); /** * Compute inverse square root. */ float __ovld __cnfn half_rsqrt(float x); float2 __ovld __cnfn half_rsqrt(float2 x); float3 __ovld __cnfn half_rsqrt(float3 x); float4 __ovld __cnfn half_rsqrt(float4 x); float8 __ovld __cnfn half_rsqrt(float8 x); float16 __ovld __cnfn half_rsqrt(float16 x); /** * Compute sine. x must be in the range -2^16 ... +2^16. */ float __ovld __cnfn half_sin(float x); float2 __ovld __cnfn half_sin(float2 x); float3 __ovld __cnfn half_sin(float3 x); float4 __ovld __cnfn half_sin(float4 x); float8 __ovld __cnfn half_sin(float8 x); float16 __ovld __cnfn half_sin(float16 x); /** * Compute square root. */ float __ovld __cnfn half_sqrt(float x); float2 __ovld __cnfn half_sqrt(float2 x); float3 __ovld __cnfn half_sqrt(float3 x); float4 __ovld __cnfn half_sqrt(float4 x); float8 __ovld __cnfn half_sqrt(float8 x); float16 __ovld __cnfn half_sqrt(float16 x); /** * Compute tangent. x must be in the range -216 ... +216. */ float __ovld __cnfn half_tan(float x); float2 __ovld __cnfn half_tan(float2 x); float3 __ovld __cnfn half_tan(float3 x); float4 __ovld __cnfn half_tan(float4 x); float8 __ovld __cnfn half_tan(float8 x); float16 __ovld __cnfn half_tan(float16 x); /** * Compute cosine over an implementation-defined range. * The maximum error is implementation-defined. */ float __ovld __cnfn native_cos(float x); float2 __ovld __cnfn native_cos(float2 x); float3 __ovld __cnfn native_cos(float3 x); float4 __ovld __cnfn native_cos(float4 x); float8 __ovld __cnfn native_cos(float8 x); float16 __ovld __cnfn native_cos(float16 x); /** * Compute x / y over an implementation-defined range. * The maximum error is implementation-defined. */ float __ovld __cnfn native_divide(float x, float y); float2 __ovld __cnfn native_divide(float2 x, float2 y); float3 __ovld __cnfn native_divide(float3 x, float3 y); float4 __ovld __cnfn native_divide(float4 x, float4 y); float8 __ovld __cnfn native_divide(float8 x, float8 y); float16 __ovld __cnfn native_divide(float16 x, float16 y); /** * Compute the base- e exponential of x over an * implementation-defined range. The maximum error is * implementation-defined. */ float __ovld __cnfn native_exp(float x); float2 __ovld __cnfn native_exp(float2 x); float3 __ovld __cnfn native_exp(float3 x); float4 __ovld __cnfn native_exp(float4 x); float8 __ovld __cnfn native_exp(float8 x); float16 __ovld __cnfn native_exp(float16 x); /** * Compute the base- 2 exponential of x over an * implementation-defined range. The maximum error is * implementation-defined. */ float __ovld __cnfn native_exp2(float x); float2 __ovld __cnfn native_exp2(float2 x); float3 __ovld __cnfn native_exp2(float3 x); float4 __ovld __cnfn native_exp2(float4 x); float8 __ovld __cnfn native_exp2(float8 x); float16 __ovld __cnfn native_exp2(float16 x); /** * Compute the base- 10 exponential of x over an * implementation-defined range. The maximum error is * implementation-defined. */ float __ovld __cnfn native_exp10(float x); float2 __ovld __cnfn native_exp10(float2 x); float3 __ovld __cnfn native_exp10(float3 x); float4 __ovld __cnfn native_exp10(float4 x); float8 __ovld __cnfn native_exp10(float8 x); float16 __ovld __cnfn native_exp10(float16 x); /** * Compute natural logarithm over an implementationdefined * range. The maximum error is implementation * defined. */ float __ovld __cnfn native_log(float x); float2 __ovld __cnfn native_log(float2 x); float3 __ovld __cnfn native_log(float3 x); float4 __ovld __cnfn native_log(float4 x); float8 __ovld __cnfn native_log(float8 x); float16 __ovld __cnfn native_log(float16 x); /** * Compute a base 2 logarithm over an implementationdefined * range. The maximum error is implementationdefined. */ float __ovld __cnfn native_log2(float x); float2 __ovld __cnfn native_log2(float2 x); float3 __ovld __cnfn native_log2(float3 x); float4 __ovld __cnfn native_log2(float4 x); float8 __ovld __cnfn native_log2(float8 x); float16 __ovld __cnfn native_log2(float16 x); /** * Compute a base 10 logarithm over an implementationdefined * range. The maximum error is implementationdefined. */ float __ovld __cnfn native_log10(float x); float2 __ovld __cnfn native_log10(float2 x); float3 __ovld __cnfn native_log10(float3 x); float4 __ovld __cnfn native_log10(float4 x); float8 __ovld __cnfn native_log10(float8 x); float16 __ovld __cnfn native_log10(float16 x); /** * Compute x to the power y, where x is >= 0. The range of * x and y are implementation-defined. The maximum error * is implementation-defined. */ float __ovld __cnfn native_powr(float x, float y); float2 __ovld __cnfn native_powr(float2 x, float2 y); float3 __ovld __cnfn native_powr(float3 x, float3 y); float4 __ovld __cnfn native_powr(float4 x, float4 y); float8 __ovld __cnfn native_powr(float8 x, float8 y); float16 __ovld __cnfn native_powr(float16 x, float16 y); /** * Compute reciprocal over an implementation-defined * range. The maximum error is implementation-defined. */ float __ovld __cnfn native_recip(float x); float2 __ovld __cnfn native_recip(float2 x); float3 __ovld __cnfn native_recip(float3 x); float4 __ovld __cnfn native_recip(float4 x); float8 __ovld __cnfn native_recip(float8 x); float16 __ovld __cnfn native_recip(float16 x); /** * Compute inverse square root over an implementationdefined * range. The maximum error is implementationdefined. */ float __ovld __cnfn native_rsqrt(float x); float2 __ovld __cnfn native_rsqrt(float2 x); float3 __ovld __cnfn native_rsqrt(float3 x); float4 __ovld __cnfn native_rsqrt(float4 x); float8 __ovld __cnfn native_rsqrt(float8 x); float16 __ovld __cnfn native_rsqrt(float16 x); /** * Compute sine over an implementation-defined range. * The maximum error is implementation-defined. */ float __ovld __cnfn native_sin(float x); float2 __ovld __cnfn native_sin(float2 x); float3 __ovld __cnfn native_sin(float3 x); float4 __ovld __cnfn native_sin(float4 x); float8 __ovld __cnfn native_sin(float8 x); float16 __ovld __cnfn native_sin(float16 x); /** * Compute square root over an implementation-defined * range. The maximum error is implementation-defined. */ float __ovld __cnfn native_sqrt(float x); float2 __ovld __cnfn native_sqrt(float2 x); float3 __ovld __cnfn native_sqrt(float3 x); float4 __ovld __cnfn native_sqrt(float4 x); float8 __ovld __cnfn native_sqrt(float8 x); float16 __ovld __cnfn native_sqrt(float16 x); /** * Compute tangent over an implementation-defined range. * The maximum error is implementation-defined. */ float __ovld __cnfn native_tan(float x); float2 __ovld __cnfn native_tan(float2 x); float3 __ovld __cnfn native_tan(float3 x); float4 __ovld __cnfn native_tan(float4 x); float8 __ovld __cnfn native_tan(float8 x); float16 __ovld __cnfn native_tan(float16 x); // OpenCL v1.1 s6.11.3, v1.2 s6.12.3, v2.0 s6.13.3 - Integer Functions /** * Returns | x |. */ uchar __ovld __cnfn abs(char x); uchar __ovld __cnfn abs(uchar x); uchar2 __ovld __cnfn abs(char2 x); uchar2 __ovld __cnfn abs(uchar2 x); uchar3 __ovld __cnfn abs(char3 x); uchar3 __ovld __cnfn abs(uchar3 x); uchar4 __ovld __cnfn abs(char4 x); uchar4 __ovld __cnfn abs(uchar4 x); uchar8 __ovld __cnfn abs(char8 x); uchar8 __ovld __cnfn abs(uchar8 x); uchar16 __ovld __cnfn abs(char16 x); uchar16 __ovld __cnfn abs(uchar16 x); ushort __ovld __cnfn abs(short x); ushort __ovld __cnfn abs(ushort x); ushort2 __ovld __cnfn abs(short2 x); ushort2 __ovld __cnfn abs(ushort2 x); ushort3 __ovld __cnfn abs(short3 x); ushort3 __ovld __cnfn abs(ushort3 x); ushort4 __ovld __cnfn abs(short4 x); ushort4 __ovld __cnfn abs(ushort4 x); ushort8 __ovld __cnfn abs(short8 x); ushort8 __ovld __cnfn abs(ushort8 x); ushort16 __ovld __cnfn abs(short16 x); ushort16 __ovld __cnfn abs(ushort16 x); uint __ovld __cnfn abs(int x); uint __ovld __cnfn abs(uint x); uint2 __ovld __cnfn abs(int2 x); uint2 __ovld __cnfn abs(uint2 x); uint3 __ovld __cnfn abs(int3 x); uint3 __ovld __cnfn abs(uint3 x); uint4 __ovld __cnfn abs(int4 x); uint4 __ovld __cnfn abs(uint4 x); uint8 __ovld __cnfn abs(int8 x); uint8 __ovld __cnfn abs(uint8 x); uint16 __ovld __cnfn abs(int16 x); uint16 __ovld __cnfn abs(uint16 x); ulong __ovld __cnfn abs(long x); ulong __ovld __cnfn abs(ulong x); ulong2 __ovld __cnfn abs(long2 x); ulong2 __ovld __cnfn abs(ulong2 x); ulong3 __ovld __cnfn abs(long3 x); ulong3 __ovld __cnfn abs(ulong3 x); ulong4 __ovld __cnfn abs(long4 x); ulong4 __ovld __cnfn abs(ulong4 x); ulong8 __ovld __cnfn abs(long8 x); ulong8 __ovld __cnfn abs(ulong8 x); ulong16 __ovld __cnfn abs(long16 x); ulong16 __ovld __cnfn abs(ulong16 x); /** * Returns | x - y | without modulo overflow. */ uchar __ovld __cnfn abs_diff(char x, char y); uchar __ovld __cnfn abs_diff(uchar x, uchar y); uchar2 __ovld __cnfn abs_diff(char2 x, char2 y); uchar2 __ovld __cnfn abs_diff(uchar2 x, uchar2 y); uchar3 __ovld __cnfn abs_diff(char3 x, char3 y); uchar3 __ovld __cnfn abs_diff(uchar3 x, uchar3 y); uchar4 __ovld __cnfn abs_diff(char4 x, char4 y); uchar4 __ovld __cnfn abs_diff(uchar4 x, uchar4 y); uchar8 __ovld __cnfn abs_diff(char8 x, char8 y); uchar8 __ovld __cnfn abs_diff(uchar8 x, uchar8 y); uchar16 __ovld __cnfn abs_diff(char16 x, char16 y); uchar16 __ovld __cnfn abs_diff(uchar16 x, uchar16 y); ushort __ovld __cnfn abs_diff(short x, short y); ushort __ovld __cnfn abs_diff(ushort x, ushort y); ushort2 __ovld __cnfn abs_diff(short2 x, short2 y); ushort2 __ovld __cnfn abs_diff(ushort2 x, ushort2 y); ushort3 __ovld __cnfn abs_diff(short3 x, short3 y); ushort3 __ovld __cnfn abs_diff(ushort3 x, ushort3 y); ushort4 __ovld __cnfn abs_diff(short4 x, short4 y); ushort4 __ovld __cnfn abs_diff(ushort4 x, ushort4 y); ushort8 __ovld __cnfn abs_diff(short8 x, short8 y); ushort8 __ovld __cnfn abs_diff(ushort8 x, ushort8 y); ushort16 __ovld __cnfn abs_diff(short16 x, short16 y); ushort16 __ovld __cnfn abs_diff(ushort16 x, ushort16 y); uint __ovld __cnfn abs_diff(int x, int y); uint __ovld __cnfn abs_diff(uint x, uint y); uint2 __ovld __cnfn abs_diff(int2 x, int2 y); uint2 __ovld __cnfn abs_diff(uint2 x, uint2 y); uint3 __ovld __cnfn abs_diff(int3 x, int3 y); uint3 __ovld __cnfn abs_diff(uint3 x, uint3 y); uint4 __ovld __cnfn abs_diff(int4 x, int4 y); uint4 __ovld __cnfn abs_diff(uint4 x, uint4 y); uint8 __ovld __cnfn abs_diff(int8 x, int8 y); uint8 __ovld __cnfn abs_diff(uint8 x, uint8 y); uint16 __ovld __cnfn abs_diff(int16 x, int16 y); uint16 __ovld __cnfn abs_diff(uint16 x, uint16 y); ulong __ovld __cnfn abs_diff(long x, long y); ulong __ovld __cnfn abs_diff(ulong x, ulong y); ulong2 __ovld __cnfn abs_diff(long2 x, long2 y); ulong2 __ovld __cnfn abs_diff(ulong2 x, ulong2 y); ulong3 __ovld __cnfn abs_diff(long3 x, long3 y); ulong3 __ovld __cnfn abs_diff(ulong3 x, ulong3 y); ulong4 __ovld __cnfn abs_diff(long4 x, long4 y); ulong4 __ovld __cnfn abs_diff(ulong4 x, ulong4 y); ulong8 __ovld __cnfn abs_diff(long8 x, long8 y); ulong8 __ovld __cnfn abs_diff(ulong8 x, ulong8 y); ulong16 __ovld __cnfn abs_diff(long16 x, long16 y); ulong16 __ovld __cnfn abs_diff(ulong16 x, ulong16 y); /** * Returns x + y and saturates the result. */ char __ovld __cnfn add_sat(char x, char y); uchar __ovld __cnfn add_sat(uchar x, uchar y); char2 __ovld __cnfn add_sat(char2 x, char2 y); uchar2 __ovld __cnfn add_sat(uchar2 x, uchar2 y); char3 __ovld __cnfn add_sat(char3 x, char3 y); uchar3 __ovld __cnfn add_sat(uchar3 x, uchar3 y); char4 __ovld __cnfn add_sat(char4 x, char4 y); uchar4 __ovld __cnfn add_sat(uchar4 x, uchar4 y); char8 __ovld __cnfn add_sat(char8 x, char8 y); uchar8 __ovld __cnfn add_sat(uchar8 x, uchar8 y); char16 __ovld __cnfn add_sat(char16 x, char16 y); uchar16 __ovld __cnfn add_sat(uchar16 x, uchar16 y); short __ovld __cnfn add_sat(short x, short y); ushort __ovld __cnfn add_sat(ushort x, ushort y); short2 __ovld __cnfn add_sat(short2 x, short2 y); ushort2 __ovld __cnfn add_sat(ushort2 x, ushort2 y); short3 __ovld __cnfn add_sat(short3 x, short3 y); ushort3 __ovld __cnfn add_sat(ushort3 x, ushort3 y); short4 __ovld __cnfn add_sat(short4 x, short4 y); ushort4 __ovld __cnfn add_sat(ushort4 x, ushort4 y); short8 __ovld __cnfn add_sat(short8 x, short8 y); ushort8 __ovld __cnfn add_sat(ushort8 x, ushort8 y); short16 __ovld __cnfn add_sat(short16 x, short16 y); ushort16 __ovld __cnfn add_sat(ushort16 x, ushort16 y); int __ovld __cnfn add_sat(int x, int y); uint __ovld __cnfn add_sat(uint x, uint y); int2 __ovld __cnfn add_sat(int2 x, int2 y); uint2 __ovld __cnfn add_sat(uint2 x, uint2 y); int3 __ovld __cnfn add_sat(int3 x, int3 y); uint3 __ovld __cnfn add_sat(uint3 x, uint3 y); int4 __ovld __cnfn add_sat(int4 x, int4 y); uint4 __ovld __cnfn add_sat(uint4 x, uint4 y); int8 __ovld __cnfn add_sat(int8 x, int8 y); uint8 __ovld __cnfn add_sat(uint8 x, uint8 y); int16 __ovld __cnfn add_sat(int16 x, int16 y); uint16 __ovld __cnfn add_sat(uint16 x, uint16 y); long __ovld __cnfn add_sat(long x, long y); ulong __ovld __cnfn add_sat(ulong x, ulong y); long2 __ovld __cnfn add_sat(long2 x, long2 y); ulong2 __ovld __cnfn add_sat(ulong2 x, ulong2 y); long3 __ovld __cnfn add_sat(long3 x, long3 y); ulong3 __ovld __cnfn add_sat(ulong3 x, ulong3 y); long4 __ovld __cnfn add_sat(long4 x, long4 y); ulong4 __ovld __cnfn add_sat(ulong4 x, ulong4 y); long8 __ovld __cnfn add_sat(long8 x, long8 y); ulong8 __ovld __cnfn add_sat(ulong8 x, ulong8 y); long16 __ovld __cnfn add_sat(long16 x, long16 y); ulong16 __ovld __cnfn add_sat(ulong16 x, ulong16 y); /** * Returns (x + y) >> 1. The intermediate sum does * not modulo overflow. */ char __ovld __cnfn hadd(char x, char y); uchar __ovld __cnfn hadd(uchar x, uchar y); char2 __ovld __cnfn hadd(char2 x, char2 y); uchar2 __ovld __cnfn hadd(uchar2 x, uchar2 y); char3 __ovld __cnfn hadd(char3 x, char3 y); uchar3 __ovld __cnfn hadd(uchar3 x, uchar3 y); char4 __ovld __cnfn hadd(char4 x, char4 y); uchar4 __ovld __cnfn hadd(uchar4 x, uchar4 y); char8 __ovld __cnfn hadd(char8 x, char8 y); uchar8 __ovld __cnfn hadd(uchar8 x, uchar8 y); char16 __ovld __cnfn hadd(char16 x, char16 y); uchar16 __ovld __cnfn hadd(uchar16 x, uchar16 y); short __ovld __cnfn hadd(short x, short y); ushort __ovld __cnfn hadd(ushort x, ushort y); short2 __ovld __cnfn hadd(short2 x, short2 y); ushort2 __ovld __cnfn hadd(ushort2 x, ushort2 y); short3 __ovld __cnfn hadd(short3 x, short3 y); ushort3 __ovld __cnfn hadd(ushort3 x, ushort3 y); short4 __ovld __cnfn hadd(short4 x, short4 y); ushort4 __ovld __cnfn hadd(ushort4 x, ushort4 y); short8 __ovld __cnfn hadd(short8 x, short8 y); ushort8 __ovld __cnfn hadd(ushort8 x, ushort8 y); short16 __ovld __cnfn hadd(short16 x, short16 y); ushort16 __ovld __cnfn hadd(ushort16 x, ushort16 y); int __ovld __cnfn hadd(int x, int y); uint __ovld __cnfn hadd(uint x, uint y); int2 __ovld __cnfn hadd(int2 x, int2 y); uint2 __ovld __cnfn hadd(uint2 x, uint2 y); int3 __ovld __cnfn hadd(int3 x, int3 y); uint3 __ovld __cnfn hadd(uint3 x, uint3 y); int4 __ovld __cnfn hadd(int4 x, int4 y); uint4 __ovld __cnfn hadd(uint4 x, uint4 y); int8 __ovld __cnfn hadd(int8 x, int8 y); uint8 __ovld __cnfn hadd(uint8 x, uint8 y); int16 __ovld __cnfn hadd(int16 x, int16 y); uint16 __ovld __cnfn hadd(uint16 x, uint16 y); long __ovld __cnfn hadd(long x, long y); ulong __ovld __cnfn hadd(ulong x, ulong y); long2 __ovld __cnfn hadd(long2 x, long2 y); ulong2 __ovld __cnfn hadd(ulong2 x, ulong2 y); long3 __ovld __cnfn hadd(long3 x, long3 y); ulong3 __ovld __cnfn hadd(ulong3 x, ulong3 y); long4 __ovld __cnfn hadd(long4 x, long4 y); ulong4 __ovld __cnfn hadd(ulong4 x, ulong4 y); long8 __ovld __cnfn hadd(long8 x, long8 y); ulong8 __ovld __cnfn hadd(ulong8 x, ulong8 y); long16 __ovld __cnfn hadd(long16 x, long16 y); ulong16 __ovld __cnfn hadd(ulong16 x, ulong16 y); /** * Returns (x + y + 1) >> 1. The intermediate sum * does not modulo overflow. */ char __ovld __cnfn rhadd(char x, char y); uchar __ovld __cnfn rhadd(uchar x, uchar y); char2 __ovld __cnfn rhadd(char2 x, char2 y); uchar2 __ovld __cnfn rhadd(uchar2 x, uchar2 y); char3 __ovld __cnfn rhadd(char3 x, char3 y); uchar3 __ovld __cnfn rhadd(uchar3 x, uchar3 y); char4 __ovld __cnfn rhadd(char4 x, char4 y); uchar4 __ovld __cnfn rhadd(uchar4 x, uchar4 y); char8 __ovld __cnfn rhadd(char8 x, char8 y); uchar8 __ovld __cnfn rhadd(uchar8 x, uchar8 y); char16 __ovld __cnfn rhadd(char16 x, char16 y); uchar16 __ovld __cnfn rhadd(uchar16 x, uchar16 y); short __ovld __cnfn rhadd(short x, short y); ushort __ovld __cnfn rhadd(ushort x, ushort y); short2 __ovld __cnfn rhadd(short2 x, short2 y); ushort2 __ovld __cnfn rhadd(ushort2 x, ushort2 y); short3 __ovld __cnfn rhadd(short3 x, short3 y); ushort3 __ovld __cnfn rhadd(ushort3 x, ushort3 y); short4 __ovld __cnfn rhadd(short4 x, short4 y); ushort4 __ovld __cnfn rhadd(ushort4 x, ushort4 y); short8 __ovld __cnfn rhadd(short8 x, short8 y); ushort8 __ovld __cnfn rhadd(ushort8 x, ushort8 y); short16 __ovld __cnfn rhadd(short16 x, short16 y); ushort16 __ovld __cnfn rhadd(ushort16 x, ushort16 y); int __ovld __cnfn rhadd(int x, int y); uint __ovld __cnfn rhadd(uint x, uint y); int2 __ovld __cnfn rhadd(int2 x, int2 y); uint2 __ovld __cnfn rhadd(uint2 x, uint2 y); int3 __ovld __cnfn rhadd(int3 x, int3 y); uint3 __ovld __cnfn rhadd(uint3 x, uint3 y); int4 __ovld __cnfn rhadd(int4 x, int4 y); uint4 __ovld __cnfn rhadd(uint4 x, uint4 y); int8 __ovld __cnfn rhadd(int8 x, int8 y); uint8 __ovld __cnfn rhadd(uint8 x, uint8 y); int16 __ovld __cnfn rhadd(int16 x, int16 y); uint16 __ovld __cnfn rhadd(uint16 x, uint16 y); long __ovld __cnfn rhadd(long x, long y); ulong __ovld __cnfn rhadd(ulong x, ulong y); long2 __ovld __cnfn rhadd(long2 x, long2 y); ulong2 __ovld __cnfn rhadd(ulong2 x, ulong2 y); long3 __ovld __cnfn rhadd(long3 x, long3 y); ulong3 __ovld __cnfn rhadd(ulong3 x, ulong3 y); long4 __ovld __cnfn rhadd(long4 x, long4 y); ulong4 __ovld __cnfn rhadd(ulong4 x, ulong4 y); long8 __ovld __cnfn rhadd(long8 x, long8 y); ulong8 __ovld __cnfn rhadd(ulong8 x, ulong8 y); long16 __ovld __cnfn rhadd(long16 x, long16 y); ulong16 __ovld __cnfn rhadd(ulong16 x, ulong16 y); /** * Returns min(max(x, minval), maxval). * Results are undefined if minval > maxval. */ char __ovld __cnfn clamp(char x, char minval, char maxval); uchar __ovld __cnfn clamp(uchar x, uchar minval, uchar maxval); char2 __ovld __cnfn clamp(char2 x, char2 minval, char2 maxval); uchar2 __ovld __cnfn clamp(uchar2 x, uchar2 minval, uchar2 maxval); char3 __ovld __cnfn clamp(char3 x, char3 minval, char3 maxval); uchar3 __ovld __cnfn clamp(uchar3 x, uchar3 minval, uchar3 maxval); char4 __ovld __cnfn clamp(char4 x, char4 minval, char4 maxval); uchar4 __ovld __cnfn clamp(uchar4 x, uchar4 minval, uchar4 maxval); char8 __ovld __cnfn clamp(char8 x, char8 minval, char8 maxval); uchar8 __ovld __cnfn clamp(uchar8 x, uchar8 minval, uchar8 maxval); char16 __ovld __cnfn clamp(char16 x, char16 minval, char16 maxval); uchar16 __ovld __cnfn clamp(uchar16 x, uchar16 minval, uchar16 maxval); short __ovld __cnfn clamp(short x, short minval, short maxval); ushort __ovld __cnfn clamp(ushort x, ushort minval, ushort maxval); short2 __ovld __cnfn clamp(short2 x, short2 minval, short2 maxval); ushort2 __ovld __cnfn clamp(ushort2 x, ushort2 minval, ushort2 maxval); short3 __ovld __cnfn clamp(short3 x, short3 minval, short3 maxval); ushort3 __ovld __cnfn clamp(ushort3 x, ushort3 minval, ushort3 maxval); short4 __ovld __cnfn clamp(short4 x, short4 minval, short4 maxval); ushort4 __ovld __cnfn clamp(ushort4 x, ushort4 minval, ushort4 maxval); short8 __ovld __cnfn clamp(short8 x, short8 minval, short8 maxval); ushort8 __ovld __cnfn clamp(ushort8 x, ushort8 minval, ushort8 maxval); short16 __ovld __cnfn clamp(short16 x, short16 minval, short16 maxval); ushort16 __ovld __cnfn clamp(ushort16 x, ushort16 minval, ushort16 maxval); int __ovld __cnfn clamp(int x, int minval, int maxval); uint __ovld __cnfn clamp(uint x, uint minval, uint maxval); int2 __ovld __cnfn clamp(int2 x, int2 minval, int2 maxval); uint2 __ovld __cnfn clamp(uint2 x, uint2 minval, uint2 maxval); int3 __ovld __cnfn clamp(int3 x, int3 minval, int3 maxval); uint3 __ovld __cnfn clamp(uint3 x, uint3 minval, uint3 maxval); int4 __ovld __cnfn clamp(int4 x, int4 minval, int4 maxval); uint4 __ovld __cnfn clamp(uint4 x, uint4 minval, uint4 maxval); int8 __ovld __cnfn clamp(int8 x, int8 minval, int8 maxval); uint8 __ovld __cnfn clamp(uint8 x, uint8 minval, uint8 maxval); int16 __ovld __cnfn clamp(int16 x, int16 minval, int16 maxval); uint16 __ovld __cnfn clamp(uint16 x, uint16 minval, uint16 maxval); long __ovld __cnfn clamp(long x, long minval, long maxval); ulong __ovld __cnfn clamp(ulong x, ulong minval, ulong maxval); long2 __ovld __cnfn clamp(long2 x, long2 minval, long2 maxval); ulong2 __ovld __cnfn clamp(ulong2 x, ulong2 minval, ulong2 maxval); long3 __ovld __cnfn clamp(long3 x, long3 minval, long3 maxval); ulong3 __ovld __cnfn clamp(ulong3 x, ulong3 minval, ulong3 maxval); long4 __ovld __cnfn clamp(long4 x, long4 minval, long4 maxval); ulong4 __ovld __cnfn clamp(ulong4 x, ulong4 minval, ulong4 maxval); long8 __ovld __cnfn clamp(long8 x, long8 minval, long8 maxval); ulong8 __ovld __cnfn clamp(ulong8 x, ulong8 minval, ulong8 maxval); long16 __ovld __cnfn clamp(long16 x, long16 minval, long16 maxval); ulong16 __ovld __cnfn clamp(ulong16 x, ulong16 minval, ulong16 maxval); char2 __ovld __cnfn clamp(char2 x, char minval, char maxval); uchar2 __ovld __cnfn clamp(uchar2 x, uchar minval, uchar maxval); char3 __ovld __cnfn clamp(char3 x, char minval, char maxval); uchar3 __ovld __cnfn clamp(uchar3 x, uchar minval, uchar maxval); char4 __ovld __cnfn clamp(char4 x, char minval, char maxval); uchar4 __ovld __cnfn clamp(uchar4 x, uchar minval, uchar maxval); char8 __ovld __cnfn clamp(char8 x, char minval, char maxval); uchar8 __ovld __cnfn clamp(uchar8 x, uchar minval, uchar maxval); char16 __ovld __cnfn clamp(char16 x, char minval, char maxval); uchar16 __ovld __cnfn clamp(uchar16 x, uchar minval, uchar maxval); short2 __ovld __cnfn clamp(short2 x, short minval, short maxval); ushort2 __ovld __cnfn clamp(ushort2 x, ushort minval, ushort maxval); short3 __ovld __cnfn clamp(short3 x, short minval, short maxval); ushort3 __ovld __cnfn clamp(ushort3 x, ushort minval, ushort maxval); short4 __ovld __cnfn clamp(short4 x, short minval, short maxval); ushort4 __ovld __cnfn clamp(ushort4 x, ushort minval, ushort maxval); short8 __ovld __cnfn clamp(short8 x, short minval, short maxval); ushort8 __ovld __cnfn clamp(ushort8 x, ushort minval, ushort maxval); short16 __ovld __cnfn clamp(short16 x, short minval, short maxval); ushort16 __ovld __cnfn clamp(ushort16 x, ushort minval, ushort maxval); int2 __ovld __cnfn clamp(int2 x, int minval, int maxval); uint2 __ovld __cnfn clamp(uint2 x, uint minval, uint maxval); int3 __ovld __cnfn clamp(int3 x, int minval, int maxval); uint3 __ovld __cnfn clamp(uint3 x, uint minval, uint maxval); int4 __ovld __cnfn clamp(int4 x, int minval, int maxval); uint4 __ovld __cnfn clamp(uint4 x, uint minval, uint maxval); int8 __ovld __cnfn clamp(int8 x, int minval, int maxval); uint8 __ovld __cnfn clamp(uint8 x, uint minval, uint maxval); int16 __ovld __cnfn clamp(int16 x, int minval, int maxval); uint16 __ovld __cnfn clamp(uint16 x, uint minval, uint maxval); long2 __ovld __cnfn clamp(long2 x, long minval, long maxval); ulong2 __ovld __cnfn clamp(ulong2 x, ulong minval, ulong maxval); long3 __ovld __cnfn clamp(long3 x, long minval, long maxval); ulong3 __ovld __cnfn clamp(ulong3 x, ulong minval, ulong maxval); long4 __ovld __cnfn clamp(long4 x, long minval, long maxval); ulong4 __ovld __cnfn clamp(ulong4 x, ulong minval, ulong maxval); long8 __ovld __cnfn clamp(long8 x, long minval, long maxval); ulong8 __ovld __cnfn clamp(ulong8 x, ulong minval, ulong maxval); long16 __ovld __cnfn clamp(long16 x, long minval, long maxval); ulong16 __ovld __cnfn clamp(ulong16 x, ulong minval, ulong maxval); /** * Returns the number of leading 0-bits in x, starting * at the most significant bit position. */ char __ovld __cnfn clz(char x); uchar __ovld __cnfn clz(uchar x); char2 __ovld __cnfn clz(char2 x); uchar2 __ovld __cnfn clz(uchar2 x); char3 __ovld __cnfn clz(char3 x); uchar3 __ovld __cnfn clz(uchar3 x); char4 __ovld __cnfn clz(char4 x); uchar4 __ovld __cnfn clz(uchar4 x); char8 __ovld __cnfn clz(char8 x); uchar8 __ovld __cnfn clz(uchar8 x); char16 __ovld __cnfn clz(char16 x); uchar16 __ovld __cnfn clz(uchar16 x); short __ovld __cnfn clz(short x); ushort __ovld __cnfn clz(ushort x); short2 __ovld __cnfn clz(short2 x); ushort2 __ovld __cnfn clz(ushort2 x); short3 __ovld __cnfn clz(short3 x); ushort3 __ovld __cnfn clz(ushort3 x); short4 __ovld __cnfn clz(short4 x); ushort4 __ovld __cnfn clz(ushort4 x); short8 __ovld __cnfn clz(short8 x); ushort8 __ovld __cnfn clz(ushort8 x); short16 __ovld __cnfn clz(short16 x); ushort16 __ovld __cnfn clz(ushort16 x); int __ovld __cnfn clz(int x); uint __ovld __cnfn clz(uint x); int2 __ovld __cnfn clz(int2 x); uint2 __ovld __cnfn clz(uint2 x); int3 __ovld __cnfn clz(int3 x); uint3 __ovld __cnfn clz(uint3 x); int4 __ovld __cnfn clz(int4 x); uint4 __ovld __cnfn clz(uint4 x); int8 __ovld __cnfn clz(int8 x); uint8 __ovld __cnfn clz(uint8 x); int16 __ovld __cnfn clz(int16 x); uint16 __ovld __cnfn clz(uint16 x); long __ovld __cnfn clz(long x); ulong __ovld __cnfn clz(ulong x); long2 __ovld __cnfn clz(long2 x); ulong2 __ovld __cnfn clz(ulong2 x); long3 __ovld __cnfn clz(long3 x); ulong3 __ovld __cnfn clz(ulong3 x); long4 __ovld __cnfn clz(long4 x); ulong4 __ovld __cnfn clz(ulong4 x); long8 __ovld __cnfn clz(long8 x); ulong8 __ovld __cnfn clz(ulong8 x); long16 __ovld __cnfn clz(long16 x); ulong16 __ovld __cnfn clz(ulong16 x); /** * Returns the count of trailing 0-bits in x. If x is 0, * returns the size in bits of the type of x or * component type of x, if x is a vector. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) char __ovld ctz(char x); uchar __ovld ctz(uchar x); char2 __ovld ctz(char2 x); uchar2 __ovld ctz(uchar2 x); char3 __ovld ctz(char3 x); uchar3 __ovld ctz(uchar3 x); char4 __ovld ctz(char4 x); uchar4 __ovld ctz(uchar4 x); char8 __ovld ctz(char8 x); uchar8 __ovld ctz(uchar8 x); char16 __ovld ctz(char16 x); uchar16 __ovld ctz(uchar16 x); short __ovld ctz(short x); ushort __ovld ctz(ushort x); short2 __ovld ctz(short2 x); ushort2 __ovld ctz(ushort2 x); short3 __ovld ctz(short3 x); ushort3 __ovld ctz(ushort3 x); short4 __ovld ctz(short4 x); ushort4 __ovld ctz(ushort4 x); short8 __ovld ctz(short8 x); ushort8 __ovld ctz(ushort8 x); short16 __ovld ctz(short16 x); ushort16 __ovld ctz(ushort16 x); int __ovld ctz(int x); uint __ovld ctz(uint x); int2 __ovld ctz(int2 x); uint2 __ovld ctz(uint2 x); int3 __ovld ctz(int3 x); uint3 __ovld ctz(uint3 x); int4 __ovld ctz(int4 x); uint4 __ovld ctz(uint4 x); int8 __ovld ctz(int8 x); uint8 __ovld ctz(uint8 x); int16 __ovld ctz(int16 x); uint16 __ovld ctz(uint16 x); long __ovld ctz(long x); ulong __ovld ctz(ulong x); long2 __ovld ctz(long2 x); ulong2 __ovld ctz(ulong2 x); long3 __ovld ctz(long3 x); ulong3 __ovld ctz(ulong3 x); long4 __ovld ctz(long4 x); ulong4 __ovld ctz(ulong4 x); long8 __ovld ctz(long8 x); ulong8 __ovld ctz(ulong8 x); long16 __ovld ctz(long16 x); ulong16 __ovld ctz(ulong16 x); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Returns mul_hi(a, b) + c. */ char __ovld __cnfn mad_hi(char a, char b, char c); uchar __ovld __cnfn mad_hi(uchar a, uchar b, uchar c); char2 __ovld __cnfn mad_hi(char2 a, char2 b, char2 c); uchar2 __ovld __cnfn mad_hi(uchar2 a, uchar2 b, uchar2 c); char3 __ovld __cnfn mad_hi(char3 a, char3 b, char3 c); uchar3 __ovld __cnfn mad_hi(uchar3 a, uchar3 b, uchar3 c); char4 __ovld __cnfn mad_hi(char4 a, char4 b, char4 c); uchar4 __ovld __cnfn mad_hi(uchar4 a, uchar4 b, uchar4 c); char8 __ovld __cnfn mad_hi(char8 a, char8 b, char8 c); uchar8 __ovld __cnfn mad_hi(uchar8 a, uchar8 b, uchar8 c); char16 __ovld __cnfn mad_hi(char16 a, char16 b, char16 c); uchar16 __ovld __cnfn mad_hi(uchar16 a, uchar16 b, uchar16 c); short __ovld __cnfn mad_hi(short a, short b, short c); ushort __ovld __cnfn mad_hi(ushort a, ushort b, ushort c); short2 __ovld __cnfn mad_hi(short2 a, short2 b, short2 c); ushort2 __ovld __cnfn mad_hi(ushort2 a, ushort2 b, ushort2 c); short3 __ovld __cnfn mad_hi(short3 a, short3 b, short3 c); ushort3 __ovld __cnfn mad_hi(ushort3 a, ushort3 b, ushort3 c); short4 __ovld __cnfn mad_hi(short4 a, short4 b, short4 c); ushort4 __ovld __cnfn mad_hi(ushort4 a, ushort4 b, ushort4 c); short8 __ovld __cnfn mad_hi(short8 a, short8 b, short8 c); ushort8 __ovld __cnfn mad_hi(ushort8 a, ushort8 b, ushort8 c); short16 __ovld __cnfn mad_hi(short16 a, short16 b, short16 c); ushort16 __ovld __cnfn mad_hi(ushort16 a, ushort16 b, ushort16 c); int __ovld __cnfn mad_hi(int a, int b, int c); uint __ovld __cnfn mad_hi(uint a, uint b, uint c); int2 __ovld __cnfn mad_hi(int2 a, int2 b, int2 c); uint2 __ovld __cnfn mad_hi(uint2 a, uint2 b, uint2 c); int3 __ovld __cnfn mad_hi(int3 a, int3 b, int3 c); uint3 __ovld __cnfn mad_hi(uint3 a, uint3 b, uint3 c); int4 __ovld __cnfn mad_hi(int4 a, int4 b, int4 c); uint4 __ovld __cnfn mad_hi(uint4 a, uint4 b, uint4 c); int8 __ovld __cnfn mad_hi(int8 a, int8 b, int8 c); uint8 __ovld __cnfn mad_hi(uint8 a, uint8 b, uint8 c); int16 __ovld __cnfn mad_hi(int16 a, int16 b, int16 c); uint16 __ovld __cnfn mad_hi(uint16 a, uint16 b, uint16 c); long __ovld __cnfn mad_hi(long a, long b, long c); ulong __ovld __cnfn mad_hi(ulong a, ulong b, ulong c); long2 __ovld __cnfn mad_hi(long2 a, long2 b, long2 c); ulong2 __ovld __cnfn mad_hi(ulong2 a, ulong2 b, ulong2 c); long3 __ovld __cnfn mad_hi(long3 a, long3 b, long3 c); ulong3 __ovld __cnfn mad_hi(ulong3 a, ulong3 b, ulong3 c); long4 __ovld __cnfn mad_hi(long4 a, long4 b, long4 c); ulong4 __ovld __cnfn mad_hi(ulong4 a, ulong4 b, ulong4 c); long8 __ovld __cnfn mad_hi(long8 a, long8 b, long8 c); ulong8 __ovld __cnfn mad_hi(ulong8 a, ulong8 b, ulong8 c); long16 __ovld __cnfn mad_hi(long16 a, long16 b, long16 c); ulong16 __ovld __cnfn mad_hi(ulong16 a, ulong16 b, ulong16 c); /** * Returns a * b + c and saturates the result. */ char __ovld __cnfn mad_sat(char a, char b, char c); uchar __ovld __cnfn mad_sat(uchar a, uchar b, uchar c); char2 __ovld __cnfn mad_sat(char2 a, char2 b, char2 c); uchar2 __ovld __cnfn mad_sat(uchar2 a, uchar2 b, uchar2 c); char3 __ovld __cnfn mad_sat(char3 a, char3 b, char3 c); uchar3 __ovld __cnfn mad_sat(uchar3 a, uchar3 b, uchar3 c); char4 __ovld __cnfn mad_sat(char4 a, char4 b, char4 c); uchar4 __ovld __cnfn mad_sat(uchar4 a, uchar4 b, uchar4 c); char8 __ovld __cnfn mad_sat(char8 a, char8 b, char8 c); uchar8 __ovld __cnfn mad_sat(uchar8 a, uchar8 b, uchar8 c); char16 __ovld __cnfn mad_sat(char16 a, char16 b, char16 c); uchar16 __ovld __cnfn mad_sat(uchar16 a, uchar16 b, uchar16 c); short __ovld __cnfn mad_sat(short a, short b, short c); ushort __ovld __cnfn mad_sat(ushort a, ushort b, ushort c); short2 __ovld __cnfn mad_sat(short2 a, short2 b, short2 c); ushort2 __ovld __cnfn mad_sat(ushort2 a, ushort2 b, ushort2 c); short3 __ovld __cnfn mad_sat(short3 a, short3 b, short3 c); ushort3 __ovld __cnfn mad_sat(ushort3 a, ushort3 b, ushort3 c); short4 __ovld __cnfn mad_sat(short4 a, short4 b, short4 c); ushort4 __ovld __cnfn mad_sat(ushort4 a, ushort4 b, ushort4 c); short8 __ovld __cnfn mad_sat(short8 a, short8 b, short8 c); ushort8 __ovld __cnfn mad_sat(ushort8 a, ushort8 b, ushort8 c); short16 __ovld __cnfn mad_sat(short16 a, short16 b, short16 c); ushort16 __ovld __cnfn mad_sat(ushort16 a, ushort16 b, ushort16 c); int __ovld __cnfn mad_sat(int a, int b, int c); uint __ovld __cnfn mad_sat(uint a, uint b, uint c); int2 __ovld __cnfn mad_sat(int2 a, int2 b, int2 c); uint2 __ovld __cnfn mad_sat(uint2 a, uint2 b, uint2 c); int3 __ovld __cnfn mad_sat(int3 a, int3 b, int3 c); uint3 __ovld __cnfn mad_sat(uint3 a, uint3 b, uint3 c); int4 __ovld __cnfn mad_sat(int4 a, int4 b, int4 c); uint4 __ovld __cnfn mad_sat(uint4 a, uint4 b, uint4 c); int8 __ovld __cnfn mad_sat(int8 a, int8 b, int8 c); uint8 __ovld __cnfn mad_sat(uint8 a, uint8 b, uint8 c); int16 __ovld __cnfn mad_sat(int16 a, int16 b, int16 c); uint16 __ovld __cnfn mad_sat(uint16 a, uint16 b, uint16 c); long __ovld __cnfn mad_sat(long a, long b, long c); ulong __ovld __cnfn mad_sat(ulong a, ulong b, ulong c); long2 __ovld __cnfn mad_sat(long2 a, long2 b, long2 c); ulong2 __ovld __cnfn mad_sat(ulong2 a, ulong2 b, ulong2 c); long3 __ovld __cnfn mad_sat(long3 a, long3 b, long3 c); ulong3 __ovld __cnfn mad_sat(ulong3 a, ulong3 b, ulong3 c); long4 __ovld __cnfn mad_sat(long4 a, long4 b, long4 c); ulong4 __ovld __cnfn mad_sat(ulong4 a, ulong4 b, ulong4 c); long8 __ovld __cnfn mad_sat(long8 a, long8 b, long8 c); ulong8 __ovld __cnfn mad_sat(ulong8 a, ulong8 b, ulong8 c); long16 __ovld __cnfn mad_sat(long16 a, long16 b, long16 c); ulong16 __ovld __cnfn mad_sat(ulong16 a, ulong16 b, ulong16 c); /** * Returns y if x < y, otherwise it returns x. */ char __ovld __cnfn max(char x, char y); uchar __ovld __cnfn max(uchar x, uchar y); char2 __ovld __cnfn max(char2 x, char2 y); uchar2 __ovld __cnfn max(uchar2 x, uchar2 y); char3 __ovld __cnfn max(char3 x, char3 y); uchar3 __ovld __cnfn max(uchar3 x, uchar3 y); char4 __ovld __cnfn max(char4 x, char4 y); uchar4 __ovld __cnfn max(uchar4 x, uchar4 y); char8 __ovld __cnfn max(char8 x, char8 y); uchar8 __ovld __cnfn max(uchar8 x, uchar8 y); char16 __ovld __cnfn max(char16 x, char16 y); uchar16 __ovld __cnfn max(uchar16 x, uchar16 y); short __ovld __cnfn max(short x, short y); ushort __ovld __cnfn max(ushort x, ushort y); short2 __ovld __cnfn max(short2 x, short2 y); ushort2 __ovld __cnfn max(ushort2 x, ushort2 y); short3 __ovld __cnfn max(short3 x, short3 y); ushort3 __ovld __cnfn max(ushort3 x, ushort3 y); short4 __ovld __cnfn max(short4 x, short4 y); ushort4 __ovld __cnfn max(ushort4 x, ushort4 y); short8 __ovld __cnfn max(short8 x, short8 y); ushort8 __ovld __cnfn max(ushort8 x, ushort8 y); short16 __ovld __cnfn max(short16 x, short16 y); ushort16 __ovld __cnfn max(ushort16 x, ushort16 y); int __ovld __cnfn max(int x, int y); uint __ovld __cnfn max(uint x, uint y); int2 __ovld __cnfn max(int2 x, int2 y); uint2 __ovld __cnfn max(uint2 x, uint2 y); int3 __ovld __cnfn max(int3 x, int3 y); uint3 __ovld __cnfn max(uint3 x, uint3 y); int4 __ovld __cnfn max(int4 x, int4 y); uint4 __ovld __cnfn max(uint4 x, uint4 y); int8 __ovld __cnfn max(int8 x, int8 y); uint8 __ovld __cnfn max(uint8 x, uint8 y); int16 __ovld __cnfn max(int16 x, int16 y); uint16 __ovld __cnfn max(uint16 x, uint16 y); long __ovld __cnfn max(long x, long y); ulong __ovld __cnfn max(ulong x, ulong y); long2 __ovld __cnfn max(long2 x, long2 y); ulong2 __ovld __cnfn max(ulong2 x, ulong2 y); long3 __ovld __cnfn max(long3 x, long3 y); ulong3 __ovld __cnfn max(ulong3 x, ulong3 y); long4 __ovld __cnfn max(long4 x, long4 y); ulong4 __ovld __cnfn max(ulong4 x, ulong4 y); long8 __ovld __cnfn max(long8 x, long8 y); ulong8 __ovld __cnfn max(ulong8 x, ulong8 y); long16 __ovld __cnfn max(long16 x, long16 y); ulong16 __ovld __cnfn max(ulong16 x, ulong16 y); char2 __ovld __cnfn max(char2 x, char y); uchar2 __ovld __cnfn max(uchar2 x, uchar y); char3 __ovld __cnfn max(char3 x, char y); uchar3 __ovld __cnfn max(uchar3 x, uchar y); char4 __ovld __cnfn max(char4 x, char y); uchar4 __ovld __cnfn max(uchar4 x, uchar y); char8 __ovld __cnfn max(char8 x, char y); uchar8 __ovld __cnfn max(uchar8 x, uchar y); char16 __ovld __cnfn max(char16 x, char y); uchar16 __ovld __cnfn max(uchar16 x, uchar y); short2 __ovld __cnfn max(short2 x, short y); ushort2 __ovld __cnfn max(ushort2 x, ushort y); short3 __ovld __cnfn max(short3 x, short y); ushort3 __ovld __cnfn max(ushort3 x, ushort y); short4 __ovld __cnfn max(short4 x, short y); ushort4 __ovld __cnfn max(ushort4 x, ushort y); short8 __ovld __cnfn max(short8 x, short y); ushort8 __ovld __cnfn max(ushort8 x, ushort y); short16 __ovld __cnfn max(short16 x, short y); ushort16 __ovld __cnfn max(ushort16 x, ushort y); int2 __ovld __cnfn max(int2 x, int y); uint2 __ovld __cnfn max(uint2 x, uint y); int3 __ovld __cnfn max(int3 x, int y); uint3 __ovld __cnfn max(uint3 x, uint y); int4 __ovld __cnfn max(int4 x, int y); uint4 __ovld __cnfn max(uint4 x, uint y); int8 __ovld __cnfn max(int8 x, int y); uint8 __ovld __cnfn max(uint8 x, uint y); int16 __ovld __cnfn max(int16 x, int y); uint16 __ovld __cnfn max(uint16 x, uint y); long2 __ovld __cnfn max(long2 x, long y); ulong2 __ovld __cnfn max(ulong2 x, ulong y); long3 __ovld __cnfn max(long3 x, long y); ulong3 __ovld __cnfn max(ulong3 x, ulong y); long4 __ovld __cnfn max(long4 x, long y); ulong4 __ovld __cnfn max(ulong4 x, ulong y); long8 __ovld __cnfn max(long8 x, long y); ulong8 __ovld __cnfn max(ulong8 x, ulong y); long16 __ovld __cnfn max(long16 x, long y); ulong16 __ovld __cnfn max(ulong16 x, ulong y); /** * Returns y if y < x, otherwise it returns x. */ char __ovld __cnfn min(char x, char y); uchar __ovld __cnfn min(uchar x, uchar y); char2 __ovld __cnfn min(char2 x, char2 y); uchar2 __ovld __cnfn min(uchar2 x, uchar2 y); char3 __ovld __cnfn min(char3 x, char3 y); uchar3 __ovld __cnfn min(uchar3 x, uchar3 y); char4 __ovld __cnfn min(char4 x, char4 y); uchar4 __ovld __cnfn min(uchar4 x, uchar4 y); char8 __ovld __cnfn min(char8 x, char8 y); uchar8 __ovld __cnfn min(uchar8 x, uchar8 y); char16 __ovld __cnfn min(char16 x, char16 y); uchar16 __ovld __cnfn min(uchar16 x, uchar16 y); short __ovld __cnfn min(short x, short y); ushort __ovld __cnfn min(ushort x, ushort y); short2 __ovld __cnfn min(short2 x, short2 y); ushort2 __ovld __cnfn min(ushort2 x, ushort2 y); short3 __ovld __cnfn min(short3 x, short3 y); ushort3 __ovld __cnfn min(ushort3 x, ushort3 y); short4 __ovld __cnfn min(short4 x, short4 y); ushort4 __ovld __cnfn min(ushort4 x, ushort4 y); short8 __ovld __cnfn min(short8 x, short8 y); ushort8 __ovld __cnfn min(ushort8 x, ushort8 y); short16 __ovld __cnfn min(short16 x, short16 y); ushort16 __ovld __cnfn min(ushort16 x, ushort16 y); int __ovld __cnfn min(int x, int y); uint __ovld __cnfn min(uint x, uint y); int2 __ovld __cnfn min(int2 x, int2 y); uint2 __ovld __cnfn min(uint2 x, uint2 y); int3 __ovld __cnfn min(int3 x, int3 y); uint3 __ovld __cnfn min(uint3 x, uint3 y); int4 __ovld __cnfn min(int4 x, int4 y); uint4 __ovld __cnfn min(uint4 x, uint4 y); int8 __ovld __cnfn min(int8 x, int8 y); uint8 __ovld __cnfn min(uint8 x, uint8 y); int16 __ovld __cnfn min(int16 x, int16 y); uint16 __ovld __cnfn min(uint16 x, uint16 y); long __ovld __cnfn min(long x, long y); ulong __ovld __cnfn min(ulong x, ulong y); long2 __ovld __cnfn min(long2 x, long2 y); ulong2 __ovld __cnfn min(ulong2 x, ulong2 y); long3 __ovld __cnfn min(long3 x, long3 y); ulong3 __ovld __cnfn min(ulong3 x, ulong3 y); long4 __ovld __cnfn min(long4 x, long4 y); ulong4 __ovld __cnfn min(ulong4 x, ulong4 y); long8 __ovld __cnfn min(long8 x, long8 y); ulong8 __ovld __cnfn min(ulong8 x, ulong8 y); long16 __ovld __cnfn min(long16 x, long16 y); ulong16 __ovld __cnfn min(ulong16 x, ulong16 y); char2 __ovld __cnfn min(char2 x, char y); uchar2 __ovld __cnfn min(uchar2 x, uchar y); char3 __ovld __cnfn min(char3 x, char y); uchar3 __ovld __cnfn min(uchar3 x, uchar y); char4 __ovld __cnfn min(char4 x, char y); uchar4 __ovld __cnfn min(uchar4 x, uchar y); char8 __ovld __cnfn min(char8 x, char y); uchar8 __ovld __cnfn min(uchar8 x, uchar y); char16 __ovld __cnfn min(char16 x, char y); uchar16 __ovld __cnfn min(uchar16 x, uchar y); short2 __ovld __cnfn min(short2 x, short y); ushort2 __ovld __cnfn min(ushort2 x, ushort y); short3 __ovld __cnfn min(short3 x, short y); ushort3 __ovld __cnfn min(ushort3 x, ushort y); short4 __ovld __cnfn min(short4 x, short y); ushort4 __ovld __cnfn min(ushort4 x, ushort y); short8 __ovld __cnfn min(short8 x, short y); ushort8 __ovld __cnfn min(ushort8 x, ushort y); short16 __ovld __cnfn min(short16 x, short y); ushort16 __ovld __cnfn min(ushort16 x, ushort y); int2 __ovld __cnfn min(int2 x, int y); uint2 __ovld __cnfn min(uint2 x, uint y); int3 __ovld __cnfn min(int3 x, int y); uint3 __ovld __cnfn min(uint3 x, uint y); int4 __ovld __cnfn min(int4 x, int y); uint4 __ovld __cnfn min(uint4 x, uint y); int8 __ovld __cnfn min(int8 x, int y); uint8 __ovld __cnfn min(uint8 x, uint y); int16 __ovld __cnfn min(int16 x, int y); uint16 __ovld __cnfn min(uint16 x, uint y); long2 __ovld __cnfn min(long2 x, long y); ulong2 __ovld __cnfn min(ulong2 x, ulong y); long3 __ovld __cnfn min(long3 x, long y); ulong3 __ovld __cnfn min(ulong3 x, ulong y); long4 __ovld __cnfn min(long4 x, long y); ulong4 __ovld __cnfn min(ulong4 x, ulong y); long8 __ovld __cnfn min(long8 x, long y); ulong8 __ovld __cnfn min(ulong8 x, ulong y); long16 __ovld __cnfn min(long16 x, long y); ulong16 __ovld __cnfn min(ulong16 x, ulong y); /** * Computes x * y and returns the high half of the * product of x and y. */ char __ovld __cnfn mul_hi(char x, char y); uchar __ovld __cnfn mul_hi(uchar x, uchar y); char2 __ovld __cnfn mul_hi(char2 x, char2 y); uchar2 __ovld __cnfn mul_hi(uchar2 x, uchar2 y); char3 __ovld __cnfn mul_hi(char3 x, char3 y); uchar3 __ovld __cnfn mul_hi(uchar3 x, uchar3 y); char4 __ovld __cnfn mul_hi(char4 x, char4 y); uchar4 __ovld __cnfn mul_hi(uchar4 x, uchar4 y); char8 __ovld __cnfn mul_hi(char8 x, char8 y); uchar8 __ovld __cnfn mul_hi(uchar8 x, uchar8 y); char16 __ovld __cnfn mul_hi(char16 x, char16 y); uchar16 __ovld __cnfn mul_hi(uchar16 x, uchar16 y); short __ovld __cnfn mul_hi(short x, short y); ushort __ovld __cnfn mul_hi(ushort x, ushort y); short2 __ovld __cnfn mul_hi(short2 x, short2 y); ushort2 __ovld __cnfn mul_hi(ushort2 x, ushort2 y); short3 __ovld __cnfn mul_hi(short3 x, short3 y); ushort3 __ovld __cnfn mul_hi(ushort3 x, ushort3 y); short4 __ovld __cnfn mul_hi(short4 x, short4 y); ushort4 __ovld __cnfn mul_hi(ushort4 x, ushort4 y); short8 __ovld __cnfn mul_hi(short8 x, short8 y); ushort8 __ovld __cnfn mul_hi(ushort8 x, ushort8 y); short16 __ovld __cnfn mul_hi(short16 x, short16 y); ushort16 __ovld __cnfn mul_hi(ushort16 x, ushort16 y); int __ovld __cnfn mul_hi(int x, int y); uint __ovld __cnfn mul_hi(uint x, uint y); int2 __ovld __cnfn mul_hi(int2 x, int2 y); uint2 __ovld __cnfn mul_hi(uint2 x, uint2 y); int3 __ovld __cnfn mul_hi(int3 x, int3 y); uint3 __ovld __cnfn mul_hi(uint3 x, uint3 y); int4 __ovld __cnfn mul_hi(int4 x, int4 y); uint4 __ovld __cnfn mul_hi(uint4 x, uint4 y); int8 __ovld __cnfn mul_hi(int8 x, int8 y); uint8 __ovld __cnfn mul_hi(uint8 x, uint8 y); int16 __ovld __cnfn mul_hi(int16 x, int16 y); uint16 __ovld __cnfn mul_hi(uint16 x, uint16 y); long __ovld __cnfn mul_hi(long x, long y); ulong __ovld __cnfn mul_hi(ulong x, ulong y); long2 __ovld __cnfn mul_hi(long2 x, long2 y); ulong2 __ovld __cnfn mul_hi(ulong2 x, ulong2 y); long3 __ovld __cnfn mul_hi(long3 x, long3 y); ulong3 __ovld __cnfn mul_hi(ulong3 x, ulong3 y); long4 __ovld __cnfn mul_hi(long4 x, long4 y); ulong4 __ovld __cnfn mul_hi(ulong4 x, ulong4 y); long8 __ovld __cnfn mul_hi(long8 x, long8 y); ulong8 __ovld __cnfn mul_hi(ulong8 x, ulong8 y); long16 __ovld __cnfn mul_hi(long16 x, long16 y); ulong16 __ovld __cnfn mul_hi(ulong16 x, ulong16 y); /** * For each element in v, the bits are shifted left by * the number of bits given by the corresponding * element in i (subject to usual shift modulo rules * described in section 6.3). Bits shifted off the left * side of the element are shifted back in from the * right. */ char __ovld __cnfn rotate(char v, char i); uchar __ovld __cnfn rotate(uchar v, uchar i); char2 __ovld __cnfn rotate(char2 v, char2 i); uchar2 __ovld __cnfn rotate(uchar2 v, uchar2 i); char3 __ovld __cnfn rotate(char3 v, char3 i); uchar3 __ovld __cnfn rotate(uchar3 v, uchar3 i); char4 __ovld __cnfn rotate(char4 v, char4 i); uchar4 __ovld __cnfn rotate(uchar4 v, uchar4 i); char8 __ovld __cnfn rotate(char8 v, char8 i); uchar8 __ovld __cnfn rotate(uchar8 v, uchar8 i); char16 __ovld __cnfn rotate(char16 v, char16 i); uchar16 __ovld __cnfn rotate(uchar16 v, uchar16 i); short __ovld __cnfn rotate(short v, short i); ushort __ovld __cnfn rotate(ushort v, ushort i); short2 __ovld __cnfn rotate(short2 v, short2 i); ushort2 __ovld __cnfn rotate(ushort2 v, ushort2 i); short3 __ovld __cnfn rotate(short3 v, short3 i); ushort3 __ovld __cnfn rotate(ushort3 v, ushort3 i); short4 __ovld __cnfn rotate(short4 v, short4 i); ushort4 __ovld __cnfn rotate(ushort4 v, ushort4 i); short8 __ovld __cnfn rotate(short8 v, short8 i); ushort8 __ovld __cnfn rotate(ushort8 v, ushort8 i); short16 __ovld __cnfn rotate(short16 v, short16 i); ushort16 __ovld __cnfn rotate(ushort16 v, ushort16 i); int __ovld __cnfn rotate(int v, int i); uint __ovld __cnfn rotate(uint v, uint i); int2 __ovld __cnfn rotate(int2 v, int2 i); uint2 __ovld __cnfn rotate(uint2 v, uint2 i); int3 __ovld __cnfn rotate(int3 v, int3 i); uint3 __ovld __cnfn rotate(uint3 v, uint3 i); int4 __ovld __cnfn rotate(int4 v, int4 i); uint4 __ovld __cnfn rotate(uint4 v, uint4 i); int8 __ovld __cnfn rotate(int8 v, int8 i); uint8 __ovld __cnfn rotate(uint8 v, uint8 i); int16 __ovld __cnfn rotate(int16 v, int16 i); uint16 __ovld __cnfn rotate(uint16 v, uint16 i); long __ovld __cnfn rotate(long v, long i); ulong __ovld __cnfn rotate(ulong v, ulong i); long2 __ovld __cnfn rotate(long2 v, long2 i); ulong2 __ovld __cnfn rotate(ulong2 v, ulong2 i); long3 __ovld __cnfn rotate(long3 v, long3 i); ulong3 __ovld __cnfn rotate(ulong3 v, ulong3 i); long4 __ovld __cnfn rotate(long4 v, long4 i); ulong4 __ovld __cnfn rotate(ulong4 v, ulong4 i); long8 __ovld __cnfn rotate(long8 v, long8 i); ulong8 __ovld __cnfn rotate(ulong8 v, ulong8 i); long16 __ovld __cnfn rotate(long16 v, long16 i); ulong16 __ovld __cnfn rotate(ulong16 v, ulong16 i); /** * Returns x - y and saturates the result. */ char __ovld __cnfn sub_sat(char x, char y); uchar __ovld __cnfn sub_sat(uchar x, uchar y); char2 __ovld __cnfn sub_sat(char2 x, char2 y); uchar2 __ovld __cnfn sub_sat(uchar2 x, uchar2 y); char3 __ovld __cnfn sub_sat(char3 x, char3 y); uchar3 __ovld __cnfn sub_sat(uchar3 x, uchar3 y); char4 __ovld __cnfn sub_sat(char4 x, char4 y); uchar4 __ovld __cnfn sub_sat(uchar4 x, uchar4 y); char8 __ovld __cnfn sub_sat(char8 x, char8 y); uchar8 __ovld __cnfn sub_sat(uchar8 x, uchar8 y); char16 __ovld __cnfn sub_sat(char16 x, char16 y); uchar16 __ovld __cnfn sub_sat(uchar16 x, uchar16 y); short __ovld __cnfn sub_sat(short x, short y); ushort __ovld __cnfn sub_sat(ushort x, ushort y); short2 __ovld __cnfn sub_sat(short2 x, short2 y); ushort2 __ovld __cnfn sub_sat(ushort2 x, ushort2 y); short3 __ovld __cnfn sub_sat(short3 x, short3 y); ushort3 __ovld __cnfn sub_sat(ushort3 x, ushort3 y); short4 __ovld __cnfn sub_sat(short4 x, short4 y); ushort4 __ovld __cnfn sub_sat(ushort4 x, ushort4 y); short8 __ovld __cnfn sub_sat(short8 x, short8 y); ushort8 __ovld __cnfn sub_sat(ushort8 x, ushort8 y); short16 __ovld __cnfn sub_sat(short16 x, short16 y); ushort16 __ovld __cnfn sub_sat(ushort16 x, ushort16 y); int __ovld __cnfn sub_sat(int x, int y); uint __ovld __cnfn sub_sat(uint x, uint y); int2 __ovld __cnfn sub_sat(int2 x, int2 y); uint2 __ovld __cnfn sub_sat(uint2 x, uint2 y); int3 __ovld __cnfn sub_sat(int3 x, int3 y); uint3 __ovld __cnfn sub_sat(uint3 x, uint3 y); int4 __ovld __cnfn sub_sat(int4 x, int4 y); uint4 __ovld __cnfn sub_sat(uint4 x, uint4 y); int8 __ovld __cnfn sub_sat(int8 x, int8 y); uint8 __ovld __cnfn sub_sat(uint8 x, uint8 y); int16 __ovld __cnfn sub_sat(int16 x, int16 y); uint16 __ovld __cnfn sub_sat(uint16 x, uint16 y); long __ovld __cnfn sub_sat(long x, long y); ulong __ovld __cnfn sub_sat(ulong x, ulong y); long2 __ovld __cnfn sub_sat(long2 x, long2 y); ulong2 __ovld __cnfn sub_sat(ulong2 x, ulong2 y); long3 __ovld __cnfn sub_sat(long3 x, long3 y); ulong3 __ovld __cnfn sub_sat(ulong3 x, ulong3 y); long4 __ovld __cnfn sub_sat(long4 x, long4 y); ulong4 __ovld __cnfn sub_sat(ulong4 x, ulong4 y); long8 __ovld __cnfn sub_sat(long8 x, long8 y); ulong8 __ovld __cnfn sub_sat(ulong8 x, ulong8 y); long16 __ovld __cnfn sub_sat(long16 x, long16 y); ulong16 __ovld __cnfn sub_sat(ulong16 x, ulong16 y); /** * result[i] = ((short)hi[i] << 8) | lo[i] * result[i] = ((ushort)hi[i] << 8) | lo[i] */ short __ovld __cnfn upsample(char hi, uchar lo); ushort __ovld __cnfn upsample(uchar hi, uchar lo); short2 __ovld __cnfn upsample(char2 hi, uchar2 lo); short3 __ovld __cnfn upsample(char3 hi, uchar3 lo); short4 __ovld __cnfn upsample(char4 hi, uchar4 lo); short8 __ovld __cnfn upsample(char8 hi, uchar8 lo); short16 __ovld __cnfn upsample(char16 hi, uchar16 lo); ushort2 __ovld __cnfn upsample(uchar2 hi, uchar2 lo); ushort3 __ovld __cnfn upsample(uchar3 hi, uchar3 lo); ushort4 __ovld __cnfn upsample(uchar4 hi, uchar4 lo); ushort8 __ovld __cnfn upsample(uchar8 hi, uchar8 lo); ushort16 __ovld __cnfn upsample(uchar16 hi, uchar16 lo); /** * result[i] = ((int)hi[i] << 16) | lo[i] * result[i] = ((uint)hi[i] << 16) | lo[i] */ int __ovld __cnfn upsample(short hi, ushort lo); uint __ovld __cnfn upsample(ushort hi, ushort lo); int2 __ovld __cnfn upsample(short2 hi, ushort2 lo); int3 __ovld __cnfn upsample(short3 hi, ushort3 lo); int4 __ovld __cnfn upsample(short4 hi, ushort4 lo); int8 __ovld __cnfn upsample(short8 hi, ushort8 lo); int16 __ovld __cnfn upsample(short16 hi, ushort16 lo); uint2 __ovld __cnfn upsample(ushort2 hi, ushort2 lo); uint3 __ovld __cnfn upsample(ushort3 hi, ushort3 lo); uint4 __ovld __cnfn upsample(ushort4 hi, ushort4 lo); uint8 __ovld __cnfn upsample(ushort8 hi, ushort8 lo); uint16 __ovld __cnfn upsample(ushort16 hi, ushort16 lo); /** * result[i] = ((long)hi[i] << 32) | lo[i] * result[i] = ((ulong)hi[i] << 32) | lo[i] */ long __ovld __cnfn upsample(int hi, uint lo); ulong __ovld __cnfn upsample(uint hi, uint lo); long2 __ovld __cnfn upsample(int2 hi, uint2 lo); long3 __ovld __cnfn upsample(int3 hi, uint3 lo); long4 __ovld __cnfn upsample(int4 hi, uint4 lo); long8 __ovld __cnfn upsample(int8 hi, uint8 lo); long16 __ovld __cnfn upsample(int16 hi, uint16 lo); ulong2 __ovld __cnfn upsample(uint2 hi, uint2 lo); ulong3 __ovld __cnfn upsample(uint3 hi, uint3 lo); ulong4 __ovld __cnfn upsample(uint4 hi, uint4 lo); ulong8 __ovld __cnfn upsample(uint8 hi, uint8 lo); ulong16 __ovld __cnfn upsample(uint16 hi, uint16 lo); /* * popcount(x): returns the number of set bit in x */ char __ovld __cnfn popcount(char x); uchar __ovld __cnfn popcount(uchar x); char2 __ovld __cnfn popcount(char2 x); uchar2 __ovld __cnfn popcount(uchar2 x); char3 __ovld __cnfn popcount(char3 x); uchar3 __ovld __cnfn popcount(uchar3 x); char4 __ovld __cnfn popcount(char4 x); uchar4 __ovld __cnfn popcount(uchar4 x); char8 __ovld __cnfn popcount(char8 x); uchar8 __ovld __cnfn popcount(uchar8 x); char16 __ovld __cnfn popcount(char16 x); uchar16 __ovld __cnfn popcount(uchar16 x); short __ovld __cnfn popcount(short x); ushort __ovld __cnfn popcount(ushort x); short2 __ovld __cnfn popcount(short2 x); ushort2 __ovld __cnfn popcount(ushort2 x); short3 __ovld __cnfn popcount(short3 x); ushort3 __ovld __cnfn popcount(ushort3 x); short4 __ovld __cnfn popcount(short4 x); ushort4 __ovld __cnfn popcount(ushort4 x); short8 __ovld __cnfn popcount(short8 x); ushort8 __ovld __cnfn popcount(ushort8 x); short16 __ovld __cnfn popcount(short16 x); ushort16 __ovld __cnfn popcount(ushort16 x); int __ovld __cnfn popcount(int x); uint __ovld __cnfn popcount(uint x); int2 __ovld __cnfn popcount(int2 x); uint2 __ovld __cnfn popcount(uint2 x); int3 __ovld __cnfn popcount(int3 x); uint3 __ovld __cnfn popcount(uint3 x); int4 __ovld __cnfn popcount(int4 x); uint4 __ovld __cnfn popcount(uint4 x); int8 __ovld __cnfn popcount(int8 x); uint8 __ovld __cnfn popcount(uint8 x); int16 __ovld __cnfn popcount(int16 x); uint16 __ovld __cnfn popcount(uint16 x); long __ovld __cnfn popcount(long x); ulong __ovld __cnfn popcount(ulong x); long2 __ovld __cnfn popcount(long2 x); ulong2 __ovld __cnfn popcount(ulong2 x); long3 __ovld __cnfn popcount(long3 x); ulong3 __ovld __cnfn popcount(ulong3 x); long4 __ovld __cnfn popcount(long4 x); ulong4 __ovld __cnfn popcount(ulong4 x); long8 __ovld __cnfn popcount(long8 x); ulong8 __ovld __cnfn popcount(ulong8 x); long16 __ovld __cnfn popcount(long16 x); ulong16 __ovld __cnfn popcount(ulong16 x); /** * Multiply two 24-bit integer values x and y and add * the 32-bit integer result to the 32-bit integer z. * Refer to definition of mul24 to see how the 24-bit * integer multiplication is performed. */ int __ovld __cnfn mad24(int x, int y, int z); uint __ovld __cnfn mad24(uint x, uint y, uint z); int2 __ovld __cnfn mad24(int2 x, int2 y, int2 z); uint2 __ovld __cnfn mad24(uint2 x, uint2 y, uint2 z); int3 __ovld __cnfn mad24(int3 x, int3 y, int3 z); uint3 __ovld __cnfn mad24(uint3 x, uint3 y, uint3 z); int4 __ovld __cnfn mad24(int4 x, int4 y, int4 z); uint4 __ovld __cnfn mad24(uint4 x, uint4 y, uint4 z); int8 __ovld __cnfn mad24(int8 x, int8 y, int8 z); uint8 __ovld __cnfn mad24(uint8 x, uint8 y, uint8 z); int16 __ovld __cnfn mad24(int16 x, int16 y, int16 z); uint16 __ovld __cnfn mad24(uint16 x, uint16 y, uint16 z); /** * Multiply two 24-bit integer values x and y. x and y * are 32-bit integers but only the low 24-bits are used * to perform the multiplication. mul24 should only * be used when values in x and y are in the range [- * 2^23, 2^23-1] if x and y are signed integers and in the * range [0, 2^24-1] if x and y are unsigned integers. If * x and y are not in this range, the multiplication * result is implementation-defined. */ int __ovld __cnfn mul24(int x, int y); uint __ovld __cnfn mul24(uint x, uint y); int2 __ovld __cnfn mul24(int2 x, int2 y); uint2 __ovld __cnfn mul24(uint2 x, uint2 y); int3 __ovld __cnfn mul24(int3 x, int3 y); uint3 __ovld __cnfn mul24(uint3 x, uint3 y); int4 __ovld __cnfn mul24(int4 x, int4 y); uint4 __ovld __cnfn mul24(uint4 x, uint4 y); int8 __ovld __cnfn mul24(int8 x, int8 y); uint8 __ovld __cnfn mul24(uint8 x, uint8 y); int16 __ovld __cnfn mul24(int16 x, int16 y); uint16 __ovld __cnfn mul24(uint16 x, uint16 y); // OpenCL v1.1 s6.11.4, v1.2 s6.12.4, v2.0 s6.13.4 - Common Functions /** * Returns fmin(fmax(x, minval), maxval). * Results are undefined if minval > maxval. */ float __ovld __cnfn clamp(float x, float minval, float maxval); float2 __ovld __cnfn clamp(float2 x, float2 minval, float2 maxval); float3 __ovld __cnfn clamp(float3 x, float3 minval, float3 maxval); float4 __ovld __cnfn clamp(float4 x, float4 minval, float4 maxval); float8 __ovld __cnfn clamp(float8 x, float8 minval, float8 maxval); float16 __ovld __cnfn clamp(float16 x, float16 minval, float16 maxval); float2 __ovld __cnfn clamp(float2 x, float minval, float maxval); float3 __ovld __cnfn clamp(float3 x, float minval, float maxval); float4 __ovld __cnfn clamp(float4 x, float minval, float maxval); float8 __ovld __cnfn clamp(float8 x, float minval, float maxval); float16 __ovld __cnfn clamp(float16 x, float minval, float maxval); #ifdef cl_khr_fp64 double __ovld __cnfn clamp(double x, double minval, double maxval); double2 __ovld __cnfn clamp(double2 x, double2 minval, double2 maxval); double3 __ovld __cnfn clamp(double3 x, double3 minval, double3 maxval); double4 __ovld __cnfn clamp(double4 x, double4 minval, double4 maxval); double8 __ovld __cnfn clamp(double8 x, double8 minval, double8 maxval); double16 __ovld __cnfn clamp(double16 x, double16 minval, double16 maxval); double2 __ovld __cnfn clamp(double2 x, double minval, double maxval); double3 __ovld __cnfn clamp(double3 x, double minval, double maxval); double4 __ovld __cnfn clamp(double4 x, double minval, double maxval); double8 __ovld __cnfn clamp(double8 x, double minval, double maxval); double16 __ovld __cnfn clamp(double16 x, double minval, double maxval); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn clamp(half x, half minval, half maxval); half2 __ovld __cnfn clamp(half2 x, half2 minval, half2 maxval); half3 __ovld __cnfn clamp(half3 x, half3 minval, half3 maxval); half4 __ovld __cnfn clamp(half4 x, half4 minval, half4 maxval); half8 __ovld __cnfn clamp(half8 x, half8 minval, half8 maxval); half16 __ovld __cnfn clamp(half16 x, half16 minval, half16 maxval); half2 __ovld __cnfn clamp(half2 x, half minval, half maxval); half3 __ovld __cnfn clamp(half3 x, half minval, half maxval); half4 __ovld __cnfn clamp(half4 x, half minval, half maxval); half8 __ovld __cnfn clamp(half8 x, half minval, half maxval); half16 __ovld __cnfn clamp(half16 x, half minval, half maxval); #endif //cl_khr_fp16 /** * Converts radians to degrees, i.e. (180 / PI) * * radians. */ float __ovld __cnfn degrees(float radians); float2 __ovld __cnfn degrees(float2 radians); float3 __ovld __cnfn degrees(float3 radians); float4 __ovld __cnfn degrees(float4 radians); float8 __ovld __cnfn degrees(float8 radians); float16 __ovld __cnfn degrees(float16 radians); #ifdef cl_khr_fp64 double __ovld __cnfn degrees(double radians); double2 __ovld __cnfn degrees(double2 radians); double3 __ovld __cnfn degrees(double3 radians); double4 __ovld __cnfn degrees(double4 radians); double8 __ovld __cnfn degrees(double8 radians); double16 __ovld __cnfn degrees(double16 radians); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn degrees(half radians); half2 __ovld __cnfn degrees(half2 radians); half3 __ovld __cnfn degrees(half3 radians); half4 __ovld __cnfn degrees(half4 radians); half8 __ovld __cnfn degrees(half8 radians); half16 __ovld __cnfn degrees(half16 radians); #endif //cl_khr_fp16 /** * Returns y if x < y, otherwise it returns x. If x and y * are infinite or NaN, the return values are undefined. */ float __ovld __cnfn max(float x, float y); float2 __ovld __cnfn max(float2 x, float2 y); float3 __ovld __cnfn max(float3 x, float3 y); float4 __ovld __cnfn max(float4 x, float4 y); float8 __ovld __cnfn max(float8 x, float8 y); float16 __ovld __cnfn max(float16 x, float16 y); float2 __ovld __cnfn max(float2 x, float y); float3 __ovld __cnfn max(float3 x, float y); float4 __ovld __cnfn max(float4 x, float y); float8 __ovld __cnfn max(float8 x, float y); float16 __ovld __cnfn max(float16 x, float y); #ifdef cl_khr_fp64 double __ovld __cnfn max(double x, double y); double2 __ovld __cnfn max(double2 x, double2 y); double3 __ovld __cnfn max(double3 x, double3 y); double4 __ovld __cnfn max(double4 x, double4 y); double8 __ovld __cnfn max(double8 x, double8 y); double16 __ovld __cnfn max(double16 x, double16 y); double2 __ovld __cnfn max(double2 x, double y); double3 __ovld __cnfn max(double3 x, double y); double4 __ovld __cnfn max(double4 x, double y); double8 __ovld __cnfn max(double8 x, double y); double16 __ovld __cnfn max(double16 x, double y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn max(half x, half y); half2 __ovld __cnfn max(half2 x, half2 y); half3 __ovld __cnfn max(half3 x, half3 y); half4 __ovld __cnfn max(half4 x, half4 y); half8 __ovld __cnfn max(half8 x, half8 y); half16 __ovld __cnfn max(half16 x, half16 y); half2 __ovld __cnfn max(half2 x, half y); half3 __ovld __cnfn max(half3 x, half y); half4 __ovld __cnfn max(half4 x, half y); half8 __ovld __cnfn max(half8 x, half y); half16 __ovld __cnfn max(half16 x, half y); #endif //cl_khr_fp16 /** * Returns y if y < x, otherwise it returns x. If x and y * are infinite or NaN, the return values are undefined. */ float __ovld __cnfn min(float x, float y); float2 __ovld __cnfn min(float2 x, float2 y); float3 __ovld __cnfn min(float3 x, float3 y); float4 __ovld __cnfn min(float4 x, float4 y); float8 __ovld __cnfn min(float8 x, float8 y); float16 __ovld __cnfn min(float16 x, float16 y); float2 __ovld __cnfn min(float2 x, float y); float3 __ovld __cnfn min(float3 x, float y); float4 __ovld __cnfn min(float4 x, float y); float8 __ovld __cnfn min(float8 x, float y); float16 __ovld __cnfn min(float16 x, float y); #ifdef cl_khr_fp64 double __ovld __cnfn min(double x, double y); double2 __ovld __cnfn min(double2 x, double2 y); double3 __ovld __cnfn min(double3 x, double3 y); double4 __ovld __cnfn min(double4 x, double4 y); double8 __ovld __cnfn min(double8 x, double8 y); double16 __ovld __cnfn min(double16 x, double16 y); double2 __ovld __cnfn min(double2 x, double y); double3 __ovld __cnfn min(double3 x, double y); double4 __ovld __cnfn min(double4 x, double y); double8 __ovld __cnfn min(double8 x, double y); double16 __ovld __cnfn min(double16 x, double y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn min(half x, half y); half2 __ovld __cnfn min(half2 x, half2 y); half3 __ovld __cnfn min(half3 x, half3 y); half4 __ovld __cnfn min(half4 x, half4 y); half8 __ovld __cnfn min(half8 x, half8 y); half16 __ovld __cnfn min(half16 x, half16 y); half2 __ovld __cnfn min(half2 x, half y); half3 __ovld __cnfn min(half3 x, half y); half4 __ovld __cnfn min(half4 x, half y); half8 __ovld __cnfn min(half8 x, half y); half16 __ovld __cnfn min(half16 x, half y); #endif //cl_khr_fp16 /** * Returns the linear blend of x & y implemented as: * x + (y - x) * a * a must be a value in the range 0.0 ... 1.0. If a is not * in the range 0.0 ... 1.0, the return values are * undefined. */ float __ovld __cnfn mix(float x, float y, float a); float2 __ovld __cnfn mix(float2 x, float2 y, float2 a); float3 __ovld __cnfn mix(float3 x, float3 y, float3 a); float4 __ovld __cnfn mix(float4 x, float4 y, float4 a); float8 __ovld __cnfn mix(float8 x, float8 y, float8 a); float16 __ovld __cnfn mix(float16 x, float16 y, float16 a); float2 __ovld __cnfn mix(float2 x, float2 y, float a); float3 __ovld __cnfn mix(float3 x, float3 y, float a); float4 __ovld __cnfn mix(float4 x, float4 y, float a); float8 __ovld __cnfn mix(float8 x, float8 y, float a); float16 __ovld __cnfn mix(float16 x, float16 y, float a); #ifdef cl_khr_fp64 double __ovld __cnfn mix(double x, double y, double a); double2 __ovld __cnfn mix(double2 x, double2 y, double2 a); double3 __ovld __cnfn mix(double3 x, double3 y, double3 a); double4 __ovld __cnfn mix(double4 x, double4 y, double4 a); double8 __ovld __cnfn mix(double8 x, double8 y, double8 a); double16 __ovld __cnfn mix(double16 x, double16 y, double16 a); double2 __ovld __cnfn mix(double2 x, double2 y, double a); double3 __ovld __cnfn mix(double3 x, double3 y, double a); double4 __ovld __cnfn mix(double4 x, double4 y, double a); double8 __ovld __cnfn mix(double8 x, double8 y, double a); double16 __ovld __cnfn mix(double16 x, double16 y, double a); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn mix(half x, half y, half a); half2 __ovld __cnfn mix(half2 x, half2 y, half2 a); half3 __ovld __cnfn mix(half3 x, half3 y, half3 a); half4 __ovld __cnfn mix(half4 x, half4 y, half4 a); half8 __ovld __cnfn mix(half8 x, half8 y, half8 a); half16 __ovld __cnfn mix(half16 x, half16 y, half16 a); half2 __ovld __cnfn mix(half2 x, half2 y, half a); half3 __ovld __cnfn mix(half3 x, half3 y, half a); half4 __ovld __cnfn mix(half4 x, half4 y, half a); half8 __ovld __cnfn mix(half8 x, half8 y, half a); half16 __ovld __cnfn mix(half16 x, half16 y, half a); #endif //cl_khr_fp16 /** * Converts degrees to radians, i.e. (PI / 180) * * degrees. */ float __ovld __cnfn radians(float degrees); float2 __ovld __cnfn radians(float2 degrees); float3 __ovld __cnfn radians(float3 degrees); float4 __ovld __cnfn radians(float4 degrees); float8 __ovld __cnfn radians(float8 degrees); float16 __ovld __cnfn radians(float16 degrees); #ifdef cl_khr_fp64 double __ovld __cnfn radians(double degrees); double2 __ovld __cnfn radians(double2 degrees); double3 __ovld __cnfn radians(double3 degrees); double4 __ovld __cnfn radians(double4 degrees); double8 __ovld __cnfn radians(double8 degrees); double16 __ovld __cnfn radians(double16 degrees); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn radians(half degrees); half2 __ovld __cnfn radians(half2 degrees); half3 __ovld __cnfn radians(half3 degrees); half4 __ovld __cnfn radians(half4 degrees); half8 __ovld __cnfn radians(half8 degrees); half16 __ovld __cnfn radians(half16 degrees); #endif //cl_khr_fp16 /** * Returns 0.0 if x < edge, otherwise it returns 1.0. */ float __ovld __cnfn step(float edge, float x); float2 __ovld __cnfn step(float2 edge, float2 x); float3 __ovld __cnfn step(float3 edge, float3 x); float4 __ovld __cnfn step(float4 edge, float4 x); float8 __ovld __cnfn step(float8 edge, float8 x); float16 __ovld __cnfn step(float16 edge, float16 x); float2 __ovld __cnfn step(float edge, float2 x); float3 __ovld __cnfn step(float edge, float3 x); float4 __ovld __cnfn step(float edge, float4 x); float8 __ovld __cnfn step(float edge, float8 x); float16 __ovld __cnfn step(float edge, float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn step(double edge, double x); double2 __ovld __cnfn step(double2 edge, double2 x); double3 __ovld __cnfn step(double3 edge, double3 x); double4 __ovld __cnfn step(double4 edge, double4 x); double8 __ovld __cnfn step(double8 edge, double8 x); double16 __ovld __cnfn step(double16 edge, double16 x); double2 __ovld __cnfn step(double edge, double2 x); double3 __ovld __cnfn step(double edge, double3 x); double4 __ovld __cnfn step(double edge, double4 x); double8 __ovld __cnfn step(double edge, double8 x); double16 __ovld __cnfn step(double edge, double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn step(half edge, half x); half2 __ovld __cnfn step(half2 edge, half2 x); half3 __ovld __cnfn step(half3 edge, half3 x); half4 __ovld __cnfn step(half4 edge, half4 x); half8 __ovld __cnfn step(half8 edge, half8 x); half16 __ovld __cnfn step(half16 edge, half16 x); half2 __ovld __cnfn step(half edge, half2 x); half3 __ovld __cnfn step(half edge, half3 x); half4 __ovld __cnfn step(half edge, half4 x); half8 __ovld __cnfn step(half edge, half8 x); half16 __ovld __cnfn step(half edge, half16 x); #endif //cl_khr_fp16 /** * Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and * performs smooth Hermite interpolation between 0 * and 1when edge0 < x < edge1. This is useful in * cases where you would want a threshold function * with a smooth transition. * This is equivalent to: * gentype t; * t = clamp ((x - edge0) / (edge1 - edge0), 0, 1); * return t * t * (3 - 2 * t); * Results are undefined if edge0 >= edge1 or if x, * edge0 or edge1 is a NaN. */ float __ovld __cnfn smoothstep(float edge0, float edge1, float x); float2 __ovld __cnfn smoothstep(float2 edge0, float2 edge1, float2 x); float3 __ovld __cnfn smoothstep(float3 edge0, float3 edge1, float3 x); float4 __ovld __cnfn smoothstep(float4 edge0, float4 edge1, float4 x); float8 __ovld __cnfn smoothstep(float8 edge0, float8 edge1, float8 x); float16 __ovld __cnfn smoothstep(float16 edge0, float16 edge1, float16 x); float2 __ovld __cnfn smoothstep(float edge0, float edge1, float2 x); float3 __ovld __cnfn smoothstep(float edge0, float edge1, float3 x); float4 __ovld __cnfn smoothstep(float edge0, float edge1, float4 x); float8 __ovld __cnfn smoothstep(float edge0, float edge1, float8 x); float16 __ovld __cnfn smoothstep(float edge0, float edge1, float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn smoothstep(double edge0, double edge1, double x); double2 __ovld __cnfn smoothstep(double2 edge0, double2 edge1, double2 x); double3 __ovld __cnfn smoothstep(double3 edge0, double3 edge1, double3 x); double4 __ovld __cnfn smoothstep(double4 edge0, double4 edge1, double4 x); double8 __ovld __cnfn smoothstep(double8 edge0, double8 edge1, double8 x); double16 __ovld __cnfn smoothstep(double16 edge0, double16 edge1, double16 x); double2 __ovld __cnfn smoothstep(double edge0, double edge1, double2 x); double3 __ovld __cnfn smoothstep(double edge0, double edge1, double3 x); double4 __ovld __cnfn smoothstep(double edge0, double edge1, double4 x); double8 __ovld __cnfn smoothstep(double edge0, double edge1, double8 x); double16 __ovld __cnfn smoothstep(double edge0, double edge1, double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn smoothstep(half edge0, half edge1, half x); half2 __ovld __cnfn smoothstep(half2 edge0, half2 edge1, half2 x); half3 __ovld __cnfn smoothstep(half3 edge0, half3 edge1, half3 x); half4 __ovld __cnfn smoothstep(half4 edge0, half4 edge1, half4 x); half8 __ovld __cnfn smoothstep(half8 edge0, half8 edge1, half8 x); half16 __ovld __cnfn smoothstep(half16 edge0, half16 edge1, half16 x); half2 __ovld __cnfn smoothstep(half edge0, half edge1, half2 x); half3 __ovld __cnfn smoothstep(half edge0, half edge1, half3 x); half4 __ovld __cnfn smoothstep(half edge0, half edge1, half4 x); half8 __ovld __cnfn smoothstep(half edge0, half edge1, half8 x); half16 __ovld __cnfn smoothstep(half edge0, half edge1, half16 x); #endif //cl_khr_fp16 /** * Returns 1.0 if x > 0, -0.0 if x = -0.0, +0.0 if x = * +0.0, or -1.0 if x < 0. Returns 0.0 if x is a NaN. */ float __ovld __cnfn sign(float x); float2 __ovld __cnfn sign(float2 x); float3 __ovld __cnfn sign(float3 x); float4 __ovld __cnfn sign(float4 x); float8 __ovld __cnfn sign(float8 x); float16 __ovld __cnfn sign(float16 x); #ifdef cl_khr_fp64 double __ovld __cnfn sign(double x); double2 __ovld __cnfn sign(double2 x); double3 __ovld __cnfn sign(double3 x); double4 __ovld __cnfn sign(double4 x); double8 __ovld __cnfn sign(double8 x); double16 __ovld __cnfn sign(double16 x); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn sign(half x); half2 __ovld __cnfn sign(half2 x); half3 __ovld __cnfn sign(half3 x); half4 __ovld __cnfn sign(half4 x); half8 __ovld __cnfn sign(half8 x); half16 __ovld __cnfn sign(half16 x); #endif //cl_khr_fp16 // OpenCL v1.1 s6.11.5, v1.2 s6.12.5, v2.0 s6.13.5 - Geometric Functions /** * Returns the cross product of p0.xyz and p1.xyz. The * w component of float4 result returned will be 0.0. */ float4 __ovld __cnfn cross(float4 p0, float4 p1); float3 __ovld __cnfn cross(float3 p0, float3 p1); #ifdef cl_khr_fp64 double4 __ovld __cnfn cross(double4 p0, double4 p1); double3 __ovld __cnfn cross(double3 p0, double3 p1); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half4 __ovld __cnfn cross(half4 p0, half4 p1); half3 __ovld __cnfn cross(half3 p0, half3 p1); #endif //cl_khr_fp16 /** * Compute dot product. */ float __ovld __cnfn dot(float p0, float p1); float __ovld __cnfn dot(float2 p0, float2 p1); float __ovld __cnfn dot(float3 p0, float3 p1); float __ovld __cnfn dot(float4 p0, float4 p1); #ifdef cl_khr_fp64 double __ovld __cnfn dot(double p0, double p1); double __ovld __cnfn dot(double2 p0, double2 p1); double __ovld __cnfn dot(double3 p0, double3 p1); double __ovld __cnfn dot(double4 p0, double4 p1); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn dot(half p0, half p1); half __ovld __cnfn dot(half2 p0, half2 p1); half __ovld __cnfn dot(half3 p0, half3 p1); half __ovld __cnfn dot(half4 p0, half4 p1); #endif //cl_khr_fp16 /** * Returns the distance between p0 and p1. This is * calculated as length(p0 - p1). */ float __ovld __cnfn distance(float p0, float p1); float __ovld __cnfn distance(float2 p0, float2 p1); float __ovld __cnfn distance(float3 p0, float3 p1); float __ovld __cnfn distance(float4 p0, float4 p1); #ifdef cl_khr_fp64 double __ovld __cnfn distance(double p0, double p1); double __ovld __cnfn distance(double2 p0, double2 p1); double __ovld __cnfn distance(double3 p0, double3 p1); double __ovld __cnfn distance(double4 p0, double4 p1); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn distance(half p0, half p1); half __ovld __cnfn distance(half2 p0, half2 p1); half __ovld __cnfn distance(half3 p0, half3 p1); half __ovld __cnfn distance(half4 p0, half4 p1); #endif //cl_khr_fp16 /** * Return the length of vector p, i.e., * sqrt(p.x2 + p.y 2 + ...) */ float __ovld __cnfn length(float p); float __ovld __cnfn length(float2 p); float __ovld __cnfn length(float3 p); float __ovld __cnfn length(float4 p); #ifdef cl_khr_fp64 double __ovld __cnfn length(double p); double __ovld __cnfn length(double2 p); double __ovld __cnfn length(double3 p); double __ovld __cnfn length(double4 p); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn length(half p); half __ovld __cnfn length(half2 p); half __ovld __cnfn length(half3 p); half __ovld __cnfn length(half4 p); #endif //cl_khr_fp16 /** * Returns a vector in the same direction as p but with a * length of 1. */ float __ovld __cnfn normalize(float p); float2 __ovld __cnfn normalize(float2 p); float3 __ovld __cnfn normalize(float3 p); float4 __ovld __cnfn normalize(float4 p); #ifdef cl_khr_fp64 double __ovld __cnfn normalize(double p); double2 __ovld __cnfn normalize(double2 p); double3 __ovld __cnfn normalize(double3 p); double4 __ovld __cnfn normalize(double4 p); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn normalize(half p); half2 __ovld __cnfn normalize(half2 p); half3 __ovld __cnfn normalize(half3 p); half4 __ovld __cnfn normalize(half4 p); #endif //cl_khr_fp16 /** * Returns fast_length(p0 - p1). */ float __ovld __cnfn fast_distance(float p0, float p1); float __ovld __cnfn fast_distance(float2 p0, float2 p1); float __ovld __cnfn fast_distance(float3 p0, float3 p1); float __ovld __cnfn fast_distance(float4 p0, float4 p1); #ifdef cl_khr_fp16 half __ovld __cnfn fast_distance(half p0, half p1); half __ovld __cnfn fast_distance(half2 p0, half2 p1); half __ovld __cnfn fast_distance(half3 p0, half3 p1); half __ovld __cnfn fast_distance(half4 p0, half4 p1); #endif //cl_khr_fp16 /** * Returns the length of vector p computed as: * half_sqrt(p.x2 + p.y2 + ...) */ float __ovld __cnfn fast_length(float p); float __ovld __cnfn fast_length(float2 p); float __ovld __cnfn fast_length(float3 p); float __ovld __cnfn fast_length(float4 p); #ifdef cl_khr_fp16 half __ovld __cnfn fast_length(half p); half __ovld __cnfn fast_length(half2 p); half __ovld __cnfn fast_length(half3 p); half __ovld __cnfn fast_length(half4 p); #endif //cl_khr_fp16 /** * Returns a vector in the same direction as p but with a * length of 1. fast_normalize is computed as: * p * half_rsqrt (p.x^2 + p.y^2 + ... ) * The result shall be within 8192 ulps error from the * infinitely precise result of * if (all(p == 0.0f)) * result = p; * else * result = p / sqrt (p.x^2 + p.y^2 + ...); * with the following exceptions: * 1) If the sum of squares is greater than FLT_MAX * then the value of the floating-point values in the * result vector are undefined. * 2) If the sum of squares is less than FLT_MIN then * the implementation may return back p. * 3) If the device is in "denorms are flushed to zero" * mode, individual operand elements with magnitude * less than sqrt(FLT_MIN) may be flushed to zero * before proceeding with the calculation. */ float __ovld __cnfn fast_normalize(float p); float2 __ovld __cnfn fast_normalize(float2 p); float3 __ovld __cnfn fast_normalize(float3 p); float4 __ovld __cnfn fast_normalize(float4 p); #ifdef cl_khr_fp16 half __ovld __cnfn fast_normalize(half p); half2 __ovld __cnfn fast_normalize(half2 p); half3 __ovld __cnfn fast_normalize(half3 p); half4 __ovld __cnfn fast_normalize(half4 p); #endif //cl_khr_fp16 // OpenCL v1.1 s6.11.6, v1.2 s6.12.6, v2.0 s6.13.6 - Relational Functions /** * intn isequal (floatn x, floatn y) * Returns the component-wise compare of x == y. */ int __ovld __cnfn isequal(float x, float y); int2 __ovld __cnfn isequal(float2 x, float2 y); int3 __ovld __cnfn isequal(float3 x, float3 y); int4 __ovld __cnfn isequal(float4 x, float4 y); int8 __ovld __cnfn isequal(float8 x, float8 y); int16 __ovld __cnfn isequal(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn isequal(double x, double y); long2 __ovld __cnfn isequal(double2 x, double2 y); long3 __ovld __cnfn isequal(double3 x, double3 y); long4 __ovld __cnfn isequal(double4 x, double4 y); long8 __ovld __cnfn isequal(double8 x, double8 y); long16 __ovld __cnfn isequal(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isequal(half x, half y); short2 __ovld __cnfn isequal(half2 x, half2 y); short3 __ovld __cnfn isequal(half3 x, half3 y); short4 __ovld __cnfn isequal(half4 x, half4 y); short8 __ovld __cnfn isequal(half8 x, half8 y); short16 __ovld __cnfn isequal(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns the component-wise compare of x != y. */ int __ovld __cnfn isnotequal(float x, float y); int2 __ovld __cnfn isnotequal(float2 x, float2 y); int3 __ovld __cnfn isnotequal(float3 x, float3 y); int4 __ovld __cnfn isnotequal(float4 x, float4 y); int8 __ovld __cnfn isnotequal(float8 x, float8 y); int16 __ovld __cnfn isnotequal(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn isnotequal(double x, double y); long2 __ovld __cnfn isnotequal(double2 x, double2 y); long3 __ovld __cnfn isnotequal(double3 x, double3 y); long4 __ovld __cnfn isnotequal(double4 x, double4 y); long8 __ovld __cnfn isnotequal(double8 x, double8 y); long16 __ovld __cnfn isnotequal(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isnotequal(half x, half y); short2 __ovld __cnfn isnotequal(half2 x, half2 y); short3 __ovld __cnfn isnotequal(half3 x, half3 y); short4 __ovld __cnfn isnotequal(half4 x, half4 y); short8 __ovld __cnfn isnotequal(half8 x, half8 y); short16 __ovld __cnfn isnotequal(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns the component-wise compare of x > y. */ int __ovld __cnfn isgreater(float x, float y); int2 __ovld __cnfn isgreater(float2 x, float2 y); int3 __ovld __cnfn isgreater(float3 x, float3 y); int4 __ovld __cnfn isgreater(float4 x, float4 y); int8 __ovld __cnfn isgreater(float8 x, float8 y); int16 __ovld __cnfn isgreater(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn isgreater(double x, double y); long2 __ovld __cnfn isgreater(double2 x, double2 y); long3 __ovld __cnfn isgreater(double3 x, double3 y); long4 __ovld __cnfn isgreater(double4 x, double4 y); long8 __ovld __cnfn isgreater(double8 x, double8 y); long16 __ovld __cnfn isgreater(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isgreater(half x, half y); short2 __ovld __cnfn isgreater(half2 x, half2 y); short3 __ovld __cnfn isgreater(half3 x, half3 y); short4 __ovld __cnfn isgreater(half4 x, half4 y); short8 __ovld __cnfn isgreater(half8 x, half8 y); short16 __ovld __cnfn isgreater(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns the component-wise compare of x >= y. */ int __ovld __cnfn isgreaterequal(float x, float y); int2 __ovld __cnfn isgreaterequal(float2 x, float2 y); int3 __ovld __cnfn isgreaterequal(float3 x, float3 y); int4 __ovld __cnfn isgreaterequal(float4 x, float4 y); int8 __ovld __cnfn isgreaterequal(float8 x, float8 y); int16 __ovld __cnfn isgreaterequal(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn isgreaterequal(double x, double y); long2 __ovld __cnfn isgreaterequal(double2 x, double2 y); long3 __ovld __cnfn isgreaterequal(double3 x, double3 y); long4 __ovld __cnfn isgreaterequal(double4 x, double4 y); long8 __ovld __cnfn isgreaterequal(double8 x, double8 y); long16 __ovld __cnfn isgreaterequal(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isgreaterequal(half x, half y); short2 __ovld __cnfn isgreaterequal(half2 x, half2 y); short3 __ovld __cnfn isgreaterequal(half3 x, half3 y); short4 __ovld __cnfn isgreaterequal(half4 x, half4 y); short8 __ovld __cnfn isgreaterequal(half8 x, half8 y); short16 __ovld __cnfn isgreaterequal(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns the component-wise compare of x < y. */ int __ovld __cnfn isless(float x, float y); int2 __ovld __cnfn isless(float2 x, float2 y); int3 __ovld __cnfn isless(float3 x, float3 y); int4 __ovld __cnfn isless(float4 x, float4 y); int8 __ovld __cnfn isless(float8 x, float8 y); int16 __ovld __cnfn isless(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn isless(double x, double y); long2 __ovld __cnfn isless(double2 x, double2 y); long3 __ovld __cnfn isless(double3 x, double3 y); long4 __ovld __cnfn isless(double4 x, double4 y); long8 __ovld __cnfn isless(double8 x, double8 y); long16 __ovld __cnfn isless(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isless(half x, half y); short2 __ovld __cnfn isless(half2 x, half2 y); short3 __ovld __cnfn isless(half3 x, half3 y); short4 __ovld __cnfn isless(half4 x, half4 y); short8 __ovld __cnfn isless(half8 x, half8 y); short16 __ovld __cnfn isless(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns the component-wise compare of x <= y. */ int __ovld __cnfn islessequal(float x, float y); int2 __ovld __cnfn islessequal(float2 x, float2 y); int3 __ovld __cnfn islessequal(float3 x, float3 y); int4 __ovld __cnfn islessequal(float4 x, float4 y); int8 __ovld __cnfn islessequal(float8 x, float8 y); int16 __ovld __cnfn islessequal(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn islessequal(double x, double y); long2 __ovld __cnfn islessequal(double2 x, double2 y); long3 __ovld __cnfn islessequal(double3 x, double3 y); long4 __ovld __cnfn islessequal(double4 x, double4 y); long8 __ovld __cnfn islessequal(double8 x, double8 y); long16 __ovld __cnfn islessequal(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn islessequal(half x, half y); short2 __ovld __cnfn islessequal(half2 x, half2 y); short3 __ovld __cnfn islessequal(half3 x, half3 y); short4 __ovld __cnfn islessequal(half4 x, half4 y); short8 __ovld __cnfn islessequal(half8 x, half8 y); short16 __ovld __cnfn islessequal(half16 x, half16 y); #endif //cl_khr_fp16 /** * Returns the component-wise compare of * (x < y) || (x > y) . */ int __ovld __cnfn islessgreater(float x, float y); int2 __ovld __cnfn islessgreater(float2 x, float2 y); int3 __ovld __cnfn islessgreater(float3 x, float3 y); int4 __ovld __cnfn islessgreater(float4 x, float4 y); int8 __ovld __cnfn islessgreater(float8 x, float8 y); int16 __ovld __cnfn islessgreater(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn islessgreater(double x, double y); long2 __ovld __cnfn islessgreater(double2 x, double2 y); long3 __ovld __cnfn islessgreater(double3 x, double3 y); long4 __ovld __cnfn islessgreater(double4 x, double4 y); long8 __ovld __cnfn islessgreater(double8 x, double8 y); long16 __ovld __cnfn islessgreater(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn islessgreater(half x, half y); short2 __ovld __cnfn islessgreater(half2 x, half2 y); short3 __ovld __cnfn islessgreater(half3 x, half3 y); short4 __ovld __cnfn islessgreater(half4 x, half4 y); short8 __ovld __cnfn islessgreater(half8 x, half8 y); short16 __ovld __cnfn islessgreater(half16 x, half16 y); #endif //cl_khr_fp16 /** * Test for finite value. */ int __ovld __cnfn isfinite(float); int2 __ovld __cnfn isfinite(float2); int3 __ovld __cnfn isfinite(float3); int4 __ovld __cnfn isfinite(float4); int8 __ovld __cnfn isfinite(float8); int16 __ovld __cnfn isfinite(float16); #ifdef cl_khr_fp64 int __ovld __cnfn isfinite(double); long2 __ovld __cnfn isfinite(double2); long3 __ovld __cnfn isfinite(double3); long4 __ovld __cnfn isfinite(double4); long8 __ovld __cnfn isfinite(double8); long16 __ovld __cnfn isfinite(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isfinite(half); short2 __ovld __cnfn isfinite(half2); short3 __ovld __cnfn isfinite(half3); short4 __ovld __cnfn isfinite(half4); short8 __ovld __cnfn isfinite(half8); short16 __ovld __cnfn isfinite(half16); #endif //cl_khr_fp16 /** * Test for infinity value (+ve or -ve) . */ int __ovld __cnfn isinf(float); int2 __ovld __cnfn isinf(float2); int3 __ovld __cnfn isinf(float3); int4 __ovld __cnfn isinf(float4); int8 __ovld __cnfn isinf(float8); int16 __ovld __cnfn isinf(float16); #ifdef cl_khr_fp64 int __ovld __cnfn isinf(double); long2 __ovld __cnfn isinf(double2); long3 __ovld __cnfn isinf(double3); long4 __ovld __cnfn isinf(double4); long8 __ovld __cnfn isinf(double8); long16 __ovld __cnfn isinf(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isinf(half); short2 __ovld __cnfn isinf(half2); short3 __ovld __cnfn isinf(half3); short4 __ovld __cnfn isinf(half4); short8 __ovld __cnfn isinf(half8); short16 __ovld __cnfn isinf(half16); #endif //cl_khr_fp16 /** * Test for a NaN. */ int __ovld __cnfn isnan(float); int2 __ovld __cnfn isnan(float2); int3 __ovld __cnfn isnan(float3); int4 __ovld __cnfn isnan(float4); int8 __ovld __cnfn isnan(float8); int16 __ovld __cnfn isnan(float16); #ifdef cl_khr_fp64 int __ovld __cnfn isnan(double); long2 __ovld __cnfn isnan(double2); long3 __ovld __cnfn isnan(double3); long4 __ovld __cnfn isnan(double4); long8 __ovld __cnfn isnan(double8); long16 __ovld __cnfn isnan(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isnan(half); short2 __ovld __cnfn isnan(half2); short3 __ovld __cnfn isnan(half3); short4 __ovld __cnfn isnan(half4); short8 __ovld __cnfn isnan(half8); short16 __ovld __cnfn isnan(half16); #endif //cl_khr_fp16 /** * Test for a normal value. */ int __ovld __cnfn isnormal(float); int2 __ovld __cnfn isnormal(float2); int3 __ovld __cnfn isnormal(float3); int4 __ovld __cnfn isnormal(float4); int8 __ovld __cnfn isnormal(float8); int16 __ovld __cnfn isnormal(float16); #ifdef cl_khr_fp64 int __ovld __cnfn isnormal(double); long2 __ovld __cnfn isnormal(double2); long3 __ovld __cnfn isnormal(double3); long4 __ovld __cnfn isnormal(double4); long8 __ovld __cnfn isnormal(double8); long16 __ovld __cnfn isnormal(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isnormal(half); short2 __ovld __cnfn isnormal(half2); short3 __ovld __cnfn isnormal(half3); short4 __ovld __cnfn isnormal(half4); short8 __ovld __cnfn isnormal(half8); short16 __ovld __cnfn isnormal(half16); #endif //cl_khr_fp16 /** * Test if arguments are ordered. isordered() takes * arguments x and y, and returns the result * isequal(x, x) && isequal(y, y). */ int __ovld __cnfn isordered(float x, float y); int2 __ovld __cnfn isordered(float2 x, float2 y); int3 __ovld __cnfn isordered(float3 x, float3 y); int4 __ovld __cnfn isordered(float4 x, float4 y); int8 __ovld __cnfn isordered(float8 x, float8 y); int16 __ovld __cnfn isordered(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn isordered(double x, double y); long2 __ovld __cnfn isordered(double2 x, double2 y); long3 __ovld __cnfn isordered(double3 x, double3 y); long4 __ovld __cnfn isordered(double4 x, double4 y); long8 __ovld __cnfn isordered(double8 x, double8 y); long16 __ovld __cnfn isordered(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isordered(half x, half y); short2 __ovld __cnfn isordered(half2 x, half2 y); short3 __ovld __cnfn isordered(half3 x, half3 y); short4 __ovld __cnfn isordered(half4 x, half4 y); short8 __ovld __cnfn isordered(half8 x, half8 y); short16 __ovld __cnfn isordered(half16 x, half16 y); #endif //cl_khr_fp16 /** * Test if arguments are unordered. isunordered() * takes arguments x and y, returning non-zero if x or y * is NaN, and zero otherwise. */ int __ovld __cnfn isunordered(float x, float y); int2 __ovld __cnfn isunordered(float2 x, float2 y); int3 __ovld __cnfn isunordered(float3 x, float3 y); int4 __ovld __cnfn isunordered(float4 x, float4 y); int8 __ovld __cnfn isunordered(float8 x, float8 y); int16 __ovld __cnfn isunordered(float16 x, float16 y); #ifdef cl_khr_fp64 int __ovld __cnfn isunordered(double x, double y); long2 __ovld __cnfn isunordered(double2 x, double2 y); long3 __ovld __cnfn isunordered(double3 x, double3 y); long4 __ovld __cnfn isunordered(double4 x, double4 y); long8 __ovld __cnfn isunordered(double8 x, double8 y); long16 __ovld __cnfn isunordered(double16 x, double16 y); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn isunordered(half x, half y); short2 __ovld __cnfn isunordered(half2 x, half2 y); short3 __ovld __cnfn isunordered(half3 x, half3 y); short4 __ovld __cnfn isunordered(half4 x, half4 y); short8 __ovld __cnfn isunordered(half8 x, half8 y); short16 __ovld __cnfn isunordered(half16 x, half16 y); #endif //cl_khr_fp16 /** * Test for sign bit. The scalar version of the function * returns a 1 if the sign bit in the float is set else returns * 0. The vector version of the function returns the * following for each component in floatn: a -1 if the * sign bit in the float is set else returns 0. */ int __ovld __cnfn signbit(float); int2 __ovld __cnfn signbit(float2); int3 __ovld __cnfn signbit(float3); int4 __ovld __cnfn signbit(float4); int8 __ovld __cnfn signbit(float8); int16 __ovld __cnfn signbit(float16); #ifdef cl_khr_fp64 int __ovld __cnfn signbit(double); long2 __ovld __cnfn signbit(double2); long3 __ovld __cnfn signbit(double3); long4 __ovld __cnfn signbit(double4); long8 __ovld __cnfn signbit(double8); long16 __ovld __cnfn signbit(double16); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 int __ovld __cnfn signbit(half); short2 __ovld __cnfn signbit(half2); short3 __ovld __cnfn signbit(half3); short4 __ovld __cnfn signbit(half4); short8 __ovld __cnfn signbit(half8); short16 __ovld __cnfn signbit(half16); #endif //cl_khr_fp16 /** * Returns 1 if the most significant bit in any component * of x is set; otherwise returns 0. */ int __ovld __cnfn any(char x); int __ovld __cnfn any(char2 x); int __ovld __cnfn any(char3 x); int __ovld __cnfn any(char4 x); int __ovld __cnfn any(char8 x); int __ovld __cnfn any(char16 x); int __ovld __cnfn any(short x); int __ovld __cnfn any(short2 x); int __ovld __cnfn any(short3 x); int __ovld __cnfn any(short4 x); int __ovld __cnfn any(short8 x); int __ovld __cnfn any(short16 x); int __ovld __cnfn any(int x); int __ovld __cnfn any(int2 x); int __ovld __cnfn any(int3 x); int __ovld __cnfn any(int4 x); int __ovld __cnfn any(int8 x); int __ovld __cnfn any(int16 x); int __ovld __cnfn any(long x); int __ovld __cnfn any(long2 x); int __ovld __cnfn any(long3 x); int __ovld __cnfn any(long4 x); int __ovld __cnfn any(long8 x); int __ovld __cnfn any(long16 x); /** * Returns 1 if the most significant bit in all components * of x is set; otherwise returns 0. */ int __ovld __cnfn all(char x); int __ovld __cnfn all(char2 x); int __ovld __cnfn all(char3 x); int __ovld __cnfn all(char4 x); int __ovld __cnfn all(char8 x); int __ovld __cnfn all(char16 x); int __ovld __cnfn all(short x); int __ovld __cnfn all(short2 x); int __ovld __cnfn all(short3 x); int __ovld __cnfn all(short4 x); int __ovld __cnfn all(short8 x); int __ovld __cnfn all(short16 x); int __ovld __cnfn all(int x); int __ovld __cnfn all(int2 x); int __ovld __cnfn all(int3 x); int __ovld __cnfn all(int4 x); int __ovld __cnfn all(int8 x); int __ovld __cnfn all(int16 x); int __ovld __cnfn all(long x); int __ovld __cnfn all(long2 x); int __ovld __cnfn all(long3 x); int __ovld __cnfn all(long4 x); int __ovld __cnfn all(long8 x); int __ovld __cnfn all(long16 x); /** * Each bit of the result is the corresponding bit of a if * the corresponding bit of c is 0. Otherwise it is the * corresponding bit of b. */ char __ovld __cnfn bitselect(char a, char b, char c); uchar __ovld __cnfn bitselect(uchar a, uchar b, uchar c); char2 __ovld __cnfn bitselect(char2 a, char2 b, char2 c); uchar2 __ovld __cnfn bitselect(uchar2 a, uchar2 b, uchar2 c); char3 __ovld __cnfn bitselect(char3 a, char3 b, char3 c); uchar3 __ovld __cnfn bitselect(uchar3 a, uchar3 b, uchar3 c); char4 __ovld __cnfn bitselect(char4 a, char4 b, char4 c); uchar4 __ovld __cnfn bitselect(uchar4 a, uchar4 b, uchar4 c); char8 __ovld __cnfn bitselect(char8 a, char8 b, char8 c); uchar8 __ovld __cnfn bitselect(uchar8 a, uchar8 b, uchar8 c); char16 __ovld __cnfn bitselect(char16 a, char16 b, char16 c); uchar16 __ovld __cnfn bitselect(uchar16 a, uchar16 b, uchar16 c); short __ovld __cnfn bitselect(short a, short b, short c); ushort __ovld __cnfn bitselect(ushort a, ushort b, ushort c); short2 __ovld __cnfn bitselect(short2 a, short2 b, short2 c); ushort2 __ovld __cnfn bitselect(ushort2 a, ushort2 b, ushort2 c); short3 __ovld __cnfn bitselect(short3 a, short3 b, short3 c); ushort3 __ovld __cnfn bitselect(ushort3 a, ushort3 b, ushort3 c); short4 __ovld __cnfn bitselect(short4 a, short4 b, short4 c); ushort4 __ovld __cnfn bitselect(ushort4 a, ushort4 b, ushort4 c); short8 __ovld __cnfn bitselect(short8 a, short8 b, short8 c); ushort8 __ovld __cnfn bitselect(ushort8 a, ushort8 b, ushort8 c); short16 __ovld __cnfn bitselect(short16 a, short16 b, short16 c); ushort16 __ovld __cnfn bitselect(ushort16 a, ushort16 b, ushort16 c); int __ovld __cnfn bitselect(int a, int b, int c); uint __ovld __cnfn bitselect(uint a, uint b, uint c); int2 __ovld __cnfn bitselect(int2 a, int2 b, int2 c); uint2 __ovld __cnfn bitselect(uint2 a, uint2 b, uint2 c); int3 __ovld __cnfn bitselect(int3 a, int3 b, int3 c); uint3 __ovld __cnfn bitselect(uint3 a, uint3 b, uint3 c); int4 __ovld __cnfn bitselect(int4 a, int4 b, int4 c); uint4 __ovld __cnfn bitselect(uint4 a, uint4 b, uint4 c); int8 __ovld __cnfn bitselect(int8 a, int8 b, int8 c); uint8 __ovld __cnfn bitselect(uint8 a, uint8 b, uint8 c); int16 __ovld __cnfn bitselect(int16 a, int16 b, int16 c); uint16 __ovld __cnfn bitselect(uint16 a, uint16 b, uint16 c); long __ovld __cnfn bitselect(long a, long b, long c); ulong __ovld __cnfn bitselect(ulong a, ulong b, ulong c); long2 __ovld __cnfn bitselect(long2 a, long2 b, long2 c); ulong2 __ovld __cnfn bitselect(ulong2 a, ulong2 b, ulong2 c); long3 __ovld __cnfn bitselect(long3 a, long3 b, long3 c); ulong3 __ovld __cnfn bitselect(ulong3 a, ulong3 b, ulong3 c); long4 __ovld __cnfn bitselect(long4 a, long4 b, long4 c); ulong4 __ovld __cnfn bitselect(ulong4 a, ulong4 b, ulong4 c); long8 __ovld __cnfn bitselect(long8 a, long8 b, long8 c); ulong8 __ovld __cnfn bitselect(ulong8 a, ulong8 b, ulong8 c); long16 __ovld __cnfn bitselect(long16 a, long16 b, long16 c); ulong16 __ovld __cnfn bitselect(ulong16 a, ulong16 b, ulong16 c); float __ovld __cnfn bitselect(float a, float b, float c); float2 __ovld __cnfn bitselect(float2 a, float2 b, float2 c); float3 __ovld __cnfn bitselect(float3 a, float3 b, float3 c); float4 __ovld __cnfn bitselect(float4 a, float4 b, float4 c); float8 __ovld __cnfn bitselect(float8 a, float8 b, float8 c); float16 __ovld __cnfn bitselect(float16 a, float16 b, float16 c); #ifdef cl_khr_fp64 double __ovld __cnfn bitselect(double a, double b, double c); double2 __ovld __cnfn bitselect(double2 a, double2 b, double2 c); double3 __ovld __cnfn bitselect(double3 a, double3 b, double3 c); double4 __ovld __cnfn bitselect(double4 a, double4 b, double4 c); double8 __ovld __cnfn bitselect(double8 a, double8 b, double8 c); double16 __ovld __cnfn bitselect(double16 a, double16 b, double16 c); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn bitselect(half a, half b, half c); half2 __ovld __cnfn bitselect(half2 a, half2 b, half2 c); half3 __ovld __cnfn bitselect(half3 a, half3 b, half3 c); half4 __ovld __cnfn bitselect(half4 a, half4 b, half4 c); half8 __ovld __cnfn bitselect(half8 a, half8 b, half8 c); half16 __ovld __cnfn bitselect(half16 a, half16 b, half16 c); #endif //cl_khr_fp16 /** * For each component of a vector type, * result[i] = if MSB of c[i] is set ? b[i] : a[i]. * For a scalar type, result = c ? b : a. * b and a must have the same type. * c must have the same number of elements and bits as a. */ char __ovld __cnfn select(char a, char b, char c); uchar __ovld __cnfn select(uchar a, uchar b, char c); char2 __ovld __cnfn select(char2 a, char2 b, char2 c); uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, char2 c); char3 __ovld __cnfn select(char3 a, char3 b, char3 c); uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, char3 c); char4 __ovld __cnfn select(char4 a, char4 b, char4 c); uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, char4 c); char8 __ovld __cnfn select(char8 a, char8 b, char8 c); uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, char8 c); char16 __ovld __cnfn select(char16 a, char16 b, char16 c); uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, char16 c); short __ovld __cnfn select(short a, short b, short c); ushort __ovld __cnfn select(ushort a, ushort b, short c); short2 __ovld __cnfn select(short2 a, short2 b, short2 c); ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, short2 c); short3 __ovld __cnfn select(short3 a, short3 b, short3 c); ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, short3 c); short4 __ovld __cnfn select(short4 a, short4 b, short4 c); ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, short4 c); short8 __ovld __cnfn select(short8 a, short8 b, short8 c); ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, short8 c); short16 __ovld __cnfn select(short16 a, short16 b, short16 c); ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, short16 c); int __ovld __cnfn select(int a, int b, int c); uint __ovld __cnfn select(uint a, uint b, int c); int2 __ovld __cnfn select(int2 a, int2 b, int2 c); uint2 __ovld __cnfn select(uint2 a, uint2 b, int2 c); int3 __ovld __cnfn select(int3 a, int3 b, int3 c); uint3 __ovld __cnfn select(uint3 a, uint3 b, int3 c); int4 __ovld __cnfn select(int4 a, int4 b, int4 c); uint4 __ovld __cnfn select(uint4 a, uint4 b, int4 c); int8 __ovld __cnfn select(int8 a, int8 b, int8 c); uint8 __ovld __cnfn select(uint8 a, uint8 b, int8 c); int16 __ovld __cnfn select(int16 a, int16 b, int16 c); uint16 __ovld __cnfn select(uint16 a, uint16 b, int16 c); float __ovld __cnfn select(float a, float b, int c); float2 __ovld __cnfn select(float2 a, float2 b, int2 c); float3 __ovld __cnfn select(float3 a, float3 b, int3 c); float4 __ovld __cnfn select(float4 a, float4 b, int4 c); float8 __ovld __cnfn select(float8 a, float8 b, int8 c); float16 __ovld __cnfn select(float16 a, float16 b, int16 c); long __ovld __cnfn select(long a, long b, long c); ulong __ovld __cnfn select(ulong a, ulong b, long c); long2 __ovld __cnfn select(long2 a, long2 b, long2 c); ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, long2 c); long3 __ovld __cnfn select(long3 a, long3 b, long3 c); ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, long3 c); long4 __ovld __cnfn select(long4 a, long4 b, long4 c); ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, long4 c); long8 __ovld __cnfn select(long8 a, long8 b, long8 c); ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, long8 c); long16 __ovld __cnfn select(long16 a, long16 b, long16 c); ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, long16 c); char __ovld __cnfn select(char a, char b, uchar c); uchar __ovld __cnfn select(uchar a, uchar b, uchar c); char2 __ovld __cnfn select(char2 a, char2 b, uchar2 c); uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, uchar2 c); char3 __ovld __cnfn select(char3 a, char3 b, uchar3 c); uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, uchar3 c); char4 __ovld __cnfn select(char4 a, char4 b, uchar4 c); uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, uchar4 c); char8 __ovld __cnfn select(char8 a, char8 b, uchar8 c); uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, uchar8 c); char16 __ovld __cnfn select(char16 a, char16 b, uchar16 c); uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, uchar16 c); short __ovld __cnfn select(short a, short b, ushort c); ushort __ovld __cnfn select(ushort a, ushort b, ushort c); short2 __ovld __cnfn select(short2 a, short2 b, ushort2 c); ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, ushort2 c); short3 __ovld __cnfn select(short3 a, short3 b, ushort3 c); ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, ushort3 c); short4 __ovld __cnfn select(short4 a, short4 b, ushort4 c); ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, ushort4 c); short8 __ovld __cnfn select(short8 a, short8 b, ushort8 c); ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, ushort8 c); short16 __ovld __cnfn select(short16 a, short16 b, ushort16 c); ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, ushort16 c); int __ovld __cnfn select(int a, int b, uint c); uint __ovld __cnfn select(uint a, uint b, uint c); int2 __ovld __cnfn select(int2 a, int2 b, uint2 c); uint2 __ovld __cnfn select(uint2 a, uint2 b, uint2 c); int3 __ovld __cnfn select(int3 a, int3 b, uint3 c); uint3 __ovld __cnfn select(uint3 a, uint3 b, uint3 c); int4 __ovld __cnfn select(int4 a, int4 b, uint4 c); uint4 __ovld __cnfn select(uint4 a, uint4 b, uint4 c); int8 __ovld __cnfn select(int8 a, int8 b, uint8 c); uint8 __ovld __cnfn select(uint8 a, uint8 b, uint8 c); int16 __ovld __cnfn select(int16 a, int16 b, uint16 c); uint16 __ovld __cnfn select(uint16 a, uint16 b, uint16 c); float __ovld __cnfn select(float a, float b, uint c); float2 __ovld __cnfn select(float2 a, float2 b, uint2 c); float3 __ovld __cnfn select(float3 a, float3 b, uint3 c); float4 __ovld __cnfn select(float4 a, float4 b, uint4 c); float8 __ovld __cnfn select(float8 a, float8 b, uint8 c); float16 __ovld __cnfn select(float16 a, float16 b, uint16 c); long __ovld __cnfn select(long a, long b, ulong c); ulong __ovld __cnfn select(ulong a, ulong b, ulong c); long2 __ovld __cnfn select(long2 a, long2 b, ulong2 c); ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, ulong2 c); long3 __ovld __cnfn select(long3 a, long3 b, ulong3 c); ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, ulong3 c); long4 __ovld __cnfn select(long4 a, long4 b, ulong4 c); ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, ulong4 c); long8 __ovld __cnfn select(long8 a, long8 b, ulong8 c); ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, ulong8 c); long16 __ovld __cnfn select(long16 a, long16 b, ulong16 c); ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, ulong16 c); #ifdef cl_khr_fp64 double __ovld __cnfn select(double a, double b, long c); double2 __ovld __cnfn select(double2 a, double2 b, long2 c); double3 __ovld __cnfn select(double3 a, double3 b, long3 c); double4 __ovld __cnfn select(double4 a, double4 b, long4 c); double8 __ovld __cnfn select(double8 a, double8 b, long8 c); double16 __ovld __cnfn select(double16 a, double16 b, long16 c); double __ovld __cnfn select(double a, double b, ulong c); double2 __ovld __cnfn select(double2 a, double2 b, ulong2 c); double3 __ovld __cnfn select(double3 a, double3 b, ulong3 c); double4 __ovld __cnfn select(double4 a, double4 b, ulong4 c); double8 __ovld __cnfn select(double8 a, double8 b, ulong8 c); double16 __ovld __cnfn select(double16 a, double16 b, ulong16 c); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __cnfn select(half a, half b, short c); half2 __ovld __cnfn select(half2 a, half2 b, short2 c); half3 __ovld __cnfn select(half3 a, half3 b, short3 c); half4 __ovld __cnfn select(half4 a, half4 b, short4 c); half8 __ovld __cnfn select(half8 a, half8 b, short8 c); half16 __ovld __cnfn select(half16 a, half16 b, short16 c); half __ovld __cnfn select(half a, half b, ushort c); half2 __ovld __cnfn select(half2 a, half2 b, ushort2 c); half3 __ovld __cnfn select(half3 a, half3 b, ushort3 c); half4 __ovld __cnfn select(half4 a, half4 b, ushort4 c); half8 __ovld __cnfn select(half8 a, half8 b, ushort8 c); half16 __ovld __cnfn select(half16 a, half16 b, ushort16 c); #endif //cl_khr_fp16 // OpenCL v1.1 s6.11.7, v1.2 s6.12.7, v2.0 s6.13.7 - Vector Data Load and Store Functions // OpenCL extensions v1.1 s9.6.6, v1.2 s9.5.6, v2.0 s9.4.6 - Vector Data Load and Store Functions for Half Type /** * Use generic type gentype to indicate the built-in data types * char, uchar, short, ushort, int, uint, long, ulong, float, * double or half. * * vloadn return sizeof (gentypen) bytes of data read from address (p + (offset * n)). * * vstoren write sizeof (gentypen) bytes given by data to address (p + (offset * n)). * * The address computed as (p + (offset * n)) must be * 8-bit aligned if gentype is char, uchar; * 16-bit aligned if gentype is short, ushort, half; * 32-bit aligned if gentype is int, uint, float; * 64-bit aligned if gentype is long, ulong, double. */ char2 __ovld vload2(size_t offset, const __constant char *p); uchar2 __ovld vload2(size_t offset, const __constant uchar *p); short2 __ovld vload2(size_t offset, const __constant short *p); ushort2 __ovld vload2(size_t offset, const __constant ushort *p); int2 __ovld vload2(size_t offset, const __constant int *p); uint2 __ovld vload2(size_t offset, const __constant uint *p); long2 __ovld vload2(size_t offset, const __constant long *p); ulong2 __ovld vload2(size_t offset, const __constant ulong *p); float2 __ovld vload2(size_t offset, const __constant float *p); char3 __ovld vload3(size_t offset, const __constant char *p); uchar3 __ovld vload3(size_t offset, const __constant uchar *p); short3 __ovld vload3(size_t offset, const __constant short *p); ushort3 __ovld vload3(size_t offset, const __constant ushort *p); int3 __ovld vload3(size_t offset, const __constant int *p); uint3 __ovld vload3(size_t offset, const __constant uint *p); long3 __ovld vload3(size_t offset, const __constant long *p); ulong3 __ovld vload3(size_t offset, const __constant ulong *p); float3 __ovld vload3(size_t offset, const __constant float *p); char4 __ovld vload4(size_t offset, const __constant char *p); uchar4 __ovld vload4(size_t offset, const __constant uchar *p); short4 __ovld vload4(size_t offset, const __constant short *p); ushort4 __ovld vload4(size_t offset, const __constant ushort *p); int4 __ovld vload4(size_t offset, const __constant int *p); uint4 __ovld vload4(size_t offset, const __constant uint *p); long4 __ovld vload4(size_t offset, const __constant long *p); ulong4 __ovld vload4(size_t offset, const __constant ulong *p); float4 __ovld vload4(size_t offset, const __constant float *p); char8 __ovld vload8(size_t offset, const __constant char *p); uchar8 __ovld vload8(size_t offset, const __constant uchar *p); short8 __ovld vload8(size_t offset, const __constant short *p); ushort8 __ovld vload8(size_t offset, const __constant ushort *p); int8 __ovld vload8(size_t offset, const __constant int *p); uint8 __ovld vload8(size_t offset, const __constant uint *p); long8 __ovld vload8(size_t offset, const __constant long *p); ulong8 __ovld vload8(size_t offset, const __constant ulong *p); float8 __ovld vload8(size_t offset, const __constant float *p); char16 __ovld vload16(size_t offset, const __constant char *p); uchar16 __ovld vload16(size_t offset, const __constant uchar *p); short16 __ovld vload16(size_t offset, const __constant short *p); ushort16 __ovld vload16(size_t offset, const __constant ushort *p); int16 __ovld vload16(size_t offset, const __constant int *p); uint16 __ovld vload16(size_t offset, const __constant uint *p); long16 __ovld vload16(size_t offset, const __constant long *p); ulong16 __ovld vload16(size_t offset, const __constant ulong *p); float16 __ovld vload16(size_t offset, const __constant float *p); #ifdef cl_khr_fp64 double2 __ovld vload2(size_t offset, const __constant double *p); double3 __ovld vload3(size_t offset, const __constant double *p); double4 __ovld vload4(size_t offset, const __constant double *p); double8 __ovld vload8(size_t offset, const __constant double *p); double16 __ovld vload16(size_t offset, const __constant double *p); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld vload(size_t offset, const __constant half *p); half2 __ovld vload2(size_t offset, const __constant half *p); half3 __ovld vload3(size_t offset, const __constant half *p); half4 __ovld vload4(size_t offset, const __constant half *p); half8 __ovld vload8(size_t offset, const __constant half *p); half16 __ovld vload16(size_t offset, const __constant half *p); #endif //cl_khr_fp16 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) char2 __ovld vload2(size_t offset, const char *p); uchar2 __ovld vload2(size_t offset, const uchar *p); short2 __ovld vload2(size_t offset, const short *p); ushort2 __ovld vload2(size_t offset, const ushort *p); int2 __ovld vload2(size_t offset, const int *p); uint2 __ovld vload2(size_t offset, const uint *p); long2 __ovld vload2(size_t offset, const long *p); ulong2 __ovld vload2(size_t offset, const ulong *p); float2 __ovld vload2(size_t offset, const float *p); char3 __ovld vload3(size_t offset, const char *p); uchar3 __ovld vload3(size_t offset, const uchar *p); short3 __ovld vload3(size_t offset, const short *p); ushort3 __ovld vload3(size_t offset, const ushort *p); int3 __ovld vload3(size_t offset, const int *p); uint3 __ovld vload3(size_t offset, const uint *p); long3 __ovld vload3(size_t offset, const long *p); ulong3 __ovld vload3(size_t offset, const ulong *p); float3 __ovld vload3(size_t offset, const float *p); char4 __ovld vload4(size_t offset, const char *p); uchar4 __ovld vload4(size_t offset, const uchar *p); short4 __ovld vload4(size_t offset, const short *p); ushort4 __ovld vload4(size_t offset, const ushort *p); int4 __ovld vload4(size_t offset, const int *p); uint4 __ovld vload4(size_t offset, const uint *p); long4 __ovld vload4(size_t offset, const long *p); ulong4 __ovld vload4(size_t offset, const ulong *p); float4 __ovld vload4(size_t offset, const float *p); char8 __ovld vload8(size_t offset, const char *p); uchar8 __ovld vload8(size_t offset, const uchar *p); short8 __ovld vload8(size_t offset, const short *p); ushort8 __ovld vload8(size_t offset, const ushort *p); int8 __ovld vload8(size_t offset, const int *p); uint8 __ovld vload8(size_t offset, const uint *p); long8 __ovld vload8(size_t offset, const long *p); ulong8 __ovld vload8(size_t offset, const ulong *p); float8 __ovld vload8(size_t offset, const float *p); char16 __ovld vload16(size_t offset, const char *p); uchar16 __ovld vload16(size_t offset, const uchar *p); short16 __ovld vload16(size_t offset, const short *p); ushort16 __ovld vload16(size_t offset, const ushort *p); int16 __ovld vload16(size_t offset, const int *p); uint16 __ovld vload16(size_t offset, const uint *p); long16 __ovld vload16(size_t offset, const long *p); ulong16 __ovld vload16(size_t offset, const ulong *p); float16 __ovld vload16(size_t offset, const float *p); #ifdef cl_khr_fp64 double2 __ovld vload2(size_t offset, const double *p); double3 __ovld vload3(size_t offset, const double *p); double4 __ovld vload4(size_t offset, const double *p); double8 __ovld vload8(size_t offset, const double *p); double16 __ovld vload16(size_t offset, const double *p); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld vload(size_t offset, const half *p); half2 __ovld vload2(size_t offset, const half *p); half3 __ovld vload3(size_t offset, const half *p); half4 __ovld vload4(size_t offset, const half *p); half8 __ovld vload8(size_t offset, const half *p); half16 __ovld vload16(size_t offset, const half *p); #endif //cl_khr_fp16 #else char2 __ovld vload2(size_t offset, const __global char *p); uchar2 __ovld vload2(size_t offset, const __global uchar *p); short2 __ovld vload2(size_t offset, const __global short *p); ushort2 __ovld vload2(size_t offset, const __global ushort *p); int2 __ovld vload2(size_t offset, const __global int *p); uint2 __ovld vload2(size_t offset, const __global uint *p); long2 __ovld vload2(size_t offset, const __global long *p); ulong2 __ovld vload2(size_t offset, const __global ulong *p); float2 __ovld vload2(size_t offset, const __global float *p); char3 __ovld vload3(size_t offset, const __global char *p); uchar3 __ovld vload3(size_t offset, const __global uchar *p); short3 __ovld vload3(size_t offset, const __global short *p); ushort3 __ovld vload3(size_t offset, const __global ushort *p); int3 __ovld vload3(size_t offset, const __global int *p); uint3 __ovld vload3(size_t offset, const __global uint *p); long3 __ovld vload3(size_t offset, const __global long *p); ulong3 __ovld vload3(size_t offset, const __global ulong *p); float3 __ovld vload3(size_t offset, const __global float *p); char4 __ovld vload4(size_t offset, const __global char *p); uchar4 __ovld vload4(size_t offset, const __global uchar *p); short4 __ovld vload4(size_t offset, const __global short *p); ushort4 __ovld vload4(size_t offset, const __global ushort *p); int4 __ovld vload4(size_t offset, const __global int *p); uint4 __ovld vload4(size_t offset, const __global uint *p); long4 __ovld vload4(size_t offset, const __global long *p); ulong4 __ovld vload4(size_t offset, const __global ulong *p); float4 __ovld vload4(size_t offset, const __global float *p); char8 __ovld vload8(size_t offset, const __global char *p); uchar8 __ovld vload8(size_t offset, const __global uchar *p); short8 __ovld vload8(size_t offset, const __global short *p); ushort8 __ovld vload8(size_t offset, const __global ushort *p); int8 __ovld vload8(size_t offset, const __global int *p); uint8 __ovld vload8(size_t offset, const __global uint *p); long8 __ovld vload8(size_t offset, const __global long *p); ulong8 __ovld vload8(size_t offset, const __global ulong *p); float8 __ovld vload8(size_t offset, const __global float *p); char16 __ovld vload16(size_t offset, const __global char *p); uchar16 __ovld vload16(size_t offset, const __global uchar *p); short16 __ovld vload16(size_t offset, const __global short *p); ushort16 __ovld vload16(size_t offset, const __global ushort *p); int16 __ovld vload16(size_t offset, const __global int *p); uint16 __ovld vload16(size_t offset, const __global uint *p); long16 __ovld vload16(size_t offset, const __global long *p); ulong16 __ovld vload16(size_t offset, const __global ulong *p); float16 __ovld vload16(size_t offset, const __global float *p); char2 __ovld vload2(size_t offset, const __local char *p); uchar2 __ovld vload2(size_t offset, const __local uchar *p); short2 __ovld vload2(size_t offset, const __local short *p); ushort2 __ovld vload2(size_t offset, const __local ushort *p); int2 __ovld vload2(size_t offset, const __local int *p); uint2 __ovld vload2(size_t offset, const __local uint *p); long2 __ovld vload2(size_t offset, const __local long *p); ulong2 __ovld vload2(size_t offset, const __local ulong *p); float2 __ovld vload2(size_t offset, const __local float *p); char3 __ovld vload3(size_t offset, const __local char *p); uchar3 __ovld vload3(size_t offset, const __local uchar *p); short3 __ovld vload3(size_t offset, const __local short *p); ushort3 __ovld vload3(size_t offset, const __local ushort *p); int3 __ovld vload3(size_t offset, const __local int *p); uint3 __ovld vload3(size_t offset, const __local uint *p); long3 __ovld vload3(size_t offset, const __local long *p); ulong3 __ovld vload3(size_t offset, const __local ulong *p); float3 __ovld vload3(size_t offset, const __local float *p); char4 __ovld vload4(size_t offset, const __local char *p); uchar4 __ovld vload4(size_t offset, const __local uchar *p); short4 __ovld vload4(size_t offset, const __local short *p); ushort4 __ovld vload4(size_t offset, const __local ushort *p); int4 __ovld vload4(size_t offset, const __local int *p); uint4 __ovld vload4(size_t offset, const __local uint *p); long4 __ovld vload4(size_t offset, const __local long *p); ulong4 __ovld vload4(size_t offset, const __local ulong *p); float4 __ovld vload4(size_t offset, const __local float *p); char8 __ovld vload8(size_t offset, const __local char *p); uchar8 __ovld vload8(size_t offset, const __local uchar *p); short8 __ovld vload8(size_t offset, const __local short *p); ushort8 __ovld vload8(size_t offset, const __local ushort *p); int8 __ovld vload8(size_t offset, const __local int *p); uint8 __ovld vload8(size_t offset, const __local uint *p); long8 __ovld vload8(size_t offset, const __local long *p); ulong8 __ovld vload8(size_t offset, const __local ulong *p); float8 __ovld vload8(size_t offset, const __local float *p); char16 __ovld vload16(size_t offset, const __local char *p); uchar16 __ovld vload16(size_t offset, const __local uchar *p); short16 __ovld vload16(size_t offset, const __local short *p); ushort16 __ovld vload16(size_t offset, const __local ushort *p); int16 __ovld vload16(size_t offset, const __local int *p); uint16 __ovld vload16(size_t offset, const __local uint *p); long16 __ovld vload16(size_t offset, const __local long *p); ulong16 __ovld vload16(size_t offset, const __local ulong *p); float16 __ovld vload16(size_t offset, const __local float *p); char2 __ovld vload2(size_t offset, const __private char *p); uchar2 __ovld vload2(size_t offset, const __private uchar *p); short2 __ovld vload2(size_t offset, const __private short *p); ushort2 __ovld vload2(size_t offset, const __private ushort *p); int2 __ovld vload2(size_t offset, const __private int *p); uint2 __ovld vload2(size_t offset, const __private uint *p); long2 __ovld vload2(size_t offset, const __private long *p); ulong2 __ovld vload2(size_t offset, const __private ulong *p); float2 __ovld vload2(size_t offset, const __private float *p); char3 __ovld vload3(size_t offset, const __private char *p); uchar3 __ovld vload3(size_t offset, const __private uchar *p); short3 __ovld vload3(size_t offset, const __private short *p); ushort3 __ovld vload3(size_t offset, const __private ushort *p); int3 __ovld vload3(size_t offset, const __private int *p); uint3 __ovld vload3(size_t offset, const __private uint *p); long3 __ovld vload3(size_t offset, const __private long *p); ulong3 __ovld vload3(size_t offset, const __private ulong *p); float3 __ovld vload3(size_t offset, const __private float *p); char4 __ovld vload4(size_t offset, const __private char *p); uchar4 __ovld vload4(size_t offset, const __private uchar *p); short4 __ovld vload4(size_t offset, const __private short *p); ushort4 __ovld vload4(size_t offset, const __private ushort *p); int4 __ovld vload4(size_t offset, const __private int *p); uint4 __ovld vload4(size_t offset, const __private uint *p); long4 __ovld vload4(size_t offset, const __private long *p); ulong4 __ovld vload4(size_t offset, const __private ulong *p); float4 __ovld vload4(size_t offset, const __private float *p); char8 __ovld vload8(size_t offset, const __private char *p); uchar8 __ovld vload8(size_t offset, const __private uchar *p); short8 __ovld vload8(size_t offset, const __private short *p); ushort8 __ovld vload8(size_t offset, const __private ushort *p); int8 __ovld vload8(size_t offset, const __private int *p); uint8 __ovld vload8(size_t offset, const __private uint *p); long8 __ovld vload8(size_t offset, const __private long *p); ulong8 __ovld vload8(size_t offset, const __private ulong *p); float8 __ovld vload8(size_t offset, const __private float *p); char16 __ovld vload16(size_t offset, const __private char *p); uchar16 __ovld vload16(size_t offset, const __private uchar *p); short16 __ovld vload16(size_t offset, const __private short *p); ushort16 __ovld vload16(size_t offset, const __private ushort *p); int16 __ovld vload16(size_t offset, const __private int *p); uint16 __ovld vload16(size_t offset, const __private uint *p); long16 __ovld vload16(size_t offset, const __private long *p); ulong16 __ovld vload16(size_t offset, const __private ulong *p); float16 __ovld vload16(size_t offset, const __private float *p); #ifdef cl_khr_fp64 double2 __ovld vload2(size_t offset, const __global double *p); double3 __ovld vload3(size_t offset, const __global double *p); double4 __ovld vload4(size_t offset, const __global double *p); double8 __ovld vload8(size_t offset, const __global double *p); double16 __ovld vload16(size_t offset, const __global double *p); double2 __ovld vload2(size_t offset, const __local double *p); double3 __ovld vload3(size_t offset, const __local double *p); double4 __ovld vload4(size_t offset, const __local double *p); double8 __ovld vload8(size_t offset, const __local double *p); double16 __ovld vload16(size_t offset, const __local double *p); double2 __ovld vload2(size_t offset, const __private double *p); double3 __ovld vload3(size_t offset, const __private double *p); double4 __ovld vload4(size_t offset, const __private double *p); double8 __ovld vload8(size_t offset, const __private double *p); double16 __ovld vload16(size_t offset, const __private double *p); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld vload(size_t offset, const __global half *p); half2 __ovld vload2(size_t offset, const __global half *p); half3 __ovld vload3(size_t offset, const __global half *p); half4 __ovld vload4(size_t offset, const __global half *p); half8 __ovld vload8(size_t offset, const __global half *p); half16 __ovld vload16(size_t offset, const __global half *p); half __ovld vload(size_t offset, const __local half *p); half2 __ovld vload2(size_t offset, const __local half *p); half3 __ovld vload3(size_t offset, const __local half *p); half4 __ovld vload4(size_t offset, const __local half *p); half8 __ovld vload8(size_t offset, const __local half *p); half16 __ovld vload16(size_t offset, const __local half *p); half __ovld vload(size_t offset, const __private half *p); half2 __ovld vload2(size_t offset, const __private half *p); half3 __ovld vload3(size_t offset, const __private half *p); half4 __ovld vload4(size_t offset, const __private half *p); half8 __ovld vload8(size_t offset, const __private half *p); half16 __ovld vload16(size_t offset, const __private half *p); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld vstore2(char2 data, size_t offset, char *p); void __ovld vstore2(uchar2 data, size_t offset, uchar *p); void __ovld vstore2(short2 data, size_t offset, short *p); void __ovld vstore2(ushort2 data, size_t offset, ushort *p); void __ovld vstore2(int2 data, size_t offset, int *p); void __ovld vstore2(uint2 data, size_t offset, uint *p); void __ovld vstore2(long2 data, size_t offset, long *p); void __ovld vstore2(ulong2 data, size_t offset, ulong *p); void __ovld vstore2(float2 data, size_t offset, float *p); void __ovld vstore3(char3 data, size_t offset, char *p); void __ovld vstore3(uchar3 data, size_t offset, uchar *p); void __ovld vstore3(short3 data, size_t offset, short *p); void __ovld vstore3(ushort3 data, size_t offset, ushort *p); void __ovld vstore3(int3 data, size_t offset, int *p); void __ovld vstore3(uint3 data, size_t offset, uint *p); void __ovld vstore3(long3 data, size_t offset, long *p); void __ovld vstore3(ulong3 data, size_t offset, ulong *p); void __ovld vstore3(float3 data, size_t offset, float *p); void __ovld vstore4(char4 data, size_t offset, char *p); void __ovld vstore4(uchar4 data, size_t offset, uchar *p); void __ovld vstore4(short4 data, size_t offset, short *p); void __ovld vstore4(ushort4 data, size_t offset, ushort *p); void __ovld vstore4(int4 data, size_t offset, int *p); void __ovld vstore4(uint4 data, size_t offset, uint *p); void __ovld vstore4(long4 data, size_t offset, long *p); void __ovld vstore4(ulong4 data, size_t offset, ulong *p); void __ovld vstore4(float4 data, size_t offset, float *p); void __ovld vstore8(char8 data, size_t offset, char *p); void __ovld vstore8(uchar8 data, size_t offset, uchar *p); void __ovld vstore8(short8 data, size_t offset, short *p); void __ovld vstore8(ushort8 data, size_t offset, ushort *p); void __ovld vstore8(int8 data, size_t offset, int *p); void __ovld vstore8(uint8 data, size_t offset, uint *p); void __ovld vstore8(long8 data, size_t offset, long *p); void __ovld vstore8(ulong8 data, size_t offset, ulong *p); void __ovld vstore8(float8 data, size_t offset, float *p); void __ovld vstore16(char16 data, size_t offset, char *p); void __ovld vstore16(uchar16 data, size_t offset, uchar *p); void __ovld vstore16(short16 data, size_t offset, short *p); void __ovld vstore16(ushort16 data, size_t offset, ushort *p); void __ovld vstore16(int16 data, size_t offset, int *p); void __ovld vstore16(uint16 data, size_t offset, uint *p); void __ovld vstore16(long16 data, size_t offset, long *p); void __ovld vstore16(ulong16 data, size_t offset, ulong *p); void __ovld vstore16(float16 data, size_t offset, float *p); #ifdef cl_khr_fp64 void __ovld vstore2(double2 data, size_t offset, double *p); void __ovld vstore3(double3 data, size_t offset, double *p); void __ovld vstore4(double4 data, size_t offset, double *p); void __ovld vstore8(double8 data, size_t offset, double *p); void __ovld vstore16(double16 data, size_t offset, double *p); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 void __ovld vstore(half data, size_t offset, half *p); void __ovld vstore2(half2 data, size_t offset, half *p); void __ovld vstore3(half3 data, size_t offset, half *p); void __ovld vstore4(half4 data, size_t offset, half *p); void __ovld vstore8(half8 data, size_t offset, half *p); void __ovld vstore16(half16 data, size_t offset, half *p); #endif //cl_khr_fp16 #else void __ovld vstore2(char2 data, size_t offset, __global char *p); void __ovld vstore2(uchar2 data, size_t offset, __global uchar *p); void __ovld vstore2(short2 data, size_t offset, __global short *p); void __ovld vstore2(ushort2 data, size_t offset, __global ushort *p); void __ovld vstore2(int2 data, size_t offset, __global int *p); void __ovld vstore2(uint2 data, size_t offset, __global uint *p); void __ovld vstore2(long2 data, size_t offset, __global long *p); void __ovld vstore2(ulong2 data, size_t offset, __global ulong *p); void __ovld vstore2(float2 data, size_t offset, __global float *p); void __ovld vstore3(char3 data, size_t offset, __global char *p); void __ovld vstore3(uchar3 data, size_t offset, __global uchar *p); void __ovld vstore3(short3 data, size_t offset, __global short *p); void __ovld vstore3(ushort3 data, size_t offset, __global ushort *p); void __ovld vstore3(int3 data, size_t offset, __global int *p); void __ovld vstore3(uint3 data, size_t offset, __global uint *p); void __ovld vstore3(long3 data, size_t offset, __global long *p); void __ovld vstore3(ulong3 data, size_t offset, __global ulong *p); void __ovld vstore3(float3 data, size_t offset, __global float *p); void __ovld vstore4(char4 data, size_t offset, __global char *p); void __ovld vstore4(uchar4 data, size_t offset, __global uchar *p); void __ovld vstore4(short4 data, size_t offset, __global short *p); void __ovld vstore4(ushort4 data, size_t offset, __global ushort *p); void __ovld vstore4(int4 data, size_t offset, __global int *p); void __ovld vstore4(uint4 data, size_t offset, __global uint *p); void __ovld vstore4(long4 data, size_t offset, __global long *p); void __ovld vstore4(ulong4 data, size_t offset, __global ulong *p); void __ovld vstore4(float4 data, size_t offset, __global float *p); void __ovld vstore8(char8 data, size_t offset, __global char *p); void __ovld vstore8(uchar8 data, size_t offset, __global uchar *p); void __ovld vstore8(short8 data, size_t offset, __global short *p); void __ovld vstore8(ushort8 data, size_t offset, __global ushort *p); void __ovld vstore8(int8 data, size_t offset, __global int *p); void __ovld vstore8(uint8 data, size_t offset, __global uint *p); void __ovld vstore8(long8 data, size_t offset, __global long *p); void __ovld vstore8(ulong8 data, size_t offset, __global ulong *p); void __ovld vstore8(float8 data, size_t offset, __global float *p); void __ovld vstore16(char16 data, size_t offset, __global char *p); void __ovld vstore16(uchar16 data, size_t offset, __global uchar *p); void __ovld vstore16(short16 data, size_t offset, __global short *p); void __ovld vstore16(ushort16 data, size_t offset, __global ushort *p); void __ovld vstore16(int16 data, size_t offset, __global int *p); void __ovld vstore16(uint16 data, size_t offset, __global uint *p); void __ovld vstore16(long16 data, size_t offset, __global long *p); void __ovld vstore16(ulong16 data, size_t offset, __global ulong *p); void __ovld vstore16(float16 data, size_t offset, __global float *p); void __ovld vstore2(char2 data, size_t offset, __local char *p); void __ovld vstore2(uchar2 data, size_t offset, __local uchar *p); void __ovld vstore2(short2 data, size_t offset, __local short *p); void __ovld vstore2(ushort2 data, size_t offset, __local ushort *p); void __ovld vstore2(int2 data, size_t offset, __local int *p); void __ovld vstore2(uint2 data, size_t offset, __local uint *p); void __ovld vstore2(long2 data, size_t offset, __local long *p); void __ovld vstore2(ulong2 data, size_t offset, __local ulong *p); void __ovld vstore2(float2 data, size_t offset, __local float *p); void __ovld vstore3(char3 data, size_t offset, __local char *p); void __ovld vstore3(uchar3 data, size_t offset, __local uchar *p); void __ovld vstore3(short3 data, size_t offset, __local short *p); void __ovld vstore3(ushort3 data, size_t offset, __local ushort *p); void __ovld vstore3(int3 data, size_t offset, __local int *p); void __ovld vstore3(uint3 data, size_t offset, __local uint *p); void __ovld vstore3(long3 data, size_t offset, __local long *p); void __ovld vstore3(ulong3 data, size_t offset, __local ulong *p); void __ovld vstore3(float3 data, size_t offset, __local float *p); void __ovld vstore4(char4 data, size_t offset, __local char *p); void __ovld vstore4(uchar4 data, size_t offset, __local uchar *p); void __ovld vstore4(short4 data, size_t offset, __local short *p); void __ovld vstore4(ushort4 data, size_t offset, __local ushort *p); void __ovld vstore4(int4 data, size_t offset, __local int *p); void __ovld vstore4(uint4 data, size_t offset, __local uint *p); void __ovld vstore4(long4 data, size_t offset, __local long *p); void __ovld vstore4(ulong4 data, size_t offset, __local ulong *p); void __ovld vstore4(float4 data, size_t offset, __local float *p); void __ovld vstore8(char8 data, size_t offset, __local char *p); void __ovld vstore8(uchar8 data, size_t offset, __local uchar *p); void __ovld vstore8(short8 data, size_t offset, __local short *p); void __ovld vstore8(ushort8 data, size_t offset, __local ushort *p); void __ovld vstore8(int8 data, size_t offset, __local int *p); void __ovld vstore8(uint8 data, size_t offset, __local uint *p); void __ovld vstore8(long8 data, size_t offset, __local long *p); void __ovld vstore8(ulong8 data, size_t offset, __local ulong *p); void __ovld vstore8(float8 data, size_t offset, __local float *p); void __ovld vstore16(char16 data, size_t offset, __local char *p); void __ovld vstore16(uchar16 data, size_t offset, __local uchar *p); void __ovld vstore16(short16 data, size_t offset, __local short *p); void __ovld vstore16(ushort16 data, size_t offset, __local ushort *p); void __ovld vstore16(int16 data, size_t offset, __local int *p); void __ovld vstore16(uint16 data, size_t offset, __local uint *p); void __ovld vstore16(long16 data, size_t offset, __local long *p); void __ovld vstore16(ulong16 data, size_t offset, __local ulong *p); void __ovld vstore16(float16 data, size_t offset, __local float *p); void __ovld vstore2(char2 data, size_t offset, __private char *p); void __ovld vstore2(uchar2 data, size_t offset, __private uchar *p); void __ovld vstore2(short2 data, size_t offset, __private short *p); void __ovld vstore2(ushort2 data, size_t offset, __private ushort *p); void __ovld vstore2(int2 data, size_t offset, __private int *p); void __ovld vstore2(uint2 data, size_t offset, __private uint *p); void __ovld vstore2(long2 data, size_t offset, __private long *p); void __ovld vstore2(ulong2 data, size_t offset, __private ulong *p); void __ovld vstore2(float2 data, size_t offset, __private float *p); void __ovld vstore3(char3 data, size_t offset, __private char *p); void __ovld vstore3(uchar3 data, size_t offset, __private uchar *p); void __ovld vstore3(short3 data, size_t offset, __private short *p); void __ovld vstore3(ushort3 data, size_t offset, __private ushort *p); void __ovld vstore3(int3 data, size_t offset, __private int *p); void __ovld vstore3(uint3 data, size_t offset, __private uint *p); void __ovld vstore3(long3 data, size_t offset, __private long *p); void __ovld vstore3(ulong3 data, size_t offset, __private ulong *p); void __ovld vstore3(float3 data, size_t offset, __private float *p); void __ovld vstore4(char4 data, size_t offset, __private char *p); void __ovld vstore4(uchar4 data, size_t offset, __private uchar *p); void __ovld vstore4(short4 data, size_t offset, __private short *p); void __ovld vstore4(ushort4 data, size_t offset, __private ushort *p); void __ovld vstore4(int4 data, size_t offset, __private int *p); void __ovld vstore4(uint4 data, size_t offset, __private uint *p); void __ovld vstore4(long4 data, size_t offset, __private long *p); void __ovld vstore4(ulong4 data, size_t offset, __private ulong *p); void __ovld vstore4(float4 data, size_t offset, __private float *p); void __ovld vstore8(char8 data, size_t offset, __private char *p); void __ovld vstore8(uchar8 data, size_t offset, __private uchar *p); void __ovld vstore8(short8 data, size_t offset, __private short *p); void __ovld vstore8(ushort8 data, size_t offset, __private ushort *p); void __ovld vstore8(int8 data, size_t offset, __private int *p); void __ovld vstore8(uint8 data, size_t offset, __private uint *p); void __ovld vstore8(long8 data, size_t offset, __private long *p); void __ovld vstore8(ulong8 data, size_t offset, __private ulong *p); void __ovld vstore8(float8 data, size_t offset, __private float *p); void __ovld vstore16(char16 data, size_t offset, __private char *p); void __ovld vstore16(uchar16 data, size_t offset, __private uchar *p); void __ovld vstore16(short16 data, size_t offset, __private short *p); void __ovld vstore16(ushort16 data, size_t offset, __private ushort *p); void __ovld vstore16(int16 data, size_t offset, __private int *p); void __ovld vstore16(uint16 data, size_t offset, __private uint *p); void __ovld vstore16(long16 data, size_t offset, __private long *p); void __ovld vstore16(ulong16 data, size_t offset, __private ulong *p); void __ovld vstore16(float16 data, size_t offset, __private float *p); #ifdef cl_khr_fp64 void __ovld vstore2(double2 data, size_t offset, __global double *p); void __ovld vstore3(double3 data, size_t offset, __global double *p); void __ovld vstore4(double4 data, size_t offset, __global double *p); void __ovld vstore8(double8 data, size_t offset, __global double *p); void __ovld vstore16(double16 data, size_t offset, __global double *p); void __ovld vstore2(double2 data, size_t offset, __local double *p); void __ovld vstore3(double3 data, size_t offset, __local double *p); void __ovld vstore4(double4 data, size_t offset, __local double *p); void __ovld vstore8(double8 data, size_t offset, __local double *p); void __ovld vstore16(double16 data, size_t offset, __local double *p); void __ovld vstore2(double2 data, size_t offset, __private double *p); void __ovld vstore3(double3 data, size_t offset, __private double *p); void __ovld vstore4(double4 data, size_t offset, __private double *p); void __ovld vstore8(double8 data, size_t offset, __private double *p); void __ovld vstore16(double16 data, size_t offset, __private double *p); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 void __ovld vstore(half data, size_t offset, __global half *p); void __ovld vstore2(half2 data, size_t offset, __global half *p); void __ovld vstore3(half3 data, size_t offset, __global half *p); void __ovld vstore4(half4 data, size_t offset, __global half *p); void __ovld vstore8(half8 data, size_t offset, __global half *p); void __ovld vstore16(half16 data, size_t offset, __global half *p); void __ovld vstore(half data, size_t offset, __local half *p); void __ovld vstore2(half2 data, size_t offset, __local half *p); void __ovld vstore3(half3 data, size_t offset, __local half *p); void __ovld vstore4(half4 data, size_t offset, __local half *p); void __ovld vstore8(half8 data, size_t offset, __local half *p); void __ovld vstore16(half16 data, size_t offset, __local half *p); void __ovld vstore(half data, size_t offset, __private half *p); void __ovld vstore2(half2 data, size_t offset, __private half *p); void __ovld vstore3(half3 data, size_t offset, __private half *p); void __ovld vstore4(half4 data, size_t offset, __private half *p); void __ovld vstore8(half8 data, size_t offset, __private half *p); void __ovld vstore16(half16 data, size_t offset, __private half *p); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Read sizeof (half) bytes of data from address * (p + offset). The data read is interpreted as a * half value. The half value is converted to a * float value and the float value is returned. * The read address computed as (p + offset) * must be 16-bit aligned. */ float __ovld vload_half(size_t offset, const __constant half *p); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld vload_half(size_t offset, const half *p); #else float __ovld vload_half(size_t offset, const __global half *p); float __ovld vload_half(size_t offset, const __local half *p); float __ovld vload_half(size_t offset, const __private half *p); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Read sizeof (halfn) bytes of data from address * (p + (offset * n)). The data read is interpreted * as a halfn value. The halfn value read is * converted to a floatn value and the floatn * value is returned. The read address computed * as (p + (offset * n)) must be 16-bit aligned. */ float2 __ovld vload_half2(size_t offset, const __constant half *p); float3 __ovld vload_half3(size_t offset, const __constant half *p); float4 __ovld vload_half4(size_t offset, const __constant half *p); float8 __ovld vload_half8(size_t offset, const __constant half *p); float16 __ovld vload_half16(size_t offset, const __constant half *p); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float2 __ovld vload_half2(size_t offset, const half *p); float3 __ovld vload_half3(size_t offset, const half *p); float4 __ovld vload_half4(size_t offset, const half *p); float8 __ovld vload_half8(size_t offset, const half *p); float16 __ovld vload_half16(size_t offset, const half *p); #else float2 __ovld vload_half2(size_t offset, const __global half *p); float3 __ovld vload_half3(size_t offset, const __global half *p); float4 __ovld vload_half4(size_t offset, const __global half *p); float8 __ovld vload_half8(size_t offset, const __global half *p); float16 __ovld vload_half16(size_t offset, const __global half *p); float2 __ovld vload_half2(size_t offset, const __local half *p); float3 __ovld vload_half3(size_t offset, const __local half *p); float4 __ovld vload_half4(size_t offset, const __local half *p); float8 __ovld vload_half8(size_t offset, const __local half *p); float16 __ovld vload_half16(size_t offset, const __local half *p); float2 __ovld vload_half2(size_t offset, const __private half *p); float3 __ovld vload_half3(size_t offset, const __private half *p); float4 __ovld vload_half4(size_t offset, const __private half *p); float8 __ovld vload_half8(size_t offset, const __private half *p); float16 __ovld vload_half16(size_t offset, const __private half *p); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * The float value given by data is first * converted to a half value using the appropriate * rounding mode. The half value is then written * to address computed as (p + offset). The * address computed as (p + offset) must be 16- * bit aligned. * vstore_half use the current rounding mode. * The default current rounding mode is round to * nearest even. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld vstore_half(float data, size_t offset, half *p); void __ovld vstore_half_rte(float data, size_t offset, half *p); void __ovld vstore_half_rtz(float data, size_t offset, half *p); void __ovld vstore_half_rtp(float data, size_t offset, half *p); void __ovld vstore_half_rtn(float data, size_t offset, half *p); #ifdef cl_khr_fp64 void __ovld vstore_half(double data, size_t offset, half *p); void __ovld vstore_half_rte(double data, size_t offset, half *p); void __ovld vstore_half_rtz(double data, size_t offset, half *p); void __ovld vstore_half_rtp(double data, size_t offset, half *p); void __ovld vstore_half_rtn(double data, size_t offset, half *p); #endif //cl_khr_fp64 #else void __ovld vstore_half(float data, size_t offset, __global half *p); void __ovld vstore_half_rte(float data, size_t offset, __global half *p); void __ovld vstore_half_rtz(float data, size_t offset, __global half *p); void __ovld vstore_half_rtp(float data, size_t offset, __global half *p); void __ovld vstore_half_rtn(float data, size_t offset, __global half *p); void __ovld vstore_half(float data, size_t offset, __local half *p); void __ovld vstore_half_rte(float data, size_t offset, __local half *p); void __ovld vstore_half_rtz(float data, size_t offset, __local half *p); void __ovld vstore_half_rtp(float data, size_t offset, __local half *p); void __ovld vstore_half_rtn(float data, size_t offset, __local half *p); void __ovld vstore_half(float data, size_t offset, __private half *p); void __ovld vstore_half_rte(float data, size_t offset, __private half *p); void __ovld vstore_half_rtz(float data, size_t offset, __private half *p); void __ovld vstore_half_rtp(float data, size_t offset, __private half *p); void __ovld vstore_half_rtn(float data, size_t offset, __private half *p); #ifdef cl_khr_fp64 void __ovld vstore_half(double data, size_t offset, __global half *p); void __ovld vstore_half_rte(double data, size_t offset, __global half *p); void __ovld vstore_half_rtz(double data, size_t offset, __global half *p); void __ovld vstore_half_rtp(double data, size_t offset, __global half *p); void __ovld vstore_half_rtn(double data, size_t offset, __global half *p); void __ovld vstore_half(double data, size_t offset, __local half *p); void __ovld vstore_half_rte(double data, size_t offset, __local half *p); void __ovld vstore_half_rtz(double data, size_t offset, __local half *p); void __ovld vstore_half_rtp(double data, size_t offset, __local half *p); void __ovld vstore_half_rtn(double data, size_t offset, __local half *p); void __ovld vstore_half(double data, size_t offset, __private half *p); void __ovld vstore_half_rte(double data, size_t offset, __private half *p); void __ovld vstore_half_rtz(double data, size_t offset, __private half *p); void __ovld vstore_half_rtp(double data, size_t offset, __private half *p); void __ovld vstore_half_rtn(double data, size_t offset, __private half *p); #endif //cl_khr_fp64 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * The floatn value given by data is converted to * a halfn value using the appropriate rounding * mode. The halfn value is then written to * address computed as (p + (offset * n)). The * address computed as (p + (offset * n)) must be * 16-bit aligned. * vstore_halfn uses the current rounding mode. * The default current rounding mode is round to * nearest even. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld vstore_half2(float2 data, size_t offset, half *p); void __ovld vstore_half3(float3 data, size_t offset, half *p); void __ovld vstore_half4(float4 data, size_t offset, half *p); void __ovld vstore_half8(float8 data, size_t offset, half *p); void __ovld vstore_half16(float16 data, size_t offset, half *p); void __ovld vstore_half2_rte(float2 data, size_t offset, half *p); void __ovld vstore_half3_rte(float3 data, size_t offset, half *p); void __ovld vstore_half4_rte(float4 data, size_t offset, half *p); void __ovld vstore_half8_rte(float8 data, size_t offset, half *p); void __ovld vstore_half16_rte(float16 data, size_t offset, half *p); void __ovld vstore_half2_rtz(float2 data, size_t offset, half *p); void __ovld vstore_half3_rtz(float3 data, size_t offset, half *p); void __ovld vstore_half4_rtz(float4 data, size_t offset, half *p); void __ovld vstore_half8_rtz(float8 data, size_t offset, half *p); void __ovld vstore_half16_rtz(float16 data, size_t offset, half *p); void __ovld vstore_half2_rtp(float2 data, size_t offset, half *p); void __ovld vstore_half3_rtp(float3 data, size_t offset, half *p); void __ovld vstore_half4_rtp(float4 data, size_t offset, half *p); void __ovld vstore_half8_rtp(float8 data, size_t offset, half *p); void __ovld vstore_half16_rtp(float16 data, size_t offset, half *p); void __ovld vstore_half2_rtn(float2 data, size_t offset, half *p); void __ovld vstore_half3_rtn(float3 data, size_t offset, half *p); void __ovld vstore_half4_rtn(float4 data, size_t offset, half *p); void __ovld vstore_half8_rtn(float8 data, size_t offset, half *p); void __ovld vstore_half16_rtn(float16 data, size_t offset, half *p); #ifdef cl_khr_fp64 void __ovld vstore_half2(double2 data, size_t offset, half *p); void __ovld vstore_half3(double3 data, size_t offset, half *p); void __ovld vstore_half4(double4 data, size_t offset, half *p); void __ovld vstore_half8(double8 data, size_t offset, half *p); void __ovld vstore_half16(double16 data, size_t offset, half *p); void __ovld vstore_half2_rte(double2 data, size_t offset, half *p); void __ovld vstore_half3_rte(double3 data, size_t offset, half *p); void __ovld vstore_half4_rte(double4 data, size_t offset, half *p); void __ovld vstore_half8_rte(double8 data, size_t offset, half *p); void __ovld vstore_half16_rte(double16 data, size_t offset, half *p); void __ovld vstore_half2_rtz(double2 data, size_t offset, half *p); void __ovld vstore_half3_rtz(double3 data, size_t offset, half *p); void __ovld vstore_half4_rtz(double4 data, size_t offset, half *p); void __ovld vstore_half8_rtz(double8 data, size_t offset, half *p); void __ovld vstore_half16_rtz(double16 data, size_t offset, half *p); void __ovld vstore_half2_rtp(double2 data, size_t offset, half *p); void __ovld vstore_half3_rtp(double3 data, size_t offset, half *p); void __ovld vstore_half4_rtp(double4 data, size_t offset, half *p); void __ovld vstore_half8_rtp(double8 data, size_t offset, half *p); void __ovld vstore_half16_rtp(double16 data, size_t offset, half *p); void __ovld vstore_half2_rtn(double2 data, size_t offset, half *p); void __ovld vstore_half3_rtn(double3 data, size_t offset, half *p); void __ovld vstore_half4_rtn(double4 data, size_t offset, half *p); void __ovld vstore_half8_rtn(double8 data, size_t offset, half *p); void __ovld vstore_half16_rtn(double16 data, size_t offset, half *p); #endif //cl_khr_fp64 #else void __ovld vstore_half2(float2 data, size_t offset, __global half *p); void __ovld vstore_half3(float3 data, size_t offset, __global half *p); void __ovld vstore_half4(float4 data, size_t offset, __global half *p); void __ovld vstore_half8(float8 data, size_t offset, __global half *p); void __ovld vstore_half16(float16 data, size_t offset, __global half *p); void __ovld vstore_half2_rte(float2 data, size_t offset, __global half *p); void __ovld vstore_half3_rte(float3 data, size_t offset, __global half *p); void __ovld vstore_half4_rte(float4 data, size_t offset, __global half *p); void __ovld vstore_half8_rte(float8 data, size_t offset, __global half *p); void __ovld vstore_half16_rte(float16 data, size_t offset, __global half *p); void __ovld vstore_half2_rtz(float2 data, size_t offset, __global half *p); void __ovld vstore_half3_rtz(float3 data, size_t offset, __global half *p); void __ovld vstore_half4_rtz(float4 data, size_t offset, __global half *p); void __ovld vstore_half8_rtz(float8 data, size_t offset, __global half *p); void __ovld vstore_half16_rtz(float16 data, size_t offset, __global half *p); void __ovld vstore_half2_rtp(float2 data, size_t offset, __global half *p); void __ovld vstore_half3_rtp(float3 data, size_t offset, __global half *p); void __ovld vstore_half4_rtp(float4 data, size_t offset, __global half *p); void __ovld vstore_half8_rtp(float8 data, size_t offset, __global half *p); void __ovld vstore_half16_rtp(float16 data, size_t offset, __global half *p); void __ovld vstore_half2_rtn(float2 data, size_t offset, __global half *p); void __ovld vstore_half3_rtn(float3 data, size_t offset, __global half *p); void __ovld vstore_half4_rtn(float4 data, size_t offset, __global half *p); void __ovld vstore_half8_rtn(float8 data, size_t offset, __global half *p); void __ovld vstore_half16_rtn(float16 data, size_t offset, __global half *p); void __ovld vstore_half2(float2 data, size_t offset, __local half *p); void __ovld vstore_half3(float3 data, size_t offset, __local half *p); void __ovld vstore_half4(float4 data, size_t offset, __local half *p); void __ovld vstore_half8(float8 data, size_t offset, __local half *p); void __ovld vstore_half16(float16 data, size_t offset, __local half *p); void __ovld vstore_half2_rte(float2 data, size_t offset, __local half *p); void __ovld vstore_half3_rte(float3 data, size_t offset, __local half *p); void __ovld vstore_half4_rte(float4 data, size_t offset, __local half *p); void __ovld vstore_half8_rte(float8 data, size_t offset, __local half *p); void __ovld vstore_half16_rte(float16 data, size_t offset, __local half *p); void __ovld vstore_half2_rtz(float2 data, size_t offset, __local half *p); void __ovld vstore_half3_rtz(float3 data, size_t offset, __local half *p); void __ovld vstore_half4_rtz(float4 data, size_t offset, __local half *p); void __ovld vstore_half8_rtz(float8 data, size_t offset, __local half *p); void __ovld vstore_half16_rtz(float16 data, size_t offset, __local half *p); void __ovld vstore_half2_rtp(float2 data, size_t offset, __local half *p); void __ovld vstore_half3_rtp(float3 data, size_t offset, __local half *p); void __ovld vstore_half4_rtp(float4 data, size_t offset, __local half *p); void __ovld vstore_half8_rtp(float8 data, size_t offset, __local half *p); void __ovld vstore_half16_rtp(float16 data, size_t offset, __local half *p); void __ovld vstore_half2_rtn(float2 data, size_t offset, __local half *p); void __ovld vstore_half3_rtn(float3 data, size_t offset, __local half *p); void __ovld vstore_half4_rtn(float4 data, size_t offset, __local half *p); void __ovld vstore_half8_rtn(float8 data, size_t offset, __local half *p); void __ovld vstore_half16_rtn(float16 data, size_t offset, __local half *p); void __ovld vstore_half2(float2 data, size_t offset, __private half *p); void __ovld vstore_half3(float3 data, size_t offset, __private half *p); void __ovld vstore_half4(float4 data, size_t offset, __private half *p); void __ovld vstore_half8(float8 data, size_t offset, __private half *p); void __ovld vstore_half16(float16 data, size_t offset, __private half *p); void __ovld vstore_half2_rte(float2 data, size_t offset, __private half *p); void __ovld vstore_half3_rte(float3 data, size_t offset, __private half *p); void __ovld vstore_half4_rte(float4 data, size_t offset, __private half *p); void __ovld vstore_half8_rte(float8 data, size_t offset, __private half *p); void __ovld vstore_half16_rte(float16 data, size_t offset, __private half *p); void __ovld vstore_half2_rtz(float2 data, size_t offset, __private half *p); void __ovld vstore_half3_rtz(float3 data, size_t offset, __private half *p); void __ovld vstore_half4_rtz(float4 data, size_t offset, __private half *p); void __ovld vstore_half8_rtz(float8 data, size_t offset, __private half *p); void __ovld vstore_half16_rtz(float16 data, size_t offset, __private half *p); void __ovld vstore_half2_rtp(float2 data, size_t offset, __private half *p); void __ovld vstore_half3_rtp(float3 data, size_t offset, __private half *p); void __ovld vstore_half4_rtp(float4 data, size_t offset, __private half *p); void __ovld vstore_half8_rtp(float8 data, size_t offset, __private half *p); void __ovld vstore_half16_rtp(float16 data, size_t offset, __private half *p); void __ovld vstore_half2_rtn(float2 data, size_t offset, __private half *p); void __ovld vstore_half3_rtn(float3 data, size_t offset, __private half *p); void __ovld vstore_half4_rtn(float4 data, size_t offset, __private half *p); void __ovld vstore_half8_rtn(float8 data, size_t offset, __private half *p); void __ovld vstore_half16_rtn(float16 data, size_t offset, __private half *p); #ifdef cl_khr_fp64 void __ovld vstore_half2(double2 data, size_t offset, __global half *p); void __ovld vstore_half3(double3 data, size_t offset, __global half *p); void __ovld vstore_half4(double4 data, size_t offset, __global half *p); void __ovld vstore_half8(double8 data, size_t offset, __global half *p); void __ovld vstore_half16(double16 data, size_t offset, __global half *p); void __ovld vstore_half2_rte(double2 data, size_t offset, __global half *p); void __ovld vstore_half3_rte(double3 data, size_t offset, __global half *p); void __ovld vstore_half4_rte(double4 data, size_t offset, __global half *p); void __ovld vstore_half8_rte(double8 data, size_t offset, __global half *p); void __ovld vstore_half16_rte(double16 data, size_t offset, __global half *p); void __ovld vstore_half2_rtz(double2 data, size_t offset, __global half *p); void __ovld vstore_half3_rtz(double3 data, size_t offset, __global half *p); void __ovld vstore_half4_rtz(double4 data, size_t offset, __global half *p); void __ovld vstore_half8_rtz(double8 data, size_t offset, __global half *p); void __ovld vstore_half16_rtz(double16 data, size_t offset, __global half *p); void __ovld vstore_half2_rtp(double2 data, size_t offset, __global half *p); void __ovld vstore_half3_rtp(double3 data, size_t offset, __global half *p); void __ovld vstore_half4_rtp(double4 data, size_t offset, __global half *p); void __ovld vstore_half8_rtp(double8 data, size_t offset, __global half *p); void __ovld vstore_half16_rtp(double16 data, size_t offset, __global half *p); void __ovld vstore_half2_rtn(double2 data, size_t offset, __global half *p); void __ovld vstore_half3_rtn(double3 data, size_t offset, __global half *p); void __ovld vstore_half4_rtn(double4 data, size_t offset, __global half *p); void __ovld vstore_half8_rtn(double8 data, size_t offset, __global half *p); void __ovld vstore_half16_rtn(double16 data, size_t offset, __global half *p); void __ovld vstore_half2(double2 data, size_t offset, __local half *p); void __ovld vstore_half3(double3 data, size_t offset, __local half *p); void __ovld vstore_half4(double4 data, size_t offset, __local half *p); void __ovld vstore_half8(double8 data, size_t offset, __local half *p); void __ovld vstore_half16(double16 data, size_t offset, __local half *p); void __ovld vstore_half2_rte(double2 data, size_t offset, __local half *p); void __ovld vstore_half3_rte(double3 data, size_t offset, __local half *p); void __ovld vstore_half4_rte(double4 data, size_t offset, __local half *p); void __ovld vstore_half8_rte(double8 data, size_t offset, __local half *p); void __ovld vstore_half16_rte(double16 data, size_t offset, __local half *p); void __ovld vstore_half2_rtz(double2 data, size_t offset, __local half *p); void __ovld vstore_half3_rtz(double3 data, size_t offset, __local half *p); void __ovld vstore_half4_rtz(double4 data, size_t offset, __local half *p); void __ovld vstore_half8_rtz(double8 data, size_t offset, __local half *p); void __ovld vstore_half16_rtz(double16 data, size_t offset, __local half *p); void __ovld vstore_half2_rtp(double2 data, size_t offset, __local half *p); void __ovld vstore_half3_rtp(double3 data, size_t offset, __local half *p); void __ovld vstore_half4_rtp(double4 data, size_t offset, __local half *p); void __ovld vstore_half8_rtp(double8 data, size_t offset, __local half *p); void __ovld vstore_half16_rtp(double16 data, size_t offset, __local half *p); void __ovld vstore_half2_rtn(double2 data, size_t offset, __local half *p); void __ovld vstore_half3_rtn(double3 data, size_t offset, __local half *p); void __ovld vstore_half4_rtn(double4 data, size_t offset, __local half *p); void __ovld vstore_half8_rtn(double8 data, size_t offset, __local half *p); void __ovld vstore_half16_rtn(double16 data, size_t offset, __local half *p); void __ovld vstore_half2(double2 data, size_t offset, __private half *p); void __ovld vstore_half3(double3 data, size_t offset, __private half *p); void __ovld vstore_half4(double4 data, size_t offset, __private half *p); void __ovld vstore_half8(double8 data, size_t offset, __private half *p); void __ovld vstore_half16(double16 data, size_t offset, __private half *p); void __ovld vstore_half2_rte(double2 data, size_t offset, __private half *p); void __ovld vstore_half3_rte(double3 data, size_t offset, __private half *p); void __ovld vstore_half4_rte(double4 data, size_t offset, __private half *p); void __ovld vstore_half8_rte(double8 data, size_t offset, __private half *p); void __ovld vstore_half16_rte(double16 data, size_t offset, __private half *p); void __ovld vstore_half2_rtz(double2 data, size_t offset, __private half *p); void __ovld vstore_half3_rtz(double3 data, size_t offset, __private half *p); void __ovld vstore_half4_rtz(double4 data, size_t offset, __private half *p); void __ovld vstore_half8_rtz(double8 data, size_t offset, __private half *p); void __ovld vstore_half16_rtz(double16 data, size_t offset, __private half *p); void __ovld vstore_half2_rtp(double2 data, size_t offset, __private half *p); void __ovld vstore_half3_rtp(double3 data, size_t offset, __private half *p); void __ovld vstore_half4_rtp(double4 data, size_t offset, __private half *p); void __ovld vstore_half8_rtp(double8 data, size_t offset, __private half *p); void __ovld vstore_half16_rtp(double16 data, size_t offset, __private half *p); void __ovld vstore_half2_rtn(double2 data, size_t offset, __private half *p); void __ovld vstore_half3_rtn(double3 data, size_t offset, __private half *p); void __ovld vstore_half4_rtn(double4 data, size_t offset, __private half *p); void __ovld vstore_half8_rtn(double8 data, size_t offset, __private half *p); void __ovld vstore_half16_rtn(double16 data, size_t offset, __private half *p); #endif //cl_khr_fp64 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * For n = 1, 2, 4, 8 and 16 read sizeof (halfn) * bytes of data from address (p + (offset * n)). * The data read is interpreted as a halfn value. * The halfn value read is converted to a floatn * value and the floatn value is returned. * The address computed as (p + (offset * n)) * must be aligned to sizeof (halfn) bytes. * For n = 3, vloada_half3 reads a half3 from * address (p + (offset * 4)) and returns a float3. * The address computed as (p + (offset * 4)) * must be aligned to sizeof (half) * 4 bytes. */ float __ovld vloada_half(size_t offset, const __constant half *p); float2 __ovld vloada_half2(size_t offset, const __constant half *p); float3 __ovld vloada_half3(size_t offset, const __constant half *p); float4 __ovld vloada_half4(size_t offset, const __constant half *p); float8 __ovld vloada_half8(size_t offset, const __constant half *p); float16 __ovld vloada_half16(size_t offset, const __constant half *p); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float __ovld vloada_half(size_t offset, const half *p); float2 __ovld vloada_half2(size_t offset, const half *p); float3 __ovld vloada_half3(size_t offset, const half *p); float4 __ovld vloada_half4(size_t offset, const half *p); float8 __ovld vloada_half8(size_t offset, const half *p); float16 __ovld vloada_half16(size_t offset, const half *p); #else float __ovld vloada_half(size_t offset, const __global half *p); float2 __ovld vloada_half2(size_t offset, const __global half *p); float3 __ovld vloada_half3(size_t offset, const __global half *p); float4 __ovld vloada_half4(size_t offset, const __global half *p); float8 __ovld vloada_half8(size_t offset, const __global half *p); float16 __ovld vloada_half16(size_t offset, const __global half *p); float __ovld vloada_half(size_t offset, const __local half *p); float2 __ovld vloada_half2(size_t offset, const __local half *p); float3 __ovld vloada_half3(size_t offset, const __local half *p); float4 __ovld vloada_half4(size_t offset, const __local half *p); float8 __ovld vloada_half8(size_t offset, const __local half *p); float16 __ovld vloada_half16(size_t offset, const __local half *p); float __ovld vloada_half(size_t offset, const __private half *p); float2 __ovld vloada_half2(size_t offset, const __private half *p); float3 __ovld vloada_half3(size_t offset, const __private half *p); float4 __ovld vloada_half4(size_t offset, const __private half *p); float8 __ovld vloada_half8(size_t offset, const __private half *p); float16 __ovld vloada_half16(size_t offset, const __private half *p); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * The floatn value given by data is converted to * a halfn value using the appropriate rounding * mode. * For n = 1, 2, 4, 8 and 16, the halfn value is * written to the address computed as (p + (offset * * n)). The address computed as (p + (offset * * n)) must be aligned to sizeof (halfn) bytes. * For n = 3, the half3 value is written to the * address computed as (p + (offset * 4)). The * address computed as (p + (offset * 4)) must be * aligned to sizeof (half) * 4 bytes. * vstorea_halfn uses the current rounding * mode. The default current rounding mode is * round to nearest even. */ #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld vstorea_half(float data, size_t offset, half *p); void __ovld vstorea_half2(float2 data, size_t offset, half *p); void __ovld vstorea_half3(float3 data, size_t offset, half *p); void __ovld vstorea_half4(float4 data, size_t offset, half *p); void __ovld vstorea_half8(float8 data, size_t offset, half *p); void __ovld vstorea_half16(float16 data, size_t offset, half *p); void __ovld vstorea_half_rte(float data, size_t offset, half *p); void __ovld vstorea_half2_rte(float2 data, size_t offset, half *p); void __ovld vstorea_half3_rte(float3 data, size_t offset, half *p); void __ovld vstorea_half4_rte(float4 data, size_t offset, half *p); void __ovld vstorea_half8_rte(float8 data, size_t offset, half *p); void __ovld vstorea_half16_rte(float16 data, size_t offset, half *p); void __ovld vstorea_half_rtz(float data, size_t offset, half *p); void __ovld vstorea_half2_rtz(float2 data, size_t offset, half *p); void __ovld vstorea_half3_rtz(float3 data, size_t offset, half *p); void __ovld vstorea_half4_rtz(float4 data, size_t offset, half *p); void __ovld vstorea_half8_rtz(float8 data, size_t offset, half *p); void __ovld vstorea_half16_rtz(float16 data, size_t offset, half *p); void __ovld vstorea_half_rtp(float data, size_t offset, half *p); void __ovld vstorea_half2_rtp(float2 data, size_t offset, half *p); void __ovld vstorea_half3_rtp(float3 data, size_t offset, half *p); void __ovld vstorea_half4_rtp(float4 data, size_t offset, half *p); void __ovld vstorea_half8_rtp(float8 data, size_t offset, half *p); void __ovld vstorea_half16_rtp(float16 data, size_t offset, half *p); void __ovld vstorea_half_rtn(float data, size_t offset, half *p); void __ovld vstorea_half2_rtn(float2 data, size_t offset, half *p); void __ovld vstorea_half3_rtn(float3 data, size_t offset, half *p); void __ovld vstorea_half4_rtn(float4 data, size_t offset, half *p); void __ovld vstorea_half8_rtn(float8 data, size_t offset, half *p); void __ovld vstorea_half16_rtn(float16 data, size_t offset, half *p); #ifdef cl_khr_fp64 void __ovld vstorea_half(double data, size_t offset, half *p); void __ovld vstorea_half2(double2 data, size_t offset, half *p); void __ovld vstorea_half3(double3 data, size_t offset, half *p); void __ovld vstorea_half4(double4 data, size_t offset, half *p); void __ovld vstorea_half8(double8 data, size_t offset, half *p); void __ovld vstorea_half16(double16 data, size_t offset, half *p); void __ovld vstorea_half_rte(double data, size_t offset, half *p); void __ovld vstorea_half2_rte(double2 data, size_t offset, half *p); void __ovld vstorea_half3_rte(double3 data, size_t offset, half *p); void __ovld vstorea_half4_rte(double4 data, size_t offset, half *p); void __ovld vstorea_half8_rte(double8 data, size_t offset, half *p); void __ovld vstorea_half16_rte(double16 data, size_t offset, half *p); void __ovld vstorea_half_rtz(double data, size_t offset, half *p); void __ovld vstorea_half2_rtz(double2 data, size_t offset, half *p); void __ovld vstorea_half3_rtz(double3 data, size_t offset, half *p); void __ovld vstorea_half4_rtz(double4 data, size_t offset, half *p); void __ovld vstorea_half8_rtz(double8 data, size_t offset, half *p); void __ovld vstorea_half16_rtz(double16 data, size_t offset, half *p); void __ovld vstorea_half_rtp(double data, size_t offset, half *p); void __ovld vstorea_half2_rtp(double2 data, size_t offset, half *p); void __ovld vstorea_half3_rtp(double3 data, size_t offset, half *p); void __ovld vstorea_half4_rtp(double4 data, size_t offset, half *p); void __ovld vstorea_half8_rtp(double8 data, size_t offset, half *p); void __ovld vstorea_half16_rtp(double16 data, size_t offset, half *p); void __ovld vstorea_half_rtn(double data, size_t offset, half *p); void __ovld vstorea_half2_rtn(double2 data, size_t offset, half *p); void __ovld vstorea_half3_rtn(double3 data, size_t offset, half *p); void __ovld vstorea_half4_rtn(double4 data, size_t offset, half *p); void __ovld vstorea_half8_rtn(double8 data, size_t offset, half *p); void __ovld vstorea_half16_rtn(double16 data, size_t offset, half *p); #endif //cl_khr_fp64 #else void __ovld vstorea_half(float data, size_t offset, __global half *p); void __ovld vstorea_half2(float2 data, size_t offset, __global half *p); void __ovld vstorea_half3(float3 data, size_t offset, __global half *p); void __ovld vstorea_half4(float4 data, size_t offset, __global half *p); void __ovld vstorea_half8(float8 data, size_t offset, __global half *p); void __ovld vstorea_half16(float16 data, size_t offset, __global half *p); void __ovld vstorea_half_rte(float data, size_t offset, __global half *p); void __ovld vstorea_half2_rte(float2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rte(float3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rte(float4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rte(float8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rte(float16 data, size_t offset, __global half *p); void __ovld vstorea_half_rtz(float data, size_t offset, __global half *p); void __ovld vstorea_half2_rtz(float2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rtz(float3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rtz(float4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rtz(float8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rtz(float16 data, size_t offset, __global half *p); void __ovld vstorea_half_rtp(float data, size_t offset, __global half *p); void __ovld vstorea_half2_rtp(float2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rtp(float3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rtp(float4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rtp(float8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rtp(float16 data, size_t offset, __global half *p); void __ovld vstorea_half_rtn(float data, size_t offset, __global half *p); void __ovld vstorea_half2_rtn(float2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rtn(float3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rtn(float4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rtn(float8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rtn(float16 data, size_t offset, __global half *p); void __ovld vstorea_half(float data, size_t offset, __local half *p); void __ovld vstorea_half2(float2 data, size_t offset, __local half *p); void __ovld vstorea_half3(float3 data, size_t offset, __local half *p); void __ovld vstorea_half4(float4 data, size_t offset, __local half *p); void __ovld vstorea_half8(float8 data, size_t offset, __local half *p); void __ovld vstorea_half16(float16 data, size_t offset, __local half *p); void __ovld vstorea_half_rte(float data, size_t offset, __local half *p); void __ovld vstorea_half2_rte(float2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rte(float3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rte(float4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rte(float8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rte(float16 data, size_t offset, __local half *p); void __ovld vstorea_half_rtz(float data, size_t offset, __local half *p); void __ovld vstorea_half2_rtz(float2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rtz(float3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rtz(float4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rtz(float8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rtz(float16 data, size_t offset, __local half *p); void __ovld vstorea_half_rtp(float data, size_t offset, __local half *p); void __ovld vstorea_half2_rtp(float2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rtp(float3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rtp(float4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rtp(float8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rtp(float16 data, size_t offset, __local half *p); void __ovld vstorea_half_rtn(float data, size_t offset, __local half *p); void __ovld vstorea_half2_rtn(float2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rtn(float3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rtn(float4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rtn(float8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rtn(float16 data, size_t offset, __local half *p); void __ovld vstorea_half(float data, size_t offset, __private half *p); void __ovld vstorea_half2(float2 data, size_t offset, __private half *p); void __ovld vstorea_half3(float3 data, size_t offset, __private half *p); void __ovld vstorea_half4(float4 data, size_t offset, __private half *p); void __ovld vstorea_half8(float8 data, size_t offset, __private half *p); void __ovld vstorea_half16(float16 data, size_t offset, __private half *p); void __ovld vstorea_half_rte(float data, size_t offset, __private half *p); void __ovld vstorea_half2_rte(float2 data, size_t offset, __private half *p); void __ovld vstorea_half3_rte(float3 data, size_t offset, __private half *p); void __ovld vstorea_half4_rte(float4 data, size_t offset, __private half *p); void __ovld vstorea_half8_rte(float8 data, size_t offset, __private half *p); void __ovld vstorea_half16_rte(float16 data, size_t offset, __private half *p); void __ovld vstorea_half_rtz(float data, size_t offset, __private half *p); void __ovld vstorea_half2_rtz(float2 data, size_t offset, __private half *p); void __ovld vstorea_half3_rtz(float3 data, size_t offset, __private half *p); void __ovld vstorea_half4_rtz(float4 data, size_t offset, __private half *p); void __ovld vstorea_half8_rtz(float8 data, size_t offset, __private half *p); void __ovld vstorea_half16_rtz(float16 data, size_t offset, __private half *p); void __ovld vstorea_half_rtp(float data, size_t offset, __private half *p); void __ovld vstorea_half2_rtp(float2 data, size_t offset, __private half *p); void __ovld vstorea_half3_rtp(float3 data, size_t offset, __private half *p); void __ovld vstorea_half4_rtp(float4 data, size_t offset, __private half *p); void __ovld vstorea_half8_rtp(float8 data, size_t offset, __private half *p); void __ovld vstorea_half16_rtp(float16 data, size_t offset, __private half *p); void __ovld vstorea_half_rtn(float data, size_t offset, __private half *p); void __ovld vstorea_half2_rtn(float2 data, size_t offset, __private half *p); void __ovld vstorea_half3_rtn(float3 data, size_t offset, __private half *p); void __ovld vstorea_half4_rtn(float4 data, size_t offset, __private half *p); void __ovld vstorea_half8_rtn(float8 data, size_t offset, __private half *p); void __ovld vstorea_half16_rtn(float16 data, size_t offset, __private half *p); #ifdef cl_khr_fp64 void __ovld vstorea_half(double data, size_t offset, __global half *p); void __ovld vstorea_half2(double2 data, size_t offset, __global half *p); void __ovld vstorea_half3(double3 data, size_t offset, __global half *p); void __ovld vstorea_half4(double4 data, size_t offset, __global half *p); void __ovld vstorea_half8(double8 data, size_t offset, __global half *p); void __ovld vstorea_half16(double16 data, size_t offset, __global half *p); void __ovld vstorea_half_rte(double data, size_t offset, __global half *p); void __ovld vstorea_half2_rte(double2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rte(double3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rte(double4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rte(double8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rte(double16 data, size_t offset, __global half *p); void __ovld vstorea_half_rtz(double data, size_t offset, __global half *p); void __ovld vstorea_half2_rtz(double2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rtz(double3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rtz(double4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rtz(double8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rtz(double16 data, size_t offset, __global half *p); void __ovld vstorea_half_rtp(double data, size_t offset, __global half *p); void __ovld vstorea_half2_rtp(double2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rtp(double3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rtp(double4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rtp(double8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rtp(double16 data, size_t offset, __global half *p); void __ovld vstorea_half_rtn(double data, size_t offset, __global half *p); void __ovld vstorea_half2_rtn(double2 data, size_t offset, __global half *p); void __ovld vstorea_half3_rtn(double3 data, size_t offset, __global half *p); void __ovld vstorea_half4_rtn(double4 data, size_t offset, __global half *p); void __ovld vstorea_half8_rtn(double8 data, size_t offset, __global half *p); void __ovld vstorea_half16_rtn(double16 data, size_t offset, __global half *p); void __ovld vstorea_half(double data, size_t offset, __local half *p); void __ovld vstorea_half2(double2 data, size_t offset, __local half *p); void __ovld vstorea_half3(double3 data, size_t offset, __local half *p); void __ovld vstorea_half4(double4 data, size_t offset, __local half *p); void __ovld vstorea_half8(double8 data, size_t offset, __local half *p); void __ovld vstorea_half16(double16 data, size_t offset, __local half *p); void __ovld vstorea_half_rte(double data, size_t offset, __local half *p); void __ovld vstorea_half2_rte(double2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rte(double3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rte(double4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rte(double8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rte(double16 data, size_t offset, __local half *p); void __ovld vstorea_half_rtz(double data, size_t offset, __local half *p); void __ovld vstorea_half2_rtz(double2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rtz(double3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rtz(double4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rtz(double8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rtz(double16 data, size_t offset, __local half *p); void __ovld vstorea_half_rtp(double data, size_t offset, __local half *p); void __ovld vstorea_half2_rtp(double2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rtp(double3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rtp(double4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rtp(double8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rtp(double16 data, size_t offset, __local half *p); void __ovld vstorea_half_rtn(double data, size_t offset, __local half *p); void __ovld vstorea_half2_rtn(double2 data, size_t offset, __local half *p); void __ovld vstorea_half3_rtn(double3 data, size_t offset, __local half *p); void __ovld vstorea_half4_rtn(double4 data, size_t offset, __local half *p); void __ovld vstorea_half8_rtn(double8 data, size_t offset, __local half *p); void __ovld vstorea_half16_rtn(double16 data, size_t offset, __local half *p); void __ovld vstorea_half(double data, size_t offset, __private half *p); void __ovld vstorea_half2(double2 data, size_t offset, __private half *p); void __ovld vstorea_half3(double3 data, size_t offset, __private half *p); void __ovld vstorea_half4(double4 data, size_t offset, __private half *p); void __ovld vstorea_half8(double8 data, size_t offset, __private half *p); void __ovld vstorea_half16(double16 data, size_t offset, __private half *p); void __ovld vstorea_half_rte(double data, size_t offset, __private half *p); void __ovld vstorea_half2_rte(double2 data, size_t offset, __private half *p); void __ovld vstorea_half3_rte(double3 data, size_t offset, __private half *p); void __ovld vstorea_half4_rte(double4 data, size_t offset, __private half *p); void __ovld vstorea_half8_rte(double8 data, size_t offset, __private half *p); void __ovld vstorea_half16_rte(double16 data, size_t offset, __private half *p); void __ovld vstorea_half_rtz(double data, size_t offset, __private half *p); void __ovld vstorea_half2_rtz(double2 data, size_t offset, __private half *p); void __ovld vstorea_half3_rtz(double3 data, size_t offset, __private half *p); void __ovld vstorea_half4_rtz(double4 data, size_t offset, __private half *p); void __ovld vstorea_half8_rtz(double8 data, size_t offset, __private half *p); void __ovld vstorea_half16_rtz(double16 data, size_t offset, __private half *p); void __ovld vstorea_half_rtp(double data, size_t offset, __private half *p); void __ovld vstorea_half2_rtp(double2 data, size_t offset, __private half *p); void __ovld vstorea_half3_rtp(double3 data, size_t offset, __private half *p); void __ovld vstorea_half4_rtp(double4 data, size_t offset, __private half *p); void __ovld vstorea_half8_rtp(double8 data, size_t offset, __private half *p); void __ovld vstorea_half16_rtp(double16 data, size_t offset, __private half *p); void __ovld vstorea_half_rtn(double data, size_t offset, __private half *p); void __ovld vstorea_half2_rtn(double2 data,size_t offset, __private half *p); void __ovld vstorea_half3_rtn(double3 data,size_t offset, __private half *p); void __ovld vstorea_half4_rtn(double4 data,size_t offset, __private half *p); void __ovld vstorea_half8_rtn(double8 data,size_t offset, __private half *p); void __ovld vstorea_half16_rtn(double16 data,size_t offset, __private half *p); #endif //cl_khr_fp64 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL v1.1 s6.11.8, v1.2 s6.12.8, v2.0 s6.13.8 - Synchronization Functions /** * All work-items in a work-group executing the kernel * on a processor must execute this function before any * are allowed to continue execution beyond the barrier. * This function must be encountered by all work-items in * a work-group executing the kernel. * If barrier is inside a conditional statement, then all * work-items must enter the conditional if any work-item * enters the conditional statement and executes the * barrier. * If barrer is inside a loop, all work-items must execute * the barrier for each iteration of the loop before any are * allowed to continue execution beyond the barrier. * The barrier function also queues a memory fence * (reads and writes) to ensure correct ordering of * memory operations to local or global memory. * The flags argument specifies the memory address space * and can be set to a combination of the following literal * values. * CLK_LOCAL_MEM_FENCE - The barrier function * will either flush any variables stored in local memory * or queue a memory fence to ensure correct ordering of * memory operations to local memory. * CLK_GLOBAL_MEM_FENCE - The barrier function * will queue a memory fence to ensure correct ordering * of memory operations to global memory. This can be * useful when work-items, for example, write to buffer or * image objects and then want to read the updated data. */ void __ovld __conv barrier(cl_mem_fence_flags flags); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv work_group_barrier(cl_mem_fence_flags flags, memory_scope scope); void __ovld __conv work_group_barrier(cl_mem_fence_flags flags); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL v1.1 s6.11.9, v1.2 s6.12.9 - Explicit Memory Fence Functions /** * Orders loads and stores of a work-item * executing a kernel. This means that loads * and stores preceding the mem_fence will * be committed to memory before any loads * and stores following the mem_fence. * The flags argument specifies the memory * address space and can be set to a * combination of the following literal * values: * CLK_LOCAL_MEM_FENCE * CLK_GLOBAL_MEM_FENCE. */ void __ovld mem_fence(cl_mem_fence_flags flags); /** * Read memory barrier that orders only * loads. * The flags argument specifies the memory * address space and can be set to a * combination of the following literal * values: * CLK_LOCAL_MEM_FENCE * CLK_GLOBAL_MEM_FENCE. */ void __ovld read_mem_fence(cl_mem_fence_flags flags); /** * Write memory barrier that orders only * stores. * The flags argument specifies the memory * address space and can be set to a * combination of the following literal * values: * CLK_LOCAL_MEM_FENCE * CLK_GLOBAL_MEM_FENCE. */ void __ovld write_mem_fence(cl_mem_fence_flags flags); // OpenCL v2.0 s6.13.9 - Address Space Qualifier Functions #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) cl_mem_fence_flags __ovld get_fence(const void *ptr); cl_mem_fence_flags __ovld get_fence(void *ptr); /** * Builtin functions to_global, to_local, and to_private need to be declared as Clang builtin functions * and checked in Sema since they should be declared as * addr gentype* to_addr (gentype*); * where gentype is builtin type or user defined type. */ #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL v1.1 s6.11.10, v1.2 s6.12.10, v2.0 s6.13.10 - Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch /** * event_t async_work_group_copy ( * __global gentype *dst, * const __local gentype *src, * size_t num_elements, * event_t event) * Perform an async copy of num_elements * gentype elements from src to dst. The async * copy is performed by all work-items in a workgroup * and this built-in function must therefore * be encountered by all work-items in a workgroup * executing the kernel with the same * argument values; otherwise the results are * undefined. * Returns an event object that can be used by * wait_group_events to wait for the async copy * to finish. The event argument can also be used * to associate the async_work_group_copy with * a previous async copy allowing an event to be * shared by multiple async copies; otherwise event * should be zero. * If event argument is non-zero, the event object * supplied in event argument will be returned. * This function does not perform any implicit * synchronization of source data such as using a * barrier before performing the copy. */ event_t __ovld async_work_group_copy(__local char *dst, const __global char *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uchar *dst, const __global uchar *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local short *dst, const __global short *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ushort *dst, const __global ushort *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local int *dst, const __global int *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uint *dst, const __global uint *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local long *dst, const __global long *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ulong *dst, const __global ulong *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local float *dst, const __global float *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local char2 *dst, const __global char2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uchar2 *dst, const __global uchar2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local short2 *dst, const __global short2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ushort2 *dst, const __global ushort2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local int2 *dst, const __global int2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uint2 *dst, const __global uint2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local long2 *dst, const __global long2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ulong2 *dst, const __global ulong2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local float2 *dst, const __global float2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local char3 *dst, const __global char3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uchar3 *dst, const __global uchar3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local short3 *dst, const __global short3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ushort3 *dst, const __global ushort3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local int3 *dst, const __global int3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uint3 *dst, const __global uint3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local long3 *dst, const __global long3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ulong3 *dst, const __global ulong3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local float3 *dst, const __global float3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local char4 *dst, const __global char4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uchar4 *dst, const __global uchar4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local short4 *dst, const __global short4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ushort4 *dst, const __global ushort4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local int4 *dst, const __global int4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uint4 *dst, const __global uint4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local long4 *dst, const __global long4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ulong4 *dst, const __global ulong4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local float4 *dst, const __global float4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local char8 *dst, const __global char8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uchar8 *dst, const __global uchar8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local short8 *dst, const __global short8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ushort8 *dst, const __global ushort8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local int8 *dst, const __global int8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uint8 *dst, const __global uint8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local long8 *dst, const __global long8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ulong8 *dst, const __global ulong8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local float8 *dst, const __global float8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local char16 *dst, const __global char16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uchar16 *dst, const __global uchar16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local short16 *dst, const __global short16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ushort16 *dst, const __global ushort16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local int16 *dst, const __global int16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local uint16 *dst, const __global uint16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local long16 *dst, const __global long16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local ulong16 *dst, const __global ulong16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local float16 *dst, const __global float16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global char *dst, const __local char *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uchar *dst, const __local uchar *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global short *dst, const __local short *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ushort *dst, const __local ushort *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global int *dst, const __local int *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uint *dst, const __local uint *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global long *dst, const __local long *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ulong *dst, const __local ulong *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global float *dst, const __local float *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global char2 *dst, const __local char2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uchar2 *dst, const __local uchar2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global short2 *dst, const __local short2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ushort2 *dst, const __local ushort2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global int2 *dst, const __local int2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uint2 *dst, const __local uint2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global long2 *dst, const __local long2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ulong2 *dst, const __local ulong2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global float2 *dst, const __local float2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global char3 *dst, const __local char3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uchar3 *dst, const __local uchar3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global short3 *dst, const __local short3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ushort3 *dst, const __local ushort3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global int3 *dst, const __local int3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uint3 *dst, const __local uint3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global long3 *dst, const __local long3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ulong3 *dst, const __local ulong3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global float3 *dst, const __local float3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global char4 *dst, const __local char4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uchar4 *dst, const __local uchar4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global short4 *dst, const __local short4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ushort4 *dst, const __local ushort4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global int4 *dst, const __local int4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uint4 *dst, const __local uint4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global long4 *dst, const __local long4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ulong4 *dst, const __local ulong4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global float4 *dst, const __local float4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global char8 *dst, const __local char8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uchar8 *dst, const __local uchar8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global short8 *dst, const __local short8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ushort8 *dst, const __local ushort8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global int8 *dst, const __local int8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uint8 *dst, const __local uint8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global long8 *dst, const __local long8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ulong8 *dst, const __local ulong8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global float8 *dst, const __local float8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global char16 *dst, const __local char16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uchar16 *dst, const __local uchar16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global short16 *dst, const __local short16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ushort16 *dst, const __local ushort16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global int16 *dst, const __local int16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global uint16 *dst, const __local uint16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, event_t event); #ifdef cl_khr_fp64 event_t __ovld async_work_group_copy(__local double *dst, const __global double *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local double4 *dst, const __global double4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local double8 *dst, const __global double8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local double16 *dst, const __global double16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global double *dst, const __local double *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global double2 *dst, const __local double2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global double3 *dst, const __local double3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, event_t event); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 event_t __ovld async_work_group_copy(__local half *dst, const __global half *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local half3 *dst, const __global half3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local half4 *dst, const __global half4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local half8 *dst, const __global half8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__local half16 *dst, const __global half16 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global half *dst, const __local half *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global half2 *dst, const __local half2 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global half3 *dst, const __local half3 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global half4 *dst, const __local half4 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global half8 *dst, const __local half8 *src, size_t num_elements, event_t event); event_t __ovld async_work_group_copy(__global half16 *dst, const __local half16 *src, size_t num_elements, event_t event); #endif //cl_khr_fp16 /** * Perform an async gather of num_elements * gentype elements from src to dst. The * src_stride is the stride in elements for each * gentype element read from src. The dst_stride * is the stride in elements for each gentype * element written to dst. The async gather is * performed by all work-items in a work-group. * This built-in function must therefore be * encountered by all work-items in a work-group * executing the kernel with the same argument * values; otherwise the results are undefined. * Returns an event object that can be used by * wait_group_events to wait for the async copy * to finish. The event argument can also be used * to associate the * async_work_group_strided_copy with a * previous async copy allowing an event to be * shared by multiple async copies; otherwise event * should be zero. * If event argument is non-zero, the event object * supplied in event argument will be returned. * This function does not perform any implicit * synchronization of source data such as using a * barrier before performing the copy. */ event_t __ovld async_work_group_strided_copy(__local char *dst, const __global char *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uchar *dst, const __global uchar *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local short *dst, const __global short *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ushort *dst, const __global ushort *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local int *dst, const __global int *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uint *dst, const __global uint *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local long *dst, const __global long *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ulong *dst, const __global ulong *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local float *dst, const __global float *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local char2 *dst, const __global char2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uchar2 *dst, const __global uchar2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local short2 *dst, const __global short2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ushort2 *dst, const __global ushort2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local int2 *dst, const __global int2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uint2 *dst, const __global uint2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local long2 *dst, const __global long2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ulong2 *dst, const __global ulong2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local float2 *dst, const __global float2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local char3 *dst, const __global char3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uchar3 *dst, const __global uchar3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local short3 *dst, const __global short3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ushort3 *dst, const __global ushort3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local int3 *dst, const __global int3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uint3 *dst, const __global uint3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local long3 *dst, const __global long3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ulong3 *dst, const __global ulong3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local float3 *dst, const __global float3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local char4 *dst, const __global char4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uchar4 *dst, const __global uchar4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local short4 *dst, const __global short4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ushort4 *dst, const __global ushort4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local int4 *dst, const __global int4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uint4 *dst, const __global uint4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local long4 *dst, const __global long4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ulong4 *dst, const __global ulong4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local float4 *dst, const __global float4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local char8 *dst, const __global char8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uchar8 *dst, const __global uchar8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local short8 *dst, const __global short8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ushort8 *dst, const __global ushort8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local int8 *dst, const __global int8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uint8 *dst, const __global uint8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local long8 *dst, const __global long8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ulong8 *dst, const __global ulong8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local float8 *dst, const __global float8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local char16 *dst, const __global char16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uchar16 *dst, const __global uchar16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local short16 *dst, const __global short16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ushort16 *dst, const __global ushort16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local int16 *dst, const __global int16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local uint16 *dst, const __global uint16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local long16 *dst, const __global long16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local ulong16 *dst, const __global ulong16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local float16 *dst, const __global float16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global char *dst, const __local char *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uchar *dst, const __local uchar *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global short *dst, const __local short *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ushort *dst, const __local ushort *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global int *dst, const __local int *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uint *dst, const __local uint *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global long *dst, const __local long *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ulong *dst, const __local ulong *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global float *dst, const __local float *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global char2 *dst, const __local char2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uchar2 *dst, const __local uchar2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global short2 *dst, const __local short2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ushort2 *dst, const __local ushort2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global int2 *dst, const __local int2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uint2 *dst, const __local uint2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global long2 *dst, const __local long2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ulong2 *dst, const __local ulong2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global float2 *dst, const __local float2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global char3 *dst, const __local char3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uchar3 *dst, const __local uchar3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global short3 *dst, const __local short3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ushort3 *dst, const __local ushort3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global int3 *dst, const __local int3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uint3 *dst, const __local uint3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global long3 *dst, const __local long3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ulong3 *dst, const __local ulong3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global float3 *dst, const __local float3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global char4 *dst, const __local char4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uchar4 *dst, const __local uchar4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global short4 *dst, const __local short4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ushort4 *dst, const __local ushort4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global int4 *dst, const __local int4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uint4 *dst, const __local uint4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global long4 *dst, const __local long4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ulong4 *dst, const __local ulong4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global float4 *dst, const __local float4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global char8 *dst, const __local char8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uchar8 *dst, const __local uchar8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global short8 *dst, const __local short8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ushort8 *dst, const __local ushort8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global int8 *dst, const __local int8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uint8 *dst, const __local uint8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global long8 *dst, const __local long8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ulong8 *dst, const __local ulong8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global float8 *dst, const __local float8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global char16 *dst, const __local char16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uchar16 *dst, const __local uchar16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global short16 *dst, const __local short16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ushort16 *dst, const __local ushort16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global int16 *dst, const __local int16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global uint16 *dst, const __local uint16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, size_t dst_stride, event_t event); #ifdef cl_khr_fp64 event_t __ovld async_work_group_strided_copy(__local double *dst, const __global double *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local double4 *dst, const __global double4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local double8 *dst, const __global double8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local double16 *dst, const __global double16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global double *dst, const __local double *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global double2 *dst, const __local double2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global double3 *dst, const __local double3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, size_t dst_stride, event_t event); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 event_t __ovld async_work_group_strided_copy(__local half *dst, const __global half *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local half3 *dst, const __global half3 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local half4 *dst, const __global half4 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local half8 *dst, const __global half8 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__local half16 *dst, const __global half16 *src, size_t num_elements, size_t src_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global half *dst, const __local half *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global half2 *dst, const __local half2 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global half3 *dst, const __local half3 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global half4 *dst, const __local half4 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global half8 *dst, const __local half8 *src, size_t num_elements, size_t dst_stride, event_t event); event_t __ovld async_work_group_strided_copy(__global half16 *dst, const __local half16 *src, size_t num_elements, size_t dst_stride, event_t event); #endif //cl_khr_fp16 /** * Wait for events that identify the * async_work_group_copy operations to * complete. The event objects specified in * event_list will be released after the wait is * performed. * This function must be encountered by all workitems * in a work-group executing the kernel with * the same num_events and event objects specified * in event_list; otherwise the results are undefined. */ void __ovld wait_group_events(int num_events, event_t *event_list); /** * Prefetch num_elements * sizeof(gentype) * bytes into the global cache. The prefetch * instruction is applied to a work-item in a workgroup * and does not affect the functional * behavior of the kernel. */ void __ovld prefetch(const __global char *p, size_t num_elements); void __ovld prefetch(const __global uchar *p, size_t num_elements); void __ovld prefetch(const __global short *p, size_t num_elements); void __ovld prefetch(const __global ushort *p, size_t num_elements); void __ovld prefetch(const __global int *p, size_t num_elements); void __ovld prefetch(const __global uint *p, size_t num_elements); void __ovld prefetch(const __global long *p, size_t num_elements); void __ovld prefetch(const __global ulong *p, size_t num_elements); void __ovld prefetch(const __global float *p, size_t num_elements); void __ovld prefetch(const __global char2 *p, size_t num_elements); void __ovld prefetch(const __global uchar2 *p, size_t num_elements); void __ovld prefetch(const __global short2 *p, size_t num_elements); void __ovld prefetch(const __global ushort2 *p, size_t num_elements); void __ovld prefetch(const __global int2 *p, size_t num_elements); void __ovld prefetch(const __global uint2 *p, size_t num_elements); void __ovld prefetch(const __global long2 *p, size_t num_elements); void __ovld prefetch(const __global ulong2 *p, size_t num_elements); void __ovld prefetch(const __global float2 *p, size_t num_elements); void __ovld prefetch(const __global char3 *p, size_t num_elements); void __ovld prefetch(const __global uchar3 *p, size_t num_elements); void __ovld prefetch(const __global short3 *p, size_t num_elements); void __ovld prefetch(const __global ushort3 *p, size_t num_elements); void __ovld prefetch(const __global int3 *p, size_t num_elements); void __ovld prefetch(const __global uint3 *p, size_t num_elements); void __ovld prefetch(const __global long3 *p, size_t num_elements); void __ovld prefetch(const __global ulong3 *p, size_t num_elements); void __ovld prefetch(const __global float3 *p, size_t num_elements); void __ovld prefetch(const __global char4 *p, size_t num_elements); void __ovld prefetch(const __global uchar4 *p, size_t num_elements); void __ovld prefetch(const __global short4 *p, size_t num_elements); void __ovld prefetch(const __global ushort4 *p, size_t num_elements); void __ovld prefetch(const __global int4 *p, size_t num_elements); void __ovld prefetch(const __global uint4 *p, size_t num_elements); void __ovld prefetch(const __global long4 *p, size_t num_elements); void __ovld prefetch(const __global ulong4 *p, size_t num_elements); void __ovld prefetch(const __global float4 *p, size_t num_elements); void __ovld prefetch(const __global char8 *p, size_t num_elements); void __ovld prefetch(const __global uchar8 *p, size_t num_elements); void __ovld prefetch(const __global short8 *p, size_t num_elements); void __ovld prefetch(const __global ushort8 *p, size_t num_elements); void __ovld prefetch(const __global int8 *p, size_t num_elements); void __ovld prefetch(const __global uint8 *p, size_t num_elements); void __ovld prefetch(const __global long8 *p, size_t num_elements); void __ovld prefetch(const __global ulong8 *p, size_t num_elements); void __ovld prefetch(const __global float8 *p, size_t num_elements); void __ovld prefetch(const __global char16 *p, size_t num_elements); void __ovld prefetch(const __global uchar16 *p, size_t num_elements); void __ovld prefetch(const __global short16 *p, size_t num_elements); void __ovld prefetch(const __global ushort16 *p, size_t num_elements); void __ovld prefetch(const __global int16 *p, size_t num_elements); void __ovld prefetch(const __global uint16 *p, size_t num_elements); void __ovld prefetch(const __global long16 *p, size_t num_elements); void __ovld prefetch(const __global ulong16 *p, size_t num_elements); void __ovld prefetch(const __global float16 *p, size_t num_elements); #ifdef cl_khr_fp64 void __ovld prefetch(const __global double *p, size_t num_elements); void __ovld prefetch(const __global double2 *p, size_t num_elements); void __ovld prefetch(const __global double3 *p, size_t num_elements); void __ovld prefetch(const __global double4 *p, size_t num_elements); void __ovld prefetch(const __global double8 *p, size_t num_elements); void __ovld prefetch(const __global double16 *p, size_t num_elements); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 void __ovld prefetch(const __global half *p, size_t num_elements); void __ovld prefetch(const __global half2 *p, size_t num_elements); void __ovld prefetch(const __global half3 *p, size_t num_elements); void __ovld prefetch(const __global half4 *p, size_t num_elements); void __ovld prefetch(const __global half8 *p, size_t num_elements); void __ovld prefetch(const __global half16 *p, size_t num_elements); #endif // cl_khr_fp16 // OpenCL v1.1 s6.11.1, v1.2 s6.12.11 - Atomic Functions #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable #pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * (old + val) and store result at location * pointed by p. The function returns old. */ int __ovld atomic_add(volatile __global int *p, int val); unsigned int __ovld atomic_add(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_add(volatile __local int *p, int val); unsigned int __ovld atomic_add(volatile __local unsigned int *p, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_add(volatile int *p, int val); unsigned int __ovld atomic_add(volatile unsigned int *p, unsigned int val); #endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_add(volatile __global int *p, int val); unsigned int __ovld atom_add(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_base_atomics) int __ovld atom_add(volatile __local int *p, int val); unsigned int __ovld atom_add(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_base_atomics) long __ovld atom_add(volatile __global long *p, long val); unsigned long __ovld atom_add(volatile __global unsigned long *p, unsigned long val); long __ovld atom_add(volatile __local long *p, long val); unsigned long __ovld atom_add(volatile __local unsigned long *p, unsigned long val); #endif /** * Read the 32-bit value (referred to as old) stored at location pointed by p. * Compute (old - val) and store result at location pointed by p. The function * returns old. */ int __ovld atomic_sub(volatile __global int *p, int val); unsigned int __ovld atomic_sub(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_sub(volatile __local int *p, int val); unsigned int __ovld atomic_sub(volatile __local unsigned int *p, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_sub(volatile int *p, int val); unsigned int __ovld atomic_sub(volatile unsigned int *p, unsigned int val); #endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_sub(volatile __global int *p, int val); unsigned int __ovld atom_sub(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_base_atomics) int __ovld atom_sub(volatile __local int *p, int val); unsigned int __ovld atom_sub(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_base_atomics) long __ovld atom_sub(volatile __global long *p, long val); unsigned long __ovld atom_sub(volatile __global unsigned long *p, unsigned long val); long __ovld atom_sub(volatile __local long *p, long val); unsigned long __ovld atom_sub(volatile __local unsigned long *p, unsigned long val); #endif /** * Swaps the old value stored at location p * with new value given by val. Returns old * value. */ int __ovld atomic_xchg(volatile __global int *p, int val); unsigned int __ovld atomic_xchg(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_xchg(volatile __local int *p, int val); unsigned int __ovld atomic_xchg(volatile __local unsigned int *p, unsigned int val); float __ovld atomic_xchg(volatile __global float *p, float val); float __ovld atomic_xchg(volatile __local float *p, float val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_xchg(volatile int *p, int val); unsigned int __ovld atomic_xchg(volatile unsigned int *p, unsigned int val); float __ovld atomic_xchg(volatile float *p, float val); #endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_xchg(volatile __global int *p, int val); unsigned int __ovld atom_xchg(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_base_atomics) int __ovld atom_xchg(volatile __local int *p, int val); unsigned int __ovld atom_xchg(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_base_atomics) long __ovld atom_xchg(volatile __global long *p, long val); long __ovld atom_xchg(volatile __local long *p, long val); unsigned long __ovld atom_xchg(volatile __global unsigned long *p, unsigned long val); unsigned long __ovld atom_xchg(volatile __local unsigned long *p, unsigned long val); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * (old + 1) and store result at location * pointed by p. The function returns old. */ int __ovld atomic_inc(volatile __global int *p); unsigned int __ovld atomic_inc(volatile __global unsigned int *p); int __ovld atomic_inc(volatile __local int *p); unsigned int __ovld atomic_inc(volatile __local unsigned int *p); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_inc(volatile int *p); unsigned int __ovld atomic_inc(volatile unsigned int *p); #endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_inc(volatile __global int *p); unsigned int __ovld atom_inc(volatile __global unsigned int *p); #endif #if defined(cl_khr_local_int32_base_atomics) int __ovld atom_inc(volatile __local int *p); unsigned int __ovld atom_inc(volatile __local unsigned int *p); #endif #if defined(cl_khr_int64_base_atomics) long __ovld atom_inc(volatile __global long *p); unsigned long __ovld atom_inc(volatile __global unsigned long *p); long __ovld atom_inc(volatile __local long *p); unsigned long __ovld atom_inc(volatile __local unsigned long *p); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * (old - 1) and store result at location * pointed by p. The function returns old. */ int __ovld atomic_dec(volatile __global int *p); unsigned int __ovld atomic_dec(volatile __global unsigned int *p); int __ovld atomic_dec(volatile __local int *p); unsigned int __ovld atomic_dec(volatile __local unsigned int *p); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_dec(volatile int *p); unsigned int __ovld atomic_dec(volatile unsigned int *p); #endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_dec(volatile __global int *p); unsigned int __ovld atom_dec(volatile __global unsigned int *p); #endif #if defined(cl_khr_local_int32_base_atomics) int __ovld atom_dec(volatile __local int *p); unsigned int __ovld atom_dec(volatile __local unsigned int *p); #endif #if defined(cl_khr_int64_base_atomics) long __ovld atom_dec(volatile __global long *p); unsigned long __ovld atom_dec(volatile __global unsigned long *p); long __ovld atom_dec(volatile __local long *p); unsigned long __ovld atom_dec(volatile __local unsigned long *p); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * (old == cmp) ? val : old and store result at * location pointed by p. The function * returns old. */ int __ovld atomic_cmpxchg(volatile __global int *p, int cmp, int val); unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val); int __ovld atomic_cmpxchg(volatile __local int *p, int cmp, int val); unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_cmpxchg(volatile int *p, int cmp, int val); unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp, unsigned int val); #endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_cmpxchg(volatile __global int *p, int cmp, int val); unsigned int __ovld atom_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val); #endif #if defined(cl_khr_local_int32_base_atomics) int __ovld atom_cmpxchg(volatile __local int *p, int cmp, int val); unsigned int __ovld atom_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val); #endif #if defined(cl_khr_int64_base_atomics) long __ovld atom_cmpxchg(volatile __global long *p, long cmp, long val); unsigned long __ovld atom_cmpxchg(volatile __global unsigned long *p, unsigned long cmp, unsigned long val); long __ovld atom_cmpxchg(volatile __local long *p, long cmp, long val); unsigned long __ovld atom_cmpxchg(volatile __local unsigned long *p, unsigned long cmp, unsigned long val); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * min(old, val) and store minimum value at * location pointed by p. The function * returns old. */ int __ovld atomic_min(volatile __global int *p, int val); unsigned int __ovld atomic_min(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_min(volatile __local int *p, int val); unsigned int __ovld atomic_min(volatile __local unsigned int *p, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_min(volatile int *p, int val); unsigned int __ovld atomic_min(volatile unsigned int *p, unsigned int val); #endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_min(volatile __global int *p, int val); unsigned int __ovld atom_min(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_extended_atomics) int __ovld atom_min(volatile __local int *p, int val); unsigned int __ovld atom_min(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_extended_atomics) long __ovld atom_min(volatile __global long *p, long val); unsigned long __ovld atom_min(volatile __global unsigned long *p, unsigned long val); long __ovld atom_min(volatile __local long *p, long val); unsigned long __ovld atom_min(volatile __local unsigned long *p, unsigned long val); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * max(old, val) and store maximum value at * location pointed by p. The function * returns old. */ int __ovld atomic_max(volatile __global int *p, int val); unsigned int __ovld atomic_max(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_max(volatile __local int *p, int val); unsigned int __ovld atomic_max(volatile __local unsigned int *p, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_max(volatile int *p, int val); unsigned int __ovld atomic_max(volatile unsigned int *p, unsigned int val); #endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_max(volatile __global int *p, int val); unsigned int __ovld atom_max(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_extended_atomics) int __ovld atom_max(volatile __local int *p, int val); unsigned int __ovld atom_max(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_extended_atomics) long __ovld atom_max(volatile __global long *p, long val); unsigned long __ovld atom_max(volatile __global unsigned long *p, unsigned long val); long __ovld atom_max(volatile __local long *p, long val); unsigned long __ovld atom_max(volatile __local unsigned long *p, unsigned long val); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * (old & val) and store result at location * pointed by p. The function returns old. */ int __ovld atomic_and(volatile __global int *p, int val); unsigned int __ovld atomic_and(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_and(volatile __local int *p, int val); unsigned int __ovld atomic_and(volatile __local unsigned int *p, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_and(volatile int *p, int val); unsigned int __ovld atomic_and(volatile unsigned int *p, unsigned int val); #endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_and(volatile __global int *p, int val); unsigned int __ovld atom_and(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_extended_atomics) int __ovld atom_and(volatile __local int *p, int val); unsigned int __ovld atom_and(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_extended_atomics) long __ovld atom_and(volatile __global long *p, long val); unsigned long __ovld atom_and(volatile __global unsigned long *p, unsigned long val); long __ovld atom_and(volatile __local long *p, long val); unsigned long __ovld atom_and(volatile __local unsigned long *p, unsigned long val); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * (old | val) and store result at location * pointed by p. The function returns old. */ int __ovld atomic_or(volatile __global int *p, int val); unsigned int __ovld atomic_or(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_or(volatile __local int *p, int val); unsigned int __ovld atomic_or(volatile __local unsigned int *p, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_or(volatile int *p, int val); unsigned int __ovld atomic_or(volatile unsigned int *p, unsigned int val); #endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_or(volatile __global int *p, int val); unsigned int __ovld atom_or(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_extended_atomics) int __ovld atom_or(volatile __local int *p, int val); unsigned int __ovld atom_or(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_extended_atomics) long __ovld atom_or(volatile __global long *p, long val); unsigned long __ovld atom_or(volatile __global unsigned long *p, unsigned long val); long __ovld atom_or(volatile __local long *p, long val); unsigned long __ovld atom_or(volatile __local unsigned long *p, unsigned long val); #endif /** * Read the 32-bit value (referred to as old) * stored at location pointed by p. Compute * (old ^ val) and store result at location * pointed by p. The function returns old. */ int __ovld atomic_xor(volatile __global int *p, int val); unsigned int __ovld atomic_xor(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_xor(volatile __local int *p, int val); unsigned int __ovld atomic_xor(volatile __local unsigned int *p, unsigned int val); #ifdef __OPENCL_CPP_VERSION__ int __ovld atomic_xor(volatile int *p, int val); unsigned int __ovld atomic_xor(volatile unsigned int *p, unsigned int val); #endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_xor(volatile __global int *p, int val); unsigned int __ovld atom_xor(volatile __global unsigned int *p, unsigned int val); #endif #if defined(cl_khr_local_int32_extended_atomics) int __ovld atom_xor(volatile __local int *p, int val); unsigned int __ovld atom_xor(volatile __local unsigned int *p, unsigned int val); #endif #if defined(cl_khr_int64_extended_atomics) long __ovld atom_xor(volatile __global long *p, long val); unsigned long __ovld atom_xor(volatile __global unsigned long *p, unsigned long val); long __ovld atom_xor(volatile __local long *p, long val); unsigned long __ovld atom_xor(volatile __local unsigned long *p, unsigned long val); #endif #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #pragma OPENCL EXTENSION cl_khr_int64_base_atomics : disable #pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : disable #endif // OpenCL v2.0 s6.13.11 - Atomics Functions #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // double atomics support requires extensions cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable #pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable #endif // atomic_init() void __ovld atomic_init(volatile atomic_int *object, int value); void __ovld atomic_init(volatile atomic_uint *object, uint value); void __ovld atomic_init(volatile atomic_float *object, float value); #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) void __ovld atomic_init(volatile atomic_long *object, long value); void __ovld atomic_init(volatile atomic_ulong *object, ulong value); #ifdef cl_khr_fp64 void __ovld atomic_init(volatile atomic_double *object, double value); #endif //cl_khr_fp64 #endif // atomic_work_item_fence() void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order, memory_scope scope); // atomic_fetch() int __ovld atomic_fetch_add(volatile atomic_int *object, int operand); int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order); int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_add(volatile atomic_uint *object, uint operand); uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order); uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope); int __ovld atomic_fetch_sub(volatile atomic_int *object, int operand); int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order); int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_sub(volatile atomic_uint *object, uint operand); uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order); uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope); int __ovld atomic_fetch_or(volatile atomic_int *object, int operand); int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order); int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_or(volatile atomic_uint *object, uint operand); uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order); uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope); int __ovld atomic_fetch_xor(volatile atomic_int *object, int operand); int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order); int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_xor(volatile atomic_uint *object, uint operand); uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order); uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope); int __ovld atomic_fetch_and(volatile atomic_int *object, int operand); int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order); int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_and(volatile atomic_uint *object, uint operand); uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order); uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope); int __ovld atomic_fetch_min(volatile atomic_int *object, int operand); int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order); int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_min(volatile atomic_uint *object, uint operand); uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order); uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_min(volatile atomic_uint *object, int operand); uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, int operand, memory_order order); uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, int operand, memory_order order, memory_scope scope); int __ovld atomic_fetch_max(volatile atomic_int *object, int operand); int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order); int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_max(volatile atomic_uint *object, uint operand); uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order); uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope); uint __ovld atomic_fetch_max(volatile atomic_uint *object, int operand); uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, int operand, memory_order order); uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, int operand, memory_order order, memory_scope scope); #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) long __ovld atomic_fetch_add(volatile atomic_long *object, long operand); long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order); long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_add(volatile atomic_ulong *object, ulong operand); ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order); ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope); long __ovld atomic_fetch_sub(volatile atomic_long *object, long operand); long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order); long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_sub(volatile atomic_ulong *object, ulong operand); ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order); ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope); long __ovld atomic_fetch_or(volatile atomic_long *object, long operand); long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order); long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_or(volatile atomic_ulong *object, ulong operand); ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order); ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope); long __ovld atomic_fetch_xor(volatile atomic_long *object, long operand); long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order); long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_xor(volatile atomic_ulong *object, ulong operand); ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order); ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope); long __ovld atomic_fetch_and(volatile atomic_long *object, long operand); long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order); long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_and(volatile atomic_ulong *object, ulong operand); ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order); ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope); long __ovld atomic_fetch_min(volatile atomic_long *object, long operand); long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order); long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, ulong operand); ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order); ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, long operand); ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, long operand, memory_order order); ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, long operand, memory_order order, memory_scope scope); long __ovld atomic_fetch_max(volatile atomic_long *object, long operand); long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order); long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, ulong operand); ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order); ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope); ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, long operand); ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long operand, memory_order order); ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long operand, memory_order order, memory_scope scope); #endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) // OpenCL v2.0 s6.13.11.7.5: // add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument can be ptrdiff_t. // or/xor/and/min/max: atomic type argument can be intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t. #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object, ptrdiff_t operand); uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order); uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope); uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object, ptrdiff_t operand); uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order); uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope); uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object, intptr_t operand); uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order); uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope); uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object, intptr_t operand); uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order); uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope); uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object, intptr_t operand); uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order); uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope); uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object, intptr_t opermax); uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder); uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope); uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object, intptr_t opermax); uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder); uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope); intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object, uintptr_t operand); intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order); intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope); intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object, uintptr_t operand); intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order); intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope); intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object, uintptr_t operand); intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order); intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope); intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object, uintptr_t opermax); intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder); intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope); intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object, uintptr_t opermax); intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder); intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope); #endif // atomic_store() void __ovld atomic_store(volatile atomic_int *object, int desired); void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order); void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope); void __ovld atomic_store(volatile atomic_uint *object, uint desired); void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order); void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope); void __ovld atomic_store(volatile atomic_float *object, float desired); void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order); void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope); #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #ifdef cl_khr_fp64 void __ovld atomic_store(volatile atomic_double *object, double desired); void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order); void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope); #endif //cl_khr_fp64 void __ovld atomic_store(volatile atomic_long *object, long desired); void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order); void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope); void __ovld atomic_store(volatile atomic_ulong *object, ulong desired); void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order); void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope); #endif // atomic_load() int __ovld atomic_load(volatile atomic_int *object); int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order); int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order, memory_scope scope); uint __ovld atomic_load(volatile atomic_uint *object); uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order); uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order, memory_scope scope); float __ovld atomic_load(volatile atomic_float *object); float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order); float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order, memory_scope scope); #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #ifdef cl_khr_fp64 double __ovld atomic_load(volatile atomic_double *object); double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order); double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order, memory_scope scope); #endif //cl_khr_fp64 long __ovld atomic_load(volatile atomic_long *object); long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order); long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order, memory_scope scope); ulong __ovld atomic_load(volatile atomic_ulong *object); ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order); ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order, memory_scope scope); #endif // atomic_exchange() int __ovld atomic_exchange(volatile atomic_int *object, int desired); int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order); int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope); uint __ovld atomic_exchange(volatile atomic_uint *object, uint desired); uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order); uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope); float __ovld atomic_exchange(volatile atomic_float *object, float desired); float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order); float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope); #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #ifdef cl_khr_fp64 double __ovld atomic_exchange(volatile atomic_double *object, double desired); double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order); double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope); #endif //cl_khr_fp64 long __ovld atomic_exchange(volatile atomic_long *object, long desired); long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order); long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope); ulong __ovld atomic_exchange(volatile atomic_ulong *object, ulong desired); ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order); ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope); #endif // atomic_compare_exchange_strong() and atomic_compare_exchange_weak() bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object, int *expected, int desired); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected, int desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected, int desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object, uint *expected, uint desired); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected, uint desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected, uint desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object, int *expected, int desired); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected, int desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected, int desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object, uint *expected, uint desired); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected, uint desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected, uint desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object, float *expected, float desired); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected, float desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected, float desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object, float *expected, float desired); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected, float desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected, float desired, memory_order success, memory_order failure, memory_scope scope); #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #ifdef cl_khr_fp64 bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object, double *expected, double desired); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected, double desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected, double desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object, double *expected, double desired); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected, double desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected, double desired, memory_order success, memory_order failure, memory_scope scope); #endif //cl_khr_fp64 bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object, long *expected, long desired); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected, long desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected, long desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object, long *expected, long desired); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected, long desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected, long desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object, ulong *expected, ulong desired); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected, ulong desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected, ulong desired, memory_order success, memory_order failure, memory_scope scope); bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object, ulong *expected, ulong desired); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected, ulong desired, memory_order success, memory_order failure); bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected, ulong desired, memory_order success, memory_order failure, memory_scope scope); #endif // atomic_flag_test_and_set() and atomic_flag_clear() bool __ovld atomic_flag_test_and_set(volatile atomic_flag *object); bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order); bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope); void __ovld atomic_flag_clear(volatile atomic_flag *object); void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order); void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL v1.1 s6.11.12, v1.2 s6.12.12, v2.0 s6.13.12 - Miscellaneous Vector Functions /** * The shuffle and shuffle2 built-in functions construct * a permutation of elements from one or two input * vectors respectively that are of the same type, * returning a vector with the same element type as the * input and length that is the same as the shuffle mask. * The size of each element in the mask must match the * size of each element in the result. For shuffle, only * the ilogb(2m-1) least significant bits of each mask * element are considered. For shuffle2, only the * ilogb(2m-1)+1 least significant bits of each mask * element are considered. Other bits in the mask shall * be ignored. * The elements of the input vectors are numbered from * left to right across one or both of the vectors. For this * purpose, the number of elements in a vector is given * by vec_step(gentypem). The shuffle mask operand * specifies, for each element of the result vector, which * element of the one or two input vectors the result * element gets. * Examples: * uint4 mask = (uint4)(3, 2, * 1, 0); * float4 a; * float4 r = shuffle(a, mask); * // r.s0123 = a.wzyx * uint8 mask = (uint8)(0, 1, 2, 3, * 4, 5, 6, 7); * float4 a, b; * float8 r = shuffle2(a, b, mask); * // r.s0123 = a.xyzw * // r.s4567 = b.xyzw * uint4 mask; * float8 a; * float4 b; * b = shuffle(a, mask); * Examples that are not valid are: * uint8 mask; * short16 a; * short8 b; * b = shuffle(a, mask); <- not valid */ char2 __ovld __cnfn shuffle(char2 x, uchar2 mask); char2 __ovld __cnfn shuffle(char4 x, uchar2 mask); char2 __ovld __cnfn shuffle(char8 x, uchar2 mask); char2 __ovld __cnfn shuffle(char16 x, uchar2 mask); uchar2 __ovld __cnfn shuffle(uchar2 x, uchar2 mask); uchar2 __ovld __cnfn shuffle(uchar4 x, uchar2 mask); uchar2 __ovld __cnfn shuffle(uchar8 x, uchar2 mask); uchar2 __ovld __cnfn shuffle(uchar16 x, uchar2 mask); short2 __ovld __cnfn shuffle(short2 x, ushort2 mask); short2 __ovld __cnfn shuffle(short4 x, ushort2 mask); short2 __ovld __cnfn shuffle(short8 x, ushort2 mask); short2 __ovld __cnfn shuffle(short16 x, ushort2 mask); ushort2 __ovld __cnfn shuffle(ushort2 x, ushort2 mask); ushort2 __ovld __cnfn shuffle(ushort4 x, ushort2 mask); ushort2 __ovld __cnfn shuffle(ushort8 x, ushort2 mask); ushort2 __ovld __cnfn shuffle(ushort16 x, ushort2 mask); int2 __ovld __cnfn shuffle(int2 x, uint2 mask); int2 __ovld __cnfn shuffle(int4 x, uint2 mask); int2 __ovld __cnfn shuffle(int8 x, uint2 mask); int2 __ovld __cnfn shuffle(int16 x, uint2 mask); uint2 __ovld __cnfn shuffle(uint2 x, uint2 mask); uint2 __ovld __cnfn shuffle(uint4 x, uint2 mask); uint2 __ovld __cnfn shuffle(uint8 x, uint2 mask); uint2 __ovld __cnfn shuffle(uint16 x, uint2 mask); long2 __ovld __cnfn shuffle(long2 x, ulong2 mask); long2 __ovld __cnfn shuffle(long4 x, ulong2 mask); long2 __ovld __cnfn shuffle(long8 x, ulong2 mask); long2 __ovld __cnfn shuffle(long16 x, ulong2 mask); ulong2 __ovld __cnfn shuffle(ulong2 x, ulong2 mask); ulong2 __ovld __cnfn shuffle(ulong4 x, ulong2 mask); ulong2 __ovld __cnfn shuffle(ulong8 x, ulong2 mask); ulong2 __ovld __cnfn shuffle(ulong16 x, ulong2 mask); float2 __ovld __cnfn shuffle(float2 x, uint2 mask); float2 __ovld __cnfn shuffle(float4 x, uint2 mask); float2 __ovld __cnfn shuffle(float8 x, uint2 mask); float2 __ovld __cnfn shuffle(float16 x, uint2 mask); char4 __ovld __cnfn shuffle(char2 x, uchar4 mask); char4 __ovld __cnfn shuffle(char4 x, uchar4 mask); char4 __ovld __cnfn shuffle(char8 x, uchar4 mask); char4 __ovld __cnfn shuffle(char16 x, uchar4 mask); uchar4 __ovld __cnfn shuffle(uchar2 x, uchar4 mask); uchar4 __ovld __cnfn shuffle(uchar4 x, uchar4 mask); uchar4 __ovld __cnfn shuffle(uchar8 x, uchar4 mask); uchar4 __ovld __cnfn shuffle(uchar16 x, uchar4 mask); short4 __ovld __cnfn shuffle(short2 x, ushort4 mask); short4 __ovld __cnfn shuffle(short4 x, ushort4 mask); short4 __ovld __cnfn shuffle(short8 x, ushort4 mask); short4 __ovld __cnfn shuffle(short16 x, ushort4 mask); ushort4 __ovld __cnfn shuffle(ushort2 x, ushort4 mask); ushort4 __ovld __cnfn shuffle(ushort4 x, ushort4 mask); ushort4 __ovld __cnfn shuffle(ushort8 x, ushort4 mask); ushort4 __ovld __cnfn shuffle(ushort16 x, ushort4 mask); int4 __ovld __cnfn shuffle(int2 x, uint4 mask); int4 __ovld __cnfn shuffle(int4 x, uint4 mask); int4 __ovld __cnfn shuffle(int8 x, uint4 mask); int4 __ovld __cnfn shuffle(int16 x, uint4 mask); uint4 __ovld __cnfn shuffle(uint2 x, uint4 mask); uint4 __ovld __cnfn shuffle(uint4 x, uint4 mask); uint4 __ovld __cnfn shuffle(uint8 x, uint4 mask); uint4 __ovld __cnfn shuffle(uint16 x, uint4 mask); long4 __ovld __cnfn shuffle(long2 x, ulong4 mask); long4 __ovld __cnfn shuffle(long4 x, ulong4 mask); long4 __ovld __cnfn shuffle(long8 x, ulong4 mask); long4 __ovld __cnfn shuffle(long16 x, ulong4 mask); ulong4 __ovld __cnfn shuffle(ulong2 x, ulong4 mask); ulong4 __ovld __cnfn shuffle(ulong4 x, ulong4 mask); ulong4 __ovld __cnfn shuffle(ulong8 x, ulong4 mask); ulong4 __ovld __cnfn shuffle(ulong16 x, ulong4 mask); float4 __ovld __cnfn shuffle(float2 x, uint4 mask); float4 __ovld __cnfn shuffle(float4 x, uint4 mask); float4 __ovld __cnfn shuffle(float8 x, uint4 mask); float4 __ovld __cnfn shuffle(float16 x, uint4 mask); char8 __ovld __cnfn shuffle(char2 x, uchar8 mask); char8 __ovld __cnfn shuffle(char4 x, uchar8 mask); char8 __ovld __cnfn shuffle(char8 x, uchar8 mask); char8 __ovld __cnfn shuffle(char16 x, uchar8 mask); uchar8 __ovld __cnfn shuffle(uchar2 x, uchar8 mask); uchar8 __ovld __cnfn shuffle(uchar4 x, uchar8 mask); uchar8 __ovld __cnfn shuffle(uchar8 x, uchar8 mask); uchar8 __ovld __cnfn shuffle(uchar16 x, uchar8 mask); short8 __ovld __cnfn shuffle(short2 x, ushort8 mask); short8 __ovld __cnfn shuffle(short4 x, ushort8 mask); short8 __ovld __cnfn shuffle(short8 x, ushort8 mask); short8 __ovld __cnfn shuffle(short16 x, ushort8 mask); ushort8 __ovld __cnfn shuffle(ushort2 x, ushort8 mask); ushort8 __ovld __cnfn shuffle(ushort4 x, ushort8 mask); ushort8 __ovld __cnfn shuffle(ushort8 x, ushort8 mask); ushort8 __ovld __cnfn shuffle(ushort16 x, ushort8 mask); int8 __ovld __cnfn shuffle(int2 x, uint8 mask); int8 __ovld __cnfn shuffle(int4 x, uint8 mask); int8 __ovld __cnfn shuffle(int8 x, uint8 mask); int8 __ovld __cnfn shuffle(int16 x, uint8 mask); uint8 __ovld __cnfn shuffle(uint2 x, uint8 mask); uint8 __ovld __cnfn shuffle(uint4 x, uint8 mask); uint8 __ovld __cnfn shuffle(uint8 x, uint8 mask); uint8 __ovld __cnfn shuffle(uint16 x, uint8 mask); long8 __ovld __cnfn shuffle(long2 x, ulong8 mask); long8 __ovld __cnfn shuffle(long4 x, ulong8 mask); long8 __ovld __cnfn shuffle(long8 x, ulong8 mask); long8 __ovld __cnfn shuffle(long16 x, ulong8 mask); ulong8 __ovld __cnfn shuffle(ulong2 x, ulong8 mask); ulong8 __ovld __cnfn shuffle(ulong4 x, ulong8 mask); ulong8 __ovld __cnfn shuffle(ulong8 x, ulong8 mask); ulong8 __ovld __cnfn shuffle(ulong16 x, ulong8 mask); float8 __ovld __cnfn shuffle(float2 x, uint8 mask); float8 __ovld __cnfn shuffle(float4 x, uint8 mask); float8 __ovld __cnfn shuffle(float8 x, uint8 mask); float8 __ovld __cnfn shuffle(float16 x, uint8 mask); char16 __ovld __cnfn shuffle(char2 x, uchar16 mask); char16 __ovld __cnfn shuffle(char4 x, uchar16 mask); char16 __ovld __cnfn shuffle(char8 x, uchar16 mask); char16 __ovld __cnfn shuffle(char16 x, uchar16 mask); uchar16 __ovld __cnfn shuffle(uchar2 x, uchar16 mask); uchar16 __ovld __cnfn shuffle(uchar4 x, uchar16 mask); uchar16 __ovld __cnfn shuffle(uchar8 x, uchar16 mask); uchar16 __ovld __cnfn shuffle(uchar16 x, uchar16 mask); short16 __ovld __cnfn shuffle(short2 x, ushort16 mask); short16 __ovld __cnfn shuffle(short4 x, ushort16 mask); short16 __ovld __cnfn shuffle(short8 x, ushort16 mask); short16 __ovld __cnfn shuffle(short16 x, ushort16 mask); ushort16 __ovld __cnfn shuffle(ushort2 x, ushort16 mask); ushort16 __ovld __cnfn shuffle(ushort4 x, ushort16 mask); ushort16 __ovld __cnfn shuffle(ushort8 x, ushort16 mask); ushort16 __ovld __cnfn shuffle(ushort16 x, ushort16 mask); int16 __ovld __cnfn shuffle(int2 x, uint16 mask); int16 __ovld __cnfn shuffle(int4 x, uint16 mask); int16 __ovld __cnfn shuffle(int8 x, uint16 mask); int16 __ovld __cnfn shuffle(int16 x, uint16 mask); uint16 __ovld __cnfn shuffle(uint2 x, uint16 mask); uint16 __ovld __cnfn shuffle(uint4 x, uint16 mask); uint16 __ovld __cnfn shuffle(uint8 x, uint16 mask); uint16 __ovld __cnfn shuffle(uint16 x, uint16 mask); long16 __ovld __cnfn shuffle(long2 x, ulong16 mask); long16 __ovld __cnfn shuffle(long4 x, ulong16 mask); long16 __ovld __cnfn shuffle(long8 x, ulong16 mask); long16 __ovld __cnfn shuffle(long16 x, ulong16 mask); ulong16 __ovld __cnfn shuffle(ulong2 x, ulong16 mask); ulong16 __ovld __cnfn shuffle(ulong4 x, ulong16 mask); ulong16 __ovld __cnfn shuffle(ulong8 x, ulong16 mask); ulong16 __ovld __cnfn shuffle(ulong16 x, ulong16 mask); float16 __ovld __cnfn shuffle(float2 x, uint16 mask); float16 __ovld __cnfn shuffle(float4 x, uint16 mask); float16 __ovld __cnfn shuffle(float8 x, uint16 mask); float16 __ovld __cnfn shuffle(float16 x, uint16 mask); #ifdef cl_khr_fp64 double2 __ovld __cnfn shuffle(double2 x, ulong2 mask); double2 __ovld __cnfn shuffle(double4 x, ulong2 mask); double2 __ovld __cnfn shuffle(double8 x, ulong2 mask); double2 __ovld __cnfn shuffle(double16 x, ulong2 mask); double4 __ovld __cnfn shuffle(double2 x, ulong4 mask); double4 __ovld __cnfn shuffle(double4 x, ulong4 mask); double4 __ovld __cnfn shuffle(double8 x, ulong4 mask); double4 __ovld __cnfn shuffle(double16 x, ulong4 mask); double8 __ovld __cnfn shuffle(double2 x, ulong8 mask); double8 __ovld __cnfn shuffle(double4 x, ulong8 mask); double8 __ovld __cnfn shuffle(double8 x, ulong8 mask); double8 __ovld __cnfn shuffle(double16 x, ulong8 mask); double16 __ovld __cnfn shuffle(double2 x, ulong16 mask); double16 __ovld __cnfn shuffle(double4 x, ulong16 mask); double16 __ovld __cnfn shuffle(double8 x, ulong16 mask); double16 __ovld __cnfn shuffle(double16 x, ulong16 mask); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half2 __ovld __cnfn shuffle(half2 x, ushort2 mask); half2 __ovld __cnfn shuffle(half4 x, ushort2 mask); half2 __ovld __cnfn shuffle(half8 x, ushort2 mask); half2 __ovld __cnfn shuffle(half16 x, ushort2 mask); half4 __ovld __cnfn shuffle(half2 x, ushort4 mask); half4 __ovld __cnfn shuffle(half4 x, ushort4 mask); half4 __ovld __cnfn shuffle(half8 x, ushort4 mask); half4 __ovld __cnfn shuffle(half16 x, ushort4 mask); half8 __ovld __cnfn shuffle(half2 x, ushort8 mask); half8 __ovld __cnfn shuffle(half4 x, ushort8 mask); half8 __ovld __cnfn shuffle(half8 x, ushort8 mask); half8 __ovld __cnfn shuffle(half16 x, ushort8 mask); half16 __ovld __cnfn shuffle(half2 x, ushort16 mask); half16 __ovld __cnfn shuffle(half4 x, ushort16 mask); half16 __ovld __cnfn shuffle(half8 x, ushort16 mask); half16 __ovld __cnfn shuffle(half16 x, ushort16 mask); #endif //cl_khr_fp16 char2 __ovld __cnfn shuffle2(char2 x, char2 y, uchar2 mask); char2 __ovld __cnfn shuffle2(char4 x, char4 y, uchar2 mask); char2 __ovld __cnfn shuffle2(char8 x, char8 y, uchar2 mask); char2 __ovld __cnfn shuffle2(char16 x, char16 y, uchar2 mask); uchar2 __ovld __cnfn shuffle2(uchar2 x, uchar2 y, uchar2 mask); uchar2 __ovld __cnfn shuffle2(uchar4 x, uchar4 y, uchar2 mask); uchar2 __ovld __cnfn shuffle2(uchar8 x, uchar8 y, uchar2 mask); uchar2 __ovld __cnfn shuffle2(uchar16 x, uchar16 y, uchar2 mask); short2 __ovld __cnfn shuffle2(short2 x, short2 y, ushort2 mask); short2 __ovld __cnfn shuffle2(short4 x, short4 y, ushort2 mask); short2 __ovld __cnfn shuffle2(short8 x, short8 y, ushort2 mask); short2 __ovld __cnfn shuffle2(short16 x, short16 y, ushort2 mask); ushort2 __ovld __cnfn shuffle2(ushort2 x, ushort2 y, ushort2 mask); ushort2 __ovld __cnfn shuffle2(ushort4 x, ushort4 y, ushort2 mask); ushort2 __ovld __cnfn shuffle2(ushort8 x, ushort8 y, ushort2 mask); ushort2 __ovld __cnfn shuffle2(ushort16 x, ushort16 y, ushort2 mask); int2 __ovld __cnfn shuffle2(int2 x, int2 y, uint2 mask); int2 __ovld __cnfn shuffle2(int4 x, int4 y, uint2 mask); int2 __ovld __cnfn shuffle2(int8 x, int8 y, uint2 mask); int2 __ovld __cnfn shuffle2(int16 x, int16 y, uint2 mask); uint2 __ovld __cnfn shuffle2(uint2 x, uint2 y, uint2 mask); uint2 __ovld __cnfn shuffle2(uint4 x, uint4 y, uint2 mask); uint2 __ovld __cnfn shuffle2(uint8 x, uint8 y, uint2 mask); uint2 __ovld __cnfn shuffle2(uint16 x, uint16 y, uint2 mask); long2 __ovld __cnfn shuffle2(long2 x, long2 y, ulong2 mask); long2 __ovld __cnfn shuffle2(long4 x, long4 y, ulong2 mask); long2 __ovld __cnfn shuffle2(long8 x, long8 y, ulong2 mask); long2 __ovld __cnfn shuffle2(long16 x, long16 y, ulong2 mask); ulong2 __ovld __cnfn shuffle2(ulong2 x, ulong2 y, ulong2 mask); ulong2 __ovld __cnfn shuffle2(ulong4 x, ulong4 y, ulong2 mask); ulong2 __ovld __cnfn shuffle2(ulong8 x, ulong8 y, ulong2 mask); ulong2 __ovld __cnfn shuffle2(ulong16 x, ulong16 y, ulong2 mask); float2 __ovld __cnfn shuffle2(float2 x, float2 y, uint2 mask); float2 __ovld __cnfn shuffle2(float4 x, float4 y, uint2 mask); float2 __ovld __cnfn shuffle2(float8 x, float8 y, uint2 mask); float2 __ovld __cnfn shuffle2(float16 x, float16 y, uint2 mask); char4 __ovld __cnfn shuffle2(char2 x, char2 y, uchar4 mask); char4 __ovld __cnfn shuffle2(char4 x, char4 y, uchar4 mask); char4 __ovld __cnfn shuffle2(char8 x, char8 y, uchar4 mask); char4 __ovld __cnfn shuffle2(char16 x, char16 y, uchar4 mask); uchar4 __ovld __cnfn shuffle2(uchar2 x, uchar2 y, uchar4 mask); uchar4 __ovld __cnfn shuffle2(uchar4 x, uchar4 y, uchar4 mask); uchar4 __ovld __cnfn shuffle2(uchar8 x, uchar8 y, uchar4 mask); uchar4 __ovld __cnfn shuffle2(uchar16 x, uchar16 y, uchar4 mask); short4 __ovld __cnfn shuffle2(short2 x, short2 y, ushort4 mask); short4 __ovld __cnfn shuffle2(short4 x, short4 y, ushort4 mask); short4 __ovld __cnfn shuffle2(short8 x, short8 y, ushort4 mask); short4 __ovld __cnfn shuffle2(short16 x, short16 y, ushort4 mask); ushort4 __ovld __cnfn shuffle2(ushort2 x, ushort2 y, ushort4 mask); ushort4 __ovld __cnfn shuffle2(ushort4 x, ushort4 y, ushort4 mask); ushort4 __ovld __cnfn shuffle2(ushort8 x, ushort8 y, ushort4 mask); ushort4 __ovld __cnfn shuffle2(ushort16 x, ushort16 y, ushort4 mask); int4 __ovld __cnfn shuffle2(int2 x, int2 y, uint4 mask); int4 __ovld __cnfn shuffle2(int4 x, int4 y, uint4 mask); int4 __ovld __cnfn shuffle2(int8 x, int8 y, uint4 mask); int4 __ovld __cnfn shuffle2(int16 x, int16 y, uint4 mask); uint4 __ovld __cnfn shuffle2(uint2 x, uint2 y, uint4 mask); uint4 __ovld __cnfn shuffle2(uint4 x, uint4 y, uint4 mask); uint4 __ovld __cnfn shuffle2(uint8 x, uint8 y, uint4 mask); uint4 __ovld __cnfn shuffle2(uint16 x, uint16 y, uint4 mask); long4 __ovld __cnfn shuffle2(long2 x, long2 y, ulong4 mask); long4 __ovld __cnfn shuffle2(long4 x, long4 y, ulong4 mask); long4 __ovld __cnfn shuffle2(long8 x, long8 y, ulong4 mask); long4 __ovld __cnfn shuffle2(long16 x, long16 y, ulong4 mask); ulong4 __ovld __cnfn shuffle2(ulong2 x, ulong2 y, ulong4 mask); ulong4 __ovld __cnfn shuffle2(ulong4 x, ulong4 y, ulong4 mask); ulong4 __ovld __cnfn shuffle2(ulong8 x, ulong8 y, ulong4 mask); ulong4 __ovld __cnfn shuffle2(ulong16 x, ulong16 y, ulong4 mask); float4 __ovld __cnfn shuffle2(float2 x, float2 y, uint4 mask); float4 __ovld __cnfn shuffle2(float4 x, float4 y, uint4 mask); float4 __ovld __cnfn shuffle2(float8 x, float8 y, uint4 mask); float4 __ovld __cnfn shuffle2(float16 x, float16 y, uint4 mask); char8 __ovld __cnfn shuffle2(char2 x, char2 y, uchar8 mask); char8 __ovld __cnfn shuffle2(char4 x, char4 y, uchar8 mask); char8 __ovld __cnfn shuffle2(char8 x, char8 y, uchar8 mask); char8 __ovld __cnfn shuffle2(char16 x, char16 y, uchar8 mask); uchar8 __ovld __cnfn shuffle2(uchar2 x, uchar2 y, uchar8 mask); uchar8 __ovld __cnfn shuffle2(uchar4 x, uchar4 y, uchar8 mask); uchar8 __ovld __cnfn shuffle2(uchar8 x, uchar8 y, uchar8 mask); uchar8 __ovld __cnfn shuffle2(uchar16 x, uchar16 y, uchar8 mask); short8 __ovld __cnfn shuffle2(short2 x, short2 y, ushort8 mask); short8 __ovld __cnfn shuffle2(short4 x, short4 y, ushort8 mask); short8 __ovld __cnfn shuffle2(short8 x, short8 y, ushort8 mask); short8 __ovld __cnfn shuffle2(short16 x, short16 y, ushort8 mask); ushort8 __ovld __cnfn shuffle2(ushort2 x, ushort2 y, ushort8 mask); ushort8 __ovld __cnfn shuffle2(ushort4 x, ushort4 y, ushort8 mask); ushort8 __ovld __cnfn shuffle2(ushort8 x, ushort8 y, ushort8 mask); ushort8 __ovld __cnfn shuffle2(ushort16 x, ushort16 y, ushort8 mask); int8 __ovld __cnfn shuffle2(int2 x, int2 y, uint8 mask); int8 __ovld __cnfn shuffle2(int4 x, int4 y, uint8 mask); int8 __ovld __cnfn shuffle2(int8 x, int8 y, uint8 mask); int8 __ovld __cnfn shuffle2(int16 x, int16 y, uint8 mask); uint8 __ovld __cnfn shuffle2(uint2 x, uint2 y, uint8 mask); uint8 __ovld __cnfn shuffle2(uint4 x, uint4 y, uint8 mask); uint8 __ovld __cnfn shuffle2(uint8 x, uint8 y, uint8 mask); uint8 __ovld __cnfn shuffle2(uint16 x, uint16 y, uint8 mask); long8 __ovld __cnfn shuffle2(long2 x, long2 y, ulong8 mask); long8 __ovld __cnfn shuffle2(long4 x, long4 y, ulong8 mask); long8 __ovld __cnfn shuffle2(long8 x, long8 y, ulong8 mask); long8 __ovld __cnfn shuffle2(long16 x, long16 y, ulong8 mask); ulong8 __ovld __cnfn shuffle2(ulong2 x, ulong2 y, ulong8 mask); ulong8 __ovld __cnfn shuffle2(ulong4 x, ulong4 y, ulong8 mask); ulong8 __ovld __cnfn shuffle2(ulong8 x, ulong8 y, ulong8 mask); ulong8 __ovld __cnfn shuffle2(ulong16 x, ulong16 y, ulong8 mask); float8 __ovld __cnfn shuffle2(float2 x, float2 y, uint8 mask); float8 __ovld __cnfn shuffle2(float4 x, float4 y, uint8 mask); float8 __ovld __cnfn shuffle2(float8 x, float8 y, uint8 mask); float8 __ovld __cnfn shuffle2(float16 x, float16 y, uint8 mask); char16 __ovld __cnfn shuffle2(char2 x, char2 y, uchar16 mask); char16 __ovld __cnfn shuffle2(char4 x, char4 y, uchar16 mask); char16 __ovld __cnfn shuffle2(char8 x, char8 y, uchar16 mask); char16 __ovld __cnfn shuffle2(char16 x, char16 y, uchar16 mask); uchar16 __ovld __cnfn shuffle2(uchar2 x, uchar2 y, uchar16 mask); uchar16 __ovld __cnfn shuffle2(uchar4 x, uchar4 y, uchar16 mask); uchar16 __ovld __cnfn shuffle2(uchar8 x, uchar8 y, uchar16 mask); uchar16 __ovld __cnfn shuffle2(uchar16 x, uchar16 y, uchar16 mask); short16 __ovld __cnfn shuffle2(short2 x, short2 y, ushort16 mask); short16 __ovld __cnfn shuffle2(short4 x, short4 y, ushort16 mask); short16 __ovld __cnfn shuffle2(short8 x, short8 y, ushort16 mask); short16 __ovld __cnfn shuffle2(short16 x, short16 y, ushort16 mask); ushort16 __ovld __cnfn shuffle2(ushort2 x, ushort2 y, ushort16 mask); ushort16 __ovld __cnfn shuffle2(ushort4 x, ushort4 y, ushort16 mask); ushort16 __ovld __cnfn shuffle2(ushort8 x, ushort8 y, ushort16 mask); ushort16 __ovld __cnfn shuffle2(ushort16 x, ushort16 y, ushort16 mask); int16 __ovld __cnfn shuffle2(int2 x, int2 y, uint16 mask); int16 __ovld __cnfn shuffle2(int4 x, int4 y, uint16 mask); int16 __ovld __cnfn shuffle2(int8 x, int8 y, uint16 mask); int16 __ovld __cnfn shuffle2(int16 x, int16 y, uint16 mask); uint16 __ovld __cnfn shuffle2(uint2 x, uint2 y, uint16 mask); uint16 __ovld __cnfn shuffle2(uint4 x, uint4 y, uint16 mask); uint16 __ovld __cnfn shuffle2(uint8 x, uint8 y, uint16 mask); uint16 __ovld __cnfn shuffle2(uint16 x, uint16 y, uint16 mask); long16 __ovld __cnfn shuffle2(long2 x, long2 y, ulong16 mask); long16 __ovld __cnfn shuffle2(long4 x, long4 y, ulong16 mask); long16 __ovld __cnfn shuffle2(long8 x, long8 y, ulong16 mask); long16 __ovld __cnfn shuffle2(long16 x, long16 y, ulong16 mask); ulong16 __ovld __cnfn shuffle2(ulong2 x, ulong2 y, ulong16 mask); ulong16 __ovld __cnfn shuffle2(ulong4 x, ulong4 y, ulong16 mask); ulong16 __ovld __cnfn shuffle2(ulong8 x, ulong8 y, ulong16 mask); ulong16 __ovld __cnfn shuffle2(ulong16 x, ulong16 y, ulong16 mask); float16 __ovld __cnfn shuffle2(float2 x, float2 y, uint16 mask); float16 __ovld __cnfn shuffle2(float4 x, float4 y, uint16 mask); float16 __ovld __cnfn shuffle2(float8 x, float8 y, uint16 mask); float16 __ovld __cnfn shuffle2(float16 x, float16 y, uint16 mask); #ifdef cl_khr_fp64 double2 __ovld __cnfn shuffle2(double2 x, double2 y, ulong2 mask); double2 __ovld __cnfn shuffle2(double4 x, double4 y, ulong2 mask); double2 __ovld __cnfn shuffle2(double8 x, double8 y, ulong2 mask); double2 __ovld __cnfn shuffle2(double16 x, double16 y, ulong2 mask); double4 __ovld __cnfn shuffle2(double2 x, double2 y, ulong4 mask); double4 __ovld __cnfn shuffle2(double4 x, double4 y, ulong4 mask); double4 __ovld __cnfn shuffle2(double8 x, double8 y, ulong4 mask); double4 __ovld __cnfn shuffle2(double16 x, double16 y, ulong4 mask); double8 __ovld __cnfn shuffle2(double2 x, double2 y, ulong8 mask); double8 __ovld __cnfn shuffle2(double4 x, double4 y, ulong8 mask); double8 __ovld __cnfn shuffle2(double8 x, double8 y, ulong8 mask); double8 __ovld __cnfn shuffle2(double16 x, double16 y, ulong8 mask); double16 __ovld __cnfn shuffle2(double2 x, double2 y, ulong16 mask); double16 __ovld __cnfn shuffle2(double4 x, double4 y, ulong16 mask); double16 __ovld __cnfn shuffle2(double8 x, double8 y, ulong16 mask); double16 __ovld __cnfn shuffle2(double16 x, double16 y, ulong16 mask); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half2 __ovld __cnfn shuffle2(half2 x, half2 y, ushort2 mask); half2 __ovld __cnfn shuffle2(half4 x, half4 y, ushort2 mask); half2 __ovld __cnfn shuffle2(half8 x, half8 y, ushort2 mask); half2 __ovld __cnfn shuffle2(half16 x, half16 y, ushort2 mask); half4 __ovld __cnfn shuffle2(half2 x, half2 y, ushort4 mask); half4 __ovld __cnfn shuffle2(half4 x, half4 y, ushort4 mask); half4 __ovld __cnfn shuffle2(half8 x, half8 y, ushort4 mask); half4 __ovld __cnfn shuffle2(half16 x, half16 y, ushort4 mask); half8 __ovld __cnfn shuffle2(half2 x, half2 y, ushort8 mask); half8 __ovld __cnfn shuffle2(half4 x, half4 y, ushort8 mask); half8 __ovld __cnfn shuffle2(half8 x, half8 y, ushort8 mask); half8 __ovld __cnfn shuffle2(half16 x, half16 y, ushort8 mask); half16 __ovld __cnfn shuffle2(half2 x, half2 y, ushort16 mask); half16 __ovld __cnfn shuffle2(half4 x, half4 y, ushort16 mask); half16 __ovld __cnfn shuffle2(half8 x, half8 y, ushort16 mask); half16 __ovld __cnfn shuffle2(half16 x, half16 y, ushort16 mask); #endif //cl_khr_fp16 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) // OpenCL v1.2 s6.12.13, v2.0 s6.13.13 - printf int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2))); #endif // OpenCL v1.1 s6.11.3, v1.2 s6.12.14, v2.0 s6.13.14 - Image Read and Write Functions #ifdef cl_khr_gl_msaa_sharing #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable #endif //cl_khr_gl_msaa_sharing /** * Use the coordinate (coord.xy) to do an element lookup in * the 2D image object specified by image. * * Use the coordinate (coord.x, coord.y, coord.z) to do * an element lookup in the 3D image object specified * by image. coord.w is ignored. * * Use the coordinate (coord.z) to index into the * 2D image array object specified by image_array * and (coord.x, coord.y) to do an element lookup in * the 2D image object specified by image. * * Use the coordinate (x) to do an element lookup in * the 1D image object specified by image. * * Use the coordinate (coord.y) to index into the * 1D image array object specified by image_array * and (coord.x) to do an element lookup in * the 1D image object specified by image. * * Use the coordinate (cood.xy) and sample to do an * element lookup in the 2D multi-sample image specified * by image. * * Use coord.xy and sample to do an element * lookup in the 2D multi-sample image layer * identified by index coord.z in the 2D multi-sample * image array specified by image. * * For mipmap images, use the mip-level specified by * the Level-of-Detail (lod) or use gradients for LOD * computation. * * read_imagef returns floating-point values in the * range [0.0 ... 1.0] for image objects created with * image_channel_data_type set to one of the predefined * packed formats or CL_UNORM_INT8, or * CL_UNORM_INT16. * * read_imagef returns floating-point values in the * range [-1.0 ... 1.0] for image objects created with * image_channel_data_type set to CL_SNORM_INT8, * or CL_SNORM_INT16. * * read_imagef returns floating-point values for image * objects created with image_channel_data_type set to * CL_HALF_FLOAT or CL_FLOAT. * * read_imagei and read_imageui return * unnormalized signed integer and unsigned integer * values respectively. Each channel will be stored in a * 32-bit integer. * * read_imagei can only be used with image objects * created with image_channel_data_type set to one of * the following values: * CL_SIGNED_INT8, * CL_SIGNED_INT16 and * CL_SIGNED_INT32. * If the image_channel_data_type is not one of the * above values, the values returned by read_imagei * are undefined. * * read_imageui can only be used with image objects * created with image_channel_data_type set to one of * the following values: * CL_UNSIGNED_INT8, * CL_UNSIGNED_INT16 and * CL_UNSIGNED_INT32. * If the image_channel_data_type is not one of the * above values, the values returned by read_imageui * are undefined. * * The read_image{i|ui} calls support a nearest filter * only. The filter_mode specified in sampler * must be set to CLK_FILTER_NEAREST; otherwise * the values returned are undefined. * The read_image{f|i|ui} calls that take * integer coordinates must use a sampler with * normalized coordinates set to * CLK_NORMALIZED_COORDS_FALSE and * addressing mode set to * CLK_ADDRESS_CLAMP_TO_EDGE, * CLK_ADDRESS_CLAMP or CLK_ADDRESS_NONE; * otherwise the values returned are undefined. * * Values returned by read_imagef for image objects * with image_channel_data_type values not specified * in the description above are undefined. */ float4 __purefn __ovld read_imagef(read_only image2d_t image, sampler_t sampler, int2 coord); float4 __purefn __ovld read_imagef(read_only image2d_t image, sampler_t sampler, float2 coord); int4 __purefn __ovld read_imagei(read_only image2d_t image, sampler_t sampler, int2 coord); int4 __purefn __ovld read_imagei(read_only image2d_t image, sampler_t sampler, float2 coord); uint4 __purefn __ovld read_imageui(read_only image2d_t image, sampler_t sampler, int2 coord); uint4 __purefn __ovld read_imageui(read_only image2d_t image, sampler_t sampler, float2 coord); float4 __purefn __ovld read_imagef(read_only image3d_t image, sampler_t sampler, int4 coord); float4 __purefn __ovld read_imagef(read_only image3d_t image, sampler_t sampler, float4 coord); int4 __purefn __ovld read_imagei(read_only image3d_t image, sampler_t sampler, int4 coord); int4 __purefn __ovld read_imagei(read_only image3d_t image, sampler_t sampler, float4 coord); uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t sampler, int4 coord); uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t sampler, float4 coord); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, int4 coord); float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, float4 coord); int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, int4 coord); int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, float4 coord); uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, int4 coord); uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, float4 coord); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t sampler, int coord); float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t sampler, float coord); int4 __purefn __ovld read_imagei(read_only image1d_t image, sampler_t sampler, int coord); int4 __purefn __ovld read_imagei(read_only image1d_t image, sampler_t sampler, float coord); uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t sampler, int coord); uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t sampler, float coord); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, sampler_t sampler, int2 coord); float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, sampler_t sampler, float2 coord); int4 __purefn __ovld read_imagei(read_only image1d_array_t image_array, sampler_t sampler, int2 coord); int4 __purefn __ovld read_imagei(read_only image1d_array_t image_array, sampler_t sampler, float2 coord); uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, sampler_t sampler, int2 coord); uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, sampler_t sampler, float2 coord); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) #ifdef cl_khr_depth_images float __purefn __ovld read_imagef(read_only image2d_depth_t image, sampler_t sampler, float2 coord); float __purefn __ovld read_imagef(read_only image2d_depth_t image, sampler_t sampler, int2 coord); float __purefn __ovld read_imagef(read_only image2d_array_depth_t image, sampler_t sampler, float4 coord); float __purefn __ovld read_imagef(read_only image2d_array_depth_t image, sampler_t sampler, int4 coord); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) float4 __purefn __ovld read_imagef(read_only image2d_msaa_t image, int2 coord, int sample); int4 __purefn __ovld read_imagei(read_only image2d_msaa_t image, int2 coord, int sample); uint4 __purefn __ovld read_imageui(read_only image2d_msaa_t image, int2 coord, int sample); float __purefn __ovld read_imagef(read_only image2d_msaa_depth_t image, int2 coord, int sample); float4 __purefn __ovld read_imagef(read_only image2d_array_msaa_t image, int4 coord, int sample); int4 __purefn __ovld read_imagei(read_only image2d_array_msaa_t image, int4 coord, int sample); uint4 __purefn __ovld read_imageui(read_only image2d_array_msaa_t image, int4 coord, int sample); float __purefn __ovld read_imagef(read_only image2d_array_msaa_depth_t image, int4 coord, int sample); #endif //cl_khr_gl_msaa_sharing // OpenCL Extension v2.0 s9.18 - Mipmaps #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #ifdef cl_khr_mipmap_image float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t sampler, float coord, float lod); int4 __purefn __ovld read_imagei(read_only image1d_t image, sampler_t sampler, float coord, float lod); uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t sampler, float coord, float lod); float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, sampler_t sampler, float2 coord, float lod); int4 __purefn __ovld read_imagei(read_only image1d_array_t image_array, sampler_t sampler, float2 coord, float lod); uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, sampler_t sampler, float2 coord, float lod); float4 __purefn __ovld read_imagef(read_only image2d_t image, sampler_t sampler, float2 coord, float lod); int4 __purefn __ovld read_imagei(read_only image2d_t image, sampler_t sampler, float2 coord, float lod); uint4 __purefn __ovld read_imageui(read_only image2d_t image, sampler_t sampler, float2 coord, float lod); float __purefn __ovld read_imagef(read_only image2d_depth_t image, sampler_t sampler, float2 coord, float lod); float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, float4 coord, float lod); int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, float4 coord, float lod); uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, float4 coord, float lod); float __purefn __ovld read_imagef(read_only image2d_array_depth_t image, sampler_t sampler, float4 coord, float lod); float4 __purefn __ovld read_imagef(read_only image3d_t image, sampler_t sampler, float4 coord, float lod); int4 __purefn __ovld read_imagei(read_only image3d_t image, sampler_t sampler, float4 coord, float lod); uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t sampler, float4 coord, float lod); float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t sampler, float coord, float gradientX, float gradientY); int4 __purefn __ovld read_imagei(read_only image1d_t image, sampler_t sampler, float coord, float gradientX, float gradientY); uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t sampler, float coord, float gradientX, float gradientY); float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, sampler_t sampler, float2 coord, float gradientX, float gradientY); int4 __purefn __ovld read_imagei(read_only image1d_array_t image_array, sampler_t sampler, float2 coord, float gradientX, float gradientY); uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, sampler_t sampler, float2 coord, float gradientX, float gradientY); float4 __purefn __ovld read_imagef(read_only image2d_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); int4 __purefn __ovld read_imagei(read_only image2d_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); uint4 __purefn __ovld read_imageui(read_only image2d_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); float __purefn __ovld read_imagef(read_only image2d_depth_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); float __purefn __ovld read_imagef(read_only image2d_array_depth_t image, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); float4 __purefn __ovld read_imagef(read_only image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY); int4 __purefn __ovld read_imagei(read_only image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY); uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY); #endif //cl_khr_mipmap_image #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) /** * Sampler-less Image Access */ float4 __purefn __ovld read_imagef(read_only image1d_t image, int coord); int4 __purefn __ovld read_imagei(read_only image1d_t image, int coord); uint4 __purefn __ovld read_imageui(read_only image1d_t image, int coord); float4 __purefn __ovld read_imagef(read_only image1d_buffer_t image, int coord); int4 __purefn __ovld read_imagei(read_only image1d_buffer_t image, int coord); uint4 __purefn __ovld read_imageui(read_only image1d_buffer_t image, int coord); float4 __purefn __ovld read_imagef(read_only image1d_array_t image, int2 coord); int4 __purefn __ovld read_imagei(read_only image1d_array_t image, int2 coord); uint4 __purefn __ovld read_imageui(read_only image1d_array_t image, int2 coord); float4 __purefn __ovld read_imagef(read_only image2d_t image, int2 coord); int4 __purefn __ovld read_imagei(read_only image2d_t image, int2 coord); uint4 __purefn __ovld read_imageui(read_only image2d_t image, int2 coord); float4 __purefn __ovld read_imagef(read_only image2d_array_t image, int4 coord); int4 __purefn __ovld read_imagei(read_only image2d_array_t image, int4 coord); uint4 __purefn __ovld read_imageui(read_only image2d_array_t image, int4 coord); #ifdef cl_khr_depth_images float __purefn __ovld read_imagef(read_only image2d_depth_t image, int2 coord); float __purefn __ovld read_imagef(read_only image2d_array_depth_t image, int4 coord); #endif //cl_khr_depth_images float4 __purefn __ovld read_imagef(read_only image3d_t image, int4 coord); int4 __purefn __ovld read_imagei(read_only image3d_t image, int4 coord); uint4 __purefn __ovld read_imageui(read_only image3d_t image, int4 coord); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) // Image read functions returning half4 type #ifdef cl_khr_fp16 half4 __purefn __ovld read_imageh(read_only image1d_t image, sampler_t sampler, int coord); half4 __purefn __ovld read_imageh(read_only image1d_t image, sampler_t sampler, float coord); half4 __purefn __ovld read_imageh(read_only image2d_t image, sampler_t sampler, int2 coord); half4 __purefn __ovld read_imageh(read_only image2d_t image, sampler_t sampler, float2 coord); half4 __purefn __ovld read_imageh(read_only image3d_t image, sampler_t sampler, int4 coord); half4 __purefn __ovld read_imageh(read_only image3d_t image, sampler_t sampler, float4 coord); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t sampler, int2 coord); half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t sampler, float2 coord); half4 __purefn __ovld read_imageh(read_only image2d_array_t image, sampler_t sampler, int4 coord); half4 __purefn __ovld read_imageh(read_only image2d_array_t image, sampler_t sampler, float4 coord); /** * Sampler-less Image Access */ half4 __purefn __ovld read_imageh(read_only image1d_t image, int coord); half4 __purefn __ovld read_imageh(read_only image2d_t image, int2 coord); half4 __purefn __ovld read_imageh(read_only image3d_t image, int4 coord); half4 __purefn __ovld read_imageh(read_only image1d_array_t image, int2 coord); half4 __purefn __ovld read_imageh(read_only image2d_array_t image, int4 coord); half4 __purefn __ovld read_imageh(read_only image1d_buffer_t image, int coord); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) #endif //cl_khr_fp16 // Image read functions for read_write images #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) float4 __purefn __ovld read_imagef(read_write image1d_t image, int coord); int4 __purefn __ovld read_imagei(read_write image1d_t image, int coord); uint4 __purefn __ovld read_imageui(read_write image1d_t image, int coord); float4 __purefn __ovld read_imagef(read_write image1d_buffer_t image, int coord); int4 __purefn __ovld read_imagei(read_write image1d_buffer_t image, int coord); uint4 __purefn __ovld read_imageui(read_write image1d_buffer_t image, int coord); float4 __purefn __ovld read_imagef(read_write image1d_array_t image, int2 coord); int4 __purefn __ovld read_imagei(read_write image1d_array_t image, int2 coord); uint4 __purefn __ovld read_imageui(read_write image1d_array_t image, int2 coord); float4 __purefn __ovld read_imagef(read_write image2d_t image, int2 coord); int4 __purefn __ovld read_imagei(read_write image2d_t image, int2 coord); uint4 __purefn __ovld read_imageui(read_write image2d_t image, int2 coord); float4 __purefn __ovld read_imagef(read_write image2d_array_t image, int4 coord); int4 __purefn __ovld read_imagei(read_write image2d_array_t image, int4 coord); uint4 __purefn __ovld read_imageui(read_write image2d_array_t image, int4 coord); float4 __purefn __ovld read_imagef(read_write image3d_t image, int4 coord); int4 __purefn __ovld read_imagei(read_write image3d_t image, int4 coord); uint4 __purefn __ovld read_imageui(read_write image3d_t image, int4 coord); #ifdef cl_khr_depth_images float __purefn __ovld read_imagef(read_write image2d_depth_t image, int2 coord); float __purefn __ovld read_imagef(read_write image2d_array_depth_t image, int4 coord); #endif //cl_khr_depth_images #if cl_khr_gl_msaa_sharing float4 __purefn __ovld read_imagef(read_write image2d_msaa_t image, int2 coord, int sample); int4 __purefn __ovld read_imagei(read_write image2d_msaa_t image, int2 coord, int sample); uint4 __purefn __ovld read_imageui(read_write image2d_msaa_t image, int2 coord, int sample); float4 __purefn __ovld read_imagef(read_write image2d_array_msaa_t image, int4 coord, int sample); int4 __purefn __ovld read_imagei(read_write image2d_array_msaa_t image, int4 coord, int sample); uint4 __purefn __ovld read_imageui(read_write image2d_array_msaa_t image, int4 coord, int sample); float __purefn __ovld read_imagef(read_write image2d_msaa_depth_t image, int2 coord, int sample); float __purefn __ovld read_imagef(read_write image2d_array_msaa_depth_t image, int4 coord, int sample); #endif //cl_khr_gl_msaa_sharing #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #ifdef cl_khr_mipmap_image float4 __purefn __ovld read_imagef(read_write image1d_t image, sampler_t sampler, float coord, float lod); int4 __purefn __ovld read_imagei(read_write image1d_t image, sampler_t sampler, float coord, float lod); uint4 __purefn __ovld read_imageui(read_write image1d_t image, sampler_t sampler, float coord, float lod); float4 __purefn __ovld read_imagef(read_write image1d_array_t image_array, sampler_t sampler, float2 coord, float lod); int4 __purefn __ovld read_imagei(read_write image1d_array_t image_array, sampler_t sampler, float2 coord, float lod); uint4 __purefn __ovld read_imageui(read_write image1d_array_t image_array, sampler_t sampler, float2 coord, float lod); float4 __purefn __ovld read_imagef(read_write image2d_t image, sampler_t sampler, float2 coord, float lod); int4 __purefn __ovld read_imagei(read_write image2d_t image, sampler_t sampler, float2 coord, float lod); uint4 __purefn __ovld read_imageui(read_write image2d_t image, sampler_t sampler, float2 coord, float lod); float __purefn __ovld read_imagef(read_write image2d_depth_t image, sampler_t sampler, float2 coord, float lod); float4 __purefn __ovld read_imagef(read_write image2d_array_t image_array, sampler_t sampler, float4 coord, float lod); int4 __purefn __ovld read_imagei(read_write image2d_array_t image_array, sampler_t sampler, float4 coord, float lod); uint4 __purefn __ovld read_imageui(read_write image2d_array_t image_array, sampler_t sampler, float4 coord, float lod); float __purefn __ovld read_imagef(read_write image2d_array_depth_t image, sampler_t sampler, float4 coord, float lod); float4 __purefn __ovld read_imagef(read_write image3d_t image, sampler_t sampler, float4 coord, float lod); int4 __purefn __ovld read_imagei(read_write image3d_t image, sampler_t sampler, float4 coord, float lod); uint4 __purefn __ovld read_imageui(read_write image3d_t image, sampler_t sampler, float4 coord, float lod); float4 __purefn __ovld read_imagef(read_write image1d_t image, sampler_t sampler, float coord, float gradientX, float gradientY); int4 __purefn __ovld read_imagei(read_write image1d_t image, sampler_t sampler, float coord, float gradientX, float gradientY); uint4 __purefn __ovld read_imageui(read_write image1d_t image, sampler_t sampler, float coord, float gradientX, float gradientY); float4 __purefn __ovld read_imagef(read_write image1d_array_t image_array, sampler_t sampler, float2 coord, float gradientX, float gradientY); int4 __purefn __ovld read_imagei(read_write image1d_array_t image_array, sampler_t sampler, float2 coord, float gradientX, float gradientY); uint4 __purefn __ovld read_imageui(read_write image1d_array_t image_array, sampler_t sampler, float2 coord, float gradientX, float gradientY); float4 __purefn __ovld read_imagef(read_write image2d_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); int4 __purefn __ovld read_imagei(read_write image2d_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); uint4 __purefn __ovld read_imageui(read_write image2d_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); float __purefn __ovld read_imagef(read_write image2d_depth_t image, sampler_t sampler, float2 coord, float2 gradientX, float2 gradientY); float4 __purefn __ovld read_imagef(read_write image2d_array_t image_array, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); int4 __purefn __ovld read_imagei(read_write image2d_array_t image_array, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); uint4 __purefn __ovld read_imageui(read_write image2d_array_t image_array, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); float __purefn __ovld read_imagef(read_write image2d_array_depth_t image, sampler_t sampler, float4 coord, float2 gradientX, float2 gradientY); float4 __purefn __ovld read_imagef(read_write image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY); int4 __purefn __ovld read_imagei(read_write image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY); uint4 __purefn __ovld read_imageui(read_write image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY); #endif //cl_khr_mipmap_image #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // Image read functions returning half4 type #ifdef cl_khr_fp16 half4 __purefn __ovld read_imageh(read_write image1d_t image, int coord); half4 __purefn __ovld read_imageh(read_write image2d_t image, int2 coord); half4 __purefn __ovld read_imageh(read_write image3d_t image, int4 coord); half4 __purefn __ovld read_imageh(read_write image1d_array_t image, int2 coord); half4 __purefn __ovld read_imageh(read_write image2d_array_t image, int4 coord); half4 __purefn __ovld read_imageh(read_write image1d_buffer_t image, int coord); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Write color value to location specified by coordinate * (coord.x, coord.y) in the 2D image object specified by image. * (coord.x, coord.y) are considered to be unnormalized coordinates * and must be in the range 0 ... image width - 1, and 0 * ... image height - 1. * Write color value to location specified by coordinate * (coord.x, coord.y) in the 2D image object specified by index * (coord.z) of the 2D image array object image_array. * (coord.x, coord.y) are considered to be unnormalized * coordinates and must be in the range 0 ... image width * - 1. * * Write color value to location specified by coordinate * (coord) in the 1D image (buffer) object specified by image. * coord is considered to be unnormalized coordinates * and must be in the range 0 ... image width - 1. * * Write color value to location specified by coordinate * (coord.x) in the 1D image object specified by index * (coord.y) of the 1D image array object image_array. * x is considered to be unnormalized coordinates * and must be in the range 0 ... image width - 1. * * Write color value to location specified by coordinate * (coord.x, coord.y, coord.z) in the 3D image object specified by image. * coord.x & coord.y are considered to be unnormalized coordinates * and must be in the range 0 ... image width - 1, and 0 * ... image height - 1. * * For mipmap images, use mip-level specified by lod. * * Appropriate data format conversion to the specified * image format is done before writing the color value. * * write_imagef can only be used with image objects * created with image_channel_data_type set to one of * the pre-defined packed formats or set to * CL_SNORM_INT8, CL_UNORM_INT8, * CL_SNORM_INT16, CL_UNORM_INT16, * CL_HALF_FLOAT or CL_FLOAT. Appropriate data * format conversion will be done to convert channel * data from a floating-point value to actual data format * in which the channels are stored. * * write_imagei can only be used with image objects * created with image_channel_data_type set to one of * the following values: * CL_SIGNED_INT8, * CL_SIGNED_INT16 and * CL_SIGNED_INT32. * * write_imageui can only be used with image objects * created with image_channel_data_type set to one of * the following values: * CL_UNSIGNED_INT8, * CL_UNSIGNED_INT16 and * CL_UNSIGNED_INT32. * * The behavior of write_imagef, write_imagei and * write_imageui for image objects created with * image_channel_data_type values not specified in * the description above or with (x, y) coordinate * values that are not in the range (0 ... image width -1, * 0 ... image height - 1), respectively, is undefined. */ void __ovld write_imagef(write_only image2d_t image, int2 coord, float4 color); void __ovld write_imagei(write_only image2d_t image, int2 coord, int4 color); void __ovld write_imageui(write_only image2d_t image, int2 coord, uint4 color); void __ovld write_imagef(write_only image2d_array_t image_array, int4 coord, float4 color); void __ovld write_imagei(write_only image2d_array_t image_array, int4 coord, int4 color); void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, uint4 color); void __ovld write_imagef(write_only image1d_t image, int coord, float4 color); void __ovld write_imagei(write_only image1d_t image, int coord, int4 color); void __ovld write_imageui(write_only image1d_t image, int coord, uint4 color); void __ovld write_imagef(write_only image1d_buffer_t image, int coord, float4 color); void __ovld write_imagei(write_only image1d_buffer_t image, int coord, int4 color); void __ovld write_imageui(write_only image1d_buffer_t image, int coord, uint4 color); void __ovld write_imagef(write_only image1d_array_t image_array, int2 coord, float4 color); void __ovld write_imagei(write_only image1d_array_t image_array, int2 coord, int4 color); void __ovld write_imageui(write_only image1d_array_t image_array, int2 coord, uint4 color); #ifdef cl_khr_3d_image_writes void __ovld write_imagef(write_only image3d_t image, int4 coord, float4 color); void __ovld write_imagei(write_only image3d_t image, int4 coord, int4 color); void __ovld write_imageui(write_only image3d_t image, int4 coord, uint4 color); #endif #ifdef cl_khr_depth_images void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, float color); void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, float color); #endif //cl_khr_depth_images // OpenCL Extension v2.0 s9.18 - Mipmaps #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #ifdef cl_khr_mipmap_image void __ovld write_imagef(write_only image1d_t image, int coord, int lod, float4 color); void __ovld write_imagei(write_only image1d_t image, int coord, int lod, int4 color); void __ovld write_imageui(write_only image1d_t image, int coord, int lod, uint4 color); void __ovld write_imagef(write_only image1d_array_t image_array, int2 coord, int lod, float4 color); void __ovld write_imagei(write_only image1d_array_t image_array, int2 coord, int lod, int4 color); void __ovld write_imageui(write_only image1d_array_t image_array, int2 coord, int lod, uint4 color); void __ovld write_imagef(write_only image2d_t image, int2 coord, int lod, float4 color); void __ovld write_imagei(write_only image2d_t image, int2 coord, int lod, int4 color); void __ovld write_imageui(write_only image2d_t image, int2 coord, int lod, uint4 color); void __ovld write_imagef(write_only image2d_array_t image_array, int4 coord, int lod, float4 color); void __ovld write_imagei(write_only image2d_array_t image_array, int4 coord, int lod, int4 color); void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, int lod, uint4 color); void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float color); void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float color); #ifdef cl_khr_3d_image_writes void __ovld write_imagef(write_only image3d_t image, int4 coord, int lod, float4 color); void __ovld write_imagei(write_only image3d_t image, int4 coord, int lod, int4 color); void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4 color); #endif #endif //cl_khr_mipmap_image #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // Image write functions for half4 type #ifdef cl_khr_fp16 void __ovld write_imageh(write_only image1d_t image, int coord, half4 color); void __ovld write_imageh(write_only image2d_t image, int2 coord, half4 color); #ifdef cl_khr_3d_image_writes void __ovld write_imageh(write_only image3d_t image, int4 coord, half4 color); #endif void __ovld write_imageh(write_only image1d_array_t image, int2 coord, half4 color); void __ovld write_imageh(write_only image2d_array_t image, int4 coord, half4 color); void __ovld write_imageh(write_only image1d_buffer_t image, int coord, half4 color); #endif //cl_khr_fp16 // Image write functions for read_write images #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld write_imagef(read_write image2d_t image, int2 coord, float4 color); void __ovld write_imagei(read_write image2d_t image, int2 coord, int4 color); void __ovld write_imageui(read_write image2d_t image, int2 coord, uint4 color); void __ovld write_imagef(read_write image2d_array_t image_array, int4 coord, float4 color); void __ovld write_imagei(read_write image2d_array_t image_array, int4 coord, int4 color); void __ovld write_imageui(read_write image2d_array_t image_array, int4 coord, uint4 color); void __ovld write_imagef(read_write image1d_t image, int coord, float4 color); void __ovld write_imagei(read_write image1d_t image, int coord, int4 color); void __ovld write_imageui(read_write image1d_t image, int coord, uint4 color); void __ovld write_imagef(read_write image1d_buffer_t image, int coord, float4 color); void __ovld write_imagei(read_write image1d_buffer_t image, int coord, int4 color); void __ovld write_imageui(read_write image1d_buffer_t image, int coord, uint4 color); void __ovld write_imagef(read_write image1d_array_t image_array, int2 coord, float4 color); void __ovld write_imagei(read_write image1d_array_t image_array, int2 coord, int4 color); void __ovld write_imageui(read_write image1d_array_t image_array, int2 coord, uint4 color); #ifdef cl_khr_3d_image_writes void __ovld write_imagef(read_write image3d_t image, int4 coord, float4 color); void __ovld write_imagei(read_write image3d_t image, int4 coord, int4 color); void __ovld write_imageui(read_write image3d_t image, int4 coord, uint4 color); #endif #ifdef cl_khr_depth_images void __ovld write_imagef(read_write image2d_depth_t image, int2 coord, float color); void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, float color); #endif //cl_khr_depth_images #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #ifdef cl_khr_mipmap_image void __ovld write_imagef(read_write image1d_t image, int coord, int lod, float4 color); void __ovld write_imagei(read_write image1d_t image, int coord, int lod, int4 color); void __ovld write_imageui(read_write image1d_t image, int coord, int lod, uint4 color); void __ovld write_imagef(read_write image1d_array_t image_array, int2 coord, int lod, float4 color); void __ovld write_imagei(read_write image1d_array_t image_array, int2 coord, int lod, int4 color); void __ovld write_imageui(read_write image1d_array_t image_array, int2 coord, int lod, uint4 color); void __ovld write_imagef(read_write image2d_t image, int2 coord, int lod, float4 color); void __ovld write_imagei(read_write image2d_t image, int2 coord, int lod, int4 color); void __ovld write_imageui(read_write image2d_t image, int2 coord, int lod, uint4 color); void __ovld write_imagef(read_write image2d_array_t image_array, int4 coord, int lod, float4 color); void __ovld write_imagei(read_write image2d_array_t image_array, int4 coord, int lod, int4 color); void __ovld write_imageui(read_write image2d_array_t image_array, int4 coord, int lod, uint4 color); void __ovld write_imagef(read_write image2d_depth_t image, int2 coord, int lod, float color); void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int lod, float color); #ifdef cl_khr_3d_image_writes void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color); void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color); void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color); #endif #endif //cl_khr_mipmap_image #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // Image write functions for half4 type #ifdef cl_khr_fp16 void __ovld write_imageh(read_write image1d_t image, int coord, half4 color); void __ovld write_imageh(read_write image2d_t image, int2 coord, half4 color); #ifdef cl_khr_3d_image_writes void __ovld write_imageh(read_write image3d_t image, int4 coord, half4 color); #endif void __ovld write_imageh(read_write image1d_array_t image, int2 coord, half4 color); void __ovld write_imageh(read_write image2d_array_t image, int4 coord, half4 color); void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 color); #endif //cl_khr_fp16 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // Note: In OpenCL v1.0/1.1/1.2, image argument of image query builtin functions does not have // access qualifier, which by default assume read_only access qualifier. Image query builtin // functions with write_only image argument should also be declared. /** * Return the image width in pixels. * */ int __ovld __cnfn get_image_width(read_only image1d_t image); int __ovld __cnfn get_image_width(read_only image1d_buffer_t image); int __ovld __cnfn get_image_width(read_only image2d_t image); #ifdef cl_khr_3d_image_writes int __ovld __cnfn get_image_width(read_only image3d_t image); #endif int __ovld __cnfn get_image_width(read_only image1d_array_t image); int __ovld __cnfn get_image_width(read_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_width(read_only image2d_depth_t image); int __ovld __cnfn get_image_width(read_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_width(read_only image2d_msaa_t image); int __ovld __cnfn get_image_width(read_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_width(read_only image2d_array_msaa_t image); int __ovld __cnfn get_image_width(read_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing int __ovld __cnfn get_image_width(write_only image1d_t image); int __ovld __cnfn get_image_width(write_only image1d_buffer_t image); int __ovld __cnfn get_image_width(write_only image2d_t image); #ifdef cl_khr_3d_image_writes int __ovld __cnfn get_image_width(write_only image3d_t image); #endif int __ovld __cnfn get_image_width(write_only image1d_array_t image); int __ovld __cnfn get_image_width(write_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_width(write_only image2d_depth_t image); int __ovld __cnfn get_image_width(write_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_width(write_only image2d_msaa_t image); int __ovld __cnfn get_image_width(write_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_width(write_only image2d_array_msaa_t image); int __ovld __cnfn get_image_width(write_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld __cnfn get_image_width(read_write image1d_t image); int __ovld __cnfn get_image_width(read_write image1d_buffer_t image); int __ovld __cnfn get_image_width(read_write image2d_t image); int __ovld __cnfn get_image_width(read_write image3d_t image); int __ovld __cnfn get_image_width(read_write image1d_array_t image); int __ovld __cnfn get_image_width(read_write image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_width(read_write image2d_depth_t image); int __ovld __cnfn get_image_width(read_write image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_width(read_write image2d_msaa_t image); int __ovld __cnfn get_image_width(read_write image2d_msaa_depth_t image); int __ovld __cnfn get_image_width(read_write image2d_array_msaa_t image); int __ovld __cnfn get_image_width(read_write image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the image height in pixels. */ int __ovld __cnfn get_image_height(read_only image2d_t image); int __ovld __cnfn get_image_height(read_only image3d_t image); int __ovld __cnfn get_image_height(read_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_height(read_only image2d_depth_t image); int __ovld __cnfn get_image_height(read_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_height(read_only image2d_msaa_t image); int __ovld __cnfn get_image_height(read_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_height(read_only image2d_array_msaa_t image); int __ovld __cnfn get_image_height(read_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing int __ovld __cnfn get_image_height(write_only image2d_t image); #ifdef cl_khr_3d_image_writes int __ovld __cnfn get_image_height(write_only image3d_t image); #endif int __ovld __cnfn get_image_height(write_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_height(write_only image2d_depth_t image); int __ovld __cnfn get_image_height(write_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_height(write_only image2d_msaa_t image); int __ovld __cnfn get_image_height(write_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_height(write_only image2d_array_msaa_t image); int __ovld __cnfn get_image_height(write_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld __cnfn get_image_height(read_write image2d_t image); int __ovld __cnfn get_image_height(read_write image3d_t image); int __ovld __cnfn get_image_height(read_write image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_height(read_write image2d_depth_t image); int __ovld __cnfn get_image_height(read_write image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_height(read_write image2d_msaa_t image); int __ovld __cnfn get_image_height(read_write image2d_msaa_depth_t image); int __ovld __cnfn get_image_height(read_write image2d_array_msaa_t image); int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the image depth in pixels. */ int __ovld __cnfn get_image_depth(read_only image3d_t image); #ifdef cl_khr_3d_image_writes int __ovld __cnfn get_image_depth(write_only image3d_t image); #endif #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld __cnfn get_image_depth(read_write image3d_t image); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL Extension v2.0 s9.18 - Mipmaps #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #ifdef cl_khr_mipmap_image /** * Return the image miplevels. */ int __ovld get_image_num_mip_levels(read_only image1d_t image); int __ovld get_image_num_mip_levels(read_only image2d_t image); int __ovld get_image_num_mip_levels(read_only image3d_t image); int __ovld get_image_num_mip_levels(write_only image1d_t image); int __ovld get_image_num_mip_levels(write_only image2d_t image); #ifdef cl_khr_3d_image_writes int __ovld get_image_num_mip_levels(write_only image3d_t image); #endif int __ovld get_image_num_mip_levels(read_write image1d_t image); int __ovld get_image_num_mip_levels(read_write image2d_t image); int __ovld get_image_num_mip_levels(read_write image3d_t image); int __ovld get_image_num_mip_levels(read_only image1d_array_t image); int __ovld get_image_num_mip_levels(read_only image2d_array_t image); int __ovld get_image_num_mip_levels(read_only image2d_array_depth_t image); int __ovld get_image_num_mip_levels(read_only image2d_depth_t image); int __ovld get_image_num_mip_levels(write_only image1d_array_t image); int __ovld get_image_num_mip_levels(write_only image2d_array_t image); int __ovld get_image_num_mip_levels(write_only image2d_array_depth_t image); int __ovld get_image_num_mip_levels(write_only image2d_depth_t image); int __ovld get_image_num_mip_levels(read_write image1d_array_t image); int __ovld get_image_num_mip_levels(read_write image2d_array_t image); int __ovld get_image_num_mip_levels(read_write image2d_array_depth_t image); int __ovld get_image_num_mip_levels(read_write image2d_depth_t image); #endif //cl_khr_mipmap_image #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the channel data type. Valid values are: * CLK_SNORM_INT8 * CLK_SNORM_INT16 * CLK_UNORM_INT8 * CLK_UNORM_INT16 * CLK_UNORM_SHORT_565 * CLK_UNORM_SHORT_555 * CLK_UNORM_SHORT_101010 * CLK_SIGNED_INT8 * CLK_SIGNED_INT16 * CLK_SIGNED_INT32 * CLK_UNSIGNED_INT8 * CLK_UNSIGNED_INT16 * CLK_UNSIGNED_INT32 * CLK_HALF_FLOAT * CLK_FLOAT */ int __ovld __cnfn get_image_channel_data_type(read_only image1d_t image); int __ovld __cnfn get_image_channel_data_type(read_only image1d_buffer_t image); int __ovld __cnfn get_image_channel_data_type(read_only image2d_t image); int __ovld __cnfn get_image_channel_data_type(read_only image3d_t image); int __ovld __cnfn get_image_channel_data_type(read_only image1d_array_t image); int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_channel_data_type(read_only image2d_depth_t image); int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_channel_data_type(read_only image2d_msaa_t image); int __ovld __cnfn get_image_channel_data_type(read_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_msaa_t image); int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing int __ovld __cnfn get_image_channel_data_type(write_only image1d_t image); int __ovld __cnfn get_image_channel_data_type(write_only image1d_buffer_t image); int __ovld __cnfn get_image_channel_data_type(write_only image2d_t image); #ifdef cl_khr_3d_image_writes int __ovld __cnfn get_image_channel_data_type(write_only image3d_t image); #endif int __ovld __cnfn get_image_channel_data_type(write_only image1d_array_t image); int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_channel_data_type(write_only image2d_depth_t image); int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_channel_data_type(write_only image2d_msaa_t image); int __ovld __cnfn get_image_channel_data_type(write_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_msaa_t image); int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld __cnfn get_image_channel_data_type(read_write image1d_t image); int __ovld __cnfn get_image_channel_data_type(read_write image1d_buffer_t image); int __ovld __cnfn get_image_channel_data_type(read_write image2d_t image); int __ovld __cnfn get_image_channel_data_type(read_write image3d_t image); int __ovld __cnfn get_image_channel_data_type(read_write image1d_array_t image); int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_channel_data_type(read_write image2d_depth_t image); int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_t image); int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_depth_t image); int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_t image); int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the image channel order. Valid values are: * CLK_A * CLK_R * CLK_Rx * CLK_RG * CLK_RGx * CLK_RA * CLK_RGB * CLK_RGBx * CLK_RGBA * CLK_ARGB * CLK_BGRA * CLK_INTENSITY * CLK_LUMINANCE */ int __ovld __cnfn get_image_channel_order(read_only image1d_t image); int __ovld __cnfn get_image_channel_order(read_only image1d_buffer_t image); int __ovld __cnfn get_image_channel_order(read_only image2d_t image); int __ovld __cnfn get_image_channel_order(read_only image3d_t image); int __ovld __cnfn get_image_channel_order(read_only image1d_array_t image); int __ovld __cnfn get_image_channel_order(read_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_channel_order(read_only image2d_depth_t image); int __ovld __cnfn get_image_channel_order(read_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_channel_order(read_only image2d_msaa_t image); int __ovld __cnfn get_image_channel_order(read_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_channel_order(read_only image2d_array_msaa_t image); int __ovld __cnfn get_image_channel_order(read_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing int __ovld __cnfn get_image_channel_order(write_only image1d_t image); int __ovld __cnfn get_image_channel_order(write_only image1d_buffer_t image); int __ovld __cnfn get_image_channel_order(write_only image2d_t image); #ifdef cl_khr_3d_image_writes int __ovld __cnfn get_image_channel_order(write_only image3d_t image); #endif int __ovld __cnfn get_image_channel_order(write_only image1d_array_t image); int __ovld __cnfn get_image_channel_order(write_only image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_channel_order(write_only image2d_depth_t image); int __ovld __cnfn get_image_channel_order(write_only image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_channel_order(write_only image2d_msaa_t image); int __ovld __cnfn get_image_channel_order(write_only image2d_msaa_depth_t image); int __ovld __cnfn get_image_channel_order(write_only image2d_array_msaa_t image); int __ovld __cnfn get_image_channel_order(write_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld __cnfn get_image_channel_order(read_write image1d_t image); int __ovld __cnfn get_image_channel_order(read_write image1d_buffer_t image); int __ovld __cnfn get_image_channel_order(read_write image2d_t image); int __ovld __cnfn get_image_channel_order(read_write image3d_t image); int __ovld __cnfn get_image_channel_order(read_write image1d_array_t image); int __ovld __cnfn get_image_channel_order(read_write image2d_array_t image); #ifdef cl_khr_depth_images int __ovld __cnfn get_image_channel_order(read_write image2d_depth_t image); int __ovld __cnfn get_image_channel_order(read_write image2d_array_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_t image); int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_depth_t image); int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_t image); int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the 2D image width and height as an int2 * type. The width is returned in the x component, and * the height in the y component. */ int2 __ovld __cnfn get_image_dim(read_only image2d_t image); int2 __ovld __cnfn get_image_dim(read_only image2d_array_t image); #ifdef cl_khr_depth_images int2 __ovld __cnfn get_image_dim(read_only image2d_array_depth_t image); int2 __ovld __cnfn get_image_dim(read_only image2d_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int2 __ovld __cnfn get_image_dim(read_only image2d_msaa_t image); int2 __ovld __cnfn get_image_dim(read_only image2d_msaa_depth_t image); int2 __ovld __cnfn get_image_dim(read_only image2d_array_msaa_t image); int2 __ovld __cnfn get_image_dim(read_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing int2 __ovld __cnfn get_image_dim(write_only image2d_t image); int2 __ovld __cnfn get_image_dim(write_only image2d_array_t image); #ifdef cl_khr_depth_images int2 __ovld __cnfn get_image_dim(write_only image2d_array_depth_t image); int2 __ovld __cnfn get_image_dim(write_only image2d_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int2 __ovld __cnfn get_image_dim(write_only image2d_msaa_t image); int2 __ovld __cnfn get_image_dim(write_only image2d_msaa_depth_t image); int2 __ovld __cnfn get_image_dim(write_only image2d_array_msaa_t image); int2 __ovld __cnfn get_image_dim(write_only image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int2 __ovld __cnfn get_image_dim(read_write image2d_t image); int2 __ovld __cnfn get_image_dim(read_write image2d_array_t image); #ifdef cl_khr_depth_images int2 __ovld __cnfn get_image_dim(read_write image2d_array_depth_t image); int2 __ovld __cnfn get_image_dim(read_write image2d_depth_t image); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_t image); int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_depth_t image); int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_t image); int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image); #endif //cl_khr_gl_msaa_sharing #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the 3D image width, height, and depth as an * int4 type. The width is returned in the x * component, height in the y component, depth in the z * component and the w component is 0. */ int4 __ovld __cnfn get_image_dim(read_only image3d_t image); #ifdef cl_khr_3d_image_writes int4 __ovld __cnfn get_image_dim(write_only image3d_t image); #endif #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int4 __ovld __cnfn get_image_dim(read_write image3d_t image); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the image array size. */ size_t __ovld __cnfn get_image_array_size(read_only image1d_array_t image_array); size_t __ovld __cnfn get_image_array_size(read_only image2d_array_t image_array); #ifdef cl_khr_depth_images size_t __ovld __cnfn get_image_array_size(read_only image2d_array_depth_t image_array); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) size_t __ovld __cnfn get_image_array_size(read_only image2d_array_msaa_t image_array); size_t __ovld __cnfn get_image_array_size(read_only image2d_array_msaa_depth_t image_array); #endif //cl_khr_gl_msaa_sharing size_t __ovld __cnfn get_image_array_size(write_only image1d_array_t image_array); size_t __ovld __cnfn get_image_array_size(write_only image2d_array_t image_array); #ifdef cl_khr_depth_images size_t __ovld __cnfn get_image_array_size(write_only image2d_array_depth_t image_array); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_t image_array); size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_depth_t image_array); #endif //cl_khr_gl_msaa_sharing #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) size_t __ovld __cnfn get_image_array_size(read_write image1d_array_t image_array); size_t __ovld __cnfn get_image_array_size(read_write image2d_array_t image_array); #ifdef cl_khr_depth_images size_t __ovld __cnfn get_image_array_size(read_write image2d_array_depth_t image_array); #endif //cl_khr_depth_images #if defined(cl_khr_gl_msaa_sharing) size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_t image_array); size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_depth_t image_array); #endif //cl_khr_gl_msaa_sharing #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) /** * Return the number of samples associated with image */ #if defined(cl_khr_gl_msaa_sharing) int __ovld get_image_num_samples(read_only image2d_msaa_t image); int __ovld get_image_num_samples(read_only image2d_msaa_depth_t image); int __ovld get_image_num_samples(read_only image2d_array_msaa_t image); int __ovld get_image_num_samples(read_only image2d_array_msaa_depth_t image); int __ovld get_image_num_samples(write_only image2d_msaa_t image); int __ovld get_image_num_samples(write_only image2d_msaa_depth_t image); int __ovld get_image_num_samples(write_only image2d_array_msaa_t image); int __ovld get_image_num_samples(write_only image2d_array_msaa_depth_t image); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld get_image_num_samples(read_write image2d_msaa_t image); int __ovld get_image_num_samples(read_write image2d_msaa_depth_t image); int __ovld get_image_num_samples(read_write image2d_array_msaa_t image); int __ovld get_image_num_samples(read_write image2d_array_msaa_depth_t image); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #endif // OpenCL v2.0 s6.13.15 - Work-group Functions #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld __conv work_group_all(int predicate); int __ovld __conv work_group_any(int predicate); #ifdef cl_khr_fp16 half __ovld __conv work_group_broadcast(half a, size_t local_id); half __ovld __conv work_group_broadcast(half a, size_t x, size_t y); half __ovld __conv work_group_broadcast(half a, size_t x, size_t y, size_t z); #endif int __ovld __conv work_group_broadcast(int a, size_t local_id); int __ovld __conv work_group_broadcast(int a, size_t x, size_t y); int __ovld __conv work_group_broadcast(int a, size_t x, size_t y, size_t z); uint __ovld __conv work_group_broadcast(uint a, size_t local_id); uint __ovld __conv work_group_broadcast(uint a, size_t x, size_t y); uint __ovld __conv work_group_broadcast(uint a, size_t x, size_t y, size_t z); long __ovld __conv work_group_broadcast(long a, size_t local_id); long __ovld __conv work_group_broadcast(long a, size_t x, size_t y); long __ovld __conv work_group_broadcast(long a, size_t x, size_t y, size_t z); ulong __ovld __conv work_group_broadcast(ulong a, size_t local_id); ulong __ovld __conv work_group_broadcast(ulong a, size_t x, size_t y); ulong __ovld __conv work_group_broadcast(ulong a, size_t x, size_t y, size_t z); float __ovld __conv work_group_broadcast(float a, size_t local_id); float __ovld __conv work_group_broadcast(float a, size_t x, size_t y); float __ovld __conv work_group_broadcast(float a, size_t x, size_t y, size_t z); #ifdef cl_khr_fp64 double __ovld __conv work_group_broadcast(double a, size_t local_id); double __ovld __conv work_group_broadcast(double a, size_t x, size_t y); double __ovld __conv work_group_broadcast(double a, size_t x, size_t y, size_t z); #endif //cl_khr_fp64 #ifdef cl_khr_fp16 half __ovld __conv work_group_reduce_add(half x); half __ovld __conv work_group_reduce_min(half x); half __ovld __conv work_group_reduce_max(half x); half __ovld __conv work_group_scan_exclusive_add(half x); half __ovld __conv work_group_scan_exclusive_min(half x); half __ovld __conv work_group_scan_exclusive_max(half x); half __ovld __conv work_group_scan_inclusive_add(half x); half __ovld __conv work_group_scan_inclusive_min(half x); half __ovld __conv work_group_scan_inclusive_max(half x); #endif int __ovld __conv work_group_reduce_add(int x); int __ovld __conv work_group_reduce_min(int x); int __ovld __conv work_group_reduce_max(int x); int __ovld __conv work_group_scan_exclusive_add(int x); int __ovld __conv work_group_scan_exclusive_min(int x); int __ovld __conv work_group_scan_exclusive_max(int x); int __ovld __conv work_group_scan_inclusive_add(int x); int __ovld __conv work_group_scan_inclusive_min(int x); int __ovld __conv work_group_scan_inclusive_max(int x); uint __ovld __conv work_group_reduce_add(uint x); uint __ovld __conv work_group_reduce_min(uint x); uint __ovld __conv work_group_reduce_max(uint x); uint __ovld __conv work_group_scan_exclusive_add(uint x); uint __ovld __conv work_group_scan_exclusive_min(uint x); uint __ovld __conv work_group_scan_exclusive_max(uint x); uint __ovld __conv work_group_scan_inclusive_add(uint x); uint __ovld __conv work_group_scan_inclusive_min(uint x); uint __ovld __conv work_group_scan_inclusive_max(uint x); long __ovld __conv work_group_reduce_add(long x); long __ovld __conv work_group_reduce_min(long x); long __ovld __conv work_group_reduce_max(long x); long __ovld __conv work_group_scan_exclusive_add(long x); long __ovld __conv work_group_scan_exclusive_min(long x); long __ovld __conv work_group_scan_exclusive_max(long x); long __ovld __conv work_group_scan_inclusive_add(long x); long __ovld __conv work_group_scan_inclusive_min(long x); long __ovld __conv work_group_scan_inclusive_max(long x); ulong __ovld __conv work_group_reduce_add(ulong x); ulong __ovld __conv work_group_reduce_min(ulong x); ulong __ovld __conv work_group_reduce_max(ulong x); ulong __ovld __conv work_group_scan_exclusive_add(ulong x); ulong __ovld __conv work_group_scan_exclusive_min(ulong x); ulong __ovld __conv work_group_scan_exclusive_max(ulong x); ulong __ovld __conv work_group_scan_inclusive_add(ulong x); ulong __ovld __conv work_group_scan_inclusive_min(ulong x); ulong __ovld __conv work_group_scan_inclusive_max(ulong x); float __ovld __conv work_group_reduce_add(float x); float __ovld __conv work_group_reduce_min(float x); float __ovld __conv work_group_reduce_max(float x); float __ovld __conv work_group_scan_exclusive_add(float x); float __ovld __conv work_group_scan_exclusive_min(float x); float __ovld __conv work_group_scan_exclusive_max(float x); float __ovld __conv work_group_scan_inclusive_add(float x); float __ovld __conv work_group_scan_inclusive_min(float x); float __ovld __conv work_group_scan_inclusive_max(float x); #ifdef cl_khr_fp64 double __ovld __conv work_group_reduce_add(double x); double __ovld __conv work_group_reduce_min(double x); double __ovld __conv work_group_reduce_max(double x); double __ovld __conv work_group_scan_exclusive_add(double x); double __ovld __conv work_group_scan_exclusive_min(double x); double __ovld __conv work_group_scan_exclusive_max(double x); double __ovld __conv work_group_scan_inclusive_add(double x); double __ovld __conv work_group_scan_inclusive_min(double x); double __ovld __conv work_group_scan_inclusive_max(double x); #endif //cl_khr_fp64 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL v2.0 s6.13.16 - Pipe Functions #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) bool __ovld is_valid_reserve_id(reserve_id_t reserve_id); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL v2.0 s6.13.17 - Enqueue Kernels #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) ndrange_t __ovld ndrange_1D(size_t); ndrange_t __ovld ndrange_1D(size_t, size_t); ndrange_t __ovld ndrange_1D(size_t, size_t, size_t); ndrange_t __ovld ndrange_2D(const size_t[2]); ndrange_t __ovld ndrange_2D(const size_t[2], const size_t[2]); ndrange_t __ovld ndrange_2D(const size_t[2], const size_t[2], const size_t[2]); ndrange_t __ovld ndrange_3D(const size_t[3]); ndrange_t __ovld ndrange_3D(const size_t[3], const size_t[3]); ndrange_t __ovld ndrange_3D(const size_t[3], const size_t[3], const size_t[3]); -int __ovld enqueue_marker(queue_t, uint, const __private clk_event_t*, __private clk_event_t*); +int __ovld enqueue_marker(queue_t, uint, const clk_event_t*, clk_event_t*); void __ovld retain_event(clk_event_t); void __ovld release_event(clk_event_t); clk_event_t __ovld create_user_event(void); void __ovld set_user_event_status(clk_event_t e, int state); bool __ovld is_valid_event (clk_event_t event); void __ovld capture_event_profiling_info(clk_event_t, clk_profiling_info, __global void* value); queue_t __ovld get_default_queue(void); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) // OpenCL Extension v2.0 s9.17 - Sub-groups #if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) // Shared Sub Group Functions uint __ovld get_sub_group_size(void); uint __ovld get_max_sub_group_size(void); uint __ovld get_num_sub_groups(void); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) uint __ovld get_enqueued_num_sub_groups(void); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) uint __ovld get_sub_group_id(void); uint __ovld get_sub_group_local_id(void); void __ovld __conv sub_group_barrier(cl_mem_fence_flags flags); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv sub_group_barrier(cl_mem_fence_flags flags, memory_scope scope); #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) int __ovld __conv sub_group_all(int predicate); int __ovld __conv sub_group_any(int predicate); int __ovld __conv sub_group_broadcast(int x, uint sub_group_local_id); uint __ovld __conv sub_group_broadcast(uint x, uint sub_group_local_id); long __ovld __conv sub_group_broadcast(long x, uint sub_group_local_id); ulong __ovld __conv sub_group_broadcast(ulong x, uint sub_group_local_id); float __ovld __conv sub_group_broadcast(float x, uint sub_group_local_id); int __ovld __conv sub_group_reduce_add(int x); uint __ovld __conv sub_group_reduce_add(uint x); long __ovld __conv sub_group_reduce_add(long x); ulong __ovld __conv sub_group_reduce_add(ulong x); float __ovld __conv sub_group_reduce_add(float x); int __ovld __conv sub_group_reduce_min(int x); uint __ovld __conv sub_group_reduce_min(uint x); long __ovld __conv sub_group_reduce_min(long x); ulong __ovld __conv sub_group_reduce_min(ulong x); float __ovld __conv sub_group_reduce_min(float x); int __ovld __conv sub_group_reduce_max(int x); uint __ovld __conv sub_group_reduce_max(uint x); long __ovld __conv sub_group_reduce_max(long x); ulong __ovld __conv sub_group_reduce_max(ulong x); float __ovld __conv sub_group_reduce_max(float x); int __ovld __conv sub_group_scan_exclusive_add(int x); uint __ovld __conv sub_group_scan_exclusive_add(uint x); long __ovld __conv sub_group_scan_exclusive_add(long x); ulong __ovld __conv sub_group_scan_exclusive_add(ulong x); float __ovld __conv sub_group_scan_exclusive_add(float x); int __ovld __conv sub_group_scan_exclusive_min(int x); uint __ovld __conv sub_group_scan_exclusive_min(uint x); long __ovld __conv sub_group_scan_exclusive_min(long x); ulong __ovld __conv sub_group_scan_exclusive_min(ulong x); float __ovld __conv sub_group_scan_exclusive_min(float x); int __ovld __conv sub_group_scan_exclusive_max(int x); uint __ovld __conv sub_group_scan_exclusive_max(uint x); long __ovld __conv sub_group_scan_exclusive_max(long x); ulong __ovld __conv sub_group_scan_exclusive_max(ulong x); float __ovld __conv sub_group_scan_exclusive_max(float x); int __ovld __conv sub_group_scan_inclusive_add(int x); uint __ovld __conv sub_group_scan_inclusive_add(uint x); long __ovld __conv sub_group_scan_inclusive_add(long x); ulong __ovld __conv sub_group_scan_inclusive_add(ulong x); float __ovld __conv sub_group_scan_inclusive_add(float x); int __ovld __conv sub_group_scan_inclusive_min(int x); uint __ovld __conv sub_group_scan_inclusive_min(uint x); long __ovld __conv sub_group_scan_inclusive_min(long x); ulong __ovld __conv sub_group_scan_inclusive_min(ulong x); float __ovld __conv sub_group_scan_inclusive_min(float x); int __ovld __conv sub_group_scan_inclusive_max(int x); uint __ovld __conv sub_group_scan_inclusive_max(uint x); long __ovld __conv sub_group_scan_inclusive_max(long x); ulong __ovld __conv sub_group_scan_inclusive_max(ulong x); float __ovld __conv sub_group_scan_inclusive_max(float x); #ifdef cl_khr_fp16 half __ovld __conv sub_group_broadcast(half x, uint sub_group_local_id); half __ovld __conv sub_group_reduce_add(half x); half __ovld __conv sub_group_reduce_min(half x); half __ovld __conv sub_group_reduce_max(half x); half __ovld __conv sub_group_scan_exclusive_add(half x); half __ovld __conv sub_group_scan_exclusive_min(half x); half __ovld __conv sub_group_scan_exclusive_max(half x); half __ovld __conv sub_group_scan_inclusive_add(half x); half __ovld __conv sub_group_scan_inclusive_min(half x); half __ovld __conv sub_group_scan_inclusive_max(half x); #endif //cl_khr_fp16 #ifdef cl_khr_fp64 double __ovld __conv sub_group_broadcast(double x, uint sub_group_local_id); double __ovld __conv sub_group_reduce_add(double x); double __ovld __conv sub_group_reduce_min(double x); double __ovld __conv sub_group_reduce_max(double x); double __ovld __conv sub_group_scan_exclusive_add(double x); double __ovld __conv sub_group_scan_exclusive_min(double x); double __ovld __conv sub_group_scan_exclusive_max(double x); double __ovld __conv sub_group_scan_inclusive_add(double x); double __ovld __conv sub_group_scan_inclusive_min(double x); double __ovld __conv sub_group_scan_inclusive_max(double x); #endif //cl_khr_fp64 #endif //cl_khr_subgroups cl_intel_subgroups #if defined(cl_intel_subgroups) // Intel-Specific Sub Group Functions float __ovld __conv intel_sub_group_shuffle( float x, uint c ); float2 __ovld __conv intel_sub_group_shuffle( float2 x, uint c ); float3 __ovld __conv intel_sub_group_shuffle( float3 x, uint c ); float4 __ovld __conv intel_sub_group_shuffle( float4 x, uint c ); float8 __ovld __conv intel_sub_group_shuffle( float8 x, uint c ); float16 __ovld __conv intel_sub_group_shuffle( float16 x, uint c ); int __ovld __conv intel_sub_group_shuffle( int x, uint c ); int2 __ovld __conv intel_sub_group_shuffle( int2 x, uint c ); int3 __ovld __conv intel_sub_group_shuffle( int3 x, uint c ); int4 __ovld __conv intel_sub_group_shuffle( int4 x, uint c ); int8 __ovld __conv intel_sub_group_shuffle( int8 x, uint c ); int16 __ovld __conv intel_sub_group_shuffle( int16 x, uint c ); uint __ovld __conv intel_sub_group_shuffle( uint x, uint c ); uint2 __ovld __conv intel_sub_group_shuffle( uint2 x, uint c ); uint3 __ovld __conv intel_sub_group_shuffle( uint3 x, uint c ); uint4 __ovld __conv intel_sub_group_shuffle( uint4 x, uint c ); uint8 __ovld __conv intel_sub_group_shuffle( uint8 x, uint c ); uint16 __ovld __conv intel_sub_group_shuffle( uint16 x, uint c ); long __ovld __conv intel_sub_group_shuffle( long x, uint c ); ulong __ovld __conv intel_sub_group_shuffle( ulong x, uint c ); float __ovld __conv intel_sub_group_shuffle_down( float cur, float next, uint c ); float2 __ovld __conv intel_sub_group_shuffle_down( float2 cur, float2 next, uint c ); float3 __ovld __conv intel_sub_group_shuffle_down( float3 cur, float3 next, uint c ); float4 __ovld __conv intel_sub_group_shuffle_down( float4 cur, float4 next, uint c ); float8 __ovld __conv intel_sub_group_shuffle_down( float8 cur, float8 next, uint c ); float16 __ovld __conv intel_sub_group_shuffle_down( float16 cur, float16 next, uint c ); int __ovld __conv intel_sub_group_shuffle_down( int cur, int next, uint c ); int2 __ovld __conv intel_sub_group_shuffle_down( int2 cur, int2 next, uint c ); int3 __ovld __conv intel_sub_group_shuffle_down( int3 cur, int3 next, uint c ); int4 __ovld __conv intel_sub_group_shuffle_down( int4 cur, int4 next, uint c ); int8 __ovld __conv intel_sub_group_shuffle_down( int8 cur, int8 next, uint c ); int16 __ovld __conv intel_sub_group_shuffle_down( int16 cur, int16 next, uint c ); uint __ovld __conv intel_sub_group_shuffle_down( uint cur, uint next, uint c ); uint2 __ovld __conv intel_sub_group_shuffle_down( uint2 cur, uint2 next, uint c ); uint3 __ovld __conv intel_sub_group_shuffle_down( uint3 cur, uint3 next, uint c ); uint4 __ovld __conv intel_sub_group_shuffle_down( uint4 cur, uint4 next, uint c ); uint8 __ovld __conv intel_sub_group_shuffle_down( uint8 cur, uint8 next, uint c ); uint16 __ovld __conv intel_sub_group_shuffle_down( uint16 cur, uint16 next, uint c ); long __ovld __conv intel_sub_group_shuffle_down( long prev, long cur, uint c ); ulong __ovld __conv intel_sub_group_shuffle_down( ulong prev, ulong cur, uint c ); float __ovld __conv intel_sub_group_shuffle_up( float prev, float cur, uint c ); float2 __ovld __conv intel_sub_group_shuffle_up( float2 prev, float2 cur, uint c ); float3 __ovld __conv intel_sub_group_shuffle_up( float3 prev, float3 cur, uint c ); float4 __ovld __conv intel_sub_group_shuffle_up( float4 prev, float4 cur, uint c ); float8 __ovld __conv intel_sub_group_shuffle_up( float8 prev, float8 cur, uint c ); float16 __ovld __conv intel_sub_group_shuffle_up( float16 prev, float16 cur, uint c ); int __ovld __conv intel_sub_group_shuffle_up( int prev, int cur, uint c ); int2 __ovld __conv intel_sub_group_shuffle_up( int2 prev, int2 cur, uint c ); int3 __ovld __conv intel_sub_group_shuffle_up( int3 prev, int3 cur, uint c ); int4 __ovld __conv intel_sub_group_shuffle_up( int4 prev, int4 cur, uint c ); int8 __ovld __conv intel_sub_group_shuffle_up( int8 prev, int8 cur, uint c ); int16 __ovld __conv intel_sub_group_shuffle_up( int16 prev, int16 cur, uint c ); uint __ovld __conv intel_sub_group_shuffle_up( uint prev, uint cur, uint c ); uint2 __ovld __conv intel_sub_group_shuffle_up( uint2 prev, uint2 cur, uint c ); uint3 __ovld __conv intel_sub_group_shuffle_up( uint3 prev, uint3 cur, uint c ); uint4 __ovld __conv intel_sub_group_shuffle_up( uint4 prev, uint4 cur, uint c ); uint8 __ovld __conv intel_sub_group_shuffle_up( uint8 prev, uint8 cur, uint c ); uint16 __ovld __conv intel_sub_group_shuffle_up( uint16 prev, uint16 cur, uint c ); long __ovld __conv intel_sub_group_shuffle_up( long prev, long cur, uint c ); ulong __ovld __conv intel_sub_group_shuffle_up( ulong prev, ulong cur, uint c ); float __ovld __conv intel_sub_group_shuffle_xor( float x, uint c ); float2 __ovld __conv intel_sub_group_shuffle_xor( float2 x, uint c ); float3 __ovld __conv intel_sub_group_shuffle_xor( float3 x, uint c ); float4 __ovld __conv intel_sub_group_shuffle_xor( float4 x, uint c ); float8 __ovld __conv intel_sub_group_shuffle_xor( float8 x, uint c ); float16 __ovld __conv intel_sub_group_shuffle_xor( float16 x, uint c ); int __ovld __conv intel_sub_group_shuffle_xor( int x, uint c ); int2 __ovld __conv intel_sub_group_shuffle_xor( int2 x, uint c ); int3 __ovld __conv intel_sub_group_shuffle_xor( int3 x, uint c ); int4 __ovld __conv intel_sub_group_shuffle_xor( int4 x, uint c ); int8 __ovld __conv intel_sub_group_shuffle_xor( int8 x, uint c ); int16 __ovld __conv intel_sub_group_shuffle_xor( int16 x, uint c ); uint __ovld __conv intel_sub_group_shuffle_xor( uint x, uint c ); uint2 __ovld __conv intel_sub_group_shuffle_xor( uint2 x, uint c ); uint3 __ovld __conv intel_sub_group_shuffle_xor( uint3 x, uint c ); uint4 __ovld __conv intel_sub_group_shuffle_xor( uint4 x, uint c ); uint8 __ovld __conv intel_sub_group_shuffle_xor( uint8 x, uint c ); uint16 __ovld __conv intel_sub_group_shuffle_xor( uint16 x, uint c ); long __ovld __conv intel_sub_group_shuffle_xor( long x, uint c ); ulong __ovld __conv intel_sub_group_shuffle_xor( ulong x, uint c ); uint __ovld __conv intel_sub_group_block_read( read_only image2d_t image, int2 coord ); uint2 __ovld __conv intel_sub_group_block_read2( read_only image2d_t image, int2 coord ); uint4 __ovld __conv intel_sub_group_block_read4( read_only image2d_t image, int2 coord ); uint8 __ovld __conv intel_sub_group_block_read8( read_only image2d_t image, int2 coord ); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) uint __ovld __conv intel_sub_group_block_read(read_write image2d_t image, int2 coord); uint2 __ovld __conv intel_sub_group_block_read2(read_write image2d_t image, int2 coord); uint4 __ovld __conv intel_sub_group_block_read4(read_write image2d_t image, int2 coord); uint8 __ovld __conv intel_sub_group_block_read8(read_write image2d_t image, int2 coord); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) uint __ovld __conv intel_sub_group_block_read( const __global uint* p ); uint2 __ovld __conv intel_sub_group_block_read2( const __global uint* p ); uint4 __ovld __conv intel_sub_group_block_read4( const __global uint* p ); uint8 __ovld __conv intel_sub_group_block_read8( const __global uint* p ); void __ovld __conv intel_sub_group_block_write(write_only image2d_t image, int2 coord, uint data); void __ovld __conv intel_sub_group_block_write2(write_only image2d_t image, int2 coord, uint2 data); void __ovld __conv intel_sub_group_block_write4(write_only image2d_t image, int2 coord, uint4 data); void __ovld __conv intel_sub_group_block_write8(write_only image2d_t image, int2 coord, uint8 data); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv intel_sub_group_block_write(read_write image2d_t image, int2 coord, uint data); void __ovld __conv intel_sub_group_block_write2(read_write image2d_t image, int2 coord, uint2 data); void __ovld __conv intel_sub_group_block_write4(read_write image2d_t image, int2 coord, uint4 data); void __ovld __conv intel_sub_group_block_write8(read_write image2d_t image, int2 coord, uint8 data); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv intel_sub_group_block_write( __global uint* p, uint data ); void __ovld __conv intel_sub_group_block_write2( __global uint* p, uint2 data ); void __ovld __conv intel_sub_group_block_write4( __global uint* p, uint4 data ); void __ovld __conv intel_sub_group_block_write8( __global uint* p, uint8 data ); #ifdef cl_khr_fp16 half __ovld __conv intel_sub_group_shuffle( half x, uint c ); half __ovld __conv intel_sub_group_shuffle_down( half prev, half cur, uint c ); half __ovld __conv intel_sub_group_shuffle_up( half prev, half cur, uint c ); half __ovld __conv intel_sub_group_shuffle_xor( half x, uint c ); #endif #if defined(cl_khr_fp64) double __ovld __conv intel_sub_group_shuffle( double x, uint c ); double __ovld __conv intel_sub_group_shuffle_down( double prev, double cur, uint c ); double __ovld __conv intel_sub_group_shuffle_up( double prev, double cur, uint c ); double __ovld __conv intel_sub_group_shuffle_xor( double x, uint c ); #endif #endif //cl_intel_subgroups #if defined(cl_intel_subgroups_short) short __ovld __conv intel_sub_group_broadcast( short x, uint sub_group_local_id ); short2 __ovld __conv intel_sub_group_broadcast( short2 x, uint sub_group_local_id ); short3 __ovld __conv intel_sub_group_broadcast( short3 x, uint sub_group_local_id ); short4 __ovld __conv intel_sub_group_broadcast( short4 x, uint sub_group_local_id ); short8 __ovld __conv intel_sub_group_broadcast( short8 x, uint sub_group_local_id ); ushort __ovld __conv intel_sub_group_broadcast( ushort x, uint sub_group_local_id ); ushort2 __ovld __conv intel_sub_group_broadcast( ushort2 x, uint sub_group_local_id ); ushort3 __ovld __conv intel_sub_group_broadcast( ushort3 x, uint sub_group_local_id ); ushort4 __ovld __conv intel_sub_group_broadcast( ushort4 x, uint sub_group_local_id ); ushort8 __ovld __conv intel_sub_group_broadcast( ushort8 x, uint sub_group_local_id ); short __ovld __conv intel_sub_group_shuffle( short x, uint c ); short2 __ovld __conv intel_sub_group_shuffle( short2 x, uint c ); short3 __ovld __conv intel_sub_group_shuffle( short3 x, uint c ); short4 __ovld __conv intel_sub_group_shuffle( short4 x, uint c ); short8 __ovld __conv intel_sub_group_shuffle( short8 x, uint c ); short16 __ovld __conv intel_sub_group_shuffle( short16 x, uint c); ushort __ovld __conv intel_sub_group_shuffle( ushort x, uint c ); ushort2 __ovld __conv intel_sub_group_shuffle( ushort2 x, uint c ); ushort3 __ovld __conv intel_sub_group_shuffle( ushort3 x, uint c ); ushort4 __ovld __conv intel_sub_group_shuffle( ushort4 x, uint c ); ushort8 __ovld __conv intel_sub_group_shuffle( ushort8 x, uint c ); ushort16 __ovld __conv intel_sub_group_shuffle( ushort16 x, uint c ); short __ovld __conv intel_sub_group_shuffle_down( short cur, short next, uint c ); short2 __ovld __conv intel_sub_group_shuffle_down( short2 cur, short2 next, uint c ); short3 __ovld __conv intel_sub_group_shuffle_down( short3 cur, short3 next, uint c ); short4 __ovld __conv intel_sub_group_shuffle_down( short4 cur, short4 next, uint c ); short8 __ovld __conv intel_sub_group_shuffle_down( short8 cur, short8 next, uint c ); short16 __ovld __conv intel_sub_group_shuffle_down( short16 cur, short16 next, uint c ); ushort __ovld __conv intel_sub_group_shuffle_down( ushort cur, ushort next, uint c ); ushort2 __ovld __conv intel_sub_group_shuffle_down( ushort2 cur, ushort2 next, uint c ); ushort3 __ovld __conv intel_sub_group_shuffle_down( ushort3 cur, ushort3 next, uint c ); ushort4 __ovld __conv intel_sub_group_shuffle_down( ushort4 cur, ushort4 next, uint c ); ushort8 __ovld __conv intel_sub_group_shuffle_down( ushort8 cur, ushort8 next, uint c ); ushort16 __ovld __conv intel_sub_group_shuffle_down( ushort16 cur, ushort16 next, uint c ); short __ovld __conv intel_sub_group_shuffle_up( short cur, short next, uint c ); short2 __ovld __conv intel_sub_group_shuffle_up( short2 cur, short2 next, uint c ); short3 __ovld __conv intel_sub_group_shuffle_up( short3 cur, short3 next, uint c ); short4 __ovld __conv intel_sub_group_shuffle_up( short4 cur, short4 next, uint c ); short8 __ovld __conv intel_sub_group_shuffle_up( short8 cur, short8 next, uint c ); short16 __ovld __conv intel_sub_group_shuffle_up( short16 cur, short16 next, uint c ); ushort __ovld __conv intel_sub_group_shuffle_up( ushort cur, ushort next, uint c ); ushort2 __ovld __conv intel_sub_group_shuffle_up( ushort2 cur, ushort2 next, uint c ); ushort3 __ovld __conv intel_sub_group_shuffle_up( ushort3 cur, ushort3 next, uint c ); ushort4 __ovld __conv intel_sub_group_shuffle_up( ushort4 cur, ushort4 next, uint c ); ushort8 __ovld __conv intel_sub_group_shuffle_up( ushort8 cur, ushort8 next, uint c ); ushort16 __ovld __conv intel_sub_group_shuffle_up( ushort16 cur, ushort16 next, uint c ); short __ovld __conv intel_sub_group_shuffle_xor( short x, uint c ); short2 __ovld __conv intel_sub_group_shuffle_xor( short2 x, uint c ); short3 __ovld __conv intel_sub_group_shuffle_xor( short3 x, uint c ); short4 __ovld __conv intel_sub_group_shuffle_xor( short4 x, uint c ); short8 __ovld __conv intel_sub_group_shuffle_xor( short8 x, uint c ); short16 __ovld __conv intel_sub_group_shuffle_xor( short16 x, uint c ); ushort __ovld __conv intel_sub_group_shuffle_xor( ushort x, uint c ); ushort2 __ovld __conv intel_sub_group_shuffle_xor( ushort2 x, uint c ); ushort3 __ovld __conv intel_sub_group_shuffle_xor( ushort3 x, uint c ); ushort4 __ovld __conv intel_sub_group_shuffle_xor( ushort4 x, uint c ); ushort8 __ovld __conv intel_sub_group_shuffle_xor( ushort8 x, uint c ); ushort16 __ovld __conv intel_sub_group_shuffle_xor( ushort16 x, uint c ); short __ovld __conv intel_sub_group_reduce_add( short x ); ushort __ovld __conv intel_sub_group_reduce_add( ushort x ); short __ovld __conv intel_sub_group_reduce_min( short x ); ushort __ovld __conv intel_sub_group_reduce_min( ushort x ); short __ovld __conv intel_sub_group_reduce_max( short x ); ushort __ovld __conv intel_sub_group_reduce_max( ushort x ); short __ovld __conv intel_sub_group_scan_exclusive_add( short x ); ushort __ovld __conv intel_sub_group_scan_exclusive_add( ushort x ); short __ovld __conv intel_sub_group_scan_exclusive_min( short x ); ushort __ovld __conv intel_sub_group_scan_exclusive_min( ushort x ); short __ovld __conv intel_sub_group_scan_exclusive_max( short x ); ushort __ovld __conv intel_sub_group_scan_exclusive_max( ushort x ); short __ovld __conv intel_sub_group_scan_inclusive_add( short x ); ushort __ovld __conv intel_sub_group_scan_inclusive_add( ushort x ); short __ovld __conv intel_sub_group_scan_inclusive_min( short x ); ushort __ovld __conv intel_sub_group_scan_inclusive_min( ushort x ); short __ovld __conv intel_sub_group_scan_inclusive_max( short x ); ushort __ovld __conv intel_sub_group_scan_inclusive_max( ushort x ); uint __ovld __conv intel_sub_group_block_read_ui( read_only image2d_t image, int2 byte_coord ); uint2 __ovld __conv intel_sub_group_block_read_ui2( read_only image2d_t image, int2 byte_coord ); uint4 __ovld __conv intel_sub_group_block_read_ui4( read_only image2d_t image, int2 byte_coord ); uint8 __ovld __conv intel_sub_group_block_read_ui8( read_only image2d_t image, int2 byte_coord ); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) uint __ovld __conv intel_sub_group_block_read_ui( read_write image2d_t image, int2 byte_coord ); uint2 __ovld __conv intel_sub_group_block_read_ui2( read_write image2d_t image, int2 byte_coord ); uint4 __ovld __conv intel_sub_group_block_read_ui4( read_write image2d_t image, int2 byte_coord ); uint8 __ovld __conv intel_sub_group_block_read_ui8( read_write image2d_t image, int2 byte_coord ); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) uint __ovld __conv intel_sub_group_block_read_ui( const __global uint* p ); uint2 __ovld __conv intel_sub_group_block_read_ui2( const __global uint* p ); uint4 __ovld __conv intel_sub_group_block_read_ui4( const __global uint* p ); uint8 __ovld __conv intel_sub_group_block_read_ui8( const __global uint* p ); void __ovld __conv intel_sub_group_block_write_ui( read_only image2d_t image, int2 byte_coord, uint data ); void __ovld __conv intel_sub_group_block_write_ui2( read_only image2d_t image, int2 byte_coord, uint2 data ); void __ovld __conv intel_sub_group_block_write_ui4( read_only image2d_t image, int2 byte_coord, uint4 data ); void __ovld __conv intel_sub_group_block_write_ui8( read_only image2d_t image, int2 byte_coord, uint8 data ); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv intel_sub_group_block_write_ui( read_write image2d_t image, int2 byte_coord, uint data ); void __ovld __conv intel_sub_group_block_write_ui2( read_write image2d_t image, int2 byte_coord, uint2 data ); void __ovld __conv intel_sub_group_block_write_ui4( read_write image2d_t image, int2 byte_coord, uint4 data ); void __ovld __conv intel_sub_group_block_write_ui8( read_write image2d_t image, int2 byte_coord, uint8 data ); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv intel_sub_group_block_write_ui( __global uint* p, uint data ); void __ovld __conv intel_sub_group_block_write_ui2( __global uint* p, uint2 data ); void __ovld __conv intel_sub_group_block_write_ui4( __global uint* p, uint4 data ); void __ovld __conv intel_sub_group_block_write_ui8( __global uint* p, uint8 data ); ushort __ovld __conv intel_sub_group_block_read_us( read_only image2d_t image, int2 coord ); ushort2 __ovld __conv intel_sub_group_block_read_us2( read_only image2d_t image, int2 coord ); ushort4 __ovld __conv intel_sub_group_block_read_us4( read_only image2d_t image, int2 coord ); ushort8 __ovld __conv intel_sub_group_block_read_us8( read_only image2d_t image, int2 coord ); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) ushort __ovld __conv intel_sub_group_block_read_us(read_write image2d_t image, int2 coord); ushort2 __ovld __conv intel_sub_group_block_read_us2(read_write image2d_t image, int2 coord); ushort4 __ovld __conv intel_sub_group_block_read_us4(read_write image2d_t image, int2 coord); ushort8 __ovld __conv intel_sub_group_block_read_us8(read_write image2d_t image, int2 coord); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) ushort __ovld __conv intel_sub_group_block_read_us( const __global ushort* p ); ushort2 __ovld __conv intel_sub_group_block_read_us2( const __global ushort* p ); ushort4 __ovld __conv intel_sub_group_block_read_us4( const __global ushort* p ); ushort8 __ovld __conv intel_sub_group_block_read_us8( const __global ushort* p ); void __ovld __conv intel_sub_group_block_write_us(write_only image2d_t image, int2 coord, ushort data); void __ovld __conv intel_sub_group_block_write_us2(write_only image2d_t image, int2 coord, ushort2 data); void __ovld __conv intel_sub_group_block_write_us4(write_only image2d_t image, int2 coord, ushort4 data); void __ovld __conv intel_sub_group_block_write_us8(write_only image2d_t image, int2 coord, ushort8 data); #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv intel_sub_group_block_write_us(read_write image2d_t image, int2 coord, ushort data); void __ovld __conv intel_sub_group_block_write_us2(read_write image2d_t image, int2 coord, ushort2 data); void __ovld __conv intel_sub_group_block_write_us4(read_write image2d_t image, int2 coord, ushort4 data); void __ovld __conv intel_sub_group_block_write_us8(read_write image2d_t image, int2 coord, ushort8 data); #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) void __ovld __conv intel_sub_group_block_write_us( __global ushort* p, ushort data ); void __ovld __conv intel_sub_group_block_write_us2( __global ushort* p, ushort2 data ); void __ovld __conv intel_sub_group_block_write_us4( __global ushort* p, ushort4 data ); void __ovld __conv intel_sub_group_block_write_us8( __global ushort* p, ushort8 data ); #endif // cl_intel_subgroups_short #ifdef cl_intel_device_side_avc_motion_estimation #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : begin // MCE built-in functions uchar __ovld intel_sub_group_avc_mce_get_default_inter_base_multi_reference_penalty( uchar slice_type, uchar qp); ulong __ovld intel_sub_group_avc_mce_get_default_inter_shape_penalty( uchar slice_type, uchar qp); uchar __ovld intel_sub_group_avc_mce_get_default_inter_direction_penalty( uchar slice_type, uchar qp); uint __ovld intel_sub_group_avc_mce_get_default_intra_luma_shape_penalty( uchar slice_type, uchar qp); uint2 __ovld intel_sub_group_avc_mce_get_default_inter_motion_vector_cost_table( uchar slice_type, uchar qp); uchar __ovld intel_sub_group_avc_mce_get_default_intra_luma_mode_penalty( uchar slice_type, uchar qp); uint2 __ovld intel_sub_group_avc_mce_get_default_high_penalty_cost_table(); uint2 __ovld intel_sub_group_avc_mce_get_default_medium_penalty_cost_table(); uint2 __ovld intel_sub_group_avc_mce_get_default_low_penalty_cost_table(); uint __ovld intel_sub_group_avc_mce_get_default_non_dc_luma_intra_penalty(); uchar __ovld intel_sub_group_avc_mce_get_default_intra_chroma_mode_base_penalty(); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_inter_base_multi_reference_penalty( uchar reference_base_penalty, intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_inter_shape_penalty( ulong packed_shape_penalty, intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_inter_direction_penalty( uchar direction_cost, intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_motion_vector_cost_function( ulong packed_cost_center_delta, uint2 packed_cost_table, uchar cost_precision, intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_ac_only_haar( intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_source_interlaced_field_polarity( uchar src_field_polarity, intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_single_reference_interlaced_field_polarity( uchar ref_field_polarity, intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_mce_set_dual_reference_interlaced_field_polarities( uchar fwd_ref_field_polarity, uchar bwd_ref_field_polarity, intel_sub_group_avc_mce_payload_t payload); ulong __ovld intel_sub_group_avc_mce_get_motion_vectors( intel_sub_group_avc_mce_result_t result); ushort __ovld intel_sub_group_avc_mce_get_inter_distortions( intel_sub_group_avc_mce_result_t result); ushort __ovld intel_sub_group_avc_mce_get_best_inter_distortion( intel_sub_group_avc_mce_result_t result); uchar __ovld intel_sub_group_avc_mce_get_inter_major_shape( intel_sub_group_avc_mce_result_t result); uchar __ovld intel_sub_group_avc_mce_get_inter_minor_shapes( intel_sub_group_avc_mce_result_t result); uchar __ovld intel_sub_group_avc_mce_get_inter_directions( intel_sub_group_avc_mce_result_t result); uchar __ovld intel_sub_group_avc_mce_get_inter_motion_vector_count( intel_sub_group_avc_mce_result_t result); uint __ovld intel_sub_group_avc_mce_get_inter_reference_ids( intel_sub_group_avc_mce_result_t result); uchar __ovld intel_sub_group_avc_mce_get_inter_reference_interlaced_field_polarities( uint packed_reference_ids, uint packed_reference_parameter_field_polarities, intel_sub_group_avc_mce_result_t result); // IME built-in functions intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_initialize( ushort2 src_coord, uchar partition_mask, uchar sad_adjustment); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_single_reference( short2 ref_offset, uchar search_window_config, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_dual_reference( short2 fwd_ref_offset, short2 bwd_ref_offset, uchar search_window_config, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_max_motion_vector_count( uchar max_motion_vector_count, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_unidirectional_mix_disable( intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_early_search_termination_threshold( uchar threshold, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_weighted_sad( uint packed_sad_weights, intel_sub_group_avc_ime_payload_t payload); __attribute__((deprecated("If you use the latest Intel driver, please use " "intel_sub_group_avc_ime_ref_window_size instead", "intel_sub_group_avc_ime_ref_window_size"))) ushort2 __ovld intel_sub_group_ime_ref_window_size(uchar search_window_config, char dual_ref); ushort2 __ovld intel_sub_group_avc_ime_ref_window_size( uchar search_window_config, char dual_ref); short2 __ovld intel_sub_group_avc_ime_adjust_ref_offset( short2 ref_offset, ushort2 src_coord, ushort2 ref_window_size, ushort2 image_size); intel_sub_group_avc_ime_result_t __ovld intel_sub_group_avc_ime_evaluate_with_single_reference( read_only image2d_t src_image, read_only image2d_t ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_result_t __ovld intel_sub_group_avc_ime_evaluate_with_dual_reference( read_only image2d_t src_image, read_only image2d_t fwd_ref_image, read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_result_single_reference_streamout_t __ovld intel_sub_group_avc_ime_evaluate_with_single_reference_streamout( read_only image2d_t src_image, read_only image2d_t ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_result_dual_reference_streamout_t __ovld intel_sub_group_avc_ime_evaluate_with_dual_reference_streamout( read_only image2d_t src_image, read_only image2d_t fwd_ref_image, read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_result_t __ovld intel_sub_group_avc_ime_evaluate_with_single_reference_streamin( read_only image2d_t src_image, read_only image2d_t ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload, intel_sub_group_avc_ime_single_reference_streamin_t streamin_components); intel_sub_group_avc_ime_result_t __ovld intel_sub_group_avc_ime_evaluate_with_dual_reference_streamin( read_only image2d_t src_image, read_only image2d_t fwd_ref_image, read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload, intel_sub_group_avc_ime_dual_reference_streamin_t streamin_components); intel_sub_group_avc_ime_result_single_reference_streamout_t __ovld intel_sub_group_avc_ime_evaluate_with_single_reference_streaminout( read_only image2d_t src_image, read_only image2d_t ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload, intel_sub_group_avc_ime_single_reference_streamin_t streamin_components); intel_sub_group_avc_ime_result_dual_reference_streamout_t __ovld intel_sub_group_avc_ime_evaluate_with_dual_reference_streaminout( read_only image2d_t src_image, read_only image2d_t fwd_ref_image, read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ime_payload_t payload, intel_sub_group_avc_ime_dual_reference_streamin_t streamin_components); intel_sub_group_avc_ime_single_reference_streamin_t __ovld intel_sub_group_avc_ime_get_single_reference_streamin( intel_sub_group_avc_ime_result_single_reference_streamout_t result); intel_sub_group_avc_ime_dual_reference_streamin_t __ovld intel_sub_group_avc_ime_get_dual_reference_streamin( intel_sub_group_avc_ime_result_dual_reference_streamout_t result); intel_sub_group_avc_ime_result_t __ovld intel_sub_group_avc_ime_strip_single_reference_streamout( intel_sub_group_avc_ime_result_single_reference_streamout_t result); intel_sub_group_avc_ime_result_t __ovld intel_sub_group_avc_ime_strip_dual_reference_streamout( intel_sub_group_avc_ime_result_dual_reference_streamout_t result); uint __ovld intel_sub_group_avc_ime_get_streamout_major_shape_motion_vectors( intel_sub_group_avc_ime_result_single_reference_streamout_t result, uchar major_shape); ushort __ovld intel_sub_group_avc_ime_get_streamout_major_shape_distortions( intel_sub_group_avc_ime_result_single_reference_streamout_t result, uchar major_shape); uchar __ovld intel_sub_group_avc_ime_get_streamout_major_shape_reference_ids( intel_sub_group_avc_ime_result_single_reference_streamout_t result, uchar major_shape); uint __ovld intel_sub_group_avc_ime_get_streamout_major_shape_motion_vectors( intel_sub_group_avc_ime_result_dual_reference_streamout_t result, uchar major_shape, uchar direction); ushort __ovld intel_sub_group_avc_ime_get_streamout_major_shape_distortions( intel_sub_group_avc_ime_result_dual_reference_streamout_t result, uchar major_shape, uchar direction); uchar __ovld intel_sub_group_avc_ime_get_streamout_major_shape_reference_ids( intel_sub_group_avc_ime_result_dual_reference_streamout_t result, uchar major_shape, uchar direction); uchar __ovld intel_sub_group_avc_ime_get_border_reached( uchar image_select, intel_sub_group_avc_ime_result_t result); uchar __ovld intel_sub_group_avc_ime_get_truncated_search_indication( intel_sub_group_avc_ime_result_t result); uchar __ovld intel_sub_group_avc_ime_get_unidirectional_early_search_termination( intel_sub_group_avc_ime_result_t result); uint __ovld intel_sub_group_avc_ime_get_weighting_pattern_minimum_motion_vector( intel_sub_group_avc_ime_result_t result); ushort __ovld intel_sub_group_avc_ime_get_weighting_pattern_minimum_distortion( intel_sub_group_avc_ime_result_t result); // REF built-in functions intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_fme_initialize( ushort2 src_coord, ulong motion_vectors, uchar major_shapes, uchar minor_shapes, uchar directions, uchar pixel_resolution, uchar sad_adjustment); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_bme_initialize( ushort2 src_coord, ulong motion_vectors, uchar major_shapes, uchar minor_shapes, uchar directions, uchar pixel_resolution, uchar bidirectional_weight, uchar sad_adjustment); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_bidirectional_mix_disable( intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_bilinear_filter_enable( intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_ref_result_t __ovld intel_sub_group_avc_ref_evaluate_with_single_reference( read_only image2d_t src_image, read_only image2d_t ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_ref_result_t __ovld intel_sub_group_avc_ref_evaluate_with_dual_reference( read_only image2d_t src_image, read_only image2d_t fwd_ref_image, read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_ref_result_t __ovld intel_sub_group_avc_ref_evaluate_with_multi_reference( read_only image2d_t src_image, uint packed_reference_ids, sampler_t vme_media_sampler, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_ref_result_t __ovld intel_sub_group_avc_ref_evaluate_with_multi_reference( read_only image2d_t src_image, uint packed_reference_ids, uchar packed_reference_field_polarities, sampler_t vme_media_sampler, intel_sub_group_avc_ref_payload_t payload); // SIC built-in functions intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_initialize( ushort2 src_coord); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_configure_skc( uint skip_block_partition_type, uint skip_motion_vector_mask, ulong motion_vectors, uchar bidirectional_weight, uchar skip_sad_adjustment, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_configure_ipe( uchar luma_intra_partition_mask, uchar intra_neighbour_availabilty, uchar left_edge_luma_pixels, uchar upper_left_corner_luma_pixel, uchar upper_edge_luma_pixels, uchar upper_right_edge_luma_pixels, uchar intra_sad_adjustment, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_configure_ipe( uchar luma_intra_partition_mask, uchar intra_neighbour_availabilty, uchar left_edge_luma_pixels, uchar upper_left_corner_luma_pixel, uchar upper_edge_luma_pixels, uchar upper_right_edge_luma_pixels, ushort left_edge_chroma_pixels, ushort upper_left_corner_chroma_pixel, ushort upper_edge_chroma_pixels, uchar intra_sad_adjustment, intel_sub_group_avc_sic_payload_t payload); uint __ovld intel_sub_group_avc_sic_get_motion_vector_mask( uint skip_block_partition_type, uchar direction); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_intra_luma_shape_penalty( uint packed_shape_cost, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_intra_luma_mode_cost_function( uchar luma_mode_penalty, uint luma_packed_neighbor_modes, uint luma_packed_non_dc_penalty, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_intra_chroma_mode_cost_function( uchar chroma_mode_penalty, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_skc_bilinear_filter_enable( intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_skc_forward_transform_enable( ulong packed_sad_coefficients, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_block_based_raw_skip_sad( uchar block_based_skip_type, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_result_t __ovld intel_sub_group_avc_sic_evaluate_ipe( read_only image2d_t src_image, sampler_t vme_media_sampler, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_result_t __ovld intel_sub_group_avc_sic_evaluate_with_single_reference( read_only image2d_t src_image, read_only image2d_t ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_result_t __ovld intel_sub_group_avc_sic_evaluate_with_dual_reference( read_only image2d_t src_image, read_only image2d_t fwd_ref_image, read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_result_t __ovld intel_sub_group_avc_sic_evaluate_with_multi_reference( read_only image2d_t src_image, uint packed_reference_ids, sampler_t vme_media_sampler, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_result_t __ovld intel_sub_group_avc_sic_evaluate_with_multi_reference( read_only image2d_t src_image, uint packed_reference_ids, uchar packed_reference_field_polarities, sampler_t vme_media_sampler, intel_sub_group_avc_sic_payload_t payload); uchar __ovld intel_sub_group_avc_sic_get_ipe_luma_shape( intel_sub_group_avc_sic_result_t result); ushort __ovld intel_sub_group_avc_sic_get_best_ipe_luma_distortion( intel_sub_group_avc_sic_result_t result); ushort __ovld intel_sub_group_avc_sic_get_best_ipe_chroma_distortion( intel_sub_group_avc_sic_result_t result); ulong __ovld intel_sub_group_avc_sic_get_packed_ipe_luma_modes( intel_sub_group_avc_sic_result_t result); uchar __ovld intel_sub_group_avc_sic_get_ipe_chroma_mode( intel_sub_group_avc_sic_result_t result); uint __ovld intel_sub_group_avc_sic_get_packed_skc_luma_count_threshold( intel_sub_group_avc_sic_result_t result); ulong __ovld intel_sub_group_avc_sic_get_packed_skc_luma_sum_threshold( intel_sub_group_avc_sic_result_t result); ushort __ovld intel_sub_group_avc_sic_get_inter_raw_sads( intel_sub_group_avc_sic_result_t result); // Wrappers intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_inter_base_multi_reference_penalty( uchar reference_base_penalty, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_inter_base_multi_reference_penalty( uchar reference_base_penalty, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_inter_base_multi_reference_penalty( uchar reference_base_penalty, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_inter_shape_penalty( ulong packed_shape_cost, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_inter_shape_penalty( ulong packed_shape_cost, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_inter_shape_penalty( ulong packed_shape_cost, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_inter_direction_penalty( uchar direction_cost, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_inter_direction_penalty( uchar direction_cost, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_inter_direction_penalty( uchar direction_cost, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_motion_vector_cost_function( ulong packed_cost_center_delta, uint2 packed_cost_table, uchar cost_precision, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_motion_vector_cost_function( ulong packed_cost_center_delta, uint2 packed_cost_table, uchar cost_precision, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_motion_vector_cost_function( ulong packed_cost_center_delta, uint2 packed_cost_table, uchar cost_precision, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_source_interlaced_field_polarity( uchar src_field_polarity, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_source_interlaced_field_polarity( uchar src_field_polarity, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_source_interlaced_field_polarity( uchar src_field_polarity, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_single_reference_interlaced_field_polarity( uchar ref_field_polarity, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_single_reference_interlaced_field_polarity( uchar ref_field_polarity, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_single_reference_interlaced_field_polarity( uchar ref_field_polarity, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_dual_reference_interlaced_field_polarities( uchar fwd_ref_field_polarity, uchar bwd_ref_field_polarity, intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_dual_reference_interlaced_field_polarities( uchar fwd_ref_field_polarity, uchar bwd_ref_field_polarity, intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_dual_reference_interlaced_field_polarities( uchar fwd_ref_field_polarity, uchar bwd_ref_field_polarity, intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_ime_set_ac_only_haar( intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_ref_set_ac_only_haar( intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_set_ac_only_haar( intel_sub_group_avc_sic_payload_t payload); ulong __ovld intel_sub_group_avc_ime_get_motion_vectors( intel_sub_group_avc_ime_result_t result); ulong __ovld intel_sub_group_avc_ref_get_motion_vectors( intel_sub_group_avc_ref_result_t result); ushort __ovld intel_sub_group_avc_ime_get_inter_distortions( intel_sub_group_avc_ime_result_t result); ushort __ovld intel_sub_group_avc_ref_get_inter_distortions( intel_sub_group_avc_ref_result_t result); ushort __ovld intel_sub_group_avc_sic_get_inter_distortions( intel_sub_group_avc_sic_result_t result); ushort __ovld intel_sub_group_avc_ime_get_best_inter_distortion( intel_sub_group_avc_ime_result_t result); ushort __ovld intel_sub_group_avc_ref_get_best_inter_distortion( intel_sub_group_avc_ref_result_t result); uchar __ovld intel_sub_group_avc_ime_get_inter_major_shape( intel_sub_group_avc_ime_result_t result); uchar __ovld intel_sub_group_avc_ref_get_inter_major_shape( intel_sub_group_avc_ref_result_t result); uchar __ovld intel_sub_group_avc_ime_get_inter_minor_shapes( intel_sub_group_avc_ime_result_t result); uchar __ovld intel_sub_group_avc_ref_get_inter_minor_shapes( intel_sub_group_avc_ref_result_t result); uchar __ovld intel_sub_group_avc_ime_get_inter_directions( intel_sub_group_avc_ime_result_t result); uchar __ovld intel_sub_group_avc_ref_get_inter_directions( intel_sub_group_avc_ref_result_t result); uchar __ovld intel_sub_group_avc_ime_get_inter_motion_vector_count( intel_sub_group_avc_ime_result_t result); uchar __ovld intel_sub_group_avc_ref_get_inter_motion_vector_count( intel_sub_group_avc_ref_result_t result); uint __ovld intel_sub_group_avc_ime_get_inter_reference_ids( intel_sub_group_avc_ime_result_t result); uint __ovld intel_sub_group_avc_ref_get_inter_reference_ids( intel_sub_group_avc_ref_result_t result); uchar __ovld intel_sub_group_avc_ime_get_inter_reference_interlaced_field_polarities( uint packed_reference_ids, uint packed_reference_parameter_field_polarities, intel_sub_group_avc_ime_result_t result); uchar __ovld intel_sub_group_avc_ref_get_inter_reference_interlaced_field_polarities( uint packed_reference_ids, uint packed_reference_parameter_field_polarities, intel_sub_group_avc_ref_result_t result); // Type conversion functions intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_ime_convert_to_mce_payload( intel_sub_group_avc_ime_payload_t payload); intel_sub_group_avc_ime_payload_t __ovld intel_sub_group_avc_mce_convert_to_ime_payload( intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_ref_convert_to_mce_payload( intel_sub_group_avc_ref_payload_t payload); intel_sub_group_avc_ref_payload_t __ovld intel_sub_group_avc_mce_convert_to_ref_payload( intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_payload_t __ovld intel_sub_group_avc_sic_convert_to_mce_payload( intel_sub_group_avc_sic_payload_t payload); intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_mce_convert_to_sic_payload( intel_sub_group_avc_mce_payload_t payload); intel_sub_group_avc_mce_result_t __ovld intel_sub_group_avc_ime_convert_to_mce_result( intel_sub_group_avc_ime_result_t result); intel_sub_group_avc_ime_result_t __ovld intel_sub_group_avc_mce_convert_to_ime_result( intel_sub_group_avc_mce_result_t result); intel_sub_group_avc_mce_result_t __ovld intel_sub_group_avc_ref_convert_to_mce_result( intel_sub_group_avc_ref_result_t result); intel_sub_group_avc_ref_result_t __ovld intel_sub_group_avc_mce_convert_to_ref_result( intel_sub_group_avc_mce_result_t result); intel_sub_group_avc_mce_result_t __ovld intel_sub_group_avc_sic_convert_to_mce_result( intel_sub_group_avc_sic_result_t result); intel_sub_group_avc_sic_result_t __ovld intel_sub_group_avc_mce_convert_to_sic_result( intel_sub_group_avc_mce_result_t result); #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : end #endif // cl_intel_device_side_avc_motion_estimation #ifdef cl_amd_media_ops uint __ovld amd_bitalign(uint a, uint b, uint c); uint2 __ovld amd_bitalign(uint2 a, uint2 b, uint2 c); uint3 __ovld amd_bitalign(uint3 a, uint3 b, uint3 c); uint4 __ovld amd_bitalign(uint4 a, uint4 b, uint4 c); uint8 __ovld amd_bitalign(uint8 a, uint8 b, uint8 c); uint16 __ovld amd_bitalign(uint16 a, uint16 b, uint16 c); uint __ovld amd_bytealign(uint a, uint b, uint c); uint2 __ovld amd_bytealign(uint2 a, uint2 b, uint2 c); uint3 __ovld amd_bytealign(uint3 a, uint3 b, uint3 c); uint4 __ovld amd_bytealign(uint4 a, uint4 b, uint4 c); uint8 __ovld amd_bytealign(uint8 a, uint8 b, uint8 c); uint16 __ovld amd_bytealign(uint16 a, uint16 b, uint16 c); uint __ovld amd_lerp(uint a, uint b, uint c); uint2 __ovld amd_lerp(uint2 a, uint2 b, uint2 c); uint3 __ovld amd_lerp(uint3 a, uint3 b, uint3 c); uint4 __ovld amd_lerp(uint4 a, uint4 b, uint4 c); uint8 __ovld amd_lerp(uint8 a, uint8 b, uint8 c); uint16 __ovld amd_lerp(uint16 a, uint16 b, uint16 c); uint __ovld amd_pack(float4 v); uint __ovld amd_sad4(uint4 x, uint4 y, uint z); uint __ovld amd_sadhi(uint a, uint b, uint c); uint2 __ovld amd_sadhi(uint2 a, uint2 b, uint2 c); uint3 __ovld amd_sadhi(uint3 a, uint3 b, uint3 c); uint4 __ovld amd_sadhi(uint4 a, uint4 b, uint4 c); uint8 __ovld amd_sadhi(uint8 a, uint8 b, uint8 c); uint16 __ovld amd_sadhi(uint16 a, uint16 b, uint16 c); uint __ovld amd_sad(uint a, uint b, uint c); uint2 __ovld amd_sad(uint2 a, uint2 b, uint2 c); uint3 __ovld amd_sad(uint3 a, uint3 b, uint3 c); uint4 __ovld amd_sad(uint4 a, uint4 b, uint4 c); uint8 __ovld amd_sad(uint8 a, uint8 b, uint8 c); uint16 __ovld amd_sad(uint16 a, uint16 b, uint16 c); float __ovld amd_unpack0(uint a); float2 __ovld amd_unpack0(uint2 a); float3 __ovld amd_unpack0(uint3 a); float4 __ovld amd_unpack0(uint4 a); float8 __ovld amd_unpack0(uint8 a); float16 __ovld amd_unpack0(uint16 a); float __ovld amd_unpack1(uint a); float2 __ovld amd_unpack1(uint2 a); float3 __ovld amd_unpack1(uint3 a); float4 __ovld amd_unpack1(uint4 a); float8 __ovld amd_unpack1(uint8 a); float16 __ovld amd_unpack1(uint16 a); float __ovld amd_unpack2(uint a); float2 __ovld amd_unpack2(uint2 a); float3 __ovld amd_unpack2(uint3 a); float4 __ovld amd_unpack2(uint4 a); float8 __ovld amd_unpack2(uint8 a); float16 __ovld amd_unpack2(uint16 a); float __ovld amd_unpack3(uint a); float2 __ovld amd_unpack3(uint2 a); float3 __ovld amd_unpack3(uint3 a); float4 __ovld amd_unpack3(uint4 a); float8 __ovld amd_unpack3(uint8 a); float16 __ovld amd_unpack3(uint16 a); #endif // cl_amd_media_ops #ifdef cl_amd_media_ops2 int __ovld amd_bfe(int src0, uint src1, uint src2); int2 __ovld amd_bfe(int2 src0, uint2 src1, uint2 src2); int3 __ovld amd_bfe(int3 src0, uint3 src1, uint3 src2); int4 __ovld amd_bfe(int4 src0, uint4 src1, uint4 src2); int8 __ovld amd_bfe(int8 src0, uint8 src1, uint8 src2); int16 __ovld amd_bfe(int16 src0, uint16 src1, uint16 src2); uint __ovld amd_bfe(uint src0, uint src1, uint src2); uint2 __ovld amd_bfe(uint2 src0, uint2 src1, uint2 src2); uint3 __ovld amd_bfe(uint3 src0, uint3 src1, uint3 src2); uint4 __ovld amd_bfe(uint4 src0, uint4 src1, uint4 src2); uint8 __ovld amd_bfe(uint8 src0, uint8 src1, uint8 src2); uint16 __ovld amd_bfe(uint16 src0, uint16 src1, uint16 src2); uint __ovld amd_bfm(uint src0, uint src1); uint2 __ovld amd_bfm(uint2 src0, uint2 src1); uint3 __ovld amd_bfm(uint3 src0, uint3 src1); uint4 __ovld amd_bfm(uint4 src0, uint4 src1); uint8 __ovld amd_bfm(uint8 src0, uint8 src1); uint16 __ovld amd_bfm(uint16 src0, uint16 src1); float __ovld amd_max3(float src0, float src1, float src2); float2 __ovld amd_max3(float2 src0, float2 src1, float2 src2); float3 __ovld amd_max3(float3 src0, float3 src1, float3 src2); float4 __ovld amd_max3(float4 src0, float4 src1, float4 src2); float8 __ovld amd_max3(float8 src0, float8 src1, float8 src2); float16 __ovld amd_max3(float16 src0, float16 src1, float16 src2); int __ovld amd_max3(int src0, int src1, int src2); int2 __ovld amd_max3(int2 src0, int2 src1, int2 src2); int3 __ovld amd_max3(int3 src0, int3 src1, int3 src2); int4 __ovld amd_max3(int4 src0, int4 src1, int4 src2); int8 __ovld amd_max3(int8 src0, int8 src1, int8 src2); int16 __ovld amd_max3(int16 src0, int16 src1, int16 src2); uint __ovld amd_max3(uint src0, uint src1, uint src2); uint2 __ovld amd_max3(uint2 src0, uint2 src1, uint2 src2); uint3 __ovld amd_max3(uint3 src0, uint3 src1, uint3 src2); uint4 __ovld amd_max3(uint4 src0, uint4 src1, uint4 src2); uint8 __ovld amd_max3(uint8 src0, uint8 src1, uint8 src2); uint16 __ovld amd_max3(uint16 src0, uint16 src1, uint16 src2); float __ovld amd_median3(float src0, float src1, float src2); float2 __ovld amd_median3(float2 src0, float2 src1, float2 src2); float3 __ovld amd_median3(float3 src0, float3 src1, float3 src2); float4 __ovld amd_median3(float4 src0, float4 src1, float4 src2); float8 __ovld amd_median3(float8 src0, float8 src1, float8 src2); float16 __ovld amd_median3(float16 src0, float16 src1, float16 src2); int __ovld amd_median3(int src0, int src1, int src2); int2 __ovld amd_median3(int2 src0, int2 src1, int2 src2); int3 __ovld amd_median3(int3 src0, int3 src1, int3 src2); int4 __ovld amd_median3(int4 src0, int4 src1, int4 src2); int8 __ovld amd_median3(int8 src0, int8 src1, int8 src2); int16 __ovld amd_median3(int16 src0, int16 src1, int16 src2); uint __ovld amd_median3(uint src0, uint src1, uint src2); uint2 __ovld amd_median3(uint2 src0, uint2 src1, uint2 src2); uint3 __ovld amd_median3(uint3 src0, uint3 src1, uint3 src2); uint4 __ovld amd_median3(uint4 src0, uint4 src1, uint4 src2); uint8 __ovld amd_median3(uint8 src0, uint8 src1, uint8 src2); uint16 __ovld amd_median3(uint16 src0, uint16 src1, uint16 src2); float __ovld amd_min3(float src0, float src1, float src); float2 __ovld amd_min3(float2 src0, float2 src1, float2 src); float3 __ovld amd_min3(float3 src0, float3 src1, float3 src); float4 __ovld amd_min3(float4 src0, float4 src1, float4 src); float8 __ovld amd_min3(float8 src0, float8 src1, float8 src); float16 __ovld amd_min3(float16 src0, float16 src1, float16 src); int __ovld amd_min3(int src0, int src1, int src2); int2 __ovld amd_min3(int2 src0, int2 src1, int2 src2); int3 __ovld amd_min3(int3 src0, int3 src1, int3 src2); int4 __ovld amd_min3(int4 src0, int4 src1, int4 src2); int8 __ovld amd_min3(int8 src0, int8 src1, int8 src2); int16 __ovld amd_min3(int16 src0, int16 src1, int16 src2); uint __ovld amd_min3(uint src0, uint src1, uint src2); uint2 __ovld amd_min3(uint2 src0, uint2 src1, uint2 src2); uint3 __ovld amd_min3(uint3 src0, uint3 src1, uint3 src2); uint4 __ovld amd_min3(uint4 src0, uint4 src1, uint4 src2); uint8 __ovld amd_min3(uint8 src0, uint8 src1, uint8 src2); uint16 __ovld amd_min3(uint16 src0, uint16 src1, uint16 src2); ulong __ovld amd_mqsad(ulong src0, uint src1, ulong src2); ulong2 __ovld amd_mqsad(ulong2 src0, uint2 src1, ulong2 src2); ulong3 __ovld amd_mqsad(ulong3 src0, uint3 src1, ulong3 src2); ulong4 __ovld amd_mqsad(ulong4 src0, uint4 src1, ulong4 src2); ulong8 __ovld amd_mqsad(ulong8 src0, uint8 src1, ulong8 src2); ulong16 __ovld amd_mqsad(ulong16 src0, uint16 src1, ulong16 src2); ulong __ovld amd_qsad(ulong src0, uint src1, ulong src2); ulong2 __ovld amd_qsad(ulong2 src0, uint2 src1, ulong2 src2); ulong3 __ovld amd_qsad(ulong3 src0, uint3 src1, ulong3 src2); ulong4 __ovld amd_qsad(ulong4 src0, uint4 src1, ulong4 src2); ulong8 __ovld amd_qsad(ulong8 src0, uint8 src1, ulong8 src2); ulong16 __ovld amd_qsad(ulong16 src0, uint16 src1, ulong16 src2); uint __ovld amd_msad(uint src0, uint src1, uint src2); uint2 __ovld amd_msad(uint2 src0, uint2 src1, uint2 src2); uint3 __ovld amd_msad(uint3 src0, uint3 src1, uint3 src2); uint4 __ovld amd_msad(uint4 src0, uint4 src1, uint4 src2); uint8 __ovld amd_msad(uint8 src0, uint8 src1, uint8 src2); uint16 __ovld amd_msad(uint16 src0, uint16 src1, uint16 src2); uint __ovld amd_sadd(uint src0, uint src1, uint src2); uint2 __ovld amd_sadd(uint2 src0, uint2 src1, uint2 src2); uint3 __ovld amd_sadd(uint3 src0, uint3 src1, uint3 src2); uint4 __ovld amd_sadd(uint4 src0, uint4 src1, uint4 src2); uint8 __ovld amd_sadd(uint8 src0, uint8 src1, uint8 src2); uint16 __ovld amd_sadd(uint16 src0, uint16 src1, uint16 src2); uint __ovld amd_sadw(uint src0, uint src1, uint src2); uint2 __ovld amd_sadw(uint2 src0, uint2 src1, uint2 src2); uint3 __ovld amd_sadw(uint3 src0, uint3 src1, uint3 src2); uint4 __ovld amd_sadw(uint4 src0, uint4 src1, uint4 src2); uint8 __ovld amd_sadw(uint8 src0, uint8 src1, uint8 src2); uint16 __ovld amd_sadw(uint16 src0, uint16 src1, uint16 src2); #endif // cl_amd_media_ops2 #if defined(cl_arm_integer_dot_product_int8) #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : begin uint __ovld arm_dot(uchar4 a, uchar4 b); int __ovld arm_dot(char4 a, char4 b); #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : end #endif // defined(cl_arm_integer_dot_product_int8) #if defined(cl_arm_integer_dot_product_accumulate_int8) #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : begin uint __ovld arm_dot_acc(uchar4 a, uchar4 b, uint c); int __ovld arm_dot_acc(char4 a, char4 b, int c); #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : end #endif // defined(cl_arm_integer_dot_product_accumulate_int8) #if defined(cl_arm_integer_dot_product_accumulate_int16) #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : begin uint __ovld arm_dot_acc(ushort2 a, ushort2 b, uint c); int __ovld arm_dot_acc(short2 a, short2 b, int c); #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : end #endif // defined(cl_arm_integer_dot_product_accumulate_int16) #if defined(cl_arm_integer_dot_product_accumulate_saturate_int8) #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : begin uint __ovld arm_dot_acc_sat(uchar4 a, uchar4 b, uint c); int __ovld arm_dot_acc_sat(char4 a, char4 b, int c); #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : end #endif // defined(cl_arm_integer_dot_product_accumulate_saturate_int8) // Disable any extensions we may have enabled previously. #pragma OPENCL EXTENSION all : disable #undef __cnfn #undef __ovld #endif //_OPENCL_H_ Index: vendor/clang/dist-release_90/lib/Sema/SemaDeclCXX.cpp =================================================================== --- vendor/clang/dist-release_90/lib/Sema/SemaDeclCXX.cpp (revision 351710) +++ vendor/clang/dist-release_90/lib/Sema/SemaDeclCXX.cpp (revision 351711) @@ -1,15753 +1,15754 @@ //===------ SemaDeclCXX.cpp - Semantic Analysis for C++ Declarations ------===// // // 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 // //===----------------------------------------------------------------------===// // // This file implements semantic analysis for C++ declarations. // //===----------------------------------------------------------------------===// #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" #include "clang/AST/ASTLambda.h" #include "clang/AST/ASTMutationListener.h" #include "clang/AST/CXXInheritance.h" #include "clang/AST/CharUnits.h" #include "clang/AST/ComparisonCategories.h" #include "clang/AST/EvaluatedExprVisitor.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/StmtVisitor.h" #include "clang/AST/TypeLoc.h" #include "clang/AST/TypeOrdering.h" #include "clang/Basic/PartialDiagnostic.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/LiteralSupport.h" #include "clang/Lex/Preprocessor.h" #include "clang/Sema/CXXFieldCollector.h" #include "clang/Sema/DeclSpec.h" #include "clang/Sema/Initialization.h" #include "clang/Sema/Lookup.h" #include "clang/Sema/ParsedTemplate.h" #include "clang/Sema/Scope.h" #include "clang/Sema/ScopeInfo.h" #include "clang/Sema/SemaInternal.h" #include "clang/Sema/Template.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" #include #include using namespace clang; //===----------------------------------------------------------------------===// // CheckDefaultArgumentVisitor //===----------------------------------------------------------------------===// namespace { /// CheckDefaultArgumentVisitor - C++ [dcl.fct.default] Traverses /// the default argument of a parameter to determine whether it /// contains any ill-formed subexpressions. For example, this will /// diagnose the use of local variables or parameters within the /// default argument expression. class CheckDefaultArgumentVisitor : public StmtVisitor { Expr *DefaultArg; Sema *S; public: CheckDefaultArgumentVisitor(Expr *defarg, Sema *s) : DefaultArg(defarg), S(s) {} bool VisitExpr(Expr *Node); bool VisitDeclRefExpr(DeclRefExpr *DRE); bool VisitCXXThisExpr(CXXThisExpr *ThisE); bool VisitLambdaExpr(LambdaExpr *Lambda); bool VisitPseudoObjectExpr(PseudoObjectExpr *POE); }; /// VisitExpr - Visit all of the children of this expression. bool CheckDefaultArgumentVisitor::VisitExpr(Expr *Node) { bool IsInvalid = false; for (Stmt *SubStmt : Node->children()) IsInvalid |= Visit(SubStmt); return IsInvalid; } /// VisitDeclRefExpr - Visit a reference to a declaration, to /// determine whether this declaration can be used in the default /// argument expression. bool CheckDefaultArgumentVisitor::VisitDeclRefExpr(DeclRefExpr *DRE) { NamedDecl *Decl = DRE->getDecl(); if (ParmVarDecl *Param = dyn_cast(Decl)) { // C++ [dcl.fct.default]p9 // Default arguments are evaluated each time the function is // called. The order of evaluation of function arguments is // unspecified. Consequently, parameters of a function shall not // be used in default argument expressions, even if they are not // evaluated. Parameters of a function declared before a default // argument expression are in scope and can hide namespace and // class member names. return S->Diag(DRE->getBeginLoc(), diag::err_param_default_argument_references_param) << Param->getDeclName() << DefaultArg->getSourceRange(); } else if (VarDecl *VDecl = dyn_cast(Decl)) { // C++ [dcl.fct.default]p7 // Local variables shall not be used in default argument // expressions. if (VDecl->isLocalVarDecl()) return S->Diag(DRE->getBeginLoc(), diag::err_param_default_argument_references_local) << VDecl->getDeclName() << DefaultArg->getSourceRange(); } return false; } /// VisitCXXThisExpr - Visit a C++ "this" expression. bool CheckDefaultArgumentVisitor::VisitCXXThisExpr(CXXThisExpr *ThisE) { // C++ [dcl.fct.default]p8: // The keyword this shall not be used in a default argument of a // member function. return S->Diag(ThisE->getBeginLoc(), diag::err_param_default_argument_references_this) << ThisE->getSourceRange(); } bool CheckDefaultArgumentVisitor::VisitPseudoObjectExpr(PseudoObjectExpr *POE) { bool Invalid = false; for (PseudoObjectExpr::semantics_iterator i = POE->semantics_begin(), e = POE->semantics_end(); i != e; ++i) { Expr *E = *i; // Look through bindings. if (OpaqueValueExpr *OVE = dyn_cast(E)) { E = OVE->getSourceExpr(); assert(E && "pseudo-object binding without source expression?"); } Invalid |= Visit(E); } return Invalid; } bool CheckDefaultArgumentVisitor::VisitLambdaExpr(LambdaExpr *Lambda) { // C++11 [expr.lambda.prim]p13: // A lambda-expression appearing in a default argument shall not // implicitly or explicitly capture any entity. if (Lambda->capture_begin() == Lambda->capture_end()) return false; return S->Diag(Lambda->getBeginLoc(), diag::err_lambda_capture_default_arg); } } void Sema::ImplicitExceptionSpecification::CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method) { // If we have an MSAny spec already, don't bother. if (!Method || ComputedEST == EST_MSAny) return; const FunctionProtoType *Proto = Method->getType()->getAs(); Proto = Self->ResolveExceptionSpec(CallLoc, Proto); if (!Proto) return; ExceptionSpecificationType EST = Proto->getExceptionSpecType(); // If we have a throw-all spec at this point, ignore the function. if (ComputedEST == EST_None) return; if (EST == EST_None && Method->hasAttr()) EST = EST_BasicNoexcept; switch (EST) { case EST_Unparsed: case EST_Uninstantiated: case EST_Unevaluated: llvm_unreachable("should not see unresolved exception specs here"); // If this function can throw any exceptions, make a note of that. case EST_MSAny: case EST_None: // FIXME: Whichever we see last of MSAny and None determines our result. // We should make a consistent, order-independent choice here. ClearExceptions(); ComputedEST = EST; return; case EST_NoexceptFalse: ClearExceptions(); ComputedEST = EST_None; return; // FIXME: If the call to this decl is using any of its default arguments, we // need to search them for potentially-throwing calls. // If this function has a basic noexcept, it doesn't affect the outcome. case EST_BasicNoexcept: case EST_NoexceptTrue: case EST_NoThrow: return; // If we're still at noexcept(true) and there's a throw() callee, // change to that specification. case EST_DynamicNone: if (ComputedEST == EST_BasicNoexcept) ComputedEST = EST_DynamicNone; return; case EST_DependentNoexcept: llvm_unreachable( "should not generate implicit declarations for dependent cases"); case EST_Dynamic: break; } assert(EST == EST_Dynamic && "EST case not considered earlier."); assert(ComputedEST != EST_None && "Shouldn't collect exceptions when throw-all is guaranteed."); ComputedEST = EST_Dynamic; // Record the exceptions in this function's exception specification. for (const auto &E : Proto->exceptions()) if (ExceptionsSeen.insert(Self->Context.getCanonicalType(E)).second) Exceptions.push_back(E); } void Sema::ImplicitExceptionSpecification::CalledExpr(Expr *E) { if (!E || ComputedEST == EST_MSAny) return; // FIXME: // // C++0x [except.spec]p14: // [An] implicit exception-specification specifies the type-id T if and // only if T is allowed by the exception-specification of a function directly // invoked by f's implicit definition; f shall allow all exceptions if any // function it directly invokes allows all exceptions, and f shall allow no // exceptions if every function it directly invokes allows no exceptions. // // Note in particular that if an implicit exception-specification is generated // for a function containing a throw-expression, that specification can still // be noexcept(true). // // Note also that 'directly invoked' is not defined in the standard, and there // is no indication that we should only consider potentially-evaluated calls. // // Ultimately we should implement the intent of the standard: the exception // specification should be the set of exceptions which can be thrown by the // implicit definition. For now, we assume that any non-nothrow expression can // throw any exception. if (Self->canThrow(E)) ComputedEST = EST_None; } bool Sema::SetParamDefaultArgument(ParmVarDecl *Param, Expr *Arg, SourceLocation EqualLoc) { if (RequireCompleteType(Param->getLocation(), Param->getType(), diag::err_typecheck_decl_incomplete_type)) { Param->setInvalidDecl(); return true; } // C++ [dcl.fct.default]p5 // A default argument expression is implicitly converted (clause // 4) to the parameter type. The default argument expression has // the same semantic constraints as the initializer expression in // a declaration of a variable of the parameter type, using the // copy-initialization semantics (8.5). InitializedEntity Entity = InitializedEntity::InitializeParameter(Context, Param); InitializationKind Kind = InitializationKind::CreateCopy(Param->getLocation(), EqualLoc); InitializationSequence InitSeq(*this, Entity, Kind, Arg); ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Arg); if (Result.isInvalid()) return true; Arg = Result.getAs(); CheckCompletedExpr(Arg, EqualLoc); Arg = MaybeCreateExprWithCleanups(Arg); // Okay: add the default argument to the parameter Param->setDefaultArg(Arg); // We have already instantiated this parameter; provide each of the // instantiations with the uninstantiated default argument. UnparsedDefaultArgInstantiationsMap::iterator InstPos = UnparsedDefaultArgInstantiations.find(Param); if (InstPos != UnparsedDefaultArgInstantiations.end()) { for (unsigned I = 0, N = InstPos->second.size(); I != N; ++I) InstPos->second[I]->setUninstantiatedDefaultArg(Arg); // We're done tracking this parameter's instantiations. UnparsedDefaultArgInstantiations.erase(InstPos); } return false; } /// ActOnParamDefaultArgument - Check whether the default argument /// provided for a function parameter is well-formed. If so, attach it /// to the parameter declaration. void Sema::ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *DefaultArg) { if (!param || !DefaultArg) return; ParmVarDecl *Param = cast(param); UnparsedDefaultArgLocs.erase(Param); // Default arguments are only permitted in C++ if (!getLangOpts().CPlusPlus) { Diag(EqualLoc, diag::err_param_default_argument) << DefaultArg->getSourceRange(); Param->setInvalidDecl(); return; } // Check for unexpanded parameter packs. if (DiagnoseUnexpandedParameterPack(DefaultArg, UPPC_DefaultArgument)) { Param->setInvalidDecl(); return; } // C++11 [dcl.fct.default]p3 // A default argument expression [...] shall not be specified for a // parameter pack. if (Param->isParameterPack()) { Diag(EqualLoc, diag::err_param_default_argument_on_parameter_pack) << DefaultArg->getSourceRange(); return; } // Check that the default argument is well-formed CheckDefaultArgumentVisitor DefaultArgChecker(DefaultArg, this); if (DefaultArgChecker.Visit(DefaultArg)) { Param->setInvalidDecl(); return; } SetParamDefaultArgument(Param, DefaultArg, EqualLoc); } /// ActOnParamUnparsedDefaultArgument - We've seen a default /// argument for a function parameter, but we can't parse it yet /// because we're inside a class definition. Note that this default /// argument will be parsed later. void Sema::ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc) { if (!param) return; ParmVarDecl *Param = cast(param); Param->setUnparsedDefaultArg(); UnparsedDefaultArgLocs[Param] = ArgLoc; } /// ActOnParamDefaultArgumentError - Parsing or semantic analysis of /// the default argument for the parameter param failed. void Sema::ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc) { if (!param) return; ParmVarDecl *Param = cast(param); Param->setInvalidDecl(); UnparsedDefaultArgLocs.erase(Param); Param->setDefaultArg(new(Context) OpaqueValueExpr(EqualLoc, Param->getType().getNonReferenceType(), VK_RValue)); } /// CheckExtraCXXDefaultArguments - Check for any extra default /// arguments in the declarator, which is not a function declaration /// or definition and therefore is not permitted to have default /// arguments. This routine should be invoked for every declarator /// that is not a function declaration or definition. void Sema::CheckExtraCXXDefaultArguments(Declarator &D) { // C++ [dcl.fct.default]p3 // A default argument expression shall be specified only in the // parameter-declaration-clause of a function declaration or in a // template-parameter (14.1). It shall not be specified for a // parameter pack. If it is specified in a // parameter-declaration-clause, it shall not occur within a // declarator or abstract-declarator of a parameter-declaration. bool MightBeFunction = D.isFunctionDeclarationContext(); for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { DeclaratorChunk &chunk = D.getTypeObject(i); if (chunk.Kind == DeclaratorChunk::Function) { if (MightBeFunction) { // This is a function declaration. It can have default arguments, but // keep looking in case its return type is a function type with default // arguments. MightBeFunction = false; continue; } for (unsigned argIdx = 0, e = chunk.Fun.NumParams; argIdx != e; ++argIdx) { ParmVarDecl *Param = cast(chunk.Fun.Params[argIdx].Param); if (Param->hasUnparsedDefaultArg()) { std::unique_ptr Toks = std::move(chunk.Fun.Params[argIdx].DefaultArgTokens); SourceRange SR; if (Toks->size() > 1) SR = SourceRange((*Toks)[1].getLocation(), Toks->back().getLocation()); else SR = UnparsedDefaultArgLocs[Param]; Diag(Param->getLocation(), diag::err_param_default_argument_nonfunc) << SR; } else if (Param->getDefaultArg()) { Diag(Param->getLocation(), diag::err_param_default_argument_nonfunc) << Param->getDefaultArg()->getSourceRange(); Param->setDefaultArg(nullptr); } } } else if (chunk.Kind != DeclaratorChunk::Paren) { MightBeFunction = false; } } } static bool functionDeclHasDefaultArgument(const FunctionDecl *FD) { for (unsigned NumParams = FD->getNumParams(); NumParams > 0; --NumParams) { const ParmVarDecl *PVD = FD->getParamDecl(NumParams-1); if (!PVD->hasDefaultArg()) return false; if (!PVD->hasInheritedDefaultArg()) return true; } return false; } /// MergeCXXFunctionDecl - Merge two declarations of the same C++ /// function, once we already know that they have the same /// type. Subroutine of MergeFunctionDecl. Returns true if there was an /// error, false otherwise. bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S) { bool Invalid = false; // The declaration context corresponding to the scope is the semantic // parent, unless this is a local function declaration, in which case // it is that surrounding function. DeclContext *ScopeDC = New->isLocalExternDecl() ? New->getLexicalDeclContext() : New->getDeclContext(); // Find the previous declaration for the purpose of default arguments. FunctionDecl *PrevForDefaultArgs = Old; for (/**/; PrevForDefaultArgs; // Don't bother looking back past the latest decl if this is a local // extern declaration; nothing else could work. PrevForDefaultArgs = New->isLocalExternDecl() ? nullptr : PrevForDefaultArgs->getPreviousDecl()) { // Ignore hidden declarations. if (!LookupResult::isVisible(*this, PrevForDefaultArgs)) continue; if (S && !isDeclInScope(PrevForDefaultArgs, ScopeDC, S) && !New->isCXXClassMember()) { // Ignore default arguments of old decl if they are not in // the same scope and this is not an out-of-line definition of // a member function. continue; } if (PrevForDefaultArgs->isLocalExternDecl() != New->isLocalExternDecl()) { // If only one of these is a local function declaration, then they are // declared in different scopes, even though isDeclInScope may think // they're in the same scope. (If both are local, the scope check is // sufficient, and if neither is local, then they are in the same scope.) continue; } // We found the right previous declaration. break; } // C++ [dcl.fct.default]p4: // For non-template functions, default arguments can be added in // later declarations of a function in the same // scope. Declarations in different scopes have completely // distinct sets of default arguments. That is, declarations in // inner scopes do not acquire default arguments from // declarations in outer scopes, and vice versa. In a given // function declaration, all parameters subsequent to a // parameter with a default argument shall have default // arguments supplied in this or previous declarations. A // default argument shall not be redefined by a later // declaration (not even to the same value). // // C++ [dcl.fct.default]p6: // Except for member functions of class templates, the default arguments // in a member function definition that appears outside of the class // definition are added to the set of default arguments provided by the // member function declaration in the class definition. for (unsigned p = 0, NumParams = PrevForDefaultArgs ? PrevForDefaultArgs->getNumParams() : 0; p < NumParams; ++p) { ParmVarDecl *OldParam = PrevForDefaultArgs->getParamDecl(p); ParmVarDecl *NewParam = New->getParamDecl(p); bool OldParamHasDfl = OldParam ? OldParam->hasDefaultArg() : false; bool NewParamHasDfl = NewParam->hasDefaultArg(); if (OldParamHasDfl && NewParamHasDfl) { unsigned DiagDefaultParamID = diag::err_param_default_argument_redefinition; // MSVC accepts that default parameters be redefined for member functions // of template class. The new default parameter's value is ignored. Invalid = true; if (getLangOpts().MicrosoftExt) { CXXMethodDecl *MD = dyn_cast(New); if (MD && MD->getParent()->getDescribedClassTemplate()) { // Merge the old default argument into the new parameter. NewParam->setHasInheritedDefaultArg(); if (OldParam->hasUninstantiatedDefaultArg()) NewParam->setUninstantiatedDefaultArg( OldParam->getUninstantiatedDefaultArg()); else NewParam->setDefaultArg(OldParam->getInit()); DiagDefaultParamID = diag::ext_param_default_argument_redefinition; Invalid = false; } } // FIXME: If we knew where the '=' was, we could easily provide a fix-it // hint here. Alternatively, we could walk the type-source information // for NewParam to find the last source location in the type... but it // isn't worth the effort right now. This is the kind of test case that // is hard to get right: // int f(int); // void g(int (*fp)(int) = f); // void g(int (*fp)(int) = &f); Diag(NewParam->getLocation(), DiagDefaultParamID) << NewParam->getDefaultArgRange(); // Look for the function declaration where the default argument was // actually written, which may be a declaration prior to Old. for (auto Older = PrevForDefaultArgs; OldParam->hasInheritedDefaultArg(); /**/) { Older = Older->getPreviousDecl(); OldParam = Older->getParamDecl(p); } Diag(OldParam->getLocation(), diag::note_previous_definition) << OldParam->getDefaultArgRange(); } else if (OldParamHasDfl) { // Merge the old default argument into the new parameter unless the new // function is a friend declaration in a template class. In the latter // case the default arguments will be inherited when the friend // declaration will be instantiated. if (New->getFriendObjectKind() == Decl::FOK_None || !New->getLexicalDeclContext()->isDependentContext()) { // It's important to use getInit() here; getDefaultArg() // strips off any top-level ExprWithCleanups. NewParam->setHasInheritedDefaultArg(); if (OldParam->hasUnparsedDefaultArg()) NewParam->setUnparsedDefaultArg(); else if (OldParam->hasUninstantiatedDefaultArg()) NewParam->setUninstantiatedDefaultArg( OldParam->getUninstantiatedDefaultArg()); else NewParam->setDefaultArg(OldParam->getInit()); } } else if (NewParamHasDfl) { if (New->getDescribedFunctionTemplate()) { // Paragraph 4, quoted above, only applies to non-template functions. Diag(NewParam->getLocation(), diag::err_param_default_argument_template_redecl) << NewParam->getDefaultArgRange(); Diag(PrevForDefaultArgs->getLocation(), diag::note_template_prev_declaration) << false; } else if (New->getTemplateSpecializationKind() != TSK_ImplicitInstantiation && New->getTemplateSpecializationKind() != TSK_Undeclared) { // C++ [temp.expr.spec]p21: // Default function arguments shall not be specified in a declaration // or a definition for one of the following explicit specializations: // - the explicit specialization of a function template; // - the explicit specialization of a member function template; // - the explicit specialization of a member function of a class // template where the class template specialization to which the // member function specialization belongs is implicitly // instantiated. Diag(NewParam->getLocation(), diag::err_template_spec_default_arg) << (New->getTemplateSpecializationKind() ==TSK_ExplicitSpecialization) << New->getDeclName() << NewParam->getDefaultArgRange(); } else if (New->getDeclContext()->isDependentContext()) { // C++ [dcl.fct.default]p6 (DR217): // Default arguments for a member function of a class template shall // be specified on the initial declaration of the member function // within the class template. // // Reading the tea leaves a bit in DR217 and its reference to DR205 // leads me to the conclusion that one cannot add default function // arguments for an out-of-line definition of a member function of a // dependent type. int WhichKind = 2; if (CXXRecordDecl *Record = dyn_cast(New->getDeclContext())) { if (Record->getDescribedClassTemplate()) WhichKind = 0; else if (isa(Record)) WhichKind = 1; else WhichKind = 2; } Diag(NewParam->getLocation(), diag::err_param_default_argument_member_template_redecl) << WhichKind << NewParam->getDefaultArgRange(); } } } // DR1344: If a default argument is added outside a class definition and that // default argument makes the function a special member function, the program // is ill-formed. This can only happen for constructors. if (isa(New) && New->getMinRequiredArguments() < Old->getMinRequiredArguments()) { CXXSpecialMember NewSM = getSpecialMember(cast(New)), OldSM = getSpecialMember(cast(Old)); if (NewSM != OldSM) { ParmVarDecl *NewParam = New->getParamDecl(New->getMinRequiredArguments()); assert(NewParam->hasDefaultArg()); Diag(NewParam->getLocation(), diag::err_default_arg_makes_ctor_special) << NewParam->getDefaultArgRange() << NewSM; Diag(Old->getLocation(), diag::note_previous_declaration); } } const FunctionDecl *Def; // C++11 [dcl.constexpr]p1: If any declaration of a function or function // template has a constexpr specifier then all its declarations shall // contain the constexpr specifier. if (New->getConstexprKind() != Old->getConstexprKind()) { Diag(New->getLocation(), diag::err_constexpr_redecl_mismatch) << New << New->getConstexprKind() << Old->getConstexprKind(); Diag(Old->getLocation(), diag::note_previous_declaration); Invalid = true; } else if (!Old->getMostRecentDecl()->isInlined() && New->isInlined() && Old->isDefined(Def) && // If a friend function is inlined but does not have 'inline' // specifier, it is a definition. Do not report attribute conflict // in this case, redefinition will be diagnosed later. (New->isInlineSpecified() || New->getFriendObjectKind() == Decl::FOK_None)) { // C++11 [dcl.fcn.spec]p4: // If the definition of a function appears in a translation unit before its // first declaration as inline, the program is ill-formed. Diag(New->getLocation(), diag::err_inline_decl_follows_def) << New; Diag(Def->getLocation(), diag::note_previous_definition); Invalid = true; } // C++17 [temp.deduct.guide]p3: // Two deduction guide declarations in the same translation unit // for the same class template shall not have equivalent // parameter-declaration-clauses. if (isa(New) && !New->isFunctionTemplateSpecialization()) { Diag(New->getLocation(), diag::err_deduction_guide_redeclared); Diag(Old->getLocation(), diag::note_previous_declaration); } // C++11 [dcl.fct.default]p4: If a friend declaration specifies a default // argument expression, that declaration shall be a definition and shall be // the only declaration of the function or function template in the // translation unit. if (Old->getFriendObjectKind() == Decl::FOK_Undeclared && functionDeclHasDefaultArgument(Old)) { Diag(New->getLocation(), diag::err_friend_decl_with_def_arg_redeclared); Diag(Old->getLocation(), diag::note_previous_declaration); Invalid = true; } return Invalid; } NamedDecl * Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists) { assert(D.isDecompositionDeclarator()); const DecompositionDeclarator &Decomp = D.getDecompositionDeclarator(); // The syntax only allows a decomposition declarator as a simple-declaration, // a for-range-declaration, or a condition in Clang, but we parse it in more // cases than that. if (!D.mayHaveDecompositionDeclarator()) { Diag(Decomp.getLSquareLoc(), diag::err_decomp_decl_context) << Decomp.getSourceRange(); return nullptr; } if (!TemplateParamLists.empty()) { // FIXME: There's no rule against this, but there are also no rules that // would actually make it usable, so we reject it for now. Diag(TemplateParamLists.front()->getTemplateLoc(), diag::err_decomp_decl_template); return nullptr; } Diag(Decomp.getLSquareLoc(), !getLangOpts().CPlusPlus17 ? diag::ext_decomp_decl : D.getContext() == DeclaratorContext::ConditionContext ? diag::ext_decomp_decl_cond : diag::warn_cxx14_compat_decomp_decl) << Decomp.getSourceRange(); // The semantic context is always just the current context. DeclContext *const DC = CurContext; // C++17 [dcl.dcl]/8: // The decl-specifier-seq shall contain only the type-specifier auto // and cv-qualifiers. // C++2a [dcl.dcl]/8: // If decl-specifier-seq contains any decl-specifier other than static, // thread_local, auto, or cv-qualifiers, the program is ill-formed. auto &DS = D.getDeclSpec(); { SmallVector BadSpecifiers; SmallVector BadSpecifierLocs; SmallVector CPlusPlus20Specifiers; SmallVector CPlusPlus20SpecifierLocs; if (auto SCS = DS.getStorageClassSpec()) { if (SCS == DeclSpec::SCS_static) { CPlusPlus20Specifiers.push_back(DeclSpec::getSpecifierName(SCS)); CPlusPlus20SpecifierLocs.push_back(DS.getStorageClassSpecLoc()); } else { BadSpecifiers.push_back(DeclSpec::getSpecifierName(SCS)); BadSpecifierLocs.push_back(DS.getStorageClassSpecLoc()); } } if (auto TSCS = DS.getThreadStorageClassSpec()) { CPlusPlus20Specifiers.push_back(DeclSpec::getSpecifierName(TSCS)); CPlusPlus20SpecifierLocs.push_back(DS.getThreadStorageClassSpecLoc()); } if (DS.hasConstexprSpecifier()) { BadSpecifiers.push_back( DeclSpec::getSpecifierName(DS.getConstexprSpecifier())); BadSpecifierLocs.push_back(DS.getConstexprSpecLoc()); } if (DS.isInlineSpecified()) { BadSpecifiers.push_back("inline"); BadSpecifierLocs.push_back(DS.getInlineSpecLoc()); } if (!BadSpecifiers.empty()) { auto &&Err = Diag(BadSpecifierLocs.front(), diag::err_decomp_decl_spec); Err << (int)BadSpecifiers.size() << llvm::join(BadSpecifiers.begin(), BadSpecifiers.end(), " "); // Don't add FixItHints to remove the specifiers; we do still respect // them when building the underlying variable. for (auto Loc : BadSpecifierLocs) Err << SourceRange(Loc, Loc); } else if (!CPlusPlus20Specifiers.empty()) { auto &&Warn = Diag(CPlusPlus20SpecifierLocs.front(), getLangOpts().CPlusPlus2a ? diag::warn_cxx17_compat_decomp_decl_spec : diag::ext_decomp_decl_spec); Warn << (int)CPlusPlus20Specifiers.size() << llvm::join(CPlusPlus20Specifiers.begin(), CPlusPlus20Specifiers.end(), " "); for (auto Loc : CPlusPlus20SpecifierLocs) Warn << SourceRange(Loc, Loc); } // We can't recover from it being declared as a typedef. if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) return nullptr; } TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); QualType R = TInfo->getType(); if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo, UPPC_DeclarationType)) D.setInvalidType(); // The syntax only allows a single ref-qualifier prior to the decomposition // declarator. No other declarator chunks are permitted. Also check the type // specifier here. if (DS.getTypeSpecType() != DeclSpec::TST_auto || D.hasGroupingParens() || D.getNumTypeObjects() > 1 || (D.getNumTypeObjects() == 1 && D.getTypeObject(0).Kind != DeclaratorChunk::Reference)) { Diag(Decomp.getLSquareLoc(), (D.hasGroupingParens() || (D.getNumTypeObjects() && D.getTypeObject(0).Kind == DeclaratorChunk::Paren)) ? diag::err_decomp_decl_parens : diag::err_decomp_decl_type) << R; // In most cases, there's no actual problem with an explicitly-specified // type, but a function type won't work here, and ActOnVariableDeclarator // shouldn't be called for such a type. if (R->isFunctionType()) D.setInvalidType(); } // Build the BindingDecls. SmallVector Bindings; // Build the BindingDecls. for (auto &B : D.getDecompositionDeclarator().bindings()) { // Check for name conflicts. DeclarationNameInfo NameInfo(B.Name, B.NameLoc); LookupResult Previous(*this, NameInfo, LookupOrdinaryName, ForVisibleRedeclaration); LookupName(Previous, S, /*CreateBuiltins*/DC->getRedeclContext()->isTranslationUnit()); // It's not permitted to shadow a template parameter name. if (Previous.isSingleResult() && Previous.getFoundDecl()->isTemplateParameter()) { DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), Previous.getFoundDecl()); Previous.clear(); } bool ConsiderLinkage = DC->isFunctionOrMethod() && DS.getStorageClassSpec() == DeclSpec::SCS_extern; FilterLookupForScope(Previous, DC, S, ConsiderLinkage, /*AllowInlineNamespace*/false); if (!Previous.empty()) { auto *Old = Previous.getRepresentativeDecl(); Diag(B.NameLoc, diag::err_redefinition) << B.Name; Diag(Old->getLocation(), diag::note_previous_definition); } auto *BD = BindingDecl::Create(Context, DC, B.NameLoc, B.Name); PushOnScopeChains(BD, S, true); Bindings.push_back(BD); ParsingInitForAutoVars.insert(BD); } // There are no prior lookup results for the variable itself, because it // is unnamed. DeclarationNameInfo NameInfo((IdentifierInfo *)nullptr, Decomp.getLSquareLoc()); LookupResult Previous(*this, NameInfo, LookupOrdinaryName, ForVisibleRedeclaration); // Build the variable that holds the non-decomposed object. bool AddToScope = true; NamedDecl *New = ActOnVariableDeclarator(S, D, DC, TInfo, Previous, MultiTemplateParamsArg(), AddToScope, Bindings); if (AddToScope) { S->AddDecl(New); CurContext->addHiddenDecl(New); } if (isInOpenMPDeclareTargetContext()) checkDeclIsAllowedInOpenMPTarget(nullptr, New); return New; } static bool checkSimpleDecomposition( Sema &S, ArrayRef Bindings, ValueDecl *Src, QualType DecompType, const llvm::APSInt &NumElems, QualType ElemType, llvm::function_ref GetInit) { if ((int64_t)Bindings.size() != NumElems) { S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings) << DecompType << (unsigned)Bindings.size() << NumElems.toString(10) << (NumElems < Bindings.size()); return true; } unsigned I = 0; for (auto *B : Bindings) { SourceLocation Loc = B->getLocation(); ExprResult E = S.BuildDeclRefExpr(Src, DecompType, VK_LValue, Loc); if (E.isInvalid()) return true; E = GetInit(Loc, E.get(), I++); if (E.isInvalid()) return true; B->setBinding(ElemType, E.get()); } return false; } static bool checkArrayLikeDecomposition(Sema &S, ArrayRef Bindings, ValueDecl *Src, QualType DecompType, const llvm::APSInt &NumElems, QualType ElemType) { return checkSimpleDecomposition( S, Bindings, Src, DecompType, NumElems, ElemType, [&](SourceLocation Loc, Expr *Base, unsigned I) -> ExprResult { ExprResult E = S.ActOnIntegerConstant(Loc, I); if (E.isInvalid()) return ExprError(); return S.CreateBuiltinArraySubscriptExpr(Base, Loc, E.get(), Loc); }); } static bool checkArrayDecomposition(Sema &S, ArrayRef Bindings, ValueDecl *Src, QualType DecompType, const ConstantArrayType *CAT) { return checkArrayLikeDecomposition(S, Bindings, Src, DecompType, llvm::APSInt(CAT->getSize()), CAT->getElementType()); } static bool checkVectorDecomposition(Sema &S, ArrayRef Bindings, ValueDecl *Src, QualType DecompType, const VectorType *VT) { return checkArrayLikeDecomposition( S, Bindings, Src, DecompType, llvm::APSInt::get(VT->getNumElements()), S.Context.getQualifiedType(VT->getElementType(), DecompType.getQualifiers())); } static bool checkComplexDecomposition(Sema &S, ArrayRef Bindings, ValueDecl *Src, QualType DecompType, const ComplexType *CT) { return checkSimpleDecomposition( S, Bindings, Src, DecompType, llvm::APSInt::get(2), S.Context.getQualifiedType(CT->getElementType(), DecompType.getQualifiers()), [&](SourceLocation Loc, Expr *Base, unsigned I) -> ExprResult { return S.CreateBuiltinUnaryOp(Loc, I ? UO_Imag : UO_Real, Base); }); } static std::string printTemplateArgs(const PrintingPolicy &PrintingPolicy, TemplateArgumentListInfo &Args) { SmallString<128> SS; llvm::raw_svector_ostream OS(SS); bool First = true; for (auto &Arg : Args.arguments()) { if (!First) OS << ", "; Arg.getArgument().print(PrintingPolicy, OS); First = false; } return OS.str(); } static bool lookupStdTypeTraitMember(Sema &S, LookupResult &TraitMemberLookup, SourceLocation Loc, StringRef Trait, TemplateArgumentListInfo &Args, unsigned DiagID) { auto DiagnoseMissing = [&] { if (DiagID) S.Diag(Loc, DiagID) << printTemplateArgs(S.Context.getPrintingPolicy(), Args); return true; }; // FIXME: Factor out duplication with lookupPromiseType in SemaCoroutine. NamespaceDecl *Std = S.getStdNamespace(); if (!Std) return DiagnoseMissing(); // Look up the trait itself, within namespace std. We can diagnose various // problems with this lookup even if we've been asked to not diagnose a // missing specialization, because this can only fail if the user has been // declaring their own names in namespace std or we don't support the // standard library implementation in use. LookupResult Result(S, &S.PP.getIdentifierTable().get(Trait), Loc, Sema::LookupOrdinaryName); if (!S.LookupQualifiedName(Result, Std)) return DiagnoseMissing(); if (Result.isAmbiguous()) return true; ClassTemplateDecl *TraitTD = Result.getAsSingle(); if (!TraitTD) { Result.suppressDiagnostics(); NamedDecl *Found = *Result.begin(); S.Diag(Loc, diag::err_std_type_trait_not_class_template) << Trait; S.Diag(Found->getLocation(), diag::note_declared_at); return true; } // Build the template-id. QualType TraitTy = S.CheckTemplateIdType(TemplateName(TraitTD), Loc, Args); if (TraitTy.isNull()) return true; if (!S.isCompleteType(Loc, TraitTy)) { if (DiagID) S.RequireCompleteType( Loc, TraitTy, DiagID, printTemplateArgs(S.Context.getPrintingPolicy(), Args)); return true; } CXXRecordDecl *RD = TraitTy->getAsCXXRecordDecl(); assert(RD && "specialization of class template is not a class?"); // Look up the member of the trait type. S.LookupQualifiedName(TraitMemberLookup, RD); return TraitMemberLookup.isAmbiguous(); } static TemplateArgumentLoc getTrivialIntegralTemplateArgument(Sema &S, SourceLocation Loc, QualType T, uint64_t I) { TemplateArgument Arg(S.Context, S.Context.MakeIntValue(I, T), T); return S.getTrivialTemplateArgumentLoc(Arg, T, Loc); } static TemplateArgumentLoc getTrivialTypeTemplateArgument(Sema &S, SourceLocation Loc, QualType T) { return S.getTrivialTemplateArgumentLoc(TemplateArgument(T), QualType(), Loc); } namespace { enum class IsTupleLike { TupleLike, NotTupleLike, Error }; } static IsTupleLike isTupleLike(Sema &S, SourceLocation Loc, QualType T, llvm::APSInt &Size) { EnterExpressionEvaluationContext ContextRAII( S, Sema::ExpressionEvaluationContext::ConstantEvaluated); DeclarationName Value = S.PP.getIdentifierInfo("value"); LookupResult R(S, Value, Loc, Sema::LookupOrdinaryName); // Form template argument list for tuple_size. TemplateArgumentListInfo Args(Loc, Loc); Args.addArgument(getTrivialTypeTemplateArgument(S, Loc, T)); // If there's no tuple_size specialization or the lookup of 'value' is empty, // it's not tuple-like. if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/ 0) || R.empty()) return IsTupleLike::NotTupleLike; // If we get this far, we've committed to the tuple interpretation, but // we can still fail if there actually isn't a usable ::value. struct ICEDiagnoser : Sema::VerifyICEDiagnoser { LookupResult &R; TemplateArgumentListInfo &Args; ICEDiagnoser(LookupResult &R, TemplateArgumentListInfo &Args) : R(R), Args(Args) {} void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) { S.Diag(Loc, diag::err_decomp_decl_std_tuple_size_not_constant) << printTemplateArgs(S.Context.getPrintingPolicy(), Args); } } Diagnoser(R, Args); ExprResult E = S.BuildDeclarationNameExpr(CXXScopeSpec(), R, /*NeedsADL*/false); if (E.isInvalid()) return IsTupleLike::Error; E = S.VerifyIntegerConstantExpression(E.get(), &Size, Diagnoser, false); if (E.isInvalid()) return IsTupleLike::Error; return IsTupleLike::TupleLike; } /// \return std::tuple_element::type. static QualType getTupleLikeElementType(Sema &S, SourceLocation Loc, unsigned I, QualType T) { // Form template argument list for tuple_element. TemplateArgumentListInfo Args(Loc, Loc); Args.addArgument( getTrivialIntegralTemplateArgument(S, Loc, S.Context.getSizeType(), I)); Args.addArgument(getTrivialTypeTemplateArgument(S, Loc, T)); DeclarationName TypeDN = S.PP.getIdentifierInfo("type"); LookupResult R(S, TypeDN, Loc, Sema::LookupOrdinaryName); if (lookupStdTypeTraitMember( S, R, Loc, "tuple_element", Args, diag::err_decomp_decl_std_tuple_element_not_specialized)) return QualType(); auto *TD = R.getAsSingle(); if (!TD) { R.suppressDiagnostics(); S.Diag(Loc, diag::err_decomp_decl_std_tuple_element_not_specialized) << printTemplateArgs(S.Context.getPrintingPolicy(), Args); if (!R.empty()) S.Diag(R.getRepresentativeDecl()->getLocation(), diag::note_declared_at); return QualType(); } return S.Context.getTypeDeclType(TD); } namespace { struct BindingDiagnosticTrap { Sema &S; DiagnosticErrorTrap Trap; BindingDecl *BD; BindingDiagnosticTrap(Sema &S, BindingDecl *BD) : S(S), Trap(S.Diags), BD(BD) {} ~BindingDiagnosticTrap() { if (Trap.hasErrorOccurred()) S.Diag(BD->getLocation(), diag::note_in_binding_decl_init) << BD; } }; } static bool checkTupleLikeDecomposition(Sema &S, ArrayRef Bindings, VarDecl *Src, QualType DecompType, const llvm::APSInt &TupleSize) { if ((int64_t)Bindings.size() != TupleSize) { S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings) << DecompType << (unsigned)Bindings.size() << TupleSize.toString(10) << (TupleSize < Bindings.size()); return true; } if (Bindings.empty()) return false; DeclarationName GetDN = S.PP.getIdentifierInfo("get"); // [dcl.decomp]p3: // The unqualified-id get is looked up in the scope of E by class member // access lookup ... LookupResult MemberGet(S, GetDN, Src->getLocation(), Sema::LookupMemberName); bool UseMemberGet = false; if (S.isCompleteType(Src->getLocation(), DecompType)) { if (auto *RD = DecompType->getAsCXXRecordDecl()) S.LookupQualifiedName(MemberGet, RD); if (MemberGet.isAmbiguous()) return true; // ... and if that finds at least one declaration that is a function // template whose first template parameter is a non-type parameter ... for (NamedDecl *D : MemberGet) { if (FunctionTemplateDecl *FTD = dyn_cast(D->getUnderlyingDecl())) { TemplateParameterList *TPL = FTD->getTemplateParameters(); if (TPL->size() != 0 && isa(TPL->getParam(0))) { // ... the initializer is e.get(). UseMemberGet = true; break; } } } } unsigned I = 0; for (auto *B : Bindings) { BindingDiagnosticTrap Trap(S, B); SourceLocation Loc = B->getLocation(); ExprResult E = S.BuildDeclRefExpr(Src, DecompType, VK_LValue, Loc); if (E.isInvalid()) return true; // e is an lvalue if the type of the entity is an lvalue reference and // an xvalue otherwise if (!Src->getType()->isLValueReferenceType()) E = ImplicitCastExpr::Create(S.Context, E.get()->getType(), CK_NoOp, E.get(), nullptr, VK_XValue); TemplateArgumentListInfo Args(Loc, Loc); Args.addArgument( getTrivialIntegralTemplateArgument(S, Loc, S.Context.getSizeType(), I)); if (UseMemberGet) { // if [lookup of member get] finds at least one declaration, the // initializer is e.get(). E = S.BuildMemberReferenceExpr(E.get(), DecompType, Loc, false, CXXScopeSpec(), SourceLocation(), nullptr, MemberGet, &Args, nullptr); if (E.isInvalid()) return true; E = S.BuildCallExpr(nullptr, E.get(), Loc, None, Loc); } else { // Otherwise, the initializer is get(e), where get is looked up // in the associated namespaces. Expr *Get = UnresolvedLookupExpr::Create( S.Context, nullptr, NestedNameSpecifierLoc(), SourceLocation(), DeclarationNameInfo(GetDN, Loc), /*RequiresADL*/true, &Args, UnresolvedSetIterator(), UnresolvedSetIterator()); Expr *Arg = E.get(); E = S.BuildCallExpr(nullptr, Get, Loc, Arg, Loc); } if (E.isInvalid()) return true; Expr *Init = E.get(); // Given the type T designated by std::tuple_element::type, QualType T = getTupleLikeElementType(S, Loc, I, DecompType); if (T.isNull()) return true; // each vi is a variable of type "reference to T" initialized with the // initializer, where the reference is an lvalue reference if the // initializer is an lvalue and an rvalue reference otherwise QualType RefType = S.BuildReferenceType(T, E.get()->isLValue(), Loc, B->getDeclName()); if (RefType.isNull()) return true; auto *RefVD = VarDecl::Create( S.Context, Src->getDeclContext(), Loc, Loc, B->getDeclName().getAsIdentifierInfo(), RefType, S.Context.getTrivialTypeSourceInfo(T, Loc), Src->getStorageClass()); RefVD->setLexicalDeclContext(Src->getLexicalDeclContext()); RefVD->setTSCSpec(Src->getTSCSpec()); RefVD->setImplicit(); if (Src->isInlineSpecified()) RefVD->setInlineSpecified(); RefVD->getLexicalDeclContext()->addHiddenDecl(RefVD); InitializedEntity Entity = InitializedEntity::InitializeBinding(RefVD); InitializationKind Kind = InitializationKind::CreateCopy(Loc, Loc); InitializationSequence Seq(S, Entity, Kind, Init); E = Seq.Perform(S, Entity, Kind, Init); if (E.isInvalid()) return true; E = S.ActOnFinishFullExpr(E.get(), Loc, /*DiscardedValue*/ false); if (E.isInvalid()) return true; RefVD->setInit(E.get()); - RefVD->checkInitIsICE(); + if (!E.get()->isValueDependent()) + RefVD->checkInitIsICE(); E = S.BuildDeclarationNameExpr(CXXScopeSpec(), DeclarationNameInfo(B->getDeclName(), Loc), RefVD); if (E.isInvalid()) return true; B->setBinding(T, E.get()); I++; } return false; } /// Find the base class to decompose in a built-in decomposition of a class type. /// This base class search is, unfortunately, not quite like any other that we /// perform anywhere else in C++. static DeclAccessPair findDecomposableBaseClass(Sema &S, SourceLocation Loc, const CXXRecordDecl *RD, CXXCastPath &BasePath) { auto BaseHasFields = [](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) { return Specifier->getType()->getAsCXXRecordDecl()->hasDirectFields(); }; const CXXRecordDecl *ClassWithFields = nullptr; AccessSpecifier AS = AS_public; if (RD->hasDirectFields()) // [dcl.decomp]p4: // Otherwise, all of E's non-static data members shall be public direct // members of E ... ClassWithFields = RD; else { // ... or of ... CXXBasePaths Paths; Paths.setOrigin(const_cast(RD)); if (!RD->lookupInBases(BaseHasFields, Paths)) { // If no classes have fields, just decompose RD itself. (This will work // if and only if zero bindings were provided.) return DeclAccessPair::make(const_cast(RD), AS_public); } CXXBasePath *BestPath = nullptr; for (auto &P : Paths) { if (!BestPath) BestPath = &P; else if (!S.Context.hasSameType(P.back().Base->getType(), BestPath->back().Base->getType())) { // ... the same ... S.Diag(Loc, diag::err_decomp_decl_multiple_bases_with_members) << false << RD << BestPath->back().Base->getType() << P.back().Base->getType(); return DeclAccessPair(); } else if (P.Access < BestPath->Access) { BestPath = &P; } } // ... unambiguous ... QualType BaseType = BestPath->back().Base->getType(); if (Paths.isAmbiguous(S.Context.getCanonicalType(BaseType))) { S.Diag(Loc, diag::err_decomp_decl_ambiguous_base) << RD << BaseType << S.getAmbiguousPathsDisplayString(Paths); return DeclAccessPair(); } // ... [accessible, implied by other rules] base class of E. S.CheckBaseClassAccess(Loc, BaseType, S.Context.getRecordType(RD), *BestPath, diag::err_decomp_decl_inaccessible_base); AS = BestPath->Access; ClassWithFields = BaseType->getAsCXXRecordDecl(); S.BuildBasePathArray(Paths, BasePath); } // The above search did not check whether the selected class itself has base // classes with fields, so check that now. CXXBasePaths Paths; if (ClassWithFields->lookupInBases(BaseHasFields, Paths)) { S.Diag(Loc, diag::err_decomp_decl_multiple_bases_with_members) << (ClassWithFields == RD) << RD << ClassWithFields << Paths.front().back().Base->getType(); return DeclAccessPair(); } return DeclAccessPair::make(const_cast(ClassWithFields), AS); } static bool checkMemberDecomposition(Sema &S, ArrayRef Bindings, ValueDecl *Src, QualType DecompType, const CXXRecordDecl *OrigRD) { if (S.RequireCompleteType(Src->getLocation(), DecompType, diag::err_incomplete_type)) return true; CXXCastPath BasePath; DeclAccessPair BasePair = findDecomposableBaseClass(S, Src->getLocation(), OrigRD, BasePath); const CXXRecordDecl *RD = cast_or_null(BasePair.getDecl()); if (!RD) return true; QualType BaseType = S.Context.getQualifiedType(S.Context.getRecordType(RD), DecompType.getQualifiers()); auto DiagnoseBadNumberOfBindings = [&]() -> bool { unsigned NumFields = std::count_if(RD->field_begin(), RD->field_end(), [](FieldDecl *FD) { return !FD->isUnnamedBitfield(); }); assert(Bindings.size() != NumFields); S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings) << DecompType << (unsigned)Bindings.size() << NumFields << (NumFields < Bindings.size()); return true; }; // all of E's non-static data members shall be [...] well-formed // when named as e.name in the context of the structured binding, // E shall not have an anonymous union member, ... unsigned I = 0; for (auto *FD : RD->fields()) { if (FD->isUnnamedBitfield()) continue; if (FD->isAnonymousStructOrUnion()) { S.Diag(Src->getLocation(), diag::err_decomp_decl_anon_union_member) << DecompType << FD->getType()->isUnionType(); S.Diag(FD->getLocation(), diag::note_declared_at); return true; } // We have a real field to bind. if (I >= Bindings.size()) return DiagnoseBadNumberOfBindings(); auto *B = Bindings[I++]; SourceLocation Loc = B->getLocation(); // The field must be accessible in the context of the structured binding. // We already checked that the base class is accessible. // FIXME: Add 'const' to AccessedEntity's classes so we can remove the // const_cast here. S.CheckStructuredBindingMemberAccess( Loc, const_cast(OrigRD), DeclAccessPair::make(FD, CXXRecordDecl::MergeAccess( BasePair.getAccess(), FD->getAccess()))); // Initialize the binding to Src.FD. ExprResult E = S.BuildDeclRefExpr(Src, DecompType, VK_LValue, Loc); if (E.isInvalid()) return true; E = S.ImpCastExprToType(E.get(), BaseType, CK_UncheckedDerivedToBase, VK_LValue, &BasePath); if (E.isInvalid()) return true; E = S.BuildFieldReferenceExpr(E.get(), /*IsArrow*/ false, Loc, CXXScopeSpec(), FD, DeclAccessPair::make(FD, FD->getAccess()), DeclarationNameInfo(FD->getDeclName(), Loc)); if (E.isInvalid()) return true; // If the type of the member is T, the referenced type is cv T, where cv is // the cv-qualification of the decomposition expression. // // FIXME: We resolve a defect here: if the field is mutable, we do not add // 'const' to the type of the field. Qualifiers Q = DecompType.getQualifiers(); if (FD->isMutable()) Q.removeConst(); B->setBinding(S.BuildQualifiedType(FD->getType(), Loc, Q), E.get()); } if (I != Bindings.size()) return DiagnoseBadNumberOfBindings(); return false; } void Sema::CheckCompleteDecompositionDeclaration(DecompositionDecl *DD) { QualType DecompType = DD->getType(); // If the type of the decomposition is dependent, then so is the type of // each binding. if (DecompType->isDependentType()) { for (auto *B : DD->bindings()) B->setType(Context.DependentTy); return; } DecompType = DecompType.getNonReferenceType(); ArrayRef Bindings = DD->bindings(); // C++1z [dcl.decomp]/2: // If E is an array type [...] // As an extension, we also support decomposition of built-in complex and // vector types. if (auto *CAT = Context.getAsConstantArrayType(DecompType)) { if (checkArrayDecomposition(*this, Bindings, DD, DecompType, CAT)) DD->setInvalidDecl(); return; } if (auto *VT = DecompType->getAs()) { if (checkVectorDecomposition(*this, Bindings, DD, DecompType, VT)) DD->setInvalidDecl(); return; } if (auto *CT = DecompType->getAs()) { if (checkComplexDecomposition(*this, Bindings, DD, DecompType, CT)) DD->setInvalidDecl(); return; } // C++1z [dcl.decomp]/3: // if the expression std::tuple_size::value is a well-formed integral // constant expression, [...] llvm::APSInt TupleSize(32); switch (isTupleLike(*this, DD->getLocation(), DecompType, TupleSize)) { case IsTupleLike::Error: DD->setInvalidDecl(); return; case IsTupleLike::TupleLike: if (checkTupleLikeDecomposition(*this, Bindings, DD, DecompType, TupleSize)) DD->setInvalidDecl(); return; case IsTupleLike::NotTupleLike: break; } // C++1z [dcl.dcl]/8: // [E shall be of array or non-union class type] CXXRecordDecl *RD = DecompType->getAsCXXRecordDecl(); if (!RD || RD->isUnion()) { Diag(DD->getLocation(), diag::err_decomp_decl_unbindable_type) << DD << !RD << DecompType; DD->setInvalidDecl(); return; } // C++1z [dcl.decomp]/4: // all of E's non-static data members shall be [...] direct members of // E or of the same unambiguous public base class of E, ... if (checkMemberDecomposition(*this, Bindings, DD, DecompType, RD)) DD->setInvalidDecl(); } /// Merge the exception specifications of two variable declarations. /// /// This is called when there's a redeclaration of a VarDecl. The function /// checks if the redeclaration might have an exception specification and /// validates compatibility and merges the specs if necessary. void Sema::MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old) { // Shortcut if exceptions are disabled. if (!getLangOpts().CXXExceptions) return; assert(Context.hasSameType(New->getType(), Old->getType()) && "Should only be called if types are otherwise the same."); QualType NewType = New->getType(); QualType OldType = Old->getType(); // We're only interested in pointers and references to functions, as well // as pointers to member functions. if (const ReferenceType *R = NewType->getAs()) { NewType = R->getPointeeType(); OldType = OldType->getAs()->getPointeeType(); } else if (const PointerType *P = NewType->getAs()) { NewType = P->getPointeeType(); OldType = OldType->getAs()->getPointeeType(); } else if (const MemberPointerType *M = NewType->getAs()) { NewType = M->getPointeeType(); OldType = OldType->getAs()->getPointeeType(); } if (!NewType->isFunctionProtoType()) return; // There's lots of special cases for functions. For function pointers, system // libraries are hopefully not as broken so that we don't need these // workarounds. if (CheckEquivalentExceptionSpec( OldType->getAs(), Old->getLocation(), NewType->getAs(), New->getLocation())) { New->setInvalidDecl(); } } /// CheckCXXDefaultArguments - Verify that the default arguments for a /// function declaration are well-formed according to C++ /// [dcl.fct.default]. void Sema::CheckCXXDefaultArguments(FunctionDecl *FD) { unsigned NumParams = FD->getNumParams(); unsigned p; // Find first parameter with a default argument for (p = 0; p < NumParams; ++p) { ParmVarDecl *Param = FD->getParamDecl(p); if (Param->hasDefaultArg()) break; } // C++11 [dcl.fct.default]p4: // In a given function declaration, each parameter subsequent to a parameter // with a default argument shall have a default argument supplied in this or // a previous declaration or shall be a function parameter pack. A default // argument shall not be redefined by a later declaration (not even to the // same value). unsigned LastMissingDefaultArg = 0; for (; p < NumParams; ++p) { ParmVarDecl *Param = FD->getParamDecl(p); if (!Param->hasDefaultArg() && !Param->isParameterPack()) { if (Param->isInvalidDecl()) /* We already complained about this parameter. */; else if (Param->getIdentifier()) Diag(Param->getLocation(), diag::err_param_default_argument_missing_name) << Param->getIdentifier(); else Diag(Param->getLocation(), diag::err_param_default_argument_missing); LastMissingDefaultArg = p; } } if (LastMissingDefaultArg > 0) { // Some default arguments were missing. Clear out all of the // default arguments up to (and including) the last missing // default argument, so that we leave the function parameters // in a semantically valid state. for (p = 0; p <= LastMissingDefaultArg; ++p) { ParmVarDecl *Param = FD->getParamDecl(p); if (Param->hasDefaultArg()) { Param->setDefaultArg(nullptr); } } } } // CheckConstexprParameterTypes - Check whether a function's parameter types // are all literal types. If so, return true. If not, produce a suitable // diagnostic and return false. static bool CheckConstexprParameterTypes(Sema &SemaRef, const FunctionDecl *FD) { unsigned ArgIndex = 0; const FunctionProtoType *FT = FD->getType()->getAs(); for (FunctionProtoType::param_type_iterator i = FT->param_type_begin(), e = FT->param_type_end(); i != e; ++i, ++ArgIndex) { const ParmVarDecl *PD = FD->getParamDecl(ArgIndex); SourceLocation ParamLoc = PD->getLocation(); if (!(*i)->isDependentType() && SemaRef.RequireLiteralType( ParamLoc, *i, diag::err_constexpr_non_literal_param, ArgIndex + 1, PD->getSourceRange(), isa(FD), FD->isConsteval())) return false; } return true; } /// Get diagnostic %select index for tag kind for /// record diagnostic message. /// WARNING: Indexes apply to particular diagnostics only! /// /// \returns diagnostic %select index. static unsigned getRecordDiagFromTagKind(TagTypeKind Tag) { switch (Tag) { case TTK_Struct: return 0; case TTK_Interface: return 1; case TTK_Class: return 2; default: llvm_unreachable("Invalid tag kind for record diagnostic!"); } } // CheckConstexprFunctionDecl - Check whether a function declaration satisfies // the requirements of a constexpr function definition or a constexpr // constructor definition. If so, return true. If not, produce appropriate // diagnostics and return false. // // This implements C++11 [dcl.constexpr]p3,4, as amended by DR1360. bool Sema::CheckConstexprFunctionDecl(const FunctionDecl *NewFD) { const CXXMethodDecl *MD = dyn_cast(NewFD); if (MD && MD->isInstance()) { // C++11 [dcl.constexpr]p4: // The definition of a constexpr constructor shall satisfy the following // constraints: // - the class shall not have any virtual base classes; // // FIXME: This only applies to constructors, not arbitrary member // functions. const CXXRecordDecl *RD = MD->getParent(); if (RD->getNumVBases()) { Diag(NewFD->getLocation(), diag::err_constexpr_virtual_base) << isa(NewFD) << getRecordDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases(); for (const auto &I : RD->vbases()) Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here) << I.getSourceRange(); return false; } } if (!isa(NewFD)) { // C++11 [dcl.constexpr]p3: // The definition of a constexpr function shall satisfy the following // constraints: // - it shall not be virtual; (removed in C++20) const CXXMethodDecl *Method = dyn_cast(NewFD); if (Method && Method->isVirtual()) { if (getLangOpts().CPlusPlus2a) { Diag(Method->getLocation(), diag::warn_cxx17_compat_constexpr_virtual); } else { Method = Method->getCanonicalDecl(); Diag(Method->getLocation(), diag::err_constexpr_virtual); // If it's not obvious why this function is virtual, find an overridden // function which uses the 'virtual' keyword. const CXXMethodDecl *WrittenVirtual = Method; while (!WrittenVirtual->isVirtualAsWritten()) WrittenVirtual = *WrittenVirtual->begin_overridden_methods(); if (WrittenVirtual != Method) Diag(WrittenVirtual->getLocation(), diag::note_overridden_virtual_function); return false; } } // - its return type shall be a literal type; QualType RT = NewFD->getReturnType(); if (!RT->isDependentType() && RequireLiteralType(NewFD->getLocation(), RT, diag::err_constexpr_non_literal_return, NewFD->isConsteval())) return false; } // - each of its parameter types shall be a literal type; if (!CheckConstexprParameterTypes(*this, NewFD)) return false; return true; } /// Check the given declaration statement is legal within a constexpr function /// body. C++11 [dcl.constexpr]p3,p4, and C++1y [dcl.constexpr]p3. /// /// \return true if the body is OK (maybe only as an extension), false if we /// have diagnosed a problem. static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl, DeclStmt *DS, SourceLocation &Cxx1yLoc) { // C++11 [dcl.constexpr]p3 and p4: // The definition of a constexpr function(p3) or constructor(p4) [...] shall // contain only for (const auto *DclIt : DS->decls()) { switch (DclIt->getKind()) { case Decl::StaticAssert: case Decl::Using: case Decl::UsingShadow: case Decl::UsingDirective: case Decl::UnresolvedUsingTypename: case Decl::UnresolvedUsingValue: // - static_assert-declarations // - using-declarations, // - using-directives, continue; case Decl::Typedef: case Decl::TypeAlias: { // - typedef declarations and alias-declarations that do not define // classes or enumerations, const auto *TN = cast(DclIt); if (TN->getUnderlyingType()->isVariablyModifiedType()) { // Don't allow variably-modified types in constexpr functions. TypeLoc TL = TN->getTypeSourceInfo()->getTypeLoc(); SemaRef.Diag(TL.getBeginLoc(), diag::err_constexpr_vla) << TL.getSourceRange() << TL.getType() << isa(Dcl); return false; } continue; } case Decl::Enum: case Decl::CXXRecord: // C++1y allows types to be defined, not just declared. if (cast(DclIt)->isThisDeclarationADefinition()) SemaRef.Diag(DS->getBeginLoc(), SemaRef.getLangOpts().CPlusPlus14 ? diag::warn_cxx11_compat_constexpr_type_definition : diag::ext_constexpr_type_definition) << isa(Dcl); continue; case Decl::EnumConstant: case Decl::IndirectField: case Decl::ParmVar: // These can only appear with other declarations which are banned in // C++11 and permitted in C++1y, so ignore them. continue; case Decl::Var: case Decl::Decomposition: { // C++1y [dcl.constexpr]p3 allows anything except: // a definition of a variable of non-literal type or of static or // thread storage duration or for which no initialization is performed. const auto *VD = cast(DclIt); if (VD->isThisDeclarationADefinition()) { if (VD->isStaticLocal()) { SemaRef.Diag(VD->getLocation(), diag::err_constexpr_local_var_static) << isa(Dcl) << (VD->getTLSKind() == VarDecl::TLS_Dynamic); return false; } if (!VD->getType()->isDependentType() && SemaRef.RequireLiteralType( VD->getLocation(), VD->getType(), diag::err_constexpr_local_var_non_literal_type, isa(Dcl))) return false; if (!VD->getType()->isDependentType() && !VD->hasInit() && !VD->isCXXForRangeDecl()) { SemaRef.Diag(VD->getLocation(), diag::err_constexpr_local_var_no_init) << isa(Dcl); return false; } } SemaRef.Diag(VD->getLocation(), SemaRef.getLangOpts().CPlusPlus14 ? diag::warn_cxx11_compat_constexpr_local_var : diag::ext_constexpr_local_var) << isa(Dcl); continue; } case Decl::NamespaceAlias: case Decl::Function: // These are disallowed in C++11 and permitted in C++1y. Allow them // everywhere as an extension. if (!Cxx1yLoc.isValid()) Cxx1yLoc = DS->getBeginLoc(); continue; default: SemaRef.Diag(DS->getBeginLoc(), diag::err_constexpr_body_invalid_stmt) << isa(Dcl) << Dcl->isConsteval(); return false; } } return true; } /// Check that the given field is initialized within a constexpr constructor. /// /// \param Dcl The constexpr constructor being checked. /// \param Field The field being checked. This may be a member of an anonymous /// struct or union nested within the class being checked. /// \param Inits All declarations, including anonymous struct/union members and /// indirect members, for which any initialization was provided. /// \param Diagnosed Set to true if an error is produced. static void CheckConstexprCtorInitializer(Sema &SemaRef, const FunctionDecl *Dcl, FieldDecl *Field, llvm::SmallSet &Inits, bool &Diagnosed) { if (Field->isInvalidDecl()) return; if (Field->isUnnamedBitfield()) return; // Anonymous unions with no variant members and empty anonymous structs do not // need to be explicitly initialized. FIXME: Anonymous structs that contain no // indirect fields don't need initializing. if (Field->isAnonymousStructOrUnion() && (Field->getType()->isUnionType() ? !Field->getType()->getAsCXXRecordDecl()->hasVariantMembers() : Field->getType()->getAsCXXRecordDecl()->isEmpty())) return; if (!Inits.count(Field)) { if (!Diagnosed) { SemaRef.Diag(Dcl->getLocation(), diag::err_constexpr_ctor_missing_init); Diagnosed = true; } SemaRef.Diag(Field->getLocation(), diag::note_constexpr_ctor_missing_init); } else if (Field->isAnonymousStructOrUnion()) { const RecordDecl *RD = Field->getType()->castAs()->getDecl(); for (auto *I : RD->fields()) // If an anonymous union contains an anonymous struct of which any member // is initialized, all members must be initialized. if (!RD->isUnion() || Inits.count(I)) CheckConstexprCtorInitializer(SemaRef, Dcl, I, Inits, Diagnosed); } } /// Check the provided statement is allowed in a constexpr function /// definition. static bool CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S, SmallVectorImpl &ReturnStmts, SourceLocation &Cxx1yLoc, SourceLocation &Cxx2aLoc) { // - its function-body shall be [...] a compound-statement that contains only switch (S->getStmtClass()) { case Stmt::NullStmtClass: // - null statements, return true; case Stmt::DeclStmtClass: // - static_assert-declarations // - using-declarations, // - using-directives, // - typedef declarations and alias-declarations that do not define // classes or enumerations, if (!CheckConstexprDeclStmt(SemaRef, Dcl, cast(S), Cxx1yLoc)) return false; return true; case Stmt::ReturnStmtClass: // - and exactly one return statement; if (isa(Dcl)) { // C++1y allows return statements in constexpr constructors. if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getBeginLoc(); return true; } ReturnStmts.push_back(S->getBeginLoc()); return true; case Stmt::CompoundStmtClass: { // C++1y allows compound-statements. if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getBeginLoc(); CompoundStmt *CompStmt = cast(S); for (auto *BodyIt : CompStmt->body()) { if (!CheckConstexprFunctionStmt(SemaRef, Dcl, BodyIt, ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; } return true; } case Stmt::AttributedStmtClass: if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getBeginLoc(); return true; case Stmt::IfStmtClass: { // C++1y allows if-statements. if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getBeginLoc(); IfStmt *If = cast(S); if (!CheckConstexprFunctionStmt(SemaRef, Dcl, If->getThen(), ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; if (If->getElse() && !CheckConstexprFunctionStmt(SemaRef, Dcl, If->getElse(), ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; return true; } case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: case Stmt::CXXForRangeStmtClass: case Stmt::ContinueStmtClass: // C++1y allows all of these. We don't allow them as extensions in C++11, // because they don't make sense without variable mutation. if (!SemaRef.getLangOpts().CPlusPlus14) break; if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getBeginLoc(); for (Stmt *SubStmt : S->children()) if (SubStmt && !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; return true; case Stmt::SwitchStmtClass: case Stmt::CaseStmtClass: case Stmt::DefaultStmtClass: case Stmt::BreakStmtClass: // C++1y allows switch-statements, and since they don't need variable // mutation, we can reasonably allow them in C++11 as an extension. if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getBeginLoc(); for (Stmt *SubStmt : S->children()) if (SubStmt && !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; return true; case Stmt::CXXTryStmtClass: if (Cxx2aLoc.isInvalid()) Cxx2aLoc = S->getBeginLoc(); for (Stmt *SubStmt : S->children()) { if (SubStmt && !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; } return true; case Stmt::CXXCatchStmtClass: // Do not bother checking the language mode (already covered by the // try block check). if (!CheckConstexprFunctionStmt(SemaRef, Dcl, cast(S)->getHandlerBlock(), ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; return true; default: if (!isa(S)) break; // C++1y allows expression-statements. if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getBeginLoc(); return true; } SemaRef.Diag(S->getBeginLoc(), diag::err_constexpr_body_invalid_stmt) << isa(Dcl) << Dcl->isConsteval(); return false; } /// Check the body for the given constexpr function declaration only contains /// the permitted types of statement. C++11 [dcl.constexpr]p3,p4. /// /// \return true if the body is OK, false if we have diagnosed a problem. bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) { SmallVector ReturnStmts; if (isa(Body)) { // C++11 [dcl.constexpr]p3: // The definition of a constexpr function shall satisfy the following // constraints: [...] // - its function-body shall be = delete, = default, or a // compound-statement // // C++11 [dcl.constexpr]p4: // In the definition of a constexpr constructor, [...] // - its function-body shall not be a function-try-block; // // This restriction is lifted in C++2a, as long as inner statements also // apply the general constexpr rules. Diag(Body->getBeginLoc(), !getLangOpts().CPlusPlus2a ? diag::ext_constexpr_function_try_block_cxx2a : diag::warn_cxx17_compat_constexpr_function_try_block) << isa(Dcl); } // - its function-body shall be [...] a compound-statement that contains only // [... list of cases ...] // // Note that walking the children here is enough to properly check for // CompoundStmt and CXXTryStmt body. SourceLocation Cxx1yLoc, Cxx2aLoc; for (Stmt *SubStmt : Body->children()) { if (SubStmt && !CheckConstexprFunctionStmt(*this, Dcl, SubStmt, ReturnStmts, Cxx1yLoc, Cxx2aLoc)) return false; } if (Cxx2aLoc.isValid()) Diag(Cxx2aLoc, getLangOpts().CPlusPlus2a ? diag::warn_cxx17_compat_constexpr_body_invalid_stmt : diag::ext_constexpr_body_invalid_stmt_cxx2a) << isa(Dcl); if (Cxx1yLoc.isValid()) Diag(Cxx1yLoc, getLangOpts().CPlusPlus14 ? diag::warn_cxx11_compat_constexpr_body_invalid_stmt : diag::ext_constexpr_body_invalid_stmt) << isa(Dcl); if (const CXXConstructorDecl *Constructor = dyn_cast(Dcl)) { const CXXRecordDecl *RD = Constructor->getParent(); // DR1359: // - every non-variant non-static data member and base class sub-object // shall be initialized; // DR1460: // - if the class is a union having variant members, exactly one of them // shall be initialized; if (RD->isUnion()) { if (Constructor->getNumCtorInitializers() == 0 && RD->hasVariantMembers()) { Diag(Dcl->getLocation(), diag::err_constexpr_union_ctor_no_init); return false; } } else if (!Constructor->isDependentContext() && !Constructor->isDelegatingConstructor()) { assert(RD->getNumVBases() == 0 && "constexpr ctor with virtual bases"); // Skip detailed checking if we have enough initializers, and we would // allow at most one initializer per member. bool AnyAnonStructUnionMembers = false; unsigned Fields = 0; for (CXXRecordDecl::field_iterator I = RD->field_begin(), E = RD->field_end(); I != E; ++I, ++Fields) { if (I->isAnonymousStructOrUnion()) { AnyAnonStructUnionMembers = true; break; } } // DR1460: // - if the class is a union-like class, but is not a union, for each of // its anonymous union members having variant members, exactly one of // them shall be initialized; if (AnyAnonStructUnionMembers || Constructor->getNumCtorInitializers() != RD->getNumBases() + Fields) { // Check initialization of non-static data members. Base classes are // always initialized so do not need to be checked. Dependent bases // might not have initializers in the member initializer list. llvm::SmallSet Inits; for (const auto *I: Constructor->inits()) { if (FieldDecl *FD = I->getMember()) Inits.insert(FD); else if (IndirectFieldDecl *ID = I->getIndirectMember()) Inits.insert(ID->chain_begin(), ID->chain_end()); } bool Diagnosed = false; for (auto *I : RD->fields()) CheckConstexprCtorInitializer(*this, Dcl, I, Inits, Diagnosed); if (Diagnosed) return false; } } } else { if (ReturnStmts.empty()) { // C++1y doesn't require constexpr functions to contain a 'return' // statement. We still do, unless the return type might be void, because // otherwise if there's no return statement, the function cannot // be used in a core constant expression. bool OK = getLangOpts().CPlusPlus14 && (Dcl->getReturnType()->isVoidType() || Dcl->getReturnType()->isDependentType()); Diag(Dcl->getLocation(), OK ? diag::warn_cxx11_compat_constexpr_body_no_return : diag::err_constexpr_body_no_return) << Dcl->isConsteval(); if (!OK) return false; } else if (ReturnStmts.size() > 1) { Diag(ReturnStmts.back(), getLangOpts().CPlusPlus14 ? diag::warn_cxx11_compat_constexpr_body_multiple_return : diag::ext_constexpr_body_multiple_return); for (unsigned I = 0; I < ReturnStmts.size() - 1; ++I) Diag(ReturnStmts[I], diag::note_constexpr_body_previous_return); } } // C++11 [dcl.constexpr]p5: // if no function argument values exist such that the function invocation // substitution would produce a constant expression, the program is // ill-formed; no diagnostic required. // C++11 [dcl.constexpr]p3: // - every constructor call and implicit conversion used in initializing the // return value shall be one of those allowed in a constant expression. // C++11 [dcl.constexpr]p4: // - every constructor involved in initializing non-static data members and // base class sub-objects shall be a constexpr constructor. SmallVector Diags; if (!Expr::isPotentialConstantExpr(Dcl, Diags)) { Diag(Dcl->getLocation(), diag::ext_constexpr_function_never_constant_expr) << isa(Dcl); for (size_t I = 0, N = Diags.size(); I != N; ++I) Diag(Diags[I].first, Diags[I].second); // Don't return false here: we allow this for compatibility in // system headers. } return true; } /// Get the class that is directly named by the current context. This is the /// class for which an unqualified-id in this scope could name a constructor /// or destructor. /// /// If the scope specifier denotes a class, this will be that class. /// If the scope specifier is empty, this will be the class whose /// member-specification we are currently within. Otherwise, there /// is no such class. CXXRecordDecl *Sema::getCurrentClass(Scope *, const CXXScopeSpec *SS) { assert(getLangOpts().CPlusPlus && "No class names in C!"); if (SS && SS->isInvalid()) return nullptr; if (SS && SS->isNotEmpty()) { DeclContext *DC = computeDeclContext(*SS, true); return dyn_cast_or_null(DC); } return dyn_cast_or_null(CurContext); } /// isCurrentClassName - Determine whether the identifier II is the /// name of the class type currently being defined. In the case of /// nested classes, this will only return true if II is the name of /// the innermost class. bool Sema::isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS) { CXXRecordDecl *CurDecl = getCurrentClass(S, SS); return CurDecl && &II == CurDecl->getIdentifier(); } /// Determine whether the identifier II is a typo for the name of /// the class type currently being defined. If so, update it to the identifier /// that should have been used. bool Sema::isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS) { assert(getLangOpts().CPlusPlus && "No class names in C!"); if (!getLangOpts().SpellChecking) return false; CXXRecordDecl *CurDecl; if (SS && SS->isSet() && !SS->isInvalid()) { DeclContext *DC = computeDeclContext(*SS, true); CurDecl = dyn_cast_or_null(DC); } else CurDecl = dyn_cast_or_null(CurContext); if (CurDecl && CurDecl->getIdentifier() && II != CurDecl->getIdentifier() && 3 * II->getName().edit_distance(CurDecl->getIdentifier()->getName()) < II->getLength()) { II = CurDecl->getIdentifier(); return true; } return false; } /// Determine whether the given class is a base class of the given /// class, including looking at dependent bases. static bool findCircularInheritance(const CXXRecordDecl *Class, const CXXRecordDecl *Current) { SmallVector Queue; Class = Class->getCanonicalDecl(); while (true) { for (const auto &I : Current->bases()) { CXXRecordDecl *Base = I.getType()->getAsCXXRecordDecl(); if (!Base) continue; Base = Base->getDefinition(); if (!Base) continue; if (Base->getCanonicalDecl() == Class) return true; Queue.push_back(Base); } if (Queue.empty()) return false; Current = Queue.pop_back_val(); } return false; } /// Check the validity of a C++ base class specifier. /// /// \returns a new CXXBaseSpecifier if well-formed, emits diagnostics /// and returns NULL otherwise. CXXBaseSpecifier * Sema::CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc) { QualType BaseType = TInfo->getType(); // C++ [class.union]p1: // A union shall not have base classes. if (Class->isUnion()) { Diag(Class->getLocation(), diag::err_base_clause_on_union) << SpecifierRange; return nullptr; } if (EllipsisLoc.isValid() && !TInfo->getType()->containsUnexpandedParameterPack()) { Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs) << TInfo->getTypeLoc().getSourceRange(); EllipsisLoc = SourceLocation(); } SourceLocation BaseLoc = TInfo->getTypeLoc().getBeginLoc(); if (BaseType->isDependentType()) { // Make sure that we don't have circular inheritance among our dependent // bases. For non-dependent bases, the check for completeness below handles // this. if (CXXRecordDecl *BaseDecl = BaseType->getAsCXXRecordDecl()) { if (BaseDecl->getCanonicalDecl() == Class->getCanonicalDecl() || ((BaseDecl = BaseDecl->getDefinition()) && findCircularInheritance(Class, BaseDecl))) { Diag(BaseLoc, diag::err_circular_inheritance) << BaseType << Context.getTypeDeclType(Class); if (BaseDecl->getCanonicalDecl() != Class->getCanonicalDecl()) Diag(BaseDecl->getLocation(), diag::note_previous_decl) << BaseType; return nullptr; } } return new (Context) CXXBaseSpecifier(SpecifierRange, Virtual, Class->getTagKind() == TTK_Class, Access, TInfo, EllipsisLoc); } // Base specifiers must be record types. if (!BaseType->isRecordType()) { Diag(BaseLoc, diag::err_base_must_be_class) << SpecifierRange; return nullptr; } // C++ [class.union]p1: // A union shall not be used as a base class. if (BaseType->isUnionType()) { Diag(BaseLoc, diag::err_union_as_base_class) << SpecifierRange; return nullptr; } // For the MS ABI, propagate DLL attributes to base class templates. if (Context.getTargetInfo().getCXXABI().isMicrosoft()) { if (Attr *ClassAttr = getDLLAttr(Class)) { if (auto *BaseTemplate = dyn_cast_or_null( BaseType->getAsCXXRecordDecl())) { propagateDLLAttrToBaseClassTemplate(Class, ClassAttr, BaseTemplate, BaseLoc); } } } // C++ [class.derived]p2: // The class-name in a base-specifier shall not be an incompletely // defined class. if (RequireCompleteType(BaseLoc, BaseType, diag::err_incomplete_base_class, SpecifierRange)) { Class->setInvalidDecl(); return nullptr; } // If the base class is polymorphic or isn't empty, the new one is/isn't, too. RecordDecl *BaseDecl = BaseType->getAs()->getDecl(); assert(BaseDecl && "Record type has no declaration"); BaseDecl = BaseDecl->getDefinition(); assert(BaseDecl && "Base type is not incomplete, but has no definition"); CXXRecordDecl *CXXBaseDecl = cast(BaseDecl); assert(CXXBaseDecl && "Base type is not a C++ type"); // Microsoft docs say: // "If a base-class has a code_seg attribute, derived classes must have the // same attribute." const auto *BaseCSA = CXXBaseDecl->getAttr(); const auto *DerivedCSA = Class->getAttr(); if ((DerivedCSA || BaseCSA) && (!BaseCSA || !DerivedCSA || BaseCSA->getName() != DerivedCSA->getName())) { Diag(Class->getLocation(), diag::err_mismatched_code_seg_base); Diag(CXXBaseDecl->getLocation(), diag::note_base_class_specified_here) << CXXBaseDecl; return nullptr; } // A class which contains a flexible array member is not suitable for use as a // base class: // - If the layout determines that a base comes before another base, // the flexible array member would index into the subsequent base. // - If the layout determines that base comes before the derived class, // the flexible array member would index into the derived class. if (CXXBaseDecl->hasFlexibleArrayMember()) { Diag(BaseLoc, diag::err_base_class_has_flexible_array_member) << CXXBaseDecl->getDeclName(); return nullptr; } // C++ [class]p3: // If a class is marked final and it appears as a base-type-specifier in // base-clause, the program is ill-formed. if (FinalAttr *FA = CXXBaseDecl->getAttr()) { Diag(BaseLoc, diag::err_class_marked_final_used_as_base) << CXXBaseDecl->getDeclName() << FA->isSpelledAsSealed(); Diag(CXXBaseDecl->getLocation(), diag::note_entity_declared_at) << CXXBaseDecl->getDeclName() << FA->getRange(); return nullptr; } if (BaseDecl->isInvalidDecl()) Class->setInvalidDecl(); // Create the base specifier. return new (Context) CXXBaseSpecifier(SpecifierRange, Virtual, Class->getTagKind() == TTK_Class, Access, TInfo, EllipsisLoc); } /// ActOnBaseSpecifier - Parsed a base specifier. A base specifier is /// one entry in the base class list of a class specifier, for /// example: /// class foo : public bar, virtual private baz { /// 'public bar' and 'virtual private baz' are each base-specifiers. BaseResult Sema::ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, ParsedAttributes &Attributes, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc) { if (!classdecl) return true; AdjustDeclIfTemplate(classdecl); CXXRecordDecl *Class = dyn_cast(classdecl); if (!Class) return true; // We haven't yet attached the base specifiers. Class->setIsParsingBaseSpecifiers(); // We do not support any C++11 attributes on base-specifiers yet. // Diagnose any attributes we see. for (const ParsedAttr &AL : Attributes) { if (AL.isInvalid() || AL.getKind() == ParsedAttr::IgnoredAttribute) continue; Diag(AL.getLoc(), AL.getKind() == ParsedAttr::UnknownAttribute ? (unsigned)diag::warn_unknown_attribute_ignored : (unsigned)diag::err_base_specifier_attribute) << AL.getName(); } TypeSourceInfo *TInfo = nullptr; GetTypeFromParser(basetype, &TInfo); if (EllipsisLoc.isInvalid() && DiagnoseUnexpandedParameterPack(SpecifierRange.getBegin(), TInfo, UPPC_BaseType)) return true; if (CXXBaseSpecifier *BaseSpec = CheckBaseSpecifier(Class, SpecifierRange, Virtual, Access, TInfo, EllipsisLoc)) return BaseSpec; else Class->setInvalidDecl(); return true; } /// Use small set to collect indirect bases. As this is only used /// locally, there's no need to abstract the small size parameter. typedef llvm::SmallPtrSet IndirectBaseSet; /// Recursively add the bases of Type. Don't add Type itself. static void NoteIndirectBases(ASTContext &Context, IndirectBaseSet &Set, const QualType &Type) { // Even though the incoming type is a base, it might not be // a class -- it could be a template parm, for instance. if (auto Rec = Type->getAs()) { auto Decl = Rec->getAsCXXRecordDecl(); // Iterate over its bases. for (const auto &BaseSpec : Decl->bases()) { QualType Base = Context.getCanonicalType(BaseSpec.getType()) .getUnqualifiedType(); if (Set.insert(Base).second) // If we've not already seen it, recurse. NoteIndirectBases(Context, Set, Base); } } } /// Performs the actual work of attaching the given base class /// specifiers to a C++ class. bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef Bases) { if (Bases.empty()) return false; // Used to keep track of which base types we have already seen, so // that we can properly diagnose redundant direct base types. Note // that the key is always the unqualified canonical type of the base // class. std::map KnownBaseTypes; // Used to track indirect bases so we can see if a direct base is // ambiguous. IndirectBaseSet IndirectBaseTypes; // Copy non-redundant base specifiers into permanent storage. unsigned NumGoodBases = 0; bool Invalid = false; for (unsigned idx = 0; idx < Bases.size(); ++idx) { QualType NewBaseType = Context.getCanonicalType(Bases[idx]->getType()); NewBaseType = NewBaseType.getLocalUnqualifiedType(); CXXBaseSpecifier *&KnownBase = KnownBaseTypes[NewBaseType]; if (KnownBase) { // C++ [class.mi]p3: // A class shall not be specified as a direct base class of a // derived class more than once. Diag(Bases[idx]->getBeginLoc(), diag::err_duplicate_base_class) << KnownBase->getType() << Bases[idx]->getSourceRange(); // Delete the duplicate base class specifier; we're going to // overwrite its pointer later. Context.Deallocate(Bases[idx]); Invalid = true; } else { // Okay, add this new base class. KnownBase = Bases[idx]; Bases[NumGoodBases++] = Bases[idx]; // Note this base's direct & indirect bases, if there could be ambiguity. if (Bases.size() > 1) NoteIndirectBases(Context, IndirectBaseTypes, NewBaseType); if (const RecordType *Record = NewBaseType->getAs()) { const CXXRecordDecl *RD = cast(Record->getDecl()); if (Class->isInterface() && (!RD->isInterfaceLike() || KnownBase->getAccessSpecifier() != AS_public)) { // The Microsoft extension __interface does not permit bases that // are not themselves public interfaces. Diag(KnownBase->getBeginLoc(), diag::err_invalid_base_in_interface) << getRecordDiagFromTagKind(RD->getTagKind()) << RD << RD->getSourceRange(); Invalid = true; } if (RD->hasAttr()) Class->addAttr(WeakAttr::CreateImplicit(Context)); } } } // Attach the remaining base class specifiers to the derived class. Class->setBases(Bases.data(), NumGoodBases); // Check that the only base classes that are duplicate are virtual. for (unsigned idx = 0; idx < NumGoodBases; ++idx) { // Check whether this direct base is inaccessible due to ambiguity. QualType BaseType = Bases[idx]->getType(); // Skip all dependent types in templates being used as base specifiers. // Checks below assume that the base specifier is a CXXRecord. if (BaseType->isDependentType()) continue; CanQualType CanonicalBase = Context.getCanonicalType(BaseType) .getUnqualifiedType(); if (IndirectBaseTypes.count(CanonicalBase)) { CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, /*DetectVirtual=*/true); bool found = Class->isDerivedFrom(CanonicalBase->getAsCXXRecordDecl(), Paths); assert(found); (void)found; if (Paths.isAmbiguous(CanonicalBase)) Diag(Bases[idx]->getBeginLoc(), diag::warn_inaccessible_base_class) << BaseType << getAmbiguousPathsDisplayString(Paths) << Bases[idx]->getSourceRange(); else assert(Bases[idx]->isVirtual()); } // Delete the base class specifier, since its data has been copied // into the CXXRecordDecl. Context.Deallocate(Bases[idx]); } return Invalid; } /// ActOnBaseSpecifiers - Attach the given base specifiers to the /// class, after checking whether there are any duplicate base /// classes. void Sema::ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef Bases) { if (!ClassDecl || Bases.empty()) return; AdjustDeclIfTemplate(ClassDecl); AttachBaseSpecifiers(cast(ClassDecl), Bases); } /// Determine whether the type \p Derived is a C++ class that is /// derived from the type \p Base. bool Sema::IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base) { if (!getLangOpts().CPlusPlus) return false; CXXRecordDecl *DerivedRD = Derived->getAsCXXRecordDecl(); if (!DerivedRD) return false; CXXRecordDecl *BaseRD = Base->getAsCXXRecordDecl(); if (!BaseRD) return false; // If either the base or the derived type is invalid, don't try to // check whether one is derived from the other. if (BaseRD->isInvalidDecl() || DerivedRD->isInvalidDecl()) return false; // FIXME: In a modules build, do we need the entire path to be visible for us // to be able to use the inheritance relationship? if (!isCompleteType(Loc, Derived) && !DerivedRD->isBeingDefined()) return false; return DerivedRD->isDerivedFrom(BaseRD); } /// Determine whether the type \p Derived is a C++ class that is /// derived from the type \p Base. bool Sema::IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base, CXXBasePaths &Paths) { if (!getLangOpts().CPlusPlus) return false; CXXRecordDecl *DerivedRD = Derived->getAsCXXRecordDecl(); if (!DerivedRD) return false; CXXRecordDecl *BaseRD = Base->getAsCXXRecordDecl(); if (!BaseRD) return false; if (!isCompleteType(Loc, Derived) && !DerivedRD->isBeingDefined()) return false; return DerivedRD->isDerivedFrom(BaseRD, Paths); } static void BuildBasePathArray(const CXXBasePath &Path, CXXCastPath &BasePathArray) { // We first go backward and check if we have a virtual base. // FIXME: It would be better if CXXBasePath had the base specifier for // the nearest virtual base. unsigned Start = 0; for (unsigned I = Path.size(); I != 0; --I) { if (Path[I - 1].Base->isVirtual()) { Start = I - 1; break; } } // Now add all bases. for (unsigned I = Start, E = Path.size(); I != E; ++I) BasePathArray.push_back(const_cast(Path[I].Base)); } void Sema::BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePathArray) { assert(BasePathArray.empty() && "Base path array must be empty!"); assert(Paths.isRecordingPaths() && "Must record paths!"); return ::BuildBasePathArray(Paths.front(), BasePathArray); } /// CheckDerivedToBaseConversion - Check whether the Derived-to-Base /// conversion (where Derived and Base are class types) is /// well-formed, meaning that the conversion is unambiguous (and /// that all of the base classes are accessible). Returns true /// and emits a diagnostic if the code is ill-formed, returns false /// otherwise. Loc is the location where this routine should point to /// if there is an error, and Range is the source range to highlight /// if there is an error. /// /// If either InaccessibleBaseID or AmbigiousBaseConvID are 0, then the /// diagnostic for the respective type of error will be suppressed, but the /// check for ill-formed code will still be performed. bool Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base, unsigned InaccessibleBaseID, unsigned AmbigiousBaseConvID, SourceLocation Loc, SourceRange Range, DeclarationName Name, CXXCastPath *BasePath, bool IgnoreAccess) { // First, determine whether the path from Derived to Base is // ambiguous. This is slightly more expensive than checking whether // the Derived to Base conversion exists, because here we need to // explore multiple paths to determine if there is an ambiguity. CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, /*DetectVirtual=*/false); bool DerivationOkay = IsDerivedFrom(Loc, Derived, Base, Paths); if (!DerivationOkay) return true; const CXXBasePath *Path = nullptr; if (!Paths.isAmbiguous(Context.getCanonicalType(Base).getUnqualifiedType())) Path = &Paths.front(); // For MSVC compatibility, check if Derived directly inherits from Base. Clang // warns about this hierarchy under -Winaccessible-base, but MSVC allows the // user to access such bases. if (!Path && getLangOpts().MSVCCompat) { for (const CXXBasePath &PossiblePath : Paths) { if (PossiblePath.size() == 1) { Path = &PossiblePath; if (AmbigiousBaseConvID) Diag(Loc, diag::ext_ms_ambiguous_direct_base) << Base << Derived << Range; break; } } } if (Path) { if (!IgnoreAccess) { // Check that the base class can be accessed. switch ( CheckBaseClassAccess(Loc, Base, Derived, *Path, InaccessibleBaseID)) { case AR_inaccessible: return true; case AR_accessible: case AR_dependent: case AR_delayed: break; } } // Build a base path if necessary. if (BasePath) ::BuildBasePathArray(*Path, *BasePath); return false; } if (AmbigiousBaseConvID) { // We know that the derived-to-base conversion is ambiguous, and // we're going to produce a diagnostic. Perform the derived-to-base // search just one more time to compute all of the possible paths so // that we can print them out. This is more expensive than any of // the previous derived-to-base checks we've done, but at this point // performance isn't as much of an issue. Paths.clear(); Paths.setRecordingPaths(true); bool StillOkay = IsDerivedFrom(Loc, Derived, Base, Paths); assert(StillOkay && "Can only be used with a derived-to-base conversion"); (void)StillOkay; // Build up a textual representation of the ambiguous paths, e.g., // D -> B -> A, that will be used to illustrate the ambiguous // conversions in the diagnostic. We only print one of the paths // to each base class subobject. std::string PathDisplayStr = getAmbiguousPathsDisplayString(Paths); Diag(Loc, AmbigiousBaseConvID) << Derived << Base << PathDisplayStr << Range << Name; } return true; } bool Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath, bool IgnoreAccess) { return CheckDerivedToBaseConversion( Derived, Base, diag::err_upcast_to_inaccessible_base, diag::err_ambiguous_derived_to_base_conv, Loc, Range, DeclarationName(), BasePath, IgnoreAccess); } /// Builds a string representing ambiguous paths from a /// specific derived class to different subobjects of the same base /// class. /// /// This function builds a string that can be used in error messages /// to show the different paths that one can take through the /// inheritance hierarchy to go from the derived class to different /// subobjects of a base class. The result looks something like this: /// @code /// struct D -> struct B -> struct A /// struct D -> struct C -> struct A /// @endcode std::string Sema::getAmbiguousPathsDisplayString(CXXBasePaths &Paths) { std::string PathDisplayStr; std::set DisplayedPaths; for (CXXBasePaths::paths_iterator Path = Paths.begin(); Path != Paths.end(); ++Path) { if (DisplayedPaths.insert(Path->back().SubobjectNumber).second) { // We haven't displayed a path to this particular base // class subobject yet. PathDisplayStr += "\n "; PathDisplayStr += Context.getTypeDeclType(Paths.getOrigin()).getAsString(); for (CXXBasePath::const_iterator Element = Path->begin(); Element != Path->end(); ++Element) PathDisplayStr += " -> " + Element->Base->getType().getAsString(); } } return PathDisplayStr; } //===----------------------------------------------------------------------===// // C++ class member Handling //===----------------------------------------------------------------------===// /// ActOnAccessSpecifier - Parsed an access specifier followed by a colon. bool Sema::ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, const ParsedAttributesView &Attrs) { assert(Access != AS_none && "Invalid kind for syntactic access specifier!"); AccessSpecDecl *ASDecl = AccessSpecDecl::Create(Context, Access, CurContext, ASLoc, ColonLoc); CurContext->addHiddenDecl(ASDecl); return ProcessAccessDeclAttributeList(ASDecl, Attrs); } /// CheckOverrideControl - Check C++11 override control semantics. void Sema::CheckOverrideControl(NamedDecl *D) { if (D->isInvalidDecl()) return; // We only care about "override" and "final" declarations. if (!D->hasAttr() && !D->hasAttr()) return; CXXMethodDecl *MD = dyn_cast(D); // We can't check dependent instance methods. if (MD && MD->isInstance() && (MD->getParent()->hasAnyDependentBases() || MD->getType()->isDependentType())) return; if (MD && !MD->isVirtual()) { // If we have a non-virtual method, check if if hides a virtual method. // (In that case, it's most likely the method has the wrong type.) SmallVector OverloadedMethods; FindHiddenVirtualMethods(MD, OverloadedMethods); if (!OverloadedMethods.empty()) { if (OverrideAttr *OA = D->getAttr()) { Diag(OA->getLocation(), diag::override_keyword_hides_virtual_member_function) << "override" << (OverloadedMethods.size() > 1); } else if (FinalAttr *FA = D->getAttr()) { Diag(FA->getLocation(), diag::override_keyword_hides_virtual_member_function) << (FA->isSpelledAsSealed() ? "sealed" : "final") << (OverloadedMethods.size() > 1); } NoteHiddenVirtualMethods(MD, OverloadedMethods); MD->setInvalidDecl(); return; } // Fall through into the general case diagnostic. // FIXME: We might want to attempt typo correction here. } if (!MD || !MD->isVirtual()) { if (OverrideAttr *OA = D->getAttr()) { Diag(OA->getLocation(), diag::override_keyword_only_allowed_on_virtual_member_functions) << "override" << FixItHint::CreateRemoval(OA->getLocation()); D->dropAttr(); } if (FinalAttr *FA = D->getAttr()) { Diag(FA->getLocation(), diag::override_keyword_only_allowed_on_virtual_member_functions) << (FA->isSpelledAsSealed() ? "sealed" : "final") << FixItHint::CreateRemoval(FA->getLocation()); D->dropAttr(); } return; } // C++11 [class.virtual]p5: // If a function is marked with the virt-specifier override and // does not override a member function of a base class, the program is // ill-formed. bool HasOverriddenMethods = MD->size_overridden_methods() != 0; if (MD->hasAttr() && !HasOverriddenMethods) Diag(MD->getLocation(), diag::err_function_marked_override_not_overriding) << MD->getDeclName(); } void Sema::DiagnoseAbsenceOfOverrideControl(NamedDecl *D) { if (D->isInvalidDecl() || D->hasAttr()) return; CXXMethodDecl *MD = dyn_cast(D); if (!MD || MD->isImplicit() || MD->hasAttr()) return; SourceLocation Loc = MD->getLocation(); SourceLocation SpellingLoc = Loc; if (getSourceManager().isMacroArgExpansion(Loc)) SpellingLoc = getSourceManager().getImmediateExpansionRange(Loc).getBegin(); SpellingLoc = getSourceManager().getSpellingLoc(SpellingLoc); if (SpellingLoc.isValid() && getSourceManager().isInSystemHeader(SpellingLoc)) return; if (MD->size_overridden_methods() > 0) { unsigned DiagID = isa(MD) ? diag::warn_destructor_marked_not_override_overriding : diag::warn_function_marked_not_override_overriding; Diag(MD->getLocation(), DiagID) << MD->getDeclName(); const CXXMethodDecl *OMD = *MD->begin_overridden_methods(); Diag(OMD->getLocation(), diag::note_overridden_virtual_function); } } /// CheckIfOverriddenFunctionIsMarkedFinal - Checks whether a virtual member /// function overrides a virtual member function marked 'final', according to /// C++11 [class.virtual]p4. bool Sema::CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old) { FinalAttr *FA = Old->getAttr(); if (!FA) return false; Diag(New->getLocation(), diag::err_final_function_overridden) << New->getDeclName() << FA->isSpelledAsSealed(); Diag(Old->getLocation(), diag::note_overridden_virtual_function); return true; } static bool InitializationHasSideEffects(const FieldDecl &FD) { const Type *T = FD.getType()->getBaseElementTypeUnsafe(); // FIXME: Destruction of ObjC lifetime types has side-effects. if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl()) return !RD->isCompleteDefinition() || !RD->hasTrivialDefaultConstructor() || !RD->hasTrivialDestructor(); return false; } static const ParsedAttr *getMSPropertyAttr(const ParsedAttributesView &list) { ParsedAttributesView::const_iterator Itr = llvm::find_if(list, [](const ParsedAttr &AL) { return AL.isDeclspecPropertyAttribute(); }); if (Itr != list.end()) return &*Itr; return nullptr; } // Check if there is a field shadowing. void Sema::CheckShadowInheritedFields(const SourceLocation &Loc, DeclarationName FieldName, const CXXRecordDecl *RD, bool DeclIsField) { if (Diags.isIgnored(diag::warn_shadow_field, Loc)) return; // To record a shadowed field in a base std::map Bases; auto FieldShadowed = [&](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) { const auto Base = Specifier->getType()->getAsCXXRecordDecl(); // Record an ambiguous path directly if (Bases.find(Base) != Bases.end()) return true; for (const auto Field : Base->lookup(FieldName)) { if ((isa(Field) || isa(Field)) && Field->getAccess() != AS_private) { assert(Field->getAccess() != AS_none); assert(Bases.find(Base) == Bases.end()); Bases[Base] = Field; return true; } } return false; }; CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, /*DetectVirtual=*/true); if (!RD->lookupInBases(FieldShadowed, Paths)) return; for (const auto &P : Paths) { auto Base = P.back().Base->getType()->getAsCXXRecordDecl(); auto It = Bases.find(Base); // Skip duplicated bases if (It == Bases.end()) continue; auto BaseField = It->second; assert(BaseField->getAccess() != AS_private); if (AS_none != CXXRecordDecl::MergeAccess(P.Access, BaseField->getAccess())) { Diag(Loc, diag::warn_shadow_field) << FieldName << RD << Base << DeclIsField; Diag(BaseField->getLocation(), diag::note_shadow_field); Bases.erase(It); } } } /// ActOnCXXMemberDeclarator - This is invoked when a C++ class member /// declarator is parsed. 'AS' is the access specifier, 'BW' specifies the /// bitfield width if there is one, 'InitExpr' specifies the initializer if /// one has been parsed, and 'InitStyle' is set if an in-class initializer is /// present (but parsing it has been deferred). NamedDecl * Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BW, const VirtSpecifiers &VS, InClassInitStyle InitStyle) { const DeclSpec &DS = D.getDeclSpec(); DeclarationNameInfo NameInfo = GetNameForDeclarator(D); DeclarationName Name = NameInfo.getName(); SourceLocation Loc = NameInfo.getLoc(); // For anonymous bitfields, the location should point to the type. if (Loc.isInvalid()) Loc = D.getBeginLoc(); Expr *BitWidth = static_cast(BW); assert(isa(CurContext)); assert(!DS.isFriendSpecified()); bool isFunc = D.isDeclarationOfFunction(); const ParsedAttr *MSPropertyAttr = getMSPropertyAttr(D.getDeclSpec().getAttributes()); if (cast(CurContext)->isInterface()) { // The Microsoft extension __interface only permits public member functions // and prohibits constructors, destructors, operators, non-public member // functions, static methods and data members. unsigned InvalidDecl; bool ShowDeclName = true; if (!isFunc && (DS.getStorageClassSpec() == DeclSpec::SCS_typedef || MSPropertyAttr)) InvalidDecl = 0; else if (!isFunc) InvalidDecl = 1; else if (AS != AS_public) InvalidDecl = 2; else if (DS.getStorageClassSpec() == DeclSpec::SCS_static) InvalidDecl = 3; else switch (Name.getNameKind()) { case DeclarationName::CXXConstructorName: InvalidDecl = 4; ShowDeclName = false; break; case DeclarationName::CXXDestructorName: InvalidDecl = 5; ShowDeclName = false; break; case DeclarationName::CXXOperatorName: case DeclarationName::CXXConversionFunctionName: InvalidDecl = 6; break; default: InvalidDecl = 0; break; } if (InvalidDecl) { if (ShowDeclName) Diag(Loc, diag::err_invalid_member_in_interface) << (InvalidDecl-1) << Name; else Diag(Loc, diag::err_invalid_member_in_interface) << (InvalidDecl-1) << ""; return nullptr; } } // C++ 9.2p6: A member shall not be declared to have automatic storage // duration (auto, register) or with the extern storage-class-specifier. // C++ 7.1.1p8: The mutable specifier can be applied only to names of class // data members and cannot be applied to names declared const or static, // and cannot be applied to reference members. switch (DS.getStorageClassSpec()) { case DeclSpec::SCS_unspecified: case DeclSpec::SCS_typedef: case DeclSpec::SCS_static: break; case DeclSpec::SCS_mutable: if (isFunc) { Diag(DS.getStorageClassSpecLoc(), diag::err_mutable_function); // FIXME: It would be nicer if the keyword was ignored only for this // declarator. Otherwise we could get follow-up errors. D.getMutableDeclSpec().ClearStorageClassSpecs(); } break; default: Diag(DS.getStorageClassSpecLoc(), diag::err_storageclass_invalid_for_member); D.getMutableDeclSpec().ClearStorageClassSpecs(); break; } bool isInstField = ((DS.getStorageClassSpec() == DeclSpec::SCS_unspecified || DS.getStorageClassSpec() == DeclSpec::SCS_mutable) && !isFunc); if (DS.hasConstexprSpecifier() && isInstField) { SemaDiagnosticBuilder B = Diag(DS.getConstexprSpecLoc(), diag::err_invalid_constexpr_member); SourceLocation ConstexprLoc = DS.getConstexprSpecLoc(); if (InitStyle == ICIS_NoInit) { B << 0 << 0; if (D.getDeclSpec().getTypeQualifiers() & DeclSpec::TQ_const) B << FixItHint::CreateRemoval(ConstexprLoc); else { B << FixItHint::CreateReplacement(ConstexprLoc, "const"); D.getMutableDeclSpec().ClearConstexprSpec(); const char *PrevSpec; unsigned DiagID; bool Failed = D.getMutableDeclSpec().SetTypeQual( DeclSpec::TQ_const, ConstexprLoc, PrevSpec, DiagID, getLangOpts()); (void)Failed; assert(!Failed && "Making a constexpr member const shouldn't fail"); } } else { B << 1; const char *PrevSpec; unsigned DiagID; if (D.getMutableDeclSpec().SetStorageClassSpec( *this, DeclSpec::SCS_static, ConstexprLoc, PrevSpec, DiagID, Context.getPrintingPolicy())) { assert(DS.getStorageClassSpec() == DeclSpec::SCS_mutable && "This is the only DeclSpec that should fail to be applied"); B << 1; } else { B << 0 << FixItHint::CreateInsertion(ConstexprLoc, "static "); isInstField = false; } } } NamedDecl *Member; if (isInstField) { CXXScopeSpec &SS = D.getCXXScopeSpec(); // Data members must have identifiers for names. if (!Name.isIdentifier()) { Diag(Loc, diag::err_bad_variable_name) << Name; return nullptr; } IdentifierInfo *II = Name.getAsIdentifierInfo(); // Member field could not be with "template" keyword. // So TemplateParameterLists should be empty in this case. if (TemplateParameterLists.size()) { TemplateParameterList* TemplateParams = TemplateParameterLists[0]; if (TemplateParams->size()) { // There is no such thing as a member field template. Diag(D.getIdentifierLoc(), diag::err_template_member) << II << SourceRange(TemplateParams->getTemplateLoc(), TemplateParams->getRAngleLoc()); } else { // There is an extraneous 'template<>' for this member. Diag(TemplateParams->getTemplateLoc(), diag::err_template_member_noparams) << II << SourceRange(TemplateParams->getTemplateLoc(), TemplateParams->getRAngleLoc()); } return nullptr; } if (SS.isSet() && !SS.isInvalid()) { // The user provided a superfluous scope specifier inside a class // definition: // // class X { // int X::member; // }; if (DeclContext *DC = computeDeclContext(SS, false)) diagnoseQualifiedDeclaration(SS, DC, Name, D.getIdentifierLoc(), D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId); else Diag(D.getIdentifierLoc(), diag::err_member_qualification) << Name << SS.getRange(); SS.clear(); } if (MSPropertyAttr) { Member = HandleMSProperty(S, cast(CurContext), Loc, D, BitWidth, InitStyle, AS, *MSPropertyAttr); if (!Member) return nullptr; isInstField = false; } else { Member = HandleField(S, cast(CurContext), Loc, D, BitWidth, InitStyle, AS); if (!Member) return nullptr; } CheckShadowInheritedFields(Loc, Name, cast(CurContext)); } else { Member = HandleDeclarator(S, D, TemplateParameterLists); if (!Member) return nullptr; // Non-instance-fields can't have a bitfield. if (BitWidth) { if (Member->isInvalidDecl()) { // don't emit another diagnostic. } else if (isa(Member) || isa(Member)) { // C++ 9.6p3: A bit-field shall not be a static member. // "static member 'A' cannot be a bit-field" Diag(Loc, diag::err_static_not_bitfield) << Name << BitWidth->getSourceRange(); } else if (isa(Member)) { // "typedef member 'x' cannot be a bit-field" Diag(Loc, diag::err_typedef_not_bitfield) << Name << BitWidth->getSourceRange(); } else { // A function typedef ("typedef int f(); f a;"). // C++ 9.6p3: A bit-field shall have integral or enumeration type. Diag(Loc, diag::err_not_integral_type_bitfield) << Name << cast(Member)->getType() << BitWidth->getSourceRange(); } BitWidth = nullptr; Member->setInvalidDecl(); } NamedDecl *NonTemplateMember = Member; if (FunctionTemplateDecl *FunTmpl = dyn_cast(Member)) NonTemplateMember = FunTmpl->getTemplatedDecl(); else if (VarTemplateDecl *VarTmpl = dyn_cast(Member)) NonTemplateMember = VarTmpl->getTemplatedDecl(); Member->setAccess(AS); // If we have declared a member function template or static data member // template, set the access of the templated declaration as well. if (NonTemplateMember != Member) NonTemplateMember->setAccess(AS); // C++ [temp.deduct.guide]p3: // A deduction guide [...] for a member class template [shall be // declared] with the same access [as the template]. if (auto *DG = dyn_cast(NonTemplateMember)) { auto *TD = DG->getDeducedTemplate(); // Access specifiers are only meaningful if both the template and the // deduction guide are from the same scope. if (AS != TD->getAccess() && TD->getDeclContext()->getRedeclContext()->Equals( DG->getDeclContext()->getRedeclContext())) { Diag(DG->getBeginLoc(), diag::err_deduction_guide_wrong_access); Diag(TD->getBeginLoc(), diag::note_deduction_guide_template_access) << TD->getAccess(); const AccessSpecDecl *LastAccessSpec = nullptr; for (const auto *D : cast(CurContext)->decls()) { if (const auto *AccessSpec = dyn_cast(D)) LastAccessSpec = AccessSpec; } assert(LastAccessSpec && "differing access with no access specifier"); Diag(LastAccessSpec->getBeginLoc(), diag::note_deduction_guide_access) << AS; } } } if (VS.isOverrideSpecified()) Member->addAttr(new (Context) OverrideAttr(VS.getOverrideLoc(), Context, 0)); if (VS.isFinalSpecified()) Member->addAttr(new (Context) FinalAttr(VS.getFinalLoc(), Context, VS.isFinalSpelledSealed())); if (VS.getLastLocation().isValid()) { // Update the end location of a method that has a virt-specifiers. if (CXXMethodDecl *MD = dyn_cast_or_null(Member)) MD->setRangeEnd(VS.getLastLocation()); } CheckOverrideControl(Member); assert((Name || isInstField) && "No identifier for non-field ?"); if (isInstField) { FieldDecl *FD = cast(Member); FieldCollector->Add(FD); if (!Diags.isIgnored(diag::warn_unused_private_field, FD->getLocation())) { // Remember all explicit private FieldDecls that have a name, no side // effects and are not part of a dependent type declaration. if (!FD->isImplicit() && FD->getDeclName() && FD->getAccess() == AS_private && !FD->hasAttr() && !FD->getParent()->isDependentContext() && !InitializationHasSideEffects(*FD)) UnusedPrivateFields.insert(FD); } } return Member; } namespace { class UninitializedFieldVisitor : public EvaluatedExprVisitor { Sema &S; // List of Decls to generate a warning on. Also remove Decls that become // initialized. llvm::SmallPtrSetImpl &Decls; // List of base classes of the record. Classes are removed after their // initializers. llvm::SmallPtrSetImpl &BaseClasses; // Vector of decls to be removed from the Decl set prior to visiting the // nodes. These Decls may have been initialized in the prior initializer. llvm::SmallVector DeclsToRemove; // If non-null, add a note to the warning pointing back to the constructor. const CXXConstructorDecl *Constructor; // Variables to hold state when processing an initializer list. When // InitList is true, special case initialization of FieldDecls matching // InitListFieldDecl. bool InitList; FieldDecl *InitListFieldDecl; llvm::SmallVector InitFieldIndex; public: typedef EvaluatedExprVisitor Inherited; UninitializedFieldVisitor(Sema &S, llvm::SmallPtrSetImpl &Decls, llvm::SmallPtrSetImpl &BaseClasses) : Inherited(S.Context), S(S), Decls(Decls), BaseClasses(BaseClasses), Constructor(nullptr), InitList(false), InitListFieldDecl(nullptr) {} // Returns true if the use of ME is not an uninitialized use. bool IsInitListMemberExprInitialized(MemberExpr *ME, bool CheckReferenceOnly) { llvm::SmallVector Fields; bool ReferenceField = false; while (ME) { FieldDecl *FD = dyn_cast(ME->getMemberDecl()); if (!FD) return false; Fields.push_back(FD); if (FD->getType()->isReferenceType()) ReferenceField = true; ME = dyn_cast(ME->getBase()->IgnoreParenImpCasts()); } // Binding a reference to an uninitialized field is not an // uninitialized use. if (CheckReferenceOnly && !ReferenceField) return true; llvm::SmallVector UsedFieldIndex; // Discard the first field since it is the field decl that is being // initialized. for (auto I = Fields.rbegin() + 1, E = Fields.rend(); I != E; ++I) { UsedFieldIndex.push_back((*I)->getFieldIndex()); } for (auto UsedIter = UsedFieldIndex.begin(), UsedEnd = UsedFieldIndex.end(), OrigIter = InitFieldIndex.begin(), OrigEnd = InitFieldIndex.end(); UsedIter != UsedEnd && OrigIter != OrigEnd; ++UsedIter, ++OrigIter) { if (*UsedIter < *OrigIter) return true; if (*UsedIter > *OrigIter) break; } return false; } void HandleMemberExpr(MemberExpr *ME, bool CheckReferenceOnly, bool AddressOf) { if (isa(ME->getMemberDecl())) return; // FieldME is the inner-most MemberExpr that is not an anonymous struct // or union. MemberExpr *FieldME = ME; bool AllPODFields = FieldME->getType().isPODType(S.Context); Expr *Base = ME; while (MemberExpr *SubME = dyn_cast(Base->IgnoreParenImpCasts())) { if (isa(SubME->getMemberDecl())) return; if (FieldDecl *FD = dyn_cast(SubME->getMemberDecl())) if (!FD->isAnonymousStructOrUnion()) FieldME = SubME; if (!FieldME->getType().isPODType(S.Context)) AllPODFields = false; Base = SubME->getBase(); } if (!isa(Base->IgnoreParenImpCasts())) return; if (AddressOf && AllPODFields) return; ValueDecl* FoundVD = FieldME->getMemberDecl(); if (ImplicitCastExpr *BaseCast = dyn_cast(Base)) { while (isa(BaseCast->getSubExpr())) { BaseCast = cast(BaseCast->getSubExpr()); } if (BaseCast->getCastKind() == CK_UncheckedDerivedToBase) { QualType T = BaseCast->getType(); if (T->isPointerType() && BaseClasses.count(T->getPointeeType())) { S.Diag(FieldME->getExprLoc(), diag::warn_base_class_is_uninit) << T->getPointeeType() << FoundVD; } } } if (!Decls.count(FoundVD)) return; const bool IsReference = FoundVD->getType()->isReferenceType(); if (InitList && !AddressOf && FoundVD == InitListFieldDecl) { // Special checking for initializer lists. if (IsInitListMemberExprInitialized(ME, CheckReferenceOnly)) { return; } } else { // Prevent double warnings on use of unbounded references. if (CheckReferenceOnly && !IsReference) return; } unsigned diag = IsReference ? diag::warn_reference_field_is_uninit : diag::warn_field_is_uninit; S.Diag(FieldME->getExprLoc(), diag) << FoundVD; if (Constructor) S.Diag(Constructor->getLocation(), diag::note_uninit_in_this_constructor) << (Constructor->isDefaultConstructor() && Constructor->isImplicit()); } void HandleValue(Expr *E, bool AddressOf) { E = E->IgnoreParens(); if (MemberExpr *ME = dyn_cast(E)) { HandleMemberExpr(ME, false /*CheckReferenceOnly*/, AddressOf /*AddressOf*/); return; } if (ConditionalOperator *CO = dyn_cast(E)) { Visit(CO->getCond()); HandleValue(CO->getTrueExpr(), AddressOf); HandleValue(CO->getFalseExpr(), AddressOf); return; } if (BinaryConditionalOperator *BCO = dyn_cast(E)) { Visit(BCO->getCond()); HandleValue(BCO->getFalseExpr(), AddressOf); return; } if (OpaqueValueExpr *OVE = dyn_cast(E)) { HandleValue(OVE->getSourceExpr(), AddressOf); return; } if (BinaryOperator *BO = dyn_cast(E)) { switch (BO->getOpcode()) { default: break; case(BO_PtrMemD): case(BO_PtrMemI): HandleValue(BO->getLHS(), AddressOf); Visit(BO->getRHS()); return; case(BO_Comma): Visit(BO->getLHS()); HandleValue(BO->getRHS(), AddressOf); return; } } Visit(E); } void CheckInitListExpr(InitListExpr *ILE) { InitFieldIndex.push_back(0); for (auto Child : ILE->children()) { if (InitListExpr *SubList = dyn_cast(Child)) { CheckInitListExpr(SubList); } else { Visit(Child); } ++InitFieldIndex.back(); } InitFieldIndex.pop_back(); } void CheckInitializer(Expr *E, const CXXConstructorDecl *FieldConstructor, FieldDecl *Field, const Type *BaseClass) { // Remove Decls that may have been initialized in the previous // initializer. for (ValueDecl* VD : DeclsToRemove) Decls.erase(VD); DeclsToRemove.clear(); Constructor = FieldConstructor; InitListExpr *ILE = dyn_cast(E); if (ILE && Field) { InitList = true; InitListFieldDecl = Field; InitFieldIndex.clear(); CheckInitListExpr(ILE); } else { InitList = false; Visit(E); } if (Field) Decls.erase(Field); if (BaseClass) BaseClasses.erase(BaseClass->getCanonicalTypeInternal()); } void VisitMemberExpr(MemberExpr *ME) { // All uses of unbounded reference fields will warn. HandleMemberExpr(ME, true /*CheckReferenceOnly*/, false /*AddressOf*/); } void VisitImplicitCastExpr(ImplicitCastExpr *E) { if (E->getCastKind() == CK_LValueToRValue) { HandleValue(E->getSubExpr(), false /*AddressOf*/); return; } Inherited::VisitImplicitCastExpr(E); } void VisitCXXConstructExpr(CXXConstructExpr *E) { if (E->getConstructor()->isCopyConstructor()) { Expr *ArgExpr = E->getArg(0); if (InitListExpr *ILE = dyn_cast(ArgExpr)) if (ILE->getNumInits() == 1) ArgExpr = ILE->getInit(0); if (ImplicitCastExpr *ICE = dyn_cast(ArgExpr)) if (ICE->getCastKind() == CK_NoOp) ArgExpr = ICE->getSubExpr(); HandleValue(ArgExpr, false /*AddressOf*/); return; } Inherited::VisitCXXConstructExpr(E); } void VisitCXXMemberCallExpr(CXXMemberCallExpr *E) { Expr *Callee = E->getCallee(); if (isa(Callee)) { HandleValue(Callee, false /*AddressOf*/); for (auto Arg : E->arguments()) Visit(Arg); return; } Inherited::VisitCXXMemberCallExpr(E); } void VisitCallExpr(CallExpr *E) { // Treat std::move as a use. if (E->isCallToStdMove()) { HandleValue(E->getArg(0), /*AddressOf=*/false); return; } Inherited::VisitCallExpr(E); } void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { Expr *Callee = E->getCallee(); if (isa(Callee)) return Inherited::VisitCXXOperatorCallExpr(E); Visit(Callee); for (auto Arg : E->arguments()) HandleValue(Arg->IgnoreParenImpCasts(), false /*AddressOf*/); } void VisitBinaryOperator(BinaryOperator *E) { // If a field assignment is detected, remove the field from the // uninitiailized field set. if (E->getOpcode() == BO_Assign) if (MemberExpr *ME = dyn_cast(E->getLHS())) if (FieldDecl *FD = dyn_cast(ME->getMemberDecl())) if (!FD->getType()->isReferenceType()) DeclsToRemove.push_back(FD); if (E->isCompoundAssignmentOp()) { HandleValue(E->getLHS(), false /*AddressOf*/); Visit(E->getRHS()); return; } Inherited::VisitBinaryOperator(E); } void VisitUnaryOperator(UnaryOperator *E) { if (E->isIncrementDecrementOp()) { HandleValue(E->getSubExpr(), false /*AddressOf*/); return; } if (E->getOpcode() == UO_AddrOf) { if (MemberExpr *ME = dyn_cast(E->getSubExpr())) { HandleValue(ME->getBase(), true /*AddressOf*/); return; } } Inherited::VisitUnaryOperator(E); } }; // Diagnose value-uses of fields to initialize themselves, e.g. // foo(foo) // where foo is not also a parameter to the constructor. // Also diagnose across field uninitialized use such as // x(y), y(x) // TODO: implement -Wuninitialized and fold this into that framework. static void DiagnoseUninitializedFields( Sema &SemaRef, const CXXConstructorDecl *Constructor) { if (SemaRef.getDiagnostics().isIgnored(diag::warn_field_is_uninit, Constructor->getLocation())) { return; } if (Constructor->isInvalidDecl()) return; const CXXRecordDecl *RD = Constructor->getParent(); if (RD->getDescribedClassTemplate()) return; // Holds fields that are uninitialized. llvm::SmallPtrSet UninitializedFields; // At the beginning, all fields are uninitialized. for (auto *I : RD->decls()) { if (auto *FD = dyn_cast(I)) { UninitializedFields.insert(FD); } else if (auto *IFD = dyn_cast(I)) { UninitializedFields.insert(IFD->getAnonField()); } } llvm::SmallPtrSet UninitializedBaseClasses; for (auto I : RD->bases()) UninitializedBaseClasses.insert(I.getType().getCanonicalType()); if (UninitializedFields.empty() && UninitializedBaseClasses.empty()) return; UninitializedFieldVisitor UninitializedChecker(SemaRef, UninitializedFields, UninitializedBaseClasses); for (const auto *FieldInit : Constructor->inits()) { if (UninitializedFields.empty() && UninitializedBaseClasses.empty()) break; Expr *InitExpr = FieldInit->getInit(); if (!InitExpr) continue; if (CXXDefaultInitExpr *Default = dyn_cast(InitExpr)) { InitExpr = Default->getExpr(); if (!InitExpr) continue; // In class initializers will point to the constructor. UninitializedChecker.CheckInitializer(InitExpr, Constructor, FieldInit->getAnyMember(), FieldInit->getBaseClass()); } else { UninitializedChecker.CheckInitializer(InitExpr, nullptr, FieldInit->getAnyMember(), FieldInit->getBaseClass()); } } } } // namespace /// Enter a new C++ default initializer scope. After calling this, the /// caller must call \ref ActOnFinishCXXInClassMemberInitializer, even if /// parsing or instantiating the initializer failed. void Sema::ActOnStartCXXInClassMemberInitializer() { // Create a synthetic function scope to represent the call to the constructor // that notionally surrounds a use of this initializer. PushFunctionScope(); } /// This is invoked after parsing an in-class initializer for a /// non-static C++ class member, and after instantiating an in-class initializer /// in a class template. Such actions are deferred until the class is complete. void Sema::ActOnFinishCXXInClassMemberInitializer(Decl *D, SourceLocation InitLoc, Expr *InitExpr) { // Pop the notional constructor scope we created earlier. PopFunctionScopeInfo(nullptr, D); FieldDecl *FD = dyn_cast(D); assert((isa(D) || FD->getInClassInitStyle() != ICIS_NoInit) && "must set init style when field is created"); if (!InitExpr) { D->setInvalidDecl(); if (FD) FD->removeInClassInitializer(); return; } if (DiagnoseUnexpandedParameterPack(InitExpr, UPPC_Initializer)) { FD->setInvalidDecl(); FD->removeInClassInitializer(); return; } ExprResult Init = InitExpr; if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) { InitializedEntity Entity = InitializedEntity::InitializeMemberFromDefaultMemberInitializer(FD); InitializationKind Kind = FD->getInClassInitStyle() == ICIS_ListInit ? InitializationKind::CreateDirectList(InitExpr->getBeginLoc(), InitExpr->getBeginLoc(), InitExpr->getEndLoc()) : InitializationKind::CreateCopy(InitExpr->getBeginLoc(), InitLoc); InitializationSequence Seq(*this, Entity, Kind, InitExpr); Init = Seq.Perform(*this, Entity, Kind, InitExpr); if (Init.isInvalid()) { FD->setInvalidDecl(); return; } } // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. Init = ActOnFinishFullExpr(Init.get(), InitLoc, /*DiscardedValue*/ false); if (Init.isInvalid()) { FD->setInvalidDecl(); return; } InitExpr = Init.get(); FD->setInClassInitializer(InitExpr); } /// Find the direct and/or virtual base specifiers that /// correspond to the given base type, for use in base initialization /// within a constructor. static bool FindBaseInitializer(Sema &SemaRef, CXXRecordDecl *ClassDecl, QualType BaseType, const CXXBaseSpecifier *&DirectBaseSpec, const CXXBaseSpecifier *&VirtualBaseSpec) { // First, check for a direct base class. DirectBaseSpec = nullptr; for (const auto &Base : ClassDecl->bases()) { if (SemaRef.Context.hasSameUnqualifiedType(BaseType, Base.getType())) { // We found a direct base of this type. That's what we're // initializing. DirectBaseSpec = &Base; break; } } // Check for a virtual base class. // FIXME: We might be able to short-circuit this if we know in advance that // there are no virtual bases. VirtualBaseSpec = nullptr; if (!DirectBaseSpec || !DirectBaseSpec->isVirtual()) { // We haven't found a base yet; search the class hierarchy for a // virtual base class. CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, /*DetectVirtual=*/false); if (SemaRef.IsDerivedFrom(ClassDecl->getLocation(), SemaRef.Context.getTypeDeclType(ClassDecl), BaseType, Paths)) { for (CXXBasePaths::paths_iterator Path = Paths.begin(); Path != Paths.end(); ++Path) { if (Path->back().Base->isVirtual()) { VirtualBaseSpec = Path->back().Base; break; } } } } return DirectBaseSpec || VirtualBaseSpec; } /// Handle a C++ member initializer using braced-init-list syntax. MemInitResult Sema::ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *InitList, SourceLocation EllipsisLoc) { return BuildMemInitializer(ConstructorD, S, SS, MemberOrBase, TemplateTypeTy, DS, IdLoc, InitList, EllipsisLoc); } /// Handle a C++ member initializer using parentheses syntax. MemInitResult Sema::ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, ArrayRef Args, SourceLocation RParenLoc, SourceLocation EllipsisLoc) { Expr *List = ParenListExpr::Create(Context, LParenLoc, Args, RParenLoc); return BuildMemInitializer(ConstructorD, S, SS, MemberOrBase, TemplateTypeTy, DS, IdLoc, List, EllipsisLoc); } namespace { // Callback to only accept typo corrections that can be a valid C++ member // intializer: either a non-static field member or a base class. class MemInitializerValidatorCCC final : public CorrectionCandidateCallback { public: explicit MemInitializerValidatorCCC(CXXRecordDecl *ClassDecl) : ClassDecl(ClassDecl) {} bool ValidateCandidate(const TypoCorrection &candidate) override { if (NamedDecl *ND = candidate.getCorrectionDecl()) { if (FieldDecl *Member = dyn_cast(ND)) return Member->getDeclContext()->getRedeclContext()->Equals(ClassDecl); return isa(ND); } return false; } std::unique_ptr clone() override { return llvm::make_unique(*this); } private: CXXRecordDecl *ClassDecl; }; } ValueDecl *Sema::tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl, CXXScopeSpec &SS, ParsedType TemplateTypeTy, IdentifierInfo *MemberOrBase) { if (SS.getScopeRep() || TemplateTypeTy) return nullptr; DeclContext::lookup_result Result = ClassDecl->lookup(MemberOrBase); if (Result.empty()) return nullptr; ValueDecl *Member; if ((Member = dyn_cast(Result.front())) || (Member = dyn_cast(Result.front()))) return Member; return nullptr; } /// Handle a C++ member initializer. MemInitResult Sema::BuildMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *Init, SourceLocation EllipsisLoc) { ExprResult Res = CorrectDelayedTyposInExpr(Init); if (!Res.isUsable()) return true; Init = Res.get(); if (!ConstructorD) return true; AdjustDeclIfTemplate(ConstructorD); CXXConstructorDecl *Constructor = dyn_cast(ConstructorD); if (!Constructor) { // The user wrote a constructor initializer on a function that is // not a C++ constructor. Ignore the error for now, because we may // have more member initializers coming; we'll diagnose it just // once in ActOnMemInitializers. return true; } CXXRecordDecl *ClassDecl = Constructor->getParent(); // C++ [class.base.init]p2: // Names in a mem-initializer-id are looked up in the scope of the // constructor's class and, if not found in that scope, are looked // up in the scope containing the constructor's definition. // [Note: if the constructor's class contains a member with the // same name as a direct or virtual base class of the class, a // mem-initializer-id naming the member or base class and composed // of a single identifier refers to the class member. A // mem-initializer-id for the hidden base class may be specified // using a qualified name. ] // Look for a member, first. if (ValueDecl *Member = tryLookupCtorInitMemberDecl( ClassDecl, SS, TemplateTypeTy, MemberOrBase)) { if (EllipsisLoc.isValid()) Diag(EllipsisLoc, diag::err_pack_expansion_member_init) << MemberOrBase << SourceRange(IdLoc, Init->getSourceRange().getEnd()); return BuildMemberInitializer(Member, Init, IdLoc); } // It didn't name a member, so see if it names a class. QualType BaseType; TypeSourceInfo *TInfo = nullptr; if (TemplateTypeTy) { BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo); if (BaseType.isNull()) return true; } else if (DS.getTypeSpecType() == TST_decltype) { BaseType = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc()); } else if (DS.getTypeSpecType() == TST_decltype_auto) { Diag(DS.getTypeSpecTypeLoc(), diag::err_decltype_auto_invalid); return true; } else { LookupResult R(*this, MemberOrBase, IdLoc, LookupOrdinaryName); LookupParsedName(R, S, &SS); TypeDecl *TyD = R.getAsSingle(); if (!TyD) { if (R.isAmbiguous()) return true; // We don't want access-control diagnostics here. R.suppressDiagnostics(); if (SS.isSet() && isDependentScopeSpecifier(SS)) { bool NotUnknownSpecialization = false; DeclContext *DC = computeDeclContext(SS, false); if (CXXRecordDecl *Record = dyn_cast_or_null(DC)) NotUnknownSpecialization = !Record->hasAnyDependentBases(); if (!NotUnknownSpecialization) { // When the scope specifier can refer to a member of an unknown // specialization, we take it as a type name. BaseType = CheckTypenameType(ETK_None, SourceLocation(), SS.getWithLocInContext(Context), *MemberOrBase, IdLoc); if (BaseType.isNull()) return true; TInfo = Context.CreateTypeSourceInfo(BaseType); DependentNameTypeLoc TL = TInfo->getTypeLoc().castAs(); if (!TL.isNull()) { TL.setNameLoc(IdLoc); TL.setElaboratedKeywordLoc(SourceLocation()); TL.setQualifierLoc(SS.getWithLocInContext(Context)); } R.clear(); R.setLookupName(MemberOrBase); } } // If no results were found, try to correct typos. TypoCorrection Corr; MemInitializerValidatorCCC CCC(ClassDecl); if (R.empty() && BaseType.isNull() && (Corr = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, &SS, CCC, CTK_ErrorRecovery, ClassDecl))) { if (FieldDecl *Member = Corr.getCorrectionDeclAs()) { // We have found a non-static data member with a similar // name to what was typed; complain and initialize that // member. diagnoseTypo(Corr, PDiag(diag::err_mem_init_not_member_or_class_suggest) << MemberOrBase << true); return BuildMemberInitializer(Member, Init, IdLoc); } else if (TypeDecl *Type = Corr.getCorrectionDeclAs()) { const CXXBaseSpecifier *DirectBaseSpec; const CXXBaseSpecifier *VirtualBaseSpec; if (FindBaseInitializer(*this, ClassDecl, Context.getTypeDeclType(Type), DirectBaseSpec, VirtualBaseSpec)) { // We have found a direct or virtual base class with a // similar name to what was typed; complain and initialize // that base class. diagnoseTypo(Corr, PDiag(diag::err_mem_init_not_member_or_class_suggest) << MemberOrBase << false, PDiag() /*Suppress note, we provide our own.*/); const CXXBaseSpecifier *BaseSpec = DirectBaseSpec ? DirectBaseSpec : VirtualBaseSpec; Diag(BaseSpec->getBeginLoc(), diag::note_base_class_specified_here) << BaseSpec->getType() << BaseSpec->getSourceRange(); TyD = Type; } } } if (!TyD && BaseType.isNull()) { Diag(IdLoc, diag::err_mem_init_not_member_or_class) << MemberOrBase << SourceRange(IdLoc,Init->getSourceRange().getEnd()); return true; } } if (BaseType.isNull()) { BaseType = Context.getTypeDeclType(TyD); MarkAnyDeclReferenced(TyD->getLocation(), TyD, /*OdrUse=*/false); if (SS.isSet()) { BaseType = Context.getElaboratedType(ETK_None, SS.getScopeRep(), BaseType); TInfo = Context.CreateTypeSourceInfo(BaseType); ElaboratedTypeLoc TL = TInfo->getTypeLoc().castAs(); TL.getNamedTypeLoc().castAs().setNameLoc(IdLoc); TL.setElaboratedKeywordLoc(SourceLocation()); TL.setQualifierLoc(SS.getWithLocInContext(Context)); } } } if (!TInfo) TInfo = Context.getTrivialTypeSourceInfo(BaseType, IdLoc); return BuildBaseInitializer(BaseType, TInfo, Init, ClassDecl, EllipsisLoc); } MemInitResult Sema::BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc) { FieldDecl *DirectMember = dyn_cast(Member); IndirectFieldDecl *IndirectMember = dyn_cast(Member); assert((DirectMember || IndirectMember) && "Member must be a FieldDecl or IndirectFieldDecl"); if (DiagnoseUnexpandedParameterPack(Init, UPPC_Initializer)) return true; if (Member->isInvalidDecl()) return true; MultiExprArg Args; if (ParenListExpr *ParenList = dyn_cast(Init)) { Args = MultiExprArg(ParenList->getExprs(), ParenList->getNumExprs()); } else if (InitListExpr *InitList = dyn_cast(Init)) { Args = MultiExprArg(InitList->getInits(), InitList->getNumInits()); } else { // Template instantiation doesn't reconstruct ParenListExprs for us. Args = Init; } SourceRange InitRange = Init->getSourceRange(); if (Member->getType()->isDependentType() || Init->isTypeDependent()) { // Can't check initialization for a member of dependent type or when // any of the arguments are type-dependent expressions. DiscardCleanupsInEvaluationContext(); } else { bool InitList = false; if (isa(Init)) { InitList = true; Args = Init; } // Initialize the member. InitializedEntity MemberEntity = DirectMember ? InitializedEntity::InitializeMember(DirectMember, nullptr) : InitializedEntity::InitializeMember(IndirectMember, nullptr); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList( IdLoc, Init->getBeginLoc(), Init->getEndLoc()) : InitializationKind::CreateDirect(IdLoc, InitRange.getBegin(), InitRange.getEnd()); InitializationSequence InitSeq(*this, MemberEntity, Kind, Args); ExprResult MemberInit = InitSeq.Perform(*this, MemberEntity, Kind, Args, nullptr); if (MemberInit.isInvalid()) return true; // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. MemberInit = ActOnFinishFullExpr(MemberInit.get(), InitRange.getBegin(), /*DiscardedValue*/ false); if (MemberInit.isInvalid()) return true; Init = MemberInit.get(); } if (DirectMember) { return new (Context) CXXCtorInitializer(Context, DirectMember, IdLoc, InitRange.getBegin(), Init, InitRange.getEnd()); } else { return new (Context) CXXCtorInitializer(Context, IndirectMember, IdLoc, InitRange.getBegin(), Init, InitRange.getEnd()); } } MemInitResult Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl) { SourceLocation NameLoc = TInfo->getTypeLoc().getLocalSourceRange().getBegin(); if (!LangOpts.CPlusPlus11) return Diag(NameLoc, diag::err_delegating_ctor) << TInfo->getTypeLoc().getLocalSourceRange(); Diag(NameLoc, diag::warn_cxx98_compat_delegating_ctor); bool InitList = true; MultiExprArg Args = Init; if (ParenListExpr *ParenList = dyn_cast(Init)) { InitList = false; Args = MultiExprArg(ParenList->getExprs(), ParenList->getNumExprs()); } SourceRange InitRange = Init->getSourceRange(); // Initialize the object. InitializedEntity DelegationEntity = InitializedEntity::InitializeDelegation( QualType(ClassDecl->getTypeForDecl(), 0)); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList( NameLoc, Init->getBeginLoc(), Init->getEndLoc()) : InitializationKind::CreateDirect(NameLoc, InitRange.getBegin(), InitRange.getEnd()); InitializationSequence InitSeq(*this, DelegationEntity, Kind, Args); ExprResult DelegationInit = InitSeq.Perform(*this, DelegationEntity, Kind, Args, nullptr); if (DelegationInit.isInvalid()) return true; assert(cast(DelegationInit.get())->getConstructor() && "Delegating constructor with no target?"); // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. DelegationInit = ActOnFinishFullExpr( DelegationInit.get(), InitRange.getBegin(), /*DiscardedValue*/ false); if (DelegationInit.isInvalid()) return true; // If we are in a dependent context, template instantiation will // perform this type-checking again. Just save the arguments that we // received in a ParenListExpr. // FIXME: This isn't quite ideal, since our ASTs don't capture all // of the information that we have about the base // initializer. However, deconstructing the ASTs is a dicey process, // and this approach is far more likely to get the corner cases right. if (CurContext->isDependentContext()) DelegationInit = Init; return new (Context) CXXCtorInitializer(Context, TInfo, InitRange.getBegin(), DelegationInit.getAs(), InitRange.getEnd()); } MemInitResult Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc) { SourceLocation BaseLoc = BaseTInfo->getTypeLoc().getLocalSourceRange().getBegin(); if (!BaseType->isDependentType() && !BaseType->isRecordType()) return Diag(BaseLoc, diag::err_base_init_does_not_name_class) << BaseType << BaseTInfo->getTypeLoc().getLocalSourceRange(); // C++ [class.base.init]p2: // [...] Unless the mem-initializer-id names a nonstatic data // member of the constructor's class or a direct or virtual base // of that class, the mem-initializer is ill-formed. A // mem-initializer-list can initialize a base class using any // name that denotes that base class type. bool Dependent = BaseType->isDependentType() || Init->isTypeDependent(); SourceRange InitRange = Init->getSourceRange(); if (EllipsisLoc.isValid()) { // This is a pack expansion. if (!BaseType->containsUnexpandedParameterPack()) { Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs) << SourceRange(BaseLoc, InitRange.getEnd()); EllipsisLoc = SourceLocation(); } } else { // Check for any unexpanded parameter packs. if (DiagnoseUnexpandedParameterPack(BaseLoc, BaseTInfo, UPPC_Initializer)) return true; if (DiagnoseUnexpandedParameterPack(Init, UPPC_Initializer)) return true; } // Check for direct and virtual base classes. const CXXBaseSpecifier *DirectBaseSpec = nullptr; const CXXBaseSpecifier *VirtualBaseSpec = nullptr; if (!Dependent) { if (Context.hasSameUnqualifiedType(QualType(ClassDecl->getTypeForDecl(),0), BaseType)) return BuildDelegatingInitializer(BaseTInfo, Init, ClassDecl); FindBaseInitializer(*this, ClassDecl, BaseType, DirectBaseSpec, VirtualBaseSpec); // C++ [base.class.init]p2: // Unless the mem-initializer-id names a nonstatic data member of the // constructor's class or a direct or virtual base of that class, the // mem-initializer is ill-formed. if (!DirectBaseSpec && !VirtualBaseSpec) { // If the class has any dependent bases, then it's possible that // one of those types will resolve to the same type as // BaseType. Therefore, just treat this as a dependent base // class initialization. FIXME: Should we try to check the // initialization anyway? It seems odd. if (ClassDecl->hasAnyDependentBases()) Dependent = true; else return Diag(BaseLoc, diag::err_not_direct_base_or_virtual) << BaseType << Context.getTypeDeclType(ClassDecl) << BaseTInfo->getTypeLoc().getLocalSourceRange(); } } if (Dependent) { DiscardCleanupsInEvaluationContext(); return new (Context) CXXCtorInitializer(Context, BaseTInfo, /*IsVirtual=*/false, InitRange.getBegin(), Init, InitRange.getEnd(), EllipsisLoc); } // C++ [base.class.init]p2: // If a mem-initializer-id is ambiguous because it designates both // a direct non-virtual base class and an inherited virtual base // class, the mem-initializer is ill-formed. if (DirectBaseSpec && VirtualBaseSpec) return Diag(BaseLoc, diag::err_base_init_direct_and_virtual) << BaseType << BaseTInfo->getTypeLoc().getLocalSourceRange(); const CXXBaseSpecifier *BaseSpec = DirectBaseSpec; if (!BaseSpec) BaseSpec = VirtualBaseSpec; // Initialize the base. bool InitList = true; MultiExprArg Args = Init; if (ParenListExpr *ParenList = dyn_cast(Init)) { InitList = false; Args = MultiExprArg(ParenList->getExprs(), ParenList->getNumExprs()); } InitializedEntity BaseEntity = InitializedEntity::InitializeBase(Context, BaseSpec, VirtualBaseSpec); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList(BaseLoc) : InitializationKind::CreateDirect(BaseLoc, InitRange.getBegin(), InitRange.getEnd()); InitializationSequence InitSeq(*this, BaseEntity, Kind, Args); ExprResult BaseInit = InitSeq.Perform(*this, BaseEntity, Kind, Args, nullptr); if (BaseInit.isInvalid()) return true; // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. BaseInit = ActOnFinishFullExpr(BaseInit.get(), InitRange.getBegin(), /*DiscardedValue*/ false); if (BaseInit.isInvalid()) return true; // If we are in a dependent context, template instantiation will // perform this type-checking again. Just save the arguments that we // received in a ParenListExpr. // FIXME: This isn't quite ideal, since our ASTs don't capture all // of the information that we have about the base // initializer. However, deconstructing the ASTs is a dicey process, // and this approach is far more likely to get the corner cases right. if (CurContext->isDependentContext()) BaseInit = Init; return new (Context) CXXCtorInitializer(Context, BaseTInfo, BaseSpec->isVirtual(), InitRange.getBegin(), BaseInit.getAs(), InitRange.getEnd(), EllipsisLoc); } // Create a static_cast\(expr). static Expr *CastForMoving(Sema &SemaRef, Expr *E, QualType T = QualType()) { if (T.isNull()) T = E->getType(); QualType TargetType = SemaRef.BuildReferenceType( T, /*SpelledAsLValue*/false, SourceLocation(), DeclarationName()); SourceLocation ExprLoc = E->getBeginLoc(); TypeSourceInfo *TargetLoc = SemaRef.Context.getTrivialTypeSourceInfo( TargetType, ExprLoc); return SemaRef.BuildCXXNamedCast(ExprLoc, tok::kw_static_cast, TargetLoc, E, SourceRange(ExprLoc, ExprLoc), E->getSourceRange()).get(); } /// ImplicitInitializerKind - How an implicit base or member initializer should /// initialize its base or member. enum ImplicitInitializerKind { IIK_Default, IIK_Copy, IIK_Move, IIK_Inherit }; static bool BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, ImplicitInitializerKind ImplicitInitKind, CXXBaseSpecifier *BaseSpec, bool IsInheritedVirtualBase, CXXCtorInitializer *&CXXBaseInit) { InitializedEntity InitEntity = InitializedEntity::InitializeBase(SemaRef.Context, BaseSpec, IsInheritedVirtualBase); ExprResult BaseInit; switch (ImplicitInitKind) { case IIK_Inherit: case IIK_Default: { InitializationKind InitKind = InitializationKind::CreateDefault(Constructor->getLocation()); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, None); BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, None); break; } case IIK_Move: case IIK_Copy: { bool Moving = ImplicitInitKind == IIK_Move; ParmVarDecl *Param = Constructor->getParamDecl(0); QualType ParamType = Param->getType().getNonReferenceType(); Expr *CopyCtorArg = DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(), SourceLocation(), Param, false, Constructor->getLocation(), ParamType, VK_LValue, nullptr); SemaRef.MarkDeclRefReferenced(cast(CopyCtorArg)); // Cast to the base class to avoid ambiguities. QualType ArgTy = SemaRef.Context.getQualifiedType(BaseSpec->getType().getUnqualifiedType(), ParamType.getQualifiers()); if (Moving) { CopyCtorArg = CastForMoving(SemaRef, CopyCtorArg); } CXXCastPath BasePath; BasePath.push_back(BaseSpec); CopyCtorArg = SemaRef.ImpCastExprToType(CopyCtorArg, ArgTy, CK_UncheckedDerivedToBase, Moving ? VK_XValue : VK_LValue, &BasePath).get(); InitializationKind InitKind = InitializationKind::CreateDirect(Constructor->getLocation(), SourceLocation(), SourceLocation()); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, CopyCtorArg); BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, CopyCtorArg); break; } } BaseInit = SemaRef.MaybeCreateExprWithCleanups(BaseInit); if (BaseInit.isInvalid()) return true; CXXBaseInit = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, SemaRef.Context.getTrivialTypeSourceInfo(BaseSpec->getType(), SourceLocation()), BaseSpec->isVirtual(), SourceLocation(), BaseInit.getAs(), SourceLocation(), SourceLocation()); return false; } static bool RefersToRValueRef(Expr *MemRef) { ValueDecl *Referenced = cast(MemRef)->getMemberDecl(); return Referenced->getType()->isRValueReferenceType(); } static bool BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, ImplicitInitializerKind ImplicitInitKind, FieldDecl *Field, IndirectFieldDecl *Indirect, CXXCtorInitializer *&CXXMemberInit) { if (Field->isInvalidDecl()) return true; SourceLocation Loc = Constructor->getLocation(); if (ImplicitInitKind == IIK_Copy || ImplicitInitKind == IIK_Move) { bool Moving = ImplicitInitKind == IIK_Move; ParmVarDecl *Param = Constructor->getParamDecl(0); QualType ParamType = Param->getType().getNonReferenceType(); // Suppress copying zero-width bitfields. if (Field->isZeroLengthBitField(SemaRef.Context)) return false; Expr *MemberExprBase = DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(), SourceLocation(), Param, false, Loc, ParamType, VK_LValue, nullptr); SemaRef.MarkDeclRefReferenced(cast(MemberExprBase)); if (Moving) { MemberExprBase = CastForMoving(SemaRef, MemberExprBase); } // Build a reference to this field within the parameter. CXXScopeSpec SS; LookupResult MemberLookup(SemaRef, Field->getDeclName(), Loc, Sema::LookupMemberName); MemberLookup.addDecl(Indirect ? cast(Indirect) : cast(Field), AS_public); MemberLookup.resolveKind(); ExprResult CtorArg = SemaRef.BuildMemberReferenceExpr(MemberExprBase, ParamType, Loc, /*IsArrow=*/false, SS, /*TemplateKWLoc=*/SourceLocation(), /*FirstQualifierInScope=*/nullptr, MemberLookup, /*TemplateArgs=*/nullptr, /*S*/nullptr); if (CtorArg.isInvalid()) return true; // C++11 [class.copy]p15: // - if a member m has rvalue reference type T&&, it is direct-initialized // with static_cast(x.m); if (RefersToRValueRef(CtorArg.get())) { CtorArg = CastForMoving(SemaRef, CtorArg.get()); } InitializedEntity Entity = Indirect ? InitializedEntity::InitializeMember(Indirect, nullptr, /*Implicit*/ true) : InitializedEntity::InitializeMember(Field, nullptr, /*Implicit*/ true); // Direct-initialize to use the copy constructor. InitializationKind InitKind = InitializationKind::CreateDirect(Loc, SourceLocation(), SourceLocation()); Expr *CtorArgE = CtorArg.getAs(); InitializationSequence InitSeq(SemaRef, Entity, InitKind, CtorArgE); ExprResult MemberInit = InitSeq.Perform(SemaRef, Entity, InitKind, MultiExprArg(&CtorArgE, 1)); MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit); if (MemberInit.isInvalid()) return true; if (Indirect) CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer( SemaRef.Context, Indirect, Loc, Loc, MemberInit.getAs(), Loc); else CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer( SemaRef.Context, Field, Loc, Loc, MemberInit.getAs(), Loc); return false; } assert((ImplicitInitKind == IIK_Default || ImplicitInitKind == IIK_Inherit) && "Unhandled implicit init kind!"); QualType FieldBaseElementType = SemaRef.Context.getBaseElementType(Field->getType()); if (FieldBaseElementType->isRecordType()) { InitializedEntity InitEntity = Indirect ? InitializedEntity::InitializeMember(Indirect, nullptr, /*Implicit*/ true) : InitializedEntity::InitializeMember(Field, nullptr, /*Implicit*/ true); InitializationKind InitKind = InitializationKind::CreateDefault(Loc); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, None); ExprResult MemberInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, None); MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit); if (MemberInit.isInvalid()) return true; if (Indirect) CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Indirect, Loc, Loc, MemberInit.get(), Loc); else CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Field, Loc, Loc, MemberInit.get(), Loc); return false; } if (!Field->getParent()->isUnion()) { if (FieldBaseElementType->isReferenceType()) { SemaRef.Diag(Constructor->getLocation(), diag::err_uninitialized_member_in_ctor) << (int)Constructor->isImplicit() << SemaRef.Context.getTagDeclType(Constructor->getParent()) << 0 << Field->getDeclName(); SemaRef.Diag(Field->getLocation(), diag::note_declared_at); return true; } if (FieldBaseElementType.isConstQualified()) { SemaRef.Diag(Constructor->getLocation(), diag::err_uninitialized_member_in_ctor) << (int)Constructor->isImplicit() << SemaRef.Context.getTagDeclType(Constructor->getParent()) << 1 << Field->getDeclName(); SemaRef.Diag(Field->getLocation(), diag::note_declared_at); return true; } } if (FieldBaseElementType.hasNonTrivialObjCLifetime()) { // ARC and Weak: // Default-initialize Objective-C pointers to NULL. CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Field, Loc, Loc, new (SemaRef.Context) ImplicitValueInitExpr(Field->getType()), Loc); return false; } // Nothing to initialize. CXXMemberInit = nullptr; return false; } namespace { struct BaseAndFieldInfo { Sema &S; CXXConstructorDecl *Ctor; bool AnyErrorsInInits; ImplicitInitializerKind IIK; llvm::DenseMap AllBaseFields; SmallVector AllToInit; llvm::DenseMap ActiveUnionMember; BaseAndFieldInfo(Sema &S, CXXConstructorDecl *Ctor, bool ErrorsInInits) : S(S), Ctor(Ctor), AnyErrorsInInits(ErrorsInInits) { bool Generated = Ctor->isImplicit() || Ctor->isDefaulted(); if (Ctor->getInheritedConstructor()) IIK = IIK_Inherit; else if (Generated && Ctor->isCopyConstructor()) IIK = IIK_Copy; else if (Generated && Ctor->isMoveConstructor()) IIK = IIK_Move; else IIK = IIK_Default; } bool isImplicitCopyOrMove() const { switch (IIK) { case IIK_Copy: case IIK_Move: return true; case IIK_Default: case IIK_Inherit: return false; } llvm_unreachable("Invalid ImplicitInitializerKind!"); } bool addFieldInitializer(CXXCtorInitializer *Init) { AllToInit.push_back(Init); // Check whether this initializer makes the field "used". if (Init->getInit()->HasSideEffects(S.Context)) S.UnusedPrivateFields.remove(Init->getAnyMember()); return false; } bool isInactiveUnionMember(FieldDecl *Field) { RecordDecl *Record = Field->getParent(); if (!Record->isUnion()) return false; if (FieldDecl *Active = ActiveUnionMember.lookup(Record->getCanonicalDecl())) return Active != Field->getCanonicalDecl(); // In an implicit copy or move constructor, ignore any in-class initializer. if (isImplicitCopyOrMove()) return true; // If there's no explicit initialization, the field is active only if it // has an in-class initializer... if (Field->hasInClassInitializer()) return false; // ... or it's an anonymous struct or union whose class has an in-class // initializer. if (!Field->isAnonymousStructOrUnion()) return true; CXXRecordDecl *FieldRD = Field->getType()->getAsCXXRecordDecl(); return !FieldRD->hasInClassInitializer(); } /// Determine whether the given field is, or is within, a union member /// that is inactive (because there was an initializer given for a different /// member of the union, or because the union was not initialized at all). bool isWithinInactiveUnionMember(FieldDecl *Field, IndirectFieldDecl *Indirect) { if (!Indirect) return isInactiveUnionMember(Field); for (auto *C : Indirect->chain()) { FieldDecl *Field = dyn_cast(C); if (Field && isInactiveUnionMember(Field)) return true; } return false; } }; } /// Determine whether the given type is an incomplete or zero-lenfgth /// array type. static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T) { if (T->isIncompleteArrayType()) return true; while (const ConstantArrayType *ArrayT = Context.getAsConstantArrayType(T)) { if (!ArrayT->getSize()) return true; T = ArrayT->getElementType(); } return false; } static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info, FieldDecl *Field, IndirectFieldDecl *Indirect = nullptr) { if (Field->isInvalidDecl()) return false; // Overwhelmingly common case: we have a direct initializer for this field. if (CXXCtorInitializer *Init = Info.AllBaseFields.lookup(Field->getCanonicalDecl())) return Info.addFieldInitializer(Init); // C++11 [class.base.init]p8: // if the entity is a non-static data member that has a // brace-or-equal-initializer and either // -- the constructor's class is a union and no other variant member of that // union is designated by a mem-initializer-id or // -- the constructor's class is not a union, and, if the entity is a member // of an anonymous union, no other member of that union is designated by // a mem-initializer-id, // the entity is initialized as specified in [dcl.init]. // // We also apply the same rules to handle anonymous structs within anonymous // unions. if (Info.isWithinInactiveUnionMember(Field, Indirect)) return false; if (Field->hasInClassInitializer() && !Info.isImplicitCopyOrMove()) { ExprResult DIE = SemaRef.BuildCXXDefaultInitExpr(Info.Ctor->getLocation(), Field); if (DIE.isInvalid()) return true; auto Entity = InitializedEntity::InitializeMember(Field, nullptr, true); SemaRef.checkInitializerLifetime(Entity, DIE.get()); CXXCtorInitializer *Init; if (Indirect) Init = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Indirect, SourceLocation(), SourceLocation(), DIE.get(), SourceLocation()); else Init = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Field, SourceLocation(), SourceLocation(), DIE.get(), SourceLocation()); return Info.addFieldInitializer(Init); } // Don't initialize incomplete or zero-length arrays. if (isIncompleteOrZeroLengthArrayType(SemaRef.Context, Field->getType())) return false; // Don't try to build an implicit initializer if there were semantic // errors in any of the initializers (and therefore we might be // missing some that the user actually wrote). if (Info.AnyErrorsInInits) return false; CXXCtorInitializer *Init = nullptr; if (BuildImplicitMemberInitializer(Info.S, Info.Ctor, Info.IIK, Field, Indirect, Init)) return true; if (!Init) return false; return Info.addFieldInitializer(Init); } bool Sema::SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer) { assert(Initializer->isDelegatingInitializer()); Constructor->setNumCtorInitializers(1); CXXCtorInitializer **initializer = new (Context) CXXCtorInitializer*[1]; memcpy(initializer, &Initializer, sizeof (CXXCtorInitializer*)); Constructor->setCtorInitializers(initializer); if (CXXDestructorDecl *Dtor = LookupDestructor(Constructor->getParent())) { MarkFunctionReferenced(Initializer->getSourceLocation(), Dtor); DiagnoseUseOfDecl(Dtor, Initializer->getSourceLocation()); } DelegatingCtorDecls.push_back(Constructor); DiagnoseUninitializedFields(*this, Constructor); return false; } bool Sema::SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef Initializers) { if (Constructor->isDependentContext()) { // Just store the initializers as written, they will be checked during // instantiation. if (!Initializers.empty()) { Constructor->setNumCtorInitializers(Initializers.size()); CXXCtorInitializer **baseOrMemberInitializers = new (Context) CXXCtorInitializer*[Initializers.size()]; memcpy(baseOrMemberInitializers, Initializers.data(), Initializers.size() * sizeof(CXXCtorInitializer*)); Constructor->setCtorInitializers(baseOrMemberInitializers); } // Let template instantiation know whether we had errors. if (AnyErrors) Constructor->setInvalidDecl(); return false; } BaseAndFieldInfo Info(*this, Constructor, AnyErrors); // We need to build the initializer AST according to order of construction // and not what user specified in the Initializers list. CXXRecordDecl *ClassDecl = Constructor->getParent()->getDefinition(); if (!ClassDecl) return true; bool HadError = false; for (unsigned i = 0; i < Initializers.size(); i++) { CXXCtorInitializer *Member = Initializers[i]; if (Member->isBaseInitializer()) Info.AllBaseFields[Member->getBaseClass()->getAs()] = Member; else { Info.AllBaseFields[Member->getAnyMember()->getCanonicalDecl()] = Member; if (IndirectFieldDecl *F = Member->getIndirectMember()) { for (auto *C : F->chain()) { FieldDecl *FD = dyn_cast(C); if (FD && FD->getParent()->isUnion()) Info.ActiveUnionMember.insert(std::make_pair( FD->getParent()->getCanonicalDecl(), FD->getCanonicalDecl())); } } else if (FieldDecl *FD = Member->getMember()) { if (FD->getParent()->isUnion()) Info.ActiveUnionMember.insert(std::make_pair( FD->getParent()->getCanonicalDecl(), FD->getCanonicalDecl())); } } } // Keep track of the direct virtual bases. llvm::SmallPtrSet DirectVBases; for (auto &I : ClassDecl->bases()) { if (I.isVirtual()) DirectVBases.insert(&I); } // Push virtual bases before others. for (auto &VBase : ClassDecl->vbases()) { if (CXXCtorInitializer *Value = Info.AllBaseFields.lookup(VBase.getType()->getAs())) { // [class.base.init]p7, per DR257: // A mem-initializer where the mem-initializer-id names a virtual base // class is ignored during execution of a constructor of any class that // is not the most derived class. if (ClassDecl->isAbstract()) { // FIXME: Provide a fixit to remove the base specifier. This requires // tracking the location of the associated comma for a base specifier. Diag(Value->getSourceLocation(), diag::warn_abstract_vbase_init_ignored) << VBase.getType() << ClassDecl; DiagnoseAbstractType(ClassDecl); } Info.AllToInit.push_back(Value); } else if (!AnyErrors && !ClassDecl->isAbstract()) { // [class.base.init]p8, per DR257: // If a given [...] base class is not named by a mem-initializer-id // [...] and the entity is not a virtual base class of an abstract // class, then [...] the entity is default-initialized. bool IsInheritedVirtualBase = !DirectVBases.count(&VBase); CXXCtorInitializer *CXXBaseInit; if (BuildImplicitBaseInitializer(*this, Constructor, Info.IIK, &VBase, IsInheritedVirtualBase, CXXBaseInit)) { HadError = true; continue; } Info.AllToInit.push_back(CXXBaseInit); } } // Non-virtual bases. for (auto &Base : ClassDecl->bases()) { // Virtuals are in the virtual base list and already constructed. if (Base.isVirtual()) continue; if (CXXCtorInitializer *Value = Info.AllBaseFields.lookup(Base.getType()->getAs())) { Info.AllToInit.push_back(Value); } else if (!AnyErrors) { CXXCtorInitializer *CXXBaseInit; if (BuildImplicitBaseInitializer(*this, Constructor, Info.IIK, &Base, /*IsInheritedVirtualBase=*/false, CXXBaseInit)) { HadError = true; continue; } Info.AllToInit.push_back(CXXBaseInit); } } // Fields. for (auto *Mem : ClassDecl->decls()) { if (auto *F = dyn_cast(Mem)) { // C++ [class.bit]p2: // A declaration for a bit-field that omits the identifier declares an // unnamed bit-field. Unnamed bit-fields are not members and cannot be // initialized. if (F->isUnnamedBitfield()) continue; // If we're not generating the implicit copy/move constructor, then we'll // handle anonymous struct/union fields based on their individual // indirect fields. if (F->isAnonymousStructOrUnion() && !Info.isImplicitCopyOrMove()) continue; if (CollectFieldInitializer(*this, Info, F)) HadError = true; continue; } // Beyond this point, we only consider default initialization. if (Info.isImplicitCopyOrMove()) continue; if (auto *F = dyn_cast(Mem)) { if (F->getType()->isIncompleteArrayType()) { assert(ClassDecl->hasFlexibleArrayMember() && "Incomplete array type is not valid"); continue; } // Initialize each field of an anonymous struct individually. if (CollectFieldInitializer(*this, Info, F->getAnonField(), F)) HadError = true; continue; } } unsigned NumInitializers = Info.AllToInit.size(); if (NumInitializers > 0) { Constructor->setNumCtorInitializers(NumInitializers); CXXCtorInitializer **baseOrMemberInitializers = new (Context) CXXCtorInitializer*[NumInitializers]; memcpy(baseOrMemberInitializers, Info.AllToInit.data(), NumInitializers * sizeof(CXXCtorInitializer*)); Constructor->setCtorInitializers(baseOrMemberInitializers); // Constructors implicitly reference the base and member // destructors. MarkBaseAndMemberDestructorsReferenced(Constructor->getLocation(), Constructor->getParent()); } return HadError; } static void PopulateKeysForFields(FieldDecl *Field, SmallVectorImpl &IdealInits) { if (const RecordType *RT = Field->getType()->getAs()) { const RecordDecl *RD = RT->getDecl(); if (RD->isAnonymousStructOrUnion()) { for (auto *Field : RD->fields()) PopulateKeysForFields(Field, IdealInits); return; } } IdealInits.push_back(Field->getCanonicalDecl()); } static const void *GetKeyForBase(ASTContext &Context, QualType BaseType) { return Context.getCanonicalType(BaseType).getTypePtr(); } static const void *GetKeyForMember(ASTContext &Context, CXXCtorInitializer *Member) { if (!Member->isAnyMemberInitializer()) return GetKeyForBase(Context, QualType(Member->getBaseClass(), 0)); return Member->getAnyMember()->getCanonicalDecl(); } static void DiagnoseBaseOrMemInitializerOrder( Sema &SemaRef, const CXXConstructorDecl *Constructor, ArrayRef Inits) { if (Constructor->getDeclContext()->isDependentContext()) return; // Don't check initializers order unless the warning is enabled at the // location of at least one initializer. bool ShouldCheckOrder = false; for (unsigned InitIndex = 0; InitIndex != Inits.size(); ++InitIndex) { CXXCtorInitializer *Init = Inits[InitIndex]; if (!SemaRef.Diags.isIgnored(diag::warn_initializer_out_of_order, Init->getSourceLocation())) { ShouldCheckOrder = true; break; } } if (!ShouldCheckOrder) return; // Build the list of bases and members in the order that they'll // actually be initialized. The explicit initializers should be in // this same order but may be missing things. SmallVector IdealInitKeys; const CXXRecordDecl *ClassDecl = Constructor->getParent(); // 1. Virtual bases. for (const auto &VBase : ClassDecl->vbases()) IdealInitKeys.push_back(GetKeyForBase(SemaRef.Context, VBase.getType())); // 2. Non-virtual bases. for (const auto &Base : ClassDecl->bases()) { if (Base.isVirtual()) continue; IdealInitKeys.push_back(GetKeyForBase(SemaRef.Context, Base.getType())); } // 3. Direct fields. for (auto *Field : ClassDecl->fields()) { if (Field->isUnnamedBitfield()) continue; PopulateKeysForFields(Field, IdealInitKeys); } unsigned NumIdealInits = IdealInitKeys.size(); unsigned IdealIndex = 0; CXXCtorInitializer *PrevInit = nullptr; for (unsigned InitIndex = 0; InitIndex != Inits.size(); ++InitIndex) { CXXCtorInitializer *Init = Inits[InitIndex]; const void *InitKey = GetKeyForMember(SemaRef.Context, Init); // Scan forward to try to find this initializer in the idealized // initializers list. for (; IdealIndex != NumIdealInits; ++IdealIndex) if (InitKey == IdealInitKeys[IdealIndex]) break; // If we didn't find this initializer, it must be because we // scanned past it on a previous iteration. That can only // happen if we're out of order; emit a warning. if (IdealIndex == NumIdealInits && PrevInit) { Sema::SemaDiagnosticBuilder D = SemaRef.Diag(PrevInit->getSourceLocation(), diag::warn_initializer_out_of_order); if (PrevInit->isAnyMemberInitializer()) D << 0 << PrevInit->getAnyMember()->getDeclName(); else D << 1 << PrevInit->getTypeSourceInfo()->getType(); if (Init->isAnyMemberInitializer()) D << 0 << Init->getAnyMember()->getDeclName(); else D << 1 << Init->getTypeSourceInfo()->getType(); // Move back to the initializer's location in the ideal list. for (IdealIndex = 0; IdealIndex != NumIdealInits; ++IdealIndex) if (InitKey == IdealInitKeys[IdealIndex]) break; assert(IdealIndex < NumIdealInits && "initializer not found in initializer list"); } PrevInit = Init; } } namespace { bool CheckRedundantInit(Sema &S, CXXCtorInitializer *Init, CXXCtorInitializer *&PrevInit) { if (!PrevInit) { PrevInit = Init; return false; } if (FieldDecl *Field = Init->getAnyMember()) S.Diag(Init->getSourceLocation(), diag::err_multiple_mem_initialization) << Field->getDeclName() << Init->getSourceRange(); else { const Type *BaseClass = Init->getBaseClass(); assert(BaseClass && "neither field nor base"); S.Diag(Init->getSourceLocation(), diag::err_multiple_base_initialization) << QualType(BaseClass, 0) << Init->getSourceRange(); } S.Diag(PrevInit->getSourceLocation(), diag::note_previous_initializer) << 0 << PrevInit->getSourceRange(); return true; } typedef std::pair UnionEntry; typedef llvm::DenseMap RedundantUnionMap; bool CheckRedundantUnionInit(Sema &S, CXXCtorInitializer *Init, RedundantUnionMap &Unions) { FieldDecl *Field = Init->getAnyMember(); RecordDecl *Parent = Field->getParent(); NamedDecl *Child = Field; while (Parent->isAnonymousStructOrUnion() || Parent->isUnion()) { if (Parent->isUnion()) { UnionEntry &En = Unions[Parent]; if (En.first && En.first != Child) { S.Diag(Init->getSourceLocation(), diag::err_multiple_mem_union_initialization) << Field->getDeclName() << Init->getSourceRange(); S.Diag(En.second->getSourceLocation(), diag::note_previous_initializer) << 0 << En.second->getSourceRange(); return true; } if (!En.first) { En.first = Child; En.second = Init; } if (!Parent->isAnonymousStructOrUnion()) return false; } Child = Parent; Parent = cast(Parent->getDeclContext()); } return false; } } /// ActOnMemInitializers - Handle the member initializers for a constructor. void Sema::ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef MemInits, bool AnyErrors) { if (!ConstructorDecl) return; AdjustDeclIfTemplate(ConstructorDecl); CXXConstructorDecl *Constructor = dyn_cast(ConstructorDecl); if (!Constructor) { Diag(ColonLoc, diag::err_only_constructors_take_base_inits); return; } // Mapping for the duplicate initializers check. // For member initializers, this is keyed with a FieldDecl*. // For base initializers, this is keyed with a Type*. llvm::DenseMap Members; // Mapping for the inconsistent anonymous-union initializers check. RedundantUnionMap MemberUnions; bool HadError = false; for (unsigned i = 0; i < MemInits.size(); i++) { CXXCtorInitializer *Init = MemInits[i]; // Set the source order index. Init->setSourceOrder(i); if (Init->isAnyMemberInitializer()) { const void *Key = GetKeyForMember(Context, Init); if (CheckRedundantInit(*this, Init, Members[Key]) || CheckRedundantUnionInit(*this, Init, MemberUnions)) HadError = true; } else if (Init->isBaseInitializer()) { const void *Key = GetKeyForMember(Context, Init); if (CheckRedundantInit(*this, Init, Members[Key])) HadError = true; } else { assert(Init->isDelegatingInitializer()); // This must be the only initializer if (MemInits.size() != 1) { Diag(Init->getSourceLocation(), diag::err_delegating_initializer_alone) << Init->getSourceRange() << MemInits[i ? 0 : 1]->getSourceRange(); // We will treat this as being the only initializer. } SetDelegatingInitializer(Constructor, MemInits[i]); // Return immediately as the initializer is set. return; } } if (HadError) return; DiagnoseBaseOrMemInitializerOrder(*this, Constructor, MemInits); SetCtorInitializers(Constructor, AnyErrors, MemInits); DiagnoseUninitializedFields(*this, Constructor); } void Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location, CXXRecordDecl *ClassDecl) { // Ignore dependent contexts. Also ignore unions, since their members never // have destructors implicitly called. if (ClassDecl->isDependentContext() || ClassDecl->isUnion()) return; // FIXME: all the access-control diagnostics are positioned on the // field/base declaration. That's probably good; that said, the // user might reasonably want to know why the destructor is being // emitted, and we currently don't say. // Non-static data members. for (auto *Field : ClassDecl->fields()) { if (Field->isInvalidDecl()) continue; // Don't destroy incomplete or zero-length arrays. if (isIncompleteOrZeroLengthArrayType(Context, Field->getType())) continue; QualType FieldType = Context.getBaseElementType(Field->getType()); const RecordType* RT = FieldType->getAs(); if (!RT) continue; CXXRecordDecl *FieldClassDecl = cast(RT->getDecl()); if (FieldClassDecl->isInvalidDecl()) continue; if (FieldClassDecl->hasIrrelevantDestructor()) continue; // The destructor for an implicit anonymous union member is never invoked. if (FieldClassDecl->isUnion() && FieldClassDecl->isAnonymousStructOrUnion()) continue; CXXDestructorDecl *Dtor = LookupDestructor(FieldClassDecl); assert(Dtor && "No dtor found for FieldClassDecl!"); CheckDestructorAccess(Field->getLocation(), Dtor, PDiag(diag::err_access_dtor_field) << Field->getDeclName() << FieldType); MarkFunctionReferenced(Location, Dtor); DiagnoseUseOfDecl(Dtor, Location); } // We only potentially invoke the destructors of potentially constructed // subobjects. bool VisitVirtualBases = !ClassDecl->isAbstract(); llvm::SmallPtrSet DirectVirtualBases; // Bases. for (const auto &Base : ClassDecl->bases()) { // Bases are always records in a well-formed non-dependent class. const RecordType *RT = Base.getType()->getAs(); // Remember direct virtual bases. if (Base.isVirtual()) { if (!VisitVirtualBases) continue; DirectVirtualBases.insert(RT); } CXXRecordDecl *BaseClassDecl = cast(RT->getDecl()); // If our base class is invalid, we probably can't get its dtor anyway. if (BaseClassDecl->isInvalidDecl()) continue; if (BaseClassDecl->hasIrrelevantDestructor()) continue; CXXDestructorDecl *Dtor = LookupDestructor(BaseClassDecl); assert(Dtor && "No dtor found for BaseClassDecl!"); // FIXME: caret should be on the start of the class name CheckDestructorAccess(Base.getBeginLoc(), Dtor, PDiag(diag::err_access_dtor_base) << Base.getType() << Base.getSourceRange(), Context.getTypeDeclType(ClassDecl)); MarkFunctionReferenced(Location, Dtor); DiagnoseUseOfDecl(Dtor, Location); } if (!VisitVirtualBases) return; // Virtual bases. for (const auto &VBase : ClassDecl->vbases()) { // Bases are always records in a well-formed non-dependent class. const RecordType *RT = VBase.getType()->castAs(); // Ignore direct virtual bases. if (DirectVirtualBases.count(RT)) continue; CXXRecordDecl *BaseClassDecl = cast(RT->getDecl()); // If our base class is invalid, we probably can't get its dtor anyway. if (BaseClassDecl->isInvalidDecl()) continue; if (BaseClassDecl->hasIrrelevantDestructor()) continue; CXXDestructorDecl *Dtor = LookupDestructor(BaseClassDecl); assert(Dtor && "No dtor found for BaseClassDecl!"); if (CheckDestructorAccess( ClassDecl->getLocation(), Dtor, PDiag(diag::err_access_dtor_vbase) << Context.getTypeDeclType(ClassDecl) << VBase.getType(), Context.getTypeDeclType(ClassDecl)) == AR_accessible) { CheckDerivedToBaseConversion( Context.getTypeDeclType(ClassDecl), VBase.getType(), diag::err_access_dtor_vbase, 0, ClassDecl->getLocation(), SourceRange(), DeclarationName(), nullptr); } MarkFunctionReferenced(Location, Dtor); DiagnoseUseOfDecl(Dtor, Location); } } void Sema::ActOnDefaultCtorInitializers(Decl *CDtorDecl) { if (!CDtorDecl) return; if (CXXConstructorDecl *Constructor = dyn_cast(CDtorDecl)) { SetCtorInitializers(Constructor, /*AnyErrors=*/false); DiagnoseUninitializedFields(*this, Constructor); } } bool Sema::isAbstractType(SourceLocation Loc, QualType T) { if (!getLangOpts().CPlusPlus) return false; const auto *RD = Context.getBaseElementType(T)->getAsCXXRecordDecl(); if (!RD) return false; // FIXME: Per [temp.inst]p1, we are supposed to trigger instantiation of a // class template specialization here, but doing so breaks a lot of code. // We can't answer whether something is abstract until it has a // definition. If it's currently being defined, we'll walk back // over all the declarations when we have a full definition. const CXXRecordDecl *Def = RD->getDefinition(); if (!Def || Def->isBeingDefined()) return false; return RD->isAbstract(); } bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser) { if (!isAbstractType(Loc, T)) return false; T = Context.getBaseElementType(T); Diagnoser.diagnose(*this, Loc, T); DiagnoseAbstractType(T->getAsCXXRecordDecl()); return true; } void Sema::DiagnoseAbstractType(const CXXRecordDecl *RD) { // Check if we've already emitted the list of pure virtual functions // for this class. if (PureVirtualClassDiagSet && PureVirtualClassDiagSet->count(RD)) return; // If the diagnostic is suppressed, don't emit the notes. We're only // going to emit them once, so try to attach them to a diagnostic we're // actually going to show. if (Diags.isLastDiagnosticIgnored()) return; CXXFinalOverriderMap FinalOverriders; RD->getFinalOverriders(FinalOverriders); // Keep a set of seen pure methods so we won't diagnose the same method // more than once. llvm::SmallPtrSet SeenPureMethods; for (CXXFinalOverriderMap::iterator M = FinalOverriders.begin(), MEnd = FinalOverriders.end(); M != MEnd; ++M) { for (OverridingMethods::iterator SO = M->second.begin(), SOEnd = M->second.end(); SO != SOEnd; ++SO) { // C++ [class.abstract]p4: // A class is abstract if it contains or inherits at least one // pure virtual function for which the final overrider is pure // virtual. // if (SO->second.size() != 1) continue; if (!SO->second.front().Method->isPure()) continue; if (!SeenPureMethods.insert(SO->second.front().Method).second) continue; Diag(SO->second.front().Method->getLocation(), diag::note_pure_virtual_function) << SO->second.front().Method->getDeclName() << RD->getDeclName(); } } if (!PureVirtualClassDiagSet) PureVirtualClassDiagSet.reset(new RecordDeclSetTy); PureVirtualClassDiagSet->insert(RD); } namespace { struct AbstractUsageInfo { Sema &S; CXXRecordDecl *Record; CanQualType AbstractType; bool Invalid; AbstractUsageInfo(Sema &S, CXXRecordDecl *Record) : S(S), Record(Record), AbstractType(S.Context.getCanonicalType( S.Context.getTypeDeclType(Record))), Invalid(false) {} void DiagnoseAbstractType() { if (Invalid) return; S.DiagnoseAbstractType(Record); Invalid = true; } void CheckType(const NamedDecl *D, TypeLoc TL, Sema::AbstractDiagSelID Sel); }; struct CheckAbstractUsage { AbstractUsageInfo &Info; const NamedDecl *Ctx; CheckAbstractUsage(AbstractUsageInfo &Info, const NamedDecl *Ctx) : Info(Info), Ctx(Ctx) {} void Visit(TypeLoc TL, Sema::AbstractDiagSelID Sel) { switch (TL.getTypeLocClass()) { #define ABSTRACT_TYPELOC(CLASS, PARENT) #define TYPELOC(CLASS, PARENT) \ case TypeLoc::CLASS: Check(TL.castAs(), Sel); break; #include "clang/AST/TypeLocNodes.def" } } void Check(FunctionProtoTypeLoc TL, Sema::AbstractDiagSelID Sel) { Visit(TL.getReturnLoc(), Sema::AbstractReturnType); for (unsigned I = 0, E = TL.getNumParams(); I != E; ++I) { if (!TL.getParam(I)) continue; TypeSourceInfo *TSI = TL.getParam(I)->getTypeSourceInfo(); if (TSI) Visit(TSI->getTypeLoc(), Sema::AbstractParamType); } } void Check(ArrayTypeLoc TL, Sema::AbstractDiagSelID Sel) { Visit(TL.getElementLoc(), Sema::AbstractArrayType); } void Check(TemplateSpecializationTypeLoc TL, Sema::AbstractDiagSelID Sel) { // Visit the type parameters from a permissive context. for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) { TemplateArgumentLoc TAL = TL.getArgLoc(I); if (TAL.getArgument().getKind() == TemplateArgument::Type) if (TypeSourceInfo *TSI = TAL.getTypeSourceInfo()) Visit(TSI->getTypeLoc(), Sema::AbstractNone); // TODO: other template argument types? } } // Visit pointee types from a permissive context. #define CheckPolymorphic(Type) \ void Check(Type TL, Sema::AbstractDiagSelID Sel) { \ Visit(TL.getNextTypeLoc(), Sema::AbstractNone); \ } CheckPolymorphic(PointerTypeLoc) CheckPolymorphic(ReferenceTypeLoc) CheckPolymorphic(MemberPointerTypeLoc) CheckPolymorphic(BlockPointerTypeLoc) CheckPolymorphic(AtomicTypeLoc) /// Handle all the types we haven't given a more specific /// implementation for above. void Check(TypeLoc TL, Sema::AbstractDiagSelID Sel) { // Every other kind of type that we haven't called out already // that has an inner type is either (1) sugar or (2) contains that // inner type in some way as a subobject. if (TypeLoc Next = TL.getNextTypeLoc()) return Visit(Next, Sel); // If there's no inner type and we're in a permissive context, // don't diagnose. if (Sel == Sema::AbstractNone) return; // Check whether the type matches the abstract type. QualType T = TL.getType(); if (T->isArrayType()) { Sel = Sema::AbstractArrayType; T = Info.S.Context.getBaseElementType(T); } CanQualType CT = T->getCanonicalTypeUnqualified().getUnqualifiedType(); if (CT != Info.AbstractType) return; // It matched; do some magic. if (Sel == Sema::AbstractArrayType) { Info.S.Diag(Ctx->getLocation(), diag::err_array_of_abstract_type) << T << TL.getSourceRange(); } else { Info.S.Diag(Ctx->getLocation(), diag::err_abstract_type_in_decl) << Sel << T << TL.getSourceRange(); } Info.DiagnoseAbstractType(); } }; void AbstractUsageInfo::CheckType(const NamedDecl *D, TypeLoc TL, Sema::AbstractDiagSelID Sel) { CheckAbstractUsage(*this, D).Visit(TL, Sel); } } /// Check for invalid uses of an abstract type in a method declaration. static void CheckAbstractClassUsage(AbstractUsageInfo &Info, CXXMethodDecl *MD) { // No need to do the check on definitions, which require that // the return/param types be complete. if (MD->doesThisDeclarationHaveABody()) return; // For safety's sake, just ignore it if we don't have type source // information. This should never happen for non-implicit methods, // but... if (TypeSourceInfo *TSI = MD->getTypeSourceInfo()) Info.CheckType(MD, TSI->getTypeLoc(), Sema::AbstractNone); } /// Check for invalid uses of an abstract type within a class definition. static void CheckAbstractClassUsage(AbstractUsageInfo &Info, CXXRecordDecl *RD) { for (auto *D : RD->decls()) { if (D->isImplicit()) continue; // Methods and method templates. if (isa(D)) { CheckAbstractClassUsage(Info, cast(D)); } else if (isa(D)) { FunctionDecl *FD = cast(D)->getTemplatedDecl(); CheckAbstractClassUsage(Info, cast(FD)); // Fields and static variables. } else if (isa(D)) { FieldDecl *FD = cast(D); if (TypeSourceInfo *TSI = FD->getTypeSourceInfo()) Info.CheckType(FD, TSI->getTypeLoc(), Sema::AbstractFieldType); } else if (isa(D)) { VarDecl *VD = cast(D); if (TypeSourceInfo *TSI = VD->getTypeSourceInfo()) Info.CheckType(VD, TSI->getTypeLoc(), Sema::AbstractVariableType); // Nested classes and class templates. } else if (isa(D)) { CheckAbstractClassUsage(Info, cast(D)); } else if (isa(D)) { CheckAbstractClassUsage(Info, cast(D)->getTemplatedDecl()); } } } static void ReferenceDllExportedMembers(Sema &S, CXXRecordDecl *Class) { Attr *ClassAttr = getDLLAttr(Class); if (!ClassAttr) return; assert(ClassAttr->getKind() == attr::DLLExport); TemplateSpecializationKind TSK = Class->getTemplateSpecializationKind(); if (TSK == TSK_ExplicitInstantiationDeclaration) // Don't go any further if this is just an explicit instantiation // declaration. return; if (S.Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) S.MarkVTableUsed(Class->getLocation(), Class, true); for (Decl *Member : Class->decls()) { // Defined static variables that are members of an exported base // class must be marked export too. auto *VD = dyn_cast(Member); if (VD && Member->getAttr() && VD->getStorageClass() == SC_Static && TSK == TSK_ImplicitInstantiation) S.MarkVariableReferenced(VD->getLocation(), VD); auto *MD = dyn_cast(Member); if (!MD) continue; if (Member->getAttr()) { if (MD->isUserProvided()) { // Instantiate non-default class member functions ... // .. except for certain kinds of template specializations. if (TSK == TSK_ImplicitInstantiation && !ClassAttr->isInherited()) continue; S.MarkFunctionReferenced(Class->getLocation(), MD); // The function will be passed to the consumer when its definition is // encountered. } else if (!MD->isTrivial() || MD->isExplicitlyDefaulted() || MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) { // Synthesize and instantiate non-trivial implicit methods, explicitly // defaulted methods, and the copy and move assignment operators. The // latter are exported even if they are trivial, because the address of // an operator can be taken and should compare equal across libraries. DiagnosticErrorTrap Trap(S.Diags); S.MarkFunctionReferenced(Class->getLocation(), MD); if (Trap.hasErrorOccurred()) { S.Diag(ClassAttr->getLocation(), diag::note_due_to_dllexported_class) << Class << !S.getLangOpts().CPlusPlus11; break; } // There is no later point when we will see the definition of this // function, so pass it to the consumer now. S.Consumer.HandleTopLevelDecl(DeclGroupRef(MD)); } } } } static void checkForMultipleExportedDefaultConstructors(Sema &S, CXXRecordDecl *Class) { // Only the MS ABI has default constructor closures, so we don't need to do // this semantic checking anywhere else. if (!S.Context.getTargetInfo().getCXXABI().isMicrosoft()) return; CXXConstructorDecl *LastExportedDefaultCtor = nullptr; for (Decl *Member : Class->decls()) { // Look for exported default constructors. auto *CD = dyn_cast(Member); if (!CD || !CD->isDefaultConstructor()) continue; auto *Attr = CD->getAttr(); if (!Attr) continue; // If the class is non-dependent, mark the default arguments as ODR-used so // that we can properly codegen the constructor closure. if (!Class->isDependentContext()) { for (ParmVarDecl *PD : CD->parameters()) { (void)S.CheckCXXDefaultArgExpr(Attr->getLocation(), CD, PD); S.DiscardCleanupsInEvaluationContext(); } } if (LastExportedDefaultCtor) { S.Diag(LastExportedDefaultCtor->getLocation(), diag::err_attribute_dll_ambiguous_default_ctor) << Class; S.Diag(CD->getLocation(), diag::note_entity_declared_at) << CD->getDeclName(); return; } LastExportedDefaultCtor = CD; } } void Sema::checkClassLevelCodeSegAttribute(CXXRecordDecl *Class) { // Mark any compiler-generated routines with the implicit code_seg attribute. for (auto *Method : Class->methods()) { if (Method->isUserProvided()) continue; if (Attr *A = getImplicitCodeSegOrSectionAttrForFunction(Method, /*IsDefinition=*/true)) Method->addAttr(A); } } /// Check class-level dllimport/dllexport attribute. void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) { Attr *ClassAttr = getDLLAttr(Class); // MSVC inherits DLL attributes to partial class template specializations. if (Context.getTargetInfo().getCXXABI().isMicrosoft() && !ClassAttr) { if (auto *Spec = dyn_cast(Class)) { if (Attr *TemplateAttr = getDLLAttr(Spec->getSpecializedTemplate()->getTemplatedDecl())) { auto *A = cast(TemplateAttr->clone(getASTContext())); A->setInherited(true); ClassAttr = A; } } } if (!ClassAttr) return; if (!Class->isExternallyVisible()) { Diag(Class->getLocation(), diag::err_attribute_dll_not_extern) << Class << ClassAttr; return; } if (Context.getTargetInfo().getCXXABI().isMicrosoft() && !ClassAttr->isInherited()) { // Diagnose dll attributes on members of class with dll attribute. for (Decl *Member : Class->decls()) { if (!isa(Member) && !isa(Member)) continue; InheritableAttr *MemberAttr = getDLLAttr(Member); if (!MemberAttr || MemberAttr->isInherited() || Member->isInvalidDecl()) continue; Diag(MemberAttr->getLocation(), diag::err_attribute_dll_member_of_dll_class) << MemberAttr << ClassAttr; Diag(ClassAttr->getLocation(), diag::note_previous_attribute); Member->setInvalidDecl(); } } if (Class->getDescribedClassTemplate()) // Don't inherit dll attribute until the template is instantiated. return; // The class is either imported or exported. const bool ClassExported = ClassAttr->getKind() == attr::DLLExport; // Check if this was a dllimport attribute propagated from a derived class to // a base class template specialization. We don't apply these attributes to // static data members. const bool PropagatedImport = !ClassExported && cast(ClassAttr)->wasPropagatedToBaseTemplate(); TemplateSpecializationKind TSK = Class->getTemplateSpecializationKind(); // Ignore explicit dllexport on explicit class template instantiation // declarations, except in MinGW mode. if (ClassExported && !ClassAttr->isInherited() && TSK == TSK_ExplicitInstantiationDeclaration && !Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) { Class->dropAttr(); return; } // Force declaration of implicit members so they can inherit the attribute. ForceDeclarationOfImplicitMembers(Class); // FIXME: MSVC's docs say all bases must be exportable, but this doesn't // seem to be true in practice? for (Decl *Member : Class->decls()) { VarDecl *VD = dyn_cast(Member); CXXMethodDecl *MD = dyn_cast(Member); // Only methods and static fields inherit the attributes. if (!VD && !MD) continue; if (MD) { // Don't process deleted methods. if (MD->isDeleted()) continue; if (MD->isInlined()) { // MinGW does not import or export inline methods. But do it for // template instantiations. if (!Context.getTargetInfo().getCXXABI().isMicrosoft() && !Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() && TSK != TSK_ExplicitInstantiationDeclaration && TSK != TSK_ExplicitInstantiationDefinition) continue; // MSVC versions before 2015 don't export the move assignment operators // and move constructor, so don't attempt to import/export them if // we have a definition. auto *Ctor = dyn_cast(MD); if ((MD->isMoveAssignmentOperator() || (Ctor && Ctor->isMoveConstructor())) && !getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015)) continue; // MSVC2015 doesn't export trivial defaulted x-tor but copy assign // operator is exported anyway. if (getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015) && (Ctor || isa(MD)) && MD->isTrivial()) continue; } } // Don't apply dllimport attributes to static data members of class template // instantiations when the attribute is propagated from a derived class. if (VD && PropagatedImport) continue; if (!cast(Member)->isExternallyVisible()) continue; if (!getDLLAttr(Member)) { InheritableAttr *NewAttr = nullptr; // Do not export/import inline function when -fno-dllexport-inlines is // passed. But add attribute for later local static var check. if (!getLangOpts().DllExportInlines && MD && MD->isInlined() && TSK != TSK_ExplicitInstantiationDeclaration && TSK != TSK_ExplicitInstantiationDefinition) { if (ClassExported) { NewAttr = ::new (getASTContext()) DLLExportStaticLocalAttr(ClassAttr->getRange(), getASTContext(), ClassAttr->getSpellingListIndex()); } else { NewAttr = ::new (getASTContext()) DLLImportStaticLocalAttr(ClassAttr->getRange(), getASTContext(), ClassAttr->getSpellingListIndex()); } } else { NewAttr = cast(ClassAttr->clone(getASTContext())); } NewAttr->setInherited(true); Member->addAttr(NewAttr); if (MD) { // Propagate DLLAttr to friend re-declarations of MD that have already // been constructed. for (FunctionDecl *FD = MD->getMostRecentDecl(); FD; FD = FD->getPreviousDecl()) { if (FD->getFriendObjectKind() == Decl::FOK_None) continue; assert(!getDLLAttr(FD) && "friend re-decl should not already have a DLLAttr"); NewAttr = cast(ClassAttr->clone(getASTContext())); NewAttr->setInherited(true); FD->addAttr(NewAttr); } } } } if (ClassExported) DelayedDllExportClasses.push_back(Class); } /// Perform propagation of DLL attributes from a derived class to a /// templated base class for MS compatibility. void Sema::propagateDLLAttrToBaseClassTemplate( CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc) { if (getDLLAttr( BaseTemplateSpec->getSpecializedTemplate()->getTemplatedDecl())) { // If the base class template has a DLL attribute, don't try to change it. return; } auto TSK = BaseTemplateSpec->getSpecializationKind(); if (!getDLLAttr(BaseTemplateSpec) && (TSK == TSK_Undeclared || TSK == TSK_ExplicitInstantiationDeclaration || TSK == TSK_ImplicitInstantiation)) { // The template hasn't been instantiated yet (or it has, but only as an // explicit instantiation declaration or implicit instantiation, which means // we haven't codegenned any members yet), so propagate the attribute. auto *NewAttr = cast(ClassAttr->clone(getASTContext())); NewAttr->setInherited(true); BaseTemplateSpec->addAttr(NewAttr); // If this was an import, mark that we propagated it from a derived class to // a base class template specialization. if (auto *ImportAttr = dyn_cast(NewAttr)) ImportAttr->setPropagatedToBaseTemplate(); // If the template is already instantiated, checkDLLAttributeRedeclaration() // needs to be run again to work see the new attribute. Otherwise this will // get run whenever the template is instantiated. if (TSK != TSK_Undeclared) checkClassLevelDLLAttribute(BaseTemplateSpec); return; } if (getDLLAttr(BaseTemplateSpec)) { // The template has already been specialized or instantiated with an // attribute, explicitly or through propagation. We should not try to change // it. return; } // The template was previously instantiated or explicitly specialized without // a dll attribute, It's too late for us to add an attribute, so warn that // this is unsupported. Diag(BaseLoc, diag::warn_attribute_dll_instantiated_base_class) << BaseTemplateSpec->isExplicitSpecialization(); Diag(ClassAttr->getLocation(), diag::note_attribute); if (BaseTemplateSpec->isExplicitSpecialization()) { Diag(BaseTemplateSpec->getLocation(), diag::note_template_class_explicit_specialization_was_here) << BaseTemplateSpec; } else { Diag(BaseTemplateSpec->getPointOfInstantiation(), diag::note_template_class_instantiation_was_here) << BaseTemplateSpec; } } static void DefineImplicitSpecialMember(Sema &S, CXXMethodDecl *MD, SourceLocation DefaultLoc) { switch (S.getSpecialMember(MD)) { case Sema::CXXDefaultConstructor: S.DefineImplicitDefaultConstructor(DefaultLoc, cast(MD)); break; case Sema::CXXCopyConstructor: S.DefineImplicitCopyConstructor(DefaultLoc, cast(MD)); break; case Sema::CXXCopyAssignment: S.DefineImplicitCopyAssignment(DefaultLoc, MD); break; case Sema::CXXDestructor: S.DefineImplicitDestructor(DefaultLoc, cast(MD)); break; case Sema::CXXMoveConstructor: S.DefineImplicitMoveConstructor(DefaultLoc, cast(MD)); break; case Sema::CXXMoveAssignment: S.DefineImplicitMoveAssignment(DefaultLoc, MD); break; case Sema::CXXInvalid: llvm_unreachable("Invalid special member."); } } /// Determine whether a type is permitted to be passed or returned in /// registers, per C++ [class.temporary]p3. static bool canPassInRegisters(Sema &S, CXXRecordDecl *D, TargetInfo::CallingConvKind CCK) { if (D->isDependentType() || D->isInvalidDecl()) return false; // Clang <= 4 used the pre-C++11 rule, which ignores move operations. // The PS4 platform ABI follows the behavior of Clang 3.2. if (CCK == TargetInfo::CCK_ClangABI4OrPS4) return !D->hasNonTrivialDestructorForCall() && !D->hasNonTrivialCopyConstructorForCall(); if (CCK == TargetInfo::CCK_MicrosoftWin64) { bool CopyCtorIsTrivial = false, CopyCtorIsTrivialForCall = false; bool DtorIsTrivialForCall = false; // If a class has at least one non-deleted, trivial copy constructor, it // is passed according to the C ABI. Otherwise, it is passed indirectly. // // Note: This permits classes with non-trivial copy or move ctors to be // passed in registers, so long as they *also* have a trivial copy ctor, // which is non-conforming. if (D->needsImplicitCopyConstructor()) { if (!D->defaultedCopyConstructorIsDeleted()) { if (D->hasTrivialCopyConstructor()) CopyCtorIsTrivial = true; if (D->hasTrivialCopyConstructorForCall()) CopyCtorIsTrivialForCall = true; } } else { for (const CXXConstructorDecl *CD : D->ctors()) { if (CD->isCopyConstructor() && !CD->isDeleted()) { if (CD->isTrivial()) CopyCtorIsTrivial = true; if (CD->isTrivialForCall()) CopyCtorIsTrivialForCall = true; } } } if (D->needsImplicitDestructor()) { if (!D->defaultedDestructorIsDeleted() && D->hasTrivialDestructorForCall()) DtorIsTrivialForCall = true; } else if (const auto *DD = D->getDestructor()) { if (!DD->isDeleted() && DD->isTrivialForCall()) DtorIsTrivialForCall = true; } // If the copy ctor and dtor are both trivial-for-calls, pass direct. if (CopyCtorIsTrivialForCall && DtorIsTrivialForCall) return true; // If a class has a destructor, we'd really like to pass it indirectly // because it allows us to elide copies. Unfortunately, MSVC makes that // impossible for small types, which it will pass in a single register or // stack slot. Most objects with dtors are large-ish, so handle that early. // We can't call out all large objects as being indirect because there are // multiple x64 calling conventions and the C++ ABI code shouldn't dictate // how we pass large POD types. // Note: This permits small classes with nontrivial destructors to be // passed in registers, which is non-conforming. bool isAArch64 = S.Context.getTargetInfo().getTriple().isAArch64(); uint64_t TypeSize = isAArch64 ? 128 : 64; if (CopyCtorIsTrivial && S.getASTContext().getTypeSize(D->getTypeForDecl()) <= TypeSize) return true; return false; } // Per C++ [class.temporary]p3, the relevant condition is: // each copy constructor, move constructor, and destructor of X is // either trivial or deleted, and X has at least one non-deleted copy // or move constructor bool HasNonDeletedCopyOrMove = false; if (D->needsImplicitCopyConstructor() && !D->defaultedCopyConstructorIsDeleted()) { if (!D->hasTrivialCopyConstructorForCall()) return false; HasNonDeletedCopyOrMove = true; } if (S.getLangOpts().CPlusPlus11 && D->needsImplicitMoveConstructor() && !D->defaultedMoveConstructorIsDeleted()) { if (!D->hasTrivialMoveConstructorForCall()) return false; HasNonDeletedCopyOrMove = true; } if (D->needsImplicitDestructor() && !D->defaultedDestructorIsDeleted() && !D->hasTrivialDestructorForCall()) return false; for (const CXXMethodDecl *MD : D->methods()) { if (MD->isDeleted()) continue; auto *CD = dyn_cast(MD); if (CD && CD->isCopyOrMoveConstructor()) HasNonDeletedCopyOrMove = true; else if (!isa(MD)) continue; if (!MD->isTrivialForCall()) return false; } return HasNonDeletedCopyOrMove; } /// Perform semantic checks on a class definition that has been /// completing, introducing implicitly-declared members, checking for /// abstract types, etc. void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) { if (!Record) return; if (Record->isAbstract() && !Record->isInvalidDecl()) { AbstractUsageInfo Info(*this, Record); CheckAbstractClassUsage(Info, Record); } // If this is not an aggregate type and has no user-declared constructor, // complain about any non-static data members of reference or const scalar // type, since they will never get initializers. if (!Record->isInvalidDecl() && !Record->isDependentType() && !Record->isAggregate() && !Record->hasUserDeclaredConstructor() && !Record->isLambda()) { bool Complained = false; for (const auto *F : Record->fields()) { if (F->hasInClassInitializer() || F->isUnnamedBitfield()) continue; if (F->getType()->isReferenceType() || (F->getType().isConstQualified() && F->getType()->isScalarType())) { if (!Complained) { Diag(Record->getLocation(), diag::warn_no_constructor_for_refconst) << Record->getTagKind() << Record; Complained = true; } Diag(F->getLocation(), diag::note_refconst_member_not_initialized) << F->getType()->isReferenceType() << F->getDeclName(); } } } if (Record->getIdentifier()) { // C++ [class.mem]p13: // If T is the name of a class, then each of the following shall have a // name different from T: // - every member of every anonymous union that is a member of class T. // // C++ [class.mem]p14: // In addition, if class T has a user-declared constructor (12.1), every // non-static data member of class T shall have a name different from T. DeclContext::lookup_result R = Record->lookup(Record->getDeclName()); for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; ++I) { NamedDecl *D = (*I)->getUnderlyingDecl(); if (((isa(D) || isa(D)) && Record->hasUserDeclaredConstructor()) || isa(D)) { Diag((*I)->getLocation(), diag::err_member_name_of_class) << D->getDeclName(); break; } } } // Warn if the class has virtual methods but non-virtual public destructor. if (Record->isPolymorphic() && !Record->isDependentType()) { CXXDestructorDecl *dtor = Record->getDestructor(); if ((!dtor || (!dtor->isVirtual() && dtor->getAccess() == AS_public)) && !Record->hasAttr()) Diag(dtor ? dtor->getLocation() : Record->getLocation(), diag::warn_non_virtual_dtor) << Context.getRecordType(Record); } if (Record->isAbstract()) { if (FinalAttr *FA = Record->getAttr()) { Diag(Record->getLocation(), diag::warn_abstract_final_class) << FA->isSpelledAsSealed(); DiagnoseAbstractType(Record); } } // See if trivial_abi has to be dropped. if (Record->hasAttr()) checkIllFormedTrivialABIStruct(*Record); // Set HasTrivialSpecialMemberForCall if the record has attribute // "trivial_abi". bool HasTrivialABI = Record->hasAttr(); if (HasTrivialABI) Record->setHasTrivialSpecialMemberForCall(); auto CompleteMemberFunction = [&](CXXMethodDecl *M) { // Check whether the explicitly-defaulted special members are valid. if (!M->isInvalidDecl() && M->isExplicitlyDefaulted()) CheckExplicitlyDefaultedSpecialMember(M); // For an explicitly defaulted or deleted special member, we defer // determining triviality until the class is complete. That time is now! CXXSpecialMember CSM = getSpecialMember(M); if (!M->isImplicit() && !M->isUserProvided()) { if (CSM != CXXInvalid) { M->setTrivial(SpecialMemberIsTrivial(M, CSM)); // Inform the class that we've finished declaring this member. Record->finishedDefaultedOrDeletedMember(M); M->setTrivialForCall( HasTrivialABI || SpecialMemberIsTrivial(M, CSM, TAH_ConsiderTrivialABI)); Record->setTrivialForCallFlags(M); } } // Set triviality for the purpose of calls if this is a user-provided // copy/move constructor or destructor. if ((CSM == CXXCopyConstructor || CSM == CXXMoveConstructor || CSM == CXXDestructor) && M->isUserProvided()) { M->setTrivialForCall(HasTrivialABI); Record->setTrivialForCallFlags(M); } if (!M->isInvalidDecl() && M->isExplicitlyDefaulted() && M->hasAttr()) { if (getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015) && M->isTrivial() && (CSM == CXXDefaultConstructor || CSM == CXXCopyConstructor || CSM == CXXDestructor)) M->dropAttr(); if (M->hasAttr()) { // Define after any fields with in-class initializers have been parsed. DelayedDllExportMemberFunctions.push_back(M); } } }; bool HasMethodWithOverrideControl = false, HasOverridingMethodWithoutOverrideControl = false; if (!Record->isDependentType()) { // Check the destructor before any other member function. We need to // determine whether it's trivial in order to determine whether the claas // type is a literal type, which is a prerequisite for determining whether // other special member functions are valid and whether they're implicitly // 'constexpr'. if (CXXDestructorDecl *Dtor = Record->getDestructor()) CompleteMemberFunction(Dtor); for (auto *M : Record->methods()) { // See if a method overloads virtual methods in a base // class without overriding any. if (!M->isStatic()) DiagnoseHiddenVirtualMethods(M); if (M->hasAttr()) HasMethodWithOverrideControl = true; else if (M->size_overridden_methods() > 0) HasOverridingMethodWithoutOverrideControl = true; if (!isa(M)) CompleteMemberFunction(M); } } if (HasMethodWithOverrideControl && HasOverridingMethodWithoutOverrideControl) { // At least one method has the 'override' control declared. // Diagnose all other overridden methods which do not have 'override' specified on them. for (auto *M : Record->methods()) DiagnoseAbsenceOfOverrideControl(M); } // ms_struct is a request to use the same ABI rules as MSVC. Check // whether this class uses any C++ features that are implemented // completely differently in MSVC, and if so, emit a diagnostic. // That diagnostic defaults to an error, but we allow projects to // map it down to a warning (or ignore it). It's a fairly common // practice among users of the ms_struct pragma to mass-annotate // headers, sweeping up a bunch of types that the project doesn't // really rely on MSVC-compatible layout for. We must therefore // support "ms_struct except for C++ stuff" as a secondary ABI. if (Record->isMsStruct(Context) && (Record->isPolymorphic() || Record->getNumBases())) { Diag(Record->getLocation(), diag::warn_cxx_ms_struct); } checkClassLevelDLLAttribute(Record); checkClassLevelCodeSegAttribute(Record); bool ClangABICompat4 = Context.getLangOpts().getClangABICompat() <= LangOptions::ClangABI::Ver4; TargetInfo::CallingConvKind CCK = Context.getTargetInfo().getCallingConvKind(ClangABICompat4); bool CanPass = canPassInRegisters(*this, Record, CCK); // Do not change ArgPassingRestrictions if it has already been set to // APK_CanNeverPassInRegs. if (Record->getArgPassingRestrictions() != RecordDecl::APK_CanNeverPassInRegs) Record->setArgPassingRestrictions(CanPass ? RecordDecl::APK_CanPassInRegs : RecordDecl::APK_CannotPassInRegs); // If canPassInRegisters returns true despite the record having a non-trivial // destructor, the record is destructed in the callee. This happens only when // the record or one of its subobjects has a field annotated with trivial_abi // or a field qualified with ObjC __strong/__weak. if (Context.getTargetInfo().getCXXABI().areArgsDestroyedLeftToRightInCallee()) Record->setParamDestroyedInCallee(true); else if (Record->hasNonTrivialDestructor()) Record->setParamDestroyedInCallee(CanPass); if (getLangOpts().ForceEmitVTables) { // If we want to emit all the vtables, we need to mark it as used. This // is especially required for cases like vtable assumption loads. MarkVTableUsed(Record->getInnerLocStart(), Record); } } /// Look up the special member function that would be called by a special /// member function for a subobject of class type. /// /// \param Class The class type of the subobject. /// \param CSM The kind of special member function. /// \param FieldQuals If the subobject is a field, its cv-qualifiers. /// \param ConstRHS True if this is a copy operation with a const object /// on its RHS, that is, if the argument to the outer special member /// function is 'const' and this is not a field marked 'mutable'. static Sema::SpecialMemberOverloadResult lookupCallFromSpecialMember( Sema &S, CXXRecordDecl *Class, Sema::CXXSpecialMember CSM, unsigned FieldQuals, bool ConstRHS) { unsigned LHSQuals = 0; if (CSM == Sema::CXXCopyAssignment || CSM == Sema::CXXMoveAssignment) LHSQuals = FieldQuals; unsigned RHSQuals = FieldQuals; if (CSM == Sema::CXXDefaultConstructor || CSM == Sema::CXXDestructor) RHSQuals = 0; else if (ConstRHS) RHSQuals |= Qualifiers::Const; return S.LookupSpecialMember(Class, CSM, RHSQuals & Qualifiers::Const, RHSQuals & Qualifiers::Volatile, false, LHSQuals & Qualifiers::Const, LHSQuals & Qualifiers::Volatile); } class Sema::InheritedConstructorInfo { Sema &S; SourceLocation UseLoc; /// A mapping from the base classes through which the constructor was /// inherited to the using shadow declaration in that base class (or a null /// pointer if the constructor was declared in that base class). llvm::DenseMap InheritedFromBases; public: InheritedConstructorInfo(Sema &S, SourceLocation UseLoc, ConstructorUsingShadowDecl *Shadow) : S(S), UseLoc(UseLoc) { bool DiagnosedMultipleConstructedBases = false; CXXRecordDecl *ConstructedBase = nullptr; UsingDecl *ConstructedBaseUsing = nullptr; // Find the set of such base class subobjects and check that there's a // unique constructed subobject. for (auto *D : Shadow->redecls()) { auto *DShadow = cast(D); auto *DNominatedBase = DShadow->getNominatedBaseClass(); auto *DConstructedBase = DShadow->getConstructedBaseClass(); InheritedFromBases.insert( std::make_pair(DNominatedBase->getCanonicalDecl(), DShadow->getNominatedBaseClassShadowDecl())); if (DShadow->constructsVirtualBase()) InheritedFromBases.insert( std::make_pair(DConstructedBase->getCanonicalDecl(), DShadow->getConstructedBaseClassShadowDecl())); else assert(DNominatedBase == DConstructedBase); // [class.inhctor.init]p2: // If the constructor was inherited from multiple base class subobjects // of type B, the program is ill-formed. if (!ConstructedBase) { ConstructedBase = DConstructedBase; ConstructedBaseUsing = D->getUsingDecl(); } else if (ConstructedBase != DConstructedBase && !Shadow->isInvalidDecl()) { if (!DiagnosedMultipleConstructedBases) { S.Diag(UseLoc, diag::err_ambiguous_inherited_constructor) << Shadow->getTargetDecl(); S.Diag(ConstructedBaseUsing->getLocation(), diag::note_ambiguous_inherited_constructor_using) << ConstructedBase; DiagnosedMultipleConstructedBases = true; } S.Diag(D->getUsingDecl()->getLocation(), diag::note_ambiguous_inherited_constructor_using) << DConstructedBase; } } if (DiagnosedMultipleConstructedBases) Shadow->setInvalidDecl(); } /// Find the constructor to use for inherited construction of a base class, /// and whether that base class constructor inherits the constructor from a /// virtual base class (in which case it won't actually invoke it). std::pair findConstructorForBase(CXXRecordDecl *Base, CXXConstructorDecl *Ctor) const { auto It = InheritedFromBases.find(Base->getCanonicalDecl()); if (It == InheritedFromBases.end()) return std::make_pair(nullptr, false); // This is an intermediary class. if (It->second) return std::make_pair( S.findInheritingConstructor(UseLoc, Ctor, It->second), It->second->constructsVirtualBase()); // This is the base class from which the constructor was inherited. return std::make_pair(Ctor, false); } }; /// Is the special member function which would be selected to perform the /// specified operation on the specified class type a constexpr constructor? static bool specialMemberIsConstexpr(Sema &S, CXXRecordDecl *ClassDecl, Sema::CXXSpecialMember CSM, unsigned Quals, bool ConstRHS, CXXConstructorDecl *InheritedCtor = nullptr, Sema::InheritedConstructorInfo *Inherited = nullptr) { // If we're inheriting a constructor, see if we need to call it for this base // class. if (InheritedCtor) { assert(CSM == Sema::CXXDefaultConstructor); auto BaseCtor = Inherited->findConstructorForBase(ClassDecl, InheritedCtor).first; if (BaseCtor) return BaseCtor->isConstexpr(); } if (CSM == Sema::CXXDefaultConstructor) return ClassDecl->hasConstexprDefaultConstructor(); Sema::SpecialMemberOverloadResult SMOR = lookupCallFromSpecialMember(S, ClassDecl, CSM, Quals, ConstRHS); if (!SMOR.getMethod()) // A constructor we wouldn't select can't be "involved in initializing" // anything. return true; return SMOR.getMethod()->isConstexpr(); } /// Determine whether the specified special member function would be constexpr /// if it were implicitly defined. static bool defaultedSpecialMemberIsConstexpr( Sema &S, CXXRecordDecl *ClassDecl, Sema::CXXSpecialMember CSM, bool ConstArg, CXXConstructorDecl *InheritedCtor = nullptr, Sema::InheritedConstructorInfo *Inherited = nullptr) { if (!S.getLangOpts().CPlusPlus11) return false; // C++11 [dcl.constexpr]p4: // In the definition of a constexpr constructor [...] bool Ctor = true; switch (CSM) { case Sema::CXXDefaultConstructor: if (Inherited) break; // Since default constructor lookup is essentially trivial (and cannot // involve, for instance, template instantiation), we compute whether a // defaulted default constructor is constexpr directly within CXXRecordDecl. // // This is important for performance; we need to know whether the default // constructor is constexpr to determine whether the type is a literal type. return ClassDecl->defaultedDefaultConstructorIsConstexpr(); case Sema::CXXCopyConstructor: case Sema::CXXMoveConstructor: // For copy or move constructors, we need to perform overload resolution. break; case Sema::CXXCopyAssignment: case Sema::CXXMoveAssignment: if (!S.getLangOpts().CPlusPlus14) return false; // In C++1y, we need to perform overload resolution. Ctor = false; break; case Sema::CXXDestructor: case Sema::CXXInvalid: return false; } // -- if the class is a non-empty union, or for each non-empty anonymous // union member of a non-union class, exactly one non-static data member // shall be initialized; [DR1359] // // If we squint, this is guaranteed, since exactly one non-static data member // will be initialized (if the constructor isn't deleted), we just don't know // which one. if (Ctor && ClassDecl->isUnion()) return CSM == Sema::CXXDefaultConstructor ? ClassDecl->hasInClassInitializer() || !ClassDecl->hasVariantMembers() : true; // -- the class shall not have any virtual base classes; if (Ctor && ClassDecl->getNumVBases()) return false; // C++1y [class.copy]p26: // -- [the class] is a literal type, and if (!Ctor && !ClassDecl->isLiteral()) return false; // -- every constructor involved in initializing [...] base class // sub-objects shall be a constexpr constructor; // -- the assignment operator selected to copy/move each direct base // class is a constexpr function, and for (const auto &B : ClassDecl->bases()) { const RecordType *BaseType = B.getType()->getAs(); if (!BaseType) continue; CXXRecordDecl *BaseClassDecl = cast(BaseType->getDecl()); if (!specialMemberIsConstexpr(S, BaseClassDecl, CSM, 0, ConstArg, InheritedCtor, Inherited)) return false; } // -- every constructor involved in initializing non-static data members // [...] shall be a constexpr constructor; // -- every non-static data member and base class sub-object shall be // initialized // -- for each non-static data member of X that is of class type (or array // thereof), the assignment operator selected to copy/move that member is // a constexpr function for (const auto *F : ClassDecl->fields()) { if (F->isInvalidDecl()) continue; if (CSM == Sema::CXXDefaultConstructor && F->hasInClassInitializer()) continue; QualType BaseType = S.Context.getBaseElementType(F->getType()); if (const RecordType *RecordTy = BaseType->getAs()) { CXXRecordDecl *FieldRecDecl = cast(RecordTy->getDecl()); if (!specialMemberIsConstexpr(S, FieldRecDecl, CSM, BaseType.getCVRQualifiers(), ConstArg && !F->isMutable())) return false; } else if (CSM == Sema::CXXDefaultConstructor) { return false; } } // All OK, it's constexpr! return true; } static Sema::ImplicitExceptionSpecification ComputeDefaultedSpecialMemberExceptionSpec( Sema &S, SourceLocation Loc, CXXMethodDecl *MD, Sema::CXXSpecialMember CSM, Sema::InheritedConstructorInfo *ICI); static Sema::ImplicitExceptionSpecification computeImplicitExceptionSpec(Sema &S, SourceLocation Loc, CXXMethodDecl *MD) { auto CSM = S.getSpecialMember(MD); if (CSM != Sema::CXXInvalid) return ComputeDefaultedSpecialMemberExceptionSpec(S, Loc, MD, CSM, nullptr); auto *CD = cast(MD); assert(CD->getInheritedConstructor() && "only special members have implicit exception specs"); Sema::InheritedConstructorInfo ICI( S, Loc, CD->getInheritedConstructor().getShadowDecl()); return ComputeDefaultedSpecialMemberExceptionSpec( S, Loc, CD, Sema::CXXDefaultConstructor, &ICI); } static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI(Sema &S, CXXMethodDecl *MD) { FunctionProtoType::ExtProtoInfo EPI; // Build an exception specification pointing back at this member. EPI.ExceptionSpec.Type = EST_Unevaluated; EPI.ExceptionSpec.SourceDecl = MD; // Set the calling convention to the default for C++ instance methods. EPI.ExtInfo = EPI.ExtInfo.withCallingConv( S.Context.getDefaultCallingConvention(/*IsVariadic=*/false, /*IsCXXMethod=*/true)); return EPI; } void Sema::EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD) { const FunctionProtoType *FPT = MD->getType()->castAs(); if (FPT->getExceptionSpecType() != EST_Unevaluated) return; // Evaluate the exception specification. auto IES = computeImplicitExceptionSpec(*this, Loc, MD); auto ESI = IES.getExceptionSpec(); // Update the type of the special member to use it. UpdateExceptionSpec(MD, ESI); // A user-provided destructor can be defined outside the class. When that // happens, be sure to update the exception specification on both // declarations. const FunctionProtoType *CanonicalFPT = MD->getCanonicalDecl()->getType()->castAs(); if (CanonicalFPT->getExceptionSpecType() == EST_Unevaluated) UpdateExceptionSpec(MD->getCanonicalDecl(), ESI); } void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) { CXXRecordDecl *RD = MD->getParent(); CXXSpecialMember CSM = getSpecialMember(MD); assert(MD->isExplicitlyDefaulted() && CSM != CXXInvalid && "not an explicitly-defaulted special member"); // Whether this was the first-declared instance of the constructor. // This affects whether we implicitly add an exception spec and constexpr. bool First = MD == MD->getCanonicalDecl(); bool HadError = false; // C++11 [dcl.fct.def.default]p1: // A function that is explicitly defaulted shall // -- be a special member function (checked elsewhere), // -- have the same type (except for ref-qualifiers, and except that a // copy operation can take a non-const reference) as an implicit // declaration, and // -- not have default arguments. // C++2a changes the second bullet to instead delete the function if it's // defaulted on its first declaration, unless it's "an assignment operator, // and its return type differs or its parameter type is not a reference". bool DeleteOnTypeMismatch = getLangOpts().CPlusPlus2a && First; bool ShouldDeleteForTypeMismatch = false; unsigned ExpectedParams = 1; if (CSM == CXXDefaultConstructor || CSM == CXXDestructor) ExpectedParams = 0; if (MD->getNumParams() != ExpectedParams) { // This checks for default arguments: a copy or move constructor with a // default argument is classified as a default constructor, and assignment // operations and destructors can't have default arguments. Diag(MD->getLocation(), diag::err_defaulted_special_member_params) << CSM << MD->getSourceRange(); HadError = true; } else if (MD->isVariadic()) { if (DeleteOnTypeMismatch) ShouldDeleteForTypeMismatch = true; else { Diag(MD->getLocation(), diag::err_defaulted_special_member_variadic) << CSM << MD->getSourceRange(); HadError = true; } } const FunctionProtoType *Type = MD->getType()->getAs(); bool CanHaveConstParam = false; if (CSM == CXXCopyConstructor) CanHaveConstParam = RD->implicitCopyConstructorHasConstParam(); else if (CSM == CXXCopyAssignment) CanHaveConstParam = RD->implicitCopyAssignmentHasConstParam(); QualType ReturnType = Context.VoidTy; if (CSM == CXXCopyAssignment || CSM == CXXMoveAssignment) { // Check for return type matching. ReturnType = Type->getReturnType(); QualType DeclType = Context.getTypeDeclType(RD); DeclType = Context.getAddrSpaceQualType(DeclType, MD->getMethodQualifiers().getAddressSpace()); QualType ExpectedReturnType = Context.getLValueReferenceType(DeclType); if (!Context.hasSameType(ReturnType, ExpectedReturnType)) { Diag(MD->getLocation(), diag::err_defaulted_special_member_return_type) << (CSM == CXXMoveAssignment) << ExpectedReturnType; HadError = true; } // A defaulted special member cannot have cv-qualifiers. if (Type->getMethodQuals().hasConst() || Type->getMethodQuals().hasVolatile()) { if (DeleteOnTypeMismatch) ShouldDeleteForTypeMismatch = true; else { Diag(MD->getLocation(), diag::err_defaulted_special_member_quals) << (CSM == CXXMoveAssignment) << getLangOpts().CPlusPlus14; HadError = true; } } } // Check for parameter type matching. QualType ArgType = ExpectedParams ? Type->getParamType(0) : QualType(); bool HasConstParam = false; if (ExpectedParams && ArgType->isReferenceType()) { // Argument must be reference to possibly-const T. QualType ReferentType = ArgType->getPointeeType(); HasConstParam = ReferentType.isConstQualified(); if (ReferentType.isVolatileQualified()) { if (DeleteOnTypeMismatch) ShouldDeleteForTypeMismatch = true; else { Diag(MD->getLocation(), diag::err_defaulted_special_member_volatile_param) << CSM; HadError = true; } } if (HasConstParam && !CanHaveConstParam) { if (DeleteOnTypeMismatch) ShouldDeleteForTypeMismatch = true; else if (CSM == CXXCopyConstructor || CSM == CXXCopyAssignment) { Diag(MD->getLocation(), diag::err_defaulted_special_member_copy_const_param) << (CSM == CXXCopyAssignment); // FIXME: Explain why this special member can't be const. HadError = true; } else { Diag(MD->getLocation(), diag::err_defaulted_special_member_move_const_param) << (CSM == CXXMoveAssignment); HadError = true; } } } else if (ExpectedParams) { // A copy assignment operator can take its argument by value, but a // defaulted one cannot. assert(CSM == CXXCopyAssignment && "unexpected non-ref argument"); Diag(MD->getLocation(), diag::err_defaulted_copy_assign_not_ref); HadError = true; } // C++11 [dcl.fct.def.default]p2: // An explicitly-defaulted function may be declared constexpr only if it // would have been implicitly declared as constexpr, // Do not apply this rule to members of class templates, since core issue 1358 // makes such functions always instantiate to constexpr functions. For // functions which cannot be constexpr (for non-constructors in C++11 and for // destructors in C++1y), this is checked elsewhere. // // FIXME: This should not apply if the member is deleted. bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, RD, CSM, HasConstParam); if ((getLangOpts().CPlusPlus14 ? !isa(MD) : isa(MD)) && MD->isConstexpr() && !Constexpr && MD->getTemplatedKind() == FunctionDecl::TK_NonTemplate) { Diag(MD->getBeginLoc(), MD->isConsteval() ? diag::err_incorrect_defaulted_consteval : diag::err_incorrect_defaulted_constexpr) << CSM; // FIXME: Explain why the special member can't be constexpr. HadError = true; } if (First) { // C++2a [dcl.fct.def.default]p3: // If a function is explicitly defaulted on its first declaration, it is // implicitly considered to be constexpr if the implicit declaration // would be. MD->setConstexprKind(Constexpr ? CSK_constexpr : CSK_unspecified); if (!Type->hasExceptionSpec()) { // C++2a [except.spec]p3: // If a declaration of a function does not have a noexcept-specifier // [and] is defaulted on its first declaration, [...] the exception // specification is as specified below FunctionProtoType::ExtProtoInfo EPI = Type->getExtProtoInfo(); EPI.ExceptionSpec.Type = EST_Unevaluated; EPI.ExceptionSpec.SourceDecl = MD; MD->setType(Context.getFunctionType(ReturnType, llvm::makeArrayRef(&ArgType, ExpectedParams), EPI)); } } if (ShouldDeleteForTypeMismatch || ShouldDeleteSpecialMember(MD, CSM)) { if (First) { SetDeclDeleted(MD, MD->getLocation()); if (!inTemplateInstantiation() && !HadError) { Diag(MD->getLocation(), diag::warn_defaulted_method_deleted) << CSM; if (ShouldDeleteForTypeMismatch) { Diag(MD->getLocation(), diag::note_deleted_type_mismatch) << CSM; } else { ShouldDeleteSpecialMember(MD, CSM, nullptr, /*Diagnose*/true); } } if (ShouldDeleteForTypeMismatch && !HadError) { Diag(MD->getLocation(), diag::warn_cxx17_compat_defaulted_method_type_mismatch) << CSM; } } else { // C++11 [dcl.fct.def.default]p4: // [For a] user-provided explicitly-defaulted function [...] if such a // function is implicitly defined as deleted, the program is ill-formed. Diag(MD->getLocation(), diag::err_out_of_line_default_deletes) << CSM; assert(!ShouldDeleteForTypeMismatch && "deleted non-first decl"); ShouldDeleteSpecialMember(MD, CSM, nullptr, /*Diagnose*/true); HadError = true; } } if (HadError) MD->setInvalidDecl(); } void Sema::CheckDelayedMemberExceptionSpecs() { decltype(DelayedOverridingExceptionSpecChecks) Overriding; decltype(DelayedEquivalentExceptionSpecChecks) Equivalent; std::swap(Overriding, DelayedOverridingExceptionSpecChecks); std::swap(Equivalent, DelayedEquivalentExceptionSpecChecks); // Perform any deferred checking of exception specifications for virtual // destructors. for (auto &Check : Overriding) CheckOverridingFunctionExceptionSpec(Check.first, Check.second); // Perform any deferred checking of exception specifications for befriended // special members. for (auto &Check : Equivalent) CheckEquivalentExceptionSpec(Check.second, Check.first); } namespace { /// CRTP base class for visiting operations performed by a special member /// function (or inherited constructor). template struct SpecialMemberVisitor { Sema &S; CXXMethodDecl *MD; Sema::CXXSpecialMember CSM; Sema::InheritedConstructorInfo *ICI; // Properties of the special member, computed for convenience. bool IsConstructor = false, IsAssignment = false, ConstArg = false; SpecialMemberVisitor(Sema &S, CXXMethodDecl *MD, Sema::CXXSpecialMember CSM, Sema::InheritedConstructorInfo *ICI) : S(S), MD(MD), CSM(CSM), ICI(ICI) { switch (CSM) { case Sema::CXXDefaultConstructor: case Sema::CXXCopyConstructor: case Sema::CXXMoveConstructor: IsConstructor = true; break; case Sema::CXXCopyAssignment: case Sema::CXXMoveAssignment: IsAssignment = true; break; case Sema::CXXDestructor: break; case Sema::CXXInvalid: llvm_unreachable("invalid special member kind"); } if (MD->getNumParams()) { if (const ReferenceType *RT = MD->getParamDecl(0)->getType()->getAs()) ConstArg = RT->getPointeeType().isConstQualified(); } } Derived &getDerived() { return static_cast(*this); } /// Is this a "move" special member? bool isMove() const { return CSM == Sema::CXXMoveConstructor || CSM == Sema::CXXMoveAssignment; } /// Look up the corresponding special member in the given class. Sema::SpecialMemberOverloadResult lookupIn(CXXRecordDecl *Class, unsigned Quals, bool IsMutable) { return lookupCallFromSpecialMember(S, Class, CSM, Quals, ConstArg && !IsMutable); } /// Look up the constructor for the specified base class to see if it's /// overridden due to this being an inherited constructor. Sema::SpecialMemberOverloadResult lookupInheritedCtor(CXXRecordDecl *Class) { if (!ICI) return {}; assert(CSM == Sema::CXXDefaultConstructor); auto *BaseCtor = cast(MD)->getInheritedConstructor().getConstructor(); if (auto *MD = ICI->findConstructorForBase(Class, BaseCtor).first) return MD; return {}; } /// A base or member subobject. typedef llvm::PointerUnion Subobject; /// Get the location to use for a subobject in diagnostics. static SourceLocation getSubobjectLoc(Subobject Subobj) { // FIXME: For an indirect virtual base, the direct base leading to // the indirect virtual base would be a more useful choice. if (auto *B = Subobj.dyn_cast()) return B->getBaseTypeLoc(); else return Subobj.get()->getLocation(); } enum BasesToVisit { /// Visit all non-virtual (direct) bases. VisitNonVirtualBases, /// Visit all direct bases, virtual or not. VisitDirectBases, /// Visit all non-virtual bases, and all virtual bases if the class /// is not abstract. VisitPotentiallyConstructedBases, /// Visit all direct or virtual bases. VisitAllBases }; // Visit the bases and members of the class. bool visit(BasesToVisit Bases) { CXXRecordDecl *RD = MD->getParent(); if (Bases == VisitPotentiallyConstructedBases) Bases = RD->isAbstract() ? VisitNonVirtualBases : VisitAllBases; for (auto &B : RD->bases()) if ((Bases == VisitDirectBases || !B.isVirtual()) && getDerived().visitBase(&B)) return true; if (Bases == VisitAllBases) for (auto &B : RD->vbases()) if (getDerived().visitBase(&B)) return true; for (auto *F : RD->fields()) if (!F->isInvalidDecl() && !F->isUnnamedBitfield() && getDerived().visitField(F)) return true; return false; } }; } namespace { struct SpecialMemberDeletionInfo : SpecialMemberVisitor { bool Diagnose; SourceLocation Loc; bool AllFieldsAreConst; SpecialMemberDeletionInfo(Sema &S, CXXMethodDecl *MD, Sema::CXXSpecialMember CSM, Sema::InheritedConstructorInfo *ICI, bool Diagnose) : SpecialMemberVisitor(S, MD, CSM, ICI), Diagnose(Diagnose), Loc(MD->getLocation()), AllFieldsAreConst(true) {} bool inUnion() const { return MD->getParent()->isUnion(); } Sema::CXXSpecialMember getEffectiveCSM() { return ICI ? Sema::CXXInvalid : CSM; } bool shouldDeleteForVariantObjCPtrMember(FieldDecl *FD, QualType FieldType); bool visitBase(CXXBaseSpecifier *Base) { return shouldDeleteForBase(Base); } bool visitField(FieldDecl *Field) { return shouldDeleteForField(Field); } bool shouldDeleteForBase(CXXBaseSpecifier *Base); bool shouldDeleteForField(FieldDecl *FD); bool shouldDeleteForAllConstMembers(); bool shouldDeleteForClassSubobject(CXXRecordDecl *Class, Subobject Subobj, unsigned Quals); bool shouldDeleteForSubobjectCall(Subobject Subobj, Sema::SpecialMemberOverloadResult SMOR, bool IsDtorCallInCtor); bool isAccessible(Subobject Subobj, CXXMethodDecl *D); }; } /// Is the given special member inaccessible when used on the given /// sub-object. bool SpecialMemberDeletionInfo::isAccessible(Subobject Subobj, CXXMethodDecl *target) { /// If we're operating on a base class, the object type is the /// type of this special member. QualType objectTy; AccessSpecifier access = target->getAccess(); if (CXXBaseSpecifier *base = Subobj.dyn_cast()) { objectTy = S.Context.getTypeDeclType(MD->getParent()); access = CXXRecordDecl::MergeAccess(base->getAccessSpecifier(), access); // If we're operating on a field, the object type is the type of the field. } else { objectTy = S.Context.getTypeDeclType(target->getParent()); } return S.isSpecialMemberAccessibleForDeletion(target, access, objectTy); } /// Check whether we should delete a special member due to the implicit /// definition containing a call to a special member of a subobject. bool SpecialMemberDeletionInfo::shouldDeleteForSubobjectCall( Subobject Subobj, Sema::SpecialMemberOverloadResult SMOR, bool IsDtorCallInCtor) { CXXMethodDecl *Decl = SMOR.getMethod(); FieldDecl *Field = Subobj.dyn_cast(); int DiagKind = -1; if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::NoMemberOrDeleted) DiagKind = !Decl ? 0 : 1; else if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::Ambiguous) DiagKind = 2; else if (!isAccessible(Subobj, Decl)) DiagKind = 3; else if (!IsDtorCallInCtor && Field && Field->getParent()->isUnion() && !Decl->isTrivial()) { // A member of a union must have a trivial corresponding special member. // As a weird special case, a destructor call from a union's constructor // must be accessible and non-deleted, but need not be trivial. Such a // destructor is never actually called, but is semantically checked as // if it were. DiagKind = 4; } if (DiagKind == -1) return false; if (Diagnose) { if (Field) { S.Diag(Field->getLocation(), diag::note_deleted_special_member_class_subobject) << getEffectiveCSM() << MD->getParent() << /*IsField*/true << Field << DiagKind << IsDtorCallInCtor << /*IsObjCPtr*/false; } else { CXXBaseSpecifier *Base = Subobj.get(); S.Diag(Base->getBeginLoc(), diag::note_deleted_special_member_class_subobject) << getEffectiveCSM() << MD->getParent() << /*IsField*/ false << Base->getType() << DiagKind << IsDtorCallInCtor << /*IsObjCPtr*/false; } if (DiagKind == 1) S.NoteDeletedFunction(Decl); // FIXME: Explain inaccessibility if DiagKind == 3. } return true; } /// Check whether we should delete a special member function due to having a /// direct or virtual base class or non-static data member of class type M. bool SpecialMemberDeletionInfo::shouldDeleteForClassSubobject( CXXRecordDecl *Class, Subobject Subobj, unsigned Quals) { FieldDecl *Field = Subobj.dyn_cast(); bool IsMutable = Field && Field->isMutable(); // C++11 [class.ctor]p5: // -- any direct or virtual base class, or non-static data member with no // brace-or-equal-initializer, has class type M (or array thereof) and // either M has no default constructor or overload resolution as applied // to M's default constructor results in an ambiguity or in a function // that is deleted or inaccessible // C++11 [class.copy]p11, C++11 [class.copy]p23: // -- a direct or virtual base class B that cannot be copied/moved because // overload resolution, as applied to B's corresponding special member, // results in an ambiguity or a function that is deleted or inaccessible // from the defaulted special member // C++11 [class.dtor]p5: // -- any direct or virtual base class [...] has a type with a destructor // that is deleted or inaccessible if (!(CSM == Sema::CXXDefaultConstructor && Field && Field->hasInClassInitializer()) && shouldDeleteForSubobjectCall(Subobj, lookupIn(Class, Quals, IsMutable), false)) return true; // C++11 [class.ctor]p5, C++11 [class.copy]p11: // -- any direct or virtual base class or non-static data member has a // type with a destructor that is deleted or inaccessible if (IsConstructor) { Sema::SpecialMemberOverloadResult SMOR = S.LookupSpecialMember(Class, Sema::CXXDestructor, false, false, false, false, false); if (shouldDeleteForSubobjectCall(Subobj, SMOR, true)) return true; } return false; } bool SpecialMemberDeletionInfo::shouldDeleteForVariantObjCPtrMember( FieldDecl *FD, QualType FieldType) { // The defaulted special functions are defined as deleted if this is a variant // member with a non-trivial ownership type, e.g., ObjC __strong or __weak // type under ARC. if (!FieldType.hasNonTrivialObjCLifetime()) return false; // Don't make the defaulted default constructor defined as deleted if the // member has an in-class initializer. if (CSM == Sema::CXXDefaultConstructor && FD->hasInClassInitializer()) return false; if (Diagnose) { auto *ParentClass = cast(FD->getParent()); S.Diag(FD->getLocation(), diag::note_deleted_special_member_class_subobject) << getEffectiveCSM() << ParentClass << /*IsField*/true << FD << 4 << /*IsDtorCallInCtor*/false << /*IsObjCPtr*/true; } return true; } /// Check whether we should delete a special member function due to the class /// having a particular direct or virtual base class. bool SpecialMemberDeletionInfo::shouldDeleteForBase(CXXBaseSpecifier *Base) { CXXRecordDecl *BaseClass = Base->getType()->getAsCXXRecordDecl(); // If program is correct, BaseClass cannot be null, but if it is, the error // must be reported elsewhere. if (!BaseClass) return false; // If we have an inheriting constructor, check whether we're calling an // inherited constructor instead of a default constructor. Sema::SpecialMemberOverloadResult SMOR = lookupInheritedCtor(BaseClass); if (auto *BaseCtor = SMOR.getMethod()) { // Note that we do not check access along this path; other than that, // this is the same as shouldDeleteForSubobjectCall(Base, BaseCtor, false); // FIXME: Check that the base has a usable destructor! Sink this into // shouldDeleteForClassSubobject. if (BaseCtor->isDeleted() && Diagnose) { S.Diag(Base->getBeginLoc(), diag::note_deleted_special_member_class_subobject) << getEffectiveCSM() << MD->getParent() << /*IsField*/ false << Base->getType() << /*Deleted*/ 1 << /*IsDtorCallInCtor*/ false << /*IsObjCPtr*/false; S.NoteDeletedFunction(BaseCtor); } return BaseCtor->isDeleted(); } return shouldDeleteForClassSubobject(BaseClass, Base, 0); } /// Check whether we should delete a special member function due to the class /// having a particular non-static data member. bool SpecialMemberDeletionInfo::shouldDeleteForField(FieldDecl *FD) { QualType FieldType = S.Context.getBaseElementType(FD->getType()); CXXRecordDecl *FieldRecord = FieldType->getAsCXXRecordDecl(); if (inUnion() && shouldDeleteForVariantObjCPtrMember(FD, FieldType)) return true; if (CSM == Sema::CXXDefaultConstructor) { // For a default constructor, all references must be initialized in-class // and, if a union, it must have a non-const member. if (FieldType->isReferenceType() && !FD->hasInClassInitializer()) { if (Diagnose) S.Diag(FD->getLocation(), diag::note_deleted_default_ctor_uninit_field) << !!ICI << MD->getParent() << FD << FieldType << /*Reference*/0; return true; } // C++11 [class.ctor]p5: any non-variant non-static data member of // const-qualified type (or array thereof) with no // brace-or-equal-initializer does not have a user-provided default // constructor. if (!inUnion() && FieldType.isConstQualified() && !FD->hasInClassInitializer() && (!FieldRecord || !FieldRecord->hasUserProvidedDefaultConstructor())) { if (Diagnose) S.Diag(FD->getLocation(), diag::note_deleted_default_ctor_uninit_field) << !!ICI << MD->getParent() << FD << FD->getType() << /*Const*/1; return true; } if (inUnion() && !FieldType.isConstQualified()) AllFieldsAreConst = false; } else if (CSM == Sema::CXXCopyConstructor) { // For a copy constructor, data members must not be of rvalue reference // type. if (FieldType->isRValueReferenceType()) { if (Diagnose) S.Diag(FD->getLocation(), diag::note_deleted_copy_ctor_rvalue_reference) << MD->getParent() << FD << FieldType; return true; } } else if (IsAssignment) { // For an assignment operator, data members must not be of reference type. if (FieldType->isReferenceType()) { if (Diagnose) S.Diag(FD->getLocation(), diag::note_deleted_assign_field) << isMove() << MD->getParent() << FD << FieldType << /*Reference*/0; return true; } if (!FieldRecord && FieldType.isConstQualified()) { // C++11 [class.copy]p23: // -- a non-static data member of const non-class type (or array thereof) if (Diagnose) S.Diag(FD->getLocation(), diag::note_deleted_assign_field) << isMove() << MD->getParent() << FD << FD->getType() << /*Const*/1; return true; } } if (FieldRecord) { // Some additional restrictions exist on the variant members. if (!inUnion() && FieldRecord->isUnion() && FieldRecord->isAnonymousStructOrUnion()) { bool AllVariantFieldsAreConst = true; // FIXME: Handle anonymous unions declared within anonymous unions. for (auto *UI : FieldRecord->fields()) { QualType UnionFieldType = S.Context.getBaseElementType(UI->getType()); if (shouldDeleteForVariantObjCPtrMember(&*UI, UnionFieldType)) return true; if (!UnionFieldType.isConstQualified()) AllVariantFieldsAreConst = false; CXXRecordDecl *UnionFieldRecord = UnionFieldType->getAsCXXRecordDecl(); if (UnionFieldRecord && shouldDeleteForClassSubobject(UnionFieldRecord, UI, UnionFieldType.getCVRQualifiers())) return true; } // At least one member in each anonymous union must be non-const if (CSM == Sema::CXXDefaultConstructor && AllVariantFieldsAreConst && !FieldRecord->field_empty()) { if (Diagnose) S.Diag(FieldRecord->getLocation(), diag::note_deleted_default_ctor_all_const) << !!ICI << MD->getParent() << /*anonymous union*/1; return true; } // Don't check the implicit member of the anonymous union type. // This is technically non-conformant, but sanity demands it. return false; } if (shouldDeleteForClassSubobject(FieldRecord, FD, FieldType.getCVRQualifiers())) return true; } return false; } /// C++11 [class.ctor] p5: /// A defaulted default constructor for a class X is defined as deleted if /// X is a union and all of its variant members are of const-qualified type. bool SpecialMemberDeletionInfo::shouldDeleteForAllConstMembers() { // This is a silly definition, because it gives an empty union a deleted // default constructor. Don't do that. if (CSM == Sema::CXXDefaultConstructor && inUnion() && AllFieldsAreConst) { bool AnyFields = false; for (auto *F : MD->getParent()->fields()) if ((AnyFields = !F->isUnnamedBitfield())) break; if (!AnyFields) return false; if (Diagnose) S.Diag(MD->getParent()->getLocation(), diag::note_deleted_default_ctor_all_const) << !!ICI << MD->getParent() << /*not anonymous union*/0; return true; } return false; } /// Determine whether a defaulted special member function should be defined as /// deleted, as specified in C++11 [class.ctor]p5, C++11 [class.copy]p11, /// C++11 [class.copy]p23, and C++11 [class.dtor]p5. bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, InheritedConstructorInfo *ICI, bool Diagnose) { if (MD->isInvalidDecl()) return false; CXXRecordDecl *RD = MD->getParent(); assert(!RD->isDependentType() && "do deletion after instantiation"); if (!LangOpts.CPlusPlus11 || RD->isInvalidDecl()) return false; // C++11 [expr.lambda.prim]p19: // The closure type associated with a lambda-expression has a // deleted (8.4.3) default constructor and a deleted copy // assignment operator. // C++2a adds back these operators if the lambda has no lambda-capture. if (RD->isLambda() && !RD->lambdaIsDefaultConstructibleAndAssignable() && (CSM == CXXDefaultConstructor || CSM == CXXCopyAssignment)) { if (Diagnose) Diag(RD->getLocation(), diag::note_lambda_decl); return true; } // For an anonymous struct or union, the copy and assignment special members // will never be used, so skip the check. For an anonymous union declared at // namespace scope, the constructor and destructor are used. if (CSM != CXXDefaultConstructor && CSM != CXXDestructor && RD->isAnonymousStructOrUnion()) return false; // C++11 [class.copy]p7, p18: // If the class definition declares a move constructor or move assignment // operator, an implicitly declared copy constructor or copy assignment // operator is defined as deleted. if (MD->isImplicit() && (CSM == CXXCopyConstructor || CSM == CXXCopyAssignment)) { CXXMethodDecl *UserDeclaredMove = nullptr; // In Microsoft mode up to MSVC 2013, a user-declared move only causes the // deletion of the corresponding copy operation, not both copy operations. // MSVC 2015 has adopted the standards conforming behavior. bool DeletesOnlyMatchingCopy = getLangOpts().MSVCCompat && !getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015); if (RD->hasUserDeclaredMoveConstructor() && (!DeletesOnlyMatchingCopy || CSM == CXXCopyConstructor)) { if (!Diagnose) return true; // Find any user-declared move constructor. for (auto *I : RD->ctors()) { if (I->isMoveConstructor()) { UserDeclaredMove = I; break; } } assert(UserDeclaredMove); } else if (RD->hasUserDeclaredMoveAssignment() && (!DeletesOnlyMatchingCopy || CSM == CXXCopyAssignment)) { if (!Diagnose) return true; // Find any user-declared move assignment operator. for (auto *I : RD->methods()) { if (I->isMoveAssignmentOperator()) { UserDeclaredMove = I; break; } } assert(UserDeclaredMove); } if (UserDeclaredMove) { Diag(UserDeclaredMove->getLocation(), diag::note_deleted_copy_user_declared_move) << (CSM == CXXCopyAssignment) << RD << UserDeclaredMove->isMoveAssignmentOperator(); return true; } } // Do access control from the special member function ContextRAII MethodContext(*this, MD); // C++11 [class.dtor]p5: // -- for a virtual destructor, lookup of the non-array deallocation function // results in an ambiguity or in a function that is deleted or inaccessible if (CSM == CXXDestructor && MD->isVirtual()) { FunctionDecl *OperatorDelete = nullptr; DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Delete); if (FindDeallocationFunction(MD->getLocation(), MD->getParent(), Name, OperatorDelete, /*Diagnose*/false)) { if (Diagnose) Diag(RD->getLocation(), diag::note_deleted_dtor_no_operator_delete); return true; } } SpecialMemberDeletionInfo SMI(*this, MD, CSM, ICI, Diagnose); // Per DR1611, do not consider virtual bases of constructors of abstract // classes, since we are not going to construct them. // Per DR1658, do not consider virtual bases of destructors of abstract // classes either. // Per DR2180, for assignment operators we only assign (and thus only // consider) direct bases. if (SMI.visit(SMI.IsAssignment ? SMI.VisitDirectBases : SMI.VisitPotentiallyConstructedBases)) return true; if (SMI.shouldDeleteForAllConstMembers()) return true; if (getLangOpts().CUDA) { // We should delete the special member in CUDA mode if target inference // failed. // For inherited constructors (non-null ICI), CSM may be passed so that MD // is treated as certain special member, which may not reflect what special // member MD really is. However inferCUDATargetForImplicitSpecialMember // expects CSM to match MD, therefore recalculate CSM. assert(ICI || CSM == getSpecialMember(MD)); auto RealCSM = CSM; if (ICI) RealCSM = getSpecialMember(MD); return inferCUDATargetForImplicitSpecialMember(RD, RealCSM, MD, SMI.ConstArg, Diagnose); } return false; } /// Perform lookup for a special member of the specified kind, and determine /// whether it is trivial. If the triviality can be determined without the /// lookup, skip it. This is intended for use when determining whether a /// special member of a containing object is trivial, and thus does not ever /// perform overload resolution for default constructors. /// /// If \p Selected is not \c NULL, \c *Selected will be filled in with the /// member that was most likely to be intended to be trivial, if any. /// /// If \p ForCall is true, look at CXXRecord::HasTrivialSpecialMembersForCall to /// determine whether the special member is trivial. static bool findTrivialSpecialMember(Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM, unsigned Quals, bool ConstRHS, Sema::TrivialABIHandling TAH, CXXMethodDecl **Selected) { if (Selected) *Selected = nullptr; switch (CSM) { case Sema::CXXInvalid: llvm_unreachable("not a special member"); case Sema::CXXDefaultConstructor: // C++11 [class.ctor]p5: // A default constructor is trivial if: // - all the [direct subobjects] have trivial default constructors // // Note, no overload resolution is performed in this case. if (RD->hasTrivialDefaultConstructor()) return true; if (Selected) { // If there's a default constructor which could have been trivial, dig it // out. Otherwise, if there's any user-provided default constructor, point // to that as an example of why there's not a trivial one. CXXConstructorDecl *DefCtor = nullptr; if (RD->needsImplicitDefaultConstructor()) S.DeclareImplicitDefaultConstructor(RD); for (auto *CI : RD->ctors()) { if (!CI->isDefaultConstructor()) continue; DefCtor = CI; if (!DefCtor->isUserProvided()) break; } *Selected = DefCtor; } return false; case Sema::CXXDestructor: // C++11 [class.dtor]p5: // A destructor is trivial if: // - all the direct [subobjects] have trivial destructors if (RD->hasTrivialDestructor() || (TAH == Sema::TAH_ConsiderTrivialABI && RD->hasTrivialDestructorForCall())) return true; if (Selected) { if (RD->needsImplicitDestructor()) S.DeclareImplicitDestructor(RD); *Selected = RD->getDestructor(); } return false; case Sema::CXXCopyConstructor: // C++11 [class.copy]p12: // A copy constructor is trivial if: // - the constructor selected to copy each direct [subobject] is trivial if (RD->hasTrivialCopyConstructor() || (TAH == Sema::TAH_ConsiderTrivialABI && RD->hasTrivialCopyConstructorForCall())) { if (Quals == Qualifiers::Const) // We must either select the trivial copy constructor or reach an // ambiguity; no need to actually perform overload resolution. return true; } else if (!Selected) { return false; } // In C++98, we are not supposed to perform overload resolution here, but we // treat that as a language defect, as suggested on cxx-abi-dev, to treat // cases like B as having a non-trivial copy constructor: // struct A { template A(T&); }; // struct B { mutable A a; }; goto NeedOverloadResolution; case Sema::CXXCopyAssignment: // C++11 [class.copy]p25: // A copy assignment operator is trivial if: // - the assignment operator selected to copy each direct [subobject] is // trivial if (RD->hasTrivialCopyAssignment()) { if (Quals == Qualifiers::Const) return true; } else if (!Selected) { return false; } // In C++98, we are not supposed to perform overload resolution here, but we // treat that as a language defect. goto NeedOverloadResolution; case Sema::CXXMoveConstructor: case Sema::CXXMoveAssignment: NeedOverloadResolution: Sema::SpecialMemberOverloadResult SMOR = lookupCallFromSpecialMember(S, RD, CSM, Quals, ConstRHS); // The standard doesn't describe how to behave if the lookup is ambiguous. // We treat it as not making the member non-trivial, just like the standard // mandates for the default constructor. This should rarely matter, because // the member will also be deleted. if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::Ambiguous) return true; if (!SMOR.getMethod()) { assert(SMOR.getKind() == Sema::SpecialMemberOverloadResult::NoMemberOrDeleted); return false; } // We deliberately don't check if we found a deleted special member. We're // not supposed to! if (Selected) *Selected = SMOR.getMethod(); if (TAH == Sema::TAH_ConsiderTrivialABI && (CSM == Sema::CXXCopyConstructor || CSM == Sema::CXXMoveConstructor)) return SMOR.getMethod()->isTrivialForCall(); return SMOR.getMethod()->isTrivial(); } llvm_unreachable("unknown special method kind"); } static CXXConstructorDecl *findUserDeclaredCtor(CXXRecordDecl *RD) { for (auto *CI : RD->ctors()) if (!CI->isImplicit()) return CI; // Look for constructor templates. typedef CXXRecordDecl::specific_decl_iterator tmpl_iter; for (tmpl_iter TI(RD->decls_begin()), TE(RD->decls_end()); TI != TE; ++TI) { if (CXXConstructorDecl *CD = dyn_cast(TI->getTemplatedDecl())) return CD; } return nullptr; } /// The kind of subobject we are checking for triviality. The values of this /// enumeration are used in diagnostics. enum TrivialSubobjectKind { /// The subobject is a base class. TSK_BaseClass, /// The subobject is a non-static data member. TSK_Field, /// The object is actually the complete object. TSK_CompleteObject }; /// Check whether the special member selected for a given type would be trivial. static bool checkTrivialSubobjectCall(Sema &S, SourceLocation SubobjLoc, QualType SubType, bool ConstRHS, Sema::CXXSpecialMember CSM, TrivialSubobjectKind Kind, Sema::TrivialABIHandling TAH, bool Diagnose) { CXXRecordDecl *SubRD = SubType->getAsCXXRecordDecl(); if (!SubRD) return true; CXXMethodDecl *Selected; if (findTrivialSpecialMember(S, SubRD, CSM, SubType.getCVRQualifiers(), ConstRHS, TAH, Diagnose ? &Selected : nullptr)) return true; if (Diagnose) { if (ConstRHS) SubType.addConst(); if (!Selected && CSM == Sema::CXXDefaultConstructor) { S.Diag(SubobjLoc, diag::note_nontrivial_no_def_ctor) << Kind << SubType.getUnqualifiedType(); if (CXXConstructorDecl *CD = findUserDeclaredCtor(SubRD)) S.Diag(CD->getLocation(), diag::note_user_declared_ctor); } else if (!Selected) S.Diag(SubobjLoc, diag::note_nontrivial_no_copy) << Kind << SubType.getUnqualifiedType() << CSM << SubType; else if (Selected->isUserProvided()) { if (Kind == TSK_CompleteObject) S.Diag(Selected->getLocation(), diag::note_nontrivial_user_provided) << Kind << SubType.getUnqualifiedType() << CSM; else { S.Diag(SubobjLoc, diag::note_nontrivial_user_provided) << Kind << SubType.getUnqualifiedType() << CSM; S.Diag(Selected->getLocation(), diag::note_declared_at); } } else { if (Kind != TSK_CompleteObject) S.Diag(SubobjLoc, diag::note_nontrivial_subobject) << Kind << SubType.getUnqualifiedType() << CSM; // Explain why the defaulted or deleted special member isn't trivial. S.SpecialMemberIsTrivial(Selected, CSM, Sema::TAH_IgnoreTrivialABI, Diagnose); } } return false; } /// Check whether the members of a class type allow a special member to be /// trivial. static bool checkTrivialClassMembers(Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM, bool ConstArg, Sema::TrivialABIHandling TAH, bool Diagnose) { for (const auto *FI : RD->fields()) { if (FI->isInvalidDecl() || FI->isUnnamedBitfield()) continue; QualType FieldType = S.Context.getBaseElementType(FI->getType()); // Pretend anonymous struct or union members are members of this class. if (FI->isAnonymousStructOrUnion()) { if (!checkTrivialClassMembers(S, FieldType->getAsCXXRecordDecl(), CSM, ConstArg, TAH, Diagnose)) return false; continue; } // C++11 [class.ctor]p5: // A default constructor is trivial if [...] // -- no non-static data member of its class has a // brace-or-equal-initializer if (CSM == Sema::CXXDefaultConstructor && FI->hasInClassInitializer()) { if (Diagnose) S.Diag(FI->getLocation(), diag::note_nontrivial_in_class_init) << FI; return false; } // Objective C ARC 4.3.5: // [...] nontrivally ownership-qualified types are [...] not trivially // default constructible, copy constructible, move constructible, copy // assignable, move assignable, or destructible [...] if (FieldType.hasNonTrivialObjCLifetime()) { if (Diagnose) S.Diag(FI->getLocation(), diag::note_nontrivial_objc_ownership) << RD << FieldType.getObjCLifetime(); return false; } bool ConstRHS = ConstArg && !FI->isMutable(); if (!checkTrivialSubobjectCall(S, FI->getLocation(), FieldType, ConstRHS, CSM, TSK_Field, TAH, Diagnose)) return false; } return true; } /// Diagnose why the specified class does not have a trivial special member of /// the given kind. void Sema::DiagnoseNontrivial(const CXXRecordDecl *RD, CXXSpecialMember CSM) { QualType Ty = Context.getRecordType(RD); bool ConstArg = (CSM == CXXCopyConstructor || CSM == CXXCopyAssignment); checkTrivialSubobjectCall(*this, RD->getLocation(), Ty, ConstArg, CSM, TSK_CompleteObject, TAH_IgnoreTrivialABI, /*Diagnose*/true); } /// Determine whether a defaulted or deleted special member function is trivial, /// as specified in C++11 [class.ctor]p5, C++11 [class.copy]p12, /// C++11 [class.copy]p25, and C++11 [class.dtor]p5. bool Sema::SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, TrivialABIHandling TAH, bool Diagnose) { assert(!MD->isUserProvided() && CSM != CXXInvalid && "not special enough"); CXXRecordDecl *RD = MD->getParent(); bool ConstArg = false; // C++11 [class.copy]p12, p25: [DR1593] // A [special member] is trivial if [...] its parameter-type-list is // equivalent to the parameter-type-list of an implicit declaration [...] switch (CSM) { case CXXDefaultConstructor: case CXXDestructor: // Trivial default constructors and destructors cannot have parameters. break; case CXXCopyConstructor: case CXXCopyAssignment: { // Trivial copy operations always have const, non-volatile parameter types. ConstArg = true; const ParmVarDecl *Param0 = MD->getParamDecl(0); const ReferenceType *RT = Param0->getType()->getAs(); if (!RT || RT->getPointeeType().getCVRQualifiers() != Qualifiers::Const) { if (Diagnose) Diag(Param0->getLocation(), diag::note_nontrivial_param_type) << Param0->getSourceRange() << Param0->getType() << Context.getLValueReferenceType( Context.getRecordType(RD).withConst()); return false; } break; } case CXXMoveConstructor: case CXXMoveAssignment: { // Trivial move operations always have non-cv-qualified parameters. const ParmVarDecl *Param0 = MD->getParamDecl(0); const RValueReferenceType *RT = Param0->getType()->getAs(); if (!RT || RT->getPointeeType().getCVRQualifiers()) { if (Diagnose) Diag(Param0->getLocation(), diag::note_nontrivial_param_type) << Param0->getSourceRange() << Param0->getType() << Context.getRValueReferenceType(Context.getRecordType(RD)); return false; } break; } case CXXInvalid: llvm_unreachable("not a special member"); } if (MD->getMinRequiredArguments() < MD->getNumParams()) { if (Diagnose) Diag(MD->getParamDecl(MD->getMinRequiredArguments())->getLocation(), diag::note_nontrivial_default_arg) << MD->getParamDecl(MD->getMinRequiredArguments())->getSourceRange(); return false; } if (MD->isVariadic()) { if (Diagnose) Diag(MD->getLocation(), diag::note_nontrivial_variadic); return false; } // C++11 [class.ctor]p5, C++11 [class.dtor]p5: // A copy/move [constructor or assignment operator] is trivial if // -- the [member] selected to copy/move each direct base class subobject // is trivial // // C++11 [class.copy]p12, C++11 [class.copy]p25: // A [default constructor or destructor] is trivial if // -- all the direct base classes have trivial [default constructors or // destructors] for (const auto &BI : RD->bases()) if (!checkTrivialSubobjectCall(*this, BI.getBeginLoc(), BI.getType(), ConstArg, CSM, TSK_BaseClass, TAH, Diagnose)) return false; // C++11 [class.ctor]p5, C++11 [class.dtor]p5: // A copy/move [constructor or assignment operator] for a class X is // trivial if // -- for each non-static data member of X that is of class type (or array // thereof), the constructor selected to copy/move that member is // trivial // // C++11 [class.copy]p12, C++11 [class.copy]p25: // A [default constructor or destructor] is trivial if // -- for all of the non-static data members of its class that are of class // type (or array thereof), each such class has a trivial [default // constructor or destructor] if (!checkTrivialClassMembers(*this, RD, CSM, ConstArg, TAH, Diagnose)) return false; // C++11 [class.dtor]p5: // A destructor is trivial if [...] // -- the destructor is not virtual if (CSM == CXXDestructor && MD->isVirtual()) { if (Diagnose) Diag(MD->getLocation(), diag::note_nontrivial_virtual_dtor) << RD; return false; } // C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25: // A [special member] for class X is trivial if [...] // -- class X has no virtual functions and no virtual base classes if (CSM != CXXDestructor && MD->getParent()->isDynamicClass()) { if (!Diagnose) return false; if (RD->getNumVBases()) { // Check for virtual bases. We already know that the corresponding // member in all bases is trivial, so vbases must all be direct. CXXBaseSpecifier &BS = *RD->vbases_begin(); assert(BS.isVirtual()); Diag(BS.getBeginLoc(), diag::note_nontrivial_has_virtual) << RD << 1; return false; } // Must have a virtual method. for (const auto *MI : RD->methods()) { if (MI->isVirtual()) { SourceLocation MLoc = MI->getBeginLoc(); Diag(MLoc, diag::note_nontrivial_has_virtual) << RD << 0; return false; } } llvm_unreachable("dynamic class with no vbases and no virtual functions"); } // Looks like it's trivial! return true; } namespace { struct FindHiddenVirtualMethod { Sema *S; CXXMethodDecl *Method; llvm::SmallPtrSet OverridenAndUsingBaseMethods; SmallVector OverloadedMethods; private: /// Check whether any most overridden method from MD in Methods static bool CheckMostOverridenMethods( const CXXMethodDecl *MD, const llvm::SmallPtrSetImpl &Methods) { if (MD->size_overridden_methods() == 0) return Methods.count(MD->getCanonicalDecl()); for (const CXXMethodDecl *O : MD->overridden_methods()) if (CheckMostOverridenMethods(O, Methods)) return true; return false; } public: /// Member lookup function that determines whether a given C++ /// method overloads virtual methods in a base class without overriding any, /// to be used with CXXRecordDecl::lookupInBases(). bool operator()(const CXXBaseSpecifier *Specifier, CXXBasePath &Path) { RecordDecl *BaseRecord = Specifier->getType()->getAs()->getDecl(); DeclarationName Name = Method->getDeclName(); assert(Name.getNameKind() == DeclarationName::Identifier); bool foundSameNameMethod = false; SmallVector overloadedMethods; for (Path.Decls = BaseRecord->lookup(Name); !Path.Decls.empty(); Path.Decls = Path.Decls.slice(1)) { NamedDecl *D = Path.Decls.front(); if (CXXMethodDecl *MD = dyn_cast(D)) { MD = MD->getCanonicalDecl(); foundSameNameMethod = true; // Interested only in hidden virtual methods. if (!MD->isVirtual()) continue; // If the method we are checking overrides a method from its base // don't warn about the other overloaded methods. Clang deviates from // GCC by only diagnosing overloads of inherited virtual functions that // do not override any other virtual functions in the base. GCC's // -Woverloaded-virtual diagnoses any derived function hiding a virtual // function from a base class. These cases may be better served by a // warning (not specific to virtual functions) on call sites when the // call would select a different function from the base class, were it // visible. // See FIXME in test/SemaCXX/warn-overload-virtual.cpp for an example. if (!S->IsOverload(Method, MD, false)) return true; // Collect the overload only if its hidden. if (!CheckMostOverridenMethods(MD, OverridenAndUsingBaseMethods)) overloadedMethods.push_back(MD); } } if (foundSameNameMethod) OverloadedMethods.append(overloadedMethods.begin(), overloadedMethods.end()); return foundSameNameMethod; } }; } // end anonymous namespace /// Add the most overriden methods from MD to Methods static void AddMostOverridenMethods(const CXXMethodDecl *MD, llvm::SmallPtrSetImpl& Methods) { if (MD->size_overridden_methods() == 0) Methods.insert(MD->getCanonicalDecl()); else for (const CXXMethodDecl *O : MD->overridden_methods()) AddMostOverridenMethods(O, Methods); } /// Check if a method overloads virtual methods in a base class without /// overriding any. void Sema::FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl &OverloadedMethods) { if (!MD->getDeclName().isIdentifier()) return; CXXBasePaths Paths(/*FindAmbiguities=*/true, // true to look in all bases. /*bool RecordPaths=*/false, /*bool DetectVirtual=*/false); FindHiddenVirtualMethod FHVM; FHVM.Method = MD; FHVM.S = this; // Keep the base methods that were overridden or introduced in the subclass // by 'using' in a set. A base method not in this set is hidden. CXXRecordDecl *DC = MD->getParent(); DeclContext::lookup_result R = DC->lookup(MD->getDeclName()); for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; ++I) { NamedDecl *ND = *I; if (UsingShadowDecl *shad = dyn_cast(*I)) ND = shad->getTargetDecl(); if (CXXMethodDecl *MD = dyn_cast(ND)) AddMostOverridenMethods(MD, FHVM.OverridenAndUsingBaseMethods); } if (DC->lookupInBases(FHVM, Paths)) OverloadedMethods = FHVM.OverloadedMethods; } void Sema::NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl &OverloadedMethods) { for (unsigned i = 0, e = OverloadedMethods.size(); i != e; ++i) { CXXMethodDecl *overloadedMD = OverloadedMethods[i]; PartialDiagnostic PD = PDiag( diag::note_hidden_overloaded_virtual_declared_here) << overloadedMD; HandleFunctionTypeMismatch(PD, MD->getType(), overloadedMD->getType()); Diag(overloadedMD->getLocation(), PD); } } /// Diagnose methods which overload virtual methods in a base class /// without overriding any. void Sema::DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD) { if (MD->isInvalidDecl()) return; if (Diags.isIgnored(diag::warn_overloaded_virtual, MD->getLocation())) return; SmallVector OverloadedMethods; FindHiddenVirtualMethods(MD, OverloadedMethods); if (!OverloadedMethods.empty()) { Diag(MD->getLocation(), diag::warn_overloaded_virtual) << MD << (OverloadedMethods.size() > 1); NoteHiddenVirtualMethods(MD, OverloadedMethods); } } void Sema::checkIllFormedTrivialABIStruct(CXXRecordDecl &RD) { auto PrintDiagAndRemoveAttr = [&]() { // No diagnostics if this is a template instantiation. if (!isTemplateInstantiation(RD.getTemplateSpecializationKind())) Diag(RD.getAttr()->getLocation(), diag::ext_cannot_use_trivial_abi) << &RD; RD.dropAttr(); }; // Ill-formed if the struct has virtual functions. if (RD.isPolymorphic()) { PrintDiagAndRemoveAttr(); return; } for (const auto &B : RD.bases()) { // Ill-formed if the base class is non-trivial for the purpose of calls or a // virtual base. if ((!B.getType()->isDependentType() && !B.getType()->getAsCXXRecordDecl()->canPassInRegisters()) || B.isVirtual()) { PrintDiagAndRemoveAttr(); return; } } for (const auto *FD : RD.fields()) { // Ill-formed if the field is an ObjectiveC pointer or of a type that is // non-trivial for the purpose of calls. QualType FT = FD->getType(); if (FT.getObjCLifetime() == Qualifiers::OCL_Weak) { PrintDiagAndRemoveAttr(); return; } if (const auto *RT = FT->getBaseElementTypeUnsafe()->getAs()) if (!RT->isDependentType() && !cast(RT->getDecl())->canPassInRegisters()) { PrintDiagAndRemoveAttr(); return; } } } void Sema::ActOnFinishCXXMemberSpecification( Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList) { if (!TagDecl) return; AdjustDeclIfTemplate(TagDecl); for (const ParsedAttr &AL : AttrList) { if (AL.getKind() != ParsedAttr::AT_Visibility) continue; AL.setInvalid(); Diag(AL.getLoc(), diag::warn_attribute_after_definition_ignored) << AL.getName(); } ActOnFields(S, RLoc, TagDecl, llvm::makeArrayRef( // strict aliasing violation! reinterpret_cast(FieldCollector->getCurFields()), FieldCollector->getCurNumFields()), LBrac, RBrac, AttrList); CheckCompletedCXXClass(cast(TagDecl)); } /// AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared /// special functions, such as the default constructor, copy /// constructor, or destructor, to the given C++ class (C++ /// [special]p1). This routine can only be executed just before the /// definition of the class is complete. void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { if (ClassDecl->needsImplicitDefaultConstructor()) { ++getASTContext().NumImplicitDefaultConstructors; if (ClassDecl->hasInheritedConstructor()) DeclareImplicitDefaultConstructor(ClassDecl); } if (ClassDecl->needsImplicitCopyConstructor()) { ++getASTContext().NumImplicitCopyConstructors; // If the properties or semantics of the copy constructor couldn't be // determined while the class was being declared, force a declaration // of it now. if (ClassDecl->needsOverloadResolutionForCopyConstructor() || ClassDecl->hasInheritedConstructor()) DeclareImplicitCopyConstructor(ClassDecl); // For the MS ABI we need to know whether the copy ctor is deleted. A // prerequisite for deleting the implicit copy ctor is that the class has a // move ctor or move assignment that is either user-declared or whose // semantics are inherited from a subobject. FIXME: We should provide a more // direct way for CodeGen to ask whether the constructor was deleted. else if (Context.getTargetInfo().getCXXABI().isMicrosoft() && (ClassDecl->hasUserDeclaredMoveConstructor() || ClassDecl->needsOverloadResolutionForMoveConstructor() || ClassDecl->hasUserDeclaredMoveAssignment() || ClassDecl->needsOverloadResolutionForMoveAssignment())) DeclareImplicitCopyConstructor(ClassDecl); } if (getLangOpts().CPlusPlus11 && ClassDecl->needsImplicitMoveConstructor()) { ++getASTContext().NumImplicitMoveConstructors; if (ClassDecl->needsOverloadResolutionForMoveConstructor() || ClassDecl->hasInheritedConstructor()) DeclareImplicitMoveConstructor(ClassDecl); } if (ClassDecl->needsImplicitCopyAssignment()) { ++getASTContext().NumImplicitCopyAssignmentOperators; // If we have a dynamic class, then the copy assignment operator may be // virtual, so we have to declare it immediately. This ensures that, e.g., // it shows up in the right place in the vtable and that we diagnose // problems with the implicit exception specification. if (ClassDecl->isDynamicClass() || ClassDecl->needsOverloadResolutionForCopyAssignment() || ClassDecl->hasInheritedAssignment()) DeclareImplicitCopyAssignment(ClassDecl); } if (getLangOpts().CPlusPlus11 && ClassDecl->needsImplicitMoveAssignment()) { ++getASTContext().NumImplicitMoveAssignmentOperators; // Likewise for the move assignment operator. if (ClassDecl->isDynamicClass() || ClassDecl->needsOverloadResolutionForMoveAssignment() || ClassDecl->hasInheritedAssignment()) DeclareImplicitMoveAssignment(ClassDecl); } if (ClassDecl->needsImplicitDestructor()) { ++getASTContext().NumImplicitDestructors; // If we have a dynamic class, then the destructor may be virtual, so we // have to declare the destructor immediately. This ensures that, e.g., it // shows up in the right place in the vtable and that we diagnose problems // with the implicit exception specification. if (ClassDecl->isDynamicClass() || ClassDecl->needsOverloadResolutionForDestructor()) DeclareImplicitDestructor(ClassDecl); } } unsigned Sema::ActOnReenterTemplateScope(Scope *S, Decl *D) { if (!D) return 0; // The order of template parameters is not important here. All names // get added to the same scope. SmallVector ParameterLists; if (TemplateDecl *TD = dyn_cast(D)) D = TD->getTemplatedDecl(); if (auto *PSD = dyn_cast(D)) ParameterLists.push_back(PSD->getTemplateParameters()); if (DeclaratorDecl *DD = dyn_cast(D)) { for (unsigned i = 0; i < DD->getNumTemplateParameterLists(); ++i) ParameterLists.push_back(DD->getTemplateParameterList(i)); if (FunctionDecl *FD = dyn_cast(D)) { if (FunctionTemplateDecl *FTD = FD->getDescribedFunctionTemplate()) ParameterLists.push_back(FTD->getTemplateParameters()); } } if (TagDecl *TD = dyn_cast(D)) { for (unsigned i = 0; i < TD->getNumTemplateParameterLists(); ++i) ParameterLists.push_back(TD->getTemplateParameterList(i)); if (CXXRecordDecl *RD = dyn_cast(TD)) { if (ClassTemplateDecl *CTD = RD->getDescribedClassTemplate()) ParameterLists.push_back(CTD->getTemplateParameters()); } } unsigned Count = 0; for (TemplateParameterList *Params : ParameterLists) { if (Params->size() > 0) // Ignore explicit specializations; they don't contribute to the template // depth. ++Count; for (NamedDecl *Param : *Params) { if (Param->getDeclName()) { S->AddDecl(Param); IdResolver.AddDecl(Param); } } } return Count; } void Sema::ActOnStartDelayedMemberDeclarations(Scope *S, Decl *RecordD) { if (!RecordD) return; AdjustDeclIfTemplate(RecordD); CXXRecordDecl *Record = cast(RecordD); PushDeclContext(S, Record); } void Sema::ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *RecordD) { if (!RecordD) return; PopDeclContext(); } /// This is used to implement the constant expression evaluation part of the /// attribute enable_if extension. There is nothing in standard C++ which would /// require reentering parameters. void Sema::ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param) { if (!Param) return; S->AddDecl(Param); if (Param->getDeclName()) IdResolver.AddDecl(Param); } /// ActOnStartDelayedCXXMethodDeclaration - We have completed /// parsing a top-level (non-nested) C++ class, and we are now /// parsing those parts of the given Method declaration that could /// not be parsed earlier (C++ [class.mem]p2), such as default /// arguments. This action should enter the scope of the given /// Method declaration as if we had just parsed the qualified method /// name. However, it should not bring the parameters into scope; /// that will be performed by ActOnDelayedCXXMethodParameter. void Sema::ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *MethodD) { } /// ActOnDelayedCXXMethodParameter - We've already started a delayed /// C++ method declaration. We're (re-)introducing the given /// function parameter into scope for use in parsing later parts of /// the method declaration. For example, we could see an /// ActOnParamDefaultArgument event for this parameter. void Sema::ActOnDelayedCXXMethodParameter(Scope *S, Decl *ParamD) { if (!ParamD) return; ParmVarDecl *Param = cast(ParamD); // If this parameter has an unparsed default argument, clear it out // to make way for the parsed default argument. if (Param->hasUnparsedDefaultArg()) Param->setDefaultArg(nullptr); S->AddDecl(Param); if (Param->getDeclName()) IdResolver.AddDecl(Param); } /// ActOnFinishDelayedCXXMethodDeclaration - We have finished /// processing the delayed method declaration for Method. The method /// declaration is now considered finished. There may be a separate /// ActOnStartOfFunctionDef action later (not necessarily /// immediately!) for this method, if it was also defined inside the /// class body. void Sema::ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *MethodD) { if (!MethodD) return; AdjustDeclIfTemplate(MethodD); FunctionDecl *Method = cast(MethodD); // Now that we have our default arguments, check the constructor // again. It could produce additional diagnostics or affect whether // the class has implicitly-declared destructors, among other // things. if (CXXConstructorDecl *Constructor = dyn_cast(Method)) CheckConstructor(Constructor); // Check the default arguments, which we may have added. if (!Method->isInvalidDecl()) CheckCXXDefaultArguments(Method); } // Emit the given diagnostic for each non-address-space qualifier. // Common part of CheckConstructorDeclarator and CheckDestructorDeclarator. static void checkMethodTypeQualifiers(Sema &S, Declarator &D, unsigned DiagID) { const DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); if (FTI.hasMethodTypeQualifiers() && !D.isInvalidType()) { bool DiagOccured = false; FTI.MethodQualifiers->forEachQualifier( [DiagID, &S, &DiagOccured](DeclSpec::TQ, StringRef QualName, SourceLocation SL) { // This diagnostic should be emitted on any qualifier except an addr // space qualifier. However, forEachQualifier currently doesn't visit // addr space qualifiers, so there's no way to write this condition // right now; we just diagnose on everything. S.Diag(SL, DiagID) << QualName << SourceRange(SL); DiagOccured = true; }); if (DiagOccured) D.setInvalidType(); } } /// CheckConstructorDeclarator - Called by ActOnDeclarator to check /// the well-formedness of the constructor declarator @p D with type @p /// R. If there are any errors in the declarator, this routine will /// emit diagnostics and set the invalid bit to true. In any case, the type /// will be updated to reflect a well-formed type for the constructor and /// returned. QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC) { bool isVirtual = D.getDeclSpec().isVirtualSpecified(); // C++ [class.ctor]p3: // A constructor shall not be virtual (10.3) or static (9.4). A // constructor can be invoked for a const, volatile or const // volatile object. A constructor shall not be declared const, // volatile, or const volatile (9.3.2). if (isVirtual) { if (!D.isInvalidType()) Diag(D.getIdentifierLoc(), diag::err_constructor_cannot_be) << "virtual" << SourceRange(D.getDeclSpec().getVirtualSpecLoc()) << SourceRange(D.getIdentifierLoc()); D.setInvalidType(); } if (SC == SC_Static) { if (!D.isInvalidType()) Diag(D.getIdentifierLoc(), diag::err_constructor_cannot_be) << "static" << SourceRange(D.getDeclSpec().getStorageClassSpecLoc()) << SourceRange(D.getIdentifierLoc()); D.setInvalidType(); SC = SC_None; } if (unsigned TypeQuals = D.getDeclSpec().getTypeQualifiers()) { diagnoseIgnoredQualifiers( diag::err_constructor_return_type, TypeQuals, SourceLocation(), D.getDeclSpec().getConstSpecLoc(), D.getDeclSpec().getVolatileSpecLoc(), D.getDeclSpec().getRestrictSpecLoc(), D.getDeclSpec().getAtomicSpecLoc()); D.setInvalidType(); } checkMethodTypeQualifiers(*this, D, diag::err_invalid_qualified_constructor); // C++0x [class.ctor]p4: // A constructor shall not be declared with a ref-qualifier. DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); if (FTI.hasRefQualifier()) { Diag(FTI.getRefQualifierLoc(), diag::err_ref_qualifier_constructor) << FTI.RefQualifierIsLValueRef << FixItHint::CreateRemoval(FTI.getRefQualifierLoc()); D.setInvalidType(); } // Rebuild the function type "R" without any type qualifiers (in // case any of the errors above fired) and with "void" as the // return type, since constructors don't have return types. const FunctionProtoType *Proto = R->getAs(); if (Proto->getReturnType() == Context.VoidTy && !D.isInvalidType()) return R; FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); EPI.TypeQuals = Qualifiers(); EPI.RefQualifier = RQ_None; return Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(), EPI); } /// CheckConstructor - Checks a fully-formed constructor for /// well-formedness, issuing any diagnostics required. Returns true if /// the constructor declarator is invalid. void Sema::CheckConstructor(CXXConstructorDecl *Constructor) { CXXRecordDecl *ClassDecl = dyn_cast(Constructor->getDeclContext()); if (!ClassDecl) return Constructor->setInvalidDecl(); // C++ [class.copy]p3: // A declaration of a constructor for a class X is ill-formed if // its first parameter is of type (optionally cv-qualified) X and // either there are no other parameters or else all other // parameters have default arguments. if (!Constructor->isInvalidDecl() && ((Constructor->getNumParams() == 1) || (Constructor->getNumParams() > 1 && Constructor->getParamDecl(1)->hasDefaultArg())) && Constructor->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) { QualType ParamType = Constructor->getParamDecl(0)->getType(); QualType ClassTy = Context.getTagDeclType(ClassDecl); if (Context.getCanonicalType(ParamType).getUnqualifiedType() == ClassTy) { SourceLocation ParamLoc = Constructor->getParamDecl(0)->getLocation(); const char *ConstRef = Constructor->getParamDecl(0)->getIdentifier() ? "const &" : " const &"; Diag(ParamLoc, diag::err_constructor_byvalue_arg) << FixItHint::CreateInsertion(ParamLoc, ConstRef); // FIXME: Rather that making the constructor invalid, we should endeavor // to fix the type. Constructor->setInvalidDecl(); } } } /// CheckDestructor - Checks a fully-formed destructor definition for /// well-formedness, issuing any diagnostics required. Returns true /// on error. bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) { CXXRecordDecl *RD = Destructor->getParent(); if (!Destructor->getOperatorDelete() && Destructor->isVirtual()) { SourceLocation Loc; if (!Destructor->isImplicit()) Loc = Destructor->getLocation(); else Loc = RD->getLocation(); // If we have a virtual destructor, look up the deallocation function if (FunctionDecl *OperatorDelete = FindDeallocationFunctionForDestructor(Loc, RD)) { Expr *ThisArg = nullptr; // If the notional 'delete this' expression requires a non-trivial // conversion from 'this' to the type of a destroying operator delete's // first parameter, perform that conversion now. if (OperatorDelete->isDestroyingOperatorDelete()) { QualType ParamType = OperatorDelete->getParamDecl(0)->getType(); if (!declaresSameEntity(ParamType->getAsCXXRecordDecl(), RD)) { // C++ [class.dtor]p13: // ... as if for the expression 'delete this' appearing in a // non-virtual destructor of the destructor's class. ContextRAII SwitchContext(*this, Destructor); ExprResult This = ActOnCXXThis(OperatorDelete->getParamDecl(0)->getLocation()); assert(!This.isInvalid() && "couldn't form 'this' expr in dtor?"); This = PerformImplicitConversion(This.get(), ParamType, AA_Passing); if (This.isInvalid()) { // FIXME: Register this as a context note so that it comes out // in the right order. Diag(Loc, diag::note_implicit_delete_this_in_destructor_here); return true; } ThisArg = This.get(); } } DiagnoseUseOfDecl(OperatorDelete, Loc); MarkFunctionReferenced(Loc, OperatorDelete); Destructor->setOperatorDelete(OperatorDelete, ThisArg); } } return false; } /// CheckDestructorDeclarator - Called by ActOnDeclarator to check /// the well-formednes of the destructor declarator @p D with type @p /// R. If there are any errors in the declarator, this routine will /// emit diagnostics and set the declarator to invalid. Even if this happens, /// will be updated to reflect a well-formed type for the destructor and /// returned. QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass& SC) { // C++ [class.dtor]p1: // [...] A typedef-name that names a class is a class-name // (7.1.3); however, a typedef-name that names a class shall not // be used as the identifier in the declarator for a destructor // declaration. QualType DeclaratorType = GetTypeFromParser(D.getName().DestructorName); if (const TypedefType *TT = DeclaratorType->getAs()) Diag(D.getIdentifierLoc(), diag::err_destructor_typedef_name) << DeclaratorType << isa(TT->getDecl()); else if (const TemplateSpecializationType *TST = DeclaratorType->getAs()) if (TST->isTypeAlias()) Diag(D.getIdentifierLoc(), diag::err_destructor_typedef_name) << DeclaratorType << 1; // C++ [class.dtor]p2: // A destructor is used to destroy objects of its class type. A // destructor takes no parameters, and no return type can be // specified for it (not even void). The address of a destructor // shall not be taken. A destructor shall not be static. A // destructor can be invoked for a const, volatile or const // volatile object. A destructor shall not be declared const, // volatile or const volatile (9.3.2). if (SC == SC_Static) { if (!D.isInvalidType()) Diag(D.getIdentifierLoc(), diag::err_destructor_cannot_be) << "static" << SourceRange(D.getDeclSpec().getStorageClassSpecLoc()) << SourceRange(D.getIdentifierLoc()) << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); SC = SC_None; } if (!D.isInvalidType()) { // Destructors don't have return types, but the parser will // happily parse something like: // // class X { // float ~X(); // }; // // The return type will be eliminated later. if (D.getDeclSpec().hasTypeSpecifier()) Diag(D.getIdentifierLoc(), diag::err_destructor_return_type) << SourceRange(D.getDeclSpec().getTypeSpecTypeLoc()) << SourceRange(D.getIdentifierLoc()); else if (unsigned TypeQuals = D.getDeclSpec().getTypeQualifiers()) { diagnoseIgnoredQualifiers(diag::err_destructor_return_type, TypeQuals, SourceLocation(), D.getDeclSpec().getConstSpecLoc(), D.getDeclSpec().getVolatileSpecLoc(), D.getDeclSpec().getRestrictSpecLoc(), D.getDeclSpec().getAtomicSpecLoc()); D.setInvalidType(); } } checkMethodTypeQualifiers(*this, D, diag::err_invalid_qualified_destructor); // C++0x [class.dtor]p2: // A destructor shall not be declared with a ref-qualifier. DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); if (FTI.hasRefQualifier()) { Diag(FTI.getRefQualifierLoc(), diag::err_ref_qualifier_destructor) << FTI.RefQualifierIsLValueRef << FixItHint::CreateRemoval(FTI.getRefQualifierLoc()); D.setInvalidType(); } // Make sure we don't have any parameters. if (FTIHasNonVoidParameters(FTI)) { Diag(D.getIdentifierLoc(), diag::err_destructor_with_params); // Delete the parameters. FTI.freeParams(); D.setInvalidType(); } // Make sure the destructor isn't variadic. if (FTI.isVariadic) { Diag(D.getIdentifierLoc(), diag::err_destructor_variadic); D.setInvalidType(); } // Rebuild the function type "R" without any type qualifiers or // parameters (in case any of the errors above fired) and with // "void" as the return type, since destructors don't have return // types. if (!D.isInvalidType()) return R; const FunctionProtoType *Proto = R->getAs(); FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); EPI.Variadic = false; EPI.TypeQuals = Qualifiers(); EPI.RefQualifier = RQ_None; return Context.getFunctionType(Context.VoidTy, None, EPI); } static void extendLeft(SourceRange &R, SourceRange Before) { if (Before.isInvalid()) return; R.setBegin(Before.getBegin()); if (R.getEnd().isInvalid()) R.setEnd(Before.getEnd()); } static void extendRight(SourceRange &R, SourceRange After) { if (After.isInvalid()) return; if (R.getBegin().isInvalid()) R.setBegin(After.getBegin()); R.setEnd(After.getEnd()); } /// CheckConversionDeclarator - Called by ActOnDeclarator to check the /// well-formednes of the conversion function declarator @p D with /// type @p R. If there are any errors in the declarator, this routine /// will emit diagnostics and return true. Otherwise, it will return /// false. Either way, the type @p R will be updated to reflect a /// well-formed type for the conversion operator. void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass& SC) { // C++ [class.conv.fct]p1: // Neither parameter types nor return type can be specified. The // type of a conversion function (8.3.5) is "function taking no // parameter returning conversion-type-id." if (SC == SC_Static) { if (!D.isInvalidType()) Diag(D.getIdentifierLoc(), diag::err_conv_function_not_member) << SourceRange(D.getDeclSpec().getStorageClassSpecLoc()) << D.getName().getSourceRange(); D.setInvalidType(); SC = SC_None; } TypeSourceInfo *ConvTSI = nullptr; QualType ConvType = GetTypeFromParser(D.getName().ConversionFunctionId, &ConvTSI); const DeclSpec &DS = D.getDeclSpec(); if (DS.hasTypeSpecifier() && !D.isInvalidType()) { // Conversion functions don't have return types, but the parser will // happily parse something like: // // class X { // float operator bool(); // }; // // The return type will be changed later anyway. Diag(D.getIdentifierLoc(), diag::err_conv_function_return_type) << SourceRange(DS.getTypeSpecTypeLoc()) << SourceRange(D.getIdentifierLoc()); D.setInvalidType(); } else if (DS.getTypeQualifiers() && !D.isInvalidType()) { // It's also plausible that the user writes type qualifiers in the wrong // place, such as: // struct S { const operator int(); }; // FIXME: we could provide a fixit to move the qualifiers onto the // conversion type. Diag(D.getIdentifierLoc(), diag::err_conv_function_with_complex_decl) << SourceRange(D.getIdentifierLoc()) << 0; D.setInvalidType(); } const FunctionProtoType *Proto = R->getAs(); // Make sure we don't have any parameters. if (Proto->getNumParams() > 0) { Diag(D.getIdentifierLoc(), diag::err_conv_function_with_params); // Delete the parameters. D.getFunctionTypeInfo().freeParams(); D.setInvalidType(); } else if (Proto->isVariadic()) { Diag(D.getIdentifierLoc(), diag::err_conv_function_variadic); D.setInvalidType(); } // Diagnose "&operator bool()" and other such nonsense. This // is actually a gcc extension which we don't support. if (Proto->getReturnType() != ConvType) { bool NeedsTypedef = false; SourceRange Before, After; // Walk the chunks and extract information on them for our diagnostic. bool PastFunctionChunk = false; for (auto &Chunk : D.type_objects()) { switch (Chunk.Kind) { case DeclaratorChunk::Function: if (!PastFunctionChunk) { if (Chunk.Fun.HasTrailingReturnType) { TypeSourceInfo *TRT = nullptr; GetTypeFromParser(Chunk.Fun.getTrailingReturnType(), &TRT); if (TRT) extendRight(After, TRT->getTypeLoc().getSourceRange()); } PastFunctionChunk = true; break; } LLVM_FALLTHROUGH; case DeclaratorChunk::Array: NeedsTypedef = true; extendRight(After, Chunk.getSourceRange()); break; case DeclaratorChunk::Pointer: case DeclaratorChunk::BlockPointer: case DeclaratorChunk::Reference: case DeclaratorChunk::MemberPointer: case DeclaratorChunk::Pipe: extendLeft(Before, Chunk.getSourceRange()); break; case DeclaratorChunk::Paren: extendLeft(Before, Chunk.Loc); extendRight(After, Chunk.EndLoc); break; } } SourceLocation Loc = Before.isValid() ? Before.getBegin() : After.isValid() ? After.getBegin() : D.getIdentifierLoc(); auto &&DB = Diag(Loc, diag::err_conv_function_with_complex_decl); DB << Before << After; if (!NeedsTypedef) { DB << /*don't need a typedef*/0; // If we can provide a correct fix-it hint, do so. if (After.isInvalid() && ConvTSI) { SourceLocation InsertLoc = getLocForEndOfToken(ConvTSI->getTypeLoc().getEndLoc()); DB << FixItHint::CreateInsertion(InsertLoc, " ") << FixItHint::CreateInsertionFromRange( InsertLoc, CharSourceRange::getTokenRange(Before)) << FixItHint::CreateRemoval(Before); } } else if (!Proto->getReturnType()->isDependentType()) { DB << /*typedef*/1 << Proto->getReturnType(); } else if (getLangOpts().CPlusPlus11) { DB << /*alias template*/2 << Proto->getReturnType(); } else { DB << /*might not be fixable*/3; } // Recover by incorporating the other type chunks into the result type. // Note, this does *not* change the name of the function. This is compatible // with the GCC extension: // struct S { &operator int(); } s; // int &r = s.operator int(); // ok in GCC // S::operator int&() {} // error in GCC, function name is 'operator int'. ConvType = Proto->getReturnType(); } // C++ [class.conv.fct]p4: // The conversion-type-id shall not represent a function type nor // an array type. if (ConvType->isArrayType()) { Diag(D.getIdentifierLoc(), diag::err_conv_function_to_array); ConvType = Context.getPointerType(ConvType); D.setInvalidType(); } else if (ConvType->isFunctionType()) { Diag(D.getIdentifierLoc(), diag::err_conv_function_to_function); ConvType = Context.getPointerType(ConvType); D.setInvalidType(); } // Rebuild the function type "R" without any parameters (in case any // of the errors above fired) and with the conversion type as the // return type. if (D.isInvalidType()) R = Context.getFunctionType(ConvType, None, Proto->getExtProtoInfo()); // C++0x explicit conversion operators. if (DS.hasExplicitSpecifier() && !getLangOpts().CPlusPlus2a) Diag(DS.getExplicitSpecLoc(), getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_explicit_conversion_functions : diag::ext_explicit_conversion_functions) << SourceRange(DS.getExplicitSpecRange()); } /// ActOnConversionDeclarator - Called by ActOnDeclarator to complete /// the declaration of the given C++ conversion function. This routine /// is responsible for recording the conversion function in the C++ /// class, if possible. Decl *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) { assert(Conversion && "Expected to receive a conversion function declaration"); CXXRecordDecl *ClassDecl = cast(Conversion->getDeclContext()); // Make sure we aren't redeclaring the conversion function. QualType ConvType = Context.getCanonicalType(Conversion->getConversionType()); // C++ [class.conv.fct]p1: // [...] A conversion function is never used to convert a // (possibly cv-qualified) object to the (possibly cv-qualified) // same object type (or a reference to it), to a (possibly // cv-qualified) base class of that type (or a reference to it), // or to (possibly cv-qualified) void. // FIXME: Suppress this warning if the conversion function ends up being a // virtual function that overrides a virtual function in a base class. QualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl)); if (const ReferenceType *ConvTypeRef = ConvType->getAs()) ConvType = ConvTypeRef->getPointeeType(); if (Conversion->getTemplateSpecializationKind() != TSK_Undeclared && Conversion->getTemplateSpecializationKind() != TSK_ExplicitSpecialization) /* Suppress diagnostics for instantiations. */; else if (ConvType->isRecordType()) { ConvType = Context.getCanonicalType(ConvType).getUnqualifiedType(); if (ConvType == ClassType) Diag(Conversion->getLocation(), diag::warn_conv_to_self_not_used) << ClassType; else if (IsDerivedFrom(Conversion->getLocation(), ClassType, ConvType)) Diag(Conversion->getLocation(), diag::warn_conv_to_base_not_used) << ClassType << ConvType; } else if (ConvType->isVoidType()) { Diag(Conversion->getLocation(), diag::warn_conv_to_void_not_used) << ClassType << ConvType; } if (FunctionTemplateDecl *ConversionTemplate = Conversion->getDescribedFunctionTemplate()) return ConversionTemplate; return Conversion; } namespace { /// Utility class to accumulate and print a diagnostic listing the invalid /// specifier(s) on a declaration. struct BadSpecifierDiagnoser { BadSpecifierDiagnoser(Sema &S, SourceLocation Loc, unsigned DiagID) : S(S), Diagnostic(S.Diag(Loc, DiagID)) {} ~BadSpecifierDiagnoser() { Diagnostic << Specifiers; } template void check(SourceLocation SpecLoc, T Spec) { return check(SpecLoc, DeclSpec::getSpecifierName(Spec)); } void check(SourceLocation SpecLoc, DeclSpec::TST Spec) { return check(SpecLoc, DeclSpec::getSpecifierName(Spec, S.getPrintingPolicy())); } void check(SourceLocation SpecLoc, const char *Spec) { if (SpecLoc.isInvalid()) return; Diagnostic << SourceRange(SpecLoc, SpecLoc); if (!Specifiers.empty()) Specifiers += " "; Specifiers += Spec; } Sema &S; Sema::SemaDiagnosticBuilder Diagnostic; std::string Specifiers; }; } /// Check the validity of a declarator that we parsed for a deduction-guide. /// These aren't actually declarators in the grammar, so we need to check that /// the user didn't specify any pieces that are not part of the deduction-guide /// grammar. void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R, StorageClass &SC) { TemplateName GuidedTemplate = D.getName().TemplateName.get().get(); TemplateDecl *GuidedTemplateDecl = GuidedTemplate.getAsTemplateDecl(); assert(GuidedTemplateDecl && "missing template decl for deduction guide"); // C++ [temp.deduct.guide]p3: // A deduction-gide shall be declared in the same scope as the // corresponding class template. if (!CurContext->getRedeclContext()->Equals( GuidedTemplateDecl->getDeclContext()->getRedeclContext())) { Diag(D.getIdentifierLoc(), diag::err_deduction_guide_wrong_scope) << GuidedTemplateDecl; Diag(GuidedTemplateDecl->getLocation(), diag::note_template_decl_here); } auto &DS = D.getMutableDeclSpec(); // We leave 'friend' and 'virtual' to be rejected in the normal way. if (DS.hasTypeSpecifier() || DS.getTypeQualifiers() || DS.getStorageClassSpecLoc().isValid() || DS.isInlineSpecified() || DS.isNoreturnSpecified() || DS.hasConstexprSpecifier()) { BadSpecifierDiagnoser Diagnoser( *this, D.getIdentifierLoc(), diag::err_deduction_guide_invalid_specifier); Diagnoser.check(DS.getStorageClassSpecLoc(), DS.getStorageClassSpec()); DS.ClearStorageClassSpecs(); SC = SC_None; // 'explicit' is permitted. Diagnoser.check(DS.getInlineSpecLoc(), "inline"); Diagnoser.check(DS.getNoreturnSpecLoc(), "_Noreturn"); Diagnoser.check(DS.getConstexprSpecLoc(), "constexpr"); DS.ClearConstexprSpec(); Diagnoser.check(DS.getConstSpecLoc(), "const"); Diagnoser.check(DS.getRestrictSpecLoc(), "__restrict"); Diagnoser.check(DS.getVolatileSpecLoc(), "volatile"); Diagnoser.check(DS.getAtomicSpecLoc(), "_Atomic"); Diagnoser.check(DS.getUnalignedSpecLoc(), "__unaligned"); DS.ClearTypeQualifiers(); Diagnoser.check(DS.getTypeSpecComplexLoc(), DS.getTypeSpecComplex()); Diagnoser.check(DS.getTypeSpecSignLoc(), DS.getTypeSpecSign()); Diagnoser.check(DS.getTypeSpecWidthLoc(), DS.getTypeSpecWidth()); Diagnoser.check(DS.getTypeSpecTypeLoc(), DS.getTypeSpecType()); DS.ClearTypeSpecType(); } if (D.isInvalidType()) return; // Check the declarator is simple enough. bool FoundFunction = false; for (const DeclaratorChunk &Chunk : llvm::reverse(D.type_objects())) { if (Chunk.Kind == DeclaratorChunk::Paren) continue; if (Chunk.Kind != DeclaratorChunk::Function || FoundFunction) { Diag(D.getDeclSpec().getBeginLoc(), diag::err_deduction_guide_with_complex_decl) << D.getSourceRange(); break; } if (!Chunk.Fun.hasTrailingReturnType()) { Diag(D.getName().getBeginLoc(), diag::err_deduction_guide_no_trailing_return_type); break; } // Check that the return type is written as a specialization of // the template specified as the deduction-guide's name. ParsedType TrailingReturnType = Chunk.Fun.getTrailingReturnType(); TypeSourceInfo *TSI = nullptr; QualType RetTy = GetTypeFromParser(TrailingReturnType, &TSI); assert(TSI && "deduction guide has valid type but invalid return type?"); bool AcceptableReturnType = false; bool MightInstantiateToSpecialization = false; if (auto RetTST = TSI->getTypeLoc().getAs()) { TemplateName SpecifiedName = RetTST.getTypePtr()->getTemplateName(); bool TemplateMatches = Context.hasSameTemplateName(SpecifiedName, GuidedTemplate); if (SpecifiedName.getKind() == TemplateName::Template && TemplateMatches) AcceptableReturnType = true; else { // This could still instantiate to the right type, unless we know it // names the wrong class template. auto *TD = SpecifiedName.getAsTemplateDecl(); MightInstantiateToSpecialization = !(TD && isa(TD) && !TemplateMatches); } } else if (!RetTy.hasQualifiers() && RetTy->isDependentType()) { MightInstantiateToSpecialization = true; } if (!AcceptableReturnType) { Diag(TSI->getTypeLoc().getBeginLoc(), diag::err_deduction_guide_bad_trailing_return_type) << GuidedTemplate << TSI->getType() << MightInstantiateToSpecialization << TSI->getTypeLoc().getSourceRange(); } // Keep going to check that we don't have any inner declarator pieces (we // could still have a function returning a pointer to a function). FoundFunction = true; } if (D.isFunctionDefinition()) Diag(D.getIdentifierLoc(), diag::err_deduction_guide_defines_function); } //===----------------------------------------------------------------------===// // Namespace Handling //===----------------------------------------------------------------------===// /// Diagnose a mismatch in 'inline' qualifiers when a namespace is /// reopened. static void DiagnoseNamespaceInlineMismatch(Sema &S, SourceLocation KeywordLoc, SourceLocation Loc, IdentifierInfo *II, bool *IsInline, NamespaceDecl *PrevNS) { assert(*IsInline != PrevNS->isInline()); // HACK: Work around a bug in libstdc++4.6's , where // std::__atomic[0,1,2] are defined as non-inline namespaces, then reopened as // inline namespaces, with the intention of bringing names into namespace std. // // We support this just well enough to get that case working; this is not // sufficient to support reopening namespaces as inline in general. if (*IsInline && II && II->getName().startswith("__atomic") && S.getSourceManager().isInSystemHeader(Loc)) { // Mark all prior declarations of the namespace as inline. for (NamespaceDecl *NS = PrevNS->getMostRecentDecl(); NS; NS = NS->getPreviousDecl()) NS->setInline(*IsInline); // Patch up the lookup table for the containing namespace. This isn't really // correct, but it's good enough for this particular case. for (auto *I : PrevNS->decls()) if (auto *ND = dyn_cast(I)) PrevNS->getParent()->makeDeclVisibleInContext(ND); return; } if (PrevNS->isInline()) // The user probably just forgot the 'inline', so suggest that it // be added back. S.Diag(Loc, diag::warn_inline_namespace_reopened_noninline) << FixItHint::CreateInsertion(KeywordLoc, "inline "); else S.Diag(Loc, diag::err_inline_namespace_mismatch); S.Diag(PrevNS->getLocation(), diag::note_previous_definition); *IsInline = PrevNS->isInline(); } /// ActOnStartNamespaceDef - This is called at the start of a namespace /// definition. Decl *Sema::ActOnStartNamespaceDef( Scope *NamespcScope, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *II, SourceLocation LBrace, const ParsedAttributesView &AttrList, UsingDirectiveDecl *&UD) { SourceLocation StartLoc = InlineLoc.isValid() ? InlineLoc : NamespaceLoc; // For anonymous namespace, take the location of the left brace. SourceLocation Loc = II ? IdentLoc : LBrace; bool IsInline = InlineLoc.isValid(); bool IsInvalid = false; bool IsStd = false; bool AddToKnown = false; Scope *DeclRegionScope = NamespcScope->getParent(); NamespaceDecl *PrevNS = nullptr; if (II) { // C++ [namespace.def]p2: // The identifier in an original-namespace-definition shall not // have been previously defined in the declarative region in // which the original-namespace-definition appears. The // identifier in an original-namespace-definition is the name of // the namespace. Subsequently in that declarative region, it is // treated as an original-namespace-name. // // Since namespace names are unique in their scope, and we don't // look through using directives, just look for any ordinary names // as if by qualified name lookup. LookupResult R(*this, II, IdentLoc, LookupOrdinaryName, ForExternalRedeclaration); LookupQualifiedName(R, CurContext->getRedeclContext()); NamedDecl *PrevDecl = R.isSingleResult() ? R.getRepresentativeDecl() : nullptr; PrevNS = dyn_cast_or_null(PrevDecl); if (PrevNS) { // This is an extended namespace definition. if (IsInline != PrevNS->isInline()) DiagnoseNamespaceInlineMismatch(*this, NamespaceLoc, Loc, II, &IsInline, PrevNS); } else if (PrevDecl) { // This is an invalid name redefinition. Diag(Loc, diag::err_redefinition_different_kind) << II; Diag(PrevDecl->getLocation(), diag::note_previous_definition); IsInvalid = true; // Continue on to push Namespc as current DeclContext and return it. } else if (II->isStr("std") && CurContext->getRedeclContext()->isTranslationUnit()) { // This is the first "real" definition of the namespace "std", so update // our cache of the "std" namespace to point at this definition. PrevNS = getStdNamespace(); IsStd = true; AddToKnown = !IsInline; } else { // We've seen this namespace for the first time. AddToKnown = !IsInline; } } else { // Anonymous namespaces. // Determine whether the parent already has an anonymous namespace. DeclContext *Parent = CurContext->getRedeclContext(); if (TranslationUnitDecl *TU = dyn_cast(Parent)) { PrevNS = TU->getAnonymousNamespace(); } else { NamespaceDecl *ND = cast(Parent); PrevNS = ND->getAnonymousNamespace(); } if (PrevNS && IsInline != PrevNS->isInline()) DiagnoseNamespaceInlineMismatch(*this, NamespaceLoc, NamespaceLoc, II, &IsInline, PrevNS); } NamespaceDecl *Namespc = NamespaceDecl::Create(Context, CurContext, IsInline, StartLoc, Loc, II, PrevNS); if (IsInvalid) Namespc->setInvalidDecl(); ProcessDeclAttributeList(DeclRegionScope, Namespc, AttrList); AddPragmaAttributes(DeclRegionScope, Namespc); // FIXME: Should we be merging attributes? if (const VisibilityAttr *Attr = Namespc->getAttr()) PushNamespaceVisibilityAttr(Attr, Loc); if (IsStd) StdNamespace = Namespc; if (AddToKnown) KnownNamespaces[Namespc] = false; if (II) { PushOnScopeChains(Namespc, DeclRegionScope); } else { // Link the anonymous namespace into its parent. DeclContext *Parent = CurContext->getRedeclContext(); if (TranslationUnitDecl *TU = dyn_cast(Parent)) { TU->setAnonymousNamespace(Namespc); } else { cast(Parent)->setAnonymousNamespace(Namespc); } CurContext->addDecl(Namespc); // C++ [namespace.unnamed]p1. An unnamed-namespace-definition // behaves as if it were replaced by // namespace unique { /* empty body */ } // using namespace unique; // namespace unique { namespace-body } // where all occurrences of 'unique' in a translation unit are // replaced by the same identifier and this identifier differs // from all other identifiers in the entire program. // We just create the namespace with an empty name and then add an // implicit using declaration, just like the standard suggests. // // CodeGen enforces the "universally unique" aspect by giving all // declarations semantically contained within an anonymous // namespace internal linkage. if (!PrevNS) { UD = UsingDirectiveDecl::Create(Context, Parent, /* 'using' */ LBrace, /* 'namespace' */ SourceLocation(), /* qualifier */ NestedNameSpecifierLoc(), /* identifier */ SourceLocation(), Namespc, /* Ancestor */ Parent); UD->setImplicit(); Parent->addDecl(UD); } } ActOnDocumentableDecl(Namespc); // Although we could have an invalid decl (i.e. the namespace name is a // redefinition), push it as current DeclContext and try to continue parsing. // FIXME: We should be able to push Namespc here, so that the each DeclContext // for the namespace has the declarations that showed up in that particular // namespace definition. PushDeclContext(NamespcScope, Namespc); return Namespc; } /// getNamespaceDecl - Returns the namespace a decl represents. If the decl /// is a namespace alias, returns the namespace it points to. static inline NamespaceDecl *getNamespaceDecl(NamedDecl *D) { if (NamespaceAliasDecl *AD = dyn_cast_or_null(D)) return AD->getNamespace(); return dyn_cast_or_null(D); } /// ActOnFinishNamespaceDef - This callback is called after a namespace is /// exited. Decl is the DeclTy returned by ActOnStartNamespaceDef. void Sema::ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace) { NamespaceDecl *Namespc = dyn_cast_or_null(Dcl); assert(Namespc && "Invalid parameter, expected NamespaceDecl"); Namespc->setRBraceLoc(RBrace); PopDeclContext(); if (Namespc->hasAttr()) PopPragmaVisibility(true, RBrace); // If this namespace contains an export-declaration, export it now. if (DeferredExportedNamespaces.erase(Namespc)) Dcl->setModuleOwnershipKind(Decl::ModuleOwnershipKind::VisibleWhenImported); } CXXRecordDecl *Sema::getStdBadAlloc() const { return cast_or_null( StdBadAlloc.get(Context.getExternalSource())); } EnumDecl *Sema::getStdAlignValT() const { return cast_or_null(StdAlignValT.get(Context.getExternalSource())); } NamespaceDecl *Sema::getStdNamespace() const { return cast_or_null( StdNamespace.get(Context.getExternalSource())); } NamespaceDecl *Sema::lookupStdExperimentalNamespace() { if (!StdExperimentalNamespaceCache) { if (auto Std = getStdNamespace()) { LookupResult Result(*this, &PP.getIdentifierTable().get("experimental"), SourceLocation(), LookupNamespaceName); if (!LookupQualifiedName(Result, Std) || !(StdExperimentalNamespaceCache = Result.getAsSingle())) Result.suppressDiagnostics(); } } return StdExperimentalNamespaceCache; } namespace { enum UnsupportedSTLSelect { USS_InvalidMember, USS_MissingMember, USS_NonTrivial, USS_Other }; struct InvalidSTLDiagnoser { Sema &S; SourceLocation Loc; QualType TyForDiags; QualType operator()(UnsupportedSTLSelect Sel = USS_Other, StringRef Name = "", const VarDecl *VD = nullptr) { { auto D = S.Diag(Loc, diag::err_std_compare_type_not_supported) << TyForDiags << ((int)Sel); if (Sel == USS_InvalidMember || Sel == USS_MissingMember) { assert(!Name.empty()); D << Name; } } if (Sel == USS_InvalidMember) { S.Diag(VD->getLocation(), diag::note_var_declared_here) << VD << VD->getSourceRange(); } return QualType(); } }; } // namespace QualType Sema::CheckComparisonCategoryType(ComparisonCategoryType Kind, SourceLocation Loc) { assert(getLangOpts().CPlusPlus && "Looking for comparison category type outside of C++."); // Check if we've already successfully checked the comparison category type // before. If so, skip checking it again. ComparisonCategoryInfo *Info = Context.CompCategories.lookupInfo(Kind); if (Info && FullyCheckedComparisonCategories[static_cast(Kind)]) return Info->getType(); // If lookup failed if (!Info) { std::string NameForDiags = "std::"; NameForDiags += ComparisonCategories::getCategoryString(Kind); Diag(Loc, diag::err_implied_comparison_category_type_not_found) << NameForDiags; return QualType(); } assert(Info->Kind == Kind); assert(Info->Record); // Update the Record decl in case we encountered a forward declaration on our // first pass. FIXME: This is a bit of a hack. if (Info->Record->hasDefinition()) Info->Record = Info->Record->getDefinition(); // Use an elaborated type for diagnostics which has a name containing the // prepended 'std' namespace but not any inline namespace names. QualType TyForDiags = [&]() { auto *NNS = NestedNameSpecifier::Create(Context, nullptr, getStdNamespace()); return Context.getElaboratedType(ETK_None, NNS, Info->getType()); }(); if (RequireCompleteType(Loc, TyForDiags, diag::err_incomplete_type)) return QualType(); InvalidSTLDiagnoser UnsupportedSTLError{*this, Loc, TyForDiags}; if (!Info->Record->isTriviallyCopyable()) return UnsupportedSTLError(USS_NonTrivial); for (const CXXBaseSpecifier &BaseSpec : Info->Record->bases()) { CXXRecordDecl *Base = BaseSpec.getType()->getAsCXXRecordDecl(); // Tolerate empty base classes. if (Base->isEmpty()) continue; // Reject STL implementations which have at least one non-empty base. return UnsupportedSTLError(); } // Check that the STL has implemented the types using a single integer field. // This expectation allows better codegen for builtin operators. We require: // (1) The class has exactly one field. // (2) The field is an integral or enumeration type. auto FIt = Info->Record->field_begin(), FEnd = Info->Record->field_end(); if (std::distance(FIt, FEnd) != 1 || !FIt->getType()->isIntegralOrEnumerationType()) { return UnsupportedSTLError(); } // Build each of the require values and store them in Info. for (ComparisonCategoryResult CCR : ComparisonCategories::getPossibleResultsForType(Kind)) { StringRef MemName = ComparisonCategories::getResultString(CCR); ComparisonCategoryInfo::ValueInfo *ValInfo = Info->lookupValueInfo(CCR); if (!ValInfo) return UnsupportedSTLError(USS_MissingMember, MemName); VarDecl *VD = ValInfo->VD; assert(VD && "should not be null!"); // Attempt to diagnose reasons why the STL definition of this type // might be foobar, including it failing to be a constant expression. // TODO Handle more ways the lookup or result can be invalid. if (!VD->isStaticDataMember() || !VD->isConstexpr() || !VD->hasInit() || !VD->checkInitIsICE()) return UnsupportedSTLError(USS_InvalidMember, MemName, VD); // Attempt to evaluate the var decl as a constant expression and extract // the value of its first field as a ICE. If this fails, the STL // implementation is not supported. if (!ValInfo->hasValidIntValue()) return UnsupportedSTLError(); MarkVariableReferenced(Loc, VD); } // We've successfully built the required types and expressions. Update // the cache and return the newly cached value. FullyCheckedComparisonCategories[static_cast(Kind)] = true; return Info->getType(); } /// Retrieve the special "std" namespace, which may require us to /// implicitly define the namespace. NamespaceDecl *Sema::getOrCreateStdNamespace() { if (!StdNamespace) { // The "std" namespace has not yet been defined, so build one implicitly. StdNamespace = NamespaceDecl::Create(Context, Context.getTranslationUnitDecl(), /*Inline=*/false, SourceLocation(), SourceLocation(), &PP.getIdentifierTable().get("std"), /*PrevDecl=*/nullptr); getStdNamespace()->setImplicit(true); } return getStdNamespace(); } bool Sema::isStdInitializerList(QualType Ty, QualType *Element) { assert(getLangOpts().CPlusPlus && "Looking for std::initializer_list outside of C++."); // We're looking for implicit instantiations of // template class std::initializer_list. if (!StdNamespace) // If we haven't seen namespace std yet, this can't be it. return false; ClassTemplateDecl *Template = nullptr; const TemplateArgument *Arguments = nullptr; if (const RecordType *RT = Ty->getAs()) { ClassTemplateSpecializationDecl *Specialization = dyn_cast(RT->getDecl()); if (!Specialization) return false; Template = Specialization->getSpecializedTemplate(); Arguments = Specialization->getTemplateArgs().data(); } else if (const TemplateSpecializationType *TST = Ty->getAs()) { Template = dyn_cast_or_null( TST->getTemplateName().getAsTemplateDecl()); Arguments = TST->getArgs(); } if (!Template) return false; if (!StdInitializerList) { // Haven't recognized std::initializer_list yet, maybe this is it. CXXRecordDecl *TemplateClass = Template->getTemplatedDecl(); if (TemplateClass->getIdentifier() != &PP.getIdentifierTable().get("initializer_list") || !getStdNamespace()->InEnclosingNamespaceSetOf( TemplateClass->getDeclContext())) return false; // This is a template called std::initializer_list, but is it the right // template? TemplateParameterList *Params = Template->getTemplateParameters(); if (Params->getMinRequiredArguments() != 1) return false; if (!isa(Params->getParam(0))) return false; // It's the right template. StdInitializerList = Template; } if (Template->getCanonicalDecl() != StdInitializerList->getCanonicalDecl()) return false; // This is an instance of std::initializer_list. Find the argument type. if (Element) *Element = Arguments[0].getAsType(); return true; } static ClassTemplateDecl *LookupStdInitializerList(Sema &S, SourceLocation Loc){ NamespaceDecl *Std = S.getStdNamespace(); if (!Std) { S.Diag(Loc, diag::err_implied_std_initializer_list_not_found); return nullptr; } LookupResult Result(S, &S.PP.getIdentifierTable().get("initializer_list"), Loc, Sema::LookupOrdinaryName); if (!S.LookupQualifiedName(Result, Std)) { S.Diag(Loc, diag::err_implied_std_initializer_list_not_found); return nullptr; } ClassTemplateDecl *Template = Result.getAsSingle(); if (!Template) { Result.suppressDiagnostics(); // We found something weird. Complain about the first thing we found. NamedDecl *Found = *Result.begin(); S.Diag(Found->getLocation(), diag::err_malformed_std_initializer_list); return nullptr; } // We found some template called std::initializer_list. Now verify that it's // correct. TemplateParameterList *Params = Template->getTemplateParameters(); if (Params->getMinRequiredArguments() != 1 || !isa(Params->getParam(0))) { S.Diag(Template->getLocation(), diag::err_malformed_std_initializer_list); return nullptr; } return Template; } QualType Sema::BuildStdInitializerList(QualType Element, SourceLocation Loc) { if (!StdInitializerList) { StdInitializerList = LookupStdInitializerList(*this, Loc); if (!StdInitializerList) return QualType(); } TemplateArgumentListInfo Args(Loc, Loc); Args.addArgument(TemplateArgumentLoc(TemplateArgument(Element), Context.getTrivialTypeSourceInfo(Element, Loc))); return Context.getCanonicalType( CheckTemplateIdType(TemplateName(StdInitializerList), Loc, Args)); } bool Sema::isInitListConstructor(const FunctionDecl *Ctor) { // C++ [dcl.init.list]p2: // A constructor is an initializer-list constructor if its first parameter // is of type std::initializer_list or reference to possibly cv-qualified // std::initializer_list for some type E, and either there are no other // parameters or else all other parameters have default arguments. if (Ctor->getNumParams() < 1 || (Ctor->getNumParams() > 1 && !Ctor->getParamDecl(1)->hasDefaultArg())) return false; QualType ArgType = Ctor->getParamDecl(0)->getType(); if (const ReferenceType *RT = ArgType->getAs()) ArgType = RT->getPointeeType().getUnqualifiedType(); return isStdInitializerList(ArgType, nullptr); } /// Determine whether a using statement is in a context where it will be /// apply in all contexts. static bool IsUsingDirectiveInToplevelContext(DeclContext *CurContext) { switch (CurContext->getDeclKind()) { case Decl::TranslationUnit: return true; case Decl::LinkageSpec: return IsUsingDirectiveInToplevelContext(CurContext->getParent()); default: return false; } } namespace { // Callback to only accept typo corrections that are namespaces. class NamespaceValidatorCCC final : public CorrectionCandidateCallback { public: bool ValidateCandidate(const TypoCorrection &candidate) override { if (NamedDecl *ND = candidate.getCorrectionDecl()) return isa(ND) || isa(ND); return false; } std::unique_ptr clone() override { return llvm::make_unique(*this); } }; } static bool TryNamespaceTypoCorrection(Sema &S, LookupResult &R, Scope *Sc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident) { R.clear(); NamespaceValidatorCCC CCC{}; if (TypoCorrection Corrected = S.CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), Sc, &SS, CCC, Sema::CTK_ErrorRecovery)) { if (DeclContext *DC = S.computeDeclContext(SS, false)) { std::string CorrectedStr(Corrected.getAsString(S.getLangOpts())); bool DroppedSpecifier = Corrected.WillReplaceSpecifier() && Ident->getName().equals(CorrectedStr); S.diagnoseTypo(Corrected, S.PDiag(diag::err_using_directive_member_suggest) << Ident << DC << DroppedSpecifier << SS.getRange(), S.PDiag(diag::note_namespace_defined_here)); } else { S.diagnoseTypo(Corrected, S.PDiag(diag::err_using_directive_suggest) << Ident, S.PDiag(diag::note_namespace_defined_here)); } R.addDecl(Corrected.getFoundDecl()); return true; } return false; } Decl *Sema::ActOnUsingDirective(Scope *S, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, const ParsedAttributesView &AttrList) { assert(!SS.isInvalid() && "Invalid CXXScopeSpec."); assert(NamespcName && "Invalid NamespcName."); assert(IdentLoc.isValid() && "Invalid NamespceName location."); // This can only happen along a recovery path. while (S->isTemplateParamScope()) S = S->getParent(); assert(S->getFlags() & Scope::DeclScope && "Invalid Scope."); UsingDirectiveDecl *UDir = nullptr; NestedNameSpecifier *Qualifier = nullptr; if (SS.isSet()) Qualifier = SS.getScopeRep(); // Lookup namespace name. LookupResult R(*this, NamespcName, IdentLoc, LookupNamespaceName); LookupParsedName(R, S, &SS); if (R.isAmbiguous()) return nullptr; if (R.empty()) { R.clear(); // Allow "using namespace std;" or "using namespace ::std;" even if // "std" hasn't been defined yet, for GCC compatibility. if ((!Qualifier || Qualifier->getKind() == NestedNameSpecifier::Global) && NamespcName->isStr("std")) { Diag(IdentLoc, diag::ext_using_undefined_std); R.addDecl(getOrCreateStdNamespace()); R.resolveKind(); } // Otherwise, attempt typo correction. else TryNamespaceTypoCorrection(*this, R, S, SS, IdentLoc, NamespcName); } if (!R.empty()) { NamedDecl *Named = R.getRepresentativeDecl(); NamespaceDecl *NS = R.getAsSingle(); assert(NS && "expected namespace decl"); // The use of a nested name specifier may trigger deprecation warnings. DiagnoseUseOfDecl(Named, IdentLoc); // C++ [namespace.udir]p1: // A using-directive specifies that the names in the nominated // namespace can be used in the scope in which the // using-directive appears after the using-directive. During // unqualified name lookup (3.4.1), the names appear as if they // were declared in the nearest enclosing namespace which // contains both the using-directive and the nominated // namespace. [Note: in this context, "contains" means "contains // directly or indirectly". ] // Find enclosing context containing both using-directive and // nominated namespace. DeclContext *CommonAncestor = NS; while (CommonAncestor && !CommonAncestor->Encloses(CurContext)) CommonAncestor = CommonAncestor->getParent(); UDir = UsingDirectiveDecl::Create(Context, CurContext, UsingLoc, NamespcLoc, SS.getWithLocInContext(Context), IdentLoc, Named, CommonAncestor); if (IsUsingDirectiveInToplevelContext(CurContext) && !SourceMgr.isInMainFile(SourceMgr.getExpansionLoc(IdentLoc))) { Diag(IdentLoc, diag::warn_using_directive_in_header); } PushUsingDirective(S, UDir); } else { Diag(IdentLoc, diag::err_expected_namespace_name) << SS.getRange(); } if (UDir) ProcessDeclAttributeList(S, UDir, AttrList); return UDir; } void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) { // If the scope has an associated entity and the using directive is at // namespace or translation unit scope, add the UsingDirectiveDecl into // its lookup structure so qualified name lookup can find it. DeclContext *Ctx = S->getEntity(); if (Ctx && !Ctx->isFunctionOrMethod()) Ctx->addDecl(UDir); else // Otherwise, it is at block scope. The using-directives will affect lookup // only to the end of the scope. S->PushUsingDirective(UDir); } Decl *Sema::ActOnUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation TypenameLoc, CXXScopeSpec &SS, UnqualifiedId &Name, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList) { assert(S->getFlags() & Scope::DeclScope && "Invalid Scope."); if (SS.isEmpty()) { Diag(Name.getBeginLoc(), diag::err_using_requires_qualname); return nullptr; } switch (Name.getKind()) { case UnqualifiedIdKind::IK_ImplicitSelfParam: case UnqualifiedIdKind::IK_Identifier: case UnqualifiedIdKind::IK_OperatorFunctionId: case UnqualifiedIdKind::IK_LiteralOperatorId: case UnqualifiedIdKind::IK_ConversionFunctionId: break; case UnqualifiedIdKind::IK_ConstructorName: case UnqualifiedIdKind::IK_ConstructorTemplateId: // C++11 inheriting constructors. Diag(Name.getBeginLoc(), getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_using_decl_constructor : diag::err_using_decl_constructor) << SS.getRange(); if (getLangOpts().CPlusPlus11) break; return nullptr; case UnqualifiedIdKind::IK_DestructorName: Diag(Name.getBeginLoc(), diag::err_using_decl_destructor) << SS.getRange(); return nullptr; case UnqualifiedIdKind::IK_TemplateId: Diag(Name.getBeginLoc(), diag::err_using_decl_template_id) << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc); return nullptr; case UnqualifiedIdKind::IK_DeductionGuideName: llvm_unreachable("cannot parse qualified deduction guide name"); } DeclarationNameInfo TargetNameInfo = GetNameFromUnqualifiedId(Name); DeclarationName TargetName = TargetNameInfo.getName(); if (!TargetName) return nullptr; // Warn about access declarations. if (UsingLoc.isInvalid()) { Diag(Name.getBeginLoc(), getLangOpts().CPlusPlus11 ? diag::err_access_decl : diag::warn_access_decl_deprecated) << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using "); } if (EllipsisLoc.isInvalid()) { if (DiagnoseUnexpandedParameterPack(SS, UPPC_UsingDeclaration) || DiagnoseUnexpandedParameterPack(TargetNameInfo, UPPC_UsingDeclaration)) return nullptr; } else { if (!SS.getScopeRep()->containsUnexpandedParameterPack() && !TargetNameInfo.containsUnexpandedParameterPack()) { Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs) << SourceRange(SS.getBeginLoc(), TargetNameInfo.getEndLoc()); EllipsisLoc = SourceLocation(); } } NamedDecl *UD = BuildUsingDeclaration(S, AS, UsingLoc, TypenameLoc.isValid(), TypenameLoc, SS, TargetNameInfo, EllipsisLoc, AttrList, /*IsInstantiation*/false); if (UD) PushOnScopeChains(UD, S, /*AddToContext*/ false); return UD; } /// Determine whether a using declaration considers the given /// declarations as "equivalent", e.g., if they are redeclarations of /// the same entity or are both typedefs of the same type. static bool IsEquivalentForUsingDecl(ASTContext &Context, NamedDecl *D1, NamedDecl *D2) { if (D1->getCanonicalDecl() == D2->getCanonicalDecl()) return true; if (TypedefNameDecl *TD1 = dyn_cast(D1)) if (TypedefNameDecl *TD2 = dyn_cast(D2)) return Context.hasSameType(TD1->getUnderlyingType(), TD2->getUnderlyingType()); return false; } /// Determines whether to create a using shadow decl for a particular /// decl, given the set of decls existing prior to this using lookup. bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig, const LookupResult &Previous, UsingShadowDecl *&PrevShadow) { // Diagnose finding a decl which is not from a base class of the // current class. We do this now because there are cases where this // function will silently decide not to build a shadow decl, which // will pre-empt further diagnostics. // // We don't need to do this in C++11 because we do the check once on // the qualifier. // // FIXME: diagnose the following if we care enough: // struct A { int foo; }; // struct B : A { using A::foo; }; // template struct C : A {}; // template struct D : C { using B::foo; } // <--- // This is invalid (during instantiation) in C++03 because B::foo // resolves to the using decl in B, which is not a base class of D. // We can't diagnose it immediately because C is an unknown // specialization. The UsingShadowDecl in D then points directly // to A::foo, which will look well-formed when we instantiate. // The right solution is to not collapse the shadow-decl chain. if (!getLangOpts().CPlusPlus11 && CurContext->isRecord()) { DeclContext *OrigDC = Orig->getDeclContext(); // Handle enums and anonymous structs. if (isa(OrigDC)) OrigDC = OrigDC->getParent(); CXXRecordDecl *OrigRec = cast(OrigDC); while (OrigRec->isAnonymousStructOrUnion()) OrigRec = cast(OrigRec->getDeclContext()); if (cast(CurContext)->isProvablyNotDerivedFrom(OrigRec)) { if (OrigDC == CurContext) { Diag(Using->getLocation(), diag::err_using_decl_nested_name_specifier_is_current_class) << Using->getQualifierLoc().getSourceRange(); Diag(Orig->getLocation(), diag::note_using_decl_target); Using->setInvalidDecl(); return true; } Diag(Using->getQualifierLoc().getBeginLoc(), diag::err_using_decl_nested_name_specifier_is_not_base_class) << Using->getQualifier() << cast(CurContext) << Using->getQualifierLoc().getSourceRange(); Diag(Orig->getLocation(), diag::note_using_decl_target); Using->setInvalidDecl(); return true; } } if (Previous.empty()) return false; NamedDecl *Target = Orig; if (isa(Target)) Target = cast(Target)->getTargetDecl(); // If the target happens to be one of the previous declarations, we // don't have a conflict. // // FIXME: but we might be increasing its access, in which case we // should redeclare it. NamedDecl *NonTag = nullptr, *Tag = nullptr; bool FoundEquivalentDecl = false; for (LookupResult::iterator I = Previous.begin(), E = Previous.end(); I != E; ++I) { NamedDecl *D = (*I)->getUnderlyingDecl(); // We can have UsingDecls in our Previous results because we use the same // LookupResult for checking whether the UsingDecl itself is a valid // redeclaration. if (isa(D) || isa(D)) continue; if (auto *RD = dyn_cast(D)) { // C++ [class.mem]p19: // If T is the name of a class, then [every named member other than // a non-static data member] shall have a name different from T if (RD->isInjectedClassName() && !isa(Target) && !isa(Target) && !isa(Target) && DiagnoseClassNameShadow( CurContext, DeclarationNameInfo(Using->getDeclName(), Using->getLocation()))) return true; } if (IsEquivalentForUsingDecl(Context, D, Target)) { if (UsingShadowDecl *Shadow = dyn_cast(*I)) PrevShadow = Shadow; FoundEquivalentDecl = true; } else if (isEquivalentInternalLinkageDeclaration(D, Target)) { // We don't conflict with an existing using shadow decl of an equivalent // declaration, but we're not a redeclaration of it. FoundEquivalentDecl = true; } if (isVisible(D)) (isa(D) ? Tag : NonTag) = D; } if (FoundEquivalentDecl) return false; if (FunctionDecl *FD = Target->getAsFunction()) { NamedDecl *OldDecl = nullptr; switch (CheckOverload(nullptr, FD, Previous, OldDecl, /*IsForUsingDecl*/ true)) { case Ovl_Overload: return false; case Ovl_NonFunction: Diag(Using->getLocation(), diag::err_using_decl_conflict); break; // We found a decl with the exact signature. case Ovl_Match: // If we're in a record, we want to hide the target, so we // return true (without a diagnostic) to tell the caller not to // build a shadow decl. if (CurContext->isRecord()) return true; // If we're not in a record, this is an error. Diag(Using->getLocation(), diag::err_using_decl_conflict); break; } Diag(Target->getLocation(), diag::note_using_decl_target); Diag(OldDecl->getLocation(), diag::note_using_decl_conflict); Using->setInvalidDecl(); return true; } // Target is not a function. if (isa(Target)) { // No conflict between a tag and a non-tag. if (!Tag) return false; Diag(Using->getLocation(), diag::err_using_decl_conflict); Diag(Target->getLocation(), diag::note_using_decl_target); Diag(Tag->getLocation(), diag::note_using_decl_conflict); Using->setInvalidDecl(); return true; } // No conflict between a tag and a non-tag. if (!NonTag) return false; Diag(Using->getLocation(), diag::err_using_decl_conflict); Diag(Target->getLocation(), diag::note_using_decl_target); Diag(NonTag->getLocation(), diag::note_using_decl_conflict); Using->setInvalidDecl(); return true; } /// Determine whether a direct base class is a virtual base class. static bool isVirtualDirectBase(CXXRecordDecl *Derived, CXXRecordDecl *Base) { if (!Derived->getNumVBases()) return false; for (auto &B : Derived->bases()) if (B.getType()->getAsCXXRecordDecl() == Base) return B.isVirtual(); llvm_unreachable("not a direct base class"); } /// Builds a shadow declaration corresponding to a 'using' declaration. UsingShadowDecl *Sema::BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Orig, UsingShadowDecl *PrevDecl) { // If we resolved to another shadow declaration, just coalesce them. NamedDecl *Target = Orig; if (isa(Target)) { Target = cast(Target)->getTargetDecl(); assert(!isa(Target) && "nested shadow declaration"); } NamedDecl *NonTemplateTarget = Target; if (auto *TargetTD = dyn_cast(Target)) NonTemplateTarget = TargetTD->getTemplatedDecl(); UsingShadowDecl *Shadow; if (NonTemplateTarget && isa(NonTemplateTarget)) { bool IsVirtualBase = isVirtualDirectBase(cast(CurContext), UD->getQualifier()->getAsRecordDecl()); Shadow = ConstructorUsingShadowDecl::Create( Context, CurContext, UD->getLocation(), UD, Orig, IsVirtualBase); } else { Shadow = UsingShadowDecl::Create(Context, CurContext, UD->getLocation(), UD, Target); } UD->addShadowDecl(Shadow); Shadow->setAccess(UD->getAccess()); if (Orig->isInvalidDecl() || UD->isInvalidDecl()) Shadow->setInvalidDecl(); Shadow->setPreviousDecl(PrevDecl); if (S) PushOnScopeChains(Shadow, S); else CurContext->addDecl(Shadow); return Shadow; } /// Hides a using shadow declaration. This is required by the current /// using-decl implementation when a resolvable using declaration in a /// class is followed by a declaration which would hide or override /// one or more of the using decl's targets; for example: /// /// struct Base { void foo(int); }; /// struct Derived : Base { /// using Base::foo; /// void foo(int); /// }; /// /// The governing language is C++03 [namespace.udecl]p12: /// /// When a using-declaration brings names from a base class into a /// derived class scope, member functions in the derived class /// override and/or hide member functions with the same name and /// parameter types in a base class (rather than conflicting). /// /// There are two ways to implement this: /// (1) optimistically create shadow decls when they're not hidden /// by existing declarations, or /// (2) don't create any shadow decls (or at least don't make them /// visible) until we've fully parsed/instantiated the class. /// The problem with (1) is that we might have to retroactively remove /// a shadow decl, which requires several O(n) operations because the /// decl structures are (very reasonably) not designed for removal. /// (2) avoids this but is very fiddly and phase-dependent. void Sema::HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow) { if (Shadow->getDeclName().getNameKind() == DeclarationName::CXXConversionFunctionName) cast(Shadow->getDeclContext())->removeConversion(Shadow); // Remove it from the DeclContext... Shadow->getDeclContext()->removeDecl(Shadow); // ...and the scope, if applicable... if (S) { S->RemoveDecl(Shadow); IdResolver.RemoveDecl(Shadow); } // ...and the using decl. Shadow->getUsingDecl()->removeShadowDecl(Shadow); // TODO: complain somehow if Shadow was used. It shouldn't // be possible for this to happen, because...? } /// Find the base specifier for a base class with the given type. static CXXBaseSpecifier *findDirectBaseWithType(CXXRecordDecl *Derived, QualType DesiredBase, bool &AnyDependentBases) { // Check whether the named type is a direct base class. CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified(); for (auto &Base : Derived->bases()) { CanQualType BaseType = Base.getType()->getCanonicalTypeUnqualified(); if (CanonicalDesiredBase == BaseType) return &Base; if (BaseType->isDependentType()) AnyDependentBases = true; } return nullptr; } namespace { class UsingValidatorCCC final : public CorrectionCandidateCallback { public: UsingValidatorCCC(bool HasTypenameKeyword, bool IsInstantiation, NestedNameSpecifier *NNS, CXXRecordDecl *RequireMemberOf) : HasTypenameKeyword(HasTypenameKeyword), IsInstantiation(IsInstantiation), OldNNS(NNS), RequireMemberOf(RequireMemberOf) {} bool ValidateCandidate(const TypoCorrection &Candidate) override { NamedDecl *ND = Candidate.getCorrectionDecl(); // Keywords are not valid here. if (!ND || isa(ND)) return false; // Completely unqualified names are invalid for a 'using' declaration. if (Candidate.WillReplaceSpecifier() && !Candidate.getCorrectionSpecifier()) return false; // FIXME: Don't correct to a name that CheckUsingDeclRedeclaration would // reject. if (RequireMemberOf) { auto *FoundRecord = dyn_cast(ND); if (FoundRecord && FoundRecord->isInjectedClassName()) { // No-one ever wants a using-declaration to name an injected-class-name // of a base class, unless they're declaring an inheriting constructor. ASTContext &Ctx = ND->getASTContext(); if (!Ctx.getLangOpts().CPlusPlus11) return false; QualType FoundType = Ctx.getRecordType(FoundRecord); // Check that the injected-class-name is named as a member of its own // type; we don't want to suggest 'using Derived::Base;', since that // means something else. NestedNameSpecifier *Specifier = Candidate.WillReplaceSpecifier() ? Candidate.getCorrectionSpecifier() : OldNNS; if (!Specifier->getAsType() || !Ctx.hasSameType(QualType(Specifier->getAsType(), 0), FoundType)) return false; // Check that this inheriting constructor declaration actually names a // direct base class of the current class. bool AnyDependentBases = false; if (!findDirectBaseWithType(RequireMemberOf, Ctx.getRecordType(FoundRecord), AnyDependentBases) && !AnyDependentBases) return false; } else { auto *RD = dyn_cast(ND->getDeclContext()); if (!RD || RequireMemberOf->isProvablyNotDerivedFrom(RD)) return false; // FIXME: Check that the base class member is accessible? } } else { auto *FoundRecord = dyn_cast(ND); if (FoundRecord && FoundRecord->isInjectedClassName()) return false; } if (isa(ND)) return HasTypenameKeyword || !IsInstantiation; return !HasTypenameKeyword; } std::unique_ptr clone() override { return llvm::make_unique(*this); } private: bool HasTypenameKeyword; bool IsInstantiation; NestedNameSpecifier *OldNNS; CXXRecordDecl *RequireMemberOf; }; } // end anonymous namespace /// Builds a using declaration. /// /// \param IsInstantiation - Whether this call arises from an /// instantiation of an unresolved using declaration. We treat /// the lookup differently for these declarations. NamedDecl *Sema::BuildUsingDeclaration( Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation) { assert(!SS.isInvalid() && "Invalid CXXScopeSpec."); SourceLocation IdentLoc = NameInfo.getLoc(); assert(IdentLoc.isValid() && "Invalid TargetName location."); // FIXME: We ignore attributes for now. // For an inheriting constructor declaration, the name of the using // declaration is the name of a constructor in this class, not in the // base class. DeclarationNameInfo UsingName = NameInfo; if (UsingName.getName().getNameKind() == DeclarationName::CXXConstructorName) if (auto *RD = dyn_cast(CurContext)) UsingName.setName(Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(Context.getRecordType(RD)))); // Do the redeclaration lookup in the current scope. LookupResult Previous(*this, UsingName, LookupUsingDeclName, ForVisibleRedeclaration); Previous.setHideTags(false); if (S) { LookupName(Previous, S); // It is really dumb that we have to do this. LookupResult::Filter F = Previous.makeFilter(); while (F.hasNext()) { NamedDecl *D = F.next(); if (!isDeclInScope(D, CurContext, S)) F.erase(); // If we found a local extern declaration that's not ordinarily visible, // and this declaration is being added to a non-block scope, ignore it. // We're only checking for scope conflicts here, not also for violations // of the linkage rules. else if (!CurContext->isFunctionOrMethod() && D->isLocalExternDecl() && !(D->getIdentifierNamespace() & Decl::IDNS_Ordinary)) F.erase(); } F.done(); } else { assert(IsInstantiation && "no scope in non-instantiation"); if (CurContext->isRecord()) LookupQualifiedName(Previous, CurContext); else { // No redeclaration check is needed here; in non-member contexts we // diagnosed all possible conflicts with other using-declarations when // building the template: // // For a dependent non-type using declaration, the only valid case is // if we instantiate to a single enumerator. We check for conflicts // between shadow declarations we introduce, and we check in the template // definition for conflicts between a non-type using declaration and any // other declaration, which together covers all cases. // // A dependent typename using declaration will never successfully // instantiate, since it will always name a class member, so we reject // that in the template definition. } } // Check for invalid redeclarations. if (CheckUsingDeclRedeclaration(UsingLoc, HasTypenameKeyword, SS, IdentLoc, Previous)) return nullptr; // Check for bad qualifiers. if (CheckUsingDeclQualifier(UsingLoc, HasTypenameKeyword, SS, NameInfo, IdentLoc)) return nullptr; DeclContext *LookupContext = computeDeclContext(SS); NamedDecl *D; NestedNameSpecifierLoc QualifierLoc = SS.getWithLocInContext(Context); if (!LookupContext || EllipsisLoc.isValid()) { if (HasTypenameKeyword) { // FIXME: not all declaration name kinds are legal here D = UnresolvedUsingTypenameDecl::Create(Context, CurContext, UsingLoc, TypenameLoc, QualifierLoc, IdentLoc, NameInfo.getName(), EllipsisLoc); } else { D = UnresolvedUsingValueDecl::Create(Context, CurContext, UsingLoc, QualifierLoc, NameInfo, EllipsisLoc); } D->setAccess(AS); CurContext->addDecl(D); return D; } auto Build = [&](bool Invalid) { UsingDecl *UD = UsingDecl::Create(Context, CurContext, UsingLoc, QualifierLoc, UsingName, HasTypenameKeyword); UD->setAccess(AS); CurContext->addDecl(UD); UD->setInvalidDecl(Invalid); return UD; }; auto BuildInvalid = [&]{ return Build(true); }; auto BuildValid = [&]{ return Build(false); }; if (RequireCompleteDeclContext(SS, LookupContext)) return BuildInvalid(); // Look up the target name. LookupResult R(*this, NameInfo, LookupOrdinaryName); // Unlike most lookups, we don't always want to hide tag // declarations: tag names are visible through the using declaration // even if hidden by ordinary names, *except* in a dependent context // where it's important for the sanity of two-phase lookup. if (!IsInstantiation) R.setHideTags(false); // For the purposes of this lookup, we have a base object type // equal to that of the current context. if (CurContext->isRecord()) { R.setBaseObjectType( Context.getTypeDeclType(cast(CurContext))); } LookupQualifiedName(R, LookupContext); // Try to correct typos if possible. If constructor name lookup finds no // results, that means the named class has no explicit constructors, and we // suppressed declaring implicit ones (probably because it's dependent or // invalid). if (R.empty() && NameInfo.getName().getNameKind() != DeclarationName::CXXConstructorName) { // HACK: Work around a bug in libstdc++'s detection of ::gets. Sometimes // it will believe that glibc provides a ::gets in cases where it does not, // and will try to pull it into namespace std with a using-declaration. // Just ignore the using-declaration in that case. auto *II = NameInfo.getName().getAsIdentifierInfo(); if (getLangOpts().CPlusPlus14 && II && II->isStr("gets") && CurContext->isStdNamespace() && isa(LookupContext) && getSourceManager().isInSystemHeader(UsingLoc)) return nullptr; UsingValidatorCCC CCC(HasTypenameKeyword, IsInstantiation, SS.getScopeRep(), dyn_cast(CurContext)); if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, &SS, CCC, CTK_ErrorRecovery)) { // We reject candidates where DroppedSpecifier == true, hence the // literal '0' below. diagnoseTypo(Corrected, PDiag(diag::err_no_member_suggest) << NameInfo.getName() << LookupContext << 0 << SS.getRange()); // If we picked a correction with no attached Decl we can't do anything // useful with it, bail out. NamedDecl *ND = Corrected.getCorrectionDecl(); if (!ND) return BuildInvalid(); // If we corrected to an inheriting constructor, handle it as one. auto *RD = dyn_cast(ND); if (RD && RD->isInjectedClassName()) { // The parent of the injected class name is the class itself. RD = cast(RD->getParent()); // Fix up the information we'll use to build the using declaration. if (Corrected.WillReplaceSpecifier()) { NestedNameSpecifierLocBuilder Builder; Builder.MakeTrivial(Context, Corrected.getCorrectionSpecifier(), QualifierLoc.getSourceRange()); QualifierLoc = Builder.getWithLocInContext(Context); } // In this case, the name we introduce is the name of a derived class // constructor. auto *CurClass = cast(CurContext); UsingName.setName(Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(Context.getRecordType(CurClass)))); UsingName.setNamedTypeInfo(nullptr); for (auto *Ctor : LookupConstructors(RD)) R.addDecl(Ctor); R.resolveKind(); } else { // FIXME: Pick up all the declarations if we found an overloaded // function. UsingName.setName(ND->getDeclName()); R.addDecl(ND); } } else { Diag(IdentLoc, diag::err_no_member) << NameInfo.getName() << LookupContext << SS.getRange(); return BuildInvalid(); } } if (R.isAmbiguous()) return BuildInvalid(); if (HasTypenameKeyword) { // If we asked for a typename and got a non-type decl, error out. if (!R.getAsSingle()) { Diag(IdentLoc, diag::err_using_typename_non_type); for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) Diag((*I)->getUnderlyingDecl()->getLocation(), diag::note_using_decl_target); return BuildInvalid(); } } else { // If we asked for a non-typename and we got a type, error out, // but only if this is an instantiation of an unresolved using // decl. Otherwise just silently find the type name. if (IsInstantiation && R.getAsSingle()) { Diag(IdentLoc, diag::err_using_dependent_value_is_type); Diag(R.getFoundDecl()->getLocation(), diag::note_using_decl_target); return BuildInvalid(); } } // C++14 [namespace.udecl]p6: // A using-declaration shall not name a namespace. if (R.getAsSingle()) { Diag(IdentLoc, diag::err_using_decl_can_not_refer_to_namespace) << SS.getRange(); return BuildInvalid(); } // C++14 [namespace.udecl]p7: // A using-declaration shall not name a scoped enumerator. if (auto *ED = R.getAsSingle()) { if (cast(ED->getDeclContext())->isScoped()) { Diag(IdentLoc, diag::err_using_decl_can_not_refer_to_scoped_enum) << SS.getRange(); return BuildInvalid(); } } UsingDecl *UD = BuildValid(); // Some additional rules apply to inheriting constructors. if (UsingName.getName().getNameKind() == DeclarationName::CXXConstructorName) { // Suppress access diagnostics; the access check is instead performed at the // point of use for an inheriting constructor. R.suppressDiagnostics(); if (CheckInheritingConstructorUsingDecl(UD)) return UD; } for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) { UsingShadowDecl *PrevDecl = nullptr; if (!CheckUsingShadowDecl(UD, *I, Previous, PrevDecl)) BuildUsingShadowDecl(S, UD, *I, PrevDecl); } return UD; } NamedDecl *Sema::BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef Expansions) { assert(isa(InstantiatedFrom) || isa(InstantiatedFrom) || isa(InstantiatedFrom)); auto *UPD = UsingPackDecl::Create(Context, CurContext, InstantiatedFrom, Expansions); UPD->setAccess(InstantiatedFrom->getAccess()); CurContext->addDecl(UPD); return UPD; } /// Additional checks for a using declaration referring to a constructor name. bool Sema::CheckInheritingConstructorUsingDecl(UsingDecl *UD) { assert(!UD->hasTypename() && "expecting a constructor name"); const Type *SourceType = UD->getQualifier()->getAsType(); assert(SourceType && "Using decl naming constructor doesn't have type in scope spec."); CXXRecordDecl *TargetClass = cast(CurContext); // Check whether the named type is a direct base class. bool AnyDependentBases = false; auto *Base = findDirectBaseWithType(TargetClass, QualType(SourceType, 0), AnyDependentBases); if (!Base && !AnyDependentBases) { Diag(UD->getUsingLoc(), diag::err_using_decl_constructor_not_in_direct_base) << UD->getNameInfo().getSourceRange() << QualType(SourceType, 0) << TargetClass; UD->setInvalidDecl(); return true; } if (Base) Base->setInheritConstructors(); return false; } /// Checks that the given using declaration is not an invalid /// redeclaration. Note that this is checking only for the using decl /// itself, not for any ill-formedness among the UsingShadowDecls. bool Sema::CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Prev) { NestedNameSpecifier *Qual = SS.getScopeRep(); // C++03 [namespace.udecl]p8: // C++0x [namespace.udecl]p10: // A using-declaration is a declaration and can therefore be used // repeatedly where (and only where) multiple declarations are // allowed. // // That's in non-member contexts. if (!CurContext->getRedeclContext()->isRecord()) { // A dependent qualifier outside a class can only ever resolve to an // enumeration type. Therefore it conflicts with any other non-type // declaration in the same scope. // FIXME: How should we check for dependent type-type conflicts at block // scope? if (Qual->isDependent() && !HasTypenameKeyword) { for (auto *D : Prev) { if (!isa(D) && !isa(D) && !isa(D)) { bool OldCouldBeEnumerator = isa(D) || isa(D); Diag(NameLoc, OldCouldBeEnumerator ? diag::err_redefinition : diag::err_redefinition_different_kind) << Prev.getLookupName(); Diag(D->getLocation(), diag::note_previous_definition); return true; } } } return false; } for (LookupResult::iterator I = Prev.begin(), E = Prev.end(); I != E; ++I) { NamedDecl *D = *I; bool DTypename; NestedNameSpecifier *DQual; if (UsingDecl *UD = dyn_cast(D)) { DTypename = UD->hasTypename(); DQual = UD->getQualifier(); } else if (UnresolvedUsingValueDecl *UD = dyn_cast(D)) { DTypename = false; DQual = UD->getQualifier(); } else if (UnresolvedUsingTypenameDecl *UD = dyn_cast(D)) { DTypename = true; DQual = UD->getQualifier(); } else continue; // using decls differ if one says 'typename' and the other doesn't. // FIXME: non-dependent using decls? if (HasTypenameKeyword != DTypename) continue; // using decls differ if they name different scopes (but note that // template instantiation can cause this check to trigger when it // didn't before instantiation). if (Context.getCanonicalNestedNameSpecifier(Qual) != Context.getCanonicalNestedNameSpecifier(DQual)) continue; Diag(NameLoc, diag::err_using_decl_redeclaration) << SS.getRange(); Diag(D->getLocation(), diag::note_using_decl) << 1; return true; } return false; } /// Checks that the given nested-name qualifier used in a using decl /// in the current context is appropriately related to the current /// scope. If an error is found, diagnoses it and returns true. bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc) { DeclContext *NamedContext = computeDeclContext(SS); if (!CurContext->isRecord()) { // C++03 [namespace.udecl]p3: // C++0x [namespace.udecl]p8: // A using-declaration for a class member shall be a member-declaration. // If we weren't able to compute a valid scope, it might validly be a // dependent class scope or a dependent enumeration unscoped scope. If // we have a 'typename' keyword, the scope must resolve to a class type. if ((HasTypename && !NamedContext) || (NamedContext && NamedContext->getRedeclContext()->isRecord())) { auto *RD = NamedContext ? cast(NamedContext->getRedeclContext()) : nullptr; if (RD && RequireCompleteDeclContext(const_cast(SS), RD)) RD = nullptr; Diag(NameLoc, diag::err_using_decl_can_not_refer_to_class_member) << SS.getRange(); // If we have a complete, non-dependent source type, try to suggest a // way to get the same effect. if (!RD) return true; // Find what this using-declaration was referring to. LookupResult R(*this, NameInfo, LookupOrdinaryName); R.setHideTags(false); R.suppressDiagnostics(); LookupQualifiedName(R, RD); if (R.getAsSingle()) { if (getLangOpts().CPlusPlus11) { // Convert 'using X::Y;' to 'using Y = X::Y;'. Diag(SS.getBeginLoc(), diag::note_using_decl_class_member_workaround) << 0 // alias declaration << FixItHint::CreateInsertion(SS.getBeginLoc(), NameInfo.getName().getAsString() + " = "); } else { // Convert 'using X::Y;' to 'typedef X::Y Y;'. SourceLocation InsertLoc = getLocForEndOfToken(NameInfo.getEndLoc()); Diag(InsertLoc, diag::note_using_decl_class_member_workaround) << 1 // typedef declaration << FixItHint::CreateReplacement(UsingLoc, "typedef") << FixItHint::CreateInsertion( InsertLoc, " " + NameInfo.getName().getAsString()); } } else if (R.getAsSingle()) { // Don't provide a fixit outside C++11 mode; we don't want to suggest // repeating the type of the static data member here. FixItHint FixIt; if (getLangOpts().CPlusPlus11) { // Convert 'using X::Y;' to 'auto &Y = X::Y;'. FixIt = FixItHint::CreateReplacement( UsingLoc, "auto &" + NameInfo.getName().getAsString() + " = "); } Diag(UsingLoc, diag::note_using_decl_class_member_workaround) << 2 // reference declaration << FixIt; } else if (R.getAsSingle()) { // Don't provide a fixit outside C++11 mode; we don't want to suggest // repeating the type of the enumeration here, and we can't do so if // the type is anonymous. FixItHint FixIt; if (getLangOpts().CPlusPlus11) { // Convert 'using X::Y;' to 'auto &Y = X::Y;'. FixIt = FixItHint::CreateReplacement( UsingLoc, "constexpr auto " + NameInfo.getName().getAsString() + " = "); } Diag(UsingLoc, diag::note_using_decl_class_member_workaround) << (getLangOpts().CPlusPlus11 ? 4 : 3) // const[expr] variable << FixIt; } return true; } // Otherwise, this might be valid. return false; } // The current scope is a record. // If the named context is dependent, we can't decide much. if (!NamedContext) { // FIXME: in C++0x, we can diagnose if we can prove that the // nested-name-specifier does not refer to a base class, which is // still possible in some cases. // Otherwise we have to conservatively report that things might be // okay. return false; } if (!NamedContext->isRecord()) { // Ideally this would point at the last name in the specifier, // but we don't have that level of source info. Diag(SS.getRange().getBegin(), diag::err_using_decl_nested_name_specifier_is_not_class) << SS.getScopeRep() << SS.getRange(); return true; } if (!NamedContext->isDependentContext() && RequireCompleteDeclContext(const_cast(SS), NamedContext)) return true; if (getLangOpts().CPlusPlus11) { // C++11 [namespace.udecl]p3: // In a using-declaration used as a member-declaration, the // nested-name-specifier shall name a base class of the class // being defined. if (cast(CurContext)->isProvablyNotDerivedFrom( cast(NamedContext))) { if (CurContext == NamedContext) { Diag(NameLoc, diag::err_using_decl_nested_name_specifier_is_current_class) << SS.getRange(); return true; } if (!cast(NamedContext)->isInvalidDecl()) { Diag(SS.getRange().getBegin(), diag::err_using_decl_nested_name_specifier_is_not_base_class) << SS.getScopeRep() << cast(CurContext) << SS.getRange(); } return true; } return false; } // C++03 [namespace.udecl]p4: // A using-declaration used as a member-declaration shall refer // to a member of a base class of the class being defined [etc.]. // Salient point: SS doesn't have to name a base class as long as // lookup only finds members from base classes. Therefore we can // diagnose here only if we can prove that that can't happen, // i.e. if the class hierarchies provably don't intersect. // TODO: it would be nice if "definitely valid" results were cached // in the UsingDecl and UsingShadowDecl so that these checks didn't // need to be repeated. llvm::SmallPtrSet Bases; auto Collect = [&Bases](const CXXRecordDecl *Base) { Bases.insert(Base); return true; }; // Collect all bases. Return false if we find a dependent base. if (!cast(CurContext)->forallBases(Collect)) return false; // Returns true if the base is dependent or is one of the accumulated base // classes. auto IsNotBase = [&Bases](const CXXRecordDecl *Base) { return !Bases.count(Base); }; // Return false if the class has a dependent base or if it or one // of its bases is present in the base set of the current context. if (Bases.count(cast(NamedContext)) || !cast(NamedContext)->forallBases(IsNotBase)) return false; Diag(SS.getRange().getBegin(), diag::err_using_decl_nested_name_specifier_is_not_base_class) << SS.getScopeRep() << cast(CurContext) << SS.getRange(); return true; } Decl *Sema::ActOnAliasDeclaration(Scope *S, AccessSpecifier AS, MultiTemplateParamsArg TemplateParamLists, SourceLocation UsingLoc, UnqualifiedId &Name, const ParsedAttributesView &AttrList, TypeResult Type, Decl *DeclFromDeclSpec) { // Skip up to the relevant declaration scope. while (S->isTemplateParamScope()) S = S->getParent(); assert((S->getFlags() & Scope::DeclScope) && "got alias-declaration outside of declaration scope"); if (Type.isInvalid()) return nullptr; bool Invalid = false; DeclarationNameInfo NameInfo = GetNameFromUnqualifiedId(Name); TypeSourceInfo *TInfo = nullptr; GetTypeFromParser(Type.get(), &TInfo); if (DiagnoseClassNameShadow(CurContext, NameInfo)) return nullptr; if (DiagnoseUnexpandedParameterPack(Name.StartLocation, TInfo, UPPC_DeclarationType)) { Invalid = true; TInfo = Context.getTrivialTypeSourceInfo(Context.IntTy, TInfo->getTypeLoc().getBeginLoc()); } LookupResult Previous(*this, NameInfo, LookupOrdinaryName, TemplateParamLists.size() ? forRedeclarationInCurContext() : ForVisibleRedeclaration); LookupName(Previous, S); // Warn about shadowing the name of a template parameter. if (Previous.isSingleResult() && Previous.getFoundDecl()->isTemplateParameter()) { DiagnoseTemplateParameterShadow(Name.StartLocation,Previous.getFoundDecl()); Previous.clear(); } assert(Name.Kind == UnqualifiedIdKind::IK_Identifier && "name in alias declaration must be an identifier"); TypeAliasDecl *NewTD = TypeAliasDecl::Create(Context, CurContext, UsingLoc, Name.StartLocation, Name.Identifier, TInfo); NewTD->setAccess(AS); if (Invalid) NewTD->setInvalidDecl(); ProcessDeclAttributeList(S, NewTD, AttrList); AddPragmaAttributes(S, NewTD); CheckTypedefForVariablyModifiedType(S, NewTD); Invalid |= NewTD->isInvalidDecl(); bool Redeclaration = false; NamedDecl *NewND; if (TemplateParamLists.size()) { TypeAliasTemplateDecl *OldDecl = nullptr; TemplateParameterList *OldTemplateParams = nullptr; if (TemplateParamLists.size() != 1) { Diag(UsingLoc, diag::err_alias_template_extra_headers) << SourceRange(TemplateParamLists[1]->getTemplateLoc(), TemplateParamLists[TemplateParamLists.size()-1]->getRAngleLoc()); } TemplateParameterList *TemplateParams = TemplateParamLists[0]; // Check that we can declare a template here. if (CheckTemplateDeclScope(S, TemplateParams)) return nullptr; // Only consider previous declarations in the same scope. FilterLookupForScope(Previous, CurContext, S, /*ConsiderLinkage*/false, /*ExplicitInstantiationOrSpecialization*/false); if (!Previous.empty()) { Redeclaration = true; OldDecl = Previous.getAsSingle(); if (!OldDecl && !Invalid) { Diag(UsingLoc, diag::err_redefinition_different_kind) << Name.Identifier; NamedDecl *OldD = Previous.getRepresentativeDecl(); if (OldD->getLocation().isValid()) Diag(OldD->getLocation(), diag::note_previous_definition); Invalid = true; } if (!Invalid && OldDecl && !OldDecl->isInvalidDecl()) { if (TemplateParameterListsAreEqual(TemplateParams, OldDecl->getTemplateParameters(), /*Complain=*/true, TPL_TemplateMatch)) OldTemplateParams = OldDecl->getMostRecentDecl()->getTemplateParameters(); else Invalid = true; TypeAliasDecl *OldTD = OldDecl->getTemplatedDecl(); if (!Invalid && !Context.hasSameType(OldTD->getUnderlyingType(), NewTD->getUnderlyingType())) { // FIXME: The C++0x standard does not clearly say this is ill-formed, // but we can't reasonably accept it. Diag(NewTD->getLocation(), diag::err_redefinition_different_typedef) << 2 << NewTD->getUnderlyingType() << OldTD->getUnderlyingType(); if (OldTD->getLocation().isValid()) Diag(OldTD->getLocation(), diag::note_previous_definition); Invalid = true; } } } // Merge any previous default template arguments into our parameters, // and check the parameter list. if (CheckTemplateParameterList(TemplateParams, OldTemplateParams, TPC_TypeAliasTemplate)) return nullptr; TypeAliasTemplateDecl *NewDecl = TypeAliasTemplateDecl::Create(Context, CurContext, UsingLoc, Name.Identifier, TemplateParams, NewTD); NewTD->setDescribedAliasTemplate(NewDecl); NewDecl->setAccess(AS); if (Invalid) NewDecl->setInvalidDecl(); else if (OldDecl) { NewDecl->setPreviousDecl(OldDecl); CheckRedeclarationModuleOwnership(NewDecl, OldDecl); } NewND = NewDecl; } else { if (auto *TD = dyn_cast_or_null(DeclFromDeclSpec)) { setTagNameForLinkagePurposes(TD, NewTD); handleTagNumbering(TD, S); } ActOnTypedefNameDecl(S, CurContext, NewTD, Previous, Redeclaration); NewND = NewTD; } PushOnScopeChains(NewND, S); ActOnDocumentableDecl(NewND); return NewND; } Decl *Sema::ActOnNamespaceAliasDef(Scope *S, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident) { // Lookup the namespace name. LookupResult R(*this, Ident, IdentLoc, LookupNamespaceName); LookupParsedName(R, S, &SS); if (R.isAmbiguous()) return nullptr; if (R.empty()) { if (!TryNamespaceTypoCorrection(*this, R, S, SS, IdentLoc, Ident)) { Diag(IdentLoc, diag::err_expected_namespace_name) << SS.getRange(); return nullptr; } } assert(!R.isAmbiguous() && !R.empty()); NamedDecl *ND = R.getRepresentativeDecl(); // Check if we have a previous declaration with the same name. LookupResult PrevR(*this, Alias, AliasLoc, LookupOrdinaryName, ForVisibleRedeclaration); LookupName(PrevR, S); // Check we're not shadowing a template parameter. if (PrevR.isSingleResult() && PrevR.getFoundDecl()->isTemplateParameter()) { DiagnoseTemplateParameterShadow(AliasLoc, PrevR.getFoundDecl()); PrevR.clear(); } // Filter out any other lookup result from an enclosing scope. FilterLookupForScope(PrevR, CurContext, S, /*ConsiderLinkage*/false, /*AllowInlineNamespace*/false); // Find the previous declaration and check that we can redeclare it. NamespaceAliasDecl *Prev = nullptr; if (PrevR.isSingleResult()) { NamedDecl *PrevDecl = PrevR.getRepresentativeDecl(); if (NamespaceAliasDecl *AD = dyn_cast(PrevDecl)) { // We already have an alias with the same name that points to the same // namespace; check that it matches. if (AD->getNamespace()->Equals(getNamespaceDecl(ND))) { Prev = AD; } else if (isVisible(PrevDecl)) { Diag(AliasLoc, diag::err_redefinition_different_namespace_alias) << Alias; Diag(AD->getLocation(), diag::note_previous_namespace_alias) << AD->getNamespace(); return nullptr; } } else if (isVisible(PrevDecl)) { unsigned DiagID = isa(PrevDecl->getUnderlyingDecl()) ? diag::err_redefinition : diag::err_redefinition_different_kind; Diag(AliasLoc, DiagID) << Alias; Diag(PrevDecl->getLocation(), diag::note_previous_definition); return nullptr; } } // The use of a nested name specifier may trigger deprecation warnings. DiagnoseUseOfDecl(ND, IdentLoc); NamespaceAliasDecl *AliasDecl = NamespaceAliasDecl::Create(Context, CurContext, NamespaceLoc, AliasLoc, Alias, SS.getWithLocInContext(Context), IdentLoc, ND); if (Prev) AliasDecl->setPreviousDecl(Prev); PushOnScopeChains(AliasDecl, S); return AliasDecl; } namespace { struct SpecialMemberExceptionSpecInfo : SpecialMemberVisitor { SourceLocation Loc; Sema::ImplicitExceptionSpecification ExceptSpec; SpecialMemberExceptionSpecInfo(Sema &S, CXXMethodDecl *MD, Sema::CXXSpecialMember CSM, Sema::InheritedConstructorInfo *ICI, SourceLocation Loc) : SpecialMemberVisitor(S, MD, CSM, ICI), Loc(Loc), ExceptSpec(S) {} bool visitBase(CXXBaseSpecifier *Base); bool visitField(FieldDecl *FD); void visitClassSubobject(CXXRecordDecl *Class, Subobject Subobj, unsigned Quals); void visitSubobjectCall(Subobject Subobj, Sema::SpecialMemberOverloadResult SMOR); }; } bool SpecialMemberExceptionSpecInfo::visitBase(CXXBaseSpecifier *Base) { auto *RT = Base->getType()->getAs(); if (!RT) return false; auto *BaseClass = cast(RT->getDecl()); Sema::SpecialMemberOverloadResult SMOR = lookupInheritedCtor(BaseClass); if (auto *BaseCtor = SMOR.getMethod()) { visitSubobjectCall(Base, BaseCtor); return false; } visitClassSubobject(BaseClass, Base, 0); return false; } bool SpecialMemberExceptionSpecInfo::visitField(FieldDecl *FD) { if (CSM == Sema::CXXDefaultConstructor && FD->hasInClassInitializer()) { Expr *E = FD->getInClassInitializer(); if (!E) // FIXME: It's a little wasteful to build and throw away a // CXXDefaultInitExpr here. // FIXME: We should have a single context note pointing at Loc, and // this location should be MD->getLocation() instead, since that's // the location where we actually use the default init expression. E = S.BuildCXXDefaultInitExpr(Loc, FD).get(); if (E) ExceptSpec.CalledExpr(E); } else if (auto *RT = S.Context.getBaseElementType(FD->getType()) ->getAs()) { visitClassSubobject(cast(RT->getDecl()), FD, FD->getType().getCVRQualifiers()); } return false; } void SpecialMemberExceptionSpecInfo::visitClassSubobject(CXXRecordDecl *Class, Subobject Subobj, unsigned Quals) { FieldDecl *Field = Subobj.dyn_cast(); bool IsMutable = Field && Field->isMutable(); visitSubobjectCall(Subobj, lookupIn(Class, Quals, IsMutable)); } void SpecialMemberExceptionSpecInfo::visitSubobjectCall( Subobject Subobj, Sema::SpecialMemberOverloadResult SMOR) { // Note, if lookup fails, it doesn't matter what exception specification we // choose because the special member will be deleted. if (CXXMethodDecl *MD = SMOR.getMethod()) ExceptSpec.CalledDecl(getSubobjectLoc(Subobj), MD); } namespace { /// RAII object to register a special member as being currently declared. struct ComputingExceptionSpec { Sema &S; ComputingExceptionSpec(Sema &S, CXXMethodDecl *MD, SourceLocation Loc) : S(S) { Sema::CodeSynthesisContext Ctx; Ctx.Kind = Sema::CodeSynthesisContext::ExceptionSpecEvaluation; Ctx.PointOfInstantiation = Loc; Ctx.Entity = MD; S.pushCodeSynthesisContext(Ctx); } ~ComputingExceptionSpec() { S.popCodeSynthesisContext(); } }; } bool Sema::tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec) { llvm::APSInt Result; ExprResult Converted = CheckConvertedConstantExpression( ExplicitSpec.getExpr(), Context.BoolTy, Result, CCEK_ExplicitBool); ExplicitSpec.setExpr(Converted.get()); if (Converted.isUsable() && !Converted.get()->isValueDependent()) { ExplicitSpec.setKind(Result.getBoolValue() ? ExplicitSpecKind::ResolvedTrue : ExplicitSpecKind::ResolvedFalse); return true; } ExplicitSpec.setKind(ExplicitSpecKind::Unresolved); return false; } ExplicitSpecifier Sema::ActOnExplicitBoolSpecifier(Expr *ExplicitExpr) { ExplicitSpecifier ES(ExplicitExpr, ExplicitSpecKind::Unresolved); if (!ExplicitExpr->isTypeDependent()) tryResolveExplicitSpecifier(ES); return ES; } static Sema::ImplicitExceptionSpecification ComputeDefaultedSpecialMemberExceptionSpec( Sema &S, SourceLocation Loc, CXXMethodDecl *MD, Sema::CXXSpecialMember CSM, Sema::InheritedConstructorInfo *ICI) { ComputingExceptionSpec CES(S, MD, Loc); CXXRecordDecl *ClassDecl = MD->getParent(); // C++ [except.spec]p14: // An implicitly declared special member function (Clause 12) shall have an // exception-specification. [...] SpecialMemberExceptionSpecInfo Info(S, MD, CSM, ICI, MD->getLocation()); if (ClassDecl->isInvalidDecl()) return Info.ExceptSpec; // FIXME: If this diagnostic fires, we're probably missing a check for // attempting to resolve an exception specification before it's known // at a higher level. if (S.RequireCompleteType(MD->getLocation(), S.Context.getRecordType(ClassDecl), diag::err_exception_spec_incomplete_type)) return Info.ExceptSpec; // C++1z [except.spec]p7: // [Look for exceptions thrown by] a constructor selected [...] to // initialize a potentially constructed subobject, // C++1z [except.spec]p8: // The exception specification for an implicitly-declared destructor, or a // destructor without a noexcept-specifier, is potentially-throwing if and // only if any of the destructors for any of its potentially constructed // subojects is potentially throwing. // FIXME: We respect the first rule but ignore the "potentially constructed" // in the second rule to resolve a core issue (no number yet) that would have // us reject: // struct A { virtual void f() = 0; virtual ~A() noexcept(false) = 0; }; // struct B : A {}; // struct C : B { void f(); }; // ... due to giving B::~B() a non-throwing exception specification. Info.visit(Info.IsConstructor ? Info.VisitPotentiallyConstructedBases : Info.VisitAllBases); return Info.ExceptSpec; } namespace { /// RAII object to register a special member as being currently declared. struct DeclaringSpecialMember { Sema &S; Sema::SpecialMemberDecl D; Sema::ContextRAII SavedContext; bool WasAlreadyBeingDeclared; DeclaringSpecialMember(Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM) : S(S), D(RD, CSM), SavedContext(S, RD) { WasAlreadyBeingDeclared = !S.SpecialMembersBeingDeclared.insert(D).second; if (WasAlreadyBeingDeclared) // This almost never happens, but if it does, ensure that our cache // doesn't contain a stale result. S.SpecialMemberCache.clear(); else { // Register a note to be produced if we encounter an error while // declaring the special member. Sema::CodeSynthesisContext Ctx; Ctx.Kind = Sema::CodeSynthesisContext::DeclaringSpecialMember; // FIXME: We don't have a location to use here. Using the class's // location maintains the fiction that we declare all special members // with the class, but (1) it's not clear that lying about that helps our // users understand what's going on, and (2) there may be outer contexts // on the stack (some of which are relevant) and printing them exposes // our lies. Ctx.PointOfInstantiation = RD->getLocation(); Ctx.Entity = RD; Ctx.SpecialMember = CSM; S.pushCodeSynthesisContext(Ctx); } } ~DeclaringSpecialMember() { if (!WasAlreadyBeingDeclared) { S.SpecialMembersBeingDeclared.erase(D); S.popCodeSynthesisContext(); } } /// Are we already trying to declare this special member? bool isAlreadyBeingDeclared() const { return WasAlreadyBeingDeclared; } }; } void Sema::CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD) { // Look up any existing declarations, but don't trigger declaration of all // implicit special members with this name. DeclarationName Name = FD->getDeclName(); LookupResult R(*this, Name, SourceLocation(), LookupOrdinaryName, ForExternalRedeclaration); for (auto *D : FD->getParent()->lookup(Name)) if (auto *Acceptable = R.getAcceptableDecl(D)) R.addDecl(Acceptable); R.resolveKind(); R.suppressDiagnostics(); CheckFunctionDeclaration(S, FD, R, /*IsMemberSpecialization*/false); } void Sema::setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem, QualType ResultTy, ArrayRef Args) { // Build an exception specification pointing back at this constructor. FunctionProtoType::ExtProtoInfo EPI = getImplicitMethodEPI(*this, SpecialMem); if (getLangOpts().OpenCLCPlusPlus) { // OpenCL: Implicitly defaulted special member are of the generic address // space. EPI.TypeQuals.addAddressSpace(LangAS::opencl_generic); } auto QT = Context.getFunctionType(ResultTy, Args, EPI); SpecialMem->setType(QT); } CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor( CXXRecordDecl *ClassDecl) { // C++ [class.ctor]p5: // A default constructor for a class X is a constructor of class X // that can be called without an argument. If there is no // user-declared constructor for class X, a default constructor is // implicitly declared. An implicitly-declared default constructor // is an inline public member of its class. assert(ClassDecl->needsImplicitDefaultConstructor() && "Should not build implicit default constructor!"); DeclaringSpecialMember DSM(*this, ClassDecl, CXXDefaultConstructor); if (DSM.isAlreadyBeingDeclared()) return nullptr; bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, ClassDecl, CXXDefaultConstructor, false); // Create the actual constructor declaration. CanQualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl)); SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationName Name = Context.DeclarationNames.getCXXConstructorName(ClassType); DeclarationNameInfo NameInfo(Name, ClassLoc); CXXConstructorDecl *DefaultCon = CXXConstructorDecl::Create( Context, ClassDecl, ClassLoc, NameInfo, /*Type*/ QualType(), /*TInfo=*/nullptr, ExplicitSpecifier(), /*isInline=*/true, /*isImplicitlyDeclared=*/true, Constexpr ? CSK_constexpr : CSK_unspecified); DefaultCon->setAccess(AS_public); DefaultCon->setDefaulted(); if (getLangOpts().CUDA) { inferCUDATargetForImplicitSpecialMember(ClassDecl, CXXDefaultConstructor, DefaultCon, /* ConstRHS */ false, /* Diagnose */ false); } setupImplicitSpecialMemberType(DefaultCon, Context.VoidTy, None); // We don't need to use SpecialMemberIsTrivial here; triviality for default // constructors is easy to compute. DefaultCon->setTrivial(ClassDecl->hasTrivialDefaultConstructor()); // Note that we have declared this constructor. ++getASTContext().NumImplicitDefaultConstructorsDeclared; Scope *S = getScopeForContext(ClassDecl); CheckImplicitSpecialMemberDeclaration(S, DefaultCon); if (ShouldDeleteSpecialMember(DefaultCon, CXXDefaultConstructor)) SetDeclDeleted(DefaultCon, ClassLoc); if (S) PushOnScopeChains(DefaultCon, S, false); ClassDecl->addDecl(DefaultCon); return DefaultCon; } void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor) { assert((Constructor->isDefaulted() && Constructor->isDefaultConstructor() && !Constructor->doesThisDeclarationHaveABody() && !Constructor->isDeleted()) && "DefineImplicitDefaultConstructor - call it for implicit default ctor"); if (Constructor->willHaveBody() || Constructor->isInvalidDecl()) return; CXXRecordDecl *ClassDecl = Constructor->getParent(); assert(ClassDecl && "DefineImplicitDefaultConstructor - invalid constructor"); SynthesizedFunctionScope Scope(*this, Constructor); // The exception specification is needed because we are defining the // function. ResolveExceptionSpec(CurrentLocation, Constructor->getType()->castAs()); MarkVTableUsed(CurrentLocation, ClassDecl); // Add a context note for diagnostics produced after this point. Scope.addContextNote(CurrentLocation); if (SetCtorInitializers(Constructor, /*AnyErrors=*/false)) { Constructor->setInvalidDecl(); return; } SourceLocation Loc = Constructor->getEndLoc().isValid() ? Constructor->getEndLoc() : Constructor->getLocation(); Constructor->setBody(new (Context) CompoundStmt(Loc)); Constructor->markUsed(Context); if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(Constructor); } DiagnoseUninitializedFields(*this, Constructor); } void Sema::ActOnFinishDelayedMemberInitializers(Decl *D) { // Perform any delayed checks on exception specifications. CheckDelayedMemberExceptionSpecs(); } /// Find or create the fake constructor we synthesize to model constructing an /// object of a derived class via a constructor of a base class. CXXConstructorDecl * Sema::findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, ConstructorUsingShadowDecl *Shadow) { CXXRecordDecl *Derived = Shadow->getParent(); SourceLocation UsingLoc = Shadow->getLocation(); // FIXME: Add a new kind of DeclarationName for an inherited constructor. // For now we use the name of the base class constructor as a member of the // derived class to indicate a (fake) inherited constructor name. DeclarationName Name = BaseCtor->getDeclName(); // Check to see if we already have a fake constructor for this inherited // constructor call. for (NamedDecl *Ctor : Derived->lookup(Name)) if (declaresSameEntity(cast(Ctor) ->getInheritedConstructor() .getConstructor(), BaseCtor)) return cast(Ctor); DeclarationNameInfo NameInfo(Name, UsingLoc); TypeSourceInfo *TInfo = Context.getTrivialTypeSourceInfo(BaseCtor->getType(), UsingLoc); FunctionProtoTypeLoc ProtoLoc = TInfo->getTypeLoc().IgnoreParens().castAs(); // Check the inherited constructor is valid and find the list of base classes // from which it was inherited. InheritedConstructorInfo ICI(*this, Loc, Shadow); bool Constexpr = BaseCtor->isConstexpr() && defaultedSpecialMemberIsConstexpr(*this, Derived, CXXDefaultConstructor, false, BaseCtor, &ICI); CXXConstructorDecl *DerivedCtor = CXXConstructorDecl::Create( Context, Derived, UsingLoc, NameInfo, TInfo->getType(), TInfo, BaseCtor->getExplicitSpecifier(), /*isInline=*/true, /*isImplicitlyDeclared=*/true, Constexpr ? BaseCtor->getConstexprKind() : CSK_unspecified, InheritedConstructor(Shadow, BaseCtor)); if (Shadow->isInvalidDecl()) DerivedCtor->setInvalidDecl(); // Build an unevaluated exception specification for this fake constructor. const FunctionProtoType *FPT = TInfo->getType()->castAs(); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExceptionSpec.Type = EST_Unevaluated; EPI.ExceptionSpec.SourceDecl = DerivedCtor; DerivedCtor->setType(Context.getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI)); // Build the parameter declarations. SmallVector ParamDecls; for (unsigned I = 0, N = FPT->getNumParams(); I != N; ++I) { TypeSourceInfo *TInfo = Context.getTrivialTypeSourceInfo(FPT->getParamType(I), UsingLoc); ParmVarDecl *PD = ParmVarDecl::Create( Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/nullptr, FPT->getParamType(I), TInfo, SC_None, /*DefArg=*/nullptr); PD->setScopeInfo(0, I); PD->setImplicit(); // Ensure attributes are propagated onto parameters (this matters for // format, pass_object_size, ...). mergeDeclAttributes(PD, BaseCtor->getParamDecl(I)); ParamDecls.push_back(PD); ProtoLoc.setParam(I, PD); } // Set up the new constructor. assert(!BaseCtor->isDeleted() && "should not use deleted constructor"); DerivedCtor->setAccess(BaseCtor->getAccess()); DerivedCtor->setParams(ParamDecls); Derived->addDecl(DerivedCtor); if (ShouldDeleteSpecialMember(DerivedCtor, CXXDefaultConstructor, &ICI)) SetDeclDeleted(DerivedCtor, UsingLoc); return DerivedCtor; } void Sema::NoteDeletedInheritingConstructor(CXXConstructorDecl *Ctor) { InheritedConstructorInfo ICI(*this, Ctor->getLocation(), Ctor->getInheritedConstructor().getShadowDecl()); ShouldDeleteSpecialMember(Ctor, CXXDefaultConstructor, &ICI, /*Diagnose*/true); } void Sema::DefineInheritingConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor) { CXXRecordDecl *ClassDecl = Constructor->getParent(); assert(Constructor->getInheritedConstructor() && !Constructor->doesThisDeclarationHaveABody() && !Constructor->isDeleted()); if (Constructor->willHaveBody() || Constructor->isInvalidDecl()) return; // Initializations are performed "as if by a defaulted default constructor", // so enter the appropriate scope. SynthesizedFunctionScope Scope(*this, Constructor); // The exception specification is needed because we are defining the // function. ResolveExceptionSpec(CurrentLocation, Constructor->getType()->castAs()); MarkVTableUsed(CurrentLocation, ClassDecl); // Add a context note for diagnostics produced after this point. Scope.addContextNote(CurrentLocation); ConstructorUsingShadowDecl *Shadow = Constructor->getInheritedConstructor().getShadowDecl(); CXXConstructorDecl *InheritedCtor = Constructor->getInheritedConstructor().getConstructor(); // [class.inhctor.init]p1: // initialization proceeds as if a defaulted default constructor is used to // initialize the D object and each base class subobject from which the // constructor was inherited InheritedConstructorInfo ICI(*this, CurrentLocation, Shadow); CXXRecordDecl *RD = Shadow->getParent(); SourceLocation InitLoc = Shadow->getLocation(); // Build explicit initializers for all base classes from which the // constructor was inherited. SmallVector Inits; for (bool VBase : {false, true}) { for (CXXBaseSpecifier &B : VBase ? RD->vbases() : RD->bases()) { if (B.isVirtual() != VBase) continue; auto *BaseRD = B.getType()->getAsCXXRecordDecl(); if (!BaseRD) continue; auto BaseCtor = ICI.findConstructorForBase(BaseRD, InheritedCtor); if (!BaseCtor.first) continue; MarkFunctionReferenced(CurrentLocation, BaseCtor.first); ExprResult Init = new (Context) CXXInheritedCtorInitExpr( InitLoc, B.getType(), BaseCtor.first, VBase, BaseCtor.second); auto *TInfo = Context.getTrivialTypeSourceInfo(B.getType(), InitLoc); Inits.push_back(new (Context) CXXCtorInitializer( Context, TInfo, VBase, InitLoc, Init.get(), InitLoc, SourceLocation())); } } // We now proceed as if for a defaulted default constructor, with the relevant // initializers replaced. if (SetCtorInitializers(Constructor, /*AnyErrors*/false, Inits)) { Constructor->setInvalidDecl(); return; } Constructor->setBody(new (Context) CompoundStmt(InitLoc)); Constructor->markUsed(Context); if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(Constructor); } DiagnoseUninitializedFields(*this, Constructor); } CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) { // C++ [class.dtor]p2: // If a class has no user-declared destructor, a destructor is // declared implicitly. An implicitly-declared destructor is an // inline public member of its class. assert(ClassDecl->needsImplicitDestructor()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXDestructor); if (DSM.isAlreadyBeingDeclared()) return nullptr; // Create the actual destructor declaration. CanQualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl)); SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationName Name = Context.DeclarationNames.getCXXDestructorName(ClassType); DeclarationNameInfo NameInfo(Name, ClassLoc); CXXDestructorDecl *Destructor = CXXDestructorDecl::Create(Context, ClassDecl, ClassLoc, NameInfo, QualType(), nullptr, /*isInline=*/true, /*isImplicitlyDeclared=*/true); Destructor->setAccess(AS_public); Destructor->setDefaulted(); if (getLangOpts().CUDA) { inferCUDATargetForImplicitSpecialMember(ClassDecl, CXXDestructor, Destructor, /* ConstRHS */ false, /* Diagnose */ false); } setupImplicitSpecialMemberType(Destructor, Context.VoidTy, None); // We don't need to use SpecialMemberIsTrivial here; triviality for // destructors is easy to compute. Destructor->setTrivial(ClassDecl->hasTrivialDestructor()); Destructor->setTrivialForCall(ClassDecl->hasAttr() || ClassDecl->hasTrivialDestructorForCall()); // Note that we have declared this destructor. ++getASTContext().NumImplicitDestructorsDeclared; Scope *S = getScopeForContext(ClassDecl); CheckImplicitSpecialMemberDeclaration(S, Destructor); // We can't check whether an implicit destructor is deleted before we complete // the definition of the class, because its validity depends on the alignment // of the class. We'll check this from ActOnFields once the class is complete. if (ClassDecl->isCompleteDefinition() && ShouldDeleteSpecialMember(Destructor, CXXDestructor)) SetDeclDeleted(Destructor, ClassLoc); // Introduce this destructor into its scope. if (S) PushOnScopeChains(Destructor, S, false); ClassDecl->addDecl(Destructor); return Destructor; } void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor) { assert((Destructor->isDefaulted() && !Destructor->doesThisDeclarationHaveABody() && !Destructor->isDeleted()) && "DefineImplicitDestructor - call it for implicit default dtor"); if (Destructor->willHaveBody() || Destructor->isInvalidDecl()) return; CXXRecordDecl *ClassDecl = Destructor->getParent(); assert(ClassDecl && "DefineImplicitDestructor - invalid destructor"); SynthesizedFunctionScope Scope(*this, Destructor); // The exception specification is needed because we are defining the // function. ResolveExceptionSpec(CurrentLocation, Destructor->getType()->castAs()); MarkVTableUsed(CurrentLocation, ClassDecl); // Add a context note for diagnostics produced after this point. Scope.addContextNote(CurrentLocation); MarkBaseAndMemberDestructorsReferenced(Destructor->getLocation(), Destructor->getParent()); if (CheckDestructor(Destructor)) { Destructor->setInvalidDecl(); return; } SourceLocation Loc = Destructor->getEndLoc().isValid() ? Destructor->getEndLoc() : Destructor->getLocation(); Destructor->setBody(new (Context) CompoundStmt(Loc)); Destructor->markUsed(Context); if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(Destructor); } } /// Perform any semantic analysis which needs to be delayed until all /// pending class member declarations have been parsed. void Sema::ActOnFinishCXXMemberDecls() { // If the context is an invalid C++ class, just suppress these checks. if (CXXRecordDecl *Record = dyn_cast(CurContext)) { if (Record->isInvalidDecl()) { DelayedOverridingExceptionSpecChecks.clear(); DelayedEquivalentExceptionSpecChecks.clear(); return; } checkForMultipleExportedDefaultConstructors(*this, Record); } } void Sema::ActOnFinishCXXNonNestedClass(Decl *D) { referenceDLLExportedClassMethods(); if (!DelayedDllExportMemberFunctions.empty()) { SmallVector WorkList; std::swap(DelayedDllExportMemberFunctions, WorkList); for (CXXMethodDecl *M : WorkList) { DefineImplicitSpecialMember(*this, M, M->getLocation()); // Pass the method to the consumer to get emitted. This is not necessary // for explicit instantiation definitions, as they will get emitted // anyway. if (M->getParent()->getTemplateSpecializationKind() != TSK_ExplicitInstantiationDefinition) ActOnFinishInlineFunctionDef(M); } } } void Sema::referenceDLLExportedClassMethods() { if (!DelayedDllExportClasses.empty()) { // Calling ReferenceDllExportedMembers might cause the current function to // be called again, so use a local copy of DelayedDllExportClasses. SmallVector WorkList; std::swap(DelayedDllExportClasses, WorkList); for (CXXRecordDecl *Class : WorkList) ReferenceDllExportedMembers(*this, Class); } } void Sema::AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor) { assert(getLangOpts().CPlusPlus11 && "adjusting dtor exception specs was introduced in c++11"); if (Destructor->isDependentContext()) return; // C++11 [class.dtor]p3: // A declaration of a destructor that does not have an exception- // specification is implicitly considered to have the same exception- // specification as an implicit declaration. const FunctionProtoType *DtorType = Destructor->getType()-> getAs(); if (DtorType->hasExceptionSpec()) return; // Replace the destructor's type, building off the existing one. Fortunately, // the only thing of interest in the destructor type is its extended info. // The return and arguments are fixed. FunctionProtoType::ExtProtoInfo EPI = DtorType->getExtProtoInfo(); EPI.ExceptionSpec.Type = EST_Unevaluated; EPI.ExceptionSpec.SourceDecl = Destructor; Destructor->setType(Context.getFunctionType(Context.VoidTy, None, EPI)); // FIXME: If the destructor has a body that could throw, and the newly created // spec doesn't allow exceptions, we should emit a warning, because this // change in behavior can break conforming C++03 programs at runtime. // However, we don't have a body or an exception specification yet, so it // needs to be done somewhere else. } namespace { /// An abstract base class for all helper classes used in building the // copy/move operators. These classes serve as factory functions and help us // avoid using the same Expr* in the AST twice. class ExprBuilder { ExprBuilder(const ExprBuilder&) = delete; ExprBuilder &operator=(const ExprBuilder&) = delete; protected: static Expr *assertNotNull(Expr *E) { assert(E && "Expression construction must not fail."); return E; } public: ExprBuilder() {} virtual ~ExprBuilder() {} virtual Expr *build(Sema &S, SourceLocation Loc) const = 0; }; class RefBuilder: public ExprBuilder { VarDecl *Var; QualType VarType; public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull(S.BuildDeclRefExpr(Var, VarType, VK_LValue, Loc)); } RefBuilder(VarDecl *Var, QualType VarType) : Var(Var), VarType(VarType) {} }; class ThisBuilder: public ExprBuilder { public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull(S.ActOnCXXThis(Loc).getAs()); } }; class CastBuilder: public ExprBuilder { const ExprBuilder &Builder; QualType Type; ExprValueKind Kind; const CXXCastPath &Path; public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull(S.ImpCastExprToType(Builder.build(S, Loc), Type, CK_UncheckedDerivedToBase, Kind, &Path).get()); } CastBuilder(const ExprBuilder &Builder, QualType Type, ExprValueKind Kind, const CXXCastPath &Path) : Builder(Builder), Type(Type), Kind(Kind), Path(Path) {} }; class DerefBuilder: public ExprBuilder { const ExprBuilder &Builder; public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull( S.CreateBuiltinUnaryOp(Loc, UO_Deref, Builder.build(S, Loc)).get()); } DerefBuilder(const ExprBuilder &Builder) : Builder(Builder) {} }; class MemberBuilder: public ExprBuilder { const ExprBuilder &Builder; QualType Type; CXXScopeSpec SS; bool IsArrow; LookupResult &MemberLookup; public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull(S.BuildMemberReferenceExpr( Builder.build(S, Loc), Type, Loc, IsArrow, SS, SourceLocation(), nullptr, MemberLookup, nullptr, nullptr).get()); } MemberBuilder(const ExprBuilder &Builder, QualType Type, bool IsArrow, LookupResult &MemberLookup) : Builder(Builder), Type(Type), IsArrow(IsArrow), MemberLookup(MemberLookup) {} }; class MoveCastBuilder: public ExprBuilder { const ExprBuilder &Builder; public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull(CastForMoving(S, Builder.build(S, Loc))); } MoveCastBuilder(const ExprBuilder &Builder) : Builder(Builder) {} }; class LvalueConvBuilder: public ExprBuilder { const ExprBuilder &Builder; public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull( S.DefaultLvalueConversion(Builder.build(S, Loc)).get()); } LvalueConvBuilder(const ExprBuilder &Builder) : Builder(Builder) {} }; class SubscriptBuilder: public ExprBuilder { const ExprBuilder &Base; const ExprBuilder &Index; public: Expr *build(Sema &S, SourceLocation Loc) const override { return assertNotNull(S.CreateBuiltinArraySubscriptExpr( Base.build(S, Loc), Loc, Index.build(S, Loc), Loc).get()); } SubscriptBuilder(const ExprBuilder &Base, const ExprBuilder &Index) : Base(Base), Index(Index) {} }; } // end anonymous namespace /// When generating a defaulted copy or move assignment operator, if a field /// should be copied with __builtin_memcpy rather than via explicit assignments, /// do so. This optimization only applies for arrays of scalars, and for arrays /// of class type where the selected copy/move-assignment operator is trivial. static StmtResult buildMemcpyForAssignmentOp(Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &ToB, const ExprBuilder &FromB) { // Compute the size of the memory buffer to be copied. QualType SizeType = S.Context.getSizeType(); llvm::APInt Size(S.Context.getTypeSize(SizeType), S.Context.getTypeSizeInChars(T).getQuantity()); // Take the address of the field references for "from" and "to". We // directly construct UnaryOperators here because semantic analysis // does not permit us to take the address of an xvalue. Expr *From = FromB.build(S, Loc); From = new (S.Context) UnaryOperator(From, UO_AddrOf, S.Context.getPointerType(From->getType()), VK_RValue, OK_Ordinary, Loc, false); Expr *To = ToB.build(S, Loc); To = new (S.Context) UnaryOperator(To, UO_AddrOf, S.Context.getPointerType(To->getType()), VK_RValue, OK_Ordinary, Loc, false); const Type *E = T->getBaseElementTypeUnsafe(); bool NeedsCollectableMemCpy = E->isRecordType() && E->getAs()->getDecl()->hasObjectMember(); // Create a reference to the __builtin_objc_memmove_collectable function StringRef MemCpyName = NeedsCollectableMemCpy ? "__builtin_objc_memmove_collectable" : "__builtin_memcpy"; LookupResult R(S, &S.Context.Idents.get(MemCpyName), Loc, Sema::LookupOrdinaryName); S.LookupName(R, S.TUScope, true); FunctionDecl *MemCpy = R.getAsSingle(); if (!MemCpy) // Something went horribly wrong earlier, and we will have complained // about it. return StmtError(); ExprResult MemCpyRef = S.BuildDeclRefExpr(MemCpy, S.Context.BuiltinFnTy, VK_RValue, Loc, nullptr); assert(MemCpyRef.isUsable() && "Builtin reference cannot fail"); Expr *CallArgs[] = { To, From, IntegerLiteral::Create(S.Context, Size, SizeType, Loc) }; ExprResult Call = S.BuildCallExpr(/*Scope=*/nullptr, MemCpyRef.get(), Loc, CallArgs, Loc); assert(!Call.isInvalid() && "Call to __builtin_memcpy cannot fail!"); return Call.getAs(); } /// Builds a statement that copies/moves the given entity from \p From to /// \c To. /// /// This routine is used to copy/move the members of a class with an /// implicitly-declared copy/move assignment operator. When the entities being /// copied are arrays, this routine builds for loops to copy them. /// /// \param S The Sema object used for type-checking. /// /// \param Loc The location where the implicit copy/move is being generated. /// /// \param T The type of the expressions being copied/moved. Both expressions /// must have this type. /// /// \param To The expression we are copying/moving to. /// /// \param From The expression we are copying/moving from. /// /// \param CopyingBaseSubobject Whether we're copying/moving a base subobject. /// Otherwise, it's a non-static member subobject. /// /// \param Copying Whether we're copying or moving. /// /// \param Depth Internal parameter recording the depth of the recursion. /// /// \returns A statement or a loop that copies the expressions, or StmtResult(0) /// if a memcpy should be used instead. static StmtResult buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &To, const ExprBuilder &From, bool CopyingBaseSubobject, bool Copying, unsigned Depth = 0) { // C++11 [class.copy]p28: // Each subobject is assigned in the manner appropriate to its type: // // - if the subobject is of class type, as if by a call to operator= with // the subobject as the object expression and the corresponding // subobject of x as a single function argument (as if by explicit // qualification; that is, ignoring any possible virtual overriding // functions in more derived classes); // // C++03 [class.copy]p13: // - if the subobject is of class type, the copy assignment operator for // the class is used (as if by explicit qualification; that is, // ignoring any possible virtual overriding functions in more derived // classes); if (const RecordType *RecordTy = T->getAs()) { CXXRecordDecl *ClassDecl = cast(RecordTy->getDecl()); // Look for operator=. DeclarationName Name = S.Context.DeclarationNames.getCXXOperatorName(OO_Equal); LookupResult OpLookup(S, Name, Loc, Sema::LookupOrdinaryName); S.LookupQualifiedName(OpLookup, ClassDecl, false); // Prior to C++11, filter out any result that isn't a copy/move-assignment // operator. if (!S.getLangOpts().CPlusPlus11) { LookupResult::Filter F = OpLookup.makeFilter(); while (F.hasNext()) { NamedDecl *D = F.next(); if (CXXMethodDecl *Method = dyn_cast(D)) if (Method->isCopyAssignmentOperator() || (!Copying && Method->isMoveAssignmentOperator())) continue; F.erase(); } F.done(); } // Suppress the protected check (C++ [class.protected]) for each of the // assignment operators we found. This strange dance is required when // we're assigning via a base classes's copy-assignment operator. To // ensure that we're getting the right base class subobject (without // ambiguities), we need to cast "this" to that subobject type; to // ensure that we don't go through the virtual call mechanism, we need // to qualify the operator= name with the base class (see below). However, // this means that if the base class has a protected copy assignment // operator, the protected member access check will fail. So, we // rewrite "protected" access to "public" access in this case, since we // know by construction that we're calling from a derived class. if (CopyingBaseSubobject) { for (LookupResult::iterator L = OpLookup.begin(), LEnd = OpLookup.end(); L != LEnd; ++L) { if (L.getAccess() == AS_protected) L.setAccess(AS_public); } } // Create the nested-name-specifier that will be used to qualify the // reference to operator=; this is required to suppress the virtual // call mechanism. CXXScopeSpec SS; const Type *CanonicalT = S.Context.getCanonicalType(T.getTypePtr()); SS.MakeTrivial(S.Context, NestedNameSpecifier::Create(S.Context, nullptr, false, CanonicalT), Loc); // Create the reference to operator=. ExprResult OpEqualRef = S.BuildMemberReferenceExpr(To.build(S, Loc), T, Loc, /*IsArrow=*/false, SS, /*TemplateKWLoc=*/SourceLocation(), /*FirstQualifierInScope=*/nullptr, OpLookup, /*TemplateArgs=*/nullptr, /*S*/nullptr, /*SuppressQualifierCheck=*/true); if (OpEqualRef.isInvalid()) return StmtError(); // Build the call to the assignment operator. Expr *FromInst = From.build(S, Loc); ExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/nullptr, OpEqualRef.getAs(), Loc, FromInst, Loc); if (Call.isInvalid()) return StmtError(); // If we built a call to a trivial 'operator=' while copying an array, // bail out. We'll replace the whole shebang with a memcpy. CXXMemberCallExpr *CE = dyn_cast(Call.get()); if (CE && CE->getMethodDecl()->isTrivial() && Depth) return StmtResult((Stmt*)nullptr); // Convert to an expression-statement, and clean up any produced // temporaries. return S.ActOnExprStmt(Call); } // - if the subobject is of scalar type, the built-in assignment // operator is used. const ConstantArrayType *ArrayTy = S.Context.getAsConstantArrayType(T); if (!ArrayTy) { ExprResult Assignment = S.CreateBuiltinBinOp( Loc, BO_Assign, To.build(S, Loc), From.build(S, Loc)); if (Assignment.isInvalid()) return StmtError(); return S.ActOnExprStmt(Assignment); } // - if the subobject is an array, each element is assigned, in the // manner appropriate to the element type; // Construct a loop over the array bounds, e.g., // // for (__SIZE_TYPE__ i0 = 0; i0 != array-size; ++i0) // // that will copy each of the array elements. QualType SizeType = S.Context.getSizeType(); // Create the iteration variable. IdentifierInfo *IterationVarName = nullptr; { SmallString<8> Str; llvm::raw_svector_ostream OS(Str); OS << "__i" << Depth; IterationVarName = &S.Context.Idents.get(OS.str()); } VarDecl *IterationVar = VarDecl::Create(S.Context, S.CurContext, Loc, Loc, IterationVarName, SizeType, S.Context.getTrivialTypeSourceInfo(SizeType, Loc), SC_None); // Initialize the iteration variable to zero. llvm::APInt Zero(S.Context.getTypeSize(SizeType), 0); IterationVar->setInit(IntegerLiteral::Create(S.Context, Zero, SizeType, Loc)); // Creates a reference to the iteration variable. RefBuilder IterationVarRef(IterationVar, SizeType); LvalueConvBuilder IterationVarRefRVal(IterationVarRef); // Create the DeclStmt that holds the iteration variable. Stmt *InitStmt = new (S.Context) DeclStmt(DeclGroupRef(IterationVar),Loc,Loc); // Subscript the "from" and "to" expressions with the iteration variable. SubscriptBuilder FromIndexCopy(From, IterationVarRefRVal); MoveCastBuilder FromIndexMove(FromIndexCopy); const ExprBuilder *FromIndex; if (Copying) FromIndex = &FromIndexCopy; else FromIndex = &FromIndexMove; SubscriptBuilder ToIndex(To, IterationVarRefRVal); // Build the copy/move for an individual element of the array. StmtResult Copy = buildSingleCopyAssignRecursively(S, Loc, ArrayTy->getElementType(), ToIndex, *FromIndex, CopyingBaseSubobject, Copying, Depth + 1); // Bail out if copying fails or if we determined that we should use memcpy. if (Copy.isInvalid() || !Copy.get()) return Copy; // Create the comparison against the array bound. llvm::APInt Upper = ArrayTy->getSize().zextOrTrunc(S.Context.getTypeSize(SizeType)); Expr *Comparison = new (S.Context) BinaryOperator(IterationVarRefRVal.build(S, Loc), IntegerLiteral::Create(S.Context, Upper, SizeType, Loc), BO_NE, S.Context.BoolTy, VK_RValue, OK_Ordinary, Loc, FPOptions()); // Create the pre-increment of the iteration variable. We can determine // whether the increment will overflow based on the value of the array // bound. Expr *Increment = new (S.Context) UnaryOperator(IterationVarRef.build(S, Loc), UO_PreInc, SizeType, VK_LValue, OK_Ordinary, Loc, Upper.isMaxValue()); // Construct the loop that copies all elements of this array. return S.ActOnForStmt( Loc, Loc, InitStmt, S.ActOnCondition(nullptr, Loc, Comparison, Sema::ConditionKind::Boolean), S.MakeFullDiscardedValueExpr(Increment), Loc, Copy.get()); } static StmtResult buildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &To, const ExprBuilder &From, bool CopyingBaseSubobject, bool Copying) { // Maybe we should use a memcpy? if (T->isArrayType() && !T.isConstQualified() && !T.isVolatileQualified() && T.isTriviallyCopyableType(S.Context)) return buildMemcpyForAssignmentOp(S, Loc, T, To, From); StmtResult Result(buildSingleCopyAssignRecursively(S, Loc, T, To, From, CopyingBaseSubobject, Copying, 0)); // If we ended up picking a trivial assignment operator for an array of a // non-trivially-copyable class type, just emit a memcpy. if (!Result.isInvalid() && !Result.get()) return buildMemcpyForAssignmentOp(S, Loc, T, To, From); return Result; } CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { // Note: The following rules are largely analoguous to the copy // constructor rules. Note that virtual bases are not taken into account // for determining the argument type of the operator. Note also that // operators taking an object instead of a reference are allowed. assert(ClassDecl->needsImplicitCopyAssignment()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXCopyAssignment); if (DSM.isAlreadyBeingDeclared()) return nullptr; QualType ArgType = Context.getTypeDeclType(ClassDecl); if (Context.getLangOpts().OpenCLCPlusPlus) ArgType = Context.getAddrSpaceQualType(ArgType, LangAS::opencl_generic); QualType RetType = Context.getLValueReferenceType(ArgType); bool Const = ClassDecl->implicitCopyAssignmentHasConstParam(); if (Const) ArgType = ArgType.withConst(); ArgType = Context.getLValueReferenceType(ArgType); bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, ClassDecl, CXXCopyAssignment, Const); // An implicitly-declared copy assignment operator is an inline public // member of its class. DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal); SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationNameInfo NameInfo(Name, ClassLoc); CXXMethodDecl *CopyAssignment = CXXMethodDecl::Create( Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/nullptr, /*StorageClass=*/SC_None, /*isInline=*/true, Constexpr ? CSK_constexpr : CSK_unspecified, SourceLocation()); CopyAssignment->setAccess(AS_public); CopyAssignment->setDefaulted(); CopyAssignment->setImplicit(); if (getLangOpts().CUDA) { inferCUDATargetForImplicitSpecialMember(ClassDecl, CXXCopyAssignment, CopyAssignment, /* ConstRHS */ Const, /* Diagnose */ false); } setupImplicitSpecialMemberType(CopyAssignment, RetType, ArgType); // Add the parameter to the operator. ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment, ClassLoc, ClassLoc, /*Id=*/nullptr, ArgType, /*TInfo=*/nullptr, SC_None, nullptr); CopyAssignment->setParams(FromParam); CopyAssignment->setTrivial( ClassDecl->needsOverloadResolutionForCopyAssignment() ? SpecialMemberIsTrivial(CopyAssignment, CXXCopyAssignment) : ClassDecl->hasTrivialCopyAssignment()); // Note that we have added this copy-assignment operator. ++getASTContext().NumImplicitCopyAssignmentOperatorsDeclared; Scope *S = getScopeForContext(ClassDecl); CheckImplicitSpecialMemberDeclaration(S, CopyAssignment); if (ShouldDeleteSpecialMember(CopyAssignment, CXXCopyAssignment)) SetDeclDeleted(CopyAssignment, ClassLoc); if (S) PushOnScopeChains(CopyAssignment, S, false); ClassDecl->addDecl(CopyAssignment); return CopyAssignment; } /// Diagnose an implicit copy operation for a class which is odr-used, but /// which is deprecated because the class has a user-declared copy constructor, /// copy assignment operator, or destructor. static void diagnoseDeprecatedCopyOperation(Sema &S, CXXMethodDecl *CopyOp) { assert(CopyOp->isImplicit()); CXXRecordDecl *RD = CopyOp->getParent(); CXXMethodDecl *UserDeclaredOperation = nullptr; // In Microsoft mode, assignment operations don't affect constructors and // vice versa. if (RD->hasUserDeclaredDestructor()) { UserDeclaredOperation = RD->getDestructor(); } else if (!isa(CopyOp) && RD->hasUserDeclaredCopyConstructor() && !S.getLangOpts().MSVCCompat) { // Find any user-declared copy constructor. for (auto *I : RD->ctors()) { if (I->isCopyConstructor()) { UserDeclaredOperation = I; break; } } assert(UserDeclaredOperation); } else if (isa(CopyOp) && RD->hasUserDeclaredCopyAssignment() && !S.getLangOpts().MSVCCompat) { // Find any user-declared move assignment operator. for (auto *I : RD->methods()) { if (I->isCopyAssignmentOperator()) { UserDeclaredOperation = I; break; } } assert(UserDeclaredOperation); } if (UserDeclaredOperation) { S.Diag(UserDeclaredOperation->getLocation(), diag::warn_deprecated_copy_operation) << RD << /*copy assignment*/!isa(CopyOp) << /*destructor*/isa(UserDeclaredOperation); } } void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *CopyAssignOperator) { assert((CopyAssignOperator->isDefaulted() && CopyAssignOperator->isOverloadedOperator() && CopyAssignOperator->getOverloadedOperator() == OO_Equal && !CopyAssignOperator->doesThisDeclarationHaveABody() && !CopyAssignOperator->isDeleted()) && "DefineImplicitCopyAssignment called for wrong function"); if (CopyAssignOperator->willHaveBody() || CopyAssignOperator->isInvalidDecl()) return; CXXRecordDecl *ClassDecl = CopyAssignOperator->getParent(); if (ClassDecl->isInvalidDecl()) { CopyAssignOperator->setInvalidDecl(); return; } SynthesizedFunctionScope Scope(*this, CopyAssignOperator); // The exception specification is needed because we are defining the // function. ResolveExceptionSpec(CurrentLocation, CopyAssignOperator->getType()->castAs()); // Add a context note for diagnostics produced after this point. Scope.addContextNote(CurrentLocation); // C++11 [class.copy]p18: // The [definition of an implicitly declared copy assignment operator] is // deprecated if the class has a user-declared copy constructor or a // user-declared destructor. if (getLangOpts().CPlusPlus11 && CopyAssignOperator->isImplicit()) diagnoseDeprecatedCopyOperation(*this, CopyAssignOperator); // C++0x [class.copy]p30: // The implicitly-defined or explicitly-defaulted copy assignment operator // for a non-union class X performs memberwise copy assignment of its // subobjects. The direct base classes of X are assigned first, in the // order of their declaration in the base-specifier-list, and then the // immediate non-static data members of X are assigned, in the order in // which they were declared in the class definition. // The statements that form the synthesized function body. SmallVector Statements; // The parameter for the "other" object, which we are copying from. ParmVarDecl *Other = CopyAssignOperator->getParamDecl(0); Qualifiers OtherQuals = Other->getType().getQualifiers(); QualType OtherRefType = Other->getType(); if (const LValueReferenceType *OtherRef = OtherRefType->getAs()) { OtherRefType = OtherRef->getPointeeType(); OtherQuals = OtherRefType.getQualifiers(); } // Our location for everything implicitly-generated. SourceLocation Loc = CopyAssignOperator->getEndLoc().isValid() ? CopyAssignOperator->getEndLoc() : CopyAssignOperator->getLocation(); // Builds a DeclRefExpr for the "other" object. RefBuilder OtherRef(Other, OtherRefType); // Builds the "this" pointer. ThisBuilder This; // Assign base classes. bool Invalid = false; for (auto &Base : ClassDecl->bases()) { // Form the assignment: // static_cast(this)->Base::operator=(static_cast(other)); QualType BaseType = Base.getType().getUnqualifiedType(); if (!BaseType->isRecordType()) { Invalid = true; continue; } CXXCastPath BasePath; BasePath.push_back(&Base); // Construct the "from" expression, which is an implicit cast to the // appropriately-qualified base type. CastBuilder From(OtherRef, Context.getQualifiedType(BaseType, OtherQuals), VK_LValue, BasePath); // Dereference "this". DerefBuilder DerefThis(This); CastBuilder To(DerefThis, Context.getQualifiedType( BaseType, CopyAssignOperator->getMethodQualifiers()), VK_LValue, BasePath); // Build the copy. StmtResult Copy = buildSingleCopyAssign(*this, Loc, BaseType, To, From, /*CopyingBaseSubobject=*/true, /*Copying=*/true); if (Copy.isInvalid()) { CopyAssignOperator->setInvalidDecl(); return; } // Success! Record the copy. Statements.push_back(Copy.getAs()); } // Assign non-static members. for (auto *Field : ClassDecl->fields()) { // FIXME: We should form some kind of AST representation for the implied // memcpy in a union copy operation. if (Field->isUnnamedBitfield() || Field->getParent()->isUnion()) continue; if (Field->isInvalidDecl()) { Invalid = true; continue; } // Check for members of reference type; we can't copy those. if (Field->getType()->isReferenceType()) { Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign) << Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName(); Diag(Field->getLocation(), diag::note_declared_at); Invalid = true; continue; } // Check for members of const-qualified, non-class type. QualType BaseType = Context.getBaseElementType(Field->getType()); if (!BaseType->getAs() && BaseType.isConstQualified()) { Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign) << Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName(); Diag(Field->getLocation(), diag::note_declared_at); Invalid = true; continue; } // Suppress assigning zero-width bitfields. if (Field->isZeroLengthBitField(Context)) continue; QualType FieldType = Field->getType().getNonReferenceType(); if (FieldType->isIncompleteArrayType()) { assert(ClassDecl->hasFlexibleArrayMember() && "Incomplete array type is not valid"); continue; } // Build references to the field in the object we're copying from and to. CXXScopeSpec SS; // Intentionally empty LookupResult MemberLookup(*this, Field->getDeclName(), Loc, LookupMemberName); MemberLookup.addDecl(Field); MemberLookup.resolveKind(); MemberBuilder From(OtherRef, OtherRefType, /*IsArrow=*/false, MemberLookup); MemberBuilder To(This, getCurrentThisType(), /*IsArrow=*/true, MemberLookup); // Build the copy of this field. StmtResult Copy = buildSingleCopyAssign(*this, Loc, FieldType, To, From, /*CopyingBaseSubobject=*/false, /*Copying=*/true); if (Copy.isInvalid()) { CopyAssignOperator->setInvalidDecl(); return; } // Success! Record the copy. Statements.push_back(Copy.getAs()); } if (!Invalid) { // Add a "return *this;" ExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UO_Deref, This.build(*this, Loc)); StmtResult Return = BuildReturnStmt(Loc, ThisObj.get()); if (Return.isInvalid()) Invalid = true; else Statements.push_back(Return.getAs()); } if (Invalid) { CopyAssignOperator->setInvalidDecl(); return; } StmtResult Body; { CompoundScopeRAII CompoundScope(*this); Body = ActOnCompoundStmt(Loc, Loc, Statements, /*isStmtExpr=*/false); assert(!Body.isInvalid() && "Compound statement creation cannot fail"); } CopyAssignOperator->setBody(Body.getAs()); CopyAssignOperator->markUsed(Context); if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(CopyAssignOperator); } } CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) { assert(ClassDecl->needsImplicitMoveAssignment()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXMoveAssignment); if (DSM.isAlreadyBeingDeclared()) return nullptr; // Note: The following rules are largely analoguous to the move // constructor rules. QualType ArgType = Context.getTypeDeclType(ClassDecl); if (Context.getLangOpts().OpenCLCPlusPlus) ArgType = Context.getAddrSpaceQualType(ArgType, LangAS::opencl_generic); QualType RetType = Context.getLValueReferenceType(ArgType); ArgType = Context.getRValueReferenceType(ArgType); bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, ClassDecl, CXXMoveAssignment, false); // An implicitly-declared move assignment operator is an inline public // member of its class. DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal); SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationNameInfo NameInfo(Name, ClassLoc); CXXMethodDecl *MoveAssignment = CXXMethodDecl::Create( Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/nullptr, /*StorageClass=*/SC_None, /*isInline=*/true, Constexpr ? CSK_constexpr : CSK_unspecified, SourceLocation()); MoveAssignment->setAccess(AS_public); MoveAssignment->setDefaulted(); MoveAssignment->setImplicit(); if (getLangOpts().CUDA) { inferCUDATargetForImplicitSpecialMember(ClassDecl, CXXMoveAssignment, MoveAssignment, /* ConstRHS */ false, /* Diagnose */ false); } // Build an exception specification pointing back at this member. FunctionProtoType::ExtProtoInfo EPI = getImplicitMethodEPI(*this, MoveAssignment); MoveAssignment->setType(Context.getFunctionType(RetType, ArgType, EPI)); // Add the parameter to the operator. ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveAssignment, ClassLoc, ClassLoc, /*Id=*/nullptr, ArgType, /*TInfo=*/nullptr, SC_None, nullptr); MoveAssignment->setParams(FromParam); MoveAssignment->setTrivial( ClassDecl->needsOverloadResolutionForMoveAssignment() ? SpecialMemberIsTrivial(MoveAssignment, CXXMoveAssignment) : ClassDecl->hasTrivialMoveAssignment()); // Note that we have added this copy-assignment operator. ++getASTContext().NumImplicitMoveAssignmentOperatorsDeclared; Scope *S = getScopeForContext(ClassDecl); CheckImplicitSpecialMemberDeclaration(S, MoveAssignment); if (ShouldDeleteSpecialMember(MoveAssignment, CXXMoveAssignment)) { ClassDecl->setImplicitMoveAssignmentIsDeleted(); SetDeclDeleted(MoveAssignment, ClassLoc); } if (S) PushOnScopeChains(MoveAssignment, S, false); ClassDecl->addDecl(MoveAssignment); return MoveAssignment; } /// Check if we're implicitly defining a move assignment operator for a class /// with virtual bases. Such a move assignment might move-assign the virtual /// base multiple times. static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class, SourceLocation CurrentLocation) { assert(!Class->isDependentContext() && "should not define dependent move"); // Only a virtual base could get implicitly move-assigned multiple times. // Only a non-trivial move assignment can observe this. We only want to // diagnose if we implicitly define an assignment operator that assigns // two base classes, both of which move-assign the same virtual base. if (Class->getNumVBases() == 0 || Class->hasTrivialMoveAssignment() || Class->getNumBases() < 2) return; llvm::SmallVector Worklist; typedef llvm::DenseMap VBaseMap; VBaseMap VBases; for (auto &BI : Class->bases()) { Worklist.push_back(&BI); while (!Worklist.empty()) { CXXBaseSpecifier *BaseSpec = Worklist.pop_back_val(); CXXRecordDecl *Base = BaseSpec->getType()->getAsCXXRecordDecl(); // If the base has no non-trivial move assignment operators, // we don't care about moves from it. if (!Base->hasNonTrivialMoveAssignment()) continue; // If there's nothing virtual here, skip it. if (!BaseSpec->isVirtual() && !Base->getNumVBases()) continue; // If we're not actually going to call a move assignment for this base, // or the selected move assignment is trivial, skip it. Sema::SpecialMemberOverloadResult SMOR = S.LookupSpecialMember(Base, Sema::CXXMoveAssignment, /*ConstArg*/false, /*VolatileArg*/false, /*RValueThis*/true, /*ConstThis*/false, /*VolatileThis*/false); if (!SMOR.getMethod() || SMOR.getMethod()->isTrivial() || !SMOR.getMethod()->isMoveAssignmentOperator()) continue; if (BaseSpec->isVirtual()) { // We're going to move-assign this virtual base, and its move // assignment operator is not trivial. If this can happen for // multiple distinct direct bases of Class, diagnose it. (If it // only happens in one base, we'll diagnose it when synthesizing // that base class's move assignment operator.) CXXBaseSpecifier *&Existing = VBases.insert(std::make_pair(Base->getCanonicalDecl(), &BI)) .first->second; if (Existing && Existing != &BI) { S.Diag(CurrentLocation, diag::warn_vbase_moved_multiple_times) << Class << Base; S.Diag(Existing->getBeginLoc(), diag::note_vbase_moved_here) << (Base->getCanonicalDecl() == Existing->getType()->getAsCXXRecordDecl()->getCanonicalDecl()) << Base << Existing->getType() << Existing->getSourceRange(); S.Diag(BI.getBeginLoc(), diag::note_vbase_moved_here) << (Base->getCanonicalDecl() == BI.getType()->getAsCXXRecordDecl()->getCanonicalDecl()) << Base << BI.getType() << BaseSpec->getSourceRange(); // Only diagnose each vbase once. Existing = nullptr; } } else { // Only walk over bases that have defaulted move assignment operators. // We assume that any user-provided move assignment operator handles // the multiple-moves-of-vbase case itself somehow. if (!SMOR.getMethod()->isDefaulted()) continue; // We're going to move the base classes of Base. Add them to the list. for (auto &BI : Base->bases()) Worklist.push_back(&BI); } } } } void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MoveAssignOperator) { assert((MoveAssignOperator->isDefaulted() && MoveAssignOperator->isOverloadedOperator() && MoveAssignOperator->getOverloadedOperator() == OO_Equal && !MoveAssignOperator->doesThisDeclarationHaveABody() && !MoveAssignOperator->isDeleted()) && "DefineImplicitMoveAssignment called for wrong function"); if (MoveAssignOperator->willHaveBody() || MoveAssignOperator->isInvalidDecl()) return; CXXRecordDecl *ClassDecl = MoveAssignOperator->getParent(); if (ClassDecl->isInvalidDecl()) { MoveAssignOperator->setInvalidDecl(); return; } // C++0x [class.copy]p28: // The implicitly-defined or move assignment operator for a non-union class // X performs memberwise move assignment of its subobjects. The direct base // classes of X are assigned first, in the order of their declaration in the // base-specifier-list, and then the immediate non-static data members of X // are assigned, in the order in which they were declared in the class // definition. // Issue a warning if our implicit move assignment operator will move // from a virtual base more than once. checkMoveAssignmentForRepeatedMove(*this, ClassDecl, CurrentLocation); SynthesizedFunctionScope Scope(*this, MoveAssignOperator); // The exception specification is needed because we are defining the // function. ResolveExceptionSpec(CurrentLocation, MoveAssignOperator->getType()->castAs()); // Add a context note for diagnostics produced after this point. Scope.addContextNote(CurrentLocation); // The statements that form the synthesized function body. SmallVector Statements; // The parameter for the "other" object, which we are move from. ParmVarDecl *Other = MoveAssignOperator->getParamDecl(0); QualType OtherRefType = Other->getType()-> getAs()->getPointeeType(); // Our location for everything implicitly-generated. SourceLocation Loc = MoveAssignOperator->getEndLoc().isValid() ? MoveAssignOperator->getEndLoc() : MoveAssignOperator->getLocation(); // Builds a reference to the "other" object. RefBuilder OtherRef(Other, OtherRefType); // Cast to rvalue. MoveCastBuilder MoveOther(OtherRef); // Builds the "this" pointer. ThisBuilder This; // Assign base classes. bool Invalid = false; for (auto &Base : ClassDecl->bases()) { // C++11 [class.copy]p28: // It is unspecified whether subobjects representing virtual base classes // are assigned more than once by the implicitly-defined copy assignment // operator. // FIXME: Do not assign to a vbase that will be assigned by some other base // class. For a move-assignment, this can result in the vbase being moved // multiple times. // Form the assignment: // static_cast(this)->Base::operator=(static_cast(other)); QualType BaseType = Base.getType().getUnqualifiedType(); if (!BaseType->isRecordType()) { Invalid = true; continue; } CXXCastPath BasePath; BasePath.push_back(&Base); // Construct the "from" expression, which is an implicit cast to the // appropriately-qualified base type. CastBuilder From(OtherRef, BaseType, VK_XValue, BasePath); // Dereference "this". DerefBuilder DerefThis(This); // Implicitly cast "this" to the appropriately-qualified base type. CastBuilder To(DerefThis, Context.getQualifiedType( BaseType, MoveAssignOperator->getMethodQualifiers()), VK_LValue, BasePath); // Build the move. StmtResult Move = buildSingleCopyAssign(*this, Loc, BaseType, To, From, /*CopyingBaseSubobject=*/true, /*Copying=*/false); if (Move.isInvalid()) { MoveAssignOperator->setInvalidDecl(); return; } // Success! Record the move. Statements.push_back(Move.getAs()); } // Assign non-static members. for (auto *Field : ClassDecl->fields()) { // FIXME: We should form some kind of AST representation for the implied // memcpy in a union copy operation. if (Field->isUnnamedBitfield() || Field->getParent()->isUnion()) continue; if (Field->isInvalidDecl()) { Invalid = true; continue; } // Check for members of reference type; we can't move those. if (Field->getType()->isReferenceType()) { Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign) << Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName(); Diag(Field->getLocation(), diag::note_declared_at); Invalid = true; continue; } // Check for members of const-qualified, non-class type. QualType BaseType = Context.getBaseElementType(Field->getType()); if (!BaseType->getAs() && BaseType.isConstQualified()) { Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign) << Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName(); Diag(Field->getLocation(), diag::note_declared_at); Invalid = true; continue; } // Suppress assigning zero-width bitfields. if (Field->isZeroLengthBitField(Context)) continue; QualType FieldType = Field->getType().getNonReferenceType(); if (FieldType->isIncompleteArrayType()) { assert(ClassDecl->hasFlexibleArrayMember() && "Incomplete array type is not valid"); continue; } // Build references to the field in the object we're copying from and to. LookupResult MemberLookup(*this, Field->getDeclName(), Loc, LookupMemberName); MemberLookup.addDecl(Field); MemberLookup.resolveKind(); MemberBuilder From(MoveOther, OtherRefType, /*IsArrow=*/false, MemberLookup); MemberBuilder To(This, getCurrentThisType(), /*IsArrow=*/true, MemberLookup); assert(!From.build(*this, Loc)->isLValue() && // could be xvalue or prvalue "Member reference with rvalue base must be rvalue except for reference " "members, which aren't allowed for move assignment."); // Build the move of this field. StmtResult Move = buildSingleCopyAssign(*this, Loc, FieldType, To, From, /*CopyingBaseSubobject=*/false, /*Copying=*/false); if (Move.isInvalid()) { MoveAssignOperator->setInvalidDecl(); return; } // Success! Record the copy. Statements.push_back(Move.getAs()); } if (!Invalid) { // Add a "return *this;" ExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UO_Deref, This.build(*this, Loc)); StmtResult Return = BuildReturnStmt(Loc, ThisObj.get()); if (Return.isInvalid()) Invalid = true; else Statements.push_back(Return.getAs()); } if (Invalid) { MoveAssignOperator->setInvalidDecl(); return; } StmtResult Body; { CompoundScopeRAII CompoundScope(*this); Body = ActOnCompoundStmt(Loc, Loc, Statements, /*isStmtExpr=*/false); assert(!Body.isInvalid() && "Compound statement creation cannot fail"); } MoveAssignOperator->setBody(Body.getAs()); MoveAssignOperator->markUsed(Context); if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(MoveAssignOperator); } } CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( CXXRecordDecl *ClassDecl) { // C++ [class.copy]p4: // If the class definition does not explicitly declare a copy // constructor, one is declared implicitly. assert(ClassDecl->needsImplicitCopyConstructor()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXCopyConstructor); if (DSM.isAlreadyBeingDeclared()) return nullptr; QualType ClassType = Context.getTypeDeclType(ClassDecl); QualType ArgType = ClassType; bool Const = ClassDecl->implicitCopyConstructorHasConstParam(); if (Const) ArgType = ArgType.withConst(); if (Context.getLangOpts().OpenCLCPlusPlus) ArgType = Context.getAddrSpaceQualType(ArgType, LangAS::opencl_generic); ArgType = Context.getLValueReferenceType(ArgType); bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, ClassDecl, CXXCopyConstructor, Const); DeclarationName Name = Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(ClassType)); SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationNameInfo NameInfo(Name, ClassLoc); // An implicitly-declared copy constructor is an inline public // member of its class. CXXConstructorDecl *CopyConstructor = CXXConstructorDecl::Create( Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/nullptr, ExplicitSpecifier(), /*isInline=*/true, /*isImplicitlyDeclared=*/true, Constexpr ? CSK_constexpr : CSK_unspecified); CopyConstructor->setAccess(AS_public); CopyConstructor->setDefaulted(); if (getLangOpts().CUDA) { inferCUDATargetForImplicitSpecialMember(ClassDecl, CXXCopyConstructor, CopyConstructor, /* ConstRHS */ Const, /* Diagnose */ false); } setupImplicitSpecialMemberType(CopyConstructor, Context.VoidTy, ArgType); // Add the parameter to the constructor. ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor, ClassLoc, ClassLoc, /*IdentifierInfo=*/nullptr, ArgType, /*TInfo=*/nullptr, SC_None, nullptr); CopyConstructor->setParams(FromParam); CopyConstructor->setTrivial( ClassDecl->needsOverloadResolutionForCopyConstructor() ? SpecialMemberIsTrivial(CopyConstructor, CXXCopyConstructor) : ClassDecl->hasTrivialCopyConstructor()); CopyConstructor->setTrivialForCall( ClassDecl->hasAttr() || (ClassDecl->needsOverloadResolutionForCopyConstructor() ? SpecialMemberIsTrivial(CopyConstructor, CXXCopyConstructor, TAH_ConsiderTrivialABI) : ClassDecl->hasTrivialCopyConstructorForCall())); // Note that we have declared this constructor. ++getASTContext().NumImplicitCopyConstructorsDeclared; Scope *S = getScopeForContext(ClassDecl); CheckImplicitSpecialMemberDeclaration(S, CopyConstructor); if (ShouldDeleteSpecialMember(CopyConstructor, CXXCopyConstructor)) { ClassDecl->setImplicitCopyConstructorIsDeleted(); SetDeclDeleted(CopyConstructor, ClassLoc); } if (S) PushOnScopeChains(CopyConstructor, S, false); ClassDecl->addDecl(CopyConstructor); return CopyConstructor; } void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *CopyConstructor) { assert((CopyConstructor->isDefaulted() && CopyConstructor->isCopyConstructor() && !CopyConstructor->doesThisDeclarationHaveABody() && !CopyConstructor->isDeleted()) && "DefineImplicitCopyConstructor - call it for implicit copy ctor"); if (CopyConstructor->willHaveBody() || CopyConstructor->isInvalidDecl()) return; CXXRecordDecl *ClassDecl = CopyConstructor->getParent(); assert(ClassDecl && "DefineImplicitCopyConstructor - invalid constructor"); SynthesizedFunctionScope Scope(*this, CopyConstructor); // The exception specification is needed because we are defining the // function. ResolveExceptionSpec(CurrentLocation, CopyConstructor->getType()->castAs()); MarkVTableUsed(CurrentLocation, ClassDecl); // Add a context note for diagnostics produced after this point. Scope.addContextNote(CurrentLocation); // C++11 [class.copy]p7: // The [definition of an implicitly declared copy constructor] is // deprecated if the class has a user-declared copy assignment operator // or a user-declared destructor. if (getLangOpts().CPlusPlus11 && CopyConstructor->isImplicit()) diagnoseDeprecatedCopyOperation(*this, CopyConstructor); if (SetCtorInitializers(CopyConstructor, /*AnyErrors=*/false)) { CopyConstructor->setInvalidDecl(); } else { SourceLocation Loc = CopyConstructor->getEndLoc().isValid() ? CopyConstructor->getEndLoc() : CopyConstructor->getLocation(); Sema::CompoundScopeRAII CompoundScope(*this); CopyConstructor->setBody( ActOnCompoundStmt(Loc, Loc, None, /*isStmtExpr=*/false).getAs()); CopyConstructor->markUsed(Context); } if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(CopyConstructor); } } CXXConstructorDecl *Sema::DeclareImplicitMoveConstructor( CXXRecordDecl *ClassDecl) { assert(ClassDecl->needsImplicitMoveConstructor()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXMoveConstructor); if (DSM.isAlreadyBeingDeclared()) return nullptr; QualType ClassType = Context.getTypeDeclType(ClassDecl); QualType ArgType = ClassType; if (Context.getLangOpts().OpenCLCPlusPlus) ArgType = Context.getAddrSpaceQualType(ClassType, LangAS::opencl_generic); ArgType = Context.getRValueReferenceType(ArgType); bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, ClassDecl, CXXMoveConstructor, false); DeclarationName Name = Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(ClassType)); SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationNameInfo NameInfo(Name, ClassLoc); // C++11 [class.copy]p11: // An implicitly-declared copy/move constructor is an inline public // member of its class. CXXConstructorDecl *MoveConstructor = CXXConstructorDecl::Create( Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/nullptr, ExplicitSpecifier(), /*isInline=*/true, /*isImplicitlyDeclared=*/true, Constexpr ? CSK_constexpr : CSK_unspecified); MoveConstructor->setAccess(AS_public); MoveConstructor->setDefaulted(); if (getLangOpts().CUDA) { inferCUDATargetForImplicitSpecialMember(ClassDecl, CXXMoveConstructor, MoveConstructor, /* ConstRHS */ false, /* Diagnose */ false); } setupImplicitSpecialMemberType(MoveConstructor, Context.VoidTy, ArgType); // Add the parameter to the constructor. ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveConstructor, ClassLoc, ClassLoc, /*IdentifierInfo=*/nullptr, ArgType, /*TInfo=*/nullptr, SC_None, nullptr); MoveConstructor->setParams(FromParam); MoveConstructor->setTrivial( ClassDecl->needsOverloadResolutionForMoveConstructor() ? SpecialMemberIsTrivial(MoveConstructor, CXXMoveConstructor) : ClassDecl->hasTrivialMoveConstructor()); MoveConstructor->setTrivialForCall( ClassDecl->hasAttr() || (ClassDecl->needsOverloadResolutionForMoveConstructor() ? SpecialMemberIsTrivial(MoveConstructor, CXXMoveConstructor, TAH_ConsiderTrivialABI) : ClassDecl->hasTrivialMoveConstructorForCall())); // Note that we have declared this constructor. ++getASTContext().NumImplicitMoveConstructorsDeclared; Scope *S = getScopeForContext(ClassDecl); CheckImplicitSpecialMemberDeclaration(S, MoveConstructor); if (ShouldDeleteSpecialMember(MoveConstructor, CXXMoveConstructor)) { ClassDecl->setImplicitMoveConstructorIsDeleted(); SetDeclDeleted(MoveConstructor, ClassLoc); } if (S) PushOnScopeChains(MoveConstructor, S, false); ClassDecl->addDecl(MoveConstructor); return MoveConstructor; } void Sema::DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *MoveConstructor) { assert((MoveConstructor->isDefaulted() && MoveConstructor->isMoveConstructor() && !MoveConstructor->doesThisDeclarationHaveABody() && !MoveConstructor->isDeleted()) && "DefineImplicitMoveConstructor - call it for implicit move ctor"); if (MoveConstructor->willHaveBody() || MoveConstructor->isInvalidDecl()) return; CXXRecordDecl *ClassDecl = MoveConstructor->getParent(); assert(ClassDecl && "DefineImplicitMoveConstructor - invalid constructor"); SynthesizedFunctionScope Scope(*this, MoveConstructor); // The exception specification is needed because we are defining the // function. ResolveExceptionSpec(CurrentLocation, MoveConstructor->getType()->castAs()); MarkVTableUsed(CurrentLocation, ClassDecl); // Add a context note for diagnostics produced after this point. Scope.addContextNote(CurrentLocation); if (SetCtorInitializers(MoveConstructor, /*AnyErrors=*/false)) { MoveConstructor->setInvalidDecl(); } else { SourceLocation Loc = MoveConstructor->getEndLoc().isValid() ? MoveConstructor->getEndLoc() : MoveConstructor->getLocation(); Sema::CompoundScopeRAII CompoundScope(*this); MoveConstructor->setBody(ActOnCompoundStmt( Loc, Loc, None, /*isStmtExpr=*/ false).getAs()); MoveConstructor->markUsed(Context); } if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(MoveConstructor); } } bool Sema::isImplicitlyDeleted(FunctionDecl *FD) { return FD->isDeleted() && FD->isDefaulted() && isa(FD); } void Sema::DefineImplicitLambdaToFunctionPointerConversion( SourceLocation CurrentLocation, CXXConversionDecl *Conv) { SynthesizedFunctionScope Scope(*this, Conv); assert(!Conv->getReturnType()->isUndeducedType()); CXXRecordDecl *Lambda = Conv->getParent(); FunctionDecl *CallOp = Lambda->getLambdaCallOperator(); FunctionDecl *Invoker = Lambda->getLambdaStaticInvoker(); if (auto *TemplateArgs = Conv->getTemplateSpecializationArgs()) { CallOp = InstantiateFunctionDeclaration( CallOp->getDescribedFunctionTemplate(), TemplateArgs, CurrentLocation); if (!CallOp) return; Invoker = InstantiateFunctionDeclaration( Invoker->getDescribedFunctionTemplate(), TemplateArgs, CurrentLocation); if (!Invoker) return; } if (CallOp->isInvalidDecl()) return; // Mark the call operator referenced (and add to pending instantiations // if necessary). // For both the conversion and static-invoker template specializations // we construct their body's in this function, so no need to add them // to the PendingInstantiations. MarkFunctionReferenced(CurrentLocation, CallOp); // Fill in the __invoke function with a dummy implementation. IR generation // will fill in the actual details. Update its type in case it contained // an 'auto'. Invoker->markUsed(Context); Invoker->setReferenced(); Invoker->setType(Conv->getReturnType()->getPointeeType()); Invoker->setBody(new (Context) CompoundStmt(Conv->getLocation())); // Construct the body of the conversion function { return __invoke; }. Expr *FunctionRef = BuildDeclRefExpr(Invoker, Invoker->getType(), VK_LValue, Conv->getLocation()); assert(FunctionRef && "Can't refer to __invoke function?"); Stmt *Return = BuildReturnStmt(Conv->getLocation(), FunctionRef).get(); Conv->setBody(CompoundStmt::Create(Context, Return, Conv->getLocation(), Conv->getLocation())); Conv->markUsed(Context); Conv->setReferenced(); if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(Conv); L->CompletedImplicitDefinition(Invoker); } } void Sema::DefineImplicitLambdaToBlockPointerConversion( SourceLocation CurrentLocation, CXXConversionDecl *Conv) { assert(!Conv->getParent()->isGenericLambda()); SynthesizedFunctionScope Scope(*this, Conv); // Copy-initialize the lambda object as needed to capture it. Expr *This = ActOnCXXThis(CurrentLocation).get(); Expr *DerefThis =CreateBuiltinUnaryOp(CurrentLocation, UO_Deref, This).get(); ExprResult BuildBlock = BuildBlockForLambdaConversion(CurrentLocation, Conv->getLocation(), Conv, DerefThis); // If we're not under ARC, make sure we still get the _Block_copy/autorelease // behavior. Note that only the general conversion function does this // (since it's unusable otherwise); in the case where we inline the // block literal, it has block literal lifetime semantics. if (!BuildBlock.isInvalid() && !getLangOpts().ObjCAutoRefCount) BuildBlock = ImplicitCastExpr::Create(Context, BuildBlock.get()->getType(), CK_CopyAndAutoreleaseBlockObject, BuildBlock.get(), nullptr, VK_RValue); if (BuildBlock.isInvalid()) { Diag(CurrentLocation, diag::note_lambda_to_block_conv); Conv->setInvalidDecl(); return; } // Create the return statement that returns the block from the conversion // function. StmtResult Return = BuildReturnStmt(Conv->getLocation(), BuildBlock.get()); if (Return.isInvalid()) { Diag(CurrentLocation, diag::note_lambda_to_block_conv); Conv->setInvalidDecl(); return; } // Set the body of the conversion function. Stmt *ReturnS = Return.get(); Conv->setBody(CompoundStmt::Create(Context, ReturnS, Conv->getLocation(), Conv->getLocation())); Conv->markUsed(Context); // We're done; notify the mutation listener, if any. if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(Conv); } } /// Determine whether the given list arguments contains exactly one /// "real" (non-default) argument. static bool hasOneRealArgument(MultiExprArg Args) { switch (Args.size()) { case 0: return false; default: if (!Args[1]->isDefaultArgument()) return false; LLVM_FALLTHROUGH; case 1: return !Args[0]->isDefaultArgument(); } return false; } ExprResult Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg ExprArgs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange) { bool Elidable = false; // C++0x [class.copy]p34: // When certain criteria are met, an implementation is allowed to // omit the copy/move construction of a class object, even if the // copy/move constructor and/or destructor for the object have // side effects. [...] // - when a temporary class object that has not been bound to a // reference (12.2) would be copied/moved to a class object // with the same cv-unqualified type, the copy/move operation // can be omitted by constructing the temporary object // directly into the target of the omitted copy/move if (ConstructKind == CXXConstructExpr::CK_Complete && Constructor && Constructor->isCopyOrMoveConstructor() && hasOneRealArgument(ExprArgs)) { Expr *SubExpr = ExprArgs[0]; Elidable = SubExpr->isTemporaryObject( Context, cast(FoundDecl->getDeclContext())); } return BuildCXXConstructExpr(ConstructLoc, DeclInitType, FoundDecl, Constructor, Elidable, ExprArgs, HadMultipleCandidates, IsListInitialization, IsStdInitListInitialization, RequiresZeroInit, ConstructKind, ParenRange); } ExprResult Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg ExprArgs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange) { if (auto *Shadow = dyn_cast(FoundDecl)) { Constructor = findInheritingConstructor(ConstructLoc, Constructor, Shadow); if (DiagnoseUseOfDecl(Constructor, ConstructLoc)) return ExprError(); } return BuildCXXConstructExpr( ConstructLoc, DeclInitType, Constructor, Elidable, ExprArgs, HadMultipleCandidates, IsListInitialization, IsStdInitListInitialization, RequiresZeroInit, ConstructKind, ParenRange); } /// BuildCXXConstructExpr - Creates a complete call to a constructor, /// including handling of its default argument expressions. ExprResult Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg ExprArgs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange) { assert(declaresSameEntity( Constructor->getParent(), DeclInitType->getBaseElementTypeUnsafe()->getAsCXXRecordDecl()) && "given constructor for wrong type"); MarkFunctionReferenced(ConstructLoc, Constructor); if (getLangOpts().CUDA && !CheckCUDACall(ConstructLoc, Constructor)) return ExprError(); return CXXConstructExpr::Create( Context, DeclInitType, ConstructLoc, Constructor, Elidable, ExprArgs, HadMultipleCandidates, IsListInitialization, IsStdInitListInitialization, RequiresZeroInit, static_cast(ConstructKind), ParenRange); } ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { assert(Field->hasInClassInitializer()); // If we already have the in-class initializer nothing needs to be done. if (Field->getInClassInitializer()) return CXXDefaultInitExpr::Create(Context, Loc, Field, CurContext); // If we might have already tried and failed to instantiate, don't try again. if (Field->isInvalidDecl()) return ExprError(); // Maybe we haven't instantiated the in-class initializer. Go check the // pattern FieldDecl to see if it has one. CXXRecordDecl *ParentRD = cast(Field->getParent()); if (isTemplateInstantiation(ParentRD->getTemplateSpecializationKind())) { CXXRecordDecl *ClassPattern = ParentRD->getTemplateInstantiationPattern(); DeclContext::lookup_result Lookup = ClassPattern->lookup(Field->getDeclName()); // Lookup can return at most two results: the pattern for the field, or the // injected class name of the parent record. No other member can have the // same name as the field. // In modules mode, lookup can return multiple results (coming from // different modules). assert((getLangOpts().Modules || (!Lookup.empty() && Lookup.size() <= 2)) && "more than two lookup results for field name"); FieldDecl *Pattern = dyn_cast(Lookup[0]); if (!Pattern) { assert(isa(Lookup[0]) && "cannot have other non-field member with same name"); for (auto L : Lookup) if (isa(L)) { Pattern = cast(L); break; } assert(Pattern && "We must have set the Pattern!"); } if (!Pattern->hasInClassInitializer() || InstantiateInClassInitializer(Loc, Field, Pattern, getTemplateInstantiationArgs(Field))) { // Don't diagnose this again. Field->setInvalidDecl(); return ExprError(); } return CXXDefaultInitExpr::Create(Context, Loc, Field, CurContext); } // DR1351: // If the brace-or-equal-initializer of a non-static data member // invokes a defaulted default constructor of its class or of an // enclosing class in a potentially evaluated subexpression, the // program is ill-formed. // // This resolution is unworkable: the exception specification of the // default constructor can be needed in an unevaluated context, in // particular, in the operand of a noexcept-expression, and we can be // unable to compute an exception specification for an enclosed class. // // Any attempt to resolve the exception specification of a defaulted default // constructor before the initializer is lexically complete will ultimately // come here at which point we can diagnose it. RecordDecl *OutermostClass = ParentRD->getOuterLexicalRecordContext(); Diag(Loc, diag::err_in_class_initializer_not_yet_parsed) << OutermostClass << Field; Diag(Field->getEndLoc(), diag::note_in_class_initializer_not_yet_parsed); // Recover by marking the field invalid, unless we're in a SFINAE context. if (!isSFINAEContext()) Field->setInvalidDecl(); return ExprError(); } void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) { if (VD->isInvalidDecl()) return; CXXRecordDecl *ClassDecl = cast(Record->getDecl()); if (ClassDecl->isInvalidDecl()) return; if (ClassDecl->hasIrrelevantDestructor()) return; if (ClassDecl->isDependentContext()) return; if (VD->isNoDestroy(getASTContext())) return; CXXDestructorDecl *Destructor = LookupDestructor(ClassDecl); // If this is an array, we'll require the destructor during initialization, so // we can skip over this. We still want to emit exit-time destructor warnings // though. if (!VD->getType()->isArrayType()) { MarkFunctionReferenced(VD->getLocation(), Destructor); CheckDestructorAccess(VD->getLocation(), Destructor, PDiag(diag::err_access_dtor_var) << VD->getDeclName() << VD->getType()); DiagnoseUseOfDecl(Destructor, VD->getLocation()); } if (Destructor->isTrivial()) return; if (!VD->hasGlobalStorage()) return; // Emit warning for non-trivial dtor in global scope (a real global, // class-static, function-static). Diag(VD->getLocation(), diag::warn_exit_time_destructor); // TODO: this should be re-enabled for static locals by !CXAAtExit if (!VD->isStaticLocal()) Diag(VD->getLocation(), diag::warn_global_destructor); } /// Given a constructor and the set of arguments provided for the /// constructor, convert the arguments and add any required default arguments /// to form a proper call to this constructor. /// /// \returns true if an error occurred, false otherwise. bool Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl &ConvertedArgs, bool AllowExplicit, bool IsListInitialization) { // FIXME: This duplicates a lot of code from Sema::ConvertArgumentsForCall. unsigned NumArgs = ArgsPtr.size(); Expr **Args = ArgsPtr.data(); const FunctionProtoType *Proto = Constructor->getType()->getAs(); assert(Proto && "Constructor without a prototype?"); unsigned NumParams = Proto->getNumParams(); // If too few arguments are available, we'll fill in the rest with defaults. if (NumArgs < NumParams) ConvertedArgs.reserve(NumParams); else ConvertedArgs.reserve(NumArgs); VariadicCallType CallType = Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply; SmallVector AllArgs; bool Invalid = GatherArgumentsForCall(Loc, Constructor, Proto, 0, llvm::makeArrayRef(Args, NumArgs), AllArgs, CallType, AllowExplicit, IsListInitialization); ConvertedArgs.append(AllArgs.begin(), AllArgs.end()); DiagnoseSentinelCalls(Constructor, Loc, AllArgs); CheckConstructorCall(Constructor, llvm::makeArrayRef(AllArgs.data(), AllArgs.size()), Proto, Loc); return Invalid; } static inline bool CheckOperatorNewDeleteDeclarationScope(Sema &SemaRef, const FunctionDecl *FnDecl) { const DeclContext *DC = FnDecl->getDeclContext()->getRedeclContext(); if (isa(DC)) { return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_delete_declared_in_namespace) << FnDecl->getDeclName(); } if (isa(DC) && FnDecl->getStorageClass() == SC_Static) { return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_delete_declared_static) << FnDecl->getDeclName(); } return false; } static QualType RemoveAddressSpaceFromPtr(Sema &SemaRef, const PointerType *PtrTy) { QualType QTy = PtrTy->getPointeeType(); QTy = SemaRef.Context.removeAddrSpaceQualType(QTy); return SemaRef.Context.getPointerType(QTy); } static inline bool CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl, CanQualType ExpectedResultType, CanQualType ExpectedFirstParamType, unsigned DependentParamTypeDiag, unsigned InvalidParamTypeDiag) { QualType ResultType = FnDecl->getType()->getAs()->getReturnType(); // Check that the result type is not dependent. if (ResultType->isDependentType()) return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_delete_dependent_result_type) << FnDecl->getDeclName() << ExpectedResultType; // The operator is valid on any address space for OpenCL. if (SemaRef.getLangOpts().OpenCLCPlusPlus) { if (auto *PtrTy = ResultType->getAs()) { ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy); } } // Check that the result type is what we expect. if (SemaRef.Context.getCanonicalType(ResultType) != ExpectedResultType) return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_delete_invalid_result_type) << FnDecl->getDeclName() << ExpectedResultType; // A function template must have at least 2 parameters. if (FnDecl->getDescribedFunctionTemplate() && FnDecl->getNumParams() < 2) return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_delete_template_too_few_parameters) << FnDecl->getDeclName(); // The function decl must have at least 1 parameter. if (FnDecl->getNumParams() == 0) return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_delete_too_few_parameters) << FnDecl->getDeclName(); // Check the first parameter type is not dependent. QualType FirstParamType = FnDecl->getParamDecl(0)->getType(); if (FirstParamType->isDependentType()) return SemaRef.Diag(FnDecl->getLocation(), DependentParamTypeDiag) << FnDecl->getDeclName() << ExpectedFirstParamType; // Check that the first parameter type is what we expect. if (SemaRef.getLangOpts().OpenCLCPlusPlus) { // The operator is valid on any address space for OpenCL. if (auto *PtrTy = FnDecl->getParamDecl(0)->getType()->getAs()) { FirstParamType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy); } } if (SemaRef.Context.getCanonicalType(FirstParamType).getUnqualifiedType() != ExpectedFirstParamType) return SemaRef.Diag(FnDecl->getLocation(), InvalidParamTypeDiag) << FnDecl->getDeclName() << ExpectedFirstParamType; return false; } static bool CheckOperatorNewDeclaration(Sema &SemaRef, const FunctionDecl *FnDecl) { // C++ [basic.stc.dynamic.allocation]p1: // A program is ill-formed if an allocation function is declared in a // namespace scope other than global scope or declared static in global // scope. if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl)) return true; CanQualType SizeTy = SemaRef.Context.getCanonicalType(SemaRef.Context.getSizeType()); // C++ [basic.stc.dynamic.allocation]p1: // The return type shall be void*. The first parameter shall have type // std::size_t. if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl, SemaRef.Context.VoidPtrTy, SizeTy, diag::err_operator_new_dependent_param_type, diag::err_operator_new_param_type)) return true; // C++ [basic.stc.dynamic.allocation]p1: // The first parameter shall not have an associated default argument. if (FnDecl->getParamDecl(0)->hasDefaultArg()) return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_default_arg) << FnDecl->getDeclName() << FnDecl->getParamDecl(0)->getDefaultArgRange(); return false; } static bool CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) { // C++ [basic.stc.dynamic.deallocation]p1: // A program is ill-formed if deallocation functions are declared in a // namespace scope other than global scope or declared static in global // scope. if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl)) return true; auto *MD = dyn_cast(FnDecl); // C++ P0722: // Within a class C, the first parameter of a destroying operator delete // shall be of type C *. The first parameter of any other deallocation // function shall be of type void *. CanQualType ExpectedFirstParamType = MD && MD->isDestroyingOperatorDelete() ? SemaRef.Context.getCanonicalType(SemaRef.Context.getPointerType( SemaRef.Context.getRecordType(MD->getParent()))) : SemaRef.Context.VoidPtrTy; // C++ [basic.stc.dynamic.deallocation]p2: // Each deallocation function shall return void if (CheckOperatorNewDeleteTypes( SemaRef, FnDecl, SemaRef.Context.VoidTy, ExpectedFirstParamType, diag::err_operator_delete_dependent_param_type, diag::err_operator_delete_param_type)) return true; // C++ P0722: // A destroying operator delete shall be a usual deallocation function. if (MD && !MD->getParent()->isDependentContext() && MD->isDestroyingOperatorDelete() && !SemaRef.isUsualDeallocationFunction(MD)) { SemaRef.Diag(MD->getLocation(), diag::err_destroying_operator_delete_not_usual); return true; } return false; } /// CheckOverloadedOperatorDeclaration - Check whether the declaration /// of this overloaded operator is well-formed. If so, returns false; /// otherwise, emits appropriate diagnostics and returns true. bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { assert(FnDecl && FnDecl->isOverloadedOperator() && "Expected an overloaded operator declaration"); OverloadedOperatorKind Op = FnDecl->getOverloadedOperator(); // C++ [over.oper]p5: // The allocation and deallocation functions, operator new, // operator new[], operator delete and operator delete[], are // described completely in 3.7.3. The attributes and restrictions // found in the rest of this subclause do not apply to them unless // explicitly stated in 3.7.3. if (Op == OO_Delete || Op == OO_Array_Delete) return CheckOperatorDeleteDeclaration(*this, FnDecl); if (Op == OO_New || Op == OO_Array_New) return CheckOperatorNewDeclaration(*this, FnDecl); // C++ [over.oper]p6: // An operator function shall either be a non-static member // function or be a non-member function and have at least one // parameter whose type is a class, a reference to a class, an // enumeration, or a reference to an enumeration. if (CXXMethodDecl *MethodDecl = dyn_cast(FnDecl)) { if (MethodDecl->isStatic()) return Diag(FnDecl->getLocation(), diag::err_operator_overload_static) << FnDecl->getDeclName(); } else { bool ClassOrEnumParam = false; for (auto Param : FnDecl->parameters()) { QualType ParamType = Param->getType().getNonReferenceType(); if (ParamType->isDependentType() || ParamType->isRecordType() || ParamType->isEnumeralType()) { ClassOrEnumParam = true; break; } } if (!ClassOrEnumParam) return Diag(FnDecl->getLocation(), diag::err_operator_overload_needs_class_or_enum) << FnDecl->getDeclName(); } // C++ [over.oper]p8: // An operator function cannot have default arguments (8.3.6), // except where explicitly stated below. // // Only the function-call operator allows default arguments // (C++ [over.call]p1). if (Op != OO_Call) { for (auto Param : FnDecl->parameters()) { if (Param->hasDefaultArg()) return Diag(Param->getLocation(), diag::err_operator_overload_default_arg) << FnDecl->getDeclName() << Param->getDefaultArgRange(); } } static const bool OperatorUses[NUM_OVERLOADED_OPERATORS][3] = { { false, false, false } #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \ , { Unary, Binary, MemberOnly } #include "clang/Basic/OperatorKinds.def" }; bool CanBeUnaryOperator = OperatorUses[Op][0]; bool CanBeBinaryOperator = OperatorUses[Op][1]; bool MustBeMemberOperator = OperatorUses[Op][2]; // C++ [over.oper]p8: // [...] Operator functions cannot have more or fewer parameters // than the number required for the corresponding operator, as // described in the rest of this subclause. unsigned NumParams = FnDecl->getNumParams() + (isa(FnDecl)? 1 : 0); if (Op != OO_Call && ((NumParams == 1 && !CanBeUnaryOperator) || (NumParams == 2 && !CanBeBinaryOperator) || (NumParams < 1) || (NumParams > 2))) { // We have the wrong number of parameters. unsigned ErrorKind; if (CanBeUnaryOperator && CanBeBinaryOperator) { ErrorKind = 2; // 2 -> unary or binary. } else if (CanBeUnaryOperator) { ErrorKind = 0; // 0 -> unary } else { assert(CanBeBinaryOperator && "All non-call overloaded operators are unary or binary!"); ErrorKind = 1; // 1 -> binary } return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be) << FnDecl->getDeclName() << NumParams << ErrorKind; } // Overloaded operators other than operator() cannot be variadic. if (Op != OO_Call && FnDecl->getType()->getAs()->isVariadic()) { return Diag(FnDecl->getLocation(), diag::err_operator_overload_variadic) << FnDecl->getDeclName(); } // Some operators must be non-static member functions. if (MustBeMemberOperator && !isa(FnDecl)) { return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be_member) << FnDecl->getDeclName(); } // C++ [over.inc]p1: // The user-defined function called operator++ implements the // prefix and postfix ++ operator. If this function is a member // function with no parameters, or a non-member function with one // parameter of class or enumeration type, it defines the prefix // increment operator ++ for objects of that type. If the function // is a member function with one parameter (which shall be of type // int) or a non-member function with two parameters (the second // of which shall be of type int), it defines the postfix // increment operator ++ for objects of that type. if ((Op == OO_PlusPlus || Op == OO_MinusMinus) && NumParams == 2) { ParmVarDecl *LastParam = FnDecl->getParamDecl(FnDecl->getNumParams() - 1); QualType ParamType = LastParam->getType(); if (!ParamType->isSpecificBuiltinType(BuiltinType::Int) && !ParamType->isDependentType()) return Diag(LastParam->getLocation(), diag::err_operator_overload_post_incdec_must_be_int) << LastParam->getType() << (Op == OO_MinusMinus); } return false; } static bool checkLiteralOperatorTemplateParameterList(Sema &SemaRef, FunctionTemplateDecl *TpDecl) { TemplateParameterList *TemplateParams = TpDecl->getTemplateParameters(); // Must have one or two template parameters. if (TemplateParams->size() == 1) { NonTypeTemplateParmDecl *PmDecl = dyn_cast(TemplateParams->getParam(0)); // The template parameter must be a char parameter pack. if (PmDecl && PmDecl->isTemplateParameterPack() && SemaRef.Context.hasSameType(PmDecl->getType(), SemaRef.Context.CharTy)) return false; } else if (TemplateParams->size() == 2) { TemplateTypeParmDecl *PmType = dyn_cast(TemplateParams->getParam(0)); NonTypeTemplateParmDecl *PmArgs = dyn_cast(TemplateParams->getParam(1)); // The second template parameter must be a parameter pack with the // first template parameter as its type. if (PmType && PmArgs && !PmType->isTemplateParameterPack() && PmArgs->isTemplateParameterPack()) { const TemplateTypeParmType *TArgs = PmArgs->getType()->getAs(); if (TArgs && TArgs->getDepth() == PmType->getDepth() && TArgs->getIndex() == PmType->getIndex()) { if (!SemaRef.inTemplateInstantiation()) SemaRef.Diag(TpDecl->getLocation(), diag::ext_string_literal_operator_template); return false; } } } SemaRef.Diag(TpDecl->getTemplateParameters()->getSourceRange().getBegin(), diag::err_literal_operator_template) << TpDecl->getTemplateParameters()->getSourceRange(); return true; } /// CheckLiteralOperatorDeclaration - Check whether the declaration /// of this literal operator function is well-formed. If so, returns /// false; otherwise, emits appropriate diagnostics and returns true. bool Sema::CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl) { if (isa(FnDecl)) { Diag(FnDecl->getLocation(), diag::err_literal_operator_outside_namespace) << FnDecl->getDeclName(); return true; } if (FnDecl->isExternC()) { Diag(FnDecl->getLocation(), diag::err_literal_operator_extern_c); if (const LinkageSpecDecl *LSD = FnDecl->getDeclContext()->getExternCContext()) Diag(LSD->getExternLoc(), diag::note_extern_c_begins_here); return true; } // This might be the definition of a literal operator template. FunctionTemplateDecl *TpDecl = FnDecl->getDescribedFunctionTemplate(); // This might be a specialization of a literal operator template. if (!TpDecl) TpDecl = FnDecl->getPrimaryTemplate(); // template type operator "" name() and // template type operator "" name() are the only valid // template signatures, and the only valid signatures with no parameters. if (TpDecl) { if (FnDecl->param_size() != 0) { Diag(FnDecl->getLocation(), diag::err_literal_operator_template_with_params); return true; } if (checkLiteralOperatorTemplateParameterList(*this, TpDecl)) return true; } else if (FnDecl->param_size() == 1) { const ParmVarDecl *Param = FnDecl->getParamDecl(0); QualType ParamType = Param->getType().getUnqualifiedType(); // Only unsigned long long int, long double, any character type, and const // char * are allowed as the only parameters. if (ParamType->isSpecificBuiltinType(BuiltinType::ULongLong) || ParamType->isSpecificBuiltinType(BuiltinType::LongDouble) || Context.hasSameType(ParamType, Context.CharTy) || Context.hasSameType(ParamType, Context.WideCharTy) || Context.hasSameType(ParamType, Context.Char8Ty) || Context.hasSameType(ParamType, Context.Char16Ty) || Context.hasSameType(ParamType, Context.Char32Ty)) { } else if (const PointerType *Ptr = ParamType->getAs()) { QualType InnerType = Ptr->getPointeeType(); // Pointer parameter must be a const char *. if (!(Context.hasSameType(InnerType.getUnqualifiedType(), Context.CharTy) && InnerType.isConstQualified() && !InnerType.isVolatileQualified())) { Diag(Param->getSourceRange().getBegin(), diag::err_literal_operator_param) << ParamType << "'const char *'" << Param->getSourceRange(); return true; } } else if (ParamType->isRealFloatingType()) { Diag(Param->getSourceRange().getBegin(), diag::err_literal_operator_param) << ParamType << Context.LongDoubleTy << Param->getSourceRange(); return true; } else if (ParamType->isIntegerType()) { Diag(Param->getSourceRange().getBegin(), diag::err_literal_operator_param) << ParamType << Context.UnsignedLongLongTy << Param->getSourceRange(); return true; } else { Diag(Param->getSourceRange().getBegin(), diag::err_literal_operator_invalid_param) << ParamType << Param->getSourceRange(); return true; } } else if (FnDecl->param_size() == 2) { FunctionDecl::param_iterator Param = FnDecl->param_begin(); // First, verify that the first parameter is correct. QualType FirstParamType = (*Param)->getType().getUnqualifiedType(); // Two parameter function must have a pointer to const as a // first parameter; let's strip those qualifiers. const PointerType *PT = FirstParamType->getAs(); if (!PT) { Diag((*Param)->getSourceRange().getBegin(), diag::err_literal_operator_param) << FirstParamType << "'const char *'" << (*Param)->getSourceRange(); return true; } QualType PointeeType = PT->getPointeeType(); // First parameter must be const if (!PointeeType.isConstQualified() || PointeeType.isVolatileQualified()) { Diag((*Param)->getSourceRange().getBegin(), diag::err_literal_operator_param) << FirstParamType << "'const char *'" << (*Param)->getSourceRange(); return true; } QualType InnerType = PointeeType.getUnqualifiedType(); // Only const char *, const wchar_t*, const char8_t*, const char16_t*, and // const char32_t* are allowed as the first parameter to a two-parameter // function if (!(Context.hasSameType(InnerType, Context.CharTy) || Context.hasSameType(InnerType, Context.WideCharTy) || Context.hasSameType(InnerType, Context.Char8Ty) || Context.hasSameType(InnerType, Context.Char16Ty) || Context.hasSameType(InnerType, Context.Char32Ty))) { Diag((*Param)->getSourceRange().getBegin(), diag::err_literal_operator_param) << FirstParamType << "'const char *'" << (*Param)->getSourceRange(); return true; } // Move on to the second and final parameter. ++Param; // The second parameter must be a std::size_t. QualType SecondParamType = (*Param)->getType().getUnqualifiedType(); if (!Context.hasSameType(SecondParamType, Context.getSizeType())) { Diag((*Param)->getSourceRange().getBegin(), diag::err_literal_operator_param) << SecondParamType << Context.getSizeType() << (*Param)->getSourceRange(); return true; } } else { Diag(FnDecl->getLocation(), diag::err_literal_operator_bad_param_count); return true; } // Parameters are good. // A parameter-declaration-clause containing a default argument is not // equivalent to any of the permitted forms. for (auto Param : FnDecl->parameters()) { if (Param->hasDefaultArg()) { Diag(Param->getDefaultArgRange().getBegin(), diag::err_literal_operator_default_argument) << Param->getDefaultArgRange(); break; } } StringRef LiteralName = FnDecl->getDeclName().getCXXLiteralIdentifier()->getName(); if (LiteralName[0] != '_' && !getSourceManager().isInSystemHeader(FnDecl->getLocation())) { // C++11 [usrlit.suffix]p1: // Literal suffix identifiers that do not start with an underscore // are reserved for future standardization. Diag(FnDecl->getLocation(), diag::warn_user_literal_reserved) << StringLiteralParser::isValidUDSuffix(getLangOpts(), LiteralName); } return false; } /// ActOnStartLinkageSpecification - Parsed the beginning of a C++ /// linkage specification, including the language and (if present) /// the '{'. ExternLoc is the location of the 'extern', Lang is the /// language string literal. LBraceLoc, if valid, provides the location of /// the '{' brace. Otherwise, this linkage specification does not /// have any braces. Decl *Sema::ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc) { StringLiteral *Lit = cast(LangStr); if (!Lit->isAscii()) { Diag(LangStr->getExprLoc(), diag::err_language_linkage_spec_not_ascii) << LangStr->getSourceRange(); return nullptr; } StringRef Lang = Lit->getString(); LinkageSpecDecl::LanguageIDs Language; if (Lang == "C") Language = LinkageSpecDecl::lang_c; else if (Lang == "C++") Language = LinkageSpecDecl::lang_cxx; else { Diag(LangStr->getExprLoc(), diag::err_language_linkage_spec_unknown) << LangStr->getSourceRange(); return nullptr; } // FIXME: Add all the various semantics of linkage specifications LinkageSpecDecl *D = LinkageSpecDecl::Create(Context, CurContext, ExternLoc, LangStr->getExprLoc(), Language, LBraceLoc.isValid()); CurContext->addDecl(D); PushDeclContext(S, D); return D; } /// ActOnFinishLinkageSpecification - Complete the definition of /// the C++ linkage specification LinkageSpec. If RBraceLoc is /// valid, it's the position of the closing '}' brace in a linkage /// specification that uses braces. Decl *Sema::ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc) { if (RBraceLoc.isValid()) { LinkageSpecDecl* LSDecl = cast(LinkageSpec); LSDecl->setRBraceLoc(RBraceLoc); } PopDeclContext(); return LinkageSpec; } Decl *Sema::ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList, SourceLocation SemiLoc) { Decl *ED = EmptyDecl::Create(Context, CurContext, SemiLoc); // Attribute declarations appertain to empty declaration so we handle // them here. ProcessDeclAttributeList(S, ED, AttrList); CurContext->addDecl(ED); return ED; } /// Perform semantic analysis for the variable declaration that /// occurs within a C++ catch clause, returning the newly-created /// variable. VarDecl *Sema::BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation Loc, IdentifierInfo *Name) { bool Invalid = false; QualType ExDeclType = TInfo->getType(); // Arrays and functions decay. if (ExDeclType->isArrayType()) ExDeclType = Context.getArrayDecayedType(ExDeclType); else if (ExDeclType->isFunctionType()) ExDeclType = Context.getPointerType(ExDeclType); // C++ 15.3p1: The exception-declaration shall not denote an incomplete type. // The exception-declaration shall not denote a pointer or reference to an // incomplete type, other than [cv] void*. // N2844 forbids rvalue references. if (!ExDeclType->isDependentType() && ExDeclType->isRValueReferenceType()) { Diag(Loc, diag::err_catch_rvalue_ref); Invalid = true; } if (ExDeclType->isVariablyModifiedType()) { Diag(Loc, diag::err_catch_variably_modified) << ExDeclType; Invalid = true; } QualType BaseType = ExDeclType; int Mode = 0; // 0 for direct type, 1 for pointer, 2 for reference unsigned DK = diag::err_catch_incomplete; if (const PointerType *Ptr = BaseType->getAs()) { BaseType = Ptr->getPointeeType(); Mode = 1; DK = diag::err_catch_incomplete_ptr; } else if (const ReferenceType *Ref = BaseType->getAs()) { // For the purpose of error recovery, we treat rvalue refs like lvalue refs. BaseType = Ref->getPointeeType(); Mode = 2; DK = diag::err_catch_incomplete_ref; } if (!Invalid && (Mode == 0 || !BaseType->isVoidType()) && !BaseType->isDependentType() && RequireCompleteType(Loc, BaseType, DK)) Invalid = true; if (!Invalid && !ExDeclType->isDependentType() && RequireNonAbstractType(Loc, ExDeclType, diag::err_abstract_type_in_decl, AbstractVariableType)) Invalid = true; // Only the non-fragile NeXT runtime currently supports C++ catches // of ObjC types, and no runtime supports catching ObjC types by value. if (!Invalid && getLangOpts().ObjC) { QualType T = ExDeclType; if (const ReferenceType *RT = T->getAs()) T = RT->getPointeeType(); if (T->isObjCObjectType()) { Diag(Loc, diag::err_objc_object_catch); Invalid = true; } else if (T->isObjCObjectPointerType()) { // FIXME: should this be a test for macosx-fragile specifically? if (getLangOpts().ObjCRuntime.isFragile()) Diag(Loc, diag::warn_objc_pointer_cxx_catch_fragile); } } VarDecl *ExDecl = VarDecl::Create(Context, CurContext, StartLoc, Loc, Name, ExDeclType, TInfo, SC_None); ExDecl->setExceptionVariable(true); // In ARC, infer 'retaining' for variables of retainable type. if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(ExDecl)) Invalid = true; if (!Invalid && !ExDeclType->isDependentType()) { if (const RecordType *recordType = ExDeclType->getAs()) { // Insulate this from anything else we might currently be parsing. EnterExpressionEvaluationContext scope( *this, ExpressionEvaluationContext::PotentiallyEvaluated); // C++ [except.handle]p16: // The object declared in an exception-declaration or, if the // exception-declaration does not specify a name, a temporary (12.2) is // copy-initialized (8.5) from the exception object. [...] // The object is destroyed when the handler exits, after the destruction // of any automatic objects initialized within the handler. // // We just pretend to initialize the object with itself, then make sure // it can be destroyed later. QualType initType = Context.getExceptionObjectType(ExDeclType); InitializedEntity entity = InitializedEntity::InitializeVariable(ExDecl); InitializationKind initKind = InitializationKind::CreateCopy(Loc, SourceLocation()); Expr *opaqueValue = new (Context) OpaqueValueExpr(Loc, initType, VK_LValue, OK_Ordinary); InitializationSequence sequence(*this, entity, initKind, opaqueValue); ExprResult result = sequence.Perform(*this, entity, initKind, opaqueValue); if (result.isInvalid()) Invalid = true; else { // If the constructor used was non-trivial, set this as the // "initializer". CXXConstructExpr *construct = result.getAs(); if (!construct->getConstructor()->isTrivial()) { Expr *init = MaybeCreateExprWithCleanups(construct); ExDecl->setInit(init); } // And make sure it's destructable. FinalizeVarWithDestructor(ExDecl, recordType); } } } if (Invalid) ExDecl->setInvalidDecl(); return ExDecl; } /// ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch /// handler. Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); bool Invalid = D.isInvalidType(); // Check for unexpanded parameter packs. if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo, UPPC_ExceptionType)) { TInfo = Context.getTrivialTypeSourceInfo(Context.IntTy, D.getIdentifierLoc()); Invalid = true; } IdentifierInfo *II = D.getIdentifier(); if (NamedDecl *PrevDecl = LookupSingleName(S, II, D.getIdentifierLoc(), LookupOrdinaryName, ForVisibleRedeclaration)) { // The scope should be freshly made just for us. There is just no way // it contains any previous declaration, except for function parameters in // a function-try-block's catch statement. assert(!S->isDeclScope(PrevDecl)); if (isDeclInScope(PrevDecl, CurContext, S)) { Diag(D.getIdentifierLoc(), diag::err_redefinition) << D.getIdentifier(); Diag(PrevDecl->getLocation(), diag::note_previous_definition); Invalid = true; } else if (PrevDecl->isTemplateParameter()) // Maybe we will complain about the shadowed template parameter. DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl); } if (D.getCXXScopeSpec().isSet() && !Invalid) { Diag(D.getIdentifierLoc(), diag::err_qualified_catch_declarator) << D.getCXXScopeSpec().getRange(); Invalid = true; } VarDecl *ExDecl = BuildExceptionDeclaration( S, TInfo, D.getBeginLoc(), D.getIdentifierLoc(), D.getIdentifier()); if (Invalid) ExDecl->setInvalidDecl(); // Add the exception declaration into this scope. if (II) PushOnScopeChains(ExDecl, S); else CurContext->addDecl(ExDecl); ProcessDeclAttributes(S, ExDecl, D); return ExDecl; } Decl *Sema::ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc) { StringLiteral *AssertMessage = AssertMessageExpr ? cast(AssertMessageExpr) : nullptr; if (DiagnoseUnexpandedParameterPack(AssertExpr, UPPC_StaticAssertExpression)) return nullptr; return BuildStaticAssertDeclaration(StaticAssertLoc, AssertExpr, AssertMessage, RParenLoc, false); } Decl *Sema::BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessage, SourceLocation RParenLoc, bool Failed) { assert(AssertExpr != nullptr && "Expected non-null condition"); if (!AssertExpr->isTypeDependent() && !AssertExpr->isValueDependent() && !Failed) { // In a static_assert-declaration, the constant-expression shall be a // constant expression that can be contextually converted to bool. ExprResult Converted = PerformContextuallyConvertToBool(AssertExpr); if (Converted.isInvalid()) Failed = true; llvm::APSInt Cond; if (!Failed && VerifyIntegerConstantExpression(Converted.get(), &Cond, diag::err_static_assert_expression_is_not_constant, /*AllowFold=*/false).isInvalid()) Failed = true; if (!Failed && !Cond) { SmallString<256> MsgBuffer; llvm::raw_svector_ostream Msg(MsgBuffer); if (AssertMessage) AssertMessage->printPretty(Msg, nullptr, getPrintingPolicy()); Expr *InnerCond = nullptr; std::string InnerCondDescription; std::tie(InnerCond, InnerCondDescription) = findFailedBooleanCondition(Converted.get()); if (InnerCond && !isa(InnerCond) && !isa(InnerCond)) { Diag(StaticAssertLoc, diag::err_static_assert_requirement_failed) << InnerCondDescription << !AssertMessage << Msg.str() << InnerCond->getSourceRange(); } else { Diag(StaticAssertLoc, diag::err_static_assert_failed) << !AssertMessage << Msg.str() << AssertExpr->getSourceRange(); } Failed = true; } } ExprResult FullAssertExpr = ActOnFinishFullExpr(AssertExpr, StaticAssertLoc, /*DiscardedValue*/false, /*IsConstexpr*/true); if (FullAssertExpr.isInvalid()) Failed = true; else AssertExpr = FullAssertExpr.get(); Decl *Decl = StaticAssertDecl::Create(Context, CurContext, StaticAssertLoc, AssertExpr, AssertMessage, RParenLoc, Failed); CurContext->addDecl(Decl); return Decl; } /// Perform semantic analysis of the given friend type declaration. /// /// \returns A friend declaration that. FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo) { assert(TSInfo && "NULL TypeSourceInfo for friend type declaration"); QualType T = TSInfo->getType(); SourceRange TypeRange = TSInfo->getTypeLoc().getLocalSourceRange(); // C++03 [class.friend]p2: // An elaborated-type-specifier shall be used in a friend declaration // for a class.* // // * The class-key of the elaborated-type-specifier is required. if (!CodeSynthesisContexts.empty()) { // Do not complain about the form of friend template types during any kind // of code synthesis. For template instantiation, we will have complained // when the template was defined. } else { if (!T->isElaboratedTypeSpecifier()) { // If we evaluated the type to a record type, suggest putting // a tag in front. if (const RecordType *RT = T->getAs()) { RecordDecl *RD = RT->getDecl(); SmallString<16> InsertionText(" "); InsertionText += RD->getKindName(); Diag(TypeRange.getBegin(), getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_unelaborated_friend_type : diag::ext_unelaborated_friend_type) << (unsigned) RD->getTagKind() << T << FixItHint::CreateInsertion(getLocForEndOfToken(FriendLoc), InsertionText); } else { Diag(FriendLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_nonclass_type_friend : diag::ext_nonclass_type_friend) << T << TypeRange; } } else if (T->getAs()) { Diag(FriendLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_enum_friend : diag::ext_enum_friend) << T << TypeRange; } // C++11 [class.friend]p3: // A friend declaration that does not declare a function shall have one // of the following forms: // friend elaborated-type-specifier ; // friend simple-type-specifier ; // friend typename-specifier ; if (getLangOpts().CPlusPlus11 && LocStart != FriendLoc) Diag(FriendLoc, diag::err_friend_not_first_in_declaration) << T; } // If the type specifier in a friend declaration designates a (possibly // cv-qualified) class type, that class is declared as a friend; otherwise, // the friend declaration is ignored. return FriendDecl::Create(Context, CurContext, TSInfo->getTypeLoc().getBeginLoc(), TSInfo, FriendLoc); } /// Handle a friend tag declaration where the scope specifier was /// templated. Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, MultiTemplateParamsArg TempParamLists) { TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForTypeSpec(TagSpec); bool IsMemberSpecialization = false; bool Invalid = false; if (TemplateParameterList *TemplateParams = MatchTemplateParametersToScopeSpecifier( TagLoc, NameLoc, SS, nullptr, TempParamLists, /*friend*/ true, IsMemberSpecialization, Invalid)) { if (TemplateParams->size() > 0) { // This is a declaration of a class template. if (Invalid) return nullptr; return CheckClassTemplate(S, TagSpec, TUK_Friend, TagLoc, SS, Name, NameLoc, Attr, TemplateParams, AS_public, /*ModulePrivateLoc=*/SourceLocation(), FriendLoc, TempParamLists.size() - 1, TempParamLists.data()).get(); } else { // The "template<>" header is extraneous. Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams) << TypeWithKeyword::getTagTypeKindName(Kind) << Name; IsMemberSpecialization = true; } } if (Invalid) return nullptr; bool isAllExplicitSpecializations = true; for (unsigned I = TempParamLists.size(); I-- > 0; ) { if (TempParamLists[I]->size()) { isAllExplicitSpecializations = false; break; } } // FIXME: don't ignore attributes. // If it's explicit specializations all the way down, just forget // about the template header and build an appropriate non-templated // friend. TODO: for source fidelity, remember the headers. if (isAllExplicitSpecializations) { if (SS.isEmpty()) { bool Owned = false; bool IsDependent = false; return ActOnTag(S, TagSpec, TUK_Friend, TagLoc, SS, Name, NameLoc, Attr, AS_public, /*ModulePrivateLoc=*/SourceLocation(), MultiTemplateParamsArg(), Owned, IsDependent, /*ScopedEnumKWLoc=*/SourceLocation(), /*ScopedEnumUsesClassTag=*/false, /*UnderlyingType=*/TypeResult(), /*IsTypeSpecifier=*/false, /*IsTemplateParamOrArg=*/false); } NestedNameSpecifierLoc QualifierLoc = SS.getWithLocInContext(Context); ElaboratedTypeKeyword Keyword = TypeWithKeyword::getKeywordForTagTypeKind(Kind); QualType T = CheckTypenameType(Keyword, TagLoc, QualifierLoc, *Name, NameLoc); if (T.isNull()) return nullptr; TypeSourceInfo *TSI = Context.CreateTypeSourceInfo(T); if (isa(T)) { DependentNameTypeLoc TL = TSI->getTypeLoc().castAs(); TL.setElaboratedKeywordLoc(TagLoc); TL.setQualifierLoc(QualifierLoc); TL.setNameLoc(NameLoc); } else { ElaboratedTypeLoc TL = TSI->getTypeLoc().castAs(); TL.setElaboratedKeywordLoc(TagLoc); TL.setQualifierLoc(QualifierLoc); TL.getNamedTypeLoc().castAs().setNameLoc(NameLoc); } FriendDecl *Friend = FriendDecl::Create(Context, CurContext, NameLoc, TSI, FriendLoc, TempParamLists); Friend->setAccess(AS_public); CurContext->addDecl(Friend); return Friend; } assert(SS.isNotEmpty() && "valid templated tag with no SS and no direct?"); // Handle the case of a templated-scope friend class. e.g. // template class A::B; // FIXME: we don't support these right now. Diag(NameLoc, diag::warn_template_qualified_friend_unsupported) << SS.getScopeRep() << SS.getRange() << cast(CurContext); ElaboratedTypeKeyword ETK = TypeWithKeyword::getKeywordForTagTypeKind(Kind); QualType T = Context.getDependentNameType(ETK, SS.getScopeRep(), Name); TypeSourceInfo *TSI = Context.CreateTypeSourceInfo(T); DependentNameTypeLoc TL = TSI->getTypeLoc().castAs(); TL.setElaboratedKeywordLoc(TagLoc); TL.setQualifierLoc(SS.getWithLocInContext(Context)); TL.setNameLoc(NameLoc); FriendDecl *Friend = FriendDecl::Create(Context, CurContext, NameLoc, TSI, FriendLoc, TempParamLists); Friend->setAccess(AS_public); Friend->setUnsupportedFriend(true); CurContext->addDecl(Friend); return Friend; } /// Handle a friend type declaration. This works in tandem with /// ActOnTag. /// /// Notes on friend class templates: /// /// We generally treat friend class declarations as if they were /// declaring a class. So, for example, the elaborated type specifier /// in a friend declaration is required to obey the restrictions of a /// class-head (i.e. no typedefs in the scope chain), template /// parameters are required to match up with simple template-ids, &c. /// However, unlike when declaring a template specialization, it's /// okay to refer to a template specialization without an empty /// template parameter declaration, e.g. /// friend class A::B; /// We permit this as a special case; if there are any template /// parameters present at all, require proper matching, i.e. /// template <> template \ friend class A::B; Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TempParams) { SourceLocation Loc = DS.getBeginLoc(); assert(DS.isFriendSpecified()); assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified); // C++ [class.friend]p3: // A friend declaration that does not declare a function shall have one of // the following forms: // friend elaborated-type-specifier ; // friend simple-type-specifier ; // friend typename-specifier ; // // Any declaration with a type qualifier does not have that form. (It's // legal to specify a qualified type as a friend, you just can't write the // keywords.) if (DS.getTypeQualifiers()) { if (DS.getTypeQualifiers() & DeclSpec::TQ_const) Diag(DS.getConstSpecLoc(), diag::err_friend_decl_spec) << "const"; if (DS.getTypeQualifiers() & DeclSpec::TQ_volatile) Diag(DS.getVolatileSpecLoc(), diag::err_friend_decl_spec) << "volatile"; if (DS.getTypeQualifiers() & DeclSpec::TQ_restrict) Diag(DS.getRestrictSpecLoc(), diag::err_friend_decl_spec) << "restrict"; if (DS.getTypeQualifiers() & DeclSpec::TQ_atomic) Diag(DS.getAtomicSpecLoc(), diag::err_friend_decl_spec) << "_Atomic"; if (DS.getTypeQualifiers() & DeclSpec::TQ_unaligned) Diag(DS.getUnalignedSpecLoc(), diag::err_friend_decl_spec) << "__unaligned"; } // Try to convert the decl specifier to a type. This works for // friend templates because ActOnTag never produces a ClassTemplateDecl // for a TUK_Friend. Declarator TheDeclarator(DS, DeclaratorContext::MemberContext); TypeSourceInfo *TSI = GetTypeForDeclarator(TheDeclarator, S); QualType T = TSI->getType(); if (TheDeclarator.isInvalidType()) return nullptr; if (DiagnoseUnexpandedParameterPack(Loc, TSI, UPPC_FriendDeclaration)) return nullptr; // This is definitely an error in C++98. It's probably meant to // be forbidden in C++0x, too, but the specification is just // poorly written. // // The problem is with declarations like the following: // template friend A::foo; // where deciding whether a class C is a friend or not now hinges // on whether there exists an instantiation of A that causes // 'foo' to equal C. There are restrictions on class-heads // (which we declare (by fiat) elaborated friend declarations to // be) that makes this tractable. // // FIXME: handle "template <> friend class A;", which // is possibly well-formed? Who even knows? if (TempParams.size() && !T->isElaboratedTypeSpecifier()) { Diag(Loc, diag::err_tagless_friend_type_template) << DS.getSourceRange(); return nullptr; } // C++98 [class.friend]p1: A friend of a class is a function // or class that is not a member of the class . . . // This is fixed in DR77, which just barely didn't make the C++03 // deadline. It's also a very silly restriction that seriously // affects inner classes and which nobody else seems to implement; // thus we never diagnose it, not even in -pedantic. // // But note that we could warn about it: it's always useless to // friend one of your own members (it's not, however, worthless to // friend a member of an arbitrary specialization of your template). Decl *D; if (!TempParams.empty()) D = FriendTemplateDecl::Create(Context, CurContext, Loc, TempParams, TSI, DS.getFriendSpecLoc()); else D = CheckFriendTypeDecl(Loc, DS.getFriendSpecLoc(), TSI); if (!D) return nullptr; D->setAccess(AS_public); CurContext->addDecl(D); return D; } NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams) { const DeclSpec &DS = D.getDeclSpec(); assert(DS.isFriendSpecified()); assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified); SourceLocation Loc = D.getIdentifierLoc(); TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); // C++ [class.friend]p1 // A friend of a class is a function or class.... // Note that this sees through typedefs, which is intended. // It *doesn't* see through dependent types, which is correct // according to [temp.arg.type]p3: // If a declaration acquires a function type through a // type dependent on a template-parameter and this causes // a declaration that does not use the syntactic form of a // function declarator to have a function type, the program // is ill-formed. if (!TInfo->getType()->isFunctionType()) { Diag(Loc, diag::err_unexpected_friend); // It might be worthwhile to try to recover by creating an // appropriate declaration. return nullptr; } // C++ [namespace.memdef]p3 // - If a friend declaration in a non-local class first declares a // class or function, the friend class or function is a member // of the innermost enclosing namespace. // - The name of the friend is not found by simple name lookup // until a matching declaration is provided in that namespace // scope (either before or after the class declaration granting // friendship). // - If a friend function is called, its name may be found by the // name lookup that considers functions from namespaces and // classes associated with the types of the function arguments. // - When looking for a prior declaration of a class or a function // declared as a friend, scopes outside the innermost enclosing // namespace scope are not considered. CXXScopeSpec &SS = D.getCXXScopeSpec(); DeclarationNameInfo NameInfo = GetNameForDeclarator(D); assert(NameInfo.getName()); // Check for unexpanded parameter packs. if (DiagnoseUnexpandedParameterPack(Loc, TInfo, UPPC_FriendDeclaration) || DiagnoseUnexpandedParameterPack(NameInfo, UPPC_FriendDeclaration) || DiagnoseUnexpandedParameterPack(SS, UPPC_FriendDeclaration)) return nullptr; // The context we found the declaration in, or in which we should // create the declaration. DeclContext *DC; Scope *DCScope = S; LookupResult Previous(*this, NameInfo, LookupOrdinaryName, ForExternalRedeclaration); // There are five cases here. // - There's no scope specifier and we're in a local class. Only look // for functions declared in the immediately-enclosing block scope. // We recover from invalid scope qualifiers as if they just weren't there. FunctionDecl *FunctionContainingLocalClass = nullptr; if ((SS.isInvalid() || !SS.isSet()) && (FunctionContainingLocalClass = cast(CurContext)->isLocalClass())) { // C++11 [class.friend]p11: // If a friend declaration appears in a local class and the name // specified is an unqualified name, a prior declaration is // looked up without considering scopes that are outside the // innermost enclosing non-class scope. For a friend function // declaration, if there is no prior declaration, the program is // ill-formed. // Find the innermost enclosing non-class scope. This is the block // scope containing the local class definition (or for a nested class, // the outer local class). DCScope = S->getFnParent(); // Look up the function name in the scope. Previous.clear(LookupLocalFriendName); LookupName(Previous, S, /*AllowBuiltinCreation*/false); if (!Previous.empty()) { // All possible previous declarations must have the same context: // either they were declared at block scope or they are members of // one of the enclosing local classes. DC = Previous.getRepresentativeDecl()->getDeclContext(); } else { // This is ill-formed, but provide the context that we would have // declared the function in, if we were permitted to, for error recovery. DC = FunctionContainingLocalClass; } adjustContextForLocalExternDecl(DC); // C++ [class.friend]p6: // A function can be defined in a friend declaration of a class if and // only if the class is a non-local class (9.8), the function name is // unqualified, and the function has namespace scope. if (D.isFunctionDefinition()) { Diag(NameInfo.getBeginLoc(), diag::err_friend_def_in_local_class); } // - There's no scope specifier, in which case we just go to the // appropriate scope and look for a function or function template // there as appropriate. } else if (SS.isInvalid() || !SS.isSet()) { // C++11 [namespace.memdef]p3: // If the name in a friend declaration is neither qualified nor // a template-id and the declaration is a function or an // elaborated-type-specifier, the lookup to determine whether // the entity has been previously declared shall not consider // any scopes outside the innermost enclosing namespace. bool isTemplateId = D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId; // Find the appropriate context according to the above. DC = CurContext; // Skip class contexts. If someone can cite chapter and verse // for this behavior, that would be nice --- it's what GCC and // EDG do, and it seems like a reasonable intent, but the spec // really only says that checks for unqualified existing // declarations should stop at the nearest enclosing namespace, // not that they should only consider the nearest enclosing // namespace. while (DC->isRecord()) DC = DC->getParent(); DeclContext *LookupDC = DC; while (LookupDC->isTransparentContext()) LookupDC = LookupDC->getParent(); while (true) { LookupQualifiedName(Previous, LookupDC); if (!Previous.empty()) { DC = LookupDC; break; } if (isTemplateId) { if (isa(LookupDC)) break; } else { if (LookupDC->isFileContext()) break; } LookupDC = LookupDC->getParent(); } DCScope = getScopeForDeclContext(S, DC); // - There's a non-dependent scope specifier, in which case we // compute it and do a previous lookup there for a function // or function template. } else if (!SS.getScopeRep()->isDependent()) { DC = computeDeclContext(SS); if (!DC) return nullptr; if (RequireCompleteDeclContext(SS, DC)) return nullptr; LookupQualifiedName(Previous, DC); // C++ [class.friend]p1: A friend of a class is a function or // class that is not a member of the class . . . if (DC->Equals(CurContext)) Diag(DS.getFriendSpecLoc(), getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_friend_is_member : diag::err_friend_is_member); if (D.isFunctionDefinition()) { // C++ [class.friend]p6: // A function can be defined in a friend declaration of a class if and // only if the class is a non-local class (9.8), the function name is // unqualified, and the function has namespace scope. // // FIXME: We should only do this if the scope specifier names the // innermost enclosing namespace; otherwise the fixit changes the // meaning of the code. SemaDiagnosticBuilder DB = Diag(SS.getRange().getBegin(), diag::err_qualified_friend_def); DB << SS.getScopeRep(); if (DC->isFileContext()) DB << FixItHint::CreateRemoval(SS.getRange()); SS.clear(); } // - There's a scope specifier that does not match any template // parameter lists, in which case we use some arbitrary context, // create a method or method template, and wait for instantiation. // - There's a scope specifier that does match some template // parameter lists, which we don't handle right now. } else { if (D.isFunctionDefinition()) { // C++ [class.friend]p6: // A function can be defined in a friend declaration of a class if and // only if the class is a non-local class (9.8), the function name is // unqualified, and the function has namespace scope. Diag(SS.getRange().getBegin(), diag::err_qualified_friend_def) << SS.getScopeRep(); } DC = CurContext; assert(isa(DC) && "friend declaration not in class?"); } if (!DC->isRecord()) { int DiagArg = -1; switch (D.getName().getKind()) { case UnqualifiedIdKind::IK_ConstructorTemplateId: case UnqualifiedIdKind::IK_ConstructorName: DiagArg = 0; break; case UnqualifiedIdKind::IK_DestructorName: DiagArg = 1; break; case UnqualifiedIdKind::IK_ConversionFunctionId: DiagArg = 2; break; case UnqualifiedIdKind::IK_DeductionGuideName: DiagArg = 3; break; case UnqualifiedIdKind::IK_Identifier: case UnqualifiedIdKind::IK_ImplicitSelfParam: case UnqualifiedIdKind::IK_LiteralOperatorId: case UnqualifiedIdKind::IK_OperatorFunctionId: case UnqualifiedIdKind::IK_TemplateId: break; } // This implies that it has to be an operator or function. if (DiagArg >= 0) { Diag(Loc, diag::err_introducing_special_friend) << DiagArg; return nullptr; } } // FIXME: This is an egregious hack to cope with cases where the scope stack // does not contain the declaration context, i.e., in an out-of-line // definition of a class. Scope FakeDCScope(S, Scope::DeclScope, Diags); if (!DCScope) { FakeDCScope.setEntity(DC); DCScope = &FakeDCScope; } bool AddToScope = true; NamedDecl *ND = ActOnFunctionDeclarator(DCScope, D, DC, TInfo, Previous, TemplateParams, AddToScope); if (!ND) return nullptr; assert(ND->getLexicalDeclContext() == CurContext); // If we performed typo correction, we might have added a scope specifier // and changed the decl context. DC = ND->getDeclContext(); // Add the function declaration to the appropriate lookup tables, // adjusting the redeclarations list as necessary. We don't // want to do this yet if the friending class is dependent. // // Also update the scope-based lookup if the target context's // lookup context is in lexical scope. if (!CurContext->isDependentContext()) { DC = DC->getRedeclContext(); DC->makeDeclVisibleInContext(ND); if (Scope *EnclosingScope = getScopeForDeclContext(S, DC)) PushOnScopeChains(ND, EnclosingScope, /*AddToContext=*/ false); } FriendDecl *FrD = FriendDecl::Create(Context, CurContext, D.getIdentifierLoc(), ND, DS.getFriendSpecLoc()); FrD->setAccess(AS_public); CurContext->addDecl(FrD); if (ND->isInvalidDecl()) { FrD->setInvalidDecl(); } else { if (DC->isRecord()) CheckFriendAccess(ND); FunctionDecl *FD; if (FunctionTemplateDecl *FTD = dyn_cast(ND)) FD = FTD->getTemplatedDecl(); else FD = cast(ND); // C++11 [dcl.fct.default]p4: If a friend declaration specifies a // default argument expression, that declaration shall be a definition // and shall be the only declaration of the function or function // template in the translation unit. if (functionDeclHasDefaultArgument(FD)) { // We can't look at FD->getPreviousDecl() because it may not have been set // if we're in a dependent context. If the function is known to be a // redeclaration, we will have narrowed Previous down to the right decl. if (D.isRedeclaration()) { Diag(FD->getLocation(), diag::err_friend_decl_with_def_arg_redeclared); Diag(Previous.getRepresentativeDecl()->getLocation(), diag::note_previous_declaration); } else if (!D.isFunctionDefinition()) Diag(FD->getLocation(), diag::err_friend_decl_with_def_arg_must_be_def); } // Mark templated-scope function declarations as unsupported. if (FD->getNumTemplateParameterLists() && SS.isValid()) { Diag(FD->getLocation(), diag::warn_template_qualified_friend_unsupported) << SS.getScopeRep() << SS.getRange() << cast(CurContext); FrD->setUnsupportedFriend(true); } } return ND; } void Sema::SetDeclDeleted(Decl *Dcl, SourceLocation DelLoc) { AdjustDeclIfTemplate(Dcl); FunctionDecl *Fn = dyn_cast_or_null(Dcl); if (!Fn) { Diag(DelLoc, diag::err_deleted_non_function); return; } // Deleted function does not have a body. Fn->setWillHaveBody(false); if (const FunctionDecl *Prev = Fn->getPreviousDecl()) { // Don't consider the implicit declaration we generate for explicit // specializations. FIXME: Do not generate these implicit declarations. if ((Prev->getTemplateSpecializationKind() != TSK_ExplicitSpecialization || Prev->getPreviousDecl()) && !Prev->isDefined()) { Diag(DelLoc, diag::err_deleted_decl_not_first); Diag(Prev->getLocation().isInvalid() ? DelLoc : Prev->getLocation(), Prev->isImplicit() ? diag::note_previous_implicit_declaration : diag::note_previous_declaration); } // If the declaration wasn't the first, we delete the function anyway for // recovery. Fn = Fn->getCanonicalDecl(); } // dllimport/dllexport cannot be deleted. if (const InheritableAttr *DLLAttr = getDLLAttr(Fn)) { Diag(Fn->getLocation(), diag::err_attribute_dll_deleted) << DLLAttr; Fn->setInvalidDecl(); } if (Fn->isDeleted()) return; // See if we're deleting a function which is already known to override a // non-deleted virtual function. if (CXXMethodDecl *MD = dyn_cast(Fn)) { bool IssuedDiagnostic = false; for (const CXXMethodDecl *O : MD->overridden_methods()) { if (!(*MD->begin_overridden_methods())->isDeleted()) { if (!IssuedDiagnostic) { Diag(DelLoc, diag::err_deleted_override) << MD->getDeclName(); IssuedDiagnostic = true; } Diag(O->getLocation(), diag::note_overridden_virtual_function); } } // If this function was implicitly deleted because it was defaulted, // explain why it was deleted. if (IssuedDiagnostic && MD->isDefaulted()) ShouldDeleteSpecialMember(MD, getSpecialMember(MD), nullptr, /*Diagnose*/true); } // C++11 [basic.start.main]p3: // A program that defines main as deleted [...] is ill-formed. if (Fn->isMain()) Diag(DelLoc, diag::err_deleted_main); // C++11 [dcl.fct.def.delete]p4: // A deleted function is implicitly inline. Fn->setImplicitlyInline(); Fn->setDeletedAsWritten(); } void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) { CXXMethodDecl *MD = dyn_cast_or_null(Dcl); if (MD) { if (MD->getParent()->isDependentType()) { MD->setDefaulted(); MD->setExplicitlyDefaulted(); return; } CXXSpecialMember Member = getSpecialMember(MD); if (Member == CXXInvalid) { if (!MD->isInvalidDecl()) Diag(DefaultLoc, diag::err_default_special_members); return; } MD->setDefaulted(); MD->setExplicitlyDefaulted(); // Unset that we will have a body for this function. We might not, // if it turns out to be trivial, and we don't need this marking now // that we've marked it as defaulted. MD->setWillHaveBody(false); // If this definition appears within the record, do the checking when // the record is complete. const FunctionDecl *Primary = MD; if (const FunctionDecl *Pattern = MD->getTemplateInstantiationPattern()) // Ask the template instantiation pattern that actually had the // '= default' on it. Primary = Pattern; // If the method was defaulted on its first declaration, we will have // already performed the checking in CheckCompletedCXXClass. Such a // declaration doesn't trigger an implicit definition. if (Primary->getCanonicalDecl()->isDefaulted()) return; CheckExplicitlyDefaultedSpecialMember(MD); if (!MD->isInvalidDecl()) DefineImplicitSpecialMember(*this, MD, DefaultLoc); } else { Diag(DefaultLoc, diag::err_default_special_members); } } static void SearchForReturnInStmt(Sema &Self, Stmt *S) { for (Stmt *SubStmt : S->children()) { if (!SubStmt) continue; if (isa(SubStmt)) Self.Diag(SubStmt->getBeginLoc(), diag::err_return_in_constructor_handler); if (!isa(SubStmt)) SearchForReturnInStmt(Self, SubStmt); } } void Sema::DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock) { for (unsigned I = 0, E = TryBlock->getNumHandlers(); I != E; ++I) { CXXCatchStmt *Handler = TryBlock->getHandler(I); SearchForReturnInStmt(*this, Handler); } } bool Sema::CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old) { const auto *NewFT = New->getType()->getAs(); const auto *OldFT = Old->getType()->getAs(); if (OldFT->hasExtParameterInfos()) { for (unsigned I = 0, E = OldFT->getNumParams(); I != E; ++I) // A parameter of the overriding method should be annotated with noescape // if the corresponding parameter of the overridden method is annotated. if (OldFT->getExtParameterInfo(I).isNoEscape() && !NewFT->getExtParameterInfo(I).isNoEscape()) { Diag(New->getParamDecl(I)->getLocation(), diag::warn_overriding_method_missing_noescape); Diag(Old->getParamDecl(I)->getLocation(), diag::note_overridden_marked_noescape); } } // Virtual overrides must have the same code_seg. const auto *OldCSA = Old->getAttr(); const auto *NewCSA = New->getAttr(); if ((NewCSA || OldCSA) && (!OldCSA || !NewCSA || NewCSA->getName() != OldCSA->getName())) { Diag(New->getLocation(), diag::err_mismatched_code_seg_override); Diag(Old->getLocation(), diag::note_previous_declaration); return true; } CallingConv NewCC = NewFT->getCallConv(), OldCC = OldFT->getCallConv(); // If the calling conventions match, everything is fine if (NewCC == OldCC) return false; // If the calling conventions mismatch because the new function is static, // suppress the calling convention mismatch error; the error about static // function override (err_static_overrides_virtual from // Sema::CheckFunctionDeclaration) is more clear. if (New->getStorageClass() == SC_Static) return false; Diag(New->getLocation(), diag::err_conflicting_overriding_cc_attributes) << New->getDeclName() << New->getType() << Old->getType(); Diag(Old->getLocation(), diag::note_overridden_virtual_function); return true; } bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old) { QualType NewTy = New->getType()->getAs()->getReturnType(); QualType OldTy = Old->getType()->getAs()->getReturnType(); if (Context.hasSameType(NewTy, OldTy) || NewTy->isDependentType() || OldTy->isDependentType()) return false; // Check if the return types are covariant QualType NewClassTy, OldClassTy; /// Both types must be pointers or references to classes. if (const PointerType *NewPT = NewTy->getAs()) { if (const PointerType *OldPT = OldTy->getAs()) { NewClassTy = NewPT->getPointeeType(); OldClassTy = OldPT->getPointeeType(); } } else if (const ReferenceType *NewRT = NewTy->getAs()) { if (const ReferenceType *OldRT = OldTy->getAs()) { if (NewRT->getTypeClass() == OldRT->getTypeClass()) { NewClassTy = NewRT->getPointeeType(); OldClassTy = OldRT->getPointeeType(); } } } // The return types aren't either both pointers or references to a class type. if (NewClassTy.isNull()) { Diag(New->getLocation(), diag::err_different_return_type_for_overriding_virtual_function) << New->getDeclName() << NewTy << OldTy << New->getReturnTypeSourceRange(); Diag(Old->getLocation(), diag::note_overridden_virtual_function) << Old->getReturnTypeSourceRange(); return true; } if (!Context.hasSameUnqualifiedType(NewClassTy, OldClassTy)) { // C++14 [class.virtual]p8: // If the class type in the covariant return type of D::f differs from // that of B::f, the class type in the return type of D::f shall be // complete at the point of declaration of D::f or shall be the class // type D. if (const RecordType *RT = NewClassTy->getAs()) { if (!RT->isBeingDefined() && RequireCompleteType(New->getLocation(), NewClassTy, diag::err_covariant_return_incomplete, New->getDeclName())) return true; } // Check if the new class derives from the old class. if (!IsDerivedFrom(New->getLocation(), NewClassTy, OldClassTy)) { Diag(New->getLocation(), diag::err_covariant_return_not_derived) << New->getDeclName() << NewTy << OldTy << New->getReturnTypeSourceRange(); Diag(Old->getLocation(), diag::note_overridden_virtual_function) << Old->getReturnTypeSourceRange(); return true; } // Check if we the conversion from derived to base is valid. if (CheckDerivedToBaseConversion( NewClassTy, OldClassTy, diag::err_covariant_return_inaccessible_base, diag::err_covariant_return_ambiguous_derived_to_base_conv, New->getLocation(), New->getReturnTypeSourceRange(), New->getDeclName(), nullptr)) { // FIXME: this note won't trigger for delayed access control // diagnostics, and it's impossible to get an undelayed error // here from access control during the original parse because // the ParsingDeclSpec/ParsingDeclarator are still in scope. Diag(Old->getLocation(), diag::note_overridden_virtual_function) << Old->getReturnTypeSourceRange(); return true; } } // The qualifiers of the return types must be the same. if (NewTy.getLocalCVRQualifiers() != OldTy.getLocalCVRQualifiers()) { Diag(New->getLocation(), diag::err_covariant_return_type_different_qualifications) << New->getDeclName() << NewTy << OldTy << New->getReturnTypeSourceRange(); Diag(Old->getLocation(), diag::note_overridden_virtual_function) << Old->getReturnTypeSourceRange(); return true; } // The new class type must have the same or less qualifiers as the old type. if (NewClassTy.isMoreQualifiedThan(OldClassTy)) { Diag(New->getLocation(), diag::err_covariant_return_type_class_type_more_qualified) << New->getDeclName() << NewTy << OldTy << New->getReturnTypeSourceRange(); Diag(Old->getLocation(), diag::note_overridden_virtual_function) << Old->getReturnTypeSourceRange(); return true; } return false; } /// Mark the given method pure. /// /// \param Method the method to be marked pure. /// /// \param InitRange the source range that covers the "0" initializer. bool Sema::CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange) { SourceLocation EndLoc = InitRange.getEnd(); if (EndLoc.isValid()) Method->setRangeEnd(EndLoc); if (Method->isVirtual() || Method->getParent()->isDependentContext()) { Method->setPure(); return false; } if (!Method->isInvalidDecl()) Diag(Method->getLocation(), diag::err_non_virtual_pure) << Method->getDeclName() << InitRange; return true; } void Sema::ActOnPureSpecifier(Decl *D, SourceLocation ZeroLoc) { if (D->getFriendObjectKind()) Diag(D->getLocation(), diag::err_pure_friend); else if (auto *M = dyn_cast(D)) CheckPureMethod(M, ZeroLoc); else Diag(D->getLocation(), diag::err_illegal_initializer); } /// Determine whether the given declaration is a global variable or /// static data member. static bool isNonlocalVariable(const Decl *D) { if (const VarDecl *Var = dyn_cast_or_null(D)) return Var->hasGlobalStorage(); return false; } /// Invoked when we are about to parse an initializer for the declaration /// 'Dcl'. /// /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a /// static data member of class X, names should be looked up in the scope of /// class X. If the declaration had a scope specifier, a scope will have /// been created and passed in for this purpose. Otherwise, S will be null. void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl *D) { // If there is no declaration, there was an error parsing it. if (!D || D->isInvalidDecl()) return; // We will always have a nested name specifier here, but this declaration // might not be out of line if the specifier names the current namespace: // extern int n; // int ::n = 0; if (S && D->isOutOfLine()) EnterDeclaratorContext(S, D->getDeclContext()); // If we are parsing the initializer for a static data member, push a // new expression evaluation context that is associated with this static // data member. if (isNonlocalVariable(D)) PushExpressionEvaluationContext( ExpressionEvaluationContext::PotentiallyEvaluated, D); } /// Invoked after we are finished parsing an initializer for the declaration D. void Sema::ActOnCXXExitDeclInitializer(Scope *S, Decl *D) { // If there is no declaration, there was an error parsing it. if (!D || D->isInvalidDecl()) return; if (isNonlocalVariable(D)) PopExpressionEvaluationContext(); if (S && D->isOutOfLine()) ExitDeclaratorContext(S); } /// ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a /// C++ if/switch/while/for statement. /// e.g: "if (int x = f()) {...}" DeclResult Sema::ActOnCXXConditionDeclaration(Scope *S, Declarator &D) { // C++ 6.4p2: // The declarator shall not specify a function or an array. // The type-specifier-seq shall not contain typedef and shall not declare a // new class or enumeration. assert(D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef && "Parser allowed 'typedef' as storage class of condition decl."); Decl *Dcl = ActOnDeclarator(S, D); if (!Dcl) return true; if (isa(Dcl)) { // The declarator shall not specify a function. Diag(Dcl->getLocation(), diag::err_invalid_use_of_function_type) << D.getSourceRange(); return true; } return Dcl; } void Sema::LoadExternalVTableUses() { if (!ExternalSource) return; SmallVector VTables; ExternalSource->ReadUsedVTables(VTables); SmallVector NewUses; for (unsigned I = 0, N = VTables.size(); I != N; ++I) { llvm::DenseMap::iterator Pos = VTablesUsed.find(VTables[I].Record); // Even if a definition wasn't required before, it may be required now. if (Pos != VTablesUsed.end()) { if (!Pos->second && VTables[I].DefinitionRequired) Pos->second = true; continue; } VTablesUsed[VTables[I].Record] = VTables[I].DefinitionRequired; NewUses.push_back(VTableUse(VTables[I].Record, VTables[I].Location)); } VTableUses.insert(VTableUses.begin(), NewUses.begin(), NewUses.end()); } void Sema::MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired) { // Ignore any vtable uses in unevaluated operands or for classes that do // not have a vtable. if (!Class->isDynamicClass() || Class->isDependentContext() || CurContext->isDependentContext() || isUnevaluatedContext()) return; // Do not mark as used if compiling for the device outside of the target // region. if (LangOpts.OpenMP && LangOpts.OpenMPIsDevice && !isInOpenMPDeclareTargetContext() && !isInOpenMPTargetExecutionDirective()) { if (!DefinitionRequired) MarkVirtualMembersReferenced(Loc, Class); return; } // Try to insert this class into the map. LoadExternalVTableUses(); Class = Class->getCanonicalDecl(); std::pair::iterator, bool> Pos = VTablesUsed.insert(std::make_pair(Class, DefinitionRequired)); if (!Pos.second) { // If we already had an entry, check to see if we are promoting this vtable // to require a definition. If so, we need to reappend to the VTableUses // list, since we may have already processed the first entry. if (DefinitionRequired && !Pos.first->second) { Pos.first->second = true; } else { // Otherwise, we can early exit. return; } } else { // The Microsoft ABI requires that we perform the destructor body // checks (i.e. operator delete() lookup) when the vtable is marked used, as // the deleting destructor is emitted with the vtable, not with the // destructor definition as in the Itanium ABI. if (Context.getTargetInfo().getCXXABI().isMicrosoft()) { CXXDestructorDecl *DD = Class->getDestructor(); if (DD && DD->isVirtual() && !DD->isDeleted()) { if (Class->hasUserDeclaredDestructor() && !DD->isDefined()) { // If this is an out-of-line declaration, marking it referenced will // not do anything. Manually call CheckDestructor to look up operator // delete(). ContextRAII SavedContext(*this, DD); CheckDestructor(DD); } else { MarkFunctionReferenced(Loc, Class->getDestructor()); } } } } // Local classes need to have their virtual members marked // immediately. For all other classes, we mark their virtual members // at the end of the translation unit. if (Class->isLocalClass()) MarkVirtualMembersReferenced(Loc, Class); else VTableUses.push_back(std::make_pair(Class, Loc)); } bool Sema::DefineUsedVTables() { LoadExternalVTableUses(); if (VTableUses.empty()) return false; // Note: The VTableUses vector could grow as a result of marking // the members of a class as "used", so we check the size each // time through the loop and prefer indices (which are stable) to // iterators (which are not). bool DefinedAnything = false; for (unsigned I = 0; I != VTableUses.size(); ++I) { CXXRecordDecl *Class = VTableUses[I].first->getDefinition(); if (!Class) continue; TemplateSpecializationKind ClassTSK = Class->getTemplateSpecializationKind(); SourceLocation Loc = VTableUses[I].second; bool DefineVTable = true; // If this class has a key function, but that key function is // defined in another translation unit, we don't need to emit the // vtable even though we're using it. const CXXMethodDecl *KeyFunction = Context.getCurrentKeyFunction(Class); if (KeyFunction && !KeyFunction->hasBody()) { // The key function is in another translation unit. DefineVTable = false; TemplateSpecializationKind TSK = KeyFunction->getTemplateSpecializationKind(); assert(TSK != TSK_ExplicitInstantiationDefinition && TSK != TSK_ImplicitInstantiation && "Instantiations don't have key functions"); (void)TSK; } else if (!KeyFunction) { // If we have a class with no key function that is the subject // of an explicit instantiation declaration, suppress the // vtable; it will live with the explicit instantiation // definition. bool IsExplicitInstantiationDeclaration = ClassTSK == TSK_ExplicitInstantiationDeclaration; for (auto R : Class->redecls()) { TemplateSpecializationKind TSK = cast(R)->getTemplateSpecializationKind(); if (TSK == TSK_ExplicitInstantiationDeclaration) IsExplicitInstantiationDeclaration = true; else if (TSK == TSK_ExplicitInstantiationDefinition) { IsExplicitInstantiationDeclaration = false; break; } } if (IsExplicitInstantiationDeclaration) DefineVTable = false; } // The exception specifications for all virtual members may be needed even // if we are not providing an authoritative form of the vtable in this TU. // We may choose to emit it available_externally anyway. if (!DefineVTable) { MarkVirtualMemberExceptionSpecsNeeded(Loc, Class); continue; } // Mark all of the virtual members of this class as referenced, so // that we can build a vtable. Then, tell the AST consumer that a // vtable for this class is required. DefinedAnything = true; MarkVirtualMembersReferenced(Loc, Class); CXXRecordDecl *Canonical = Class->getCanonicalDecl(); if (VTablesUsed[Canonical]) Consumer.HandleVTable(Class); // Warn if we're emitting a weak vtable. The vtable will be weak if there is // no key function or the key function is inlined. Don't warn in C++ ABIs // that lack key functions, since the user won't be able to make one. if (Context.getTargetInfo().getCXXABI().hasKeyFunctions() && Class->isExternallyVisible() && ClassTSK != TSK_ImplicitInstantiation) { const FunctionDecl *KeyFunctionDef = nullptr; if (!KeyFunction || (KeyFunction->hasBody(KeyFunctionDef) && KeyFunctionDef->isInlined())) { Diag(Class->getLocation(), ClassTSK == TSK_ExplicitInstantiationDefinition ? diag::warn_weak_template_vtable : diag::warn_weak_vtable) << Class; } } } VTableUses.clear(); return DefinedAnything; } void Sema::MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD) { for (const auto *I : RD->methods()) if (I->isVirtual() && !I->isPure()) ResolveExceptionSpec(Loc, I->getType()->castAs()); } void Sema::MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD, bool ConstexprOnly) { // Mark all functions which will appear in RD's vtable as used. CXXFinalOverriderMap FinalOverriders; RD->getFinalOverriders(FinalOverriders); for (CXXFinalOverriderMap::const_iterator I = FinalOverriders.begin(), E = FinalOverriders.end(); I != E; ++I) { for (OverridingMethods::const_iterator OI = I->second.begin(), OE = I->second.end(); OI != OE; ++OI) { assert(OI->second.size() > 0 && "no final overrider"); CXXMethodDecl *Overrider = OI->second.front().Method; // C++ [basic.def.odr]p2: // [...] A virtual member function is used if it is not pure. [...] if (!Overrider->isPure() && (!ConstexprOnly || Overrider->isConstexpr())) MarkFunctionReferenced(Loc, Overrider); } } // Only classes that have virtual bases need a VTT. if (RD->getNumVBases() == 0) return; for (const auto &I : RD->bases()) { const CXXRecordDecl *Base = cast(I.getType()->getAs()->getDecl()); if (Base->getNumVBases() == 0) continue; MarkVirtualMembersReferenced(Loc, Base); } } /// SetIvarInitializers - This routine builds initialization ASTs for the /// Objective-C implementation whose ivars need be initialized. void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { if (!getLangOpts().CPlusPlus) return; if (ObjCInterfaceDecl *OID = ObjCImplementation->getClassInterface()) { SmallVector ivars; CollectIvarsToConstructOrDestruct(OID, ivars); if (ivars.empty()) return; SmallVector AllToInit; for (unsigned i = 0; i < ivars.size(); i++) { FieldDecl *Field = ivars[i]; if (Field->isInvalidDecl()) continue; CXXCtorInitializer *Member; InitializedEntity InitEntity = InitializedEntity::InitializeMember(Field); InitializationKind InitKind = InitializationKind::CreateDefault(ObjCImplementation->getLocation()); InitializationSequence InitSeq(*this, InitEntity, InitKind, None); ExprResult MemberInit = InitSeq.Perform(*this, InitEntity, InitKind, None); MemberInit = MaybeCreateExprWithCleanups(MemberInit); // Note, MemberInit could actually come back empty if no initialization // is required (e.g., because it would call a trivial default constructor) if (!MemberInit.get() || MemberInit.isInvalid()) continue; Member = new (Context) CXXCtorInitializer(Context, Field, SourceLocation(), SourceLocation(), MemberInit.getAs(), SourceLocation()); AllToInit.push_back(Member); // Be sure that the destructor is accessible and is marked as referenced. if (const RecordType *RecordTy = Context.getBaseElementType(Field->getType()) ->getAs()) { CXXRecordDecl *RD = cast(RecordTy->getDecl()); if (CXXDestructorDecl *Destructor = LookupDestructor(RD)) { MarkFunctionReferenced(Field->getLocation(), Destructor); CheckDestructorAccess(Field->getLocation(), Destructor, PDiag(diag::err_access_dtor_ivar) << Context.getBaseElementType(Field->getType())); } } } ObjCImplementation->setIvarInitializers(Context, AllToInit.data(), AllToInit.size()); } } static void DelegatingCycleHelper(CXXConstructorDecl* Ctor, llvm::SmallPtrSet &Valid, llvm::SmallPtrSet &Invalid, llvm::SmallPtrSet &Current, Sema &S) { if (Ctor->isInvalidDecl()) return; CXXConstructorDecl *Target = Ctor->getTargetConstructor(); // Target may not be determinable yet, for instance if this is a dependent // call in an uninstantiated template. if (Target) { const FunctionDecl *FNTarget = nullptr; (void)Target->hasBody(FNTarget); Target = const_cast( cast_or_null(FNTarget)); } CXXConstructorDecl *Canonical = Ctor->getCanonicalDecl(), // Avoid dereferencing a null pointer here. *TCanonical = Target? Target->getCanonicalDecl() : nullptr; if (!Current.insert(Canonical).second) return; // We know that beyond here, we aren't chaining into a cycle. if (!Target || !Target->isDelegatingConstructor() || Target->isInvalidDecl() || Valid.count(TCanonical)) { Valid.insert(Current.begin(), Current.end()); Current.clear(); // We've hit a cycle. } else if (TCanonical == Canonical || Invalid.count(TCanonical) || Current.count(TCanonical)) { // If we haven't diagnosed this cycle yet, do so now. if (!Invalid.count(TCanonical)) { S.Diag((*Ctor->init_begin())->getSourceLocation(), diag::warn_delegating_ctor_cycle) << Ctor; // Don't add a note for a function delegating directly to itself. if (TCanonical != Canonical) S.Diag(Target->getLocation(), diag::note_it_delegates_to); CXXConstructorDecl *C = Target; while (C->getCanonicalDecl() != Canonical) { const FunctionDecl *FNTarget = nullptr; (void)C->getTargetConstructor()->hasBody(FNTarget); assert(FNTarget && "Ctor cycle through bodiless function"); C = const_cast( cast(FNTarget)); S.Diag(C->getLocation(), diag::note_which_delegates_to); } } Invalid.insert(Current.begin(), Current.end()); Current.clear(); } else { DelegatingCycleHelper(Target, Valid, Invalid, Current, S); } } void Sema::CheckDelegatingCtorCycles() { llvm::SmallPtrSet Valid, Invalid, Current; for (DelegatingCtorDeclsType::iterator I = DelegatingCtorDecls.begin(ExternalSource), E = DelegatingCtorDecls.end(); I != E; ++I) DelegatingCycleHelper(*I, Valid, Invalid, Current, *this); for (auto CI = Invalid.begin(), CE = Invalid.end(); CI != CE; ++CI) (*CI)->setInvalidDecl(); } namespace { /// AST visitor that finds references to the 'this' expression. class FindCXXThisExpr : public RecursiveASTVisitor { Sema &S; public: explicit FindCXXThisExpr(Sema &S) : S(S) { } bool VisitCXXThisExpr(CXXThisExpr *E) { S.Diag(E->getLocation(), diag::err_this_static_member_func) << E->isImplicit(); return false; } }; } bool Sema::checkThisInStaticMemberFunctionType(CXXMethodDecl *Method) { TypeSourceInfo *TSInfo = Method->getTypeSourceInfo(); if (!TSInfo) return false; TypeLoc TL = TSInfo->getTypeLoc(); FunctionProtoTypeLoc ProtoTL = TL.getAs(); if (!ProtoTL) return false; // C++11 [expr.prim.general]p3: // [The expression this] shall not appear before the optional // cv-qualifier-seq and it shall not appear within the declaration of a // static member function (although its type and value category are defined // within a static member function as they are within a non-static member // function). [ Note: this is because declaration matching does not occur // until the complete declarator is known. - end note ] const FunctionProtoType *Proto = ProtoTL.getTypePtr(); FindCXXThisExpr Finder(*this); // If the return type came after the cv-qualifier-seq, check it now. if (Proto->hasTrailingReturn() && !Finder.TraverseTypeLoc(ProtoTL.getReturnLoc())) return true; // Check the exception specification. if (checkThisInStaticMemberFunctionExceptionSpec(Method)) return true; return checkThisInStaticMemberFunctionAttributes(Method); } bool Sema::checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method) { TypeSourceInfo *TSInfo = Method->getTypeSourceInfo(); if (!TSInfo) return false; TypeLoc TL = TSInfo->getTypeLoc(); FunctionProtoTypeLoc ProtoTL = TL.getAs(); if (!ProtoTL) return false; const FunctionProtoType *Proto = ProtoTL.getTypePtr(); FindCXXThisExpr Finder(*this); switch (Proto->getExceptionSpecType()) { case EST_Unparsed: case EST_Uninstantiated: case EST_Unevaluated: case EST_BasicNoexcept: case EST_NoThrow: case EST_DynamicNone: case EST_MSAny: case EST_None: break; case EST_DependentNoexcept: case EST_NoexceptFalse: case EST_NoexceptTrue: if (!Finder.TraverseStmt(Proto->getNoexceptExpr())) return true; LLVM_FALLTHROUGH; case EST_Dynamic: for (const auto &E : Proto->exceptions()) { if (!Finder.TraverseType(E)) return true; } break; } return false; } bool Sema::checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method) { FindCXXThisExpr Finder(*this); // Check attributes. for (const auto *A : Method->attrs()) { // FIXME: This should be emitted by tblgen. Expr *Arg = nullptr; ArrayRef Args; if (const auto *G = dyn_cast(A)) Arg = G->getArg(); else if (const auto *G = dyn_cast(A)) Arg = G->getArg(); else if (const auto *AA = dyn_cast(A)) Args = llvm::makeArrayRef(AA->args_begin(), AA->args_size()); else if (const auto *AB = dyn_cast(A)) Args = llvm::makeArrayRef(AB->args_begin(), AB->args_size()); else if (const auto *ETLF = dyn_cast(A)) { Arg = ETLF->getSuccessValue(); Args = llvm::makeArrayRef(ETLF->args_begin(), ETLF->args_size()); } else if (const auto *STLF = dyn_cast(A)) { Arg = STLF->getSuccessValue(); Args = llvm::makeArrayRef(STLF->args_begin(), STLF->args_size()); } else if (const auto *LR = dyn_cast(A)) Arg = LR->getArg(); else if (const auto *LE = dyn_cast(A)) Args = llvm::makeArrayRef(LE->args_begin(), LE->args_size()); else if (const auto *RC = dyn_cast(A)) Args = llvm::makeArrayRef(RC->args_begin(), RC->args_size()); else if (const auto *AC = dyn_cast(A)) Args = llvm::makeArrayRef(AC->args_begin(), AC->args_size()); else if (const auto *AC = dyn_cast(A)) Args = llvm::makeArrayRef(AC->args_begin(), AC->args_size()); else if (const auto *RC = dyn_cast(A)) Args = llvm::makeArrayRef(RC->args_begin(), RC->args_size()); if (Arg && !Finder.TraverseStmt(Arg)) return true; for (unsigned I = 0, N = Args.size(); I != N; ++I) { if (!Finder.TraverseStmt(Args[I])) return true; } } return false; } void Sema::checkExceptionSpecification( bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef DynamicExceptions, ArrayRef DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI) { Exceptions.clear(); ESI.Type = EST; if (EST == EST_Dynamic) { Exceptions.reserve(DynamicExceptions.size()); for (unsigned ei = 0, ee = DynamicExceptions.size(); ei != ee; ++ei) { // FIXME: Preserve type source info. QualType ET = GetTypeFromParser(DynamicExceptions[ei]); if (IsTopLevel) { SmallVector Unexpanded; collectUnexpandedParameterPacks(ET, Unexpanded); if (!Unexpanded.empty()) { DiagnoseUnexpandedParameterPacks( DynamicExceptionRanges[ei].getBegin(), UPPC_ExceptionType, Unexpanded); continue; } } // Check that the type is valid for an exception spec, and // drop it if not. if (!CheckSpecifiedExceptionType(ET, DynamicExceptionRanges[ei])) Exceptions.push_back(ET); } ESI.Exceptions = Exceptions; return; } if (isComputedNoexcept(EST)) { assert((NoexceptExpr->isTypeDependent() || NoexceptExpr->getType()->getCanonicalTypeUnqualified() == Context.BoolTy) && "Parser should have made sure that the expression is boolean"); if (IsTopLevel && DiagnoseUnexpandedParameterPack(NoexceptExpr)) { ESI.Type = EST_BasicNoexcept; return; } ESI.NoexceptExpr = NoexceptExpr; return; } } void Sema::actOnDelayedExceptionSpecification(Decl *MethodD, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef DynamicExceptions, ArrayRef DynamicExceptionRanges, Expr *NoexceptExpr) { if (!MethodD) return; // Dig out the method we're referring to. if (FunctionTemplateDecl *FunTmpl = dyn_cast(MethodD)) MethodD = FunTmpl->getTemplatedDecl(); CXXMethodDecl *Method = dyn_cast(MethodD); if (!Method) return; // Check the exception specification. llvm::SmallVector Exceptions; FunctionProtoType::ExceptionSpecInfo ESI; checkExceptionSpecification(/*IsTopLevel*/true, EST, DynamicExceptions, DynamicExceptionRanges, NoexceptExpr, Exceptions, ESI); // Update the exception specification on the function type. Context.adjustExceptionSpec(Method, ESI, /*AsWritten*/true); if (Method->isStatic()) checkThisInStaticMemberFunctionExceptionSpec(Method); if (Method->isVirtual()) { // Check overrides, which we previously had to delay. for (const CXXMethodDecl *O : Method->overridden_methods()) CheckOverridingFunctionExceptionSpec(Method, O); } } /// HandleMSProperty - Analyze a __delcspec(property) field of a C++ class. /// MSPropertyDecl *Sema::HandleMSProperty(Scope *S, RecordDecl *Record, SourceLocation DeclStart, Declarator &D, Expr *BitWidth, InClassInitStyle InitStyle, AccessSpecifier AS, const ParsedAttr &MSPropertyAttr) { IdentifierInfo *II = D.getIdentifier(); if (!II) { Diag(DeclStart, diag::err_anonymous_property); return nullptr; } SourceLocation Loc = D.getIdentifierLoc(); TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); QualType T = TInfo->getType(); if (getLangOpts().CPlusPlus) { CheckExtraCXXDefaultArguments(D); if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo, UPPC_DataMemberType)) { D.setInvalidType(); T = Context.IntTy; TInfo = Context.getTrivialTypeSourceInfo(T, Loc); } } DiagnoseFunctionSpecifiers(D.getDeclSpec()); if (D.getDeclSpec().isInlineSpecified()) Diag(D.getDeclSpec().getInlineSpecLoc(), diag::err_inline_non_function) << getLangOpts().CPlusPlus17; if (DeclSpec::TSCS TSCS = D.getDeclSpec().getThreadStorageClassSpec()) Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(), diag::err_invalid_thread) << DeclSpec::getSpecifierName(TSCS); // Check to see if this name was declared as a member previously NamedDecl *PrevDecl = nullptr; LookupResult Previous(*this, II, Loc, LookupMemberName, ForVisibleRedeclaration); LookupName(Previous, S); switch (Previous.getResultKind()) { case LookupResult::Found: case LookupResult::FoundUnresolvedValue: PrevDecl = Previous.getAsSingle(); break; case LookupResult::FoundOverloaded: PrevDecl = Previous.getRepresentativeDecl(); break; case LookupResult::NotFound: case LookupResult::NotFoundInCurrentInstantiation: case LookupResult::Ambiguous: break; } if (PrevDecl && PrevDecl->isTemplateParameter()) { // Maybe we will complain about the shadowed template parameter. DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl); // Just pretend that we didn't see the previous declaration. PrevDecl = nullptr; } if (PrevDecl && !isDeclInScope(PrevDecl, Record, S)) PrevDecl = nullptr; SourceLocation TSSL = D.getBeginLoc(); MSPropertyDecl *NewPD = MSPropertyDecl::Create(Context, Record, Loc, II, T, TInfo, TSSL, MSPropertyAttr.getPropertyDataGetter(), MSPropertyAttr.getPropertyDataSetter()); ProcessDeclAttributes(TUScope, NewPD, D); NewPD->setAccess(AS); if (NewPD->isInvalidDecl()) Record->setInvalidDecl(); if (D.getDeclSpec().isModulePrivateSpecified()) NewPD->setModulePrivate(); if (NewPD->isInvalidDecl() && PrevDecl) { // Don't introduce NewFD into scope; there's already something // with the same name in the same scope. } else if (II) { PushOnScopeChains(NewPD, S); } else Record->addDecl(NewPD); return NewPD; } Index: vendor/clang/dist-release_90/lib/Sema/SemaTemplate.cpp =================================================================== --- vendor/clang/dist-release_90/lib/Sema/SemaTemplate.cpp (revision 351710) +++ vendor/clang/dist-release_90/lib/Sema/SemaTemplate.cpp (revision 351711) @@ -1,10476 +1,10477 @@ //===------- SemaTemplate.cpp - Semantic Analysis for C++ Templates -------===// // // 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 //===----------------------------------------------------------------------===// // // This file implements semantic analysis for C++ templates. //===----------------------------------------------------------------------===// #include "TreeTransform.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclFriend.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/TypeVisitor.h" #include "clang/Basic/Builtins.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/PartialDiagnostic.h" #include "clang/Basic/TargetInfo.h" #include "clang/Sema/DeclSpec.h" #include "clang/Sema/Lookup.h" #include "clang/Sema/ParsedTemplate.h" #include "clang/Sema/Scope.h" #include "clang/Sema/SemaInternal.h" #include "clang/Sema/Template.h" #include "clang/Sema/TemplateDeduction.h" #include "llvm/ADT/SmallBitVector.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" #include using namespace clang; using namespace sema; // Exported for use by Parser. SourceRange clang::getTemplateParamsRange(TemplateParameterList const * const *Ps, unsigned N) { if (!N) return SourceRange(); return SourceRange(Ps[0]->getTemplateLoc(), Ps[N-1]->getRAngleLoc()); } namespace clang { /// [temp.constr.decl]p2: A template's associated constraints are /// defined as a single constraint-expression derived from the introduced /// constraint-expressions [ ... ]. /// /// \param Params The template parameter list and optional requires-clause. /// /// \param FD The underlying templated function declaration for a function /// template. static Expr *formAssociatedConstraints(TemplateParameterList *Params, FunctionDecl *FD); } static Expr *clang::formAssociatedConstraints(TemplateParameterList *Params, FunctionDecl *FD) { // FIXME: Concepts: collect additional introduced constraint-expressions assert(!FD && "Cannot collect constraints from function declaration yet."); return Params->getRequiresClause(); } /// Determine whether the declaration found is acceptable as the name /// of a template and, if so, return that template declaration. Otherwise, /// returns null. /// /// Note that this may return an UnresolvedUsingValueDecl if AllowDependent /// is true. In all other cases it will return a TemplateDecl (or null). NamedDecl *Sema::getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates, bool AllowDependent) { D = D->getUnderlyingDecl(); if (isa(D)) { if (!AllowFunctionTemplates && isa(D)) return nullptr; return D; } if (CXXRecordDecl *Record = dyn_cast(D)) { // C++ [temp.local]p1: // Like normal (non-template) classes, class templates have an // injected-class-name (Clause 9). The injected-class-name // can be used with or without a template-argument-list. When // it is used without a template-argument-list, it is // equivalent to the injected-class-name followed by the // template-parameters of the class template enclosed in // <>. When it is used with a template-argument-list, it // refers to the specified class template specialization, // which could be the current specialization or another // specialization. if (Record->isInjectedClassName()) { Record = cast(Record->getDeclContext()); if (Record->getDescribedClassTemplate()) return Record->getDescribedClassTemplate(); if (ClassTemplateSpecializationDecl *Spec = dyn_cast(Record)) return Spec->getSpecializedTemplate(); } return nullptr; } // 'using Dependent::foo;' can resolve to a template name. // 'using typename Dependent::foo;' cannot (not even if 'foo' is an // injected-class-name). if (AllowDependent && isa(D)) return D; return nullptr; } void Sema::FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates, bool AllowDependent) { LookupResult::Filter filter = R.makeFilter(); while (filter.hasNext()) { NamedDecl *Orig = filter.next(); if (!getAsTemplateNameDecl(Orig, AllowFunctionTemplates, AllowDependent)) filter.erase(); } filter.done(); } bool Sema::hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates, bool AllowDependent, bool AllowNonTemplateFunctions) { for (LookupResult::iterator I = R.begin(), IEnd = R.end(); I != IEnd; ++I) { if (getAsTemplateNameDecl(*I, AllowFunctionTemplates, AllowDependent)) return true; if (AllowNonTemplateFunctions && isa((*I)->getUnderlyingDecl())) return true; } return false; } TemplateNameKind Sema::isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectTypePtr, bool EnteringContext, TemplateTy &TemplateResult, bool &MemberOfUnknownSpecialization) { assert(getLangOpts().CPlusPlus && "No template names in C!"); DeclarationName TName; MemberOfUnknownSpecialization = false; switch (Name.getKind()) { case UnqualifiedIdKind::IK_Identifier: TName = DeclarationName(Name.Identifier); break; case UnqualifiedIdKind::IK_OperatorFunctionId: TName = Context.DeclarationNames.getCXXOperatorName( Name.OperatorFunctionId.Operator); break; case UnqualifiedIdKind::IK_LiteralOperatorId: TName = Context.DeclarationNames.getCXXLiteralOperatorName(Name.Identifier); break; default: return TNK_Non_template; } QualType ObjectType = ObjectTypePtr.get(); AssumedTemplateKind AssumedTemplate; LookupResult R(*this, TName, Name.getBeginLoc(), LookupOrdinaryName); if (LookupTemplateName(R, S, SS, ObjectType, EnteringContext, MemberOfUnknownSpecialization, SourceLocation(), &AssumedTemplate)) return TNK_Non_template; if (AssumedTemplate != AssumedTemplateKind::None) { TemplateResult = TemplateTy::make(Context.getAssumedTemplateName(TName)); // Let the parser know whether we found nothing or found functions; if we // found nothing, we want to more carefully check whether this is actually // a function template name versus some other kind of undeclared identifier. return AssumedTemplate == AssumedTemplateKind::FoundNothing ? TNK_Undeclared_template : TNK_Function_template; } if (R.empty()) return TNK_Non_template; NamedDecl *D = nullptr; if (R.isAmbiguous()) { // If we got an ambiguity involving a non-function template, treat this // as a template name, and pick an arbitrary template for error recovery. bool AnyFunctionTemplates = false; for (NamedDecl *FoundD : R) { if (NamedDecl *FoundTemplate = getAsTemplateNameDecl(FoundD)) { if (isa(FoundTemplate)) AnyFunctionTemplates = true; else { D = FoundTemplate; break; } } } // If we didn't find any templates at all, this isn't a template name. // Leave the ambiguity for a later lookup to diagnose. if (!D && !AnyFunctionTemplates) { R.suppressDiagnostics(); return TNK_Non_template; } // If the only templates were function templates, filter out the rest. // We'll diagnose the ambiguity later. if (!D) FilterAcceptableTemplateNames(R); } // At this point, we have either picked a single template name declaration D // or we have a non-empty set of results R containing either one template name // declaration or a set of function templates. TemplateName Template; TemplateNameKind TemplateKind; unsigned ResultCount = R.end() - R.begin(); if (!D && ResultCount > 1) { // We assume that we'll preserve the qualifier from a function // template name in other ways. Template = Context.getOverloadedTemplateName(R.begin(), R.end()); TemplateKind = TNK_Function_template; // We'll do this lookup again later. R.suppressDiagnostics(); } else { if (!D) { D = getAsTemplateNameDecl(*R.begin()); assert(D && "unambiguous result is not a template name"); } if (isa(D)) { // We don't yet know whether this is a template-name or not. MemberOfUnknownSpecialization = true; return TNK_Non_template; } TemplateDecl *TD = cast(D); if (SS.isSet() && !SS.isInvalid()) { NestedNameSpecifier *Qualifier = SS.getScopeRep(); Template = Context.getQualifiedTemplateName(Qualifier, hasTemplateKeyword, TD); } else { Template = TemplateName(TD); } if (isa(TD)) { TemplateKind = TNK_Function_template; // We'll do this lookup again later. R.suppressDiagnostics(); } else { assert(isa(TD) || isa(TD) || isa(TD) || isa(TD) || isa(TD) || isa(TD)); TemplateKind = isa(TD) ? TNK_Var_template : isa(TD) ? TNK_Concept_template : TNK_Type_template; } } TemplateResult = TemplateTy::make(Template); return TemplateKind; } bool Sema::isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, ParsedTemplateTy *Template) { CXXScopeSpec SS; bool MemberOfUnknownSpecialization = false; // We could use redeclaration lookup here, but we don't need to: the // syntactic form of a deduction guide is enough to identify it even // if we can't look up the template name at all. LookupResult R(*this, DeclarationName(&Name), NameLoc, LookupOrdinaryName); if (LookupTemplateName(R, S, SS, /*ObjectType*/ QualType(), /*EnteringContext*/ false, MemberOfUnknownSpecialization)) return false; if (R.empty()) return false; if (R.isAmbiguous()) { // FIXME: Diagnose an ambiguity if we find at least one template. R.suppressDiagnostics(); return false; } // We only treat template-names that name type templates as valid deduction // guide names. TemplateDecl *TD = R.getAsSingle(); if (!TD || !getAsTypeTemplateDecl(TD)) return false; if (Template) *Template = TemplateTy::make(TemplateName(TD)); return true; } bool Sema::DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind) { // We can't recover unless there's a dependent scope specifier preceding the // template name. // FIXME: Typo correction? if (!SS || !SS->isSet() || !isDependentScopeSpecifier(*SS) || computeDeclContext(*SS)) return false; // The code is missing a 'template' keyword prior to the dependent template // name. NestedNameSpecifier *Qualifier = (NestedNameSpecifier*)SS->getScopeRep(); Diag(IILoc, diag::err_template_kw_missing) << Qualifier << II.getName() << FixItHint::CreateInsertion(IILoc, "template "); SuggestedTemplate = TemplateTy::make(Context.getDependentTemplateName(Qualifier, &II)); SuggestedKind = TNK_Dependent_template_name; return true; } bool Sema::LookupTemplateName(LookupResult &Found, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization, SourceLocation TemplateKWLoc, AssumedTemplateKind *ATK) { if (ATK) *ATK = AssumedTemplateKind::None; Found.setTemplateNameLookup(true); // Determine where to perform name lookup MemberOfUnknownSpecialization = false; DeclContext *LookupCtx = nullptr; bool IsDependent = false; if (!ObjectType.isNull()) { // This nested-name-specifier occurs in a member access expression, e.g., // x->B::f, and we are looking into the type of the object. assert(!SS.isSet() && "ObjectType and scope specifier cannot coexist"); LookupCtx = computeDeclContext(ObjectType); IsDependent = !LookupCtx && ObjectType->isDependentType(); assert((IsDependent || !ObjectType->isIncompleteType() || ObjectType->castAs()->isBeingDefined()) && "Caller should have completed object type"); // Template names cannot appear inside an Objective-C class or object type // or a vector type. // // FIXME: This is wrong. For example: // // template using Vec = T __attribute__((ext_vector_type(4))); // Vec vi; // vi.Vec::~Vec(); // // ... should be accepted but we will not treat 'Vec' as a template name // here. The right thing to do would be to check if the name is a valid // vector component name, and look up a template name if not. And similarly // for lookups into Objective-C class and object types, where the same // problem can arise. if (ObjectType->isObjCObjectOrInterfaceType() || ObjectType->isVectorType()) { Found.clear(); return false; } } else if (SS.isSet()) { // This nested-name-specifier occurs after another nested-name-specifier, // so long into the context associated with the prior nested-name-specifier. LookupCtx = computeDeclContext(SS, EnteringContext); IsDependent = !LookupCtx; // The declaration context must be complete. if (LookupCtx && RequireCompleteDeclContext(SS, LookupCtx)) return true; } bool ObjectTypeSearchedInScope = false; bool AllowFunctionTemplatesInLookup = true; if (LookupCtx) { // Perform "qualified" name lookup into the declaration context we // computed, which is either the type of the base of a member access // expression or the declaration context associated with a prior // nested-name-specifier. LookupQualifiedName(Found, LookupCtx); // FIXME: The C++ standard does not clearly specify what happens in the // case where the object type is dependent, and implementations vary. In // Clang, we treat a name after a . or -> as a template-name if lookup // finds a non-dependent member or member of the current instantiation that // is a type template, or finds no such members and lookup in the context // of the postfix-expression finds a type template. In the latter case, the // name is nonetheless dependent, and we may resolve it to a member of an // unknown specialization when we come to instantiate the template. IsDependent |= Found.wasNotFoundInCurrentInstantiation(); } if (!SS.isSet() && (ObjectType.isNull() || Found.empty())) { // C++ [basic.lookup.classref]p1: // In a class member access expression (5.2.5), if the . or -> token is // immediately followed by an identifier followed by a <, the // identifier must be looked up to determine whether the < is the // beginning of a template argument list (14.2) or a less-than operator. // The identifier is first looked up in the class of the object // expression. If the identifier is not found, it is then looked up in // the context of the entire postfix-expression and shall name a class // template. if (S) LookupName(Found, S); if (!ObjectType.isNull()) { // FIXME: We should filter out all non-type templates here, particularly // variable templates and concepts. But the exclusion of alias templates // and template template parameters is a wording defect. AllowFunctionTemplatesInLookup = false; ObjectTypeSearchedInScope = true; } IsDependent |= Found.wasNotFoundInCurrentInstantiation(); } if (Found.isAmbiguous()) return false; if (ATK && !SS.isSet() && ObjectType.isNull() && TemplateKWLoc.isInvalid()) { // C++2a [temp.names]p2: // A name is also considered to refer to a template if it is an // unqualified-id followed by a < and name lookup finds either one or more // functions or finds nothing. // // To keep our behavior consistent, we apply the "finds nothing" part in // all language modes, and diagnose the empty lookup in ActOnCallExpr if we // successfully form a call to an undeclared template-id. bool AllFunctions = getLangOpts().CPlusPlus2a && std::all_of(Found.begin(), Found.end(), [](NamedDecl *ND) { return isa(ND->getUnderlyingDecl()); }); if (AllFunctions || (Found.empty() && !IsDependent)) { // If lookup found any functions, or if this is a name that can only be // used for a function, then strongly assume this is a function // template-id. *ATK = (Found.empty() && Found.getLookupName().isIdentifier()) ? AssumedTemplateKind::FoundNothing : AssumedTemplateKind::FoundFunctions; Found.clear(); return false; } } if (Found.empty() && !IsDependent) { // If we did not find any names, attempt to correct any typos. DeclarationName Name = Found.getLookupName(); Found.clear(); // Simple filter callback that, for keywords, only accepts the C++ *_cast DefaultFilterCCC FilterCCC{}; FilterCCC.WantTypeSpecifiers = false; FilterCCC.WantExpressionKeywords = false; FilterCCC.WantRemainingKeywords = false; FilterCCC.WantCXXNamedCasts = true; if (TypoCorrection Corrected = CorrectTypo(Found.getLookupNameInfo(), Found.getLookupKind(), S, &SS, FilterCCC, CTK_ErrorRecovery, LookupCtx)) { if (auto *ND = Corrected.getFoundDecl()) Found.addDecl(ND); FilterAcceptableTemplateNames(Found); if (Found.isAmbiguous()) { Found.clear(); } else if (!Found.empty()) { Found.setLookupName(Corrected.getCorrection()); if (LookupCtx) { std::string CorrectedStr(Corrected.getAsString(getLangOpts())); bool DroppedSpecifier = Corrected.WillReplaceSpecifier() && Name.getAsString() == CorrectedStr; diagnoseTypo(Corrected, PDiag(diag::err_no_member_template_suggest) << Name << LookupCtx << DroppedSpecifier << SS.getRange()); } else { diagnoseTypo(Corrected, PDiag(diag::err_no_template_suggest) << Name); } } } } NamedDecl *ExampleLookupResult = Found.empty() ? nullptr : Found.getRepresentativeDecl(); FilterAcceptableTemplateNames(Found, AllowFunctionTemplatesInLookup); if (Found.empty()) { if (IsDependent) { MemberOfUnknownSpecialization = true; return false; } // If a 'template' keyword was used, a lookup that finds only non-template // names is an error. if (ExampleLookupResult && TemplateKWLoc.isValid()) { Diag(Found.getNameLoc(), diag::err_template_kw_refers_to_non_template) << Found.getLookupName() << SS.getRange(); Diag(ExampleLookupResult->getUnderlyingDecl()->getLocation(), diag::note_template_kw_refers_to_non_template) << Found.getLookupName(); return true; } return false; } if (S && !ObjectType.isNull() && !ObjectTypeSearchedInScope && !getLangOpts().CPlusPlus11) { // C++03 [basic.lookup.classref]p1: // [...] If the lookup in the class of the object expression finds a // template, the name is also looked up in the context of the entire // postfix-expression and [...] // // Note: C++11 does not perform this second lookup. LookupResult FoundOuter(*this, Found.getLookupName(), Found.getNameLoc(), LookupOrdinaryName); FoundOuter.setTemplateNameLookup(true); LookupName(FoundOuter, S); // FIXME: We silently accept an ambiguous lookup here, in violation of // [basic.lookup]/1. FilterAcceptableTemplateNames(FoundOuter, /*AllowFunctionTemplates=*/false); NamedDecl *OuterTemplate; if (FoundOuter.empty()) { // - if the name is not found, the name found in the class of the // object expression is used, otherwise } else if (FoundOuter.isAmbiguous() || !FoundOuter.isSingleResult() || !(OuterTemplate = getAsTemplateNameDecl(FoundOuter.getFoundDecl()))) { // - if the name is found in the context of the entire // postfix-expression and does not name a class template, the name // found in the class of the object expression is used, otherwise FoundOuter.clear(); } else if (!Found.isSuppressingDiagnostics()) { // - if the name found is a class template, it must refer to the same // entity as the one found in the class of the object expression, // otherwise the program is ill-formed. if (!Found.isSingleResult() || getAsTemplateNameDecl(Found.getFoundDecl())->getCanonicalDecl() != OuterTemplate->getCanonicalDecl()) { Diag(Found.getNameLoc(), diag::ext_nested_name_member_ref_lookup_ambiguous) << Found.getLookupName() << ObjectType; Diag(Found.getRepresentativeDecl()->getLocation(), diag::note_ambig_member_ref_object_type) << ObjectType; Diag(FoundOuter.getFoundDecl()->getLocation(), diag::note_ambig_member_ref_scope); // Recover by taking the template that we found in the object // expression's type. } } } return false; } void Sema::diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater) { if (TemplateName.isInvalid()) return; DeclarationNameInfo NameInfo; CXXScopeSpec SS; LookupNameKind LookupKind; DeclContext *LookupCtx = nullptr; NamedDecl *Found = nullptr; bool MissingTemplateKeyword = false; // Figure out what name we looked up. if (auto *DRE = dyn_cast(TemplateName.get())) { NameInfo = DRE->getNameInfo(); SS.Adopt(DRE->getQualifierLoc()); LookupKind = LookupOrdinaryName; Found = DRE->getFoundDecl(); } else if (auto *ME = dyn_cast(TemplateName.get())) { NameInfo = ME->getMemberNameInfo(); SS.Adopt(ME->getQualifierLoc()); LookupKind = LookupMemberName; LookupCtx = ME->getBase()->getType()->getAsCXXRecordDecl(); Found = ME->getMemberDecl(); } else if (auto *DSDRE = dyn_cast(TemplateName.get())) { NameInfo = DSDRE->getNameInfo(); SS.Adopt(DSDRE->getQualifierLoc()); MissingTemplateKeyword = true; } else if (auto *DSME = dyn_cast(TemplateName.get())) { NameInfo = DSME->getMemberNameInfo(); SS.Adopt(DSME->getQualifierLoc()); MissingTemplateKeyword = true; } else { llvm_unreachable("unexpected kind of potential template name"); } // If this is a dependent-scope lookup, diagnose that the 'template' keyword // was missing. if (MissingTemplateKeyword) { Diag(NameInfo.getBeginLoc(), diag::err_template_kw_missing) << "" << NameInfo.getName().getAsString() << SourceRange(Less, Greater); return; } // Try to correct the name by looking for templates and C++ named casts. struct TemplateCandidateFilter : CorrectionCandidateCallback { Sema &S; TemplateCandidateFilter(Sema &S) : S(S) { WantTypeSpecifiers = false; WantExpressionKeywords = false; WantRemainingKeywords = false; WantCXXNamedCasts = true; }; bool ValidateCandidate(const TypoCorrection &Candidate) override { if (auto *ND = Candidate.getCorrectionDecl()) return S.getAsTemplateNameDecl(ND); return Candidate.isKeyword(); } std::unique_ptr clone() override { return llvm::make_unique(*this); } }; DeclarationName Name = NameInfo.getName(); TemplateCandidateFilter CCC(*this); if (TypoCorrection Corrected = CorrectTypo(NameInfo, LookupKind, S, &SS, CCC, CTK_ErrorRecovery, LookupCtx)) { auto *ND = Corrected.getFoundDecl(); if (ND) ND = getAsTemplateNameDecl(ND); if (ND || Corrected.isKeyword()) { if (LookupCtx) { std::string CorrectedStr(Corrected.getAsString(getLangOpts())); bool DroppedSpecifier = Corrected.WillReplaceSpecifier() && Name.getAsString() == CorrectedStr; diagnoseTypo(Corrected, PDiag(diag::err_non_template_in_member_template_id_suggest) << Name << LookupCtx << DroppedSpecifier << SS.getRange(), false); } else { diagnoseTypo(Corrected, PDiag(diag::err_non_template_in_template_id_suggest) << Name, false); } if (Found) Diag(Found->getLocation(), diag::note_non_template_in_template_id_found); return; } } Diag(NameInfo.getLoc(), diag::err_non_template_in_template_id) << Name << SourceRange(Less, Greater); if (Found) Diag(Found->getLocation(), diag::note_non_template_in_template_id_found); } /// ActOnDependentIdExpression - Handle a dependent id-expression that /// was just parsed. This is only possible with an explicit scope /// specifier naming a dependent type. ExprResult Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs) { DeclContext *DC = getFunctionLevelDeclContext(); // C++11 [expr.prim.general]p12: // An id-expression that denotes a non-static data member or non-static // member function of a class can only be used: // (...) // - if that id-expression denotes a non-static data member and it // appears in an unevaluated operand. // // If this might be the case, form a DependentScopeDeclRefExpr instead of a // CXXDependentScopeMemberExpr. The former can instantiate to either // DeclRefExpr or MemberExpr depending on lookup results, while the latter is // always a MemberExpr. bool MightBeCxx11UnevalField = getLangOpts().CPlusPlus11 && isUnevaluatedContext(); // Check if the nested name specifier is an enum type. bool IsEnum = false; if (NestedNameSpecifier *NNS = SS.getScopeRep()) IsEnum = dyn_cast_or_null(NNS->getAsType()); if (!MightBeCxx11UnevalField && !isAddressOfOperand && !IsEnum && isa(DC) && cast(DC)->isInstance()) { QualType ThisType = cast(DC)->getThisType(); // Since the 'this' expression is synthesized, we don't need to // perform the double-lookup check. NamedDecl *FirstQualifierInScope = nullptr; return CXXDependentScopeMemberExpr::Create( Context, /*This*/ nullptr, ThisType, /*IsArrow*/ true, /*Op*/ SourceLocation(), SS.getWithLocInContext(Context), TemplateKWLoc, FirstQualifierInScope, NameInfo, TemplateArgs); } return BuildDependentDeclRefExpr(SS, TemplateKWLoc, NameInfo, TemplateArgs); } ExprResult Sema::BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs) { return DependentScopeDeclRefExpr::Create( Context, SS.getWithLocInContext(Context), TemplateKWLoc, NameInfo, TemplateArgs); } /// Determine whether we would be unable to instantiate this template (because /// it either has no definition, or is in the process of being instantiated). bool Sema::DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain /*= true*/) { assert(isa(Instantiation) || isa(Instantiation) || isa(Instantiation)); bool IsEntityBeingDefined = false; if (const TagDecl *TD = dyn_cast_or_null(PatternDef)) IsEntityBeingDefined = TD->isBeingDefined(); if (PatternDef && !IsEntityBeingDefined) { NamedDecl *SuggestedDef = nullptr; if (!hasVisibleDefinition(const_cast(PatternDef), &SuggestedDef, /*OnlyNeedComplete*/false)) { // If we're allowed to diagnose this and recover, do so. bool Recover = Complain && !isSFINAEContext(); if (Complain) diagnoseMissingImport(PointOfInstantiation, SuggestedDef, Sema::MissingImportKind::Definition, Recover); return !Recover; } return false; } if (!Complain || (PatternDef && PatternDef->isInvalidDecl())) return true; llvm::Optional Note; QualType InstantiationTy; if (TagDecl *TD = dyn_cast(Instantiation)) InstantiationTy = Context.getTypeDeclType(TD); if (PatternDef) { Diag(PointOfInstantiation, diag::err_template_instantiate_within_definition) << /*implicit|explicit*/(TSK != TSK_ImplicitInstantiation) << InstantiationTy; // Not much point in noting the template declaration here, since // we're lexically inside it. Instantiation->setInvalidDecl(); } else if (InstantiatedFromMember) { if (isa(Instantiation)) { Diag(PointOfInstantiation, diag::err_explicit_instantiation_undefined_member) << /*member function*/ 1 << Instantiation->getDeclName() << Instantiation->getDeclContext(); Note = diag::note_explicit_instantiation_here; } else { assert(isa(Instantiation) && "Must be a TagDecl!"); Diag(PointOfInstantiation, diag::err_implicit_instantiate_member_undefined) << InstantiationTy; Note = diag::note_member_declared_at; } } else { if (isa(Instantiation)) { Diag(PointOfInstantiation, diag::err_explicit_instantiation_undefined_func_template) << Pattern; Note = diag::note_explicit_instantiation_here; } else if (isa(Instantiation)) { Diag(PointOfInstantiation, diag::err_template_instantiate_undefined) << (TSK != TSK_ImplicitInstantiation) << InstantiationTy; Note = diag::note_template_decl_here; } else { assert(isa(Instantiation) && "Must be a VarDecl!"); if (isa(Instantiation)) { Diag(PointOfInstantiation, diag::err_explicit_instantiation_undefined_var_template) << Instantiation; Instantiation->setInvalidDecl(); } else Diag(PointOfInstantiation, diag::err_explicit_instantiation_undefined_member) << /*static data member*/ 2 << Instantiation->getDeclName() << Instantiation->getDeclContext(); Note = diag::note_explicit_instantiation_here; } } if (Note) // Diagnostics were emitted. Diag(Pattern->getLocation(), Note.getValue()); // In general, Instantiation isn't marked invalid to get more than one // error for multiple undefined instantiations. But the code that does // explicit declaration -> explicit definition conversion can't handle // invalid declarations, so mark as invalid in that case. if (TSK == TSK_ExplicitInstantiationDeclaration) Instantiation->setInvalidDecl(); return true; } /// DiagnoseTemplateParameterShadow - Produce a diagnostic complaining /// that the template parameter 'PrevDecl' is being shadowed by a new /// declaration at location Loc. Returns true to indicate that this is /// an error, and false otherwise. void Sema::DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl) { assert(PrevDecl->isTemplateParameter() && "Not a template parameter"); // Microsoft Visual C++ permits template parameters to be shadowed. if (getLangOpts().MicrosoftExt) return; // C++ [temp.local]p4: // A template-parameter shall not be redeclared within its // scope (including nested scopes). Diag(Loc, diag::err_template_param_shadow) << cast(PrevDecl)->getDeclName(); Diag(PrevDecl->getLocation(), diag::note_template_param_here); } /// AdjustDeclIfTemplate - If the given decl happens to be a template, reset /// the parameter D to reference the templated declaration and return a pointer /// to the template declaration. Otherwise, do nothing to D and return null. TemplateDecl *Sema::AdjustDeclIfTemplate(Decl *&D) { if (TemplateDecl *Temp = dyn_cast_or_null(D)) { D = Temp->getTemplatedDecl(); return Temp; } return nullptr; } ParsedTemplateArgument ParsedTemplateArgument::getTemplatePackExpansion( SourceLocation EllipsisLoc) const { assert(Kind == Template && "Only template template arguments can be pack expansions here"); assert(getAsTemplate().get().containsUnexpandedParameterPack() && "Template template argument pack expansion without packs"); ParsedTemplateArgument Result(*this); Result.EllipsisLoc = EllipsisLoc; return Result; } static TemplateArgumentLoc translateTemplateArgument(Sema &SemaRef, const ParsedTemplateArgument &Arg) { switch (Arg.getKind()) { case ParsedTemplateArgument::Type: { TypeSourceInfo *DI; QualType T = SemaRef.GetTypeFromParser(Arg.getAsType(), &DI); if (!DI) DI = SemaRef.Context.getTrivialTypeSourceInfo(T, Arg.getLocation()); return TemplateArgumentLoc(TemplateArgument(T), DI); } case ParsedTemplateArgument::NonType: { Expr *E = static_cast(Arg.getAsExpr()); return TemplateArgumentLoc(TemplateArgument(E), E); } case ParsedTemplateArgument::Template: { TemplateName Template = Arg.getAsTemplate().get(); TemplateArgument TArg; if (Arg.getEllipsisLoc().isValid()) TArg = TemplateArgument(Template, Optional()); else TArg = Template; return TemplateArgumentLoc(TArg, Arg.getScopeSpec().getWithLocInContext( SemaRef.Context), Arg.getLocation(), Arg.getEllipsisLoc()); } } llvm_unreachable("Unhandled parsed template argument"); } /// Translates template arguments as provided by the parser /// into template arguments used by semantic analysis. void Sema::translateTemplateArguments(const ASTTemplateArgsPtr &TemplateArgsIn, TemplateArgumentListInfo &TemplateArgs) { for (unsigned I = 0, Last = TemplateArgsIn.size(); I != Last; ++I) TemplateArgs.addArgument(translateTemplateArgument(*this, TemplateArgsIn[I])); } static void maybeDiagnoseTemplateParameterShadow(Sema &SemaRef, Scope *S, SourceLocation Loc, IdentifierInfo *Name) { NamedDecl *PrevDecl = SemaRef.LookupSingleName( S, Name, Loc, Sema::LookupOrdinaryName, Sema::ForVisibleRedeclaration); if (PrevDecl && PrevDecl->isTemplateParameter()) SemaRef.DiagnoseTemplateParameterShadow(Loc, PrevDecl); } /// Convert a parsed type into a parsed template argument. This is mostly /// trivial, except that we may have parsed a C++17 deduced class template /// specialization type, in which case we should form a template template /// argument instead of a type template argument. ParsedTemplateArgument Sema::ActOnTemplateTypeArgument(TypeResult ParsedType) { TypeSourceInfo *TInfo; QualType T = GetTypeFromParser(ParsedType.get(), &TInfo); if (T.isNull()) return ParsedTemplateArgument(); assert(TInfo && "template argument with no location"); // If we might have formed a deduced template specialization type, convert // it to a template template argument. if (getLangOpts().CPlusPlus17) { TypeLoc TL = TInfo->getTypeLoc(); SourceLocation EllipsisLoc; if (auto PET = TL.getAs()) { EllipsisLoc = PET.getEllipsisLoc(); TL = PET.getPatternLoc(); } CXXScopeSpec SS; if (auto ET = TL.getAs()) { SS.Adopt(ET.getQualifierLoc()); TL = ET.getNamedTypeLoc(); } if (auto DTST = TL.getAs()) { TemplateName Name = DTST.getTypePtr()->getTemplateName(); if (SS.isSet()) Name = Context.getQualifiedTemplateName(SS.getScopeRep(), /*HasTemplateKeyword*/ false, Name.getAsTemplateDecl()); ParsedTemplateArgument Result(SS, TemplateTy::make(Name), DTST.getTemplateNameLoc()); if (EllipsisLoc.isValid()) Result = Result.getTemplatePackExpansion(EllipsisLoc); return Result; } } // This is a normal type template argument. Note, if the type template // argument is an injected-class-name for a template, it has a dual nature // and can be used as either a type or a template. We handle that in // convertTypeTemplateArgumentToTemplate. return ParsedTemplateArgument(ParsedTemplateArgument::Type, ParsedType.get().getAsOpaquePtr(), TInfo->getTypeLoc().getBeginLoc()); } /// ActOnTypeParameter - Called when a C++ template type parameter /// (e.g., "typename T") has been parsed. Typename specifies whether /// the keyword "typename" was used to declare the type parameter /// (otherwise, "class" was used), and KeyLoc is the location of the /// "class" or "typename" keyword. ParamName is the name of the /// parameter (NULL indicates an unnamed template parameter) and /// ParamNameLoc is the location of the parameter name (if any). /// If the type parameter has a default argument, it will be added /// later via ActOnTypeParameterDefault. NamedDecl *Sema::ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg) { assert(S->isTemplateParamScope() && "Template type parameter not in template parameter scope!"); SourceLocation Loc = ParamNameLoc; if (!ParamName) Loc = KeyLoc; bool IsParameterPack = EllipsisLoc.isValid(); TemplateTypeParmDecl *Param = TemplateTypeParmDecl::Create(Context, Context.getTranslationUnitDecl(), KeyLoc, Loc, Depth, Position, ParamName, Typename, IsParameterPack); Param->setAccess(AS_public); if (ParamName) { maybeDiagnoseTemplateParameterShadow(*this, S, ParamNameLoc, ParamName); // Add the template parameter into the current scope. S->AddDecl(Param); IdResolver.AddDecl(Param); } // C++0x [temp.param]p9: // A default template-argument may be specified for any kind of // template-parameter that is not a template parameter pack. if (DefaultArg && IsParameterPack) { Diag(EqualLoc, diag::err_template_param_pack_default_arg); DefaultArg = nullptr; } // Handle the default argument, if provided. if (DefaultArg) { TypeSourceInfo *DefaultTInfo; GetTypeFromParser(DefaultArg, &DefaultTInfo); assert(DefaultTInfo && "expected source information for type"); // Check for unexpanded parameter packs. if (DiagnoseUnexpandedParameterPack(Loc, DefaultTInfo, UPPC_DefaultArgument)) return Param; // Check the template argument itself. if (CheckTemplateArgument(Param, DefaultTInfo)) { Param->setInvalidDecl(); return Param; } Param->setDefaultArgument(DefaultTInfo); } return Param; } /// Check that the type of a non-type template parameter is /// well-formed. /// /// \returns the (possibly-promoted) parameter type if valid; /// otherwise, produces a diagnostic and returns a NULL type. QualType Sema::CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc) { if (TSI->getType()->isUndeducedType()) { // C++17 [temp.dep.expr]p3: // An id-expression is type-dependent if it contains // - an identifier associated by name lookup with a non-type // template-parameter declared with a type that contains a // placeholder type (7.1.7.4), TSI = SubstAutoTypeSourceInfo(TSI, Context.DependentTy); } return CheckNonTypeTemplateParameterType(TSI->getType(), Loc); } QualType Sema::CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc) { // We don't allow variably-modified types as the type of non-type template // parameters. if (T->isVariablyModifiedType()) { Diag(Loc, diag::err_variably_modified_nontype_template_param) << T; return QualType(); } // C++ [temp.param]p4: // // A non-type template-parameter shall have one of the following // (optionally cv-qualified) types: // // -- integral or enumeration type, if (T->isIntegralOrEnumerationType() || // -- pointer to object or pointer to function, T->isPointerType() || // -- reference to object or reference to function, T->isReferenceType() || // -- pointer to member, T->isMemberPointerType() || // -- std::nullptr_t. T->isNullPtrType() || // If T is a dependent type, we can't do the check now, so we // assume that it is well-formed. T->isDependentType() || // Allow use of auto in template parameter declarations. T->isUndeducedType()) { // C++ [temp.param]p5: The top-level cv-qualifiers on the template-parameter // are ignored when determining its type. return T.getUnqualifiedType(); } // C++ [temp.param]p8: // // A non-type template-parameter of type "array of T" or // "function returning T" is adjusted to be of type "pointer to // T" or "pointer to function returning T", respectively. else if (T->isArrayType() || T->isFunctionType()) return Context.getDecayedType(T); Diag(Loc, diag::err_template_nontype_parm_bad_type) << T; return QualType(); } NamedDecl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *Default) { TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); // Check that we have valid decl-specifiers specified. auto CheckValidDeclSpecifiers = [this, &D] { // C++ [temp.param] // p1 // template-parameter: // ... // parameter-declaration // p2 // ... A storage class shall not be specified in a template-parameter // declaration. // [dcl.typedef]p1: // The typedef specifier [...] shall not be used in the decl-specifier-seq // of a parameter-declaration const DeclSpec &DS = D.getDeclSpec(); auto EmitDiag = [this](SourceLocation Loc) { Diag(Loc, diag::err_invalid_decl_specifier_in_nontype_parm) << FixItHint::CreateRemoval(Loc); }; if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified) EmitDiag(DS.getStorageClassSpecLoc()); if (DS.getThreadStorageClassSpec() != TSCS_unspecified) EmitDiag(DS.getThreadStorageClassSpecLoc()); // [dcl.inline]p1: // The inline specifier can be applied only to the declaration or // definition of a variable or function. if (DS.isInlineSpecified()) EmitDiag(DS.getInlineSpecLoc()); // [dcl.constexpr]p1: // The constexpr specifier shall be applied only to the definition of a // variable or variable template or the declaration of a function or // function template. if (DS.hasConstexprSpecifier()) EmitDiag(DS.getConstexprSpecLoc()); // [dcl.fct.spec]p1: // Function-specifiers can be used only in function declarations. if (DS.isVirtualSpecified()) EmitDiag(DS.getVirtualSpecLoc()); if (DS.hasExplicitSpecifier()) EmitDiag(DS.getExplicitSpecLoc()); if (DS.isNoreturnSpecified()) EmitDiag(DS.getNoreturnSpecLoc()); }; CheckValidDeclSpecifiers(); if (TInfo->getType()->isUndeducedType()) { Diag(D.getIdentifierLoc(), diag::warn_cxx14_compat_template_nontype_parm_auto_type) << QualType(TInfo->getType()->getContainedAutoType(), 0); } assert(S->isTemplateParamScope() && "Non-type template parameter not in template parameter scope!"); bool Invalid = false; QualType T = CheckNonTypeTemplateParameterType(TInfo, D.getIdentifierLoc()); if (T.isNull()) { T = Context.IntTy; // Recover with an 'int' type. Invalid = true; } CheckFunctionOrTemplateParamDeclarator(S, D); IdentifierInfo *ParamName = D.getIdentifier(); bool IsParameterPack = D.hasEllipsis(); NonTypeTemplateParmDecl *Param = NonTypeTemplateParmDecl::Create( Context, Context.getTranslationUnitDecl(), D.getBeginLoc(), D.getIdentifierLoc(), Depth, Position, ParamName, T, IsParameterPack, TInfo); Param->setAccess(AS_public); if (Invalid) Param->setInvalidDecl(); if (ParamName) { maybeDiagnoseTemplateParameterShadow(*this, S, D.getIdentifierLoc(), ParamName); // Add the template parameter into the current scope. S->AddDecl(Param); IdResolver.AddDecl(Param); } // C++0x [temp.param]p9: // A default template-argument may be specified for any kind of // template-parameter that is not a template parameter pack. if (Default && IsParameterPack) { Diag(EqualLoc, diag::err_template_param_pack_default_arg); Default = nullptr; } // Check the well-formedness of the default template argument, if provided. if (Default) { // Check for unexpanded parameter packs. if (DiagnoseUnexpandedParameterPack(Default, UPPC_DefaultArgument)) return Param; TemplateArgument Converted; ExprResult DefaultRes = CheckTemplateArgument(Param, Param->getType(), Default, Converted); if (DefaultRes.isInvalid()) { Param->setInvalidDecl(); return Param; } Default = DefaultRes.get(); Param->setDefaultArgument(Default); } return Param; } /// ActOnTemplateTemplateParameter - Called when a C++ template template /// parameter (e.g. T in template