This is an archive of the discontinued LLVM Phabricator instance.

[M68k] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros
ClosedPublic

Authored by brad on Dec 27 2022, 8:09 AM.

Details

Summary

Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros

Fixes #58974

Diff Detail

Event Timeline

brad created this revision.Dec 27 2022, 8:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 27 2022, 8:09 AM
brad requested review of this revision.Dec 27 2022, 8:09 AM
myhsu accepted this revision.Dec 27 2022, 9:01 AM

LGTM Thanks!

This revision is now accepted and ready to land.Dec 27 2022, 9:01 AM
glaubitz accepted this revision.Dec 27 2022, 12:04 PM

Tested and works as expected. Thanks a lot for catching this!

0x59616e added a comment.EditedDec 27 2022, 9:45 PM

FYI the pre-merge checks seem to have some issues. Here is the output:

Command Output (stderr):
--
/var/lib/buildkite-agent/builds/llvm-project/clang/test/Preprocessor/predefined-arch-macros.c:4322:28: error: CHECK_M68K_GCC_ATOMICS: expected string not found in input
// CHECK_M68K_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
                           ^
<stdin>:1:1: note: scanning from here
#define _ILP32 1
^
<stdin>:62:1: note: possible intended match here
#define __GCC_ATOMIC_CHAR_LOCK_FREE 1
^
 
Input file: <stdin>
Check file: /var/lib/buildkite-agent/builds/llvm-project/clang/test/Preprocessor/predefined-arch-macros.c
 
-dump-input=help explains the following input dump.
 
Input was:
<<<<<<
              1: #define _ILP32 1
check:4322'0     X~~~~~~~~~~~~~~~~ error: no match found
              2: #define __ATOMIC_ACQUIRE 2
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              3: #define __ATOMIC_ACQ_REL 4
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              4: #define __ATOMIC_CONSUME 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              5: #define __ATOMIC_RELAXED 0
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              6: #define __ATOMIC_RELEASE 3
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              .
              .
              .
             57: #define __FLT_MIN__ 1.17549435e-38F
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             58: #define __FLT_RADIX__ 2
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~
             59: #define __GCC_ATOMIC_BOOL_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             60: #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             61: #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             62: #define __GCC_ATOMIC_CHAR_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:4322'1     ?                                      possible intended match
             63: #define __GCC_ATOMIC_INT_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             64: #define __GCC_ATOMIC_LLONG_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             65: #define __GCC_ATOMIC_LONG_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             66: #define __GCC_ATOMIC_POINTER_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             67: #define __GCC_ATOMIC_SHORT_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              .
              .
              .
>>>>>>
 
--
0x59616e added a comment.EditedDec 27 2022, 9:52 PM

Also, could you add "Fixes #58974" in the commit message so that the item will be closed automatically upon commiting ? Thanks

brad edited the summary of this revision. (Show Details)Dec 28 2022, 2:46 PM
myhsu requested changes to this revision.EditedDec 28 2022, 3:29 PM

FYI the pre-merge checks seem to have some issues. Here is the output:

Command Output (stderr):
--
/var/lib/buildkite-agent/builds/llvm-project/clang/test/Preprocessor/predefined-arch-macros.c:4322:28: error: CHECK_M68K_GCC_ATOMICS: expected string not found in input
// CHECK_M68K_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
                           ^
<stdin>:1:1: note: scanning from here
#define _ILP32 1
^
<stdin>:62:1: note: possible intended match here
#define __GCC_ATOMIC_CHAR_LOCK_FREE 1
^
 
Input file: <stdin>
Check file: /var/lib/buildkite-agent/builds/llvm-project/clang/test/Preprocessor/predefined-arch-macros.c
 
-dump-input=help explains the following input dump.
 
Input was:
<<<<<<
              1: #define _ILP32 1
check:4322'0     X~~~~~~~~~~~~~~~~ error: no match found
              2: #define __ATOMIC_ACQUIRE 2
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              3: #define __ATOMIC_ACQ_REL 4
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              4: #define __ATOMIC_CONSUME 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              5: #define __ATOMIC_RELAXED 0
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              6: #define __ATOMIC_RELEASE 3
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
              .
              .
              .
             57: #define __FLT_MIN__ 1.17549435e-38F
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             58: #define __FLT_RADIX__ 2
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~
             59: #define __GCC_ATOMIC_BOOL_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             60: #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             61: #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             62: #define __GCC_ATOMIC_CHAR_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:4322'1     ?                                      possible intended match
             63: #define __GCC_ATOMIC_INT_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             64: #define __GCC_ATOMIC_LLONG_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             65: #define __GCC_ATOMIC_LONG_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             66: #define __GCC_ATOMIC_POINTER_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             67: #define __GCC_ATOMIC_SHORT_LOCK_FREE 1
check:4322'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              .
              .
              .
>>>>>>
 
--

This is probably caused by the fact that you didn't use CPU later than 68020. @brad Please update your test.

This revision now requires changes to proceed.Dec 28 2022, 3:29 PM
brad added a comment.Dec 28 2022, 10:15 PM

How come the Clang M68k backend defaults to 68000? GCC defaults to 68020 for all targets.

brad updated this revision to Diff 485582.Dec 28 2022, 10:18 PM

How come the Clang M68k backend defaults to 68000? GCC defaults to 68020 for all targets.

The Clang M68k is a complete rewrite from scratch, independent of GCC, so it's not surprising you may see differences between Clang and GCC.

I'm open to raising the default baseline to 68020 though once the backend has matured enough.

0x59616e accepted this revision.Dec 29 2022, 1:04 AM

The CI seems OK. My first LGTM is given to you.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 29 2022, 2:08 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.