Hi all, We (Intel) would like to revive this thread on X32 ABI support upstreaming. X32 ABI homepage is here: https://sites.google.com/site/x32abi/ Currently x32 support is available in kernel/glibc/gcc/binutils and one can install for example Ubuntu 14 with extra x32 lib packages (apt-get install libc6-dev-x32) to evaluate x32-target code generated by GCC (gcc supports x32 on Ubuntu 14 out of box). We are planning to contribute enabling patches in LLVM/Clang trees and going to provide continuous support for this ABI in the future. Most of the changes obviously will be submitted to backend. Our current work is based on: * what’s currently done in trunk (some changes required for x32 are already there) * Michael Liao work done ~2 years ago and available here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html What’s currently in trunk: * Triplet x86_64-*-linux-gnux32 (command line support, EnvironmentType enum to differentiate x32 from x86_64 by getTriple().getEnvironment() == llvm::Triple::GNUX32) https://github.com/llvm-mirror/llvm/commit/9dd2a3b1f2c253e20262535bb89b1ab6cc680ece * ILP32/LP64 differentiation for TargetMachine https://github.com/llvm-mirror/llvm/commit/a5597f0eaf1f93c6d0bc641a0cc54ecffb33955a * LEA tuning: https://github.com/llvm-mirror/llvm/commit/693c37aa86506be657dfaf8835845b0998531c3c * Bunch of tests (grep for gnux32): test/CodeGen/X86/imul64-lea.ll test/CodeGen/X86/stack-update-frame-opcode.ll test/CodeGen/X86/stack-update-frame-opcode.ll test/CodeGen/X86/x86-64-sret-return.ll test/CodeGen/X86/rip-rel-lea.ll test/CodeGen/X86/x86-64-sret-return-2.ll test/CodeGen/X86/x86-64-ptr-arg-simple.ll test/MC/X86/gnux32-dwarf-gen.s What’s been done by Michael (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html) but not released in trunk: * Clang Driver support (linker/libraries paths lookup, x32 specific flags, etc.). This change is rebased, modified and submitted here: http://reviews.llvm.org/D4180 . Welcome to review. * ELF support for x32. This change is rebased, modified and submitted here: http://reviews.llvm.org/D4181 . Welcome to review. * Use EBP/ESP as frame/stack pointer. This patch will be rebased modified and submitted soon. * Other cases which require introduction X32 specific instruction definitions such as JMPX32r/CALLX32r/CALLX32m. * X32 JIT support * I hope Michael correct me if I missed anything important What’s still missing or experiencing issues (just something from the top): * New tests required and several existing tests fail when extending to x32. * Pointer and struct return; * Cast int to pointer; * Function indirect calls; * TLS * Etc. We don’t plan to introduce new backend from scratch. Major part of the changes are incremental to X86 backend and extend cases such as (64bits) ? do-64 : do-32 with (64bits) ? ((LP64) ? do-64 : do-x32) : do-32 or some shorter form if x32 mimic x86 or x86_64. X32 ABI is very close to x86-64 ABI. Our plan is to start from basic stuff, focus on more tests adding and on stability issues, then continue with performance tuning. So the first 2 patches I submitted enable “Hello, world!” sample on Ubuntu 14. Patches are here: http://reviews.llvm.org/D4180 http://reviews.llvm.org/D4181 Next steps are to rebase and split Michael patch, cover with tests and submit by chunks convenient for review. Then move to other discovered issues. Any suggestions and patches review are welcome! -- Pavel Chupin Intel Corporation
On Wed, Jul 2, 2014 at 3:59 PM, Pavel Chupin <pavel.v.chupin at gmail.com> wrote:> Any suggestions and patches review are welcome!It would be great to have a bootstrapping buildbot. I have some spare hardware, feel free to ping me when Clang can bootstrap on x32. Dmitri -- main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
Hi Pavel, We (the Native Client team) are also interested in helping you get these reviewed and in, especially the x86 backend stuff. Native Client's x86-64 ABI is similar to x32 so we could probably share a good portion of the code if it's structured the right way. -Derek On 1404316081542, Dmitri Gribenko <gribozavr at gmail.com> wrote:> On Wed, Jul 2, 2014 at 3:59 PM, Pavel Chupin <pavel.v.chupin at gmail.com> > wrote: > > Any suggestions and patches review are welcome! > > It would be great to have a bootstrapping buildbot. I have some spare > hardware, feel free to ping me when Clang can bootstrap on x32. > > Dmitri > > -- > main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if > (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/ > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140702/0c02f28e/attachment.html>
Sure. Will do. Thanks. On Wed, Jul 2, 2014 at 7:45 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:> On Wed, Jul 2, 2014 at 3:59 PM, Pavel Chupin <pavel.v.chupin at gmail.com> wrote: >> Any suggestions and patches review are welcome! > > It would be great to have a bootstrapping buildbot. I have some spare > hardware, feel free to ping me when Clang can bootstrap on x32. > > Dmitri > > -- > main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if > (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/-- Pavel Chupin Intel Corporation
Pavel, Thank you for writing to llvm-dev to describe your work on X32. It sounds like you are committed to making it happen and that other people in the community are also interested in this feature. When you send your patches to llvm-commit for review please CC people who could help with reviewing the patches. One way to find reviewers is to look at the 'svn blame’ line for areas of the code that you are modifying. Thanks, Nadav> On Jul 2, 2014, at 7:59 AM, Pavel Chupin <pavel.v.chupin at gmail.com> wrote: > > Hi all, > > We (Intel) would like to revive this thread on X32 ABI support > upstreaming. X32 ABI homepage is here: > https://sites.google.com/site/x32abi/ > > Currently x32 support is available in kernel/glibc/gcc/binutils and > one can install for example Ubuntu 14 with extra x32 lib packages > (apt-get install libc6-dev-x32) to evaluate x32-target code generated > by GCC (gcc supports x32 on Ubuntu 14 out of box). > > We are planning to contribute enabling patches in LLVM/Clang trees and > going to provide continuous support for this ABI in the future. Most > of the changes obviously will be submitted to backend. > > Our current work is based on: > > * what’s currently done in trunk (some changes required for x32 are > already there) > * Michael Liao work done ~2 years ago and available here: > http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html > > What’s currently in trunk: > > * Triplet x86_64-*-linux-gnux32 (command line support, EnvironmentType > enum to differentiate x32 from x86_64 by getTriple().getEnvironment() > == llvm::Triple::GNUX32) > https://github.com/llvm-mirror/llvm/commit/9dd2a3b1f2c253e20262535bb89b1ab6cc680ece > * ILP32/LP64 differentiation for TargetMachine > https://github.com/llvm-mirror/llvm/commit/a5597f0eaf1f93c6d0bc641a0cc54ecffb33955a > * LEA tuning: > https://github.com/llvm-mirror/llvm/commit/693c37aa86506be657dfaf8835845b0998531c3c > * Bunch of tests (grep for gnux32): > test/CodeGen/X86/imul64-lea.ll > test/CodeGen/X86/stack-update-frame-opcode.ll > test/CodeGen/X86/stack-update-frame-opcode.ll > test/CodeGen/X86/x86-64-sret-return.ll > test/CodeGen/X86/rip-rel-lea.ll > test/CodeGen/X86/x86-64-sret-return-2.ll > test/CodeGen/X86/x86-64-ptr-arg-simple.ll > test/MC/X86/gnux32-dwarf-gen.s > > What’s been done by Michael > (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html) > but not released in trunk: > > * Clang Driver support (linker/libraries paths lookup, x32 specific > flags, etc.). This change is rebased, modified and submitted here: > http://reviews.llvm.org/D4180 . Welcome to review. > * ELF support for x32. This change is rebased, modified and submitted > here: http://reviews.llvm.org/D4181 . Welcome to review. > * Use EBP/ESP as frame/stack pointer. This patch will be rebased > modified and submitted soon. > * Other cases which require introduction X32 specific instruction > definitions such as JMPX32r/CALLX32r/CALLX32m. > * X32 JIT support > * I hope Michael correct me if I missed anything important > > What’s still missing or experiencing issues (just something from the top): > > * New tests required and several existing tests fail when extending to x32. > * Pointer and struct return; > * Cast int to pointer; > * Function indirect calls; > * TLS > * Etc. > > We don’t plan to introduce new backend from scratch. Major part of the > changes are incremental to X86 backend and extend cases such as > > (64bits) ? do-64 : do-32 > with > (64bits) ? ((LP64) ? do-64 : do-x32) : do-32 > > or some shorter form if x32 mimic x86 or x86_64. X32 ABI is very close > to x86-64 ABI. > > Our plan is to start from basic stuff, focus on more tests adding and > on stability issues, then continue with performance tuning. So the > first 2 patches I submitted enable “Hello, world!” sample on Ubuntu > 14. Patches are here: > > http://reviews.llvm.org/D4180 > http://reviews.llvm.org/D4181 > > Next steps are to rebase and split Michael patch, cover with tests and > submit by chunks convenient for review. Then move to other discovered > issues. > > Any suggestions and patches review are welcome! > > -- > Pavel Chupin > Intel Corporation > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Just a datapoint on why x32 is interesting. I compiled clang on a ubuntu vm in 32 bits, 64 bits and x32. As a simple benchmark I then compiled gcc.c from http://people.csail.mit.edu/smcc/projects/single-file-programs. The results were (best of 3 runs, user time) 32: 0m19.529s 64: 0m17.044s x32: 0m15.768s On 2 July 2014 10:59, Pavel Chupin <pavel.v.chupin at gmail.com> wrote:> Hi all, > > We (Intel) would like to revive this thread on X32 ABI support > upstreaming. X32 ABI homepage is here: > https://sites.google.com/site/x32abi/ > > Currently x32 support is available in kernel/glibc/gcc/binutils and > one can install for example Ubuntu 14 with extra x32 lib packages > (apt-get install libc6-dev-x32) to evaluate x32-target code generated > by GCC (gcc supports x32 on Ubuntu 14 out of box). > > We are planning to contribute enabling patches in LLVM/Clang trees and > going to provide continuous support for this ABI in the future. Most > of the changes obviously will be submitted to backend. > > Our current work is based on: > > * what’s currently done in trunk (some changes required for x32 are > already there) > * Michael Liao work done ~2 years ago and available here: > http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html > > What’s currently in trunk: > > * Triplet x86_64-*-linux-gnux32 (command line support, EnvironmentType > enum to differentiate x32 from x86_64 by getTriple().getEnvironment() > == llvm::Triple::GNUX32) > https://github.com/llvm-mirror/llvm/commit/9dd2a3b1f2c253e20262535bb89b1ab6cc680ece > * ILP32/LP64 differentiation for TargetMachine > https://github.com/llvm-mirror/llvm/commit/a5597f0eaf1f93c6d0bc641a0cc54ecffb33955a > * LEA tuning: > https://github.com/llvm-mirror/llvm/commit/693c37aa86506be657dfaf8835845b0998531c3c > * Bunch of tests (grep for gnux32): > test/CodeGen/X86/imul64-lea.ll > test/CodeGen/X86/stack-update-frame-opcode.ll > test/CodeGen/X86/stack-update-frame-opcode.ll > test/CodeGen/X86/x86-64-sret-return.ll > test/CodeGen/X86/rip-rel-lea.ll > test/CodeGen/X86/x86-64-sret-return-2.ll > test/CodeGen/X86/x86-64-ptr-arg-simple.ll > test/MC/X86/gnux32-dwarf-gen.s > > What’s been done by Michael > (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html) > but not released in trunk: > > * Clang Driver support (linker/libraries paths lookup, x32 specific > flags, etc.). This change is rebased, modified and submitted here: > http://reviews.llvm.org/D4180 . Welcome to review. > * ELF support for x32. This change is rebased, modified and submitted > here: http://reviews.llvm.org/D4181 . Welcome to review. > * Use EBP/ESP as frame/stack pointer. This patch will be rebased > modified and submitted soon. > * Other cases which require introduction X32 specific instruction > definitions such as JMPX32r/CALLX32r/CALLX32m. > * X32 JIT support > * I hope Michael correct me if I missed anything important > > What’s still missing or experiencing issues (just something from the top): > > * New tests required and several existing tests fail when extending to x32. > * Pointer and struct return; > * Cast int to pointer; > * Function indirect calls; > * TLS > * Etc. > > We don’t plan to introduce new backend from scratch. Major part of the > changes are incremental to X86 backend and extend cases such as > > (64bits) ? do-64 : do-32 > with > (64bits) ? ((LP64) ? do-64 : do-x32) : do-32 > > or some shorter form if x32 mimic x86 or x86_64. X32 ABI is very close > to x86-64 ABI. > > Our plan is to start from basic stuff, focus on more tests adding and > on stability issues, then continue with performance tuning. So the > first 2 patches I submitted enable “Hello, world!” sample on Ubuntu > 14. Patches are here: > > http://reviews.llvm.org/D4180 > http://reviews.llvm.org/D4181 > > Next steps are to rebase and split Michael patch, cover with tests and > submit by chunks convenient for review. Then move to other discovered > issues. > > Any suggestions and patches review are welcome! > > -- > Pavel Chupin > Intel Corporation > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Wed, 2014-07-02 at 18:59 +0400, Pavel Chupin wrote:> Hi all, > > We (Intel) would like to revive this thread on X32 ABI support > upstreaming. X32 ABI homepage is here: > https://sites.google.com/site/x32abi/ > > Currently x32 support is available in kernel/glibc/gcc/binutils and > one can install for example Ubuntu 14 with extra x32 lib packages > (apt-get install libc6-dev-x32) to evaluate x32-target code generated > by GCC (gcc supports x32 on Ubuntu 14 out of box). > > We are planning to contribute enabling patches in LLVM/Clang trees > and > going to provide continuous support for this ABI in the future. Most > of the changes obviously will be submitted to backend. > > Our current work is based on: > > * what’s currently done in trunk (some changes required for x32 are > already there) > * Michael Liao work done ~2 years ago and available here: > http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html > > What’s currently in trunk: > > * Triplet x86_64-*-linux-gnux32 (command line support, > EnvironmentType > enum to differentiate x32 from x86_64 by getTriple().getEnvironment() > == llvm::Triple::GNUX32) > https://github.com/llvm-mirror/llvm/commit/9dd2a3b1f2c253e20262535bb89b1ab6cc680ece > * ILP32/LP64 differentiation for TargetMachine > https://github.com/llvm-mirror/llvm/commit/a5597f0eaf1f93c6d0bc641a0cc54ecffb33955a > * LEA tuning: > https://github.com/llvm-mirror/llvm/commit/693c37aa86506be657dfaf8835845b0998531c3c > * Bunch of tests (grep for gnux32): > test/CodeGen/X86/imul64-lea.ll > test/CodeGen/X86/stack-update-frame-opcode.ll > test/CodeGen/X86/stack-update-frame-opcode.ll > test/CodeGen/X86/x86-64-sret-return.ll > test/CodeGen/X86/rip-rel-lea.ll > test/CodeGen/X86/x86-64-sret-return-2.ll > test/CodeGen/X86/x86-64-ptr-arg-simple.ll > test/MC/X86/gnux32-dwarf-gen.s > > What’s been done by Michael > (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html) > but not released in trunk: > > * Clang Driver support (linker/libraries paths lookup, x32 specific > flags, etc.). This change is rebased, modified and submitted here: > http://reviews.llvm.org/D4180 . Welcome to review. > * ELF support for x32. This change is rebased, modified and submitted > here: http://reviews.llvm.org/D4181 . Welcome to review. > * Use EBP/ESP as frame/stack pointer. This patch will be rebased > modified and submitted soon. > * Other cases which require introduction X32 specific instruction > definitions such as JMPX32r/CALLX32r/CALLX32m. > * X32 JIT support > * I hope Michael correct me if I missed anything important > > What’s still missing or experiencing issues (just something from the > top): > > * New tests required and several existing tests fail when extending > to x32. > * Pointer and struct return; > * Cast int to pointer; > * Function indirect calls; > * TLS > * Etc. > > We don’t plan to introduce new backend from scratch. Major part of > the > changes are incremental to X86 backend and extend cases such as > > (64bits) ? do-64 : do-32 > with > (64bits) ? ((LP64) ? do-64 : do-x32) : do-32 > > or some shorter form if x32 mimic x86 or x86_64. X32 ABI is very > close > to x86-64 ABI. > > Our plan is to start from basic stuff, focus on more tests adding and > on stability issues, then continue with performance tuning. So the > first 2 patches I submitted enable “Hello, world!” sample on Ubuntu > 14. Patches are here: > > http://reviews.llvm.org/D4180 > http://reviews.llvm.org/D4181 > > Next steps are to rebase and split Michael patch, cover with tests > and > submit by chunks convenient for review. Then move to other discovered > issues. > > Any suggestions and patches review are welcome! >This is terrific news! :) I tried to tackle it on my own before, it was just too much to take on; or rather, I didn't have the needed skill or experience to get it working alone. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140703/f309aaf4/attachment.sig>
Possibly Parallel Threads
- X32 bugs around "cannot select" lingering around
- [LLVMdev] Upstreaming x32 ABI support
- [LLVMdev] X32 ABI support for Clang/compiler-rt (re: clang patch)
- [LLVMdev] [RFC PATCH] X32 ABI support for Clang/compiler-rt
- [LLVMdev] [RFC PATCH] X32 ABI support for Clang/compiler-rt (Clang patch)