-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tcg/optimize: Fix sign_mask for logical right-shift
The 'sign' computation is attempting to locate the sign bit that has been repeated, so that we can test if that bit is known zero. That computation can be zero if there are no known sign repetitions. Cc: qemu-stable@nongnu.org Fixes: 93a967f ("tcg/optimize: Propagate sign info for shifting") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2248 Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
/* See https://gitlab.com/qemu-project/qemu/-/issues/2248 */ | ||
|
||
#include <assert.h> | ||
|
||
__attribute__((noinline)) | ||
long test(long x, long y, long sh) | ||
{ | ||
long r; | ||
asm("cmp %1, %2\n\t" | ||
"cset x12, lt\n\t" | ||
"and w11, w12, #0xff\n\t" | ||
"cmp w11, #0\n\t" | ||
"csetm x14, ne\n\t" | ||
"lsr x13, x14, %3\n\t" | ||
"sxtb %0, w13" | ||
: "=r"(r) | ||
: "r"(x), "r"(y), "r"(sh) | ||
: "x11", "x12", "x13", "x14"); | ||
return r; | ||
} | ||
|
||
int main() | ||
{ | ||
long r = test(0, 1, 2); | ||
assert(r == -1); | ||
return 0; | ||
} |