native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
pmull.h
1// SPDX-License-Identifier: BSD-2-Clause OR Apache-2.0
2#pragma once
4#include "native/config.h"
5#include <hint.h>
6#include "native/isa.h"
7#include <cstdint>
8#if NATIVE_HOST_NEON
9#include <arm_neon.h>
10#endif
11
12#if NATIVE_HOST_NEON || defined(NATIVE_DOXYGEN)
13namespace native::detail::arm_pmull {
14
15 template<isa<arm> Arch> requires(Arch.has(arm_feature::pmull))
16 [[nodiscard]] hint_inline hint_const hint_target("aes")
17 poly128_t pmull(poly64_t a, poly64_t b) noexcept {
18 return vmull_p64(a, b);
19 }
20
21 template<isa<arm> Arch> requires(Arch.has(arm_feature::pmull))
22 [[nodiscard]] hint_inline hint_const hint_target("aes")
23 poly128_t pmull2(poly64x2_t a, poly64x2_t b) noexcept {
24 return vmull_high_p64(a, b);
25 }
26
27 template<isa<arm> Arch> requires(Arch.has(arm_feature::neon))
28 [[nodiscard]] hint_inline hint_const
29 poly16x8_t pmull(poly8x8_t a, poly8x8_t b) noexcept {
30 return vmull_p8(a, b);
31 }
32
33 template<isa<arm> Arch> requires(Arch.has(arm_feature::neon))
34 [[nodiscard]] hint_inline hint_const
35 poly16x8_t pmull2(poly8x16_t a, poly8x16_t b) noexcept {
36 return vmull_high_p8(a, b);
37 }
38
39 // Reject Clang's implicit same-size vector conversions and scalar narrowing.
40 template<isa<arm> Arch, class... T> void pmull(T...) = delete;
41
42 template<isa<arm> Arch, class... T> void pmull2(T...) = delete;
43
44}
45#endif
constexpr simd< std::uint64_t, 2, Arch > pmull(std::uint64_t a, std::uint64_t b) noexcept
constexpr simd< std::uint64_t, 2, Arch > pmull2(simd< std::uint64_t, 2, Arch > a, simd< std::uint64_t, 2, Arch > b) noexcept
Multiply the high 64-bit polynomial lane of each operand; lower lanes are ignored.