annotate runtime/import/ldc/intrinsics.di @ 1075:34bc1945bc85

Factor out some common code between X86 and X86_64, and supply *_real versions of all floating point intrinsics that exist whether reals are 80-bit or 64-bit.
author Frits van Bommel <fvbommel wxs.nl>
date Mon, 09 Mar 2009 21:38:06 +0100
parents 7a0238db1962
children 39b7c32cd010
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
1 /*
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
2 * This module holds declarations to LLVM intrinsics.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
3 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
4 * See the LLVM language reference for more information:
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
5 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
6 * - http://llvm.org/docs/LangRef.html#intrinsics
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
7 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
8 */
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
9
663
6aaa3d3c1183 First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents: 527
diff changeset
10 module ldc.intrinsics;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
11
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
12 // Check for the right compiler
663
6aaa3d3c1183 First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents: 527
diff changeset
13 version(LDC)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
14 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
15 // OK
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
16 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
17 else
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
18 {
663
6aaa3d3c1183 First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents: 527
diff changeset
19 static assert(false, "This module is only valid for LDC");
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
20 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
21
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
22 version(X86)
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
23 version = Reals_80Bit;
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
24 else version(X86_64)
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
25 version = Reals_80Bit;
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
26
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
27 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
28 // CODE GENERATOR INTRINSICS
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
29 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
30
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
31
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
32 // The 'llvm.returnaddress' intrinsic attempts to compute a target-specific value indicating the return address of the current function or one of its callers.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
33
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
34 pragma(intrinsic, "llvm.returnaddress")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
35 void* llvm_returnaddress(uint level);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
36
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
37
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
38 // The 'llvm.frameaddress' intrinsic attempts to return the target-specific frame pointer value for the specified stack frame.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
39
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
40 pragma(intrinsic, "llvm.frameaddress")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
41 void* llvm_frameaddress(uint level);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
42
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
43
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
44 // The 'llvm.stacksave' intrinsic is used to remember the current state of the function stack, for use with llvm.stackrestore. This is useful for implementing language features like scoped automatic variable sized arrays in C99.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
45
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
46 pragma(intrinsic, "llvm.stacksave")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
47 void* llvm_stacksave();
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
48
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
49
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
50 // The 'llvm.stackrestore' intrinsic is used to restore the state of the function stack to the state it was in when the corresponding llvm.stacksave intrinsic executed. This is useful for implementing language features like scoped automatic variable sized arrays in C99.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
51
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
52 pragma(intrinsic, "llvm.stackrestore")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
53 void llvm_stackrestore(void* ptr);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
54
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
55
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
56 // The 'llvm.prefetch' intrinsic is a hint to the code generator to insert a prefetch instruction if supported; otherwise, it is a noop. Prefetches have no effect on the behavior of the program but can change its performance characteristics.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
57
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
58 pragma(intrinsic, "llvm.prefetch")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
59 void llvm_prefetch(void* ptr, uint rw, uint locality);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
60
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
61
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
62 // The 'llvm.pcmarker' intrinsic is a method to export a Program Counter (PC) in a region of code to simulators and other tools. The method is target specific, but it is expected that the marker will use exported symbols to transmit the PC of the marker. The marker makes no guarantees that it will remain with any specific instruction after optimizations. It is possible that the presence of a marker will inhibit optimizations. The intended use is to be inserted after optimizations to allow correlations of simulation runs.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
63
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
64 pragma(intrinsic, "llvm.pcmarker")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
65 void llvm_pcmarker(uint id);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
66
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
67
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
68 // The 'llvm.readcyclecounter' intrinsic provides access to the cycle counter register (or similar low latency, high accuracy clocks) on those targets that support it. On X86, it should map to RDTSC. On Alpha, it should map to RPCC. As the backing counters overflow quickly (on the order of 9 seconds on alpha), this should only be used for small timings.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
69
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
70 pragma(intrinsic, "llvm.readcyclecounter")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
71 ulong readcyclecounter();
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
72
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
73
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
74
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
75
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
76 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
77 // STANDARD C LIBRARY INTRINSICS
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
78 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
79
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
80
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
81 // The 'llvm.memcpy.*' intrinsics copy a block of memory from the source location to the destination location.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
82 // Note that, unlike the standard libc function, the llvm.memcpy.* intrinsics do not return a value, and takes an extra alignment argument.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
83
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
84 pragma(intrinsic, "llvm.memcpy.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
85 void llvm_memcpy_i32(void* dst, void* src, uint len, uint alignment);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
86 pragma(intrinsic, "llvm.memcpy.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
87 void llvm_memcpy_i64(void* dst, void* src, ulong len, uint alignment);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
88
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
89
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
90 // The 'llvm.memmove.*' intrinsics move a block of memory from the source location to the destination location. It is similar to the 'llvm.memcpy' intrinsic but allows the two memory locations to overlap.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
91 // Note that, unlike the standard libc function, the llvm.memmove.* intrinsics do not return a value, and takes an extra alignment argument.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
92
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
93 pragma(intrinsic, "llvm.memmove.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
94 void llvm_memmove_i32(void* dst, void* src, uint len, uint alignment);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
95 pragma(intrinsic, "llvm.memmove.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
96 void llvm_memmove_i64(void* dst, void* src, ulong len, int alignment);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
97
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
98
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
99 // The 'llvm.memset.*' intrinsics fill a block of memory with a particular byte value.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
100 // Note that, unlike the standard libc function, the llvm.memset intrinsic does not return a value, and takes an extra alignment argument.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
101
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
102 pragma(intrinsic, "llvm.memset.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
103 void llvm_memset_i32(void* dst, ubyte val, uint len, uint alignment);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
104 pragma(intrinsic, "llvm.memset.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
105 void llvm_memset_i64(void* dst, ubyte val, ulong len, uint alignment);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
106
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
107
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
108 // The 'llvm.sqrt' intrinsics return the sqrt of the specified operand, returning the same value as the libm 'sqrt' functions would. Unlike sqrt in libm, however, llvm.sqrt has undefined behavior for negative numbers other than -0.0 (which allows for better optimization, because there is no need to worry about errno being set). llvm.sqrt(-0.0) is defined to return -0.0 like IEEE sqrt.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
109
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
110 pragma(intrinsic, "llvm.sqrt.f32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
111 float llvm_sqrt_f32(float val);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
112 pragma(intrinsic, "llvm.sqrt.f64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
113 double llvm_sqrt_f64(double val);
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
114
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
115 version(Reals_80Bit)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
116 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
117 pragma(intrinsic, "llvm.sqrt.f80")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
118 real llvm_sqrt_f80(real val);
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
119 alias llvm_sqrt_f80 llvm_sqrt_real;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
120 }
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
121 else
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
122 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
123 pragma(intrinsic, "llvm.sqrt.f64")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
124 real llvm_sqrt_real(real val);
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
125 }
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
126
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
127
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
128 // The 'llvm.sin.*' intrinsics return the sine of the operand.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
129
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
130 pragma(intrinsic, "llvm.sin.f32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
131 float llvm_sin_f32(float val);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
132 pragma(intrinsic, "llvm.sin.f64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
133 double llvm_sin_f64(double val);
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
134
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
135 version(Reals_80Bit)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
136 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
137 pragma(intrinsic, "llvm.sin.f80")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
138 real llvm_sin_f80(real val);
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
139 alias llvm_sin_f80 llvm_sin_real;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
140 }
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
141 else
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
142 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
143 pragma(intrinsic, "llvm.sin.f64")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
144 real llvm_sin_real(real val);
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
145 }
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
146
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
147
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
148 // The 'llvm.cos.*' intrinsics return the cosine of the operand.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
149
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
150 pragma(intrinsic, "llvm.cos.f32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
151 float llvm_cos_f32(float val);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
152 pragma(intrinsic, "llvm.cos.f64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
153 double llvm_cos_f64(double val);
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
154
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
155 version(Reals_80Bit)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
156 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
157 pragma(intrinsic, "llvm.cos.f80")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
158 real llvm_cos_f80(real val);
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
159 alias llvm_cos_f80 llvm_cos_real;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
160 }
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
161 else
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
162 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
163 pragma(intrinsic, "llvm.cos.f64")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
164 real llvm_cos_real(real val);
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
165 }
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
166
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
167
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
168 // The 'llvm.powi.*' intrinsics return the first operand raised to the specified (positive or negative) power. The order of evaluation of multiplications is not defined. When a vector of floating point type is used, the second argument remains a scalar integer value.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
169
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
170 pragma(intrinsic, "llvm.powi.f32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
171 float llvm_powi_f32(float val, int power);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
172
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
173 pragma(intrinsic, "llvm.powi.f64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
174 double llvm_powi_f64(double val, int power);
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
175
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
176 version(Reals_80Bit)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
177 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
178 pragma(intrinsic, "llvm.powi.f80")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
179 real llvm_powi_f80(real val, int power);
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
180 alias llvm_powi_f80 llvm_powi_real;
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
181 }
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
182 else
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
183 {
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
184 pragma(intrinsic, "llvm.powi.f64")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
185 real llvm_powi_real(real val, int power);
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
186 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
187
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
188
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
189 // The 'llvm.pow.*' intrinsics return the first operand raised to the specified (positive or negative) power.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
190
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
191 pragma(intrinsic, "llvm.pow.f32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
192 float llvm_pow_f32(float val, float power);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
193
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
194 pragma(intrinsic, "llvm.pow.f64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
195 double llvm_pow_f64(double val, double power);
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
196
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
197 version(Reals_80Bit)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
198 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
199 pragma(intrinsic, "llvm.pow.f80")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
200 real llvm_pow_f80(real val, real power);
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
201 alias llvm_pow_f80 llvm_pow_real;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
202 }
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
203 else
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
204 {
1075
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
205 pragma(intrinsic, "llvm.pow.f64")
34bc1945bc85 Factor out some common code between X86 and X86_64, and supply *_real versions
Frits van Bommel <fvbommel wxs.nl>
parents: 1001
diff changeset
206 real llvm_pow_real(real val, real power);
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
207 }
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
208
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
209
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
210 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
211 // BIT MANIPULATION INTRINSICS
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
212 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
213
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
214 // The 'llvm.bswap' family of intrinsics is used to byte swap integer values with an even number of bytes (positive multiple of 16 bits). These are useful for performing operations on data that is not in the target's native byte order.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
215
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
216 pragma(intrinsic, "llvm.bswap.i16.i16")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
217 ushort llvm_bswap_i16(ushort val);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
218
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
219 pragma(intrinsic, "llvm.bswap.i32.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
220 uint llvm_bswap_i32(uint val);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
221
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
222 pragma(intrinsic, "llvm.bswap.i64.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
223 ulong llvm_bswap_i64(ulong val);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
224
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
225
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
226 // The 'llvm.ctpop' family of intrinsics counts the number of bits set in a value.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
227
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
228 pragma(intrinsic, "llvm.ctpop.i8")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
229 ubyte llvm_ctpop_i8(ubyte src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
230
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
231 pragma(intrinsic, "llvm.ctpop.i16")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
232 ushort llvm_ctpop_i16(ushort src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
233
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
234 pragma(intrinsic, "llvm.ctpop.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
235 uint llvm_ctpop_i32(uint src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
236
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
237 pragma(intrinsic, "llvm.ctpop.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
238 ulong llvm_ctpop_i64(ulong src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
239
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
240
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
241 // The 'llvm.ctlz' family of intrinsic functions counts the number of leading zeros in a variable.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
242
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
243 pragma(intrinsic, "llvm.ctlz.i8")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
244 ubyte llvm_ctlz_i8(ubyte src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
245
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
246 pragma(intrinsic, "llvm.ctlz.i16")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
247 ushort llvm_ctlz_i16(ushort src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
248
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
249 pragma(intrinsic, "llvm.ctlz.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
250 uint llvm_ctlz_i32(uint src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
251
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
252 pragma(intrinsic, "llvm.ctlz.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
253 ulong llvm_ctlz_i64(ulong src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
254
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
255
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
256 // The 'llvm.cttz' family of intrinsic functions counts the number of trailing zeros.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
257
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
258 pragma(intrinsic, "llvm.cttz.i8")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
259 ubyte llvm_cttz_i8(ubyte src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
260
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
261 pragma(intrinsic, "llvm.cttz.i16")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
262 ushort llvm_cttz_i16(ushort src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
263
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
264 pragma(intrinsic, "llvm.cttz.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
265 uint llvm_cttz_i32(uint src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
266
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
267 pragma(intrinsic, "llvm.cttz.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
268 ulong llvm_cttz_i64(ulong src);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
269
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
270
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
271 // The 'llvm.part.select' family of intrinsic functions selects a range of bits from an integer value and returns them in the same bit width as the original value.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
272
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
273 pragma(intrinsic, "llvm.part.select.i8")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
274 ubyte llvm_part_select_i(ubyte val, uint loBit, uint hiBit);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
275
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
276 pragma(intrinsic, "llvm.part.select.i16")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
277 ushort llvm_part_select_i(ushort val, uint loBit, uint hiBit);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
278
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
279 pragma(intrinsic, "llvm.part.select.i32")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
280 uint llvm_part_select_i(uint val, uint loBit, uint hiBit);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
281
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
282 pragma(intrinsic, "llvm.part.select.i64")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
283 ulong llvm_part_select_i(ulong val, uint loBit, uint hiBit);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
284
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
285
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
286 // The 'llvm.part.set' family of intrinsic functions replaces a range of bits in an integer value with another integer value. It returns the integer with the replaced bits.
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
287
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
288 // TODO
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
289 // declare i17 @llvm.part.set.i17.i9 (i17 %val, i9 %repl, i32 %lo, i32 %hi)
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
290 // declare i29 @llvm.part.set.i29.i9 (i29 %val, i9 %repl, i32 %lo, i32 %hi)
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
291
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
292
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
293
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
294
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
295 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
296 // ATOMIC OPERATIONS AND SYNCHRONIZATION INTRINSICS
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
297 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
298
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
299 // The llvm.memory.barrier intrinsic guarantees ordering between specific pairs of memory access types.
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
300
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
301 pragma(intrinsic, "llvm.memory.barrier")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
302 void llvm_memory_barrier(bool ll, bool ls, bool sl, bool ss, bool device);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
303
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
304 // This loads a value in memory and compares it to a given value. If they are equal, it stores a new value into the memory.
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
305
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
306 pragma(intrinsic, "llvm.atomic.cmp.swap.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
307 T llvm_atomic_cmp_swap(T)(T* ptr, T cmp, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
308
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
309 // This intrinsic loads the value stored in memory at ptr and yields the value from memory. It then stores the value in val in the memory at ptr.
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
310
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
311 pragma(intrinsic, "llvm.atomic.swap.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
312 T llvm_atomic_swap(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
313
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
314 // This intrinsic adds delta to the value stored in memory at ptr. It yields the original value at ptr.
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
315
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
316 pragma(intrinsic, "llvm.atomic.load.add.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
317 T llvm_atomic_load_add(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
318
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
319 // This intrinsic subtracts delta to the value stored in memory at ptr. It yields the original value at ptr.
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
320
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
321 pragma(intrinsic, "llvm.atomic.load.sub.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
322 T llvm_atomic_load_sub(T)(T* ptr, T val);
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
323
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
324 // These intrinsics bitwise the operation (and, nand, or, xor) delta to the value stored in memory at ptr. It yields the original value at ptr.
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
325
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
326 pragma(intrinsic, "llvm.atomic.load.and.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
327 T llvm_atomic_load_and(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
328 pragma(intrinsic, "llvm.atomic.load.nand.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
329 T llvm_atomic_load_nand(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
330 pragma(intrinsic, "llvm.atomic.load.or.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
331 T llvm_atomic_load_or(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
332 pragma(intrinsic, "llvm.atomic.load.xor.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
333 T llvm_atomic_load_xor(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
334
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
335 // These intrinsics takes the signed or unsigned minimum or maximum of delta and the value stored in memory at ptr. It yields the original value at ptr.
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
336
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
337 pragma(intrinsic, "llvm.atomic.load.max.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
338 T llvm_atomic_load_max(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
339 pragma(intrinsic, "llvm.atomic.load.min.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
340 T llvm_atomic_load_min(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
341 pragma(intrinsic, "llvm.atomic.load.umax.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
342 T llvm_atomic_load_umax(T)(T* ptr, T val);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
343 pragma(intrinsic, "llvm.atomic.load.umin.i#.p0i#")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
344 T llvm_atomic_load_umin(T)(T* ptr, T val);
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
345
1001
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
346
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
347 //
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
348 // ARITHMETIC-WITH-OVERFLOW INTRINSICS
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
349 //
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
350
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
351 struct OverflowRet(T) {
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
352 static assert(is(T : int), T.stringof ~ " is not an integer type!");
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
353 T result;
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
354 bool overflow;
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
355 }
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
356
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
357 // Signed and unsigned addition
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
358 pragma(intrinsic, "llvm.sadd.with.overflow.i#")
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
359 OverflowRet!(T) llvm_sadd_with_overflow(T)(T lhs, T rhs);
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
360
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
361 pragma(intrinsic, "llvm.uadd.with.overflow.i#")
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
362 OverflowRet!(T) llvm_uadd_with_overflow(T)(T lhs, T rhs);
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
363
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
364 // Signed and unsigned subtraction
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
365 pragma(intrinsic, "llvm.ssub.with.overflow.i#")
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
366 OverflowRet!(T) llvm_ssub_with_overflow(T)(T lhs, T rhs);
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
367
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
368 pragma(intrinsic, "llvm.usub.with.overflow.i#")
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
369 OverflowRet!(T) llvm_usub_with_overflow(T)(T lhs, T rhs);
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
370
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
371 // Signed and unsigned multiplication
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
372 pragma(intrinsic, "llvm.smul.with.overflow.i#")
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
373 OverflowRet!(T) llvm_smul_with_overflow(T)(T lhs, T rhs);
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
374
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
375 /* Note: LLVM documentations says:
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
376 * Warning: 'llvm.umul.with.overflow' is badly broken.
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
377 * It is actively being fixed, but it should not currently be used!
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
378 *
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
379 * See: http://llvm.org/docs/LangRef.html#int_umul_overflow
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
380 */
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
381 pragma(intrinsic, "llvm.umul.with.overflow.i#")
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
382 OverflowRet!(T) llvm_umul_with_overflow(T)(T lhs, T rhs);
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
383
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
384
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
385 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
386 // GENERAL INTRINSICS
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
387 //
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
388
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
389
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
390 // This intrinsics is lowered to the target dependent trap instruction. If the target does not have a trap instruction, this intrinsic will be lowered to the call of the abort() function.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
391
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
392 pragma(intrinsic, "llvm.trap")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
393 void llvm_trap();