Changeset View
Changeset View
Standalone View
Standalone View
openmp/libomptarget/DeviceRTL/src/Utils.cpp
//===------- Utils.cpp - OpenMP device runtime utility functions -- C++ -*-===// | //===------- Utils.cpp - OpenMP device runtime utility functions -- C++ -*-===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "Utils.h" | #include "Utils.h" | ||||
#include "Debug.h" | |||||
#include "Interface.h" | #include "Interface.h" | ||||
#include "Mapping.h" | #include "Mapping.h" | ||||
#pragma omp declare target | #pragma omp declare target | ||||
using namespace _OMP; | using namespace _OMP; | ||||
namespace _OMP { | namespace _OMP { | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
int32_t utils::shuffleDown(uint64_t Mask, int32_t Var, uint32_t Delta, | int32_t utils::shuffleDown(uint64_t Mask, int32_t Var, uint32_t Delta, | ||||
int32_t Width) { | int32_t Width) { | ||||
return impl::shuffleDown(Mask, Var, Delta, Width); | return impl::shuffleDown(Mask, Var, Delta, Width); | ||||
} | } | ||||
extern "C" { | extern "C" { | ||||
int32_t __kmpc_shuffle_int32(int32_t Val, int16_t Delta, int16_t SrcLane) { | int32_t __kmpc_shuffle_int32(int32_t Val, int16_t Delta, int16_t SrcLane) { | ||||
FunctionTracingRAII(); | |||||
return impl::shuffleDown(lanes::All, Val, Delta, SrcLane); | return impl::shuffleDown(lanes::All, Val, Delta, SrcLane); | ||||
} | } | ||||
int64_t __kmpc_shuffle_int64(int64_t Val, int16_t Delta, int16_t Width) { | int64_t __kmpc_shuffle_int64(int64_t Val, int16_t Delta, int16_t Width) { | ||||
FunctionTracingRAII(); | |||||
uint32_t lo, hi; | uint32_t lo, hi; | ||||
utils::unpack(Val, lo, hi); | utils::unpack(Val, lo, hi); | ||||
hi = impl::shuffleDown(lanes::All, hi, Delta, Width); | hi = impl::shuffleDown(lanes::All, hi, Delta, Width); | ||||
lo = impl::shuffleDown(lanes::All, lo, Delta, Width); | lo = impl::shuffleDown(lanes::All, lo, Delta, Width); | ||||
return utils::pack(lo, hi); | return utils::pack(lo, hi); | ||||
} | } | ||||
} | } | ||||
#pragma omp end declare target | #pragma omp end declare target |