xref: /freebsd/contrib/llvm-project/clang/lib/Basic/Targets/VE.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
15ffd83dbSDimitry Andric //===--- VE.cpp - Implement VE target feature support ---------------------===//
25ffd83dbSDimitry Andric //
35ffd83dbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45ffd83dbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
55ffd83dbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65ffd83dbSDimitry Andric //
75ffd83dbSDimitry Andric //===----------------------------------------------------------------------===//
85ffd83dbSDimitry Andric //
95ffd83dbSDimitry Andric // This file implements VE TargetInfo objects.
105ffd83dbSDimitry Andric //
115ffd83dbSDimitry Andric //===----------------------------------------------------------------------===//
125ffd83dbSDimitry Andric 
135ffd83dbSDimitry Andric #include "VE.h"
145ffd83dbSDimitry Andric #include "clang/Basic/Builtins.h"
155ffd83dbSDimitry Andric #include "clang/Basic/MacroBuilder.h"
165ffd83dbSDimitry Andric #include "clang/Basic/TargetBuiltins.h"
175ffd83dbSDimitry Andric 
185ffd83dbSDimitry Andric using namespace clang;
195ffd83dbSDimitry Andric using namespace clang::targets;
205ffd83dbSDimitry Andric 
21*bdd1243dSDimitry Andric static constexpr Builtin::Info BuiltinInfo[] = {
2281ad6265SDimitry Andric #define BUILTIN(ID, TYPE, ATTRS)                                               \
23*bdd1243dSDimitry Andric   {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES},
2481ad6265SDimitry Andric #include "clang/Basic/BuiltinsVE.def"
2581ad6265SDimitry Andric };
2681ad6265SDimitry Andric 
getTargetDefines(const LangOptions & Opts,MacroBuilder & Builder) const275ffd83dbSDimitry Andric void VETargetInfo::getTargetDefines(const LangOptions &Opts,
285ffd83dbSDimitry Andric                                     MacroBuilder &Builder) const {
295ffd83dbSDimitry Andric   Builder.defineMacro("__ve", "1");
305ffd83dbSDimitry Andric   Builder.defineMacro("__ve__", "1");
315ffd83dbSDimitry Andric   Builder.defineMacro("__NEC__", "1");
325ffd83dbSDimitry Andric   // FIXME: define __FAST_MATH__ 1 if -ffast-math is enabled
335ffd83dbSDimitry Andric   // FIXME: define __OPTIMIZE__ n if -On is enabled
345ffd83dbSDimitry Andric   // FIXME: define __VECTOR__ n 1 if automatic vectorization is enabled
35*bdd1243dSDimitry Andric 
36*bdd1243dSDimitry Andric   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
37*bdd1243dSDimitry Andric   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
38*bdd1243dSDimitry Andric   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
39*bdd1243dSDimitry Andric   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
405ffd83dbSDimitry Andric }
415ffd83dbSDimitry Andric 
getTargetBuiltins() const425ffd83dbSDimitry Andric ArrayRef<Builtin::Info> VETargetInfo::getTargetBuiltins() const {
43*bdd1243dSDimitry Andric   return llvm::ArrayRef(BuiltinInfo,
4481ad6265SDimitry Andric                         clang::VE::LastTSBuiltin - Builtin::FirstTSBuiltin);
455ffd83dbSDimitry Andric }
46