[PATCH] D77448: [PowerPC] Canonicalize shuffles to match more single-instruction masks on LE
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 21 17:33:33 PDT 2020
MaskRay added a comment.
Our internal testing finds a correctness bug related to this patch (after the last known fix eafe7c14ea38946e8c1fb64d548effaee7614718 <https://reviews.llvm.org/rGeafe7c14ea38946e8c1fb64d548effaee7614718>)
The code is at https://github.com/google/dimsum/blob/master/dimsum_fuzz.cc#L402
With the following patch it can build with `-mcpu=pwr9 -O0`. When I feed the executable `dimsum_fuzz` itself to `dimsum_fuzz`, it triggers `__builtin_trap` because hmin (horizontal min) on `typedef signed char simd_char __attribute__((vector_size__(8)));` computed result is different from a naive algorithm. Our internal environment may be a bit strange and I can't immediately reproduce with https://github.com/google/dimsum/blob/master/dimsum_fuzz.cc#L402
I'll inform you when I can get a minimized reproduce or in the meantime if you can find problem that'd also be nice:)
diff --git i/dimsum_fuzz.cc w/dimsum_fuzz.cc
index fafd1fa..b7188fd 100644
--- i/dimsum_fuzz.cc
+++ w/dimsum_fuzz.cc
@@ -532 +532,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
+
+int main() {
+ const long data[] = {0x00010102464c457f, 0x0000000000000000};
+ LLVMFuzzerTestOneInput((const uint8_t*)data, 16);
+}
diff --git i/simd_vsx.h w/simd_vsx.h
index 5c59e2a..15a32fe 100644
--- i/simd_vsx.h
+++ w/simd_vsx.h
@@ -23,2 +23,6 @@
+inline __vector long vec_abs(__vector long a) {
+ return (__vector long)vec_abs((__vector long long)a);
+}
+
namespace dimsum {
cgdb session
2004x typename std::enable_if<(_SimdType::size() > 1 && is_simd<_SimdType>::value &&
2005x __floor_pow_of_2(_SimdType::size()) ==
2006x _SimdType::size()),
2007x typename _SimdType::value_type>::type
2008x __hmin(const _SimdType& __v) {
2009x auto __arr = split_by<2>(__v);
2010x return __hmin(min(__arr[0], __arr[1]));
2011x }
2012x
2013x template <class _SimdType>
2014x typename std::enable_if<(_SimdType::size() > 1 &&
2015x !(is_simd<_SimdType>::value &&
2016x __floor_pow_of_2(_SimdType::size()) ==
/home/maskray/test/src/third_party/dimsum/simd.h
t third_party/dimsum/simd.h:2079
0x0000000010083c40 in std::experimental::__hmin<std::experimental::simd<signed char, std::experimental::__simd_abi<(std::experimental::_StorageKind)2,
16> > > (__v=...) at third_party/dimsum/simd.h:2010
Value returned is $2 = <incomplete type>
(gdb) s
std::experimental::__hmin<std::experimental::simd<signed char, std::experimental::__simd_abi<(std::experimental::_StorageKind)2, 8> > > (__v=...) at t
hird_party/dimsum/simd.h:2009
(gdb) n
(gdb) x/2xg &__v
0x7fffffffed88: 0x0000000000000000 0x00010102464c457f
(gdb) x/2xg &__arr
0x7fffffffecf8: 0x00007fff00000000 0x00007fffffffed88
(gdb) p sizeof(__arr) # under the hood this is a signed char vector_size(8) type
$3 = 8
(gdb)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77448/new/
https://reviews.llvm.org/D77448
More information about the llvm-commits
mailing list