This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a

For following test-case,
static long long AL[24];

check_ok (void)
  return (__sync_bool_compare_and_swap (AL+1, 0x200000003ll, 0x1234567890ll));

Compiling with -O2 -march=armv8.2-a results in:
pr90724.c: In function ‘check_ok’:
pr90724.c:7:1: error: unrecognizable insn:
    7 | }
      | ^
(insn 11 10 12 2 (set (reg:CC 66 cc)
        (compare:CC (reg:DI 95)
            (const_int 8589934595 [0x200000003]))) "pr90724.c":6:11 -1

IIUC, the issue is that 0x200000003 falls outside the range of
allowable immediate in cmp ? If it's replaced by a small constant then it works.

The ICE results with -march=armv8.2-a because, we enter if
(TARGET_LSE) { ... } condition
in aarch64_expand_compare_and_swap, while with -march=armv8.a it goes into else,
which forces oldval into register if the predicate fails to match.

The attached patch checks if y (oldval) satisfies aarch64_plus_operand
predicate and if not, forces it to be in register, which resolves ICE.
Does it look OK ?

Bootstrap+testing in progress on aarch64-linux-gnu.

PS: The issue has nothing to do with SVE, which I incorrectly
mentioned in bug report.


Attachment: pr90724-2.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]