We are currently being inconsistent in using signed vs unsigned comparisons for vec_all_* and vec_any_* interfaces that use vector bool types. For example we use signed comparison for vec_all_ge(vector signed char, vector bool char) but unsigned comparison for when the arguments are swapped. GCC and XL use signed comparison instead. This patch makes clang consistent with itself and with XL and GCC.
Example:
#include <stdio.h> #include <altivec.h> int main() { vector signed char a = {0,0,0,0,0,0,0xA3,0,0,0x89,0,0,0xA4,0,0,0}; vector bool char b = {0,0,0,0,0,0,0xF3,0,0,0x61,0,0,0xAE,0,0,0}; printf(" a >= b : %d\n b >= a : %d\n", vec_all_ge(a, b), vec_all_ge(b, a)); return 0; }
currently produces
a >= b : 0 b >= a : 0
with this patch we get:
a >= b : 0 b >= a : 1
clang-tidy: error: "AltiVec support not enabled" [clang-diagnostic-error]
not useful