annotate runtime/import/ldc/intrinsics.di @ 1651:cb960b882ca3 default tip

bindings were moved to dsource.org/projects/bindings/
author Moritz Warning <moritzwarning@web.de>
date Thu, 20 May 2010 20:05:03 +0200
parents 34f2fd925de3
children
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
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
22 //
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
23 // 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
24 //
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
25
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
26
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
27 // The 'llvm.returnaddress' intrinsic attempts to compute a target-specific
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
28 // value indicating the return address of the current function or one of its
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
29 // callers.
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
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 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
32 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
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
35 // The 'llvm.frameaddress' intrinsic attempts to return the target-specific
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
36 // frame pointer value for the specified stack frame.
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
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 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
39 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
40
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
42 // The 'llvm.stacksave' intrinsic is used to remember the current state of the
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
43 // function stack, for use with llvm.stackrestore. This is useful for
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
44 // implementing language features like scoped automatic variable sized arrays
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
45 // in C99.
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
46
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 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
48 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
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
51 // The 'llvm.stackrestore' intrinsic is used to restore the state of the
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
52 // function stack to the state it was in when the corresponding llvm.stacksave
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
53 // intrinsic executed. This is useful for implementing language features like
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
54 // scoped automatic variable sized arrays in C99.
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
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 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
57 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
58
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
60 // The 'llvm.prefetch' intrinsic is a hint to the code generator to insert a
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
61 // prefetch instruction if supported; otherwise, it is a noop. Prefetches have
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
62 // no effect on the behavior of the program but can change its performance
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
63 // characteristics.
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
64
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 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
66 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
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
69 // The 'llvm.pcmarker' intrinsic is a method to export a Program Counter (PC)
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
70 // in a region of code to simulators and other tools. The method is target
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
71 // specific, but it is expected that the marker will use exported symbols to
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
72 // transmit the PC of the marker. The marker makes no guarantees that it will
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
73 // remain with any specific instruction after optimizations. It is possible
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
74 // that the presence of a marker will inhibit optimizations. The intended use
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
75 // is to be inserted after optimizations to allow correlations of simulation
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
76 // runs.
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
77
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 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
79 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
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
82 // The 'llvm.readcyclecounter' intrinsic provides access to the cycle counter
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
83 // register (or similar low latency, high accuracy clocks) on those targets that
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
84 // support it. On X86, it should map to RDTSC. On Alpha, it should map to RPCC.
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
85 // As the backing counters overflow quickly (on the order of 9 seconds on
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
86 // alpha), this should only be used for small timings.
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
87
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 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
89 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
90
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
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
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 //
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 // 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
96 //
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
99 // The 'llvm.memcpy.*' intrinsics copy a block of memory from the source
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
100 // location to the destination location.
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
101 // Note that, unlike the standard libc function, the llvm.memcpy.* intrinsics do
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
102 // not return a value, and takes an extra alignment argument.
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
103
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
104 pragma(intrinsic, "llvm.memcpy.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
105 void llvm_memcpy(T)(void* dst, void* src, T len, uint alignment);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
106
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
107 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
108 alias llvm_memcpy!(uint) llvm_memcpy_i32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
109 alias llvm_memcpy!(ulong) llvm_memcpy_i64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
110 }
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
111
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
113 // The 'llvm.memmove.*' intrinsics move a block of memory from the source
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
114 // location to the destination location. It is similar to the 'llvm.memcpy'
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
115 // intrinsic but allows the two memory locations to overlap.
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
116 // Note that, unlike the standard libc function, the llvm.memmove.* intrinsics
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
117 // do not return a value, and takes an extra alignment argument.
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
118
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
119 pragma(intrinsic, "llvm.memmove.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
120 void llvm_memmove(T)(void* dst, void* src, T len, uint alignment);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
121
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
122 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
123 alias llvm_memmove!(uint) llvm_memmove_i32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
124 alias llvm_memmove!(ulong) llvm_memmove_i64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
125 }
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
126
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
128 // The 'llvm.memset.*' intrinsics fill a block of memory with a particular byte
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
129 // value.
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
130 // Note that, unlike the standard libc function, the llvm.memset intrinsic does
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
131 // not return a value, and takes an extra alignment argument.
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
132
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
133 pragma(intrinsic, "llvm.memset.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
134 void llvm_memset(T)(void* dst, ubyte val, T len, uint alignment);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
135
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
136 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
137 alias llvm_memset!(uint) llvm_memset_i32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
138 alias llvm_memset!(ulong) llvm_memset_i64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
139 }
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
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
141
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
142 // The 'llvm.sqrt' intrinsics return the sqrt of the specified operand,
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
143 // returning the same value as the libm 'sqrt' functions would. Unlike sqrt in
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
144 // libm, however, llvm.sqrt has undefined behavior for negative numbers other
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
145 // than -0.0 (which allows for better optimization, because there is no need to
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
146 // worry about errno being set). llvm.sqrt(-0.0) is defined to return -0.0 like
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
147 // IEEE sqrt.
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
148
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
149 pragma(intrinsic, "llvm.sqrt.f#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
150 T llvm_sqrt(T)(T 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
151
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
152 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
153 alias llvm_sqrt!(float) llvm_sqrt_f32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
154 alias llvm_sqrt!(double) llvm_sqrt_f64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
155 alias llvm_sqrt!(real) llvm_sqrt_f80; // may not actually be .f80
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
156 }
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
157
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
158
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
159 // The 'llvm.sin.*' intrinsics return the sine of the operand.
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
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
161 pragma(intrinsic, "llvm.sin.f#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
162 T llvm_sin(T)(T 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
163
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
164 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
165 alias llvm_sin!(float) llvm_sin_f32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
166 alias llvm_sin!(double) llvm_sin_f64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
167 alias llvm_sin!(real) llvm_sin_f80; // may not actually be .f80
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
168 }
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
169
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
170
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
171 // The 'llvm.cos.*' intrinsics return the cosine of the operand.
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
172
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
173 pragma(intrinsic, "llvm.cos.f#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
174 T llvm_cos(T)(T 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
175
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
176 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
177 alias llvm_cos!(float) llvm_cos_f32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
178 alias llvm_cos!(double) llvm_cos_f64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
179 alias llvm_cos!(real) llvm_cos_f80; // may not actually be .f80
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
180 }
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
181
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
182
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
183 // The 'llvm.powi.*' intrinsics return the first operand raised to the specified
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
184 // (positive or negative) power. The order of evaluation of multiplications is
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
185 // not defined. When a vector of floating point type is used, the second
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
186 // argument remains a scalar integer value.
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
187
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
188 pragma(intrinsic, "llvm.powi.f#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
189 T llvm_powi(T)(T 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
190
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
191 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
192 alias llvm_powi!(float) llvm_powi_f32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
193 alias llvm_powi!(double) llvm_powi_f64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
194 alias llvm_powi!(real) llvm_powi_f80; // may not actually be .f80
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
195 }
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
196
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
197
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
198 // The 'llvm.pow.*' intrinsics return the first operand raised to the specified
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
199 // (positive or negative) 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
200
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
201 pragma(intrinsic, "llvm.pow.f#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
202 T llvm_pow(T)(T val, T 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
203
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
204 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
205 alias llvm_pow!(float) llvm_pow_f32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
206 alias llvm_pow!(double) llvm_pow_f64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
207 alias llvm_pow!(real) llvm_pow_f80; // may not actually be .f80
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 665
diff changeset
208 }
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
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 //
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 // 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
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
215 // The 'llvm.bswap' family of intrinsics is used to byte swap integer values
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
216 // with an even number of bytes (positive multiple of 16 bits). These are
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
217 // useful for performing operations on data that is not in the target's native
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
218 // byte order.
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
219
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
220 pragma(intrinsic, "llvm.bswap.i#.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
221 T llvm_bswap(T)(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
222
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
223 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
224 alias llvm_bswap!(ushort) llvm_bswap_i16;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
225 alias llvm_bswap!(uint) llvm_bswap_i32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
226 alias llvm_bswap!(ulong) llvm_bswap_i64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
227 }
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
228
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
230 // The 'llvm.ctpop' family of intrinsics counts the number of bits set in a
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
231 // value.
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
232
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
233 pragma(intrinsic, "llvm.ctpop.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
234 T llvm_ctpop(T)(T src);
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
235
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
236 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
237 alias llvm_ctpop!(ubyte) llvm_ctpop_i8;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
238 alias llvm_ctpop!(ushort) llvm_ctpop_i16;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
239 alias llvm_ctpop!(uint) llvm_ctpop_i32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
240 alias llvm_ctpop!(ulong) llvm_ctpop_i64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
241 }
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
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
244 // The 'llvm.ctlz' family of intrinsic functions counts the number of leading
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
245 // zeros in a variable.
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
246
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
247 pragma(intrinsic, "llvm.ctlz.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
248 T llvm_ctlz(T)(T src);
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
249
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
250 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
251 alias llvm_ctlz!(ubyte) llvm_ctlz_i8;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
252 alias llvm_ctlz!(ushort) llvm_ctlz_i16;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
253 alias llvm_ctlz!(uint) llvm_ctlz_i32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
254 alias llvm_ctlz!(ulong) llvm_ctlz_i64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
255 }
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
256
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
258 // The 'llvm.cttz' family of intrinsic functions counts the number of trailing
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
259 // zeros.
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
260
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
261 pragma(intrinsic, "llvm.cttz.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
262 T llvm_cttz(T)(T src);
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
263
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
264 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
265 alias llvm_cttz!(ubyte) llvm_cttz_i8;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
266 alias llvm_cttz!(ushort) llvm_cttz_i16;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
267 alias llvm_cttz!(uint) llvm_cttz_i32;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
268 alias llvm_cttz!(ulong) llvm_cttz_i64;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
269 }
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
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
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
272 // The 'llvm.part.select' family of intrinsic functions selects a range of bits
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
273 // from an integer value and returns them in the same bit width as the original
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
274 // value.
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
275
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
276 pragma(intrinsic, "llvm.part.select.i#")
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
277 T llvm_part_select(T)(T val, uint loBit, uint hiBit);
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
278
1079
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
279 deprecated {
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
280 alias llvm_part_select!(ubyte) llvm_part_select_i;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
281 alias llvm_part_select!(ushort) llvm_part_select_i;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
282 alias llvm_part_select!(uint) llvm_part_select_i;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
283 alias llvm_part_select!(ulong) llvm_part_select_i;
4e388d9d0e25 Intrinsics overhaul:
Frits van Bommel <fvbommel wxs.nl>
parents: 1076
diff changeset
284 }
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
285
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
286
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
287 // The 'llvm.part.set' family of intrinsic functions replaces a range of bits
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
288 // in an integer value with another integer value. It returns the integer with
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
289 // the replaced bits.
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
290
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
291 // TODO
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
292 // 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
293 // 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
294
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
295
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
296
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 //
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
299 // 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
300 //
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
301
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
302 // The llvm.memory.barrier intrinsic guarantees ordering between specific
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
303 // pairs of memory access types.
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
304
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
305 pragma(intrinsic, "llvm.memory.barrier")
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
306 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
307
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
308 // This loads a value in memory and compares it to a given value. If they are
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
309 // equal, it stores a new value into the memory.
527
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.cmp.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_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
313
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
314 // This intrinsic loads the value stored in memory at ptr and yields the value
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
315 // from memory. It then stores the value in val in the memory at ptr.
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
316
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
317 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
318 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
319
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
320 // This intrinsic adds delta to the value stored in memory at ptr. It yields
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
321 // the original value at ptr.
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
322
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
323 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
324 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
325
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
326 // This intrinsic subtracts delta to the value stored in memory at ptr. It
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
327 // 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
328
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
329 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
330 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
331
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
332 // These intrinsics bitwise the operation (and, nand, or, xor) delta to the
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
333 // 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
334
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
335 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
336 T llvm_atomic_load_and(T)(T* ptr, T val);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
337
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
338 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
339 T llvm_atomic_load_nand(T)(T* ptr, T val);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
340
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
341 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
342 T llvm_atomic_load_or(T)(T* ptr, T val);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
343
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
344 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
345 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
346
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
347 // These intrinsics takes the signed or unsigned minimum or maximum of delta
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
348 // and the value stored in memory at ptr. It yields the original value at ptr.
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
349
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
350 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
351 T llvm_atomic_load_max(T)(T* ptr, T val);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
352
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
353 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
354 T llvm_atomic_load_min(T)(T* ptr, T val);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
355
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
356 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
357 T llvm_atomic_load_umax(T)(T* ptr, T val);
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
358
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 492
diff changeset
359 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
360 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
361
1001
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
362
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 // ARITHMETIC-WITH-OVERFLOW INTRINSICS
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
365 //
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
366
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
367 struct OverflowRet(T) {
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
368 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
369 T result;
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
370 bool overflow;
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
371 }
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
372
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
373 // Signed and unsigned addition
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
374 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
375 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
376
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
377 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
378 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
379
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
380
1001
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
381 // Signed and unsigned subtraction
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
382 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
383 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
384
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
385 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
386 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
387
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
388
1001
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
389 // Signed and unsigned multiplication
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
390 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
391 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
392
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
393 /* Note: LLVM documentations says:
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
394 * 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
395 * 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
396 *
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
397 * 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
398 */
1359
34f2fd925de3 Intrinsics shouldn't see struct padding, so use a special TargetABI for them
Frits van Bommel <fvbommel wxs.nl>
parents: 1079
diff changeset
399 //pragma(intrinsic, "llvm.umul.with.overflow.i#")
34f2fd925de3 Intrinsics shouldn't see struct padding, so use a special TargetABI for them
Frits van Bommel <fvbommel wxs.nl>
parents: 1079
diff changeset
400 // OverflowRet!(T) llvm_umul_with_overflow(T)(T lhs, T rhs);
1001
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
401
7a0238db1962 Implement support for intrinsics returning struct types
Frits van Bommel <fvbommel wxs.nl>
parents: 741
diff changeset
402
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
403 //
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
404 // 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
405 //
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
406
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
407
1076
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
408 // This intrinsics is lowered to the target dependent trap instruction. If the
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
409 // target does not have a trap instruction, this intrinsic will be lowered to
39b7c32cd010 Reformat intrinsics.di a bit.
Frits van Bommel <fvbommel wxs.nl>
parents: 1075
diff changeset
410 // the call of the abort() function.
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
411
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
412 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
413 void llvm_trap();