Skip to content

Elementwise builtins are not constexpr #57905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RKSimon opened this issue Sep 22, 2022 · 2 comments
Closed

Elementwise builtins are not constexpr #57905

RKSimon opened this issue Sep 22, 2022 · 2 comments
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. duplicate Resolved as duplicate

Comments

@RKSimon
Copy link
Collaborator

RKSimon commented Sep 22, 2022

https://simd.godbolt.org/z/E4KcoTfdP

typedef int __v4si __attribute__((__vector_size__(16)));
constexpr __v4si minmax(__v4si x, __v4si y) {
    return __builtin_elementwise_max(x, y);
}

clang -g0 -O3

<source>:3:18: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
constexpr __v4si minmax(__v4si x, __v4si y) {
                 ^
<source>:4:12: note: subexpression not valid in a constant expression
    return __builtin_elementwise_max(x, y);
@RKSimon RKSimon added the clang:codegen IR generation bugs: mangling, exceptions, etc. label Sep 22, 2022
@llvmbot
Copy link
Member

llvmbot commented Sep 22, 2022

@llvm/issue-subscribers-clang-codegen

@RKSimon RKSimon added the duplicate Resolved as duplicate label Aug 9, 2023
@RKSimon
Copy link
Collaborator Author

RKSimon commented Aug 9, 2023

Duplicate of #51787

@RKSimon RKSimon marked this as a duplicate of #51787 Aug 9, 2023
@RKSimon RKSimon closed this as completed Aug 9, 2023
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

3 participants