aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/builtins/x86_64
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /contrib/libs/cxxsupp/builtins/x86_64
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/builtins/x86_64')
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/Makefile.mk40
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/chkstk.S78
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/chkstk2.S84
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/floatdidf.c32
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/floatdisf.c28
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/floatdixf.c32
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/floatundidf.S98
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/floatundisf.S70
-rw-r--r--contrib/libs/cxxsupp/builtins/x86_64/floatundixf.S136
9 files changed, 299 insertions, 299 deletions
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/Makefile.mk b/contrib/libs/cxxsupp/builtins/x86_64/Makefile.mk
index 83848dddd9..60219c0bc1 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/Makefile.mk
+++ b/contrib/libs/cxxsupp/builtins/x86_64/Makefile.mk
@@ -1,20 +1,20 @@
-#===- lib/builtins/x86_64/Makefile.mk ----------------------*- Makefile -*--===#
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-#===------------------------------------------------------------------------===#
-
-ModuleName := builtins
-SubDirs :=
-OnlyArchs := x86_64 x86_64h
-
-AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file)))
-Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file)))
-ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o)
-Implementation := Optimized
-
-# FIXME: use automatic dependencies?
-Dependencies := $(wildcard lib/*.h $(Dir)/*.h)
+#===- lib/builtins/x86_64/Makefile.mk ----------------------*- Makefile -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+ModuleName := builtins
+SubDirs :=
+OnlyArchs := x86_64 x86_64h
+
+AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file)))
+Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file)))
+ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o)
+Implementation := Optimized
+
+# FIXME: use automatic dependencies?
+Dependencies := $(wildcard lib/*.h $(Dir)/*.h)
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/chkstk.S b/contrib/libs/cxxsupp/builtins/x86_64/chkstk.S
index 4149ac63d9..de315176c1 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/chkstk.S
+++ b/contrib/libs/cxxsupp/builtins/x86_64/chkstk.S
@@ -1,39 +1,39 @@
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-
-#include "../assembly.h"
-
-// _chkstk routine
-// This routine is windows specific
-// http://msdn.microsoft.com/en-us/library/ms648426.aspx
-
-// Notes from r227519
-// MSVC x64s __chkstk and cygmings ___chkstk_ms do not adjust %rsp
-// themselves. It also does not clobber %rax so we can reuse it when
-// adjusting %rsp.
-
-#ifdef __x86_64__
-
-.text
-.balign 4
-DEFINE_COMPILERRT_FUNCTION(___chkstk_ms)
- push %rcx
- push %rax
- cmp $0x1000,%rax
- lea 24(%rsp),%rcx
- jb 1f
-2:
- sub $0x1000,%rcx
- test %rcx,(%rcx)
- sub $0x1000,%rax
- cmp $0x1000,%rax
- ja 2b
-1:
- sub %rax,%rcx
- test %rcx,(%rcx)
- pop %rax
- pop %rcx
- ret
-END_COMPILERRT_FUNCTION(___chkstk_ms)
-
-#endif // __x86_64__
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+
+#include "../assembly.h"
+
+// _chkstk routine
+// This routine is windows specific
+// http://msdn.microsoft.com/en-us/library/ms648426.aspx
+
+// Notes from r227519
+// MSVC x64s __chkstk and cygmings ___chkstk_ms do not adjust %rsp
+// themselves. It also does not clobber %rax so we can reuse it when
+// adjusting %rsp.
+
+#ifdef __x86_64__
+
+.text
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(___chkstk_ms)
+ push %rcx
+ push %rax
+ cmp $0x1000,%rax
+ lea 24(%rsp),%rcx
+ jb 1f
+2:
+ sub $0x1000,%rcx
+ test %rcx,(%rcx)
+ sub $0x1000,%rax
+ cmp $0x1000,%rax
+ ja 2b
+1:
+ sub %rax,%rcx
+ test %rcx,(%rcx)
+ pop %rax
+ pop %rcx
+ ret
+END_COMPILERRT_FUNCTION(___chkstk_ms)
+
+#endif // __x86_64__
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/chkstk2.S b/contrib/libs/cxxsupp/builtins/x86_64/chkstk2.S
index ac1eb920e0..24f4ab1727 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/chkstk2.S
+++ b/contrib/libs/cxxsupp/builtins/x86_64/chkstk2.S
@@ -1,42 +1,42 @@
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-
-#include "../assembly.h"
-
-#ifdef __x86_64__
-
-// _chkstk (_alloca) routine - probe stack between %rsp and (%rsp-%rax) in 4k increments,
-// then decrement %rsp by %rax. Preserves all registers except %rsp and flags.
-// This routine is windows specific
-// http://msdn.microsoft.com/en-us/library/ms648426.aspx
-
-.text
-.balign 4
-DEFINE_COMPILERRT_FUNCTION(__alloca)
- mov %rcx,%rax // x64 _alloca is a normal function with parameter in rcx
- // fallthrough
-DEFINE_COMPILERRT_FUNCTION(___chkstk)
- push %rcx
- cmp $0x1000,%rax
- lea 16(%rsp),%rcx // rsp before calling this routine -> rcx
- jb 1f
-2:
- sub $0x1000,%rcx
- test %rcx,(%rcx)
- sub $0x1000,%rax
- cmp $0x1000,%rax
- ja 2b
-1:
- sub %rax,%rcx
- test %rcx,(%rcx)
-
- lea 8(%rsp),%rax // load pointer to the return address into rax
- mov %rcx,%rsp // install the new top of stack pointer into rsp
- mov -8(%rax),%rcx // restore rcx
- push (%rax) // push return address onto the stack
- sub %rsp,%rax // restore the original value in rax
- ret
-END_COMPILERRT_FUNCTION(___chkstk)
-END_COMPILERRT_FUNCTION(__alloca)
-
-#endif // __x86_64__
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+
+#include "../assembly.h"
+
+#ifdef __x86_64__
+
+// _chkstk (_alloca) routine - probe stack between %rsp and (%rsp-%rax) in 4k increments,
+// then decrement %rsp by %rax. Preserves all registers except %rsp and flags.
+// This routine is windows specific
+// http://msdn.microsoft.com/en-us/library/ms648426.aspx
+
+.text
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(__alloca)
+ mov %rcx,%rax // x64 _alloca is a normal function with parameter in rcx
+ // fallthrough
+DEFINE_COMPILERRT_FUNCTION(___chkstk)
+ push %rcx
+ cmp $0x1000,%rax
+ lea 16(%rsp),%rcx // rsp before calling this routine -> rcx
+ jb 1f
+2:
+ sub $0x1000,%rcx
+ test %rcx,(%rcx)
+ sub $0x1000,%rax
+ cmp $0x1000,%rax
+ ja 2b
+1:
+ sub %rax,%rcx
+ test %rcx,(%rcx)
+
+ lea 8(%rsp),%rax // load pointer to the return address into rax
+ mov %rcx,%rsp // install the new top of stack pointer into rsp
+ mov -8(%rax),%rcx // restore rcx
+ push (%rax) // push return address onto the stack
+ sub %rsp,%rax // restore the original value in rax
+ ret
+END_COMPILERRT_FUNCTION(___chkstk)
+END_COMPILERRT_FUNCTION(__alloca)
+
+#endif // __x86_64__
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/floatdidf.c b/contrib/libs/cxxsupp/builtins/x86_64/floatdidf.c
index 388404e5e0..6bf8e90b1c 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/floatdidf.c
+++ b/contrib/libs/cxxsupp/builtins/x86_64/floatdidf.c
@@ -1,16 +1,16 @@
-/* This file is distributed under the University of Illinois Open Source
- * License. See LICENSE.TXT for details.
- */
-
-/* double __floatdidf(di_int a); */
-
-#ifdef __x86_64__
-
-#include "../int_lib.h"
-
-double __floatdidf(int64_t a)
-{
- return (double)a;
-}
-
-#endif /* __x86_64__ */
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
+
+/* double __floatdidf(di_int a); */
+
+#ifdef __x86_64__
+
+#include "../int_lib.h"
+
+double __floatdidf(int64_t a)
+{
+ return (double)a;
+}
+
+#endif /* __x86_64__ */
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/floatdisf.c b/contrib/libs/cxxsupp/builtins/x86_64/floatdisf.c
index 96c3728e92..92fc82d2cb 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/floatdisf.c
+++ b/contrib/libs/cxxsupp/builtins/x86_64/floatdisf.c
@@ -1,14 +1,14 @@
-/* This file is distributed under the University of Illinois Open Source
- * License. See LICENSE.TXT for details.
- */
-
-#ifdef __x86_64__
-
-#include "../int_lib.h"
-
-float __floatdisf(int64_t a)
-{
- return (float)a;
-}
-
-#endif /* __x86_64__ */
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
+
+#ifdef __x86_64__
+
+#include "../int_lib.h"
+
+float __floatdisf(int64_t a)
+{
+ return (float)a;
+}
+
+#endif /* __x86_64__ */
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/floatdixf.c b/contrib/libs/cxxsupp/builtins/x86_64/floatdixf.c
index c01193a82b..8d308e6fb0 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/floatdixf.c
+++ b/contrib/libs/cxxsupp/builtins/x86_64/floatdixf.c
@@ -1,16 +1,16 @@
-/* This file is distributed under the University of Illinois Open Source
- * License. See LICENSE.TXT for details.
- */
-
-/* long double __floatdixf(di_int a); */
-
-#ifdef __x86_64__
-
-#include "../int_lib.h"
-
-long double __floatdixf(int64_t a)
-{
- return (long double)a;
-}
-
-#endif /* __i386__ */
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
+
+/* long double __floatdixf(di_int a); */
+
+#ifdef __x86_64__
+
+#include "../int_lib.h"
+
+long double __floatdixf(int64_t a)
+{
+ return (long double)a;
+}
+
+#endif /* __i386__ */
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/floatundidf.S b/contrib/libs/cxxsupp/builtins/x86_64/floatundidf.S
index 3cd5d02a74..6b2f061391 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/floatundidf.S
+++ b/contrib/libs/cxxsupp/builtins/x86_64/floatundidf.S
@@ -1,49 +1,49 @@
-//===-- floatundidf.S - Implement __floatundidf for x86_64 ----------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatundidf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
-
-#include "../assembly.h"
-
-// double __floatundidf(du_int a);
-
-#ifdef __x86_64__
-
-CONST_SECTION
-
- .balign 16
-twop52:
- .quad 0x4330000000000000
-
- .balign 16
-twop84_plus_twop52:
- .quad 0x4530000000100000
-
- .balign 16
-twop84:
- .quad 0x4530000000000000
-
-#define REL_ADDR(_a) (_a)(%rip)
-
-.text
-.balign 4
-DEFINE_COMPILERRT_FUNCTION(__floatundidf)
- movd %edi, %xmm0 // low 32 bits of a
- shrq $32, %rdi // high 32 bits of a
- orq REL_ADDR(twop84), %rdi // 0x1p84 + a_hi (no rounding occurs)
- orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs)
- movd %rdi, %xmm1
- subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs)
- addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here)
- ret
-END_COMPILERRT_FUNCTION(__floatundidf)
-
-#endif // __x86_64__
+//===-- floatundidf.S - Implement __floatundidf for x86_64 ----------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements __floatundidf for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+// double __floatundidf(du_int a);
+
+#ifdef __x86_64__
+
+CONST_SECTION
+
+ .balign 16
+twop52:
+ .quad 0x4330000000000000
+
+ .balign 16
+twop84_plus_twop52:
+ .quad 0x4530000000100000
+
+ .balign 16
+twop84:
+ .quad 0x4530000000000000
+
+#define REL_ADDR(_a) (_a)(%rip)
+
+.text
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(__floatundidf)
+ movd %edi, %xmm0 // low 32 bits of a
+ shrq $32, %rdi // high 32 bits of a
+ orq REL_ADDR(twop84), %rdi // 0x1p84 + a_hi (no rounding occurs)
+ orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs)
+ movd %rdi, %xmm1
+ subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs)
+ addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here)
+ ret
+END_COMPILERRT_FUNCTION(__floatundidf)
+
+#endif // __x86_64__
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/floatundisf.S b/contrib/libs/cxxsupp/builtins/x86_64/floatundisf.S
index 61952f4047..ad45327114 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/floatundisf.S
+++ b/contrib/libs/cxxsupp/builtins/x86_64/floatundisf.S
@@ -1,35 +1,35 @@
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-
-#include "../assembly.h"
-
-// float __floatundisf(du_int a);
-
-#ifdef __x86_64__
-
-CONST_SECTION
-
- .balign 16
-two:
- .single 2.0
-
-#define REL_ADDR(_a) (_a)(%rip)
-
-.text
-.balign 4
-DEFINE_COMPILERRT_FUNCTION(__floatundisf)
- movq $1, %rsi
- testq %rdi, %rdi
- js 1f
- cvtsi2ssq %rdi, %xmm0
- ret
-
-1: andq %rdi, %rsi
- shrq %rdi
- orq %rsi, %rdi
- cvtsi2ssq %rdi, %xmm0
- mulss REL_ADDR(two), %xmm0
- ret
-END_COMPILERRT_FUNCTION(__floatundisf)
-
-#endif // __x86_64__
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+
+#include "../assembly.h"
+
+// float __floatundisf(du_int a);
+
+#ifdef __x86_64__
+
+CONST_SECTION
+
+ .balign 16
+two:
+ .single 2.0
+
+#define REL_ADDR(_a) (_a)(%rip)
+
+.text
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(__floatundisf)
+ movq $1, %rsi
+ testq %rdi, %rdi
+ js 1f
+ cvtsi2ssq %rdi, %xmm0
+ ret
+
+1: andq %rdi, %rsi
+ shrq %rdi
+ orq %rsi, %rdi
+ cvtsi2ssq %rdi, %xmm0
+ mulss REL_ADDR(two), %xmm0
+ ret
+END_COMPILERRT_FUNCTION(__floatundisf)
+
+#endif // __x86_64__
diff --git a/contrib/libs/cxxsupp/builtins/x86_64/floatundixf.S b/contrib/libs/cxxsupp/builtins/x86_64/floatundixf.S
index 92961c8911..b3bac15b9e 100644
--- a/contrib/libs/cxxsupp/builtins/x86_64/floatundixf.S
+++ b/contrib/libs/cxxsupp/builtins/x86_64/floatundixf.S
@@ -1,68 +1,68 @@
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-
-#include "../assembly.h"
-
-// long double __floatundixf(du_int a);
-
-#ifdef __x86_64__
-
-CONST_SECTION
-
- .balign 16
-twop64:
- .quad 0x43f0000000000000
-
-#define REL_ADDR(_a) (_a)(%rip)
-
- .text
-
- .balign 4
-DEFINE_COMPILERRT_FUNCTION(__floatundixf)
- movq %rdi, -8(%rsp)
- fildq -8(%rsp)
- test %rdi, %rdi
- js 1f
- ret
-1: faddl REL_ADDR(twop64)
- ret
-END_COMPILERRT_FUNCTION(__floatundixf)
-
-#endif // __x86_64__
-
-
-/* Branch-free implementation is ever so slightly slower, but more beautiful.
- It is likely superior for inlining, so I kept it around for future reference.
-
-#ifdef __x86_64__
-
-CONST_SECTION
-
- .balign 4
-twop52:
- .quad 0x4330000000000000
-twop84_plus_twop52_neg:
- .quad 0xc530000000100000
-twop84:
- .quad 0x4530000000000000
-
-#define REL_ADDR(_a) (_a)(%rip)
-
-.text
-.balign 4
-DEFINE_COMPILERRT_FUNCTION(__floatundixf)
- movl %edi, %esi // low 32 bits of input
- shrq $32, %rdi // hi 32 bits of input
- orq REL_ADDR(twop84), %rdi // 2^84 + hi (as a double)
- orq REL_ADDR(twop52), %rsi // 2^52 + lo (as a double)
- movq %rdi, -8(%rsp)
- movq %rsi, -16(%rsp)
- fldl REL_ADDR(twop84_plus_twop52_neg)
- faddl -8(%rsp) // hi - 2^52 (as double extended, no rounding occurs)
- faddl -16(%rsp) // hi + lo (as double extended)
- ret
-END_COMPILERRT_FUNCTION(__floatundixf)
-
-#endif // __x86_64__
-
-*/
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+
+#include "../assembly.h"
+
+// long double __floatundixf(du_int a);
+
+#ifdef __x86_64__
+
+CONST_SECTION
+
+ .balign 16
+twop64:
+ .quad 0x43f0000000000000
+
+#define REL_ADDR(_a) (_a)(%rip)
+
+ .text
+
+ .balign 4
+DEFINE_COMPILERRT_FUNCTION(__floatundixf)
+ movq %rdi, -8(%rsp)
+ fildq -8(%rsp)
+ test %rdi, %rdi
+ js 1f
+ ret
+1: faddl REL_ADDR(twop64)
+ ret
+END_COMPILERRT_FUNCTION(__floatundixf)
+
+#endif // __x86_64__
+
+
+/* Branch-free implementation is ever so slightly slower, but more beautiful.
+ It is likely superior for inlining, so I kept it around for future reference.
+
+#ifdef __x86_64__
+
+CONST_SECTION
+
+ .balign 4
+twop52:
+ .quad 0x4330000000000000
+twop84_plus_twop52_neg:
+ .quad 0xc530000000100000
+twop84:
+ .quad 0x4530000000000000
+
+#define REL_ADDR(_a) (_a)(%rip)
+
+.text
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(__floatundixf)
+ movl %edi, %esi // low 32 bits of input
+ shrq $32, %rdi // hi 32 bits of input
+ orq REL_ADDR(twop84), %rdi // 2^84 + hi (as a double)
+ orq REL_ADDR(twop52), %rsi // 2^52 + lo (as a double)
+ movq %rdi, -8(%rsp)
+ movq %rsi, -16(%rsp)
+ fldl REL_ADDR(twop84_plus_twop52_neg)
+ faddl -8(%rsp) // hi - 2^52 (as double extended, no rounding occurs)
+ faddl -16(%rsp) // hi + lo (as double extended)
+ ret
+END_COMPILERRT_FUNCTION(__floatundixf)
+
+#endif // __x86_64__
+
+*/