[PATCH] D105666: [PowerPC] [Altivec] Use signed comparison for vec_all_* and vec_any_* interfaces that compare vector bool types with vector signed types
Bardia Mahjour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 8 15:24:11 PDT 2021
bmahjour created this revision.
bmahjour added reviewers: nemanjai, cebowleratibm, PowerPC, rzurob.
bmahjour added projects: PowerPC, LLVM.
Herald added subscribers: shchenz, kbarton.
bmahjour requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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 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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105666
Files:
clang/lib/Headers/altivec.h
clang/test/CodeGen/builtins-ppc-altivec.c
clang/test/CodeGen/builtins-ppc-vsx.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105666.357370.patch
Type: text/x-patch
Size: 27669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210708/cbe52765/attachment-0001.bin>
More information about the cfe-commits
mailing list