RFR: 8315841: RISC-V: Check for hardware TSO support [v8]

Fei Yang fyang at openjdk.org
Sat Sep 9 03:21:38 UTC 2023


On Fri, 8 Sep 2023 07:31:34 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:

>> Good question, I don't find docs in the compilers for this either, but:
>> https://github.com/riscv-non-isa/riscv-toolchain-conventions#cc-preprocessor-definitions
>
> We checked for it with [this simple snippet](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:2,lang:c%2B%2B,selection:(endColumn:1,endLineNumber:8,positionColumn:1,positionLineNumber:8,selectionStartColumn:1,selectionStartLineNumber:8,startColumn:1,startLineNumber:8),source:'int+main(void)+%7B%0A%23ifdef+__riscv_ztso%0A++++return+0%3B%0A%23else%0A++++return+1%3B%0A%23endif%0A%7D%0A'),l:'5',n:'0',o:'C%2B%2B+source+%232',t:'0')),k:51.29770473331974,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:rv64-gcctrunk,deviceViewOpen:'1',filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:2,lang:c%2B%2B,libs:!(),options:'-O2+-march%3Drv64gcv_ztso0p1',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,st
 artColumn:1,startLineNumber:1),source:2),l:'5',n:'0',o:'+RISC-V+(64-bits)+gcc+(trunk)+(Editor+%232)',t:'0'),(h:compiler,i:(compiler:rv64-clang,deviceViewOpen:'1',filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:3,lang:c%2B%2B,libs:!(),options:'-O2+-march%3Drv64gcv_ztso0p1+-menable-experimental-extensions',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:2),l:'5',n:'0',o:'+RISC-V+rv64gc+clang+(trunk)+(Editor+%232)',t:'0')),header:(),k:48.70229526668027,l:'4',m:100,n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4). You can see that in both cases, it returns `0` which implies TSO is enabled.

OK. I think I have found its definition in gcc source code [1]. It's strange that this is not mentioned in [2].

[1] https://github.com/llvm/llvm-project/blob/523c471250a49b5603bd907ff05535f18ef61c91/clang/lib/Basic/Targets/RISCV.cpp#L160C5-L162C77
[2] https://github.com/riscv-non-isa/riscv-toolchain-conventions#cc-preprocessor-definitions

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15613#discussion_r1320468890


More information about the hotspot-dev mailing list