llvm/llvm-project

[clang++] operator==(vector of long, vector of long) -> vector of long long

Open

#132,604 建立於 2025年3月23日

在 GitHub 查看
 (22 留言) (0 反應) (1 負責人)C++ (10,782 fork)batch import
ABIclang:frontenddiverges-from:gccgood first issue

倉庫指標

Star
 (26,378 star)
PR 合併指標
 (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)

描述

When comparing two variables of vector of long, clang++ returns a vector of long long, inconsistent with g++. https://godbolt.org/z/db9zT6f4r

#include <type_traits>

using T [[gnu::vector_size(sizeof(long))]] = long;

static_assert(std::is_same_v<std::remove_reference_t<decltype((T{} == T{})[0])>, long>);

This makes the following code fails to compile with clang++ with the compilation options -march=x86-64-v4 -std=c++20 (previously reported as gcc bugzilla 118546). Online link: https://godbolt.org/z/sxqsKrv9e .

#include <experimental/simd>
#include <cstdint>

using deduce_t_element = std::experimental::simd<
    std::uint64_t,
    std::experimental::simd_abi::deduce_t<std::uint64_t, 4>
>;

auto f(deduce_t_element e) {
    return e == 0;
}

貢獻者指南