Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement atomic operations for M68k #48236

Closed
glaubitz opened this issue Jan 27, 2021 · 9 comments
Closed

Implement atomic operations for M68k #48236

glaubitz opened this issue Jan 27, 2021 · 9 comments
Assignees
Labels
backend:m68k bugzilla Issues migrated from bugzilla

Comments

@glaubitz
Copy link
Contributor

glaubitz commented Jan 27, 2021

Bugzilla Link 48892
Version trunk
OS Linux
Blocks #48135
CC @glaubitz,@mshockwave

Extended Description

The M68k is not implementing any atomic operations yet which include load and store operations and compare_and_swap.

Load operations:

  • atomic_load_8 - using MOV8rm
  • atomic_load_16 - using MOV16rm
  • atomic_load_32 - using MOV32rm

Store operations:

  • atomic_store_8 - using MOV8mr
  • atomic_store_16 - using MOV16mr
  • atomic_store_32 - using MOV32mr

Compare-and-swap:

  • atomic_cmp_swap_32 - using CAS
  • atomic_cmp_swap_64 - using CAS2

Without support for atomic operations, compiling some C++ code currently fails with:

glaubitz@epyc:..openscad-2019.05/src> /local_scratch/glaubitz/M680x0-mono-repo/build/bin/clang -target m68k-linux-gnu localscope.cc -o localscope.o -I /usr/m68k-linux-gnu/include/c++/10/m68k-linux-gnu/ -I /usr/m68k-linux-gnu/include/ -I /usr/include/glib-2.0 -I /usr/lib/m68k-linux-gnu/glib-2.0/include/
fatal error: error in backend: Cannot select: 0x55f0fc5b1ea8: i8,ch = AtomicLoad<(dereferenceable load acquire 1 from `i8* bitcast (i64* @&#8203;_ZGVZN5boost6system6detail15to_std_categoryERKNS0_14error_categoryEE4map_ to i8*)`, align 4)> 0x55f0fc31e988, 0x55f0fc5ae8c8
  0x55f0fc5ae8c8: i32 = M680x0ISD::WrapperPC TargetGlobalAddress:i32<i64* @&#8203;_ZGVZN5boost6system6detail15to_std_categoryERKNS0_14error_categoryEE4map_> 0
    0x55f0fc5aec70: i32 = TargetGlobalAddress<i64* @&#8203;_ZGVZN5boost6system6detail15to_std_categoryERKNS0_14error_categoryEE4map_> 0
In function: _ZN5boost6system6detail15to_std_categoryERKNS0_14error_categoryE
clang-12: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 12.0.0 ([email protected]:M680x0/M680x0-mono-repo.git c5834ffbda019df8c94c669c658d804cb9c19af3)
Target: m68k-unknown-linux-gnu
Thread model: posix
InstalledDir: /local_scratch/glaubitz/M680x0-mono-repo/build/bin
clang-12: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/localscope-405c82.cpp
clang-12: note: diagnostic msg: /tmp/localscope-405c82.sh
clang-12: note: diagnostic msg: 

********************
glaubitz@epyc:..openscad-2019.05/src>
@glaubitz
Copy link
Contributor Author

@0x59616e Do you have any insight on how to implement support for AtomicStore and AtomicLoad? I've tried implementing it myself, but I'm currently lacking detailed knowledge on TableGen to define the proper macros.

See also: M680x0/M680x0-mono-repo#13

@0x59616e
Copy link
Contributor

@0x59616e Do you have any insight on how to implement support for AtomicStore and AtomicLoad? I've tried implementing it myself, but I'm currently lacking detailed knowledge on TableGen to define the proper macros.

See also: M680x0/M680x0-mono-repo#13

No, it hasn't been put on my agenda. I'll take a look at it once I finish the disassembler ;)

@glaubitz
Copy link
Contributor Author

OK, thanks. I think, I'll give it another go myself over the weekend.

@glaubitz
Copy link
Contributor Author

glaubitz commented Jun 9, 2022

@0x59616e Do you have any insight on how to implement support for AtomicStore and AtomicLoad? I've tried implementing it myself, but I'm currently lacking detailed knowledge on TableGen to define the proper macros.
See also: M680x0/M680x0-mono-repo#13

No, it hasn't been put on my agenda. I'll take a look at it once I finish the disassembler ;)

Do you think you could have a look during the next weeks? I haven't found a solution myself, unfortunately as I'm not very experienced with the LLVM-IR syntax.

@0x59616e
Copy link
Contributor

0x59616e commented Jun 9, 2022

@0x59616e Do you have any insight on how to implement support for AtomicStore and AtomicLoad? I've tried implementing it myself, but I'm currently lacking detailed knowledge on TableGen to define the proper macros.
See also: M680x0/M680x0-mono-repo#13

No, it hasn't been put on my agenda. I'll take a look at it once I finish the disassembler ;)

Do you think you could have a look during the next weeks? I haven't found a solution myself, unfortunately as I'm not very experienced with the LLVM-IR syntax.

Oh, I almost forgot this one. I've immersed myself in loop optimization and LLVM-IR in the past few weeks, and I believe that will be helpful as I dig into this issue ;)

@docbobo
Copy link

docbobo commented Jul 24, 2022

Is there any updaten this? I would try to help but I am probably lacking the right skill set 😉

@0x59616e
Copy link
Contributor

0x59616e commented Jul 25, 2022

Thanks for your kindness ;) Unfortunately, not much progress on this.

If you need any help to work on this, please let me know.

@0x59616e 0x59616e self-assigned this Oct 20, 2022
@chewi
Copy link
Contributor

chewi commented Nov 9, 2022

Thank you!!

@0x59616e
Copy link
Contributor

0x59616e commented Nov 9, 2022

Thank you!!

My pleasure;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:m68k bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

4 participants