49 lines
1.5 KiB
Diff
49 lines
1.5 KiB
Diff
2021-01-22 Jakub Jelinek <jakub@redhat.com>
|
|
|
|
PR target/98681
|
|
* config/aarch64/aarch64.c (aarch64_mask_and_shift_for_ubfiz_p):
|
|
Use UINTVAL (shft_amnt) and UINTVAL (mask) instead of INTVAL (shft_amnt)
|
|
and INTVAL (mask). Add && INTVAL (mask) > 0 condition.
|
|
|
|
* gcc.c-torture/execute/pr98681.c: New test.
|
|
|
|
--- gcc/config/aarch64/aarch64.c.jj 2021-01-13 11:36:27.069888393 +0100
|
|
+++ gcc/config/aarch64/aarch64.c 2021-01-22 18:53:18.611518461 +0100
|
|
@@ -12060,10 +12060,11 @@ aarch64_mask_and_shift_for_ubfiz_p (scal
|
|
rtx shft_amnt)
|
|
{
|
|
return CONST_INT_P (mask) && CONST_INT_P (shft_amnt)
|
|
- && INTVAL (shft_amnt) < GET_MODE_BITSIZE (mode)
|
|
- && exact_log2 ((INTVAL (mask) >> INTVAL (shft_amnt)) + 1) >= 0
|
|
- && (INTVAL (mask)
|
|
- & ((HOST_WIDE_INT_1U << INTVAL (shft_amnt)) - 1)) == 0;
|
|
+ && INTVAL (mask) > 0
|
|
+ && UINTVAL (shft_amnt) < GET_MODE_BITSIZE (mode)
|
|
+ && exact_log2 ((UINTVAL (mask) >> UINTVAL (shft_amnt)) + 1) >= 0
|
|
+ && (UINTVAL (mask)
|
|
+ & ((HOST_WIDE_INT_1U << UINTVAL (shft_amnt)) - 1)) == 0;
|
|
}
|
|
|
|
/* Return true if the masks and a shift amount from an RTX of the form
|
|
--- gcc/testsuite/gcc.c-torture/execute/pr98681.c.jj 2021-01-22 16:45:05.102070501 +0100
|
|
+++ gcc/testsuite/gcc.c-torture/execute/pr98681.c 2021-01-22 16:44:34.165416961 +0100
|
|
@@ -0,0 +1,18 @@
|
|
+/* PR target/98681 */
|
|
+
|
|
+__attribute__((noipa)) int
|
|
+foo (int x)
|
|
+{
|
|
+ if (x > 32)
|
|
+ return (x << -64) & 255;
|
|
+ else
|
|
+ return x;
|
|
+}
|
|
+
|
|
+int
|
|
+main ()
|
|
+{
|
|
+ if (foo (32) != 32 || foo (-150) != -150)
|
|
+ __builtin_abort ();
|
|
+ return 0;
|
|
+}
|