Get codebase completely working with LLVM

You can now build Cosmopolitan with Clang:

    make -j8 MODE=llvm
    o/llvm/examples/hello.com

The assembler and linker code is now friendly to LLVM too.
So it's not needed to configure Clang to use binutils under
the hood. If you love LLVM then you can now use pure LLVM.
This commit is contained in:
Justine Tunney 2021-02-08 09:19:00 -08:00
parent 0e36cb3ac4
commit e75ffde09e
4528 changed files with 7776 additions and 11640 deletions

View file

@ -19,46 +19,46 @@
#include "libc/macros.h"
#include "libc/nexgen32e/x86feature.h"
/ Broadcast byte literal to vector, e.g.
/
/ # xmm0=0x12121212121212121212121212121212
/ .bcblit $0x12,%al,%eax,%xmm0
/
/ @param reg and regSI need to be the same register
// Broadcast byte literal to vector, e.g.
//
// # xmm0=0x12121212121212121212121212121212
// .bcblit $0x12,%al,%eax,%xmm0
//
// @param reg and regSI need to be the same register
.macro .bcblit lit:req reg:req regSI:req xmm:req
mov \lit,\reg
movd \regSI,\xmm
pbroadcastb \xmm
.endm
/ Broadcast word literal to vector, e.g.
/
/ # xmm0=0x01230123012301230123012301230123
/ .bcwlit $0x123,%ax,%eax,%xmm0
/
/ @param reg and regSI need to be the same register
// Broadcast word literal to vector, e.g.
//
// # xmm0=0x01230123012301230123012301230123
// .bcwlit $0x123,%ax,%eax,%xmm0
//
// @param reg and regSI need to be the same register
.macro .bcwlit lit:req reg:req regSI:req xmm:req
mov \lit,\reg
movd \regSI,\xmm
pbroadcastw \xmm
.endm
/ Broadcast int16 from register to vector.
// Broadcast int16 from register to vector.
.macro .bcwreg regSI:req xmm:req
movd \regSI,\xmm
pbroadcastw \xmm
.endm
/ Sets all bytes in XMM register to first byte, e.g.
/
/ mov $0x11,%eax
/ movd %eax,%xmm0
/ pbroadcastb %xmm0
/
/ 11000000000000000000000000000000
/ 11111111111111111111111111111111
/
/ @param xmm can be %xmm0,%xmm1,etc.
// Sets all bytes in XMM register to first byte, e.g.
//
// mov $0x11,%eax
// movd %eax,%xmm0
// pbroadcastb %xmm0
//
// 11000000000000000000000000000000
// → 11111111111111111111111111111111
//
// @param xmm can be %xmm0,%xmm1,etc.
.macro pbroadcastb xmm:req
#if X86_NEED(AVX2)
vpbroadcastb \xmm,\xmm
@ -69,16 +69,16 @@
#endif
.endm
/ Sets all words in XMM register to first word, e.g.
/
/ mov $0x1234,%eax
/ movd %eax,%xmm0
/ pbroadcastw %xmm0
/
/ 12340000000000000000000000000000
/ 12341234123412341234123412341234
/
/ @param xmm can be %xmm0,%xmm1,etc.
// Sets all words in XMM register to first word, e.g.
//
// mov $0x1234,%eax
// movd %eax,%xmm0
// pbroadcastw %xmm0
//
// 12340000000000000000000000000000
// → 12341234123412341234123412341234
//
// @param xmm can be %xmm0,%xmm1,etc.
.macro pbroadcastw xmm:req
#if X86_NEED(AVX2)
vpbroadcastw \xmm,\xmm