[PATCH] D42574: [ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations
Yvan Roux via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 31 15:02:50 PST 2018
On 1 February 2018 at 00:00, Evgenii Stepanov via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
> eugenis added a comment.
>
> I've reverted your commit in r323929.
> It miscompiles the following program on armv7-linux-android:
> #include <stdio.h>
>
> typedef unsigned long long u64;
> typedef signed long long s64;
> s64 f(u64 x) {
>
> return (x > (u64)0x7fffffffffffffffULL) ? (s64)1 : -(s64)x;
>
> }
>
> int main() {
>
> volatile u64 x = 42;
> s64 y = f(x);
> printf("%lld\n", y);
>
> }
>
> Without this patch, the output is -42.
> With your patch, the output is 4294967254.
>
> It also breaks the android bot:
>
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/7279
Thanks Evgenii, you were faster than me ;)
>
> Repository:
> rL LLVM
>
> https://reviews.llvm.org/D42574
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list