Closed
Description
Given the following: https://godbolt.org/z/M1hEqs9q5
unsigned char f(unsigned char a) {
return __builtin_elementwise_bitreverse(a);
}
unsigned short f(unsigned short a) {
return __builtin_elementwise_bitreverse(a);
}
signed char f3(signed char a) {
return __builtin_elementwise_bitreverse(a);
}
signed short f3(signed short a) {
return __builtin_elementwise_bitreverse(a);
}
for the unsigned char
and unsigned short
cases it automatically returns 0
w/ any level of optimization e.g.
define dso_local noundef zeroext i8 @f(unsigned char)(i8 noundef zeroext %a) local_unnamed_addr {
entry:
tail call void @llvm.dbg.value(metadata i8 %a, metadata !16, metadata !DIExpression())
ret i8 0
}
Based on the documentation: https://clang.llvm.org/docs/LanguageExtensions.html
This is not expected behavior.